|
|
|
@ -12,12 +12,52 @@ define(function(require){ |
|
|
|
'voip.featureCodes.render': 'featureCodesRender' |
|
|
|
}, |
|
|
|
|
|
|
|
categories: { |
|
|
|
call_forward: [ |
|
|
|
"call_forward[action=activate]", |
|
|
|
"call_forward[action=deactivate]", |
|
|
|
"call_forward[action=toggle]", |
|
|
|
"call_forward[action=update]", |
|
|
|
"call_forward[action=on_busy_enable]", |
|
|
|
"call_forward[action=on_busy_disable]", |
|
|
|
"call_forward[action=no_answer_enable]", |
|
|
|
"call_forward[action=no_answer_disable]" |
|
|
|
], |
|
|
|
hotdesk: [ |
|
|
|
"hotdesk[action=login]", |
|
|
|
"hotdesk[action=logout]", |
|
|
|
"hotdesk[action=toggle]" |
|
|
|
], |
|
|
|
parking: [ |
|
|
|
"park_and_retrieve", |
|
|
|
"valet", |
|
|
|
"retrieve" |
|
|
|
], |
|
|
|
do_not_disturb: [ |
|
|
|
"donotdisturb[action=\"enable\"]", |
|
|
|
"donotdisturb[action=\"disable\"]", |
|
|
|
"donotdisturb[action=\"toggle\"]" |
|
|
|
], |
|
|
|
misc: [ |
|
|
|
"voicemail[action=check]", |
|
|
|
"voicemail[action=\"direct\"]", |
|
|
|
"intercom", |
|
|
|
"privacy[mode=full]", |
|
|
|
"directory", |
|
|
|
"time", |
|
|
|
"call_waiting[action=enable]", |
|
|
|
"call_waiting[action=disable]", |
|
|
|
"sound_test_service", |
|
|
|
"call_recording" |
|
|
|
] |
|
|
|
}, |
|
|
|
|
|
|
|
featureCodesRender: function(args) { |
|
|
|
var self = this, |
|
|
|
parent = args.parent || $('.right-content'); |
|
|
|
|
|
|
|
self.featureCodesLoadData(function(featureCodesData) { |
|
|
|
var template = $(monster.template(self, 'featureCodes-layout', {featureCodes: featureCodesData})); |
|
|
|
var template = $(monster.template(self, 'featureCodes-layout', { featureCodes: self.featureCodesFormatData(featureCodesData) })); |
|
|
|
|
|
|
|
self.featureCodesBindEvents({ |
|
|
|
parent: parent, |
|
|
|
@ -43,18 +83,43 @@ define(function(require){ |
|
|
|
} |
|
|
|
}, |
|
|
|
success: function(data, status) { |
|
|
|
var featureCodes = $.map(data.data, function(callflow) { |
|
|
|
if(!_.isEmpty(callflow.featurecode)) { |
|
|
|
return { |
|
|
|
key: callflow.featurecode.name, |
|
|
|
name: self.i18n.active().featureCodes.labels[callflow.featurecode.name], |
|
|
|
number: callflow.featurecode.number.replace(/\\/g,'') |
|
|
|
}; |
|
|
|
} |
|
|
|
}); |
|
|
|
callback && callback(featureCodes); |
|
|
|
callback && callback(data.data); |
|
|
|
} |
|
|
|
}); |
|
|
|
}, |
|
|
|
|
|
|
|
featureCodesFormatData: function(featureCodeData) { |
|
|
|
var self = this, |
|
|
|
featureCodes = {}; |
|
|
|
|
|
|
|
_.each(featureCodeData, function(callflow) { |
|
|
|
var category = 'misc'; |
|
|
|
_.find(self.categories, function(cat, key) { |
|
|
|
if(cat.indexOf(callflow.featurecode.name) >= 0) { |
|
|
|
category = key; |
|
|
|
return true; |
|
|
|
} |
|
|
|
return false; |
|
|
|
}); |
|
|
|
|
|
|
|
if(!featureCodes.hasOwnProperty(category)) { |
|
|
|
featureCodes[category] = { |
|
|
|
category: self.i18n.active().featureCodes.categories[category], |
|
|
|
codes: [] |
|
|
|
}; |
|
|
|
} |
|
|
|
|
|
|
|
featureCodes[category].codes.push({ |
|
|
|
key: callflow.featurecode.name, |
|
|
|
name: self.i18n.active().featureCodes.labels[callflow.featurecode.name], |
|
|
|
number: callflow.featurecode.number.replace(/\\/g,'') |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
return monster.util.sort($.map(featureCodes, function(category) { |
|
|
|
monster.util.sort(category.codes, 'number'); |
|
|
|
return category; |
|
|
|
}), 'category'); |
|
|
|
}, |
|
|
|
|
|
|
|
featureCodesBindEvents: function(args) { |
|
|
|
|