mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-14 20:39:03 +00:00
Always Allow Owner to edit/Create Public holidays (#4528)
Signed-off-by: Vyacheslav Tumanov <me@slavatumanov.me>
This commit is contained in:
parent
722ae8a0f5
commit
02758613d7
@ -37,9 +37,9 @@
|
||||
}
|
||||
}
|
||||
|
||||
function saveHoliday () {
|
||||
async function saveHoliday () {
|
||||
if (existingHoliday !== undefined) {
|
||||
client.updateDoc(hr.class.PublicHoliday, core.space.Space, existingHoliday._id, {
|
||||
await client.updateDoc(hr.class.PublicHoliday, core.space.Space, existingHoliday._id, {
|
||||
title,
|
||||
description
|
||||
})
|
||||
@ -50,7 +50,7 @@
|
||||
date: toTzDate(date),
|
||||
department
|
||||
}
|
||||
client.createDoc(hr.class.PublicHoliday, core.space.Space, holiday)
|
||||
await client.createDoc(hr.class.PublicHoliday, core.space.Space, holiday)
|
||||
}
|
||||
}
|
||||
findHoliday()
|
||||
|
@ -172,6 +172,7 @@
|
||||
eventToHTMLElement(e)
|
||||
)
|
||||
}
|
||||
const me = getCurrentAccount()
|
||||
|
||||
function isFutureDate () {
|
||||
const today = new Date(Date.now())
|
||||
@ -182,7 +183,7 @@
|
||||
}
|
||||
|
||||
function isEditable (employee: Staff): boolean {
|
||||
return editableList.includes(employee._id) && (isFutureDate() || getCurrentAccount().role === AccountRole.Owner)
|
||||
return editableList.includes(employee._id) && (isFutureDate() || me.role === AccountRole.Owner)
|
||||
}
|
||||
|
||||
function getTooltip (requests: Request[], day: Date, staff: Staff): LabelAndProps | undefined {
|
||||
@ -305,7 +306,7 @@
|
||||
class="timeline-cell timeline-day-header flex-col-center justify-center"
|
||||
style={getCellStyle()}
|
||||
on:click={() => {
|
||||
if (isFutureDate()) {
|
||||
if (isFutureDate() || me.role === AccountRole.Owner) {
|
||||
setPublicHoliday(day)
|
||||
}
|
||||
}}
|
||||
|
Loading…
Reference in New Issue
Block a user