From a72010554cd41201dd8261d98a3dd9ff4d2e8516 Mon Sep 17 00:00:00 2001 From: joan Date: Fri, 11 Jun 2021 10:58:00 +0200 Subject: [PATCH] Fixes and E2E updated --- e2e/helpers/selectors.js | 12 ++++----- e2e/paths/03-worker/05_calendar.spec.js | 2 +- modules/worker/front/calendar/index.html | 2 +- modules/worker/front/time-control/index.js | 30 ++++++++++++++++++---- 4 files changed, 33 insertions(+), 13 deletions(-) diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index a5da8dddd..850a8c3fb 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -888,7 +888,7 @@ export default { }, workerCalendar: { year: 'vn-worker-calendar vn-autocomplete[ng-model="$ctrl.year"]', - totalHolidaysUsed: 'vn-worker-calendar div.totalBox > div', + totalHolidaysUsed: 'vn-worker-calendar div.totalBox:first-child > div', penultimateMondayOfJanuary: 'vn-worker-calendar vn-calendar:nth-child(2) section:nth-child(22) > div', lastMondayOfMarch: 'vn-worker-calendar vn-calendar:nth-child(4) section:nth-child(29) > div', fistMondayOfMay: 'vn-worker-calendar vn-calendar:nth-child(6) section:nth-child(8) > div', @@ -896,11 +896,11 @@ export default { secondTuesdayOfMay: 'vn-worker-calendar vn-calendar:nth-child(6) section:nth-child(16) > div', secondWednesdayOfMay: 'vn-worker-calendar vn-calendar:nth-child(6) section:nth-child(17) > div', secondThursdayOfMay: 'vn-worker-calendar vn-calendar:nth-child(6) section:nth-child(18) > div', - holidays: 'vn-worker-calendar > vn-side-menu div:nth-child(3) > vn-chip:nth-child(1)', - absence: 'vn-worker-calendar > vn-side-menu div:nth-child(3) > vn-chip:nth-child(2)', - halfHoliday: 'vn-worker-calendar > vn-side-menu div:nth-child(3) > vn-chip:nth-child(3)', - furlough: 'vn-worker-calendar > vn-side-menu div:nth-child(3) > vn-chip:nth-child(4)', - halfFurlough: 'vn-worker-calendar > vn-side-menu div:nth-child(3) > vn-chip:nth-child(5)', + holidays: 'vn-worker-calendar > vn-side-menu [name="absenceTypes"] > vn-chip:nth-child(1)', + absence: 'vn-worker-calendar > vn-side-menu [name="absenceTypes"] > vn-chip:nth-child(2)', + halfHoliday: 'vn-worker-calendar > vn-side-menu [name="absenceTypes"] > vn-chip:nth-child(3)', + furlough: 'vn-worker-calendar > vn-side-menu [name="absenceTypes"] > vn-chip:nth-child(4)', + halfFurlough: 'vn-worker-calendar > vn-side-menu [name="absenceTypes"] > vn-chip:nth-child(5)', }, invoiceOutIndex: { topbarSearch: 'vn-searchbar', diff --git a/e2e/paths/03-worker/05_calendar.spec.js b/e2e/paths/03-worker/05_calendar.spec.js index 1a7e2dd19..08ef71f13 100644 --- a/e2e/paths/03-worker/05_calendar.spec.js +++ b/e2e/paths/03-worker/05_calendar.spec.js @@ -1,7 +1,7 @@ import selectors from '../../helpers/selectors.js'; import getBrowser from '../../helpers/puppeteer'; -fdescribe('Worker calendar path', () => { +describe('Worker calendar path', () => { let reasonableTimeBetweenClicks = 400; let browser; let page; diff --git a/modules/worker/front/calendar/index.html b/modules/worker/front/calendar/index.html index d308c2fcb..f012e8e55 100644 --- a/modules/worker/front/calendar/index.html +++ b/modules/worker/front/calendar/index.html @@ -62,7 +62,7 @@ -
+
this.getAbsences()); + } + } + /** * The current selected date */ @@ -70,6 +83,11 @@ class Controller extends Section { } } + getActiveContract() { + return this.$http.get(`Workers/${this.worker.id}/activeContract`) + .then(res => this.businessId = res.data.businessFk); + } + fetchHours() { const params = {workerFk: this.$params.id}; const filter = { @@ -80,7 +98,6 @@ class Controller extends Section { }; this.$.model.applyFilter(filter, params).then(() => { this.getWorkedHours(this.started, this.ended); - this.getAbsences(); }); } @@ -89,10 +106,10 @@ class Controller extends Section { } getAbsences() { + const fullYear = this.started.getFullYear(); let params = { - workerFk: this.$params.id, - started: this.started, - ended: this.ended + businessFk: this.businessId, + year: fullYear }; return this.$http.get(`Calendars/absences`, {params}) @@ -257,5 +274,8 @@ Controller.$inject = ['$element', '$scope', 'vnWeekDays']; ngModule.vnComponent('vnWorkerTimeControl', { template: require('./index.html'), - controller: Controller + controller: Controller, + bindings: { + worker: '<' + } });