diff --git a/src/apps/callflows/i18n/en-US.json b/src/apps/callflows/i18n/en-US.json index 1d625f8..ca1c9d4 100644 --- a/src/apps/callflows/i18n/en-US.json +++ b/src/apps/callflows/i18n/en-US.json @@ -1446,7 +1446,7 @@ "basic": "Basic", "advanced": "Advanced", "options": "Options", - "name": "Name", + "namePlaceholder": "Name", "nameDataContent": "Friendly name for this Queue", "noName": "no name", @@ -1466,7 +1466,32 @@ "save": "Save", "thereIsCurrentlyNoUser": "There is currently no user in this queue", "userLabel": "Users list", - "selectQueue": "Select Queue" + "selectQueue": "Select Queue", + + "agent_ring_timeout": "In seconds, how long to ring an agent before progressing to the next agent available", + "agent_wrapup_time": "Pre-defined wait period applied after an agent handles a customer call", + "announce": "Media to play when caller is about to be connected.", + "announcements.interval": "Time between announcements", + "announcements.media.in_the_queue": "Played after the numeric position", + "announcements.media.increase_in_call_volume": "Played if the estimated wait time has increased since the previous wait time announcement", + "announcements.media.the_estimated_wait_time_is": "Played before the estimated wait time media", + "announcements.media.you_are_at_position": "Played before the numeric position", + "announcements.media": "Custom prompts to be played for the announcements", + "announcements.position_announcements_enabled": "Whether announcements of the caller's position in the queue should be played", + "announcements.wait_time_announcements_enabled": "Whether announcements of the estimated wait time in the queue should be played", + "announcements": "Configuration for periodic announcements to callers waiting in the queue", + "caller_exit_key": "Key caller can press while on hold to exit the queue and continue in the callflow", + "cdr_url": "An optional HTTP URL to POST the CDR", + "connection_timeout": "In seconds, how long to try to connect the caller before progressing past the queue callflow action", + "enter_when_empty": "Allows a caller to enter a queue and wait when no agents are available", + "max_priority": "Maximum possible priority level queue will support. Can not be redefined for existing queue.", + "max_queue_size": "How many callers are allowed to wait on hold in the queue (0 for no limit)", + "moh": "Media to play while caller is on hold.", + "name": "A friendly name for the queue", + "record_caller": "When enabled, a caller's audio will be recorded", + "recording_url": "An optional HTTP URL to PUT the call recording after the call ends (and should respond to GET for retrieving the audio data)", + "ring_simultaneously": "The number of agents to try in parallel when connecting a caller", + "strategy": "The queue strategy for connecting agents to callers" }, "introTitle": "What is Callflow?", "introDescription": "A callflow defines what happens when someone dials an extension or phone number.", diff --git a/src/apps/callflows/submodules/callcenter/callcenter.js b/src/apps/callflows/submodules/callcenter/callcenter.js index 980617c..3d79321 100644 --- a/src/apps/callflows/submodules/callcenter/callcenter.js +++ b/src/apps/callflows/submodules/callcenter/callcenter.js @@ -376,9 +376,8 @@ define(function(require) { target = args.target || $('#queue-view', parent), _callbacks = args.callbacks || {}, callbacks = { - save_success: _callbacks.save_success || function(_data) { + save_success: _callbacks.save_success || function (_data) { self.queueRenderList(parent); - self.queueEdit({ data: { id: _data.data.id @@ -388,58 +387,85 @@ define(function(require) { callbacks: callbacks }); }, - save_error: _callbacks.save_error, - - delete_success: _callbacks.delete_success || function() { + delete_success: _callbacks.delete_success || function () { target.empty(); self.queueRenderList(parent); }, - delete_error: _callbacks.delete_error, - after_render: _callbacks.after_render }, defaults = { - data: $.extend(true, { - connection_timeout: '300', - member_timeout: '5' - /* caller_exit_key: '#' */ - }, args.data_defaults || {}), + data: {}, field_data: { sort_by: { 'first_name': self.i18n.active().callflows.callcenter.first_name, 'last_name': self.i18n.active().callflows.callcenter.last_name } } - }; + } - self.getUsersList(function(users) { - defaults.field_data.users = users; + monster.parallel({ + media_list: function (callback) { + self.callApi({ + resource: 'media.list', + data: { + accountId: self.accountId, + filters: { + paginate: false + } + }, + success: function (mediaList, status) { + _.each(mediaList.data, function (media) { + if (media.media_source) { + media.name = '[' + media.media_source.substring(0, 3).toUpperCase() + '] ' + media.name; + } + }); - if (typeof data === 'object' && data.id) { - self.queueGet(data.id, function(queueData) { - var render_data = $.extend(true, defaults, queueData); + mediaList.data.unshift({ + id: '', + name: self.i18n.active().callflows.menu.not_set + }); + + defaults.field_data.media = mediaList.data; - render_data.field_data.old_list = []; - if ('agents' in queueData.data) { - render_data.field_data.old_list = queueData.data.agents; + callback(null, mediaList); } - self.queueRender(render_data, target, callbacks); + }); + }, + user_list: function (callback) { + self.getUsersList(function (users) { + defaults.field_data.users = users; - if (typeof (callbacks.after_render) === 'function') { - callbacks.after_render(); + if (typeof data === 'object' && data.id) { + self.queueGet(data.id, function (queueData) { + var render_data = $.extend(true, defaults, queueData); + + render_data.field_data.old_list = []; + if ('agents' in queueData.data) { + render_data.field_data.old_list = queueData.data.agents; + } + + callback(null, {}); + }); } }); - } else { - self.queueRender(defaults, target, callbacks); + } + }, function (err, results) { + let render_data = defaults; + if (typeof data === 'object' && data.id) { + render_data = $.extend(true, defaults, results.user_list); + } - if (typeof (callbacks.after_render) === 'function') { - callbacks.after_render(); - } + self.queueRender(render_data, target, callbacks); + + if (typeof (callbacks.after_render) === 'function') { + callbacks.after_render(); } }); + + }, @@ -536,8 +562,13 @@ define(function(require) { rules: self.validationRules }); - monster.ui.tooltips(queue_html, { - selector: '[rel=popover]' + // monster.ui.tooltips(queue_html, { + // selector: '[rel=popover]' + // }); + + $('*[rel=popover]', queue_html).popover({ + trigger: 'focus', + placement: 'right' }); $('.queue-save', queue_html).click(function(ev) { @@ -635,6 +666,12 @@ define(function(require) { } }); + self.queueBindEvents({ + data: data, + template: queue_html, + callbacks: callbacks + }); + target.empty().append(queue_html); }, @@ -800,7 +837,56 @@ define(function(require) { normalizeData: function(form_data) { delete form_data.user_id; + + // remove blank fields and let Kazoo set the defaults + $.each(form_data, function(key, value){ + if (value === "" || value === null){ + delete form_data[key]; + } + }); + + console.log(form_data) + return form_data; + }, + + queueBindEvents: function (args) { + var self = this, + data = args.data, + callbacks = args.callbacks, + queue_html = args.template; + + + console.log($('.inline_action_media', queue_html)); + $('.inline_action_media', queue_html).click(function (ev) { + var _data = ($(this).data('action') === 'edit') ? {id: $('#announce', queue_html).val()} : {}, + _id = _data.id; + + ev.preventDefault(); + + monster.pub('callflows.media.editPopup', { + data: _data, + callback: function (media) { + /* Create */ + if (!_id) { + $('#announce', queue_html).append(''); + $('#announce', queue_html).val(media.id); + + $('#edit_link_media', queue_html).show(); + } else { + /* Update */ + if (media.hasOwnProperty('id')) { + $('#announce #' + media.id, queue_html).text(media.name); + /* Delete */ + } else { + $('#announce #' + _id, queue_html).remove(); + $('#edit_link_media', queue_html).hide(); + } + } + } + }); + }); + } }; diff --git a/src/apps/callflows/submodules/callcenter/views/queue-edit.html b/src/apps/callflows/submodules/callcenter/views/queue-edit.html index 2efb87a..806e8ab 100644 --- a/src/apps/callflows/submodules/callcenter/views/queue-edit.html +++ b/src/apps/callflows/submodules/callcenter/views/queue-edit.html @@ -7,26 +7,151 @@
- +
- +
- +
- + + + {{ i18nApp.moh }} +
+
+ +
+ +
+ + + {{ i18nApp.announce }} +
+
+ +
+ +
+ +
+
+ +
+ +
+ + {{ i18nApp.strategy }} +
+
+ +
+ +
+ +
+
+ +
+ +
+ + +
+
+ +
+ +
+ + +
+
+ +
+ +
+ + {{ i18nApp.enter_when_empty }}
- +
- + + {{ i18nApp.record_caller }}
+
+ +
+ + +
+
+ +
+ +
+ + +
+
+ +
+ +
+ + {{ i18nApp.caller_exit_key }} +
+
+

{{ i18nApp.userLabel }}