diff --git a/src/apps/callflows/app.js b/src/apps/callflows/app.js index fba4a53..0c42eb0 100644 --- a/src/apps/callflows/app.js +++ b/src/apps/callflows/app.js @@ -144,6 +144,7 @@ define(function(require){ self.editCallflow({ id: callflowId }); }); + callflowList.on('scroll', function() { if(!isLoading && callflowList.data('next-key') && (callflowList.scrollTop() >= (callflowList[0].scrollHeight - callflowList.innerHeight() - 100))) { isLoading = true; @@ -1561,6 +1562,13 @@ define(function(require){ } }); + $('.node-options .jump', layout).click(function() { + + var $this = $(this), + callflowId = $this.attr('id'); + self.editCallflow({ id: callflowId }); + }); + return layout; }, diff --git a/src/apps/callflows/i18n/en-US.json b/src/apps/callflows/i18n/en-US.json index 67e6a23..9ee7419 100644 --- a/src/apps/callflows/i18n/en-US.json +++ b/src/apps/callflows/i18n/en-US.json @@ -1138,6 +1138,7 @@ "advanced_cat": "Advanced", "call_recording_cat": "Call Recording", "caller_id_cat": "Caller-ID", + "integrations_cat": "Integrations", "delete_callflow": "Delete callflow", "save_changes": "Save changes", "invalid_number": "Invalid number!", @@ -1286,7 +1287,19 @@ "current": "Current", "original": "Original" } - } + }, + "check_cid": "Match caller number", + "check_cid_tip": "Branch in a callflow based on the A number", + "check_cid_match": "Match", + "check_cid_nomatch": "No match", + "check_cid_matchnomatch": "Match or no match?", + "regex": "Regex", + "webhook": "Send webhook", + "webhook_tip": "Send a webhook to an external webservice when this callflow node is hit", + "webhook_title": "Send a HTTP webhook", + "webhook_uri": "URI", + "webhook_method": "HTTP method", + "webhook_retry": "# retries" }, "__comment": "UI-1260: created common control for carrier selection", "__version": "v3.20_s2", diff --git a/src/apps/callflows/style/app.css b/src/apps/callflows/style/app.css index 95b0ce0..78325f4 100644 --- a/src/apps/callflows/style/app.css +++ b/src/apps/callflows/style/app.css @@ -349,7 +349,7 @@ #ws_callflow .module { font-size: 13px; - height: 59px; + height: 49px; margin-top: 15px; cursor: default; } @@ -1740,4 +1740,4 @@ .ui-dialog-content .monster-link:not(.disabled):focus .fa { background: transparent; color: #22A5FF; -} \ No newline at end of file +} diff --git a/src/apps/callflows/submodules/misc/misc.js b/src/apps/callflows/submodules/misc/misc.js index 8eb18b0..bc0b022 100644 --- a/src/apps/callflows/submodules/misc/misc.js +++ b/src/apps/callflows/submodules/misc/misc.js @@ -395,6 +395,136 @@ define(function(require){ } } }, + 'check_cid[]': { + name: self.i18n.active().oldCallflows.check_cid, + icon: 'list-ol', + category: self.i18n.active().oldCallflows.caller_id_cat, + module: 'check_cid', + tip: self.i18n.active().oldCallflows.check_cid_tip, + data: { + }, + rules: [ + { + type: 'quantity', + maxSize: 2 + } + ], + isUsable: 'true', + weight: 60, + caption: function(node, caption_map) { + return ''; + }, + edit: function(node, callback) { + var popup, popup_html; + + popup_html = $(monster.template(self, 'check_cid-callflowEdit', { + data_check_cid: { + 'regex': node.getMetadata('regex') || '' + } + })), + popup; + $('#add', popup_html).click(function() { + var regex = $('#regex_input', popup_html).val(); + node.setMetadata('regex', regex); + node.setMetadata('use_absolute_mode', false); + node.caption = regex; + + popup.dialog('close'); + }); + + popup = monster.ui.dialog(popup_html, { + title: self.i18n.active().oldCallflows.check_cid_title, + beforeClose: function() { + if(typeof callback == 'function') { + callback(); + } + } + }); + }, + key_caption: function(child_node, caption_map) { + var key = child_node.key; + return (key != '_') ? key : self.i18n.active().oldCallflows.check_cid_match; + }, + key_edit: function(child_node, callback) { + var popup, popup_html; + + popup_html = $(monster.template(self, 'check_cid-childCallflow', { + items: { + 'match': self.i18n.active().oldCallflows.check_cid_match, + 'nomatch': self.i18n.active().oldCallflows.check_cid_nomatch + }, + selected: child_node.key + })); + + popup_html.find('#add').on('click', function() { + child_node.key = $('#check_cid_callflow_key_selector', popup_html).val(); + + child_node.key_caption = $('#check_cid_callflow_key_selector option:selected', popup_html).text(); + + popup.dialog('close'); + }); + + popup = monster.ui.dialog(popup_html, { + title: self.i18n.active().oldCallflows.check_cid_matchnomatch, + minHeight: '0', + beforeClose: function() { + if (typeof callback === 'function') { + callback(); + } + } + }); + + + } + + }, + 'webhook[]': { + name: self.i18n.active().oldCallflows.webhook, + icon: 'upload', + category: self.i18n.active().oldCallflows.integrations_cat, + module: 'webhook', + tip: self.i18n.active().oldCallflows.webhook_tip, + data: { + }, + rules: [ + { + type: 'quantity', + maxSize: '1' + } + ], + isUsable: 'true', + weight: 40, + caption: function(node, caption_map) { + return node.getMetadata('webhook') || ''; + }, + edit: function(node, callback) { + var popup_html = $(monster.template(self, 'webhook-callflowEdit', { + data_webhook: { + 'http_verb': node.getMetadata('http_verb') || 'get', + 'retries': node.getMetadata('retries') || '3', + 'uri': node.getMetadata('uri') || '' + } + })), + popup; + $('#add', popup_html).click(function() { + node.setMetadata('http_verb', $('#http_verb option:selected', popup_html).val()); + node.setMetadata('retries', $('#retries_input', popup_html).val()); + node.setMetadata('uri', $('#uri_input', popup_html).val()); + + popup.dialog('close'); + }); + + popup = monster.ui.dialog(popup_html, { + title: self.i18n.active().oldCallflows.webhook_title, + beforeClose: function() { + if(typeof callback == 'function') { + callback(); + } + } + }); + } + + }, 'manual_presence[]': { name: self.i18n.active().oldCallflows.manual_presence, icon: 'lightbulb-o', diff --git a/src/apps/callflows/views/check_cid-callflowEdit.html b/src/apps/callflows/views/check_cid-callflowEdit.html new file mode 100644 index 0000000..911e633 --- /dev/null +++ b/src/apps/callflows/views/check_cid-callflowEdit.html @@ -0,0 +1,14 @@ +