refs #5334 descriptor wprkerFk clientFk
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Carlos Satorres 2023-05-30 11:54:14 +02:00
parent cf632040e7
commit e26eedb51c
4 changed files with 16 additions and 39 deletions

View File

@ -7,15 +7,16 @@ class Controller extends ModuleCard {
fields: ['id', 'name', 'code', 'workerFk', 'isProduction', 'chatName', fields: ['id', 'name', 'code', 'workerFk', 'isProduction', 'chatName',
'isTeleworking', 'notificationEmail', 'hasToRefill', 'hasToSendMail', 'hasToMistake', 'clientFk'], 'isTeleworking', 'notificationEmail', 'hasToRefill', 'hasToSendMail', 'hasToMistake', 'clientFk'],
include: [ include: [
{ {relation: 'client',
relation: 'client', scope: {
scope: {fields: ['name']} fields: ['id', 'name']
}, }},
{ {
relation: 'worker', relation: 'worker',
scope: {fields: ['name']} scope: {
fields: ['id', 'firstName', 'lastName']
}
} }
] ]
}; };

View File

@ -24,11 +24,11 @@
</vn-label-value> </vn-label-value>
<vn-label-value <vn-label-value
label="Self-consumption customer" label="Self-consumption customer"
value="{{$ctrl.department.clientFK}}"> value="{{$ctrl.department.client.name}}">
</vn-label-value> </vn-label-value>
<vn-label-value <vn-label-value
label="Boss department" label="Boss department"
value="{{$ctrl.department.workerFk}}"> value="{{$ctrl.department.worker.firstName}} {{$ctrl.department.worker.secondName}}">
</vn-label-value> </vn-label-value>
</div> </div>
</div> </div>

View File

@ -19,13 +19,15 @@ class Controller extends Descriptor {
fields: ['id', 'name', 'code', 'workerFk', 'isProduction', 'chatName', fields: ['id', 'name', 'code', 'workerFk', 'isProduction', 'chatName',
'isTeleworking', 'notificationEmail', 'hasToRefill', 'hasToSendMail', 'hasToMistake', 'clientFk'], 'isTeleworking', 'notificationEmail', 'hasToRefill', 'hasToSendMail', 'hasToMistake', 'clientFk'],
include: [ include: [
{ {relation: 'client',
relation: 'client', scope: {
scope: {fields: ['name']} fields: ['id', 'name']
}, }},
{ {
relation: 'worker', relation: 'worker',
scope: {fields: ['name']} scope: {
fields: ['id', 'firstName', 'lastName']
}
} }
] ]
}; };

View File

@ -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);
});
});
});