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.',
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: {
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.'
}
},
contacts:{
title:{
contacts: {
title: {
en: 'Contacts',
it: 'Contacts',
de: 'Contacts',
fr: 'Contacts',
sp: 'Contacts'
},
delete_user:{
delete_user: {
en: '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?',
@ -2107,14 +2110,14 @@ Ext.define('Ngcp.csc.locales', {
}
},
devices: {
delete_assignment:{
delete_assignment: {
en: '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}?',
fr: 'Do you really want to unassign button {0}?',
sp: 'Do you really want to unassign button {0}?'
},
tooltip:{
tooltip: {
click: {
en: 'Click to edit or remove',
it: 'Click to edit or remove',
@ -2133,6 +2136,9 @@ Ext.define('Ngcp.csc.locales', {
}
},
common: {
create: {
en: 'CREATE'
},
edit: {
en: 'Edit',
it: 'Edit',

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

@ -41,8 +41,18 @@ Ext.define('NgcpCsc.view.pages.callforward.CallForwardController', {
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 me = this;
var vm = me.getViewModel();
var weekDaysMap = {
1: 'Sunday',
2: 'Monday',
@ -56,6 +66,11 @@ Ext.define('NgcpCsc.view.pages.callforward.CallForwardController', {
var days = timeSlot.wday.split('-');
var fromHour = timeSlot.hour ? parseInt(timeSlot.hour.split('-')[0]) : 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) {
var fromDay = parseInt(days[0]);
var toDay = parseInt(days[1]);
@ -87,7 +102,6 @@ Ext.define('NgcpCsc.view.pages.callforward.CallForwardController', {
break;
default:
return 0;
}
},
@ -107,7 +121,10 @@ Ext.define('NgcpCsc.view.pages.callforward.CallForwardController', {
cfTimesetStoreLoaded: function(store, data) {
var me = this;
var arrayOfModels = [];
var vm = this.getViewModel();
var currentRoute = window.location.hash;
var timesets;
if (data.getData()._embedded == undefined) {
return;
} else {
@ -117,9 +134,8 @@ Ext.define('NgcpCsc.view.pages.callforward.CallForwardController', {
Ext.each(timesets, function(timeset) {
var timesetName = timeset.name;
var timesetId = timeset.id;
me.setVmToTrue(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) {
var cfModel = Ext.create('NgcpCsc.model.CallForwardDestination', {
id: Ext.id(),
@ -130,22 +146,25 @@ Ext.define('NgcpCsc.view.pages.callforward.CallForwardController', {
day: time.day
});
arrayOfModels.push(cfModel);
me.setVmToTrue(timesetName, true);
});
};
});
if (arrayOfModels.length > 0) {
me.populateTimesetStores(arrayOfModels);
};
}else{
me.setVmToTrue(me.getTimesetFromRoute(currentRoute), false);
}
},
setVmToTrue: function(name) {
setVmToTrue: function(name, exists) {
var vm = this.getViewModel();
switch (name) {
case 'After Hours':
vm.set('after_hours_exists_in_api', true);
vm.set('after_hours_exists_in_api', exists);
break;
case 'Company Hours':
vm.set('company_hours_exists_in_api', true);
vm.set('company_hours_exists_in_api', exists);
break;
};
},
@ -160,7 +179,6 @@ Ext.define('NgcpCsc.view.pages.callforward.CallForwardController', {
Ext.each(sourcesets, function(sourceset) {
var sourcesetName = sourceset.name;
var sourcesetId = sourceset.id;
$cf.setVmToTrue(sourcesetName);
Ext.each(sourceset.sources, function(sourceEntry) {
arrayOfModels.push(Ext.create('NgcpCsc.model.CallForwardDestination', {
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) {
switch (route) {
case ('#callforward/always'):

@ -33,7 +33,9 @@ Ext.define('NgcpCsc.view.pages.callforward.CallForwardModel', {
offline_then_number: '',
offline_then_timeout: '10',
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_add_text: Ngcp.csc.locales.callforward.no_company_hours_set[localStorage.getItem('languageSelected')],
last_store_synced: '',
cft_ringtimeout: '15',
arrayOfDestModels: null,

@ -50,10 +50,24 @@ Ext.define('NgcpCsc.view.pages.callforward.afterhours.Afterhours', {
items: [{
xtype: 'panel',
margin: '10 0 10 0',
html: Ngcp.csc.locales.callforward.no_after_hours_set[localStorage.getItem('languageSelected')],
bind: {
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, {
text: Ngcp.csc.locales.common.save_caps[localStorage.getItem('languageSelected')],

@ -50,17 +50,30 @@ Ext.define('NgcpCsc.view.pages.callforward.companyhours.Companyhours', {
items: [{
xtype: 'panel',
margin: '10 0 10 0',
html: Ngcp.csc.locales.callforward.no_company_hours_set[localStorage.getItem('languageSelected')],
bind: {
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')],
xtype: 'button',
cls: 'x-btn-left',
id: 'companyHours-saveButton',
cls: 'x-btn-left',
width: 135,
margin: '10 0 10 585',
listeners: {

Loading…
Cancel
Save