Browse Source

Branch Bnumber submodule

pull/4/head
Vladimir Barkasov 6 years ago
parent
commit
ab92ac0011
7 changed files with 235 additions and 0 deletions
  1. +1
    -0
      src/apps/callflows/app.js
  2. +19
    -0
      src/apps/callflows/i18n/en-US.json
  3. +1
    -0
      src/apps/callflows/style/app.css
  4. +14
    -0
      src/apps/callflows/submodules/branchbnumber/branchbnumber.css
  5. +131
    -0
      src/apps/callflows/submodules/branchbnumber/branchbnumber.js
  6. +52
    -0
      src/apps/callflows/submodules/branchbnumber/views/dialogEdit.html
  7. +17
    -0
      src/apps/callflows/submodules/branchbnumber/views/dialogMenuOption.html

+ 1
- 0
src/apps/callflows/app.js View File

@ -6,6 +6,7 @@ define(function(require) {
'afterbridge',
'audiomacro',
'blacklist',
'branchbnumber',
'branchvariable',
'callcenter',
'conference',


+ 19
- 0
src/apps/callflows/i18n/en-US.json View File

@ -120,6 +120,25 @@
},
"are_you_sure_you_want_to_delete": "Are you sure you want to delete this item?"
},
"branch_bnumber": {
"branch_bnumber": "Branch Bnumber",
"tooltip": "Try to branch to the capture group of the feature code",
"hunting": "Hunting",
"branching": "Branching",
"menu_option": "Menu option",
"menu_option_title": "Menu Option",
"default_action": "Default action",
"timeout": "Timeout",
"edit_dialog": {
"title": "Branch Bnumber",
"hunt_label": "Hunt",
"hunt_tooltip": "With the hunt flag set to false, the capture group will be used to lookup a child branch",
"hunt_allow_label": "Hunt allow (regexp)",
"hunt_allow_tooltip": "A regexp used to match against the capture group to whitelist allowed numbers to hunt",
"hunt_deny_label": "Hunt deny (regexp)",
"hunt_deny_tooltip": "A regexp used to match against the capture group to blacklist denied numbers to hunt"
}
},
"branch_variable": {
"branch_variable": "Branch variable",
"tooltip": "The Branch variable callflow enables you to branch based on value of some field inside one of the a call CCVs, user's document, device's document or an account's document.",


+ 1
- 0
src/apps/callflows/style/app.css View File

@ -12,6 +12,7 @@
@import url('../submodules/callcenter/callcenter.css');
@import url('../submodules/audiomacro/audiomacro.css');
@import url('../submodules/afterbridge/afterbridge.css');
@import url('../submodules/branchbnumber/branchbnumber.css');
@import url('../submodules/branchvariable/branchvariable.css');
@import url('../../../css/vendor/bootstrap-tour.css');
/* style.css */


+ 14
- 0
src/apps/callflows/submodules/branchbnumber/branchbnumber.css View File

@ -0,0 +1,14 @@
.dialog_popup .branch-bnumber-form .form_content .checkbox-label-wrapper {
padding-left: 170px;
text-align: left;
width: 200px;
margin-right: 0;
margin-bottom: 13px;
padding-top: 0;
}
.callflows-port form.branch-bnumber-form label:not(.monster-invalid) {
width: 160px;
}

+ 131
- 0
src/apps/callflows/submodules/branchbnumber/branchbnumber.js View File

@ -0,0 +1,131 @@
define(function(require) {
var $ = require('jquery'),
monster = require('monster');
var app = {
requests: {},
subscribe: {
'callflows.fetchActions': 'branchbnumberDefineActions'
},
branchbnumberDefineActions: function(args) {
var self = this,
callflow_nodes = args.actions,
i18n = self.i18n.active().callflows.branch_bnumber;
$.extend(callflow_nodes, {
'branch_bnumber[]': {
name: i18n.branch_bnumber,
icon: 'share-alt',
category: self.i18n.active().oldCallflows.advanced_cat,
module: 'branch_bnumber',
tip: i18n.tooltip,
data: {
hunt: true
},
rules: [
{
type: 'quantity',
maxSize: '9999'
}
],
isUsable: 'true',
weight: 48,
key_caption: function(child_node) {
var key = child_node.key;
return (key !== '_') ? key : i18n.default_action;
},
key_edit: function(child_node, callback) {
var popup, popup_html;
popup_html = $(self.getTemplate({
name: 'dialogMenuOption',
data: {
menuOption: child_node.key
},
submodule: 'branchbnumber'
}));
popup_html.find('.js-save').on('click', function() {
var menuOption = $('[name="menu_option"]', popup).val();
child_node.key = menuOption;
child_node.key_caption = menuOption;
popup.dialog('close');
});
popup = monster.ui.dialog(popup_html, {
title: i18n.menu_option_title,
minHeight: '0',
beforeClose: function() {
callback && callback();
}
});
},
caption: function(node, caption_map) {
return node.getMetadata('hunt') ? i18n.hunting : i18n.branching;
},
edit: function(node, callback) {
self.branchbnumberShowEditDialog(node, callback);
}
}
});
},
branchbnumberShowEditDialog: function (node, callback) {
var self = this,
$popup,
$dialog,
i18n = self.i18n.active().callflows.branch_bnumber,
hunt = node.getMetadata('hunt'),
huntAllow = node.getMetadata('hunt_allow'),
huntDeny = node.getMetadata('hunt_deny');
$dialog = $(self.getTemplate({
name: 'dialogEdit',
data: {
hunt: hunt,
huntAllow: huntAllow || '',
huntDeny: huntDeny || ''
},
submodule: 'branchbnumber'
}));
$popup = monster.ui.dialog($dialog, {
title: self.i18n.active().callflows.branch_bnumber.edit_dialog.title,
minHeight: '0',
width: 450,
beforeClose: function() {
if (typeof callback === 'function') {
callback();
}
}
});
monster.ui.tooltips($dialog);
$dialog.find('.js-save').click(function() {
var $form = $(this)
.closest('.js-branch-bnumber-dialog')
.find('.js-branch-bnumber-form');
var formData = monster.ui.getFormData($form[0]);
node.deleteMetadata('hunt_allow');
node.deleteMetadata('hunt_deny');
formData.hunt_allow && node.setMetadata('hunt_allow', formData.hunt_allow);
formData.hunt_deny && node.setMetadata('hunt_deny', formData.hunt_deny);
node.setMetadata('hunt', formData.hunt);
node.caption = formData.hunt ? i18n.hunting : i18n.branching;
if (typeof callback === 'function') {
callback();
}
$popup.dialog('close');
});
}
};
return app;
});

+ 52
- 0
src/apps/callflows/submodules/branchbnumber/views/dialogEdit.html View File

@ -0,0 +1,52 @@
<div class="dialog_popup callflows-port branch-bnumber-dialog js-branch-bnumber-dialog">
<form method="post" action="#" class="branch-bnumber-form js-branch-bnumber-form">
<div class="form_content">
<div class="popup_field clear">
<label for="branch-bnumber-hunt">
{{ i18n.callflows.branch_bnumber.edit_dialog.hunt_label }}
<i class="help-popover fa fa-question-circle"
data-original-title="{{ i18n.callflows.branch_bnumber.edit_dialog.hunt_tooltip}}"
data-placement="bottom"
data-toggle="tooltip"></i>
</label>
<div class="field_wrapper">
{{#monsterSwitch}}
<input id="branch-bnumber-hunt" name="hunt" type="checkbox"{{#if hunt}} checked="checked"{{/if}}>
{{/monsterSwitch}}
</div>
</div>
<div class="popup_field clear">
<label for="branch-bnumber-hunt-allow">
{{ i18n.callflows.branch_bnumber.edit_dialog.hunt_allow_label }}
<i class="help-popover fa fa-question-circle"
data-original-title="{{ i18n.callflows.branch_bnumber.edit_dialog.hunt_allow_tooltip}}"
data-placement="right"
data-toggle="tooltip"></i>
</label>
<div class="field_wrapper">
<input name="hunt_allow" type="text" value="{{ huntAllow }}" id="branch-bnumber-hunt-allow"/>
</div>
</div>
<div class="popup_field clear">
<label for="branch-bnumber-hunt-deny">
{{ i18n.callflows.branch_bnumber.edit_dialog.hunt_deny_label }}
<i class="help-popover fa fa-question-circle"
data-original-title="{{ i18n.callflows.branch_bnumber.edit_dialog.hunt_deny_tooltip}}"
data-placement="right"
data-toggle="tooltip"></i>
</label>
<div class="field_wrapper">
<input name="hunt_deny" type="text" value="{{ huntDeny }}" id="branch-bnumber-hunt-deny"/>
</div>
</div>
</div>
</form>
<div class="buttons-center">
<button class="js-save monster-button monster-button-primary">
{{ i18n.save }}
</button>
</div>
</div>

+ 17
- 0
src/apps/callflows/submodules/branchbnumber/views/dialogMenuOption.html View File

@ -0,0 +1,17 @@
<div class="dialog_popup">
<form name="form" method="post" action="#">
<div class="form_content">
<div class="popup_field clear">
<label for="branch-bnumber-key">
{{ i18n.callflows.branch_bnumber.menu_option }}
</label>
<div class="field_wrapper">
<input name="menu_option" type="text" value="{{ menuOption }}" id="branch-bnumber-key"/>
</div>
</div>
</div>
</form>
<div class="buttons-center">
<button class="js-save monster-button monster-button-primary">{{ i18n.save }}</button>
</div>
</div>

Loading…
Cancel
Save