Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Mar 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions plugins/hr-resources/src/components/ScheduleRequests.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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>[]
Expand All @@ -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
}

Expand All @@ -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)
}}
Expand Down
4 changes: 2 additions & 2 deletions plugins/hr-resources/src/components/ScheduleView.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -294,6 +293,7 @@
{timeReports}
{holidays}
{department}
{departments}
{staffDepartmentMap}
/>
{:else if display === 'stats'}
Expand Down
2 changes: 2 additions & 0 deletions plugins/hr-resources/src/components/schedule/MonthView.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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>[]
Expand Down Expand Up @@ -237,6 +238,7 @@
<div class:worked={ww > 0} class="h-full w-full">
{#if requests.length}
<ScheduleRequests
{departments}
{requests}
{editable}
date={day}
Expand Down