Add icons around days off
This commit is contained in:
@@ -49,6 +49,15 @@
|
|||||||
|
|
||||||
return startDays > endDays ? startMonth : endMonth;
|
return startDays > endDays ? startMonth : endMonth;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isConsecutiveDayOff(day) {
|
||||||
|
return consecutiveDaysOff.some(period => {
|
||||||
|
const start = period.startDate;
|
||||||
|
const end = period.endDate;
|
||||||
|
const date = new Date(year, month, day);
|
||||||
|
return date >= start && date <= end;
|
||||||
|
});
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="calendar">
|
<div class="calendar">
|
||||||
@@ -57,7 +66,7 @@
|
|||||||
<div class="day"></div>
|
<div class="day"></div>
|
||||||
{/each}
|
{/each}
|
||||||
{#each Array.from({ length: daysInMonth }, (_, i) => i + 1) as day}
|
{#each Array.from({ length: daysInMonth }, (_, i) => i + 1) as day}
|
||||||
<div class="day {(firstDay + day - 1) % 7 === 0 || (firstDay + day - 1) % 7 === 6 ? 'weekend' : ''} {getHoliday(day) ? 'holiday' : ''} {isOptimizedDayOff(day) ? 'optimized' : ''}">
|
<div class="day {(firstDay + day - 1) % 7 === 0 || (firstDay + day - 1) % 7 === 6 ? 'weekend' : ''} {getHoliday(day) ? 'holiday' : ''} {isOptimizedDayOff(day) ? 'optimized' : ''} {isConsecutiveDayOff(day) ? 'consecutive-day' : ''}">
|
||||||
{day}
|
{day}
|
||||||
{#if getHoliday(day)}
|
{#if getHoliday(day)}
|
||||||
<Tooltip text={getHoliday(day).name} />
|
<Tooltip text={getHoliday(day).name} />
|
||||||
@@ -114,6 +123,9 @@
|
|||||||
background-color: #3b1e6e;
|
background-color: #3b1e6e;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
.consecutive-day {
|
||||||
|
border: 1px solid rgba(255, 255, 255, 0.7);
|
||||||
|
}
|
||||||
.month-name {
|
.month-name {
|
||||||
grid-column: span 7;
|
grid-column: span 7;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|||||||
Reference in New Issue
Block a user