From 725752fa60d7d9b0a347971e3ecbb5ed0468f11c Mon Sep 17 00:00:00 2001 From: florimondmanca Date: Wed, 30 Oct 2024 11:54:05 +0100 Subject: [PATCH] =?UTF-8?q?Tient=20compte=20de=20startsAllDay=20/=20endsAl?= =?UTF-8?q?lDay=20dans=20les=20=C3=A9l=C3=A9ments=20de=20paie?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Leave/View/LeaveRequestSlotView.ts | 4 +++- .../Query/GetUserElementsQueryHandler.spec.ts | 15 ++++++++++++--- .../Payslip/Query/GetUsersElementsQueryHandler.ts | 4 +++- src/templates/pages/payroll_elements/_leaves.njk | 2 +- 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/src/Application/HumanResource/Leave/View/LeaveRequestSlotView.ts b/src/Application/HumanResource/Leave/View/LeaveRequestSlotView.ts index 72ee46a8..35be89a0 100644 --- a/src/Application/HumanResource/Leave/View/LeaveRequestSlotView.ts +++ b/src/Application/HumanResource/Leave/View/LeaveRequestSlotView.ts @@ -1,6 +1,8 @@ export class LeaveRequestSlotView { constructor( public readonly startDate: string, - public readonly endDate: string + public readonly startsAllDay: boolean, + public readonly endDate: string, + public readonly endsAllDay: boolean ) {} } diff --git a/src/Application/HumanResource/Payslip/Query/GetUserElementsQueryHandler.spec.ts b/src/Application/HumanResource/Payslip/Query/GetUserElementsQueryHandler.spec.ts index 2d341219..e33c97f2 100644 --- a/src/Application/HumanResource/Payslip/Query/GetUserElementsQueryHandler.spec.ts +++ b/src/Application/HumanResource/Payslip/Query/GetUserElementsQueryHandler.spec.ts @@ -101,20 +101,29 @@ describe('GetUserElementsQueryHandler', () => { const startDate1 = '2022-05-09'; const endDate1 = '2022-05-11'; const leaveRequest1 = createLeaveRequestMock(startDate1, endDate1); - const leaveRequestSlot1 = new LeaveRequestSlotView(startDate1, endDate1); + const leaveRequestSlot1 = new LeaveRequestSlotView( + startDate1, + false, + endDate1, + false + ); const startDate2 = '2022-04-25'; const endDate2 = '2022-05-02'; const leaveRequest2 = createLeaveRequestMock(startDate2, endDate2); const leaveRequestSlot2 = new LeaveRequestSlotView( '2022-05-01T00:00:00.000Z', - endDate2 + true, + endDate2, + false ); const startDate3 = '2022-05-29'; const endDate3 = '2022-06-05'; const leaveRequest3 = createLeaveRequestMock(startDate3, endDate3); const leaveRequestSlot3 = new LeaveRequestSlotView( startDate3, - '2022-05-31T00:00:00.000Z' + false, + '2022-05-31T00:00:00.000Z', + true ); when( diff --git a/src/Application/HumanResource/Payslip/Query/GetUsersElementsQueryHandler.ts b/src/Application/HumanResource/Payslip/Query/GetUsersElementsQueryHandler.ts index 7ec3af78..a7937843 100644 --- a/src/Application/HumanResource/Payslip/Query/GetUsersElementsQueryHandler.ts +++ b/src/Application/HumanResource/Payslip/Query/GetUsersElementsQueryHandler.ts @@ -95,7 +95,9 @@ export class GetUsersElementsQueryHandler { leavesSlotViews.push( new LeaveRequestSlotView( monthScopedLeave.startDate, - monthScopedLeave.endDate + monthScopedLeave.startsAllDay, + monthScopedLeave.endDate, + monthScopedLeave.endsAllDay ) ); } diff --git a/src/templates/pages/payroll_elements/_leaves.njk b/src/templates/pages/payroll_elements/_leaves.njk index 546c1fca..e9c5d9a0 100644 --- a/src/templates/pages/payroll_elements/_leaves.njk +++ b/src/templates/pages/payroll_elements/_leaves.njk @@ -1,7 +1,7 @@ {%- if leaves.totalDays > 0 -%} {{ leaves.totalDays }}
{%- for leave in leaves.leaves -%} - {{ leave.startDate|date }} -> {{ leave.endDate|date }} + {{ leave.startDate|date }} {% if not leave.startsAllDay %}(0.5){% endif %} -> {{ leave.endDate|date }} {% if not leave.endsAllDay %}(0.5){% endif %} {%- if not loop.last %}
{% endif -%} {%- endfor -%} {%- endif -%}