mirror of
https://github.com/hcengineering/platform.git
synced 2024-12-28 22:13:29 +03:00
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:
parent
3ca0f8ba7c
commit
18a756a1a9
@ -25,6 +25,7 @@
|
|||||||
export let editable: boolean = false
|
export let editable: boolean = false
|
||||||
export let holidays: Map<Ref<Department>, Date[]>
|
export let holidays: Map<Ref<Department>, Date[]>
|
||||||
export let employee: Staff
|
export let employee: Staff
|
||||||
|
export let departments: Ref<Department>[]
|
||||||
|
|
||||||
const client = getClient()
|
const client = getClient()
|
||||||
export let noWeekendHolidayType: Ref<RequestType>[]
|
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: ${
|
let res = `background-color: ${
|
||||||
isWeekend(date) && noWeekendHolidayType.includes(type._id) ? getPlatformColor(16) : getPlatformColor(type.color)
|
isWeekend(date) && noWeekendHolidayType.includes(type._id) ? getPlatformColor(16) : getPlatformColor(type.color)
|
||||||
};`
|
};`
|
||||||
if (Math.abs(type.value % 1) === 0.5) {
|
if (Math.abs(type.value % 1) === 0.5) {
|
||||||
res += ' height: 50%;'
|
res += ' height: 50%;'
|
||||||
}
|
}
|
||||||
|
if (!departments.includes(request.space)) res += ' opacity: 0.5;'
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,7 +65,7 @@
|
|||||||
<div
|
<div
|
||||||
class="request flex-center"
|
class="request flex-center"
|
||||||
class:cursor-pointer={editable}
|
class:cursor-pointer={editable}
|
||||||
style={getStyle(type)}
|
style={getStyle(type, request)}
|
||||||
on:click={(e) => {
|
on:click={(e) => {
|
||||||
click(e, request)
|
click(e, request)
|
||||||
}}
|
}}
|
||||||
|
@ -95,8 +95,7 @@
|
|||||||
hr.class.Request,
|
hr.class.Request,
|
||||||
{
|
{
|
||||||
'tzDueDate.year': { $gte: startDate.getFullYear() },
|
'tzDueDate.year': { $gte: startDate.getFullYear() },
|
||||||
'tzDate.year': { $lte: endDate.getFullYear() },
|
'tzDate.year': { $lte: endDate.getFullYear() }
|
||||||
space: { $in: departments }
|
|
||||||
},
|
},
|
||||||
(res) => {
|
(res) => {
|
||||||
reqests = res
|
reqests = res
|
||||||
@ -294,6 +293,7 @@
|
|||||||
{timeReports}
|
{timeReports}
|
||||||
{holidays}
|
{holidays}
|
||||||
{department}
|
{department}
|
||||||
|
{departments}
|
||||||
{staffDepartmentMap}
|
{staffDepartmentMap}
|
||||||
/>
|
/>
|
||||||
{:else if display === 'stats'}
|
{:else if display === 'stats'}
|
||||||
|
@ -49,6 +49,7 @@
|
|||||||
|
|
||||||
export let departmentStaff: Staff[]
|
export let departmentStaff: Staff[]
|
||||||
export let department: Ref<Department>
|
export let department: Ref<Department>
|
||||||
|
export let departments: Ref<Department>[]
|
||||||
|
|
||||||
export let employeeRequests: Map<Ref<Staff>, Request[]>
|
export let employeeRequests: Map<Ref<Staff>, Request[]>
|
||||||
export let editableList: Ref<Employee>[]
|
export let editableList: Ref<Employee>[]
|
||||||
@ -237,6 +238,7 @@
|
|||||||
<div class:worked={ww > 0} class="h-full w-full">
|
<div class:worked={ww > 0} class="h-full w-full">
|
||||||
{#if requests.length}
|
{#if requests.length}
|
||||||
<ScheduleRequests
|
<ScheduleRequests
|
||||||
|
{departments}
|
||||||
{requests}
|
{requests}
|
||||||
{editable}
|
{editable}
|
||||||
date={day}
|
date={day}
|
||||||
|
Loading…
Reference in New Issue
Block a user