From ae4f1d1730c2284918bbaf204dc9932b86ff4fad Mon Sep 17 00:00:00 2001 From: carlosjr Date: Wed, 14 Jul 2021 10:09:24 +0200 Subject: [PATCH 1/3] the absences are now fetched alongside the hours --- modules/worker/front/time-control/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/worker/front/time-control/index.js b/modules/worker/front/time-control/index.js index 2631c82d2..0fb5f9dbe 100644 --- a/modules/worker/front/time-control/index.js +++ b/modules/worker/front/time-control/index.js @@ -106,6 +106,7 @@ class Controller extends Section { }; this.$.model.applyFilter(filter, params).then(() => { this.getWorkedHours(this.started, this.ended); + this.getAbsences(); }); } @@ -129,7 +130,7 @@ class Controller extends Section { onData(data) { const events = {}; - let addEvent = (day, event) => { + const addEvent = (day, event) => { events[new Date(day).getTime()] = event; }; From 9f5df91be459e0a79ef4092561d969988289cf93 Mon Sep 17 00:00:00 2001 From: carlosjr Date: Wed, 30 Jun 2021 14:05:16 +0200 Subject: [PATCH 2/3] workers without active contract no longer set calendar and timeControl at fault --- modules/worker/front/calendar/index.js | 6 ++++-- modules/worker/front/time-control/index.js | 7 ++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/modules/worker/front/calendar/index.js b/modules/worker/front/calendar/index.js index d60fa0647..014a35b63 100644 --- a/modules/worker/front/calendar/index.js +++ b/modules/worker/front/calendar/index.js @@ -91,8 +91,10 @@ class Controller extends Section { } getActiveContract() { - this.$http.get(`Workers/${this.worker.id}/activeContract`) - .then(res => this.businessId = res.data.businessFk); + this.$http.get(`Workers/${this.worker.id}/activeContract`).then(res => { + if (res.data) + this.businessId = res.data.businessFk; + }); } getContractHolidays() { diff --git a/modules/worker/front/time-control/index.js b/modules/worker/front/time-control/index.js index b980243c9..2631c82d2 100644 --- a/modules/worker/front/time-control/index.js +++ b/modules/worker/front/time-control/index.js @@ -90,7 +90,10 @@ class Controller extends Section { getActiveContract() { return this.$http.get(`Workers/${this.worker.id}/activeContract`) - .then(res => this.businessId = res.data.businessFk); + .then(res => { + if (res.data) + this.businessId = res.data.businessFk; + }); } fetchHours() { @@ -111,6 +114,8 @@ class Controller extends Section { } getAbsences() { + if (!this.businessId) return; + const fullYear = this.started.getFullYear(); let params = { businessFk: this.businessId, From 559eaf5853a89f0165520686c61e89b120241b55 Mon Sep 17 00:00:00 2001 From: carlosjr Date: Wed, 14 Jul 2021 10:09:24 +0200 Subject: [PATCH 3/3] the absences are now fetched alongside the hours --- modules/worker/front/time-control/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/worker/front/time-control/index.js b/modules/worker/front/time-control/index.js index 2631c82d2..0fb5f9dbe 100644 --- a/modules/worker/front/time-control/index.js +++ b/modules/worker/front/time-control/index.js @@ -106,6 +106,7 @@ class Controller extends Section { }; this.$.model.applyFilter(filter, params).then(() => { this.getWorkedHours(this.started, this.ended); + this.getAbsences(); }); } @@ -129,7 +130,7 @@ class Controller extends Section { onData(data) { const events = {}; - let addEvent = (day, event) => { + const addEvent = (day, event) => { events[new Date(day).getTime()] = event; };