Browse Source

added destination_listmatch action

master
Ruel Tmeizeh - RuhNet 2 weeks ago
parent
commit
e231afb16b
6 changed files with 212 additions and 0 deletions
  1. +1
    -0
      src/apps/callflows/app.js
  2. +14
    -0
      src/apps/callflows/i18n/en-US.json
  3. +3
    -0
      src/apps/callflows/submodules/destination_listmatch/destination_listmatch.css
  4. +145
    -0
      src/apps/callflows/submodules/destination_listmatch/destination_listmatch.js
  5. +27
    -0
      src/apps/callflows/submodules/destination_listmatch/views/dialogEdit.html
  6. +22
    -0
      src/apps/callflows/submodules/destination_listmatch/views/dialogMenuOption.html

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

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


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

@ -259,6 +259,20 @@
"dead_air": "Dead Air",
"tooltip": "Answers the call and switches media off. Could be useful for external calls/conferences recording over inbound leg."
},
"destination_list_match": {
"destination_list_match": "Destination List Match",
"tooltip": "Handles inspection of destination number and branches to a child callflow node accordingly",
"edit_dialog": {
"title": "Destination List Match",
"id": "Destination List ID"
},
"menu_option_dialog": {
"title": "Menu option",
"menu_option": "Menu option",
"match": "Match",
"no_match": "No match"
}
},
"device": {
"device": "Device",
"device_tip": "Ring a VoIP or cell phone or other device",


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

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

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

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

@ -0,0 +1,27 @@
<div class="dialog_popup callflows-port destination-list-match-dialog">
<form method="post" action="#" class="destination-list-match-form">
<div class="form_content">
<div class="popup_field clear">
<label for="destination-list-match_id">
{{ i18n.callflows.destination_list_match.edit_dialog.id }}
</label>
<div class="select_wrapper">
<select name="id" id="destination-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/destination_listmatch/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="destination-list-match_menu-option">
{{ i18n.callflows.destination_list_match.menu_option_dialog.menu_option }}
</label>
<div class="select_wrapper">
<select name="menu-option" id="destination-list-match_menu-option">
{{#select selected }}
<option value="match">{{ i18n.callflows.destination_list_match.menu_option_dialog.match }}</option>
<option value="nomatch">{{ i18n.callflows.destination_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