Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions app/livechat/client/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ AccountBox.addRoute({
sideNav: 'livechatFlex',
i18nPageTitle: 'Edit_Department',
pageTemplate: 'livechatDepartmentForm',
customContainer: true,
}, livechatManagerRoutes, load);

AccountBox.addRoute({
Expand All @@ -79,6 +80,7 @@ AccountBox.addRoute({
sideNav: 'livechatFlex',
i18nPageTitle: 'New_Department',
pageTemplate: 'livechatDepartmentForm',
customContainer: true,
}, livechatManagerRoutes, load);

AccountBox.addRoute({
Expand Down
2 changes: 0 additions & 2 deletions app/livechat/client/stylesheets/livechat.less
Original file line number Diff line number Diff line change
Expand Up @@ -548,12 +548,10 @@
flex: 0 0 auto;
margin-top: 26px;
padding-left: 30px;
border-left: 1px solid #cccccc;

& > .rc-button__group {
margin: 0 5px;
}

}

.livechat-current-chats-tag-filter-wrapper {
Expand Down
2 changes: 1 addition & 1 deletion app/livechat/client/views/app/livechatCurrentChats.html
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
</div>

<div class="form-group">
<button class="rc-button rc-button--secondary add-filter-button livechat-current-chats-add-filter-button">{{> icon icon="plus" }}</button>
<button type="button" class="rc-button rc-button--secondary add-filter-button livechat-current-chats-add-filter-button">{{> icon icon="plus" }}</button>
</div>
</div>

Expand Down
280 changes: 146 additions & 134 deletions app/livechat/client/views/app/livechatDepartmentForm.html
Original file line number Diff line number Diff line change
@@ -1,148 +1,160 @@
<template name="livechatDepartmentForm">
{{#requiresPermission 'view-livechat-departments'}}
<form id="department-form" data-id="{{department._id}}">
<div class="rocket-form">
{{#if Template.subscriptionsReady}}
<fieldset>
{{#requiresPermission 'manage-livechat-departments'}}
<div class="input-line">
<label>{{_ "Enabled"}}</label>
<div>
<label><input type="radio" name="enabled" value="1" checked="{{$eq department.enabled true}}" /> {{_ "Yes"}}</label>
<label><input type="radio" name="enabled" value="0" checked="{{$eq department.enabled false}}" /> {{_ "No"}}</label>
</div>
</div>
<div class="input-line">
<label>{{_ "Name"}}</label>
<div>
<input type="text" class="rc-input__element" name="name" value="{{department.name}}" placeholder="{{_ "Name"}}" />
</div>
</div>
<div class="input-line">
<label>{{_ "Description"}}</label>
<div>
<textarea name="description" class="rc-input__element" rows="6">{{department.description}}</textarea>
</div>
</div>
<div class="input-line">
<label>{{_ "Show_on_registration_page"}}</label>
<div>
<label><input type="radio" name="showOnRegistration" value="1" checked="{{showOnRegistration true}}" /> {{_ "Yes"}}</label>
<label><input type="radio" name="showOnRegistration" value="0" checked="{{showOnRegistration false}}" /> {{_ "No"}}</label>
</div>
</div>
<div class="input-line">
<label>{{_ "Email"}}</label>
<div>
<input type="email" class="rc-input__element" name="email" value="{{department.email}}" placeholder="{{_ "Email"}}" />
</div>
</div>
<div class="input-line">
<label>{{_ "Show_on_offline_page"}}</label>
<div>
<label><input type="radio" name="showOnOfflineForm" value="1" checked="{{showOnOfflineForm true}}" /> {{_ "Yes"}}</label>
<label><input type="radio" name="showOnOfflineForm" value="0" checked="{{showOnOfflineForm false}}" /> {{_ "No"}}</label>
</div>
</div>
<div class="input-line">
<label>{{_ "Request_tag_before_closing_chat"}}</label>
<div>
<label><input type="radio" name="requestTagBeforeClosingChat" value="1" checked="{{$eq requestTagBeforeClosingChat true}}" /> {{_ "Yes"}}</label>
<label><input type="radio" name="requestTagBeforeClosingChat" value="0" checked="{{$eq requestTagBeforeClosingChat false}}" /> {{_ "No"}}</label>
</div>
</div>
{{#if customFieldsTemplate}}
{{> Template.dynamic template=customFieldsTemplate data=data }}
{{/if}}

{{#requiresPermission 'add-livechat-department-agents'}}
<hr />
{{else}}
{{/requiresPermission}}
{{else}}
<legend>{{department.name}}</legend>
{{/requiresPermission}}

{{#requiresPermission 'add-livechat-department-agents'}}
<h2>{{_ "Agents"}}</h2>

<div class="main-content-flex">
<section class="page-container flex-tab-main-content">
{{> header sectionName=i18nPageTitle}}
<div class="content">
<form id="department-form" data-id="{{department._id}}">
<div class="rocket-form">
{{#if Template.subscriptionsReady}}
<fieldset>
<label>{{_ "Add_agent"}}</label>
<div class="input-line form-inline">
<div class="form-group">
{{> livechatAutocompleteUser
onClickTag=onClickTagAgents
list=selectedAgents
onSelect=onSelectAgents
collection='UserAndRoom'
subscription='userAutocomplete'
field='username'
sort='username'
label="Search_by_username"
placeholder="Search_by_username"
name="username"
exceptions=exceptionsAgents
icon="at"
noMatchTemplate="userSearchEmpty"
templateItem="popupList_item_default"
modifier=agentModifier
conditions=agentConditions
}}
{{#requiresPermission 'manage-livechat-departments'}}
<div class="input-line">
<label>{{_ "Enabled"}}</label>
<div>
<label><input type="radio" name="enabled" value="1" checked="{{$eq department.enabled true}}" /> {{_ "Yes"}}</label>
<label><input type="radio" name="enabled" value="0" checked="{{$eq department.enabled false}}" /> {{_ "No"}}</label>
</div>
</div>
<div class="form-group">
<button name="add" class="rc-button rc-button--primary add-agent">{{_ "Add"}}</button>
<div class="input-line">
<label>{{_ "Name"}}</label>
<div>
<input type="text" class="rc-input__element" name="name" value="{{department.name}}" placeholder="{{_ "Name"}}" />
</div>
</div>
</div>
</fieldset>
<div class="input-line">
<label>{{_ "Description"}}</label>
<div>
<textarea name="description" class="rc-input__element" rows="6">{{department.description}}</textarea>
</div>
</div>
<div class="input-line">
<label>{{_ "Show_on_registration_page"}}</label>
<div>
<label><input type="radio" name="showOnRegistration" value="1" checked="{{showOnRegistration true}}" /> {{_ "Yes"}}</label>
<label><input type="radio" name="showOnRegistration" value="0" checked="{{showOnRegistration false}}" /> {{_ "No"}}</label>
</div>
</div>
<div class="input-line">
<label>{{_ "Email"}}</label>
<div>
<input type="email" class="rc-input__element" name="email" value="{{department.email}}" placeholder="{{_ "Email"}}" />
</div>
</div>
<div class="input-line">
<label>{{_ "Show_on_offline_page"}}</label>
<div>
<label><input type="radio" name="showOnOfflineForm" value="1" checked="{{showOnOfflineForm true}}" /> {{_ "Yes"}}</label>
<label><input type="radio" name="showOnOfflineForm" value="0" checked="{{showOnOfflineForm false}}" /> {{_ "No"}}</label>
</div>
</div>
<div class="input-line">
<label>{{_ "Request_tag_before_closing_chat"}}</label>
<div>
<label><input type="radio" name="requestTagBeforeClosingChat" value="1" checked="{{$eq requestTagBeforeClosingChat true}}" /> {{_ "Yes"}}</label>
<label><input type="radio" name="requestTagBeforeClosingChat" value="0" checked="{{$eq requestTagBeforeClosingChat false}}" /> {{_ "No"}}</label>
</div>
</div>
{{#if customFieldsTemplate}}
{{> Template.dynamic template=customFieldsTemplate data=data }}
{{/if}}

<fieldset>
<legend>{{_ "Selected_agents"}}</legend>
{{#requiresPermission 'add-livechat-department-agents'}}
<hr />
{{else}}
{{/requiresPermission}}
{{else}}
<legend>{{department.name}}</legend>
{{/requiresPermission}}

{{#requiresPermission 'add-livechat-department-agents'}}
<h2>{{_ "Agents"}}</h2>

<fieldset>
<label>{{_ "Add_agent"}}</label>
<div class="input-line form-inline">
<div class="form-group">
{{> livechatAutocompleteUser
onClickTag=onClickTagAgents
list=selectedAgents
onSelect=onSelectAgents
collection='UserAndRoom'
subscription='userAutocomplete'
field='username'
sort='username'
label="Search_by_username"
placeholder="Search_by_username"
name="username"
exceptions=exceptionsAgents
icon="at"
noMatchTemplate="userSearchEmpty"
templateItem="popupList_item_default"
modifier=agentModifier
conditions=agentConditions
}}
</div>
<div class="form-group">
<button name="add" class="rc-button rc-button--primary add-agent">{{_ "Add"}}</button>
</div>
</div>
</fieldset>

<div class="rc-table-content">
{{#table fixed='true'}}
<thead>
<tr>
<th width="25%"><div class="table-fake-th">{{_ "Username"}}</div></th>
<th><div class="table-fake-th">{{_ "Count"}}</div></th>
<th><div class="table-fake-th">{{_ "Order"}}</div></th>
<th width="40px">&nbsp;</th>
</tr>
</thead>
<tbody>
{{#each departmentAgents}}
<tr class="agent-info">
<td>
<div class="rc-table-wrapper">
<div class="rc-table-info">
<span class="rc-table-title">{{username}}</span>
</div>
</div>
</td>
<td><input type="text" class="count-{{agentId}}" name="count" value="{{count}}" size="3"></td>
<td><input type="text" class="order-{{agentId}}" name="order" value="{{order}}" size="3"></td>
<td><a href="#remove" class="remove-agent"><i class="icon-trash"></i></a></td>
</tr>
{{else}}
<tr>
<td colspan="4">{{_ "There_are_no_agents_added_to_this_department_yet"}}</td>
</tr>
{{/each}}
</tbody>
{{/table}}
</div>
<fieldset>
<legend>{{_ "Selected_agents"}}</legend>

<div class="rc-table-content">
{{#table fixed='true'}}
<thead>
<tr>
<th width="25%"><div class="table-fake-th">{{_ "Username"}}</div></th>
<th><div class="table-fake-th">{{_ "Count"}}</div></th>
<th><div class="table-fake-th">{{_ "Order"}}</div></th>
<th width="40px">&nbsp;</th>
</tr>
</thead>
<tbody>
{{#each departmentAgents}}
<tr class="agent-info">
<td>
<div class="rc-table-wrapper">
<div class="rc-table-info">
<span class="rc-table-title">{{username}}</span>
</div>
</div>
</td>
<td><input type="text" class="count-{{agentId}}" name="count" value="{{count}}" size="3"></td>
<td><input type="text" class="order-{{agentId}}" name="order" value="{{order}}" size="3"></td>
<td><a href="#remove" class="remove-agent"><i class="icon-trash"></i></a></td>
</tr>
{{else}}
<tr>
<td colspan="4">{{_ "There_are_no_agents_added_to_this_department_yet"}}</td>
</tr>
{{/each}}
</tbody>
{{/table}}
</div>

</fieldset>
{{else}}
{{/requiresPermission}}
</fieldset>
<div class="rc-button__group">
<button class="rc-button back" type="button"><i class="icon-left-big"></i><span>{{_ "Back"}}</span></button>
<button class="rc-button rc-button--primary save"><i class="icon-floppy"></i><span>{{_ "Save"}}</span></button>
</div>
{{else}}
{{/requiresPermission}}
</fieldset>
<div class="rc-button__group">
<button class="rc-button back" type="button"><i class="icon-left-big"></i><span>{{_ "Back"}}</span></button>
<button class="rc-button rc-button--primary save"><i class="icon-floppy"></i><span>{{_ "Save"}}</span></button>
{{> loading}}
{{/if}}
</div>
{{else}}
{{> loading}}
{{/if}}
</form>
</div>
</form>
</section>
{{#if tabBarVisible}}
{{#with flexData}}
{{> flexTabBar}}
{{/with}}
{{/if}}
</div>
{{/requiresPermission}}
</template>
15 changes: 15 additions & 0 deletions app/livechat/client/views/app/livechatDepartmentForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { Template } from 'meteor/templating';
import _ from 'underscore';
import toastr from 'toastr';

import { TabBar, RocketChatTabBar } from '../../../../ui-utils';
import { t, handleError } from '../../../../utils';
import { hasPermission } from '../../../../authorization';
import { getCustomFormTemplate } from './customTemplates/register';
Expand Down Expand Up @@ -67,6 +68,17 @@ Template.livechatDepartmentForm.helpers({
onClickTagAgents() {
return Template.instance().onClickTagAgents;
},
flexData() {
return {
tabBar: Template.instance().tabBar,
data: Template.instance().tabBarData.get(),
};
},
tabBarVisible() {
return Object.values(TabBar.buttons.get())
.some((button) => button.groups
.some((group) => group.startsWith('livechat-department')));
},
});

Template.livechatDepartmentForm.events({
Expand Down Expand Up @@ -184,6 +196,9 @@ Template.livechatDepartmentForm.onCreated(async function() {
this.department = new ReactiveVar({ enabled: true });
this.departmentAgents = new ReactiveVar([]);
this.selectedAgents = new ReactiveVar([]);
this.tabBar = new RocketChatTabBar();
this.tabBar.showGroup(FlowRouter.current().route.name);
this.tabBarData = new ReactiveVar();

this.onSelectAgents = ({ item: agent }) => {
this.selectedAgents.set([agent]);
Expand Down
20 changes: 16 additions & 4 deletions app/livechat/client/views/app/livechatRoomTagSelector.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
<template name="livechatRoomTagSelector">
<div class="rc-input__wrapper">
<input autocomplete="off" type="text" placeholder="{{_ "Tags"}}" class="rc-input__element" name="tags">
</div>
</template>
{{#if hasAvailableTags}}
<div class="rc-select">
<select class="rc-select__element" name="tags">
<option class="rc-select__option" value="">{{_ "All"}}</option>
{{#each availableTags}}
<option class="rc-select__option" value="{{name}}">{{name}}</option>
{{/each}}
</select>
{{> icon block="rc-select__arrow" icon="arrow-down" }}
</div>
{{else}}
<div class="rc-input__wrapper">
<input autocomplete="off" type="text" placeholder="{{_ "Tags"}}" class="rc-input__element" name="tags">
</div>
{{/if}}
</template>
Loading