diff --git a/packages/theme/styles/_colors.scss b/packages/theme/styles/_colors.scss index 20436cbefb..e741cc5824 100644 --- a/packages/theme/styles/_colors.scss +++ b/packages/theme/styles/_colors.scss @@ -59,6 +59,7 @@ --primary-color-skyblue: #93CAF3; --primary-color-pink: #FA8DA1; + --highlight-blue-01: #0084FF; --highlight-red: #F96E50; --highlight-red-hover: #ff967e; --highlight-red-press: #f96f50bd; @@ -349,9 +350,13 @@ --theme-calendar-today-color: #000; --theme-calendar-holiday-color: #eb5757; --theme-calendar-weekend-color: rgba(242, 153, 74, 1); - --theme-calendar-today-bgcolor: rgba(43, 81, 144, .1); + --theme-calendar-today-bgcolor: rgba(51, 157, 255, .1); --theme-calendar-holiday-bgcolor: rgba(235, 87, 87, .1); --theme-calendar-weekend-bgcolor: rgba(242, 153, 74, .1); + --theme-calendar-event-available-color: rgba(55, 122, 230, 0.20); + --theme-calendar-event-available-bgcolor: #f6f9fe; + --theme-calendar-event-unavailable-color: rgba(244, 119, 88, 0.20); + --theme-calendar-event-unavailable-bgcolor: #fdece7; --theme-tooltip-color: #FFF; --theme-tooltip-bg: #444248; diff --git a/plugins/hr-resources/src/components/DepartmentStaff.svelte b/plugins/hr-resources/src/components/DepartmentStaff.svelte index 758dac88ea..acf2ed92bd 100644 --- a/plugins/hr-resources/src/components/DepartmentStaff.svelte +++ b/plugins/hr-resources/src/components/DepartmentStaff.svelte @@ -98,6 +98,7 @@ + diff --git a/plugins/hr-resources/src/components/ScheduleRequests.svelte b/plugins/hr-resources/src/components/ScheduleRequests.svelte deleted file mode 100644 index c8bf988507..0000000000 --- a/plugins/hr-resources/src/components/ScheduleRequests.svelte +++ /dev/null @@ -1,90 +0,0 @@ - - - -
- {#each requests as request} - {#await getType(request) then type} - {#if type} - -
{ - click(e, request) - }} - > - -
- {/if} - {/await} - {/each} -
- - diff --git a/plugins/hr-resources/src/components/ScheduleView.svelte b/plugins/hr-resources/src/components/ScheduleView.svelte index 270beaf563..f92064208e 100644 --- a/plugins/hr-resources/src/components/ScheduleView.svelte +++ b/plugins/hr-resources/src/components/ScheduleView.svelte @@ -282,40 +282,43 @@ }) -{#if staffDepartmentMap.size > 0} - {#if mode === CalendarMode.Year} - - {:else if mode === CalendarMode.Month} - {#if display === 'chart'} - - {:else if display === 'stats'} - +
+ {#if staffDepartmentMap.size > 0} + {#if mode === CalendarMode.Year} + + {:else if mode === CalendarMode.Month} + {#if display === 'chart'} + + {:else if display === 'stats'} + + {/if} {/if} + {:else} +
+
{/if} -{:else} -
-
-{/if} +
diff --git a/plugins/hr-resources/src/components/schedule/MonthView.svelte b/plugins/hr-resources/src/components/schedule/MonthView.svelte index bf9ac4f6ef..707e0ac8b9 100644 --- a/plugins/hr-resources/src/components/schedule/MonthView.svelte +++ b/plugins/hr-resources/src/components/schedule/MonthView.svelte @@ -1,5 +1,5 @@ -{#if departmentStaff.length} - - - - - - - - {#each values as value, i} - {@const day = getDay(startDate, value)} - - {/each} - - - - {#each departmentStaff as employee, row} - {@const requests = employeeRequests.get(employee._id) ?? []} - {@const rTime = timeReports.get(employee._id)} - - - - - - {#each values as value, i} +
+
+ + + + + +
+ {#each rows as row} +
+
+ +
+
+ {/each} +
+ + +
+
+ {#each values as value} {@const day = getDay(startDate, value)} - {@const requests = getRequests(employeeRequests, day, day, employee._id)} - {@const editable = isEditable(employee)} - {@const tooltipValue = getTooltip(requests, day, employee)} - {@const ww = findReports(employee, day, timeReports)} - {#key [tooltipValue, editable]} - -
- {/key} - {/each} - - {/each} - - - - - - - {#each values as value, i} - {@const day = getDay(startDate, value)} - {/each} - - -
-
-
-
### { - hoveredIndex = i - }} - on:mouseleave={() => { - hoveredIndex = -1 - }} - on:click={() => isFutureDate() && setPublicHoliday(day)} - > - {getWeekDayName(day, 'short')} - {day.getDate()} -
-
- +{#if rows.length} + {@const dep = departmentById.get(department)} + + +
+ {#key [containerWidthRem, columnWidthRem, headerWidthRem]} + +
+
+
+
+ {dep?.name}
-
- {getTotal( - requests, - startDate, - endDate, - types, - getHolidayDatesForEmployee(staffDepartmentMap, employee._id, holidays) - )} - showReportInfo(employee, rTime)} - > - {#if rTime !== undefined} - {floorFractionDigits(rTime.value, 3)} - ({rTime.tasks.size}) - {:else} - 0 - {/if} - createRequest(e, day, employee)} - on:mousemove={() => { - hoveredColumn = i - }} - on:mouseleave={() => { - hoveredColumn = -1 - }} + {@const today = areDatesEqual(todayDate, day)} + +
isFutureDate() && setPublicHoliday(day)} + > +
-
0} class="h-full w-full"> - {#if requests.length} - + {day.getDate()} +
+
{getWeekDayName(day, 'short')}
+
+ {/each} +
+ + + +
+ {#each rows as row} + {@const employee = row.employee} + {@const tracks = row.tracks} + {@const editable = isEditable(employee)} + +
+
+ {#each tracks as track, trackIndex} + {#each track.elements as element} + {@const request = element.request} +
+ 1} /> +
+ {/each} + {/each} +
+ + {#each values as value, i} + {@const day = getDay(startDate, value)} + {@const today = areDatesEqual(todayDate, day)} + {@const weekend = isWeekend(day)} + {@const holiday = isHoliday( + getHolidayDatesForEmployee(staffDepartmentMap, employee._id, holidays), + day + )} + {@const requests = getRequests(employeeRequests, day, day, employee._id)} + {@const tooltipValue = getTooltip(requests, day, employee)} + + {#key [tooltipValue, editable]} + +
createRequest(e, day, employee)} + > + {#if today} +
{/if}
-
-
-
-
- {getTotal( - Array.from(employeeRequests.values()).flat(), - startDate, - endDate, - types, - [...holidays.values()].flat() - )} - - {floorFractionDigits( - Array.from(timeReports.values()) - .flat() - .reduce((a, b) => a + b.value, 0), - 3 - )} - { - hoveredColumn = i - }} - on:mouseleave={() => { - hoveredColumn = -1 - }} - > - {getTotal([...employeeRequests.values()].flat(), day, day, types, [...holidays.values()].flat())} -
+ + {/key} +
{:else}
@@ -311,107 +362,162 @@ {/if} diff --git a/plugins/hr-resources/src/components/schedule/ScheduleRequest.svelte b/plugins/hr-resources/src/components/schedule/ScheduleRequest.svelte new file mode 100644 index 0000000000..180bb3059a --- /dev/null +++ b/plugins/hr-resources/src/components/schedule/ScheduleRequest.svelte @@ -0,0 +1,99 @@ + + + +{#await getType(request) then type} + {#if type} + {@const available = isAvailable(type, request)} + + +
click(e, request)} + > + + + {#if shouldShowDescription} + + {#if request.description !== ''} + + {:else if type} + + {/if} +
+ {/if} +{/await} + + diff --git a/plugins/hr-resources/src/components/schedule/StaffPresenter.svelte b/plugins/hr-resources/src/components/schedule/StaffPresenter.svelte new file mode 100644 index 0000000000..68d24df781 --- /dev/null +++ b/plugins/hr-resources/src/components/schedule/StaffPresenter.svelte @@ -0,0 +1,68 @@ + + + +{#if value} + +
+
+ +
+
+
+ {getName(value)} +
+ {#await getDepartment(value) then department} + {#if department} +
+ {department.name} +
+ {/if} + {/await} +
+
+
+{/if} + + diff --git a/plugins/hr/src/utils.ts b/plugins/hr/src/utils.ts index a9887ddabb..bf0b26767d 100644 --- a/plugins/hr/src/utils.ts +++ b/plugins/hr/src/utils.ts @@ -39,3 +39,18 @@ export function fromTzDate (tzDate: TzDate): number { export function tzDateEqual (tzDate: TzDate, tzDate2: TzDate): boolean { return tzDate.year === tzDate2.year && tzDate.month === tzDate2.month && tzDate.day === tzDate2.day } + +/** + * @public + */ +export function tzDateCompare (tzDate1: TzDate, tzDate2: TzDate): number { + if (tzDate1.year === tzDate2.year) { + if (tzDate1.month === tzDate2.month) { + return tzDate1.day - tzDate2.day + } else { + return tzDate1.month - tzDate2.month + } + } else { + return tzDate1.year - tzDate2.year + } +}