From 85bcb356d4984377bd06b8f5c7e8e55911c02ac5 Mon Sep 17 00:00:00 2001 From: Bernat Date: Fri, 18 Oct 2019 13:52:15 +0200 Subject: [PATCH] 1778 Refactor worker.phone --- modules/worker/front/phones/index.js | 20 +++++++++++--------- modules/worker/front/routes.json | 2 +- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/modules/worker/front/phones/index.js b/modules/worker/front/phones/index.js index b4eb8df71..3810832d9 100644 --- a/modules/worker/front/phones/index.js +++ b/modules/worker/front/phones/index.js @@ -1,9 +1,8 @@ import ngModule from '../module'; class Controller { - constructor($scope, $stateParams) { + constructor($scope) { this.$scope = $scope; - this.$stateParams = $stateParams; } get worker() { @@ -12,12 +11,15 @@ class Controller { set worker(value) { this._worker = value; - if (value) { - this.$scope.$applyAsync(()=> { - this.$scope.model.link = {userFk: value.userFk}; - this.$scope.model.refresh(); - }); - } + if (value) + this.setLink(value); + } + + setLink(value) { + this.$scope.$applyAsync(()=> { + this.$scope.model.link = {userFk: value.userFk}; + this.$scope.model.refresh(); + }); } onSubmit() { @@ -34,7 +36,7 @@ class Controller { } } -Controller.$inject = ['$scope', '$stateParams']; +Controller.$inject = ['$scope']; ngModule.component('vnWorkerPhones', { template: require('./index.html'), diff --git a/modules/worker/front/routes.json b/modules/worker/front/routes.json index c92ccc94d..e2fa9c165 100644 --- a/modules/worker/front/routes.json +++ b/modules/worker/front/routes.json @@ -8,7 +8,7 @@ {"state": "worker.card.pbx", "icon": "icon-pbx"}, {"state": "worker.card.calendar", "icon": "icon-calendar"}, {"state": "worker.card.timeControl", "icon": "access_time"}, - {"state": "worker.card.phones", "icon": "icon-pbx"} + {"state": "worker.card.phones", "icon": "contact_phone"} ], "routes": [ {