diff --git a/client/app/telecom/pack/xdsl/modem/service/pack-xdsl-modem-service.controller.js b/client/app/telecom/pack/xdsl/modem/service/pack-xdsl-modem-service.controller.js index edf72b329..a95a1cc95 100644 --- a/client/app/telecom/pack/xdsl/modem/service/pack-xdsl-modem-service.controller.js +++ b/client/app/telecom/pack/xdsl/modem/service/pack-xdsl-modem-service.controller.js @@ -222,7 +222,7 @@ angular.module('managerApp').controller('XdslModemServiceCtrl', class XdslModemS }).$promise .then(({ xdslTask }) => { sipAlg.value = xdslTask === 'enabled'; - sipAlg.isDefine = true; + sipAlg.isDefined = true; return xdslTask; }).finally(() => { this.modemServices.push(sipAlg); diff --git a/client/app/telecom/telephony/line/phone/programmableKeys/telecom-telephony-line-phone-programmableKeys.controller.js b/client/app/telecom/telephony/line/phone/programmableKeys/telecom-telephony-line-phone-programmableKeys.controller.js index 9c9251d46..eb493cb8c 100644 --- a/client/app/telecom/telephony/line/phone/programmableKeys/telecom-telephony-line-phone-programmableKeys.controller.js +++ b/client/app/telecom/telephony/line/phone/programmableKeys/telecom-telephony-line-phone-programmableKeys.controller.js @@ -82,10 +82,29 @@ export default class TelecomTelephonyLinePhoneProgammableKeysCtrl { /* ----- End of INITIALIZATION ------*/ getPhone() { + const regexp = new RegExp(/[a-z]+|[\d.-_]+/ig); + const complexNumericRegExp = new RegExp(/\d+/g); + + function sortFunctionKeys(a, b) { + const [alphaA, numericA] = a.label.match(regexp); + const [alphaB, numericB] = b.label.match(regexp); + if (alphaA === alphaB) { + const [numericA1, numericA2] = numericA.match(complexNumericRegExp); + const [numericB1, numericB2] = numericB.match(complexNumericRegExp); + + if (numericA1 === numericB1) { + return parseInt(numericA2, 10) > parseInt(numericB2, 10) ? 1 : -1; + } + return parseInt(numericA, 10) > parseInt(numericB, 10) ? 1 : -1; + } + return alphaA > alphaB ? 1 : -1; + } + return this.line.getPhone().then(() => { if (this.line.hasPhone) { return this.line.phone.initDeffered().then(() => { - this.functionKeys.raw = angular.copy(this.line.phone.functionKeys); + this.functionKeys.raw = _.cloneDeep(this.line.phone.functionKeys); + this.functionKeys.raw.sort(sortFunctionKeys); }); } return null; diff --git a/client/app/telecom/telephony/line/phone/reboot/telecom-telephony-line-phone-reboot.controller.js b/client/app/telecom/telephony/line/phone/reboot/telecom-telephony-line-phone-reboot.controller.js index e5a4a0b4b..74981d8b8 100644 --- a/client/app/telecom/telephony/line/phone/reboot/telecom-telephony-line-phone-reboot.controller.js +++ b/client/app/telecom/telephony/line/phone/reboot/telecom-telephony-line-phone-reboot.controller.js @@ -7,7 +7,7 @@ angular.module('managerApp').controller('TelecomTelephonyLinePhoneRebootCtrl', f .getGroup($stateParams.billingAccount) .then(group => group.getLine($stateParams.serviceName).getPhone()).then((phone) => { self.phone = phone; - self.isRebootable = /^phone\.(thomson|swissvoice)/.test(self.phone.brand); + self.isRebootable = !/^phone\.(gigaset|cisco.spa112)/.test(self.phone.brand); }) .catch(err => new TucToastError(err)) .finally(() => {