mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-25 18:02:04 +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) {
|
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,
|
title,
|
||||||
description
|
description
|
||||||
})
|
})
|
||||||
@ -50,7 +50,7 @@
|
|||||||
date: toTzDate(date),
|
date: toTzDate(date),
|
||||||
department
|
department
|
||||||
}
|
}
|
||||||
client.createDoc(hr.class.PublicHoliday, core.space.Space, holiday)
|
await client.createDoc(hr.class.PublicHoliday, core.space.Space, holiday)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
findHoliday()
|
findHoliday()
|
||||||
|
@ -172,6 +172,7 @@
|
|||||||
eventToHTMLElement(e)
|
eventToHTMLElement(e)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
const me = getCurrentAccount()
|
||||||
|
|
||||||
function isFutureDate () {
|
function isFutureDate () {
|
||||||
const today = new Date(Date.now())
|
const today = new Date(Date.now())
|
||||||
@ -182,7 +183,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function isEditable (employee: Staff): boolean {
|
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 {
|
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"
|
class="timeline-cell timeline-day-header flex-col-center justify-center"
|
||||||
style={getCellStyle()}
|
style={getCellStyle()}
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
if (isFutureDate()) {
|
if (isFutureDate() || me.role === AccountRole.Owner) {
|
||||||
setPublicHoliday(day)
|
setPublicHoliday(day)
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
|
Loading…
Reference in New Issue
Block a user