From 26d998a2dd4665193e87761529e95088efe14470 Mon Sep 17 00:00:00 2001 From: Alexander Platov Date: Mon, 4 Jul 2022 21:16:04 +0300 Subject: [PATCH] HR: update schedule layout (#2202) --- packages/theme/styles/components.scss | 12 +-- .../src/components/Schedule.svelte | 4 +- .../src/components/ScheduleView.svelte | 92 +++++++++++++++---- 3 files changed, 80 insertions(+), 28 deletions(-) diff --git a/packages/theme/styles/components.scss b/packages/theme/styles/components.scss index 436ad6b190..7ca4a82c79 100644 --- a/packages/theme/styles/components.scss +++ b/packages/theme/styles/components.scss @@ -434,13 +434,13 @@ &:hover { background-color: var(--highlight-select-hover); } } } +} - .scroller-thead { - position: sticky; - top: 0; - z-index: 2; - background-color: var(--body-color); - } +.scroller-thead { + position: sticky; + top: 0; + z-index: 2; + background-color: var(--body-color); } // THead background-color in Tooltip and Popups diff --git a/plugins/hr-resources/src/components/Schedule.svelte b/plugins/hr-resources/src/components/Schedule.svelte index 6a8c4dd7e0..2d110ee649 100644 --- a/plugins/hr-resources/src/components/Schedule.svelte +++ b/plugins/hr-resources/src/components/Schedule.svelte @@ -119,6 +119,4 @@ -
- -
+ diff --git a/plugins/hr-resources/src/components/ScheduleView.svelte b/plugins/hr-resources/src/components/ScheduleView.svelte index 4662604b6b..a0a7fae28e 100644 --- a/plugins/hr-resources/src/components/ScheduleView.svelte +++ b/plugins/hr-resources/src/components/ScheduleView.svelte @@ -189,47 +189,60 @@ } return total } + + let hoveredIndex: number = -1 {#if departmentStaff.length} - + - {#each values as value} + {#each values as value, i} {#if mode === CalendarMode.Year} {@const month = getMonth(currentDate, value)} {:else} {@const day = getDay(new Date(startDate), value)} - {/if} {/each} - {#each departmentStaff as employee} + {#each departmentStaff as employee, row} - {#each values as value} + {#each values as value, i} {#if mode === CalendarMode.Year} {@const month = getMonth(currentDate, value)} {@const requests = getRequests(employee._id, month)} @@ -256,6 +269,9 @@ class:today={areDatesEqual(todayDate, date)} class:weekend={isWeekend(date)} class:cursor-pointer={editable} + class:hovered={i === hoveredIndex} + class:firstLine={row === 0} + class:lastLine={row === departmentStaff.length - 1} use:tooltip={tooltipValue} on:click={(e) => createRequest(e, date, employee)} > @@ -272,24 +288,26 @@
{ + hoveredIndex = i + }} + on:mouseleave={() => { + hoveredIndex = -1 + }} > -
-
{getMonthName(month)}
-
+ {getMonthName(month)}
-
-
{getWeekDayName(day, 'short')}
-
{day.getDate()}
-
+
{ + hoveredIndex = i + }} + on:mouseleave={() => { + hoveredIndex = -1 + }} + > + {getWeekDayName(day, 'short')} + {day.getDate()}
{:else} -
+
{/if}