diff --git a/plugins/hr-resources/package.json b/plugins/hr-resources/package.json index 4171ee1e323..2bdc3717bda 100644 --- a/plugins/hr-resources/package.json +++ b/plugins/hr-resources/package.json @@ -33,6 +33,7 @@ "@anticrm/platform": "~0.6.6", "svelte": "^3.47", "@anticrm/calendar": "~0.6.0", + "@anticrm/calendar-resources": "~0.6.0", "@anticrm/hr": "~0.6.0", "@anticrm/ui": "~0.6.0", "@anticrm/presentation": "~0.6.2", diff --git a/plugins/hr-resources/src/components/CreateRequest.svelte b/plugins/hr-resources/src/components/CreateRequest.svelte index 47f061a561f..65655a434a0 100644 --- a/plugins/hr-resources/src/components/CreateRequest.svelte +++ b/plugins/hr-resources/src/components/CreateRequest.svelte @@ -46,7 +46,7 @@ } }) - $: value = new Date(date).getTime() + let value = new Date(date).getTime() $: dueDate = new Date(value).setDate(new Date(value).getDate() + 1) export function canClose (): boolean { @@ -72,6 +72,10 @@ function typeSelected (_id: Ref): void { type = types.find((p) => p._id === _id) + dueDate = + Math.abs(type?.value ?? 0 % 1) === 0.5 + ? new Date(value).setHours(12) + : new Date(value).setDate(new Date(value).getDate() + 1) } diff --git a/plugins/hr-resources/src/components/RequestsPopup.svelte b/plugins/hr-resources/src/components/RequestsPopup.svelte index edbf26e0e7d..3b01d511c68 100644 --- a/plugins/hr-resources/src/components/RequestsPopup.svelte +++ b/plugins/hr-resources/src/components/RequestsPopup.svelte @@ -18,16 +18,15 @@ import { Table } from '@anticrm/view-resources' export let date: Date + export let endDate: number export let employee: Ref - - $: endDate = new Date(date).setDate(date.getDate() + 1) {#if departmentStaff.length} @@ -154,14 +200,27 @@ - {#each [...Array(daysInMonth(currentDate)).keys()] as dayOfMonth} - {@const day = getDay(new Date(startDate), dayOfMonth)} - + {#each values as value} + {#if mode === CalendarMode.Year} + {@const month = getMonth(currentDate, value)} + + {:else} + {@const day = getDay(new Date(startDate), value)} + + {/if} {/each} @@ -171,21 +230,36 @@ - {#each [...Array(daysInMonth(currentDate)).keys()] as dayOfMonth} - {@const date = getDay(new Date(startDate), dayOfMonth)} - {@const requests = getRequests(employee._id, date)} - {@const editable = isEditable(employee)} - + {#each values as value} + {#if mode === CalendarMode.Year} + {@const month = getMonth(currentDate, value)} + {@const requests = getRequests(employee._id, month)} + + {:else} + {@const date = getDay(new Date(startDate), value)} + {@const requests = getRequests(employee._id, date)} + {@const editable = isEditable(employee)} + + {/if} {/each} {/each} @@ -209,6 +283,9 @@ th { width: auto; min-width: 1rem; + &.fixed { + width: 5rem; + } &:first-child { width: 15rem; padding: 0.5rem;
-
-
{getWeekDayName(day, 'short')}
-
{day.getDate()}
-
-
+
+
{getMonthName(month)}
+
+
+
+
{getWeekDayName(day, 'short')}
+
{day.getDate()}
+
+
createRequest(e, date, employee)} - > - {#if requests.length} - - {/if} - +
+ {getTotal(requests)} +
+
createRequest(e, date, employee)} + > + {#if requests.length} + + {/if} +