mirror of
https://github.com/hcengineering/platform.git
synced 2025-05-09 17:05:01 +00:00
Schedule tooltip fix (#2193)
Signed-off-by: Denis Bykhov <80476319+BykhovDenis@users.noreply.github.com>
This commit is contained in:
parent
36f900e2a4
commit
808ea852a4
@ -92,7 +92,6 @@
|
||||
items={types.map((p) => {
|
||||
return { id: p._id, label: p.label }
|
||||
})}
|
||||
placeholder={hr.string.RequestType}
|
||||
label={hr.string.RequestType}
|
||||
on:selected={(e) => typeSelected(e.detail)}
|
||||
/>
|
||||
|
@ -157,8 +157,7 @@
|
||||
: new Date(date).setDate(date.getDate() + 1)
|
||||
}
|
||||
|
||||
function getTooltip (employee: Staff, date: Date): LabelAndProps | undefined {
|
||||
const requests = getRequests(employee._id, date)
|
||||
function getTooltip (requests: Request[], employee: Staff, date: Date): LabelAndProps | undefined {
|
||||
if (requests.length === 0) return
|
||||
const endDate = getEndDate(date)
|
||||
return {
|
||||
@ -234,31 +233,37 @@
|
||||
{#if mode === CalendarMode.Year}
|
||||
{@const month = getMonth(currentDate, value)}
|
||||
{@const requests = getRequests(employee._id, month)}
|
||||
<td
|
||||
class:today={month.getFullYear() === todayDate.getFullYear() &&
|
||||
month.getMonth() === todayDate.getMonth()}
|
||||
class="fixed"
|
||||
use:tooltip={getTooltip(employee, month)}
|
||||
>
|
||||
<div class="flex-center">
|
||||
{getTotal(requests)}
|
||||
</div>
|
||||
</td>
|
||||
{@const tooltipValue = getTooltip(requests, employee, month)}
|
||||
{#key tooltipValue}
|
||||
<td
|
||||
class:today={month.getFullYear() === todayDate.getFullYear() &&
|
||||
month.getMonth() === todayDate.getMonth()}
|
||||
class="fixed"
|
||||
use:tooltip={tooltipValue}
|
||||
>
|
||||
<div class="flex-center">
|
||||
{getTotal(requests)}
|
||||
</div>
|
||||
</td>
|
||||
{/key}
|
||||
{:else}
|
||||
{@const date = getDay(new Date(startDate), value)}
|
||||
{@const requests = getRequests(employee._id, date)}
|
||||
{@const editable = isEditable(employee)}
|
||||
<td
|
||||
class:today={areDatesEqual(todayDate, date)}
|
||||
class:weekend={isWeekend(date)}
|
||||
class:cursor-pointer={editable}
|
||||
use:tooltip={getTooltip(employee, date)}
|
||||
on:click={(e) => createRequest(e, date, employee)}
|
||||
>
|
||||
{#if requests.length}
|
||||
<ScheduleRequests {requests} {date} {editable} />
|
||||
{/if}
|
||||
</td>
|
||||
{@const tooltipValue = getTooltip(requests, employee, date)}
|
||||
{#key [tooltipValue, editable]}
|
||||
<td
|
||||
class:today={areDatesEqual(todayDate, date)}
|
||||
class:weekend={isWeekend(date)}
|
||||
class:cursor-pointer={editable}
|
||||
use:tooltip={tooltipValue}
|
||||
on:click={(e) => createRequest(e, date, employee)}
|
||||
>
|
||||
{#if requests.length}
|
||||
<ScheduleRequests {requests} {date} {editable} />
|
||||
{/if}
|
||||
</td>
|
||||
{/key}
|
||||
{/if}
|
||||
{/each}
|
||||
</tr>
|
||||
|
Loading…
Reference in New Issue
Block a user