From 675f42dc3bcc503b295345726aaeda944a055152 Mon Sep 17 00:00:00 2001 From: vbarkasov Date: Thu, 23 Nov 2017 20:28:23 +0700 Subject: [PATCH] Eavesdrop for queue --- README.md | 4 +- app.js | 91 +++++++++++++++++++++++++++++++++++++ i18n/de-DE.json | 6 +++ i18n/dk-DK.json | 6 +++ i18n/en-NZ.json | 7 ++- i18n/en-US.json | 6 +++ i18n/es-ES.json | 7 +++ i18n/fr-FR.json | 6 +++ i18n/it-IT.json | 6 +++ i18n/nl-NL.json | 6 +++ i18n/pt-PT.json | 6 +++ i18n/ro-RO.json | 6 +++ i18n/ru-RU.json | 6 +++ i18n/zh-CN.json | 6 +++ style/app.scss | 55 +++++++++++++++++++++- views/agents_dashboard.html | 6 ++- views/eavesdrop_popup.html | 18 ++++++++ views/queues_dashboard.html | 82 +++++++++++++++++---------------- 18 files changed, 284 insertions(+), 46 deletions(-) create mode 100644 views/eavesdrop_popup.html diff --git a/README.md b/README.md index 6b54219..a57639e 100644 --- a/README.md +++ b/README.md @@ -16,15 +16,13 @@ Installation 2. Add next strings to `js/lib/jquery.kazoosdk.js` after string `methodsGenerator = {` ```javascript queues: { - 'queue_eavesdrop': { 'verb': 'PUT', 'url': 'accounts/{accountId}/queues/{queueId}/eavesdrop' }, - 'call_eavesdrop': { 'verb': 'PUT', 'url': 'accounts/{accountId}/queues/eavesdrop' }, 'queues_list': { 'verb': 'GET', 'url': 'accounts/{accountId}/queues' }, 'queues_create': { 'verb': 'PUT', 'url': 'accounts/{accountId}/queues' }, 'queues_get': { 'verb': 'GET', 'url': 'accounts/{accountId}/queues/{queuesId}' }, 'queues_update': { 'verb': 'POST', 'url': 'accounts/{accountId}/queues/{queuesId}' }, 'queues_delete': { 'verb': 'DELETE', 'url': 'accounts/{accountId}/queues/{queuesId}' }, 'queues_stats': { 'verb': 'GET', 'url': 'accounts/{accountId}/queues/stats' } - }, + }, agents: { 'agents_stats': { 'verb': 'GET', 'url': 'accounts/{accountId}/agents/stats' }, 'agents_status': { 'verb': 'GET', 'url': 'accounts/{accountId}/agents/status' }, diff --git a/app.js b/app.js index 0695304..23481cc 100644 --- a/app.js +++ b/app.js @@ -39,6 +39,14 @@ var app = { url: 'accounts/{accountId}/agents/{agentId}/status', verb: 'POST' }*/ + 'callcenter.queue.eavesdrop': { + 'verb': 'PUT', + 'url': 'accounts/{accountId}/queues/{queueId}/eavesdrop' + }, + 'callcenter.call.eavesdrop': { + 'verb': 'PUT', + 'url': 'accounts/{accountId}/queues/eavesdrop' + } }, load: function(callback){ @@ -143,6 +151,66 @@ var app = { } }); }, + + showEavesdropPopup: function(mode, data) { + var self = this; + + self.callApi({ + resource: 'device.list', + data: { + accountId: self.accountId, + generateError: false + }, + success: function (devices) { + var popup_html = $(monster.template(self, 'eavesdrop_popup', { + devices: devices.data + })); + + var i18n = self.i18n.active(); + + $('#ring', popup_html).click(function(e) { + e.preventDefault(); + + var requestData = { + accountId: self.accountId, + generateError: false, + data: { + id: $('#object-selector', popup_html).val() + } + }; + + if(mode === 'call') { + requestData.data.call_id = data.call_id; + } else if(mode === 'queue') { + requestData.queueId = data.queue_id; + } + + monster.request({ + resource: 'callcenter.' + mode + '.eavesdrop', + data: requestData, + success: function (devices) { + popup.dialog('close'); + }, + error: function() { + // monster.ui.alert('Eavesdrop failed'); + console.log(i18n.callcenter.eavesdrop_request_failed); + } + }); + }); + + $('#cancel', popup_html).click(function(e) { + e.preventDefault(); + popup.dialog('close'); + }); + + var popup = monster.ui.dialog(popup_html, { + title: i18n.callcenter.select_the_device, + width: '450px' + }); + } + }); + }, + /* listDevices: function (callback) { var self = this; @@ -1445,6 +1513,29 @@ var app = { } }); + $('.js-agent-item .js-eavesdrop', container).on('click', function(e) { + e.preventDefault(); + e.stopPropagation(); + + var data = { + call_id: $(this).data('call_id') + }; + + self.showEavesdropPopup('call', data); + }); + + + $('.list_queues li .js-eavesdrop', container).on('click', function(e) { + e.preventDefault(); + e.stopPropagation(); + + var data = { + queue_id: $(this).closest('li').attr('id') + }; + + self.showEavesdropPopup('queue', data); + }); + $('.js-login-to-queue', container).click(function(e) { e.preventDefault(); diff --git a/i18n/de-DE.json b/i18n/de-DE.json index 9152261..d698bcc 100644 --- a/i18n/de-DE.json +++ b/i18n/de-DE.json @@ -20,6 +20,12 @@ "devices_title": "Geräte", "hide_queues_html": "Warteräume ausblenden", "show_queues_html": "Warteräume anzeigen", + "eavesdropTooltip": "Eavesdrop", + "eavesdropPopup": { + "deviceLabel": "Device", + "callBtnText": "klingeln", + "cancelBtnText": "Abbrechen" + }, "settings": { "sidebar": { "title": "Queues" diff --git a/i18n/dk-DK.json b/i18n/dk-DK.json index ebb631c..aba3695 100644 --- a/i18n/dk-DK.json +++ b/i18n/dk-DK.json @@ -21,6 +21,12 @@ "devices_title": "Devices", "hide_queues_html": "Hide Queues", "show_queues_html": "Show Queues", + "eavesdropTooltip": "Eavesdrop", + "eavesdropPopup": { + "deviceLabel": "Device", + "callBtnText": "Call", + "cancelBtnText": "Cancel" + }, "settings": { "sidebar": { "title": "Queues" diff --git a/i18n/en-NZ.json b/i18n/en-NZ.json index e78bbbe..aba3695 100644 --- a/i18n/en-NZ.json +++ b/i18n/en-NZ.json @@ -21,6 +21,12 @@ "devices_title": "Devices", "hide_queues_html": "Hide Queues", "show_queues_html": "Show Queues", + "eavesdropTooltip": "Eavesdrop", + "eavesdropPopup": { + "deviceLabel": "Device", + "callBtnText": "Call", + "cancelBtnText": "Cancel" + }, "settings": { "sidebar": { "title": "Queues" @@ -33,7 +39,6 @@ "noDataText": "None", "actionsColumnHeader": "Add", "userNameColumnHeader": "User Name" - }, "queuePanel": { "title": "Queue settings", diff --git a/i18n/en-US.json b/i18n/en-US.json index ebb631c..aba3695 100644 --- a/i18n/en-US.json +++ b/i18n/en-US.json @@ -21,6 +21,12 @@ "devices_title": "Devices", "hide_queues_html": "Hide Queues", "show_queues_html": "Show Queues", + "eavesdropTooltip": "Eavesdrop", + "eavesdropPopup": { + "deviceLabel": "Device", + "callBtnText": "Call", + "cancelBtnText": "Cancel" + }, "settings": { "sidebar": { "title": "Queues" diff --git a/i18n/es-ES.json b/i18n/es-ES.json index 1b6dec0..40697af 100644 --- a/i18n/es-ES.json +++ b/i18n/es-ES.json @@ -14,11 +14,18 @@ "which_device": "Which device?", "ring": "Ring", "cancel": "Cancel", + "call_waiting": "Call Waiting", "call_waiting_log": "Call Waiting Log...", "eavesdrop_request_failed": "Eavesdrop Request failed. Error #", "devices_title": "Devices", "hide_queues_html": "Hide Queues", "show_queues_html": "Show Queues", + "eavesdropTooltip": "Eavesdrop", + "eavesdropPopup": { + "deviceLabel": "Device", + "callBtnText": "Call", + "cancelBtnText": "Cancel" + }, "settings": { "sidebar": { "title": "Queues" diff --git a/i18n/fr-FR.json b/i18n/fr-FR.json index 1b6dec0..30832e4 100644 --- a/i18n/fr-FR.json +++ b/i18n/fr-FR.json @@ -19,6 +19,12 @@ "devices_title": "Devices", "hide_queues_html": "Hide Queues", "show_queues_html": "Show Queues", + "eavesdropTooltip": "Eavesdrop", + "eavesdropPopup": { + "deviceLabel": "Device", + "callBtnText": "Call", + "cancelBtnText": "Cancel" + }, "settings": { "sidebar": { "title": "Queues" diff --git a/i18n/it-IT.json b/i18n/it-IT.json index 1b6dec0..30832e4 100644 --- a/i18n/it-IT.json +++ b/i18n/it-IT.json @@ -19,6 +19,12 @@ "devices_title": "Devices", "hide_queues_html": "Hide Queues", "show_queues_html": "Show Queues", + "eavesdropTooltip": "Eavesdrop", + "eavesdropPopup": { + "deviceLabel": "Device", + "callBtnText": "Call", + "cancelBtnText": "Cancel" + }, "settings": { "sidebar": { "title": "Queues" diff --git a/i18n/nl-NL.json b/i18n/nl-NL.json index 7a17342..7a0790f 100644 --- a/i18n/nl-NL.json +++ b/i18n/nl-NL.json @@ -19,6 +19,12 @@ "devices_title": "Devices", "hide_queues_html": "Verberg Queues", "show_queues_html": "Toon Queues", + "eavesdropTooltip": "Eavesdrop", + "eavesdropPopup": { + "deviceLabel": "Device", + "callBtnText": "Call", + "cancelBtnText": "Cancel" + }, "settings": { "sidebar": { "title": "Queues" diff --git a/i18n/pt-PT.json b/i18n/pt-PT.json index ebb631c..aba3695 100644 --- a/i18n/pt-PT.json +++ b/i18n/pt-PT.json @@ -21,6 +21,12 @@ "devices_title": "Devices", "hide_queues_html": "Hide Queues", "show_queues_html": "Show Queues", + "eavesdropTooltip": "Eavesdrop", + "eavesdropPopup": { + "deviceLabel": "Device", + "callBtnText": "Call", + "cancelBtnText": "Cancel" + }, "settings": { "sidebar": { "title": "Queues" diff --git a/i18n/ro-RO.json b/i18n/ro-RO.json index e78bbbe..c5f3003 100644 --- a/i18n/ro-RO.json +++ b/i18n/ro-RO.json @@ -21,6 +21,12 @@ "devices_title": "Devices", "hide_queues_html": "Hide Queues", "show_queues_html": "Show Queues", + "eavesdropTooltip": "Eavesdrop", + "eavesdropPopup": { + "deviceLabel": "Device", + "callBtnText": "Call", + "cancelBtnText": "Cancel" + }, "settings": { "sidebar": { "title": "Queues" diff --git a/i18n/ru-RU.json b/i18n/ru-RU.json index 6d3edff..6e29298 100644 --- a/i18n/ru-RU.json +++ b/i18n/ru-RU.json @@ -19,6 +19,12 @@ "devices_title": "Устройства", "hide_queues_html": "Скрыть очереди", "show_queues_html": "Показать очереди", + "eavesdropTooltip": "Eavesdrop", + "eavesdropPopup": { + "deviceLabel": "Device", + "callBtnText": "Call", + "cancelBtnText": "Cancel" + }, "settings": { "sidebar": { "title": "Очереди" diff --git a/i18n/zh-CN.json b/i18n/zh-CN.json index e7da84a..b6e551e 100644 --- a/i18n/zh-CN.json +++ b/i18n/zh-CN.json @@ -19,6 +19,12 @@ "devices_title": "设备", "hide_queues_html": "隐藏队列", "show_queues_html": "显示队列", + "eavesdropTooltip": "Eavesdrop", + "eavesdropPopup": { + "deviceLabel": "Device", + "callBtnText": "Call", + "cancelBtnText": "Cancel" + }, "settings": { "sidebar": { "title": "Queues" diff --git a/style/app.scss b/style/app.scss index fd23c67..4aeee6a 100644 --- a/style/app.scss +++ b/style/app.scss @@ -11,6 +11,33 @@ } } +.callcenter-dialog-body { + padding: 20px 20px 30px; + + form { + margin-bottom: 0; + } + + .buttons-wrapper { + padding-top: 10px; + text-align: center; + } + + .buttons-wrapper .btn { + margin-right: 10px; + } +} + +.eavesdrop-dialog-body { + .form-horizontal .control-label { + width: 100px; + } + + .form-horizontal .controls { + margin-left: 115px; + } +} + #dashboard-content #dashboard-topbar .settings-bar { background: #B1AFAF; cursor: pointer; @@ -90,7 +117,7 @@ margin: 0; } -#dashboard-content #dashboard-topbar .topbar-right .list_queues .list_queues_inner > li{ +#dashboard-content #dashboard-topbar .topbar-right .list_queues .list_queues_inner > li { width: 151px; height: 200px; list-style-type: none; @@ -100,6 +127,11 @@ cursor: pointer; } +#dashboard-content #dashboard-topbar .topbar-right .list_queues .list_queues_inner > li.active .eavesdrop_queue, +#dashboard-content #dashboard-topbar .topbar-right .list_queues .list_queues_inner > li.active .edit_queue { + display: inline-block !important; +} + #dashboard-content #dashboard-topbar .topbar-right .list_queues .list_queues_inner > li.active, #dashboard-content #dashboard-topbar .topbar-right .list_queues .list_queues_inner > li:hover { background: #E3E3E3; } @@ -129,6 +161,27 @@ white-space: nowrap; } +#dashboard-content #dashboard-topbar .topbar-right .list_queues .list_queues_inner > li .box_title_text { + width: 100%; + display: inline-block; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + vertical-align: top; +} + +#dashboard-content #dashboard-topbar .topbar-right .list_queues .list_queues_inner > li.active .box_title_text { + width: 78px; +} + +#dashboard-content #dashboard-topbar .topbar-right .list_queues .list_queues_inner > li .box_title .btn { + width: 19px; + padding: 2px 3px 3px 3px; + height: 18px; + text-align: center; + display: none; +} + #dashboard-content #dashboard-topbar .topbar-right .list_queues .list_queues_inner > li .box { float: left; width: 65px; diff --git a/views/agents_dashboard.html b/views/agents_dashboard.html index 7485bc2..e9a6199 100644 --- a/views/agents_dashboard.html +++ b/views/agents_dashboard.html @@ -1,7 +1,7 @@
{{#each agents}} -
+
{{first_name}} {{last_name}} @@ -42,7 +42,9 @@ {{#compare status "===" 'handling'}} {{#if current_call}}
{{ ../../i18n.callcenter.current_call }}
- + + + {{else}}
{{ ../../i18n.callcenter.no_active_call }}
{{/if}} diff --git a/views/eavesdrop_popup.html b/views/eavesdrop_popup.html new file mode 100644 index 0000000..7614a81 --- /dev/null +++ b/views/eavesdrop_popup.html @@ -0,0 +1,18 @@ +
+
+
+ +
+ +
+
+
+ + +
+
+
\ No newline at end of file diff --git a/views/queues_dashboard.html b/views/queues_dashboard.html index 627010e..b91e42d 100644 --- a/views/queues_dashboard.html +++ b/views/queues_dashboard.html @@ -1,41 +1,45 @@
-
-
    - {{#each queues}} -
  • -
    - - {{name}} - -
    -
    -
    -
    -
    -
    - {{current_calls}} / {{total_calls}} -
    -
    -
    -
    -
    - {{current_agents}} / {{max_agents}} -
    -
    -
    -
    -
    -
    -
    {{abandoned_calls}}
    -
    -
    -
    -
    {{average_hold_time}}
    -
    -
    -
    -
  • - {{/each}} -
-
+
+
    + {{#each queues}} +
  • +
    + + {{name}} + +
    +
    +
    +
    +
    +
    + {{current_calls}} / {{total_calls}} +
    +
    +
    +
    +
    + {{current_agents}} / {{max_agents}} +
    +
    +
    +
    +
    +
    +
    {{abandoned_calls}}
    +
    +
    +
    +
    {{average_hold_time}}
    +
    +
    +
    +
  • + {{/each}} +
+