From 2e264f9ddb35464a1b8407241b4038762dcc58c8 Mon Sep 17 00:00:00 2001 From: Vyacheslav Tumanov Date: Thu, 30 Mar 2023 19:12:26 +0500 Subject: [PATCH] TSK-989: transparent requests (PTO, extra, etc.) when not in department or it's descendants Signed-off-by: Vyacheslav Tumanov --- plugins/hr-resources/src/components/ScheduleRequests.svelte | 6 ++++-- plugins/hr-resources/src/components/ScheduleView.svelte | 4 ++-- .../hr-resources/src/components/schedule/MonthView.svelte | 2 ++ 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/plugins/hr-resources/src/components/ScheduleRequests.svelte b/plugins/hr-resources/src/components/ScheduleRequests.svelte index 72dbb77851d..dc5ef291e80 100644 --- a/plugins/hr-resources/src/components/ScheduleRequests.svelte +++ b/plugins/hr-resources/src/components/ScheduleRequests.svelte @@ -25,6 +25,7 @@ export let editable: boolean = false export let holidays: Map, Date[]> export let employee: Staff + export let departments: Ref[] const client = getClient() export let noWeekendHolidayType: Ref[] @@ -35,13 +36,14 @@ }) } - function getStyle (type: RequestType): string { + function getStyle (type: RequestType, request: Request): string { let res = `background-color: ${ isWeekend(date) && noWeekendHolidayType.includes(type._id) ? getPlatformColor(16) : getPlatformColor(type.color) };` if (Math.abs(type.value % 1) === 0.5) { res += ' height: 50%;' } + if (!departments.includes(request.space)) res += ' opacity: 0.5;' return res } @@ -63,7 +65,7 @@
{ click(e, request) }} diff --git a/plugins/hr-resources/src/components/ScheduleView.svelte b/plugins/hr-resources/src/components/ScheduleView.svelte index 3803bf7ab0a..6eaf505930e 100644 --- a/plugins/hr-resources/src/components/ScheduleView.svelte +++ b/plugins/hr-resources/src/components/ScheduleView.svelte @@ -95,8 +95,7 @@ hr.class.Request, { 'tzDueDate.year': { $gte: startDate.getFullYear() }, - 'tzDate.year': { $lte: endDate.getFullYear() }, - space: { $in: departments } + 'tzDate.year': { $lte: endDate.getFullYear() } }, (res) => { reqests = res @@ -294,6 +293,7 @@ {timeReports} {holidays} {department} + {departments} {staffDepartmentMap} /> {:else if display === 'stats'} diff --git a/plugins/hr-resources/src/components/schedule/MonthView.svelte b/plugins/hr-resources/src/components/schedule/MonthView.svelte index 8255399f2fd..91aeae39410 100644 --- a/plugins/hr-resources/src/components/schedule/MonthView.svelte +++ b/plugins/hr-resources/src/components/schedule/MonthView.svelte @@ -49,6 +49,7 @@ export let departmentStaff: Staff[] export let department: Ref + export let departments: Ref[] export let employeeRequests: Map, Request[]> export let editableList: Ref[] @@ -237,6 +238,7 @@
0} class="h-full w-full"> {#if requests.length}