diff --git a/modules/claim/front/index/index.html b/modules/claim/front/index/index.html index 535fbc214..f6d27dffb 100644 --- a/modules/claim/front/index/index.html +++ b/modules/claim/front/index/index.html @@ -76,7 +76,7 @@ + user-id="$ctrl.selectedWorker"> diff --git a/modules/claim/front/summary/index.html b/modules/claim/front/summary/index.html index 4a04ae4e2..dd50d4933 100644 --- a/modules/claim/front/summary/index.html +++ b/modules/claim/front/summary/index.html @@ -149,5 +149,5 @@ + user-id="$ctrl.selectedWorker"> \ No newline at end of file diff --git a/modules/item/front/index/index.html b/modules/item/front/index/index.html index 656a28e79..997f2fded 100644 --- a/modules/item/front/index/index.html +++ b/modules/item/front/index/index.html @@ -119,5 +119,5 @@ + user-id="$ctrl.selectedWorker"> \ No newline at end of file diff --git a/modules/order/front/index/index.html b/modules/order/front/index/index.html index 9c738d2e8..b136425ab 100644 --- a/modules/order/front/index/index.html +++ b/modules/order/front/index/index.html @@ -81,7 +81,7 @@ + user-id="$ctrl.selectedWorker"> + user-id="$ctrl.selectedWorker"> + user-id="$ctrl.selectedWorker"> \ No newline at end of file diff --git a/modules/ticket/front/request/index/index.html b/modules/ticket/front/request/index/index.html index f15c4e55e..e868486af 100644 --- a/modules/ticket/front/request/index/index.html +++ b/modules/ticket/front/request/index/index.html @@ -86,7 +86,7 @@ + user-id="$ctrl.selectedWorker"> + user-id="$ctrl.selectedWorker"> \ No newline at end of file diff --git a/modules/ticket/front/tracking/index/index.html b/modules/ticket/front/tracking/index/index.html index 4497fdad2..269fe23ac 100644 --- a/modules/ticket/front/tracking/index/index.html +++ b/modules/ticket/front/tracking/index/index.html @@ -41,5 +41,5 @@ + user-id="$ctrl.selectedWorker"> \ No newline at end of file diff --git a/modules/worker/front/descriptor-popover/index.js b/modules/worker/front/descriptor-popover/index.js index 637bfe50c..0df83ae45 100644 --- a/modules/worker/front/descriptor-popover/index.js +++ b/modules/worker/front/descriptor-popover/index.js @@ -11,16 +11,16 @@ class Controller extends Component { this.worker = null; } - set workerFk(id) { - if (id == this._workerFk) return; + set userId(id) { + if (id == this._userId) return; - this._workerFk = id; + this._userId = id; this.worker = null; this.loadData(); } - get workerFk() { - return this._workerFk; + get userId() { + return this._userId; } set quicklinks(value = {}) { @@ -37,8 +37,11 @@ class Controller extends Component { } loadData() { - let query = `api/Workers/${this._workerFk}`; + let query = `api/Workers/findOne`; let filter = { + where: { + userFk: this._userId + }, include: [ { relation: 'user', @@ -49,6 +52,13 @@ class Controller extends Component { }, { relation: 'sip', scope: {fields: ['extension']} + }, { + relation: 'department', + scope: { + include: { + relation: 'department' + } + } } ] }; @@ -67,7 +77,7 @@ ngModule.component('vnWorkerDescriptorPopover', { template: require('./index.html'), controller: Controller, bindings: { - workerFk: '<', + userId: '<', quicklinks: '<' } }); diff --git a/modules/worker/front/descriptor-popover/index.spec.js b/modules/worker/front/descriptor-popover/index.spec.js index 246fb9b37..c0267c397 100644 --- a/modules/worker/front/descriptor-popover/index.spec.js +++ b/modules/worker/front/descriptor-popover/index.spec.js @@ -21,23 +21,23 @@ describe('worker Component vnWorkerDescriptorPopover', () => { describe('workerFk()', () => { it(`should not apply any changes if the received id is the same stored in _workerFk`, () => { controller.worker = 'I exist!'; - controller._workerFk = 1; + controller._userId = 1; spyOn(controller, 'loadData'); - controller.workerFk = 1; + controller.userId = 1; expect(controller.worker).toEqual('I exist!'); - expect(controller._workerFk).toEqual(1); + expect(controller._userId).toEqual(1); expect(controller.loadData).not.toHaveBeenCalled(); }); it(`should set the received id into _workerFk, set the worker to null and then call loadData()`, () => { controller.worker = `Please don't`; - controller._workerFk = 1; + controller._userId = 1; spyOn(controller, 'loadData'); - controller.workerFk = 999; + controller.userId = 999; expect(controller.worker).toBeNull(); - expect(controller._workerFk).toEqual(999); + expect(controller._userId).toEqual(999); expect(controller.loadData).toHaveBeenCalledWith(); }); }); @@ -53,12 +53,15 @@ describe('worker Component vnWorkerDescriptorPopover', () => { describe('loadData()', () => { it(`should perform a get query to store the worker data into the controller`, () => { - controller.workerFk = 1; + controller.userId = 1; controller.canceler = null; let response = {}; let config = { filter: { + where: { + userFk: controller.userId + }, include: [ { relation: 'user', @@ -69,6 +72,13 @@ describe('worker Component vnWorkerDescriptorPopover', () => { }, { relation: 'sip', scope: {fields: ['extension']} + }, { + relation: 'department', + scope: { + include: { + relation: 'department' + } + } } ] } @@ -76,8 +86,8 @@ describe('worker Component vnWorkerDescriptorPopover', () => { let json = $httpParamSerializer(config); - $httpBackend.whenGET(`api/Workers/${controller._workerFk}?${json}`).respond(response); - $httpBackend.expectGET(`api/Workers/${controller._workerFk}?${json}`); + $httpBackend.whenGET(`api/Workers/findOne?${json}`).respond(response); + $httpBackend.expectGET(`api/Workers/findOne?${json}`); controller.loadData(); $httpBackend.flush();