TT#8304 Impl ngcp-csc filtering for cf grid stores

When clicking the timeset and sourceset buttons, up to 9 combinations
are allowed. Implementing filtering for the corresponding types of
calls (online, busy, offline).

Change-Id: I71126c869782f80d5a56e980fc0918131650148a
changes/66/10766/9
Robert Axelsen 8 years ago
parent bfc6007d36
commit ea185ba343

@ -536,6 +536,20 @@ Ext.define('Ngcp.csc.locales', {
de: 'List B',
fr: 'List B',
sp: 'List B'
},
closed: {
en: 'Closed',
it: 'Closed',
de: 'Closed',
fr: 'Closed',
sp: 'Closed'
},
add_new_source: {
en: 'ADD NEW SOURCE',
it: 'ADD NEW SOURCE',
de: 'ADD NEW SOURCE',
fr: 'ADD NEW SOURCE',
sp: 'ADD NEW SOURCE'
}
},
filters: {

@ -152,7 +152,7 @@ Ext.define('NgcpCsc.view.pages.callforward.CallForward', {
items: [
callForwardListAGrid,
{
html: 'ADD NEW SOURCE',
text: Ngcp.csc.locales.callforward.add_new_source[localStorage.getItem('languageSelected')],
xtype: 'button',
id: 'addListAButton',
width: 135,
@ -177,7 +177,7 @@ Ext.define('NgcpCsc.view.pages.callforward.CallForward', {
items: [
callForwardListBGrid,
{
html: 'ADD NEW SOURCE',
text: Ngcp.csc.locales.callforward.add_new_source[localStorage.getItem('languageSelected')],
xtype: 'button',
id: 'addListBButton',
width: 135,

@ -25,8 +25,8 @@ Ext.define('NgcpCsc.view.pages.callforward.CallForwardController', {
rec.set('active', !rec.get('active'));
},
checkIndex: function(button, target) {
return (target.indexOf(button) > -1) === true ? true : false;
checkIndexOf: function(string, target) {
return target.indexOf(string) > -1;
},
addEmptyRow: function (el) {
@ -36,18 +36,18 @@ Ext.define('NgcpCsc.view.pages.callforward.CallForwardController', {
var record = targetStore.getAt(targetStore.getCount() - 1);
if (record.data.phone !== '') {
targetStore.add({ "phone": "", "active": false, "ring_for": "0 secs" });
}
};
};
if (this.checkIndex('onlineButton', targetId)) {
if (this.checkIndexOf('onlineButton', targetId)) {
addRowToStore('CallForwardOnline');
} else if (this.checkIndex('busyButton', targetId)) {
} else if (this.checkIndexOf('busyButton', targetId)) {
addRowToStore('CallForwardBusy');
} else if (this.checkIndex('offlineButton', targetId)) {
} else if (this.checkIndexOf('offlineButton', targetId)) {
addRowToStore('CallForwardOffline');
} else if (this.checkIndex('addListAButton', targetId)) {
} else if (this.checkIndexOf('addListAButton', targetId)) {
var grid = Ext.getCmp('cf-sourceset-list-a-grid');
addRowToStore(grid.getStore());
} else if (this.checkIndex('addListBButton', targetId)) {
} else if (this.checkIndexOf('addListBButton', targetId)) {
var grid = Ext.getCmp('cf-sourceset-list-b-grid');
addRowToStore(grid.getStore());
};
@ -59,28 +59,68 @@ Ext.define('NgcpCsc.view.pages.callforward.CallForwardController', {
store.remove(rec);
},
clickSegmentedButton: function (el) {
var targetId = el.getTarget().id;
var vm = this.getViewModel();
changeWidget: function (target, vm) {
vm.set('after_hours', true);
vm.set('company_hours', true);
vm.set('list_a', true);
vm.set('list_b', true);
if (this.checkIndex('afterHoursButton-btnIconEl', targetId)) {
vm.set('active_widget', Ngcp.csc.locales.callforward.after_hours[localStorage.getItem('languageSelected')]);
vm.set('after_hours', false);
} else if (this.checkIndex('companyHoursButton-btnIconEl', targetId)) {
vm.set('active_widget', Ngcp.csc.locales.callforward.company_hours[localStorage.getItem('languageSelected')]);
vm.set('company_hours', false);
} else if (this.checkIndex('listAButton-btnIconEl', targetId)) {
vm.set('active_widget', Ngcp.csc.locales.callforward.list_a[localStorage.getItem('languageSelected')]);
vm.set('list_a', false);
} else if (this.checkIndex('listBButton-btnIconEl', targetId)) {
vm.set('active_widget', Ngcp.csc.locales.callforward.list_b[localStorage.getItem('languageSelected')]);
vm.set('list_b', false);
switch (target) {
case 'afterHoursButton-btnIconEl':
vm.set('active_widget', Ngcp.csc.locales.callforward.after_hours[localStorage.getItem('languageSelected')]);
vm.set('after_hours', false);
break;
case 'companyHoursButton-btnIconEl':
vm.set('active_widget', Ngcp.csc.locales.callforward.company_hours[localStorage.getItem('languageSelected')]);
vm.set('company_hours', false);
break;
case 'listAButton-btnIconEl':
vm.set('active_widget', Ngcp.csc.locales.callforward.list_a[localStorage.getItem('languageSelected')]);
vm.set('list_a', false);
break;
case 'listBButton-btnIconEl':
vm.set('active_widget', Ngcp.csc.locales.callforward.list_b[localStorage.getItem('languageSelected')]);
vm.set('list_b', false);
break;
};
},
getSelectedSet: function (type) {
return type == 'timeButtons' ? 'selected_timeset' : 'selected_sourceset';
},
clickSegmentedButton: function (button, event) {
var me = this,
vm = me.getViewModel(),
targetId = event.getTarget().id,
buttonValue = button.value,
buttonType = button.findParentByType('segmentedbutton').itemId,
storesArray = ['CallForwardOnline', 'CallForwardBusy', 'CallForwardOffline'];
me.changeWidget(targetId, vm);
vm.set(me.getSelectedSet(buttonType), buttonValue);
Ext.Ajax.request({
url: '/resources/data/callForwardCombinations.json',
success: function(response, opts) {
var obj = Ext.decode(response.responseText),
combinationStore = obj.data[0],
selectedTimeset = vm.get('selected_timeset'),
selectedSourceset = vm.get('selected_sourceset');
storesArray.map(function (storeName) {
var store = Ext.getStore(storeName);
store.removeAll();
for (node in combinationStore) {
if (me.checkIndexOf(storeName, node) && me.checkIndexOf(selectedTimeset, node) && me.checkIndexOf(selectedSourceset, node)) {
var records = combinationStore[node];
store.add(records);
};
};
});
},
failure: function(response, opts) {
console.log('failed to load store, with code ' + response.status);
}
});
},
renderDay: function(value, meta, record) {
if (record.get('closed') === true) {
return Ext.String.format('<div class="cf-deactivate-day">{0}</div>', value);

@ -61,25 +61,22 @@ Ext.define('NgcpCsc.view.pages.callforward.CallForwardMainForm', {
this.items = [{
xtype: 'segmentedbutton',
itemId: 'timeButtons',
value: 'alwaysButton',
value: 'always',
defaults: {
listeners: {
element: 'el',
click: 'clickSegmentedButton'
}
handler: 'clickSegmentedButton'
},
items: [{
value: 'alwaysButton', // Can be used for filtering
value: 'always',
id: 'alwaysButton',
text: Ngcp.csc.locales.callforward.time_one[localStorage.getItem('languageSelected')]
}, {
value: 'afterHoursButton',
value: 'afterHours',
id: 'afterHoursButton',
text: Ngcp.csc.locales.callforward.time_two[localStorage.getItem('languageSelected')],
iconCls: 'x-fa fa-pencil',
iconAlign: 'right'
}, {
value: 'companyHoursButton',
value: 'companyHours',
id: 'companyHoursButton',
text: Ngcp.csc.locales.callforward.time_three[localStorage.getItem('languageSelected')],
iconCls: 'x-fa fa-pencil',
@ -88,26 +85,23 @@ Ext.define('NgcpCsc.view.pages.callforward.CallForwardMainForm', {
}, {
xtype: 'segmentedbutton',
itemId: 'sourceButtons',
value: 'everybodyButton',
value: 'everybody',
defaults: {
listeners: {
element: 'el',
click: 'clickSegmentedButton'
}
handler: 'clickSegmentedButton'
},
ui: 'cf-segmentedbutton',
items: [{
value: 'everybodyButton',
value: 'everybody',
id: 'everybodyButton',
text: Ngcp.csc.locales.callforward.source_one[localStorage.getItem('languageSelected')]
}, {
value: 'listAButton',
value: 'listA',
id: 'listAButton',
text: Ngcp.csc.locales.callforward.source_two[localStorage.getItem('languageSelected')],
iconCls: 'x-fa fa-pencil',
iconAlign: 'right'
}, {
value: 'listBButton',
value: 'listB',
id: 'listBButton',
text: Ngcp.csc.locales.callforward.source_three[localStorage.getItem('languageSelected')],
iconCls: 'x-fa fa-pencil',

@ -37,11 +37,10 @@ Ext.define('NgcpCsc.view.pages.callforward.CallForwardMainGrid', {
}, {
text: Ngcp.csc.locales.callforward.ring_for[localStorage.getItem('languageSelected')],
flex: 1,
xtype: 'widgetcolumn',
dataIndex: 'ring_for',
editable: false,
widget: {
editor: {
xtype: 'combo',
editable: false,
value: '20 secs',
store: ['0 secs', '10 secs', '20 secs', '30 secs', '40 secs', '50 secs', '60 secs']
}

@ -11,7 +11,9 @@ Ext.define('NgcpCsc.view.pages.callforward.CallForwardModel', {
busy_timeout_hidden: true,
offline_timeout_hidden: true,
active_widget: '',
row_elements_disabled: false
row_elements_disabled: false,
selected_timeset: 'always',
selected_sourceset: 'everybody'
}
});

@ -1,19 +1,15 @@
{
"data": [{
"phone": "Bobby Doe",
"active": true,
"ring_for": "20 secs"
}, {
"phone": "33333333",
"active": true,
"ring_for": "20 secs"
"phone": "43144159",
"active": false,
"ring_for": "60 secs"
}, {
"phone": "67788877",
"active": true,
"ring_for": "20 secs"
"phone": "43236655",
"active": false,
"ring_for": "50 secs"
}, {
"phone": "Voicemail",
"active": false,
"active": true,
"ring_for": "0 secs"
}]
}

@ -0,0 +1,295 @@
{
"data": [{
"CallForwardBusy_always_everybody": [{
"phone": "43144159",
"active": false,
"ring_for": "60 secs"
}, {
"phone": "43236655",
"active": false,
"ring_for": "50 secs"
}, {
"phone": "Voicemail",
"active": true,
"ring_for": "0 secs"
}],
"CallForwardBusy_always_listA": [{
"phone": "43429008",
"active": true,
"ring_for": "60 secs"
}, {
"phone": "43043042",
"active": true,
"ring_for": "60 secs"
}],
"CallForwardBusy_always_listB": [{
"phone": "43235388",
"active": false,
"ring_for": "60 secs"
}, {
"phone": "43828384",
"active": false,
"ring_for": "50 secs"
}, {
"phone": "43294320",
"active": false,
"ring_for": "60 secs"
}, {
"phone": "Voicemail",
"active": true,
"ring_for": "0 secs"
}],
"CallForwardBusy_afterHours_everybody": [{
"phone": "43058597",
"active": false,
"ring_for": "40 secs"
}, {
"phone": "43069072",
"active": false,
"ring_for": "50 secs"
}, {
"phone": "Voicemail",
"active": false,
"ring_for": "0 secs"
}],
"CallForwardBusy_afterHours_listA": [{
"phone": "43671959",
"active": false,
"ring_for": "60 secs"
}, {
"phone": "Voicemail",
"active": false,
"ring_for": "0 secs"
}],
"CallForwardBusy_afterHours_listB": [{
"phone": "43963808",
"active": true,
"ring_for": "60 secs"
}, {
"phone": "43292626",
"active": false,
"ring_for": "60 secs"
}, {
"phone": "Voicemail",
"active": true,
"ring_for": "0 secs"
}],
"CallForwardBusy_companyHours_everybody": [{
"phone": "43506322",
"active": false,
"ring_for": "60 secs"
}, {
"phone": "43438084",
"active": false,
"ring_for": "60 secs"
}, {
"phone": "43503407",
"active": false,
"ring_for": "60 secs"
}, {
"phone": "Voicemail",
"active": false,
"ring_for": "0 secs"
}],
"CallForwardBusy_companyHours_listA": [{
"phone": "Voicemail",
"active": false,
"ring_for": "0 secs"
}],
"CallForwardBusy_companyHours_listB": [{
"phone": "43115899",
"active": false,
"ring_for": "50 secs"
}, {
"phone": "43163841",
"active": true,
"ring_for": "30 secs"
}, {
"phone": "43453636",
"active": false,
"ring_for": "60 secs"
}, {
"phone": "43623866",
"active": true,
"ring_for": "60 secs"
}],
"CallForwardOnline_always_everybody": [{
"phone": "43792601",
"active": true,
"ring_for": "60 secs"
}, {
"phone": "Voicemail",
"active": false,
"ring_for": "0 secs"
}],
"CallForwardOnline_always_listA": [{
"phone": "43346472",
"active": false,
"ring_for": "60 secs"
}, {
"phone": "43191649",
"active": true,
"ring_for": "50 secs"
}],
"CallForwardOnline_always_listB": [{
"phone": "43234068",
"active": true,
"ring_for": "50 secs"
}, {
"phone": "43702431",
"active": true,
"ring_for": "60 secs"
}, {
"phone": "43502814",
"active": true,
"ring_for": "60 secs"
}],
"CallForwardOnline_afterHours_everybody": [{
"phone": "43814887",
"active": false,
"ring_for": "40 secs"
}],
"CallForwardOnline_afterHours_listA": [{
"phone": "43658124",
"active": true,
"ring_for": "40 secs"
}, {
"phone": "43478930",
"active": false,
"ring_for": "20 secs"
}],
"CallForwardOnline_afterHours_listB": [{
"phone": "43805856",
"active": true,
"ring_for": "60 secs"
}, {
"phone": "43321147",
"active": true,
"ring_for": "60 secs"
}, {
"phone": "Voicemail",
"active": true,
"ring_for": "0 secs"
}],
"CallForwardOnline_companyHours_everybody": [{
"phone": "Voicemail",
"active": true,
"ring_for": "0 secs"
}],
"CallForwardOnline_companyHours_listA": [{
"phone": "43401291",
"active": true,
"ring_for": "0 secs"
}, {
"phone": "43393673",
"active": false,
"ring_for": "40 secs"
}, {
"phone": "43228450",
"active": true,
"ring_for": "60 secs"
}, {
"phone": "Voicemail",
"active": false,
"ring_for": "0 secs"
}],
"CallForwardOnline_companyHours_listB": [{
"phone": "43544823",
"active": false,
"ring_for": "60 secs"
}, {
"phone": "43380981",
"active": false,
"ring_for": "60 secs"
}],
"CallForwardOffline_always_everybody": [{
"phone": "43131586",
"active": false,
"ring_for": "50 secs"
}],
"CallForwardOffline_always_listA": [{
"phone": "43189843",
"active": true,
"ring_for": "10 secs"
}, {
"phone": "43434117",
"active": true,
"ring_for": "60 secs"
}, {
"phone": "43304032",
"active": true,
"ring_for": "60 secs"
}],
"CallForwardOffline_always_listB": [{
"phone": "43861777",
"active": false,
"ring_for": "40 secs"
}, {
"phone": "43626176",
"active": false,
"ring_for": "50 secs"
}],
"CallForwardOffline_afterHours_everybody": [{
"phone": "43249513",
"active": true,
"ring_for": "40 secs"
}],
"CallForwardOffline_afterHours_listA": [{
"phone": "43828647",
"active": true,
"ring_for": "60 secs"
}],
"CallForwardOffline_afterHours_listB": [{
"phone": "43848070",
"active": false,
"ring_for": "60 secs"
}, {
"phone": "43870457",
"active": false,
"ring_for": "40 secs"
}, {
"phone": "43956620",
"active": false,
"ring_for": "60 secs"
}, {
"phone": "Voicemail",
"active": false,
"ring_for": "0 secs"
}],
"CallForwardOffline_companyHours_everybody": [{
"phone": "43109414",
"active": true,
"ring_for": "60 secs"
}, {
"phone": "43643249",
"active": true,
"ring_for": "50 secs"
}],
"CallForwardOffline_companyHours_listA": [{
"phone": "43773031",
"active": false,
"ring_for": "60 secs"
}, {
"phone": "43845534",
"active": true,
"ring_for": "60 secs"
}, {
"phone": "Voicemail",
"active": true,
"ring_for": "0 secs"
}],
"CallForwardOffline_companyHours_listB": [{
"phone": "43878682",
"active": false,
"ring_for": "40 secs"
}, {
"phone": "43358997",
"active": false,
"ring_for": "60 secs"
}, {
"phone": "Voicemail",
"active": false,
"ring_for": "0 secs"
}]
}]
}

@ -1,15 +1,7 @@
{
"data": [{
"phone": "John Doe",
"active": true,
"ring_for": "10 secs"
}, {
"phone": "222222",
"active": true,
"ring_for": "20 secs"
}, {
"phone": "Voicemail",
"active": true,
"ring_for": "0 secs"
"phone": "43131586",
"active": false,
"ring_for": "50 secs"
}]
}

@ -1,16 +1,8 @@
{
"data": [{
"phone": "Jane Doe",
"phone": "43792601",
"active": true,
"ring_for": "20 secs"
}, {
"phone": "11111111",
"active": true,
"ring_for": "20 secs"
}, {
"phone": "67788888",
"active": true,
"ring_for": "20 secs"
"ring_for": "60 secs"
}, {
"phone": "Voicemail",
"active": false,

Loading…
Cancel
Save