TSK-989: transparent requests (PTO, extra, etc.) when not in department or it's descendants (#2861)

Signed-off-by: Vyacheslav Tumanov <me@slavatumanov.me>
This commit is contained in:
Vyacheslav Tumanov 2023-03-30 21:24:32 +05:00 committed by GitHub
parent 3ca0f8ba7c
commit 18a756a1a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 4 deletions

View File

@ -25,6 +25,7 @@
export let editable: boolean = false
export let holidays: Map<Ref<Department>, Date[]>
export let employee: Staff
export let departments: Ref<Department>[]
const client = getClient()
export let noWeekendHolidayType: Ref<RequestType>[]
@ -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 @@
<div
class="request flex-center"
class:cursor-pointer={editable}
style={getStyle(type)}
style={getStyle(type, request)}
on:click={(e) => {
click(e, request)
}}

View File

@ -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'}

View File

@ -49,6 +49,7 @@
export let departmentStaff: Staff[]
export let department: Ref<Department>
export let departments: Ref<Department>[]
export let employeeRequests: Map<Ref<Staff>, Request[]>
export let editableList: Ref<Employee>[]
@ -237,6 +238,7 @@
<div class:worked={ww > 0} class="h-full w-full">
{#if requests.length}
<ScheduleRequests
{departments}
{requests}
{editable}
date={day}