The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/packages/rocketchat-livechat/.app/client/views/options.js

43 lines
1.1 KiB

/* globals Department, Livechat */
import { Meteor } from 'meteor/meteor';
import { Template } from 'meteor/templating';
import swal from 'sweetalert2';
import visitor from '../../imports/client/visitor';
Template.options.helpers({
showDepartments() {
return Livechat.allowSwitchingDepartments && Department.find({ showOnRegistration: true }).count() > 1;
},
departments() {
return Department.find({ showOnRegistration: true });
},
selectedDepartment() {
return this._id === Livechat.department;
},
});
Template.options.events({
'click .end-chat'() {
swal({
text: t('Are_you_sure_do_you_want_end_this_chat'),
title: '',
type: 'warning',
showCancelButton: true,
confirmButtonColor: '#DD6B55',
confirmButtonText: t('Yes'),
cancelButtonText: t('No'),
html: false,
}).then((result) => {
if (result.value) {
Meteor.call('livechat:closeByVisitor', { roomId: visitor.getRoom(), token: visitor.getToken() }, (error) => {
if (error) {
return console.log('Error ->', error);
}
});
}
});
},
'click .switch-department'() {
Livechat.showSwitchDepartmentForm = true;
},
});