TT#21849 Ngcp CSC - CallForwarding Timset - Invalid alert

Change-Id: Iba4f8e625f92d81ec24ee8a9cc83dc2efd449a13
changes/55/15555/6
Carlo 8 years ago
parent 6686858fd7
commit 9085193a92

@ -1050,6 +1050,9 @@ Ext.define('Ngcp.csc.locales', {
en: 'Only numbers allowed. Please retry.', en: 'Only numbers allowed. Please retry.',
it: 'Only numbers allowed. Please retry.' it: 'Only numbers allowed. Please retry.'
}, },
invalid_times: {
en: 'There are invalid time periods in the timeset; allowed fields are Weekday and Hour. Please fix your time periods or reset the timeset by clicking on Create button.'
},
tooltips: { tooltips: {
change_time_from: { change_time_from: {
en: 'Change time from', en: 'Change time from',
@ -1367,15 +1370,15 @@ Ext.define('Ngcp.csc.locales', {
sp: 'With your 4-digit PIN you may query your voicebox from any telephone.' sp: 'With your 4-digit PIN you may query your voicebox from any telephone.'
} }
}, },
contacts:{ contacts: {
title:{ title: {
en: 'Contacts', en: 'Contacts',
it: 'Contacts', it: 'Contacts',
de: 'Contacts', de: 'Contacts',
fr: 'Contacts', fr: 'Contacts',
sp: 'Contacts' sp: 'Contacts'
}, },
delete_user:{ delete_user: {
en: 'Do you really want to delete {0} from your Personal Addressbook?', en: 'Do you really want to delete {0} from your Personal Addressbook?',
it: 'Do you really want to delete {0} from your Personal Addressbook?', it: 'Do you really want to delete {0} from your Personal Addressbook?',
de: 'Do you really want to delete {0} from your Personal Addressbook?', de: 'Do you really want to delete {0} from your Personal Addressbook?',
@ -2107,14 +2110,14 @@ Ext.define('Ngcp.csc.locales', {
} }
}, },
devices: { devices: {
delete_assignment:{ delete_assignment: {
en: 'Do you really want to unassign button {0}?', en: 'Do you really want to unassign button {0}?',
it: 'Do you really want to unassign button {0}?', it: 'Do you really want to unassign button {0}?',
de: 'Do you really want to unassign button {0}?', de: 'Do you really want to unassign button {0}?',
fr: 'Do you really want to unassign button {0}?', fr: 'Do you really want to unassign button {0}?',
sp: 'Do you really want to unassign button {0}?' sp: 'Do you really want to unassign button {0}?'
}, },
tooltip:{ tooltip: {
click: { click: {
en: 'Click to edit or remove', en: 'Click to edit or remove',
it: 'Click to edit or remove', it: 'Click to edit or remove',
@ -2133,6 +2136,9 @@ Ext.define('Ngcp.csc.locales', {
} }
}, },
common: { common: {
create: {
en: 'CREATE'
},
edit: { edit: {
en: 'Edit', en: 'Edit',
it: 'Edit', it: 'Edit',

@ -101,3 +101,7 @@
background: #B0FFC5; background: #B0FFC5;
color: black; color: black;
} }
.cf-invalid-period-box {
padding: 2px;
color: red;
}

@ -41,8 +41,18 @@ Ext.define('NgcpCsc.view.pages.callforward.CallForwardController', {
store.sync(); store.sync();
}, },
parseTimesetApiToRecords: function(times) { checkIncompatibleTimeset: function(timeSlot){
var mday = timeSlot.mday;
var minute = timeSlot.minute;
var month = timeSlot.month;
var year = timeSlot.year;
return mday || minute || month || year;
},
parseTimesetApiToRecords: function(times, timesetName) {
var retData = []; var retData = [];
var me = this;
var vm = me.getViewModel();
var weekDaysMap = { var weekDaysMap = {
1: 'Sunday', 1: 'Sunday',
2: 'Monday', 2: 'Monday',
@ -56,6 +66,11 @@ Ext.define('NgcpCsc.view.pages.callforward.CallForwardController', {
var days = timeSlot.wday.split('-'); var days = timeSlot.wday.split('-');
var fromHour = timeSlot.hour ? parseInt(timeSlot.hour.split('-')[0]) : null; var fromHour = timeSlot.hour ? parseInt(timeSlot.hour.split('-')[0]) : null;
var toHour = timeSlot.hour ? parseInt(timeSlot.hour.split('-')[1]) : null; var toHour = timeSlot.hour ? parseInt(timeSlot.hour.split('-')[1]) : null;
var checkIncompatibleTimeset = me.checkIncompatibleTimeset(timeSlot);
if(checkIncompatibleTimeset){
vm.set(me.getTimesetPrexifFromName(timesetName) + '_add_text', '<div class="cf-invalid-period-box">' + Ngcp.csc.locales.callforward.invalid_times[localStorage.getItem('languageSelected')] + '</div>');
return;
}
if (days.length > 1) { if (days.length > 1) {
var fromDay = parseInt(days[0]); var fromDay = parseInt(days[0]);
var toDay = parseInt(days[1]); var toDay = parseInt(days[1]);
@ -87,7 +102,6 @@ Ext.define('NgcpCsc.view.pages.callforward.CallForwardController', {
break; break;
default: default:
return 0; return 0;
} }
}, },
@ -107,7 +121,10 @@ Ext.define('NgcpCsc.view.pages.callforward.CallForwardController', {
cfTimesetStoreLoaded: function(store, data) { cfTimesetStoreLoaded: function(store, data) {
var me = this; var me = this;
var arrayOfModels = []; var arrayOfModels = [];
var vm = this.getViewModel();
var currentRoute = window.location.hash;
var timesets; var timesets;
if (data.getData()._embedded == undefined) { if (data.getData()._embedded == undefined) {
return; return;
} else { } else {
@ -117,9 +134,8 @@ Ext.define('NgcpCsc.view.pages.callforward.CallForwardController', {
Ext.each(timesets, function(timeset) { Ext.each(timesets, function(timeset) {
var timesetName = timeset.name; var timesetName = timeset.name;
var timesetId = timeset.id; var timesetId = timeset.id;
me.setVmToTrue(timesetName);
if (/(After|Company)\s(Hours)/.test(timesetName)) { if (/(After|Company)\s(Hours)/.test(timesetName)) {
var times = me.parseTimesetApiToRecords(timeset.times); var times = me.parseTimesetApiToRecords(timeset.times, timesetName);
Ext.each(times, function(time) { Ext.each(times, function(time) {
var cfModel = Ext.create('NgcpCsc.model.CallForwardDestination', { var cfModel = Ext.create('NgcpCsc.model.CallForwardDestination', {
id: Ext.id(), id: Ext.id(),
@ -130,22 +146,25 @@ Ext.define('NgcpCsc.view.pages.callforward.CallForwardController', {
day: time.day day: time.day
}); });
arrayOfModels.push(cfModel); arrayOfModels.push(cfModel);
me.setVmToTrue(timesetName, true);
}); });
}; };
}); });
if (arrayOfModels.length > 0) { if (arrayOfModels.length > 0) {
me.populateTimesetStores(arrayOfModels); me.populateTimesetStores(arrayOfModels);
}; }else{
me.setVmToTrue(me.getTimesetFromRoute(currentRoute), false);
}
}, },
setVmToTrue: function(name) { setVmToTrue: function(name, exists) {
var vm = this.getViewModel(); var vm = this.getViewModel();
switch (name) { switch (name) {
case 'After Hours': case 'After Hours':
vm.set('after_hours_exists_in_api', true); vm.set('after_hours_exists_in_api', exists);
break; break;
case 'Company Hours': case 'Company Hours':
vm.set('company_hours_exists_in_api', true); vm.set('company_hours_exists_in_api', exists);
break; break;
}; };
}, },
@ -160,7 +179,6 @@ Ext.define('NgcpCsc.view.pages.callforward.CallForwardController', {
Ext.each(sourcesets, function(sourceset) { Ext.each(sourcesets, function(sourceset) {
var sourcesetName = sourceset.name; var sourcesetName = sourceset.name;
var sourcesetId = sourceset.id; var sourcesetId = sourceset.id;
$cf.setVmToTrue(sourcesetName);
Ext.each(sourceset.sources, function(sourceEntry) { Ext.each(sourceset.sources, function(sourceEntry) {
arrayOfModels.push(Ext.create('NgcpCsc.model.CallForwardDestination', { arrayOfModels.push(Ext.create('NgcpCsc.model.CallForwardDestination', {
id: Ext.id(), id: Ext.id(),
@ -192,6 +210,17 @@ Ext.define('NgcpCsc.view.pages.callforward.CallForwardController', {
}; };
}, },
getTimesetPrexifFromName: function(timesetName) {
switch (timesetName) {
case ('Company Hours'):
return 'company_hours';
break;
case ('After Hours'):
return 'after_hours';
break;
};
},
getStoreNameFromRoute: function(route) { getStoreNameFromRoute: function(route) {
switch (route) { switch (route) {
case ('#callforward/always'): case ('#callforward/always'):

@ -33,7 +33,9 @@ Ext.define('NgcpCsc.view.pages.callforward.CallForwardModel', {
offline_then_number: '', offline_then_number: '',
offline_then_timeout: '10', offline_then_timeout: '10',
after_hours_exists_in_api: false, after_hours_exists_in_api: false,
after_hours_add_text: Ngcp.csc.locales.callforward.no_after_hours_set[localStorage.getItem('languageSelected')],
company_hours_exists_in_api: false, company_hours_exists_in_api: false,
company_hours_add_text: Ngcp.csc.locales.callforward.no_company_hours_set[localStorage.getItem('languageSelected')],
last_store_synced: '', last_store_synced: '',
cft_ringtimeout: '15', cft_ringtimeout: '15',
arrayOfDestModels: null, arrayOfDestModels: null,

@ -50,10 +50,24 @@ Ext.define('NgcpCsc.view.pages.callforward.afterhours.Afterhours', {
items: [{ items: [{
xtype: 'panel', xtype: 'panel',
margin: '10 0 10 0', margin: '10 0 10 0',
html: Ngcp.csc.locales.callforward.no_after_hours_set[localStorage.getItem('languageSelected')],
bind: { bind: {
hidden: '{after_hours_exists_in_api}' hidden: '{after_hours_exists_in_api}'
} },
items: [{
bind: {
html: '{after_hours_add_text}'
}
}, {
width: '100%',
layout:'hbox',
items: [{
flex: 5
},{
flex: 1,
xtype: 'button',
text: Ngcp.csc.locales.common.create[localStorage.getItem('languageSelected')]
}]
}]
}, },
callForwardAfterGrid, { callForwardAfterGrid, {
text: Ngcp.csc.locales.common.save_caps[localStorage.getItem('languageSelected')], text: Ngcp.csc.locales.common.save_caps[localStorage.getItem('languageSelected')],

@ -50,17 +50,30 @@ Ext.define('NgcpCsc.view.pages.callforward.companyhours.Companyhours', {
items: [{ items: [{
xtype: 'panel', xtype: 'panel',
margin: '10 0 10 0', margin: '10 0 10 0',
html: Ngcp.csc.locales.callforward.no_company_hours_set[localStorage.getItem('languageSelected')],
bind: { bind: {
hidden: '{company_hours_exists_in_api}' hidden: '{company_hours_exists_in_api}'
} },
items: [{
bind: {
html: '{company_hours_add_text}'
}
}, {
width: '100%',
layout:'hbox',
items: [{
flex: 5
},{
flex: 1,
xtype: 'button',
text: Ngcp.csc.locales.common.create[localStorage.getItem('languageSelected')]
}]
}]
}, },
callForwardCompanyGrid, callForwardCompanyGrid, {
{
text: Ngcp.csc.locales.common.save_caps[localStorage.getItem('languageSelected')], text: Ngcp.csc.locales.common.save_caps[localStorage.getItem('languageSelected')],
xtype: 'button', xtype: 'button',
cls: 'x-btn-left',
id: 'companyHours-saveButton', id: 'companyHours-saveButton',
cls: 'x-btn-left',
width: 135, width: 135,
margin: '10 0 10 585', margin: '10 0 10 585',
listeners: { listeners: {

Loading…
Cancel
Save