From 9f9963af5679edcae918134b20031dad4e54035c Mon Sep 17 00:00:00 2001 From: carlossa Date: Tue, 16 May 2023 13:10:26 +0200 Subject: [PATCH] refs #5334 descriptor --- .../front/department/descriptor/index.html | 53 ++------ .../front/department/descriptor/index.js | 125 ++++++------------ 2 files changed, 53 insertions(+), 125 deletions(-) diff --git a/modules/worker/front/department/descriptor/index.html b/modules/worker/front/department/descriptor/index.html index 05230bd09..0fa80da50 100644 --- a/modules/worker/front/department/descriptor/index.html +++ b/modules/worker/front/department/descriptor/index.html @@ -7,63 +7,30 @@ ng-click="$ctrl.handleExcluded()" translate ng-if="!$ctrl.excluded"> - Click to exclude the user from getting disabled - - - Click to allow the user to be disabled + Delete +

{{worker.department.name}}

+

{{worker.department.id}}

+ label="Chat" + value="{{$ctrl.worker.department.chatName}}"> + value="{{$ctrl.worker.department.emailNotification}}"> + label="Self-consumption customer" + value="{{$ctrl.worker.department.clientFK}}"> - - + label="Boss department" + value="{{$ctrl.worker.department.workerFk}}">
-
- - -
-
diff --git a/modules/worker/front/department/descriptor/index.js b/modules/worker/front/department/descriptor/index.js index 12ec396a6..937f4c351 100644 --- a/modules/worker/front/department/descriptor/index.js +++ b/modules/worker/front/department/descriptor/index.js @@ -7,90 +7,51 @@ class Controller extends Descriptor { this.$rootScope = $rootScope; } - // get worker() { - // return this.entity; - // } + get department() { + return this.entity; + } - // set worker(value) { - // this.entity = value; + set department(value) { + this.entity = value; + } + loadData() { + const filter = { + include: [ + { + relation: 'user', + scope: { + fields: ['name'], + include: { + relation: 'emailUser', + scope: { + fields: ['email'] + } + } + } + }, { + relation: 'client', + scope: { + fields: ['fi'] + } + }, { + relation: 'sip', + scope: { + fields: ['extension'] + } + }, { + relation: 'department', + scope: { + include: { + relation: 'department' + } + } + } + ] + }; - // if (value) - // this.getIsExcluded(); - // } - - // get excluded() { - // return this.entity.excluded; - // } - - // set excluded(value) { - // this.entity.excluded = value; - // } - - // getIsExcluded() { - // this.$http.get(`workerDisableExcludeds/${this.entity.id}/exists`).then(data => { - // this.excluded = data.data.exists; - // }); - // } - - // handleExcluded() { - // if (this.excluded) { - // this.$http.delete(`workerDisableExcludeds/${this.entity.id}`); - // this.excluded = false; - // } else { - // this.$http.post(`workerDisableExcludeds`, {workerFk: this.entity.id, dated: new Date}); - // this.excluded = true; - // } - // } - - // loadData() { - // const filter = { - // include: [ - // { - // relation: 'user', - // scope: { - // fields: ['name'], - // include: { - // relation: 'emailUser', - // scope: { - // fields: ['email'] - // } - // } - // } - // }, { - // relation: 'client', - // scope: { - // fields: ['fi'] - // } - // }, { - // relation: 'sip', - // scope: { - // fields: ['extension'] - // } - // }, { - // relation: 'department', - // scope: { - // include: { - // relation: 'department' - // } - // } - // } - // ] - // }; - - // return this.getData(`Workers/${this.id}`, {filter}) - // .then(res => this.entity = res.data); - // } - - // onUploadResponse() { - // const timestamp = Date.vnNew().getTime(); - // const src = this.$rootScope.imagePath('user', '520x520', this.worker.id); - // const zoomSrc = this.$rootScope.imagePath('user', '1600x1600', this.worker.id); - // const newSrc = `${src}&t=${timestamp}`; - // const newZoomSrc = `${zoomSrc}&t=${timestamp}`; - - // this.$.photo.setAttribute('src', newSrc); - // this.$.photo.setAttribute('zoom-image', newZoomSrc); - // } + return this.getData(`Workers/${this.id}`, {filter}) + .then(res => this.entity = res.data); + } } Controller.$inject = ['$element', '$scope', '$rootScope'];