diff --git a/src/apps/callflows/app.js b/src/apps/callflows/app.js index d4bf7a7..7cdcd6c 100644 --- a/src/apps/callflows/app.js +++ b/src/apps/callflows/app.js @@ -3,9 +3,10 @@ define(function(require) { _ = require('lodash'), monster = require('monster'); var appSubmodules = [ + 'afterbridge', + 'audiomacro', 'blacklist', 'callcenter', - 'audiomacro', 'conference', 'device', 'directory', diff --git a/src/apps/callflows/i18n/en-US.json b/src/apps/callflows/i18n/en-US.json index 4b1624b..298f3b7 100644 --- a/src/apps/callflows/i18n/en-US.json +++ b/src/apps/callflows/i18n/en-US.json @@ -27,6 +27,29 @@ "qubicle_tip": "Route to a queue", "which_queue": "Which queue?" }, + "after_bridge": { + "category": "After bridge", + "park": { + "nodeName": "After bridge: Park", + "tooltip": "Allow park on the caller after the bridge is terminated.", + "action": "Park" + }, + "transfer": { + "nodeName": "After bridge: Transfer", + "tooltip": "Allow transfer on the caller after the bridge is terminated.", + "dialog_title": "After bridge: Transfer", + "number": "Number" + }, + "hangup": { + "nodeName": "After bridge: Hangup", + "tooltip": "Allow hangup on the caller after the bridge is terminated." + }, + "warning_dialog": { + "title": "After bridge", + "message": "Place this item in front of the action item" + }, + "warning": "Warning!" + }, "audio_macro": { "dialog_title": "Audio Macro", "macro_type": "Macro type", diff --git a/src/apps/callflows/style/app.css b/src/apps/callflows/style/app.css index cd1160d..98f00d9 100644 --- a/src/apps/callflows/style/app.css +++ b/src/apps/callflows/style/app.css @@ -11,6 +11,7 @@ @import url('../submodules/temporalset/temporalset.css'); @import url('../submodules/callcenter/callcenter.css'); @import url('../submodules/audiomacro/audiomacro.css'); +@import url('../submodules/afterbridge/afterbridge.css'); @import url('../../../css/vendor/bootstrap-tour.css'); /* style.css */ #ws_callflow > .callflow { @@ -416,7 +417,7 @@ #ws_callflow .div_icon > .fa, .callflow-preview .div_icon > .fa { font-size: 23px; - margin-right: 7px; + /* margin-right: 7px; */ color: white; vertical-align: top; } diff --git a/src/apps/callflows/submodules/afterbridge/afterbridge.css b/src/apps/callflows/submodules/afterbridge/afterbridge.css new file mode 100644 index 0000000..09296f3 --- /dev/null +++ b/src/apps/callflows/submodules/afterbridge/afterbridge.css @@ -0,0 +1,3 @@ +.dialog_popup .form_content .after-bridge-number input[type="text"] { + max-width: 135px; +} diff --git a/src/apps/callflows/submodules/afterbridge/afterbridge.js b/src/apps/callflows/submodules/afterbridge/afterbridge.js new file mode 100644 index 0000000..bce87d2 --- /dev/null +++ b/src/apps/callflows/submodules/afterbridge/afterbridge.js @@ -0,0 +1,175 @@ +define(function(require) { + var $ = require('jquery'), + monster = require('monster'); + + var app = { + requests: {}, + + subscribe: { + 'callflows.fetchActions': 'afterbridgeDefineActions' + }, + + afterbridgeDefineActions: function(args) { + var self = this, + callflow_nodes = args.actions, + i18n = self.i18n.active().callflows.after_bridge; + + $.extend(callflow_nodes, { + 'after_bridge[action=park]': { + name: i18n.park.nodeName, + icon: 'reply', + category: i18n.category, + module: 'after_bridge', + tip: i18n.park.tooltip, + data: { + action: 'park', + data: true + }, + rules: [ + { + type: 'quantity', + maxSize: '1' + } + ], + isUsable: 'true', + weight: 48, + caption: function(node, caption_map) { + return ''; + }, + edit: function(node, callback) { + self.afterbridgeShowWarningDialog(node, callback); + } + }, + 'after_bridge[action=transfer]': { + name: i18n.transfer.nodeName, + icon: 'map-signs', + category: i18n.category, + module: 'after_bridge', + tip: i18n.transfer.tooltip, + data: { + action: 'transfer', + data: false + }, + rules: [ + { + type: 'quantity', + maxSize: '1' + } + ], + isUsable: 'true', + weight: 48, + caption: function(node, caption_map) { + return node.getMetadata('data') || ''; + }, + edit: function(node, callback) { + self.afterbridgeTransferEdit(node, callback); + } + }, + 'after_bridge[action=hangup]': { + name: i18n.hangup.nodeName, + icon: 'power-off', + category: i18n.category, + module: 'after_bridge', + tip: i18n.hangup.tooltip, + data: { + action: 'hangup', + data: true + }, + rules: [ + { + type: 'quantity', + maxSize: '1' + } + ], + isUsable: 'true', + weight: 48, + caption: function(node, caption_map) { + return ''; + }, + edit: function(node, callback) { + self.afterbridgeShowWarningDialog(node, callback); + } + } + }); + }, + + afterbridgeShowWarningDialog: function (node, callback) { + var self = this, + $popup, + $dialog; + + $dialog = $(self.getTemplate({ + name: 'warningDialog', + data: {}, + submodule: 'afterbridge' + })); + + $popup = monster.ui.dialog($dialog, { + title: self.i18n.active().callflows.after_bridge.warning_dialog.title, + minHeight: '0', + width: 400, + beforeClose: function() { + if (typeof callback === 'function') { + callback(); + } + } + }); + + $dialog.find('.js-confirm').click(function() { + if (typeof callback === 'function') { + callback(); + } + $popup.dialog('close'); + }); + }, + + afterbridgeTransferEdit: function (node, callback) { + var self = this, + $popup, + $dialog, + action = node.getMetadata('action'), + number = node.getMetadata('data'); + + $dialog = $(self.getTemplate({ + name: 'transferDialog', + data: { + action: action, + number: number || '' + }, + submodule: 'afterbridge' + })); + + $popup = monster.ui.dialog($dialog, { + title: self.i18n.active().callflows.after_bridge.transfer.dialog_title, + minHeight: '0', + width: 400, + beforeClose: function() { + if (typeof callback === 'function') { + callback(); + } + } + }); + + $dialog.find('.js-save').click(function() { + var number = $('#after-bridge-number').val(); + var caption = ''; + + if(!number) { + number = false + } else { + caption = number; + } + + node.setMetadata('data', number); + node.caption = caption; + if (typeof callback === 'function') { + callback(); + } + + $popup.dialog('close'); + }); + } + }; + + return app; +}); diff --git a/src/apps/callflows/submodules/afterbridge/views/transferDialog.html b/src/apps/callflows/submodules/afterbridge/views/transferDialog.html new file mode 100644 index 0000000..e9ba6d3 --- /dev/null +++ b/src/apps/callflows/submodules/afterbridge/views/transferDialog.html @@ -0,0 +1,23 @@ +
+
+
+ +
+ {{#monsterPanelText i18n.callflows.after_bridge.warning 'warning' 'fill-width'}} + {{{ i18n.callflows.after_bridge.warning_dialog.message }}} + {{/monsterPanelText}} +
+ +
+ +
+
diff --git a/src/apps/callflows/submodules/afterbridge/views/warningDialog.html b/src/apps/callflows/submodules/afterbridge/views/warningDialog.html new file mode 100644 index 0000000..086ab6e --- /dev/null +++ b/src/apps/callflows/submodules/afterbridge/views/warningDialog.html @@ -0,0 +1,10 @@ +
+ {{#monsterPanelText i18n.callflows.after_bridge.warning 'warning' 'fill-width'}} + {{{ i18n.callflows.after_bridge.warning_dialog.message }}} + {{/monsterPanelText}} +
+ +
+