diff --git a/src/apps/callflows/app.js b/src/apps/callflows/app.js index 3eee193..26d2e0a 100644 --- a/src/apps/callflows/app.js +++ b/src/apps/callflows/app.js @@ -21,6 +21,7 @@ define(function(require) { 'flushdtmf', 'groups', 'language', + 'lookupcidname', 'media', 'menu', 'misc', diff --git a/src/apps/callflows/i18n/en-US.json b/src/apps/callflows/i18n/en-US.json index 6f221de..1d625f8 100644 --- a/src/apps/callflows/i18n/en-US.json +++ b/src/apps/callflows/i18n/en-US.json @@ -1379,6 +1379,21 @@ } }, + "lookup_cid_name": { + "lookup_cid_name": "Lookup CID Name", + "edit_dialog": { + "title": "Lookup CID Name", + "available_lists": "Available lists", + "selected_lists": "Selected lists" + }, + "menu_option_dialog": { + "title": "Menu option", + "menu_option": "Menu option", + "match": "Match", + "no_match": "No match" + } + }, + "__comment": "UI-1929: adding time of day sets to adv. callflows", "__version": "v4.1", "temporalset": { diff --git a/src/apps/callflows/style/app.css b/src/apps/callflows/style/app.css index a505ec0..20f5b33 100644 --- a/src/apps/callflows/style/app.css +++ b/src/apps/callflows/style/app.css @@ -19,6 +19,7 @@ @import url('../submodules/faxdetect/faxdetect.css'); @import url('../submodules/flushdtmf/flushdtmf.css'); @import url('../submodules/language/language.css'); +@import url('../submodules/lookupcidname/lookupcidname.css'); @import url('../../../css/vendor/bootstrap-tour.css'); /* style.css */ #ws_callflow > .callflow { diff --git a/src/apps/callflows/submodules/lookupcidname/lookupcidname.css b/src/apps/callflows/submodules/lookupcidname/lookupcidname.css new file mode 100644 index 0000000..60ede4a --- /dev/null +++ b/src/apps/callflows/submodules/lookupcidname/lookupcidname.css @@ -0,0 +1,7 @@ +.lookup-cid-name_dialog .items-selector .box-selector { + max-width: 195px; +} + +.lookup-cid-name_dialog form { + margin: 15px 0 0; +} diff --git a/src/apps/callflows/submodules/lookupcidname/lookupcidname.js b/src/apps/callflows/submodules/lookupcidname/lookupcidname.js new file mode 100644 index 0000000..77c13d2 --- /dev/null +++ b/src/apps/callflows/submodules/lookupcidname/lookupcidname.js @@ -0,0 +1,164 @@ +define(function(require) { + var $ = require('jquery'), + monster = require('monster'); + + var app = { + requests: { + 'callflows.lookupcidname.lists.get': { + 'verb': 'GET', + 'url': 'accounts/{accountId}/lists' + } + }, + + subscribe: { + 'callflows.fetchActions': 'lookupcidnameDefineActions' + }, + + lookupcidnameDefineActions: function(args) { + var self = this, + callflow_nodes = args.actions, + i18n = self.i18n.active().callflows.lookup_cid_name; + + $.extend(callflow_nodes, { + 'lookupcidname[]': { + name: i18n.lookup_cid_name, + icon: 'group', + category: self.i18n.active().oldCallflows.advanced_cat, + module: 'lookupcidname', + tip: i18n.tooltip, + data: { + lists: [] + }, + rules: [{ + type: 'quantity', + maxSize: 2 + }], + isUsable: 'true', + weight: 48, + caption: function(node, caption_map) { + return ''; + }, + edit: function(node, callback) { + self.lookupcidnameShowEditDialog(node, callback); + }, + key_caption: function(child_node, caption_map) { + if(child_node.key === 'match') { + return i18n.menu_option_dialog.match; + } else if(child_node.key === 'nomatch') { + return i18n.menu_option_dialog.no_match; + } + return child_node.key; + }, + key_edit: function(child_node, callback) { + var $dialog, $popup; + + $popup = $(self.getTemplate({ + name: 'dialogMenuOption', + data: { + selected: child_node.key + }, + submodule: 'lookupcidname' + })); + + $popup.find('.js-save').on('click', function() { + var $menuOption = $('#lookup-cid-name_menu-option option:selected', $popup); + child_node.key = $menuOption.val(); + child_node.key_caption = $menuOption.text(); + $dialog.dialog('close'); + }); + + $dialog = monster.ui.dialog($popup, { + title: self.i18n.active().callflows.lookup_cid_name.menu_option_dialog.title, + minHeight: '0', + width: 450, + beforeClose: function() { + if (typeof callback === 'function') { + callback(); + } + } + }); + } + } + }); + }, + + getLists: function(callback){ + var self = this; + + monster.request({ + resource: 'callflows.lookupcidname.lists.get', + data: { + accountId: self.accountId, + generateError: false + }, + success: function (data) { + if(typeof(callback) === 'function') { + callback(data.data); + } + } + }); + }, + + lookupcidnameShowEditDialog: function (node, callback) { + var self = this, + $dialogHtml, + $dialog, + i18n = self.i18n.active().callflows.lookup_cid_name, + selectedListsIds = node.getMetadata('lists') || []; + + self.getLists(function (lists) { + var selectedLists = []; + var allListsWithoutSelected = []; + for(var i=0, len=lists.length; i +
+
+
+ {{ i18n.callflows.lookup_cid_name.edit_dialog.available_lists }} +
+
    + {{#each lists}} +
  • +
    + {{ this.name }} +
  • + {{/each}} +
+
+ +
+
+ {{ i18n.callflows.lookup_cid_name.edit_dialog.selected_lists }} +
+
    + {{#each selectedLists}} +
  • +
    + {{ this.name }} +
  • + {{/each}} +
+
+
+ +
+ +
+ diff --git a/src/apps/callflows/submodules/lookupcidname/views/dialogMenuOption.html b/src/apps/callflows/submodules/lookupcidname/views/dialogMenuOption.html new file mode 100644 index 0000000..fc9effd --- /dev/null +++ b/src/apps/callflows/submodules/lookupcidname/views/dialogMenuOption.html @@ -0,0 +1,26 @@ +
+
+
+ +
+
+
+ +
+