From e26eedb51cdd0b88b056aff532e410150cda7da7 Mon Sep 17 00:00:00 2001 From: carlossa Date: Tue, 30 May 2023 11:54:14 +0200 Subject: [PATCH] refs #5334 descriptor wprkerFk clientFk --- modules/worker/front/department/card/index.js | 13 +++++----- .../front/department/descriptor/index.html | 4 +-- .../front/department/descriptor/index.js | 12 +++++---- .../front/department/descriptor/index.spec.js | 26 ------------------- 4 files changed, 16 insertions(+), 39 deletions(-) delete mode 100644 modules/worker/front/department/descriptor/index.spec.js diff --git a/modules/worker/front/department/card/index.js b/modules/worker/front/department/card/index.js index 72b0876a0..93a39dd44 100644 --- a/modules/worker/front/department/card/index.js +++ b/modules/worker/front/department/card/index.js @@ -7,15 +7,16 @@ class Controller extends ModuleCard { fields: ['id', 'name', 'code', 'workerFk', 'isProduction', 'chatName', 'isTeleworking', 'notificationEmail', 'hasToRefill', 'hasToSendMail', 'hasToMistake', 'clientFk'], include: [ - { - relation: 'client', - scope: {fields: ['name']} - }, + {relation: 'client', + scope: { + fields: ['id', 'name'] + }}, { relation: 'worker', - scope: {fields: ['name']} + scope: { + fields: ['id', 'firstName', 'lastName'] + } } - ] }; diff --git a/modules/worker/front/department/descriptor/index.html b/modules/worker/front/department/descriptor/index.html index 8ac078968..78aaf45b7 100644 --- a/modules/worker/front/department/descriptor/index.html +++ b/modules/worker/front/department/descriptor/index.html @@ -24,11 +24,11 @@ + value="{{$ctrl.department.client.name}}"> + value="{{$ctrl.department.worker.firstName}} {{$ctrl.department.worker.secondName}}"> diff --git a/modules/worker/front/department/descriptor/index.js b/modules/worker/front/department/descriptor/index.js index 3a7c2b5fe..46764751c 100644 --- a/modules/worker/front/department/descriptor/index.js +++ b/modules/worker/front/department/descriptor/index.js @@ -19,13 +19,15 @@ class Controller extends Descriptor { fields: ['id', 'name', 'code', 'workerFk', 'isProduction', 'chatName', 'isTeleworking', 'notificationEmail', 'hasToRefill', 'hasToSendMail', 'hasToMistake', 'clientFk'], include: [ - { - relation: 'client', - scope: {fields: ['name']} - }, + {relation: 'client', + scope: { + fields: ['id', 'name'] + }}, { relation: 'worker', - scope: {fields: ['name']} + scope: { + fields: ['id', 'firstName', 'lastName'] + } } ] }; diff --git a/modules/worker/front/department/descriptor/index.spec.js b/modules/worker/front/department/descriptor/index.spec.js deleted file mode 100644 index dfb800415..000000000 --- a/modules/worker/front/department/descriptor/index.spec.js +++ /dev/null @@ -1,26 +0,0 @@ -import './index.js'; - -describe('vnWorkerDescriptor', () => { - let controller; - let $httpBackend; - - beforeEach(ngModule('worker')); - - beforeEach(inject(($componentController, _$httpBackend_) => { - $httpBackend = _$httpBackend_; - controller = $componentController('vnWorkerDescriptor', {$element: null}); - })); - - describe('loadData()', () => { - it(`should perform a get query to store the worker data into the controller`, () => { - const id = 1; - const response = 'foo'; - - $httpBackend.expectRoute('GET', `Workers/${id}`).respond(response); - controller.id = id; - $httpBackend.flush(); - - expect(controller.worker).toEqual(response); - }); - }); -});