From d5aae8f824562074ca7693c0669227b489e1d784 Mon Sep 17 00:00:00 2001 From: vicent Date: Wed, 31 May 2023 14:53:31 +0200 Subject: [PATCH 01/10] refs #5688 refactor: muestra un mensaje de error controlado --- loopback/locale/es.json | 5 +++-- modules/worker/back/methods/calendar/absences.js | 5 ++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/loopback/locale/es.json b/loopback/locale/es.json index d88a4ebc95..56ecb741fb 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -84,7 +84,7 @@ "The current ticket can't be modified": "El ticket actual no puede ser modificado", "The current claim can't be modified": "La reclamación actual no puede ser modificada", "The sales of this ticket can't be modified": "Las lineas de este ticket no pueden ser modificadas", - "The sales do not exists": "La(s) línea(s) seleccionada(s) no existe(n)", + "The sales do not exists": "La(s) línea(s) seleccionada(s) no existe(n)", "Please select at least one sale": "Por favor selecciona al menos una linea", "All sales must belong to the same ticket": "Todas las lineas deben pertenecer al mismo ticket", "NO_ZONE_FOR_THIS_PARAMETERS": "Para este día no hay ninguna zona configurada", @@ -293,5 +293,6 @@ "comercialName": "Comercial", "Invalid NIF for VIES": "Invalid NIF for VIES", "Ticket does not exist": "Este ticket no existe", - "Ticket is already signed": "Este ticket ya ha sido firmado" + "Ticket is already signed": "Este ticket ya ha sido firmado", + "This worker does not have a work center": "Este trabajador no tiene centro de trabajo" } diff --git a/modules/worker/back/methods/calendar/absences.js b/modules/worker/back/methods/calendar/absences.js index 8420ed7705..e78e49698d 100644 --- a/modules/worker/back/methods/calendar/absences.js +++ b/modules/worker/back/methods/calendar/absences.js @@ -117,7 +117,10 @@ module.exports = Self => { absences.push(absence); } - for (let day of contract.workCenter().holidays()) { + const workCenter = contract.workCenter(); + if (!workCenter) throw new UserError(`This worker does not have a work center`); + + for (let day of workCenter.holidays()) { day.dated = new Date(day.dated); day.dated.setHours(0, 0, 0, 0); From 0dbd3abd65d0182779748e04a6fe0543549a6a71 Mon Sep 17 00:00:00 2001 From: vicent Date: Wed, 7 Jun 2023 15:06:37 +0200 Subject: [PATCH 02/10] refs #5808 fix: corregido el condicional --- modules/client/back/models/client.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/client/back/models/client.js b/modules/client/back/models/client.js index 7b577fa981..697129df0f 100644 --- a/modules/client/back/models/client.js +++ b/modules/client/back/models/client.js @@ -14,7 +14,7 @@ module.exports = Self => { Self.validatesPresenceOf('street', { message: 'Street cannot be empty' }); - + Self.validatesPresenceOf('city', { message: 'City cannot be empty' }); @@ -282,7 +282,7 @@ module.exports = Self => { await Self.changeCredit(ctx, finalState, changes); // Credit management changes - if (orgData?.rating != changes.rating || orgData?.recommendedCredit != changes.recommendedCredit) + if (changes?.rating || changes?.recommendedCredit) await Self.changeCreditManagement(ctx, finalState, changes); const oldInstance = {}; From cf559b2ba58b2e5cf31e4292d5b2b6dc91c22639 Mon Sep 17 00:00:00 2001 From: vicent Date: Thu, 8 Jun 2023 09:19:57 +0200 Subject: [PATCH 03/10] =?UTF-8?q?refs=20#5774=20feat:=20solo=20se=20pueden?= =?UTF-8?q?=20a=C3=B1adir=20cantidades=20negativas=20si=20es=20un=20ticket?= =?UTF-8?q?=20de=20abono?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/dump/fixtures.sql | 3 +- loopback/locale/es.json | 5 +- .../methods/sale/specs/updateQuantity.spec.js | 49 +++++++++++++++++++ .../back/methods/sale/updateQuantity.js | 7 +++ 4 files changed, 61 insertions(+), 3 deletions(-) diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index 3476bfe48d..99ed993f06 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -2833,7 +2833,8 @@ INSERT INTO `vn`.`workerConfig` (`id`, `businessUpdated`, `roleFk`, `payMethodFk INSERT INTO `vn`.`ticketRefund`(`refundTicketFk`, `originalTicketFk`) VALUES - (1, 12); + (1, 12), + (8, 10); INSERT INTO `vn`.`deviceProductionModels` (`code`) VALUES diff --git a/loopback/locale/es.json b/loopback/locale/es.json index d88a4ebc95..3b1c331c79 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -84,7 +84,7 @@ "The current ticket can't be modified": "El ticket actual no puede ser modificado", "The current claim can't be modified": "La reclamación actual no puede ser modificada", "The sales of this ticket can't be modified": "Las lineas de este ticket no pueden ser modificadas", - "The sales do not exists": "La(s) línea(s) seleccionada(s) no existe(n)", + "The sales do not exists": "La(s) línea(s) seleccionada(s) no existe(n)", "Please select at least one sale": "Por favor selecciona al menos una linea", "All sales must belong to the same ticket": "Todas las lineas deben pertenecer al mismo ticket", "NO_ZONE_FOR_THIS_PARAMETERS": "Para este día no hay ninguna zona configurada", @@ -293,5 +293,6 @@ "comercialName": "Comercial", "Invalid NIF for VIES": "Invalid NIF for VIES", "Ticket does not exist": "Este ticket no existe", - "Ticket is already signed": "Este ticket ya ha sido firmado" + "Ticket is already signed": "Este ticket ya ha sido firmado", + "You can only add negative amounts in refund tickets": "Solo se puede añadir cantidades negativas en tickets abono" } diff --git a/modules/ticket/back/methods/sale/specs/updateQuantity.spec.js b/modules/ticket/back/methods/sale/specs/updateQuantity.spec.js index 80adb0bd10..8064ea30b2 100644 --- a/modules/ticket/back/methods/sale/specs/updateQuantity.spec.js +++ b/modules/ticket/back/methods/sale/specs/updateQuantity.spec.js @@ -110,4 +110,53 @@ describe('sale updateQuantity()', () => { throw e; } }); + + it('should throw an error if the quantity is negative and it is not a refund ticket', async() => { + const ctx = { + req: { + accessToken: {userId: 1}, + headers: {origin: 'localhost:5000'}, + __: () => {} + } + }; + const saleId = 17; + const newQuantity = -10; + + const tx = await models.Sale.beginTransaction({}); + + let error; + try { + const options = {transaction: tx}; + + await models.Sale.updateQuantity(ctx, saleId, newQuantity, options); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + error = e; + } + + expect(error).toEqual(new Error('You can only add negative amounts in refund tickets')); + }); + + it('should update a negative quantity when is a ticket refund', async() => { + const tx = await models.Sale.beginTransaction({}); + const saleId = 13; + const newQuantity = -10; + + try { + const options = {transaction: tx}; + + await models.Sale.updateQuantity(ctx, saleId, newQuantity, options); + + const modifiedLine = await models.Sale.findOne({where: {id: saleId}, fields: ['quantity']}, options); + + expect(modifiedLine.quantity).toEqual(newQuantity); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); }); diff --git a/modules/ticket/back/methods/sale/updateQuantity.js b/modules/ticket/back/methods/sale/updateQuantity.js index 421c747028..edbc34e421 100644 --- a/modules/ticket/back/methods/sale/updateQuantity.js +++ b/modules/ticket/back/methods/sale/updateQuantity.js @@ -68,6 +68,13 @@ module.exports = Self => { if (newQuantity > sale.quantity && !isRoleAdvanced) throw new UserError('The new quantity should be smaller than the old one'); + const ticketRefund = await models.TicketRefund.findOne({ + where: {refundTicketFk: sale.ticketFk}, + fields: ['id']} + , myOptions); + if (newQuantity < 0 && !ticketRefund) + throw new UserError('You can only add negative amounts in refund tickets'); + const oldQuantity = sale.quantity; const result = await sale.updateAttributes({quantity: newQuantity}, myOptions); From b7b6f413ba45e66f32e080d6022998cc5c1eb326 Mon Sep 17 00:00:00 2001 From: vicent Date: Thu, 15 Jun 2023 14:15:22 +0200 Subject: [PATCH 04/10] refs #5688 feat: no mostrar datos si no tiene workerCenterFk --- modules/worker/front/calendar/index.html | 214 +++++----- modules/worker/front/calendar/index.js | 3 +- modules/worker/front/calendar/locale/es.yml | 3 +- modules/worker/front/card/index.js | 2 + modules/worker/front/time-control/index.html | 406 ++++++++++--------- modules/worker/front/time-control/index.js | 4 + 6 files changed, 327 insertions(+), 305 deletions(-) diff --git a/modules/worker/front/calendar/index.html b/modules/worker/front/calendar/index.html index c9eacbd82b..78d4832c88 100644 --- a/modules/worker/front/calendar/index.html +++ b/modules/worker/front/calendar/index.html @@ -1,104 +1,112 @@ - - -
- - - - - - -
- -
-
-
{{'Contract' | translate}} #{{$ctrl.businessId}}
-
- {{'Used' | translate}} {{$ctrl.contractHolidays.holidaysEnjoyed || 0}} - {{'of' | translate}} {{$ctrl.contractHolidays.totalHolidays || 0}} {{'days' | translate}} -
-
- {{'Spent' | translate}} {{$ctrl.contractHolidays.hoursEnjoyed || 0}} - {{'of' | translate}} {{$ctrl.contractHolidays.totalHours || 0}} {{'hours' | translate}} -
-
- {{'Paid holidays' | translate}} {{$ctrl.contractHolidays.payedHolidays || 0}} {{'days' | translate}} -
-
- -
-
{{'Year' | translate}} {{$ctrl.year}}
-
- {{'Used' | translate}} {{$ctrl.yearHolidays.holidaysEnjoyed || 0}} - {{'of' | translate}} {{$ctrl.yearHolidays.totalHolidays || 0}} {{'days' | translate}} -
-
- {{'Spent' | translate}} {{$ctrl.yearHolidays.hoursEnjoyed || 0}} - {{'of' | translate}} {{$ctrl.yearHolidays.totalHours || 0}} {{'hours' | translate}} -
-
- -
- - - - -
#{{businessFk}}
-
- {{started | date: 'dd/MM/yyyy'}} - {{ended ? (ended | date: 'dd/MM/yyyy') : 'Indef.'}} -
-
-
-
-
- - - - - {{absenceType.name}} - -
-
- - - - Festive - - - - - Current day - -
+
+ + +
+ + + + + +
- - - + +
+
+
{{'Contract' | translate}} #{{$ctrl.card.worker.hasWorkCenter}}
+
+ {{'Used' | translate}} {{$ctrl.contractHolidays.holidaysEnjoyed || 0}} + {{'of' | translate}} {{$ctrl.contractHolidays.totalHolidays || 0}} {{'days' | translate}} +
+
+ {{'Spent' | translate}} {{$ctrl.contractHolidays.hoursEnjoyed || 0}} + {{'of' | translate}} {{$ctrl.contractHolidays.totalHours || 0}} {{'hours' | translate}} +
+
+ {{'Paid holidays' | translate}} {{$ctrl.contractHolidays.payedHolidays || 0}} {{'days' | translate}} +
+
+ +
+
{{'Year' | translate}} {{$ctrl.year}}
+
+ {{'Used' | translate}} {{$ctrl.yearHolidays.holidaysEnjoyed || 0}} + {{'of' | translate}} {{$ctrl.yearHolidays.totalHolidays || 0}} {{'days' | translate}} +
+
+ {{'Spent' | translate}} {{$ctrl.yearHolidays.hoursEnjoyed || 0}} + {{'of' | translate}} {{$ctrl.yearHolidays.totalHours || 0}} {{'hours' | translate}} +
+
+ +
+ + + + +
#{{businessFk}}
+
+ {{started | date: 'dd/MM/yyyy'}} - {{ended ? (ended | date: 'dd/MM/yyyy') : 'Indef.'}} +
+
+
+
+
+ + + + + {{absenceType.name}} + +
+
+ + + + Festive + + + + + Current day + +
+
+
+ + +
+
+ Autonomous worker +
diff --git a/modules/worker/front/calendar/index.js b/modules/worker/front/calendar/index.js index 4ca0fc9297..4b07a2e98a 100644 --- a/modules/worker/front/calendar/index.js +++ b/modules/worker/front/calendar/index.js @@ -64,8 +64,7 @@ class Controller extends Section { set worker(value) { this._worker = value; - - if (value) { + if (value && value.hasWorkCenter) { this.getIsSubordinate(); this.getActiveContract(); } diff --git a/modules/worker/front/calendar/locale/es.yml b/modules/worker/front/calendar/locale/es.yml index bd75458aab..50bb4bb526 100644 --- a/modules/worker/front/calendar/locale/es.yml +++ b/modules/worker/front/calendar/locale/es.yml @@ -11,4 +11,5 @@ Choose an absence type from the right menu: Elige un tipo de ausencia desde el m To start adding absences, click an absence type from the right menu and then on the day you want to add an absence: Para empezar a añadir ausencias, haz clic en un tipo de ausencia desde el menu de la derecha y después en el día que quieres añadir la ausencia You can just add absences within the current year: Solo puedes añadir ausencias dentro del año actual Current day: Día actual -Paid holidays: Vacaciones pagadas \ No newline at end of file +Paid holidays: Vacaciones pagadas +Autonomous worker: Trabajador autónomo diff --git a/modules/worker/front/card/index.js b/modules/worker/front/card/index.js index 415b607874..dacdc954ad 100644 --- a/modules/worker/front/card/index.js +++ b/modules/worker/front/card/index.js @@ -34,6 +34,8 @@ class Controller extends ModuleCard { this.$http.get(`Workers/${this.$params.id}`, {filter}) .then(res => this.worker = res.data); + this.$http.get(`Workers/${this.$params.id}/activeContract`) + .then(res => this.worker.hasWorkCenter = res.data.workCenterFk); } } diff --git a/modules/worker/front/time-control/index.html b/modules/worker/front/time-control/index.html index 044ea4038a..d3a4b5640d 100644 --- a/modules/worker/front/time-control/index.html +++ b/modules/worker/front/time-control/index.html @@ -4,211 +4,219 @@ filter="::$ctrl.filter" data="$ctrl.hours"> - - - - - -
{{::$ctrl.weekdayNames[$index].name}}
-
- {{::weekday.dated | date: 'dd'}} - - {{::weekday.dated | date: 'MMMM'}} - -
- - - +
+ + + + + +
{{::$ctrl.weekdayNames[$index].name}}
- {{::weekday.event.name}} + {{::weekday.dated | date: 'dd'}} + + {{::weekday.dated | date: 'MMMM'}} +
- -
-
-
- - - -
- - - - - - - {{::hour.timed | date: 'HH:mm'}} + title="{{::weekday.event.name}}" + ng-class="{invisible: !weekday.event}"> + + +
+ {{::weekday.event.name}} +
-
-
-
-
- - - - {{$ctrl.formatHours(weekday.workedHours)}} h. - - - - - - - - - -
-
+ + + + + + +
+ + + + + + + + {{::hour.timed | date: 'HH:mm'}} + +
+
+
+
+ + + + {{$ctrl.formatHours(weekday.workedHours)}} h. + + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + - -
-
-
Hours
- - - - + +
+
+
Hours
+ + + + +
+ +
- - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- + + + - -
-
- - - - -
+ + + + + + + + + + + - - - Are you sure you want to send it? - - - - - - + + + + + + + + + + + + +
+ + +
+
+ + + + +
+ + + + Are you sure you want to send it? + + + + + + +
+
+ Autonomous worker +
diff --git a/modules/worker/front/time-control/index.js b/modules/worker/front/time-control/index.js index 85ddcedfe6..0f62085e35 100644 --- a/modules/worker/front/time-control/index.js +++ b/modules/worker/front/time-control/index.js @@ -151,6 +151,7 @@ class Controller extends Section { } getAbsences() { + if (!this.card.worker.hasWorkerCenter) return; const fullYear = this.started.getFullYear(); let params = { workerFk: this.$params.id, @@ -485,5 +486,8 @@ ngModule.vnComponent('vnWorkerTimeControl', { controller: Controller, bindings: { worker: '<' + }, + require: { + card: '^vnWorkerCard' } }); From 55990869e2bfc87ca44815e33342b0c4486fcc2d Mon Sep 17 00:00:00 2001 From: vicent Date: Thu, 15 Jun 2023 14:16:26 +0200 Subject: [PATCH 05/10] refs #5688 ya no muestra mensaje de error --- loopback/locale/es.json | 3 +-- modules/worker/back/methods/calendar/absences.js | 5 +---- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/loopback/locale/es.json b/loopback/locale/es.json index 768a36297b..d352319144 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -293,6 +293,5 @@ "Pass expired": "La contraseña ha caducado, cambiela desde Salix", "Invalid NIF for VIES": "Invalid NIF for VIES", "Ticket does not exist": "Este ticket no existe", - "Ticket is already signed": "Este ticket ya ha sido firmado", - "This worker does not have a work center": "Este trabajador no tiene centro de trabajo" + "Ticket is already signed": "Este ticket ya ha sido firmado" } diff --git a/modules/worker/back/methods/calendar/absences.js b/modules/worker/back/methods/calendar/absences.js index e78e49698d..8420ed7705 100644 --- a/modules/worker/back/methods/calendar/absences.js +++ b/modules/worker/back/methods/calendar/absences.js @@ -117,10 +117,7 @@ module.exports = Self => { absences.push(absence); } - const workCenter = contract.workCenter(); - if (!workCenter) throw new UserError(`This worker does not have a work center`); - - for (let day of workCenter.holidays()) { + for (let day of contract.workCenter().holidays()) { day.dated = new Date(day.dated); day.dated.setHours(0, 0, 0, 0); From 5f4b62f133754dd6aa2a9974df03b063323e2ebe Mon Sep 17 00:00:00 2001 From: vicent Date: Thu, 22 Jun 2023 09:48:14 +0200 Subject: [PATCH 06/10] refs #5688 fix: test front --- modules/worker/front/calendar/index.spec.js | 2 +- modules/worker/front/time-control/index.spec.js | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/modules/worker/front/calendar/index.spec.js b/modules/worker/front/calendar/index.spec.js index 586a7223d2..4b78d883b7 100644 --- a/modules/worker/front/calendar/index.spec.js +++ b/modules/worker/front/calendar/index.spec.js @@ -74,7 +74,7 @@ describe('Worker', () => { let yesterday = new Date(today.getTime()); yesterday.setDate(yesterday.getDate() - 1); - controller.worker = {id: 1107}; + controller.worker = {id: 1107, hasWorkCenter: true}; expect(controller.getIsSubordinate).toHaveBeenCalledWith(); expect(controller.getActiveContract).toHaveBeenCalledWith(); diff --git a/modules/worker/front/time-control/index.spec.js b/modules/worker/front/time-control/index.spec.js index 94f9d3d485..445ddeecd5 100644 --- a/modules/worker/front/time-control/index.spec.js +++ b/modules/worker/front/time-control/index.spec.js @@ -16,6 +16,12 @@ describe('Component vnWorkerTimeControl', () => { $scope = $rootScope.$new(); $element = angular.element(''); controller = $componentController('vnWorkerTimeControl', {$element, $scope}); + controller.card = { + worker: { + hasWorkerCenter: true + } + + }; })); describe('date() setter', () => { From d26778e94e8dbe2160a071cc3b7ed654d9f73595 Mon Sep 17 00:00:00 2001 From: vicent Date: Thu, 22 Jun 2023 13:30:53 +0200 Subject: [PATCH 07/10] refs #5688 fix: e2e --- modules/worker/front/time-control/index.html | 218 +++++++++---------- modules/worker/front/time-control/index.js | 5 +- 2 files changed, 110 insertions(+), 113 deletions(-) diff --git a/modules/worker/front/time-control/index.html b/modules/worker/front/time-control/index.html index d3a4b5640d..5f0855ee63 100644 --- a/modules/worker/front/time-control/index.html +++ b/modules/worker/front/time-control/index.html @@ -4,7 +4,7 @@ filter="::$ctrl.filter" data="$ctrl.hours"> -
+
@@ -105,114 +105,6 @@ ng-show="::$ctrl.isHr"> - - -
-
-
Hours
- - - - -
- - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - -
-
- - - - -
- - - - Are you sure you want to send it? - - - - - -
Autonomous worker
+ + +
+
+
Hours
+ + + + +
+ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+
+ + + + +
+ + + + Are you sure you want to send it? + + + + + + diff --git a/modules/worker/front/time-control/index.js b/modules/worker/front/time-control/index.js index 0f62085e35..90ec33293d 100644 --- a/modules/worker/front/time-control/index.js +++ b/modules/worker/front/time-control/index.js @@ -151,7 +151,7 @@ class Controller extends Section { } getAbsences() { - if (!this.card.worker.hasWorkerCenter) return; + if (!this.worker.hasWorkerCenter) return; const fullYear = this.started.getFullYear(); let params = { workerFk: this.$params.id, @@ -486,8 +486,5 @@ ngModule.vnComponent('vnWorkerTimeControl', { controller: Controller, bindings: { worker: '<' - }, - require: { - card: '^vnWorkerCard' } }); From d272121258ae9c373fc9c88ae80a93dc550444b8 Mon Sep 17 00:00:00 2001 From: vicent Date: Thu, 22 Jun 2023 14:52:42 +0200 Subject: [PATCH 08/10] refs 5688 fix: e2e --- modules/worker/front/calendar/index.html | 175 ++++++++++++----------- 1 file changed, 88 insertions(+), 87 deletions(-) diff --git a/modules/worker/front/calendar/index.html b/modules/worker/front/calendar/index.html index 78d4832c88..ace2f4e276 100644 --- a/modules/worker/front/calendar/index.html +++ b/modules/worker/front/calendar/index.html @@ -1,9 +1,9 @@ + +
- -
- -
-
-
{{'Contract' | translate}} #{{$ctrl.card.worker.hasWorkCenter}}
-
- {{'Used' | translate}} {{$ctrl.contractHolidays.holidaysEnjoyed || 0}} - {{'of' | translate}} {{$ctrl.contractHolidays.totalHolidays || 0}} {{'days' | translate}} -
-
- {{'Spent' | translate}} {{$ctrl.contractHolidays.hoursEnjoyed || 0}} - {{'of' | translate}} {{$ctrl.contractHolidays.totalHours || 0}} {{'hours' | translate}} -
-
- {{'Paid holidays' | translate}} {{$ctrl.contractHolidays.payedHolidays || 0}} {{'days' | translate}} -
-
- -
-
{{'Year' | translate}} {{$ctrl.year}}
-
- {{'Used' | translate}} {{$ctrl.yearHolidays.holidaysEnjoyed || 0}} - {{'of' | translate}} {{$ctrl.yearHolidays.totalHolidays || 0}} {{'days' | translate}} -
-
- {{'Spent' | translate}} {{$ctrl.yearHolidays.hoursEnjoyed || 0}} - {{'of' | translate}} {{$ctrl.yearHolidays.totalHours || 0}} {{'hours' | translate}} -
-
- -
- - - - -
#{{businessFk}}
-
- {{started | date: 'dd/MM/yyyy'}} - {{ended ? (ended | date: 'dd/MM/yyyy') : 'Indef.'}} -
-
-
-
-
- - - - - {{absenceType.name}} - -
-
- - - - Festive - - - - - Current day - -
-
-
- -
Autonomous worker
+ +
+
+
{{'Contract' | translate}} #{{$ctrl.card.worker.hasWorkCenter}}
+
+ {{'Used' | translate}} {{$ctrl.contractHolidays.holidaysEnjoyed || 0}} + {{'of' | translate}} {{$ctrl.contractHolidays.totalHolidays || 0}} {{'days' | translate}} +
+
+ {{'Spent' | translate}} {{$ctrl.contractHolidays.hoursEnjoyed || 0}} + {{'of' | translate}} {{$ctrl.contractHolidays.totalHours || 0}} {{'hours' | translate}} +
+
+ {{'Paid holidays' | translate}} {{$ctrl.contractHolidays.payedHolidays || 0}} {{'days' | translate}} +
+
+ +
+
{{'Year' | translate}} {{$ctrl.year}}
+
+ {{'Used' | translate}} {{$ctrl.yearHolidays.holidaysEnjoyed || 0}} + {{'of' | translate}} {{$ctrl.yearHolidays.totalHolidays || 0}} {{'days' | translate}} +
+
+ {{'Spent' | translate}} {{$ctrl.yearHolidays.hoursEnjoyed || 0}} + {{'of' | translate}} {{$ctrl.yearHolidays.totalHours || 0}} {{'hours' | translate}} +
+
+ +
+ + + + +
#{{businessFk}}
+
+ {{started | date: 'dd/MM/yyyy'}} - {{ended ? (ended | date: 'dd/MM/yyyy') : 'Indef.'}} +
+
+
+
+
+ + + + + {{absenceType.name}} + +
+
+ + + + Festive + + + + + Current day + +
+
+
+ + + From d9b1f4b8a1e0a19ed22d7f31955837a6a0f8fb95 Mon Sep 17 00:00:00 2001 From: vicent Date: Thu, 22 Jun 2023 15:06:27 +0200 Subject: [PATCH 09/10] refs #5688 fix: test e2e --- modules/worker/front/card/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/worker/front/card/index.js b/modules/worker/front/card/index.js index dacdc954ad..e1eb97327b 100644 --- a/modules/worker/front/card/index.js +++ b/modules/worker/front/card/index.js @@ -35,7 +35,9 @@ class Controller extends ModuleCard { this.$http.get(`Workers/${this.$params.id}`, {filter}) .then(res => this.worker = res.data); this.$http.get(`Workers/${this.$params.id}/activeContract`) - .then(res => this.worker.hasWorkCenter = res.data.workCenterFk); + .then(res => { + if (res.data) this.worker.hasWorkCenter = res.data.workCenterFk; + }); } } From 6894da7e2216a36e814dcc195cd1067d660ab41f Mon Sep 17 00:00:00 2001 From: vicent Date: Wed, 28 Jun 2023 13:27:18 +0200 Subject: [PATCH 10/10] refs #5688 fix: front test --- modules/worker/front/time-control/index.spec.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/modules/worker/front/time-control/index.spec.js b/modules/worker/front/time-control/index.spec.js index 445ddeecd5..0132f50fe1 100644 --- a/modules/worker/front/time-control/index.spec.js +++ b/modules/worker/front/time-control/index.spec.js @@ -16,10 +16,8 @@ describe('Component vnWorkerTimeControl', () => { $scope = $rootScope.$new(); $element = angular.element(''); controller = $componentController('vnWorkerTimeControl', {$element, $scope}); - controller.card = { - worker: { - hasWorkerCenter: true - } + controller.worker = { + hasWorkerCenter: true }; }));