diff --git a/plugins/hr-resources/src/components/schedule/CreatePublicHoliday.svelte b/plugins/hr-resources/src/components/schedule/CreatePublicHoliday.svelte index aff5fdd3c3..98061d5a5a 100644 --- a/plugins/hr-resources/src/components/schedule/CreatePublicHoliday.svelte +++ b/plugins/hr-resources/src/components/schedule/CreatePublicHoliday.svelte @@ -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() diff --git a/plugins/hr-resources/src/components/schedule/MonthView.svelte b/plugins/hr-resources/src/components/schedule/MonthView.svelte index 0ff556e5c1..c9d983d601 100644 --- a/plugins/hr-resources/src/components/schedule/MonthView.svelte +++ b/plugins/hr-resources/src/components/schedule/MonthView.svelte @@ -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) } }}