Browse Source

CID List Match submodule

pull/4/head
Vladimir Barkasov 6 years ago
parent
commit
a7f0319cf0
7 changed files with 213 additions and 0 deletions
  1. +1
    -0
      src/apps/callflows/app.js
  2. +14
    -0
      src/apps/callflows/i18n/en-US.json
  3. +1
    -0
      src/apps/callflows/style/app.css
  4. +3
    -0
      src/apps/callflows/submodules/cidlistmatch/cidlistmatch.css
  5. +145
    -0
      src/apps/callflows/submodules/cidlistmatch/cidlistmatch.js
  6. +27
    -0
      src/apps/callflows/submodules/cidlistmatch/views/dialogEdit.html
  7. +22
    -0
      src/apps/callflows/submodules/cidlistmatch/views/dialogMenuOption.html

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

@ -10,6 +10,7 @@ define(function(require) {
'branchvariable',
'callcenter',
'checkcid',
'cidlistmatch',
'conference',
'device',
'directory',


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

@ -164,6 +164,20 @@
"merged": "Merged",
"user": "User"
},
"cid_list_match": {
"cid_list_match": "CID List Match",
"tooltip": "Handles inspection of incoming caller id and branching to a child callflow node accordingly",
"edit_dialog": {
"title": "CID List Match",
"id": "CallerID List ID"
},
"menu_option_dialog": {
"title": "Menu option",
"menu_option": "Menu option",
"match": "Match",
"no_match": "No match"
}
},
"check_cid": {
"check_cid": "Check Cid",
"tooltip": "Handles inspection of incoming caller id and branching to a child callflow node accordingly.",


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

@ -15,6 +15,7 @@
@import url('../submodules/branchbnumber/branchbnumber.css');
@import url('../submodules/branchvariable/branchvariable.css');
@import url('../submodules/checkcid/checkcid.css');
@import url('../submodules/cidlistmatch/cidlistmatch.css');
@import url('../../../css/vendor/bootstrap-tour.css');
/* style.css */
#ws_callflow > .callflow {


+ 3
- 0
src/apps/callflows/submodules/cidlistmatch/cidlistmatch.css View File

@ -0,0 +1,3 @@
.cid-list-match-form {
margin: 15px 0 0;
}

+ 145
- 0
src/apps/callflows/submodules/cidlistmatch/cidlistmatch.js View File

@ -0,0 +1,145 @@
define(function(require) {
var $ = require('jquery'),
monster = require('monster');
var app = {
requests: {
'callflows.cidlistmatch.lists.get': {
'verb': 'GET',
'url': 'accounts/{accountId}/lists'
}
},
subscribe: {
'callflows.fetchActions': 'cidlistmatchDefineActions'
},
cidlistmatchDefineActions: function(args) {
var self = this,
callflow_nodes = args.actions,
i18n = self.i18n.active().callflows.cid_list_match;
$.extend(callflow_nodes, {
'cidlistmatch[id=*]': {
name: i18n.cid_list_match,
icon: 'group',
category: self.i18n.active().oldCallflows.caller_id_cat,
module: 'cidlistmatch',
tip: i18n.tooltip,
data: {},
rules: [
{
type: 'quantity',
maxSize: '2'
}
],
isUsable: 'true',
weight: 48,
caption: function(node, caption_map) {
return '';
},
edit: function(node, callback) {
self.cidlistmatchShowEditDialog(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: 'cidlistmatch'
}));
$popup.find('.js-save').on('click', function() {
var $menuOption = $('#cid-list-match_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.cid_list_match.menu_option_dialog.title,
minHeight: '0',
width: 450,
beforeClose: function() {
if (typeof callback === 'function') {
callback();
}
}
});
}
}
});
},
cidlistmatchShowEditDialog: function (node, callback) {
var self = this,
$popup,
$dialog,
listId = node.getMetadata('id');
self.cidlistmatchGetLists(function (lists) {
$dialog = $(self.getTemplate({
name: 'dialogEdit',
data: {
listId: listId,
lists: lists
},
submodule: 'cidlistmatch'
}));
$popup = monster.ui.dialog($dialog, {
title: self.i18n.active().callflows.cid_list_match.edit_dialog.title,
minHeight: '0',
width: 450,
beforeClose: function() {
if (typeof callback === 'function') {
callback();
}
}
});
$dialog.find('.js-save').click(function() {
var $selectedOption = $('#cid-list-match_id option:selected');
var listId = $selectedOption.val();
node.setMetadata('id', listId);
if (typeof callback === 'function') {
callback();
}
$popup.dialog('close');
});
})
},
cidlistmatchGetLists: function(callback){
var self = this;
monster.request({
resource: 'callflows.cidlistmatch.lists.get',
data: {
accountId: self.accountId,
generateError: false
},
success: function (data) {
if(typeof(callback) === 'function') {
callback(data.data);
}
}
});
},
};
return app;
});

+ 27
- 0
src/apps/callflows/submodules/cidlistmatch/views/dialogEdit.html View File

@ -0,0 +1,27 @@
<div class="dialog_popup callflows-port cid-list-match-dialog">
<form method="post" action="#" class="cid-list-match-form">
<div class="form_content">
<div class="popup_field clear">
<label for="cid-list-match_id">
{{ i18n.callflows.cid_list_match.edit_dialog.id }}
</label>
<div class="select_wrapper">
<select name="id" id="cid-list-match_id">
{{#select listId}}
{{#each lists}}
<option value="{{ this.id }}">{{ this.name }} ({{ this.id }})</option>
{{/each}}
{{/select}}
</select>
</div>
</div>
</div>
</form>
<div class="buttons-center">
<button class="monster-button monster-button-primary js-save">
{{ i18n.save }}
</button>
</div>
</div>

+ 22
- 0
src/apps/callflows/submodules/cidlistmatch/views/dialogMenuOption.html View File

@ -0,0 +1,22 @@
<div class="dialog_popup">
<form name="form" method="post" action="#">
<div class="form_content">
<div class="popup_field clear">
<label for="cid-list-match_menu-option">
{{ i18n.callflows.cid_list_match.menu_option_dialog.menu_option }}
</label>
<div class="select_wrapper">
<select name="menu-option" id="cid-list-match_menu-option">
{{#select selected }}
<option value="match">{{ i18n.callflows.cid_list_match.menu_option_dialog.match }}</option>
<option value="nomatch">{{ i18n.callflows.cid_list_match.menu_option_dialog.no_match }}</option>
{{/select}}
</select>
</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