#157 - prepared clikable days
This commit is contained in:
parent
6fdd2ca049
commit
34a5827aeb
@ -39,7 +39,7 @@
|
|||||||
offset-distance="0"
|
offset-distance="0"
|
||||||
>
|
>
|
||||||
<div :class="[day.isPendingVacation && 'mx-0.5']">
|
<div :class="[day.isPendingVacation && 'mx-0.5']">
|
||||||
<button :class="[day.isPendingVacation && `border-dashed`, `${getVacationBorder(day)} isolate bg-white w-full hover:bg-blumilk-25 border-b-4 py-1.5 font-medium focus:outline-blumilk-500`]">
|
<button :class="[day.isPendingVacation && `border-dashed`, `${getVacationBorder(day)} isolate bg-white w-full hover:bg-blumilk-25 border-b-4 py-1.5 font-medium focus:outline-blumilk-500 cursor-default`]">
|
||||||
<time
|
<time
|
||||||
:datetime="day.date.toISODate()"
|
:datetime="day.date.toISODate()"
|
||||||
:class="[ day.isToday && 'bg-blumilk-500 font-semibold text-white rounded-full', 'mx-auto flex h-7 w-7 p-4 items-center justify-center']"
|
:class="[ day.isToday && 'bg-blumilk-500 font-semibold text-white rounded-full', 'mx-auto flex h-7 w-7 p-4 items-center justify-center']"
|
||||||
@ -58,7 +58,7 @@
|
|||||||
hover
|
hover
|
||||||
offset-distance="0"
|
offset-distance="0"
|
||||||
>
|
>
|
||||||
<button class="py-1.5 w-full font-medium bg-white hover:bg-blumilk-25 border-b-4 border-transparent focus:outline-blumilk-500">
|
<button class="py-1.5 w-full font-medium bg-white hover:bg-blumilk-25 border-b-4 border-transparent focus:outline-blumilk-500 cursor-default">
|
||||||
<time
|
<time
|
||||||
:datetime="day.date.toISODate()"
|
:datetime="day.date.toISODate()"
|
||||||
:class="[ day.isToday && 'bg-blumilk-500 font-semibold text-white rounded-full', 'text-red-700 font-bold mx-auto flex h-7 w-7 p-4 items-center justify-center']"
|
:class="[ day.isToday && 'bg-blumilk-500 font-semibold text-white rounded-full', 'text-red-700 font-bold mx-auto flex h-7 w-7 p-4 items-center justify-center']"
|
||||||
@ -73,16 +73,44 @@
|
|||||||
</template>
|
</template>
|
||||||
</Popper>
|
</Popper>
|
||||||
<button
|
<button
|
||||||
v-else
|
v-else-if="day.isWeekend"
|
||||||
class="py-1.5 w-full font-medium bg-white hover:bg-blumilk-25 border-b-4 border-transparent focus:outline-blumilk-500"
|
class="py-1.5 w-full font-medium bg-white hover:bg-blumilk-25 border-b-4 border-transparent focus:outline-blumilk-500 hover:bg-transparent cursor-not-allowed"
|
||||||
>
|
>
|
||||||
<time
|
<time
|
||||||
:datetime="day.date.toISODate()"
|
:datetime="day.date.toISODate()"
|
||||||
:class="[ day.isToday && 'bg-blumilk-500 font-semibold text-white rounded-full', day.isWeekend && 'text-red-700 font-bold', 'mx-auto flex h-7 w-7 p-4 items-center justify-center']"
|
class="text-red-700 font-bold mx-auto flex h-7 w-7 p-4 items-center justify-center"
|
||||||
>
|
>
|
||||||
{{ day.date.day }}
|
{{ day.date.day }}
|
||||||
</time>
|
</time>
|
||||||
</button>
|
</button>
|
||||||
|
<template
|
||||||
|
v-else
|
||||||
|
>
|
||||||
|
<InertiaLink
|
||||||
|
v-if="day.isFuture"
|
||||||
|
href="/vacation/requests/create"
|
||||||
|
:data="{ 'start_date': day.date.toISODate() }"
|
||||||
|
class="py-1.5 w-full font-medium bg-white hover:bg-blumilk-25 border-b-4 border-transparent focus:outline-blumilk-500"
|
||||||
|
>
|
||||||
|
<time
|
||||||
|
:datetime="day.date.toISODate()"
|
||||||
|
:class="[ day.isToday && 'bg-blumilk-500 font-semibold text-white rounded-full', 'mx-auto flex h-7 w-7 p-4 items-center justify-center']"
|
||||||
|
>
|
||||||
|
{{ day.date.day }}
|
||||||
|
</time>
|
||||||
|
</InertiaLink>
|
||||||
|
<button
|
||||||
|
v-else
|
||||||
|
class="py-1.5 w-full font-medium bg-white hover:bg-blumilk-25 border-b-4 border-transparent focus:outline-blumilk-500 hover:bg-transparent cursor-not-allowed"
|
||||||
|
>
|
||||||
|
<time
|
||||||
|
:datetime="day.date.toISODate()"
|
||||||
|
class="mx-auto flex h-7 w-7 p-4 items-center justify-center"
|
||||||
|
>
|
||||||
|
{{ day.date.day }}
|
||||||
|
</time>
|
||||||
|
</button>
|
||||||
|
</template>
|
||||||
</template>
|
</template>
|
||||||
<div
|
<div
|
||||||
v-else
|
v-else
|
||||||
@ -101,6 +129,15 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<style lang="css">
|
||||||
|
.cursor-default {
|
||||||
|
cursor: auto;
|
||||||
|
}
|
||||||
|
.cursor-not-allowed {
|
||||||
|
cursor: not-allowed;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { DateTime } from 'luxon'
|
import { DateTime } from 'luxon'
|
||||||
import useVacationTypeInfo from '@/Composables/vacationTypeInfo'
|
import useVacationTypeInfo from '@/Composables/vacationTypeInfo'
|
||||||
@ -112,6 +149,7 @@ const props = defineProps({
|
|||||||
holidays: Object,
|
holidays: Object,
|
||||||
vacations: Object,
|
vacations: Object,
|
||||||
pendingVacations: Object,
|
pendingVacations: Object,
|
||||||
|
overButtonDay: String,
|
||||||
})
|
})
|
||||||
|
|
||||||
const { findType } = useVacationTypeInfo()
|
const { findType } = useVacationTypeInfo()
|
||||||
@ -141,6 +179,7 @@ for (let i = 1; i < 13; i++) {
|
|||||||
isVacation: isCurrentMonth && isVacation(day),
|
isVacation: isCurrentMonth && isVacation(day),
|
||||||
isPendingVacation: isCurrentMonth && isPendingVacation(day),
|
isPendingVacation: isCurrentMonth && isPendingVacation(day),
|
||||||
isHoliday: isHoliday(day),
|
isHoliday: isHoliday(day),
|
||||||
|
isFuture: isFuture(day),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -163,6 +202,10 @@ function isToday(date) {
|
|||||||
return DateTime.now().hasSame(date, 'year') && DateTime.now().hasSame(date, 'day')
|
return DateTime.now().hasSame(date, 'year') && DateTime.now().hasSame(date, 'day')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isFuture(date) {
|
||||||
|
return date.toISODate().toString() >= DateTime.now().toISODate().toString()
|
||||||
|
}
|
||||||
|
|
||||||
function isInCurrentMonth(date, currentMonth) {
|
function isInCurrentMonth(date, currentMonth) {
|
||||||
return currentMonth.hasSame(date, 'month')
|
return currentMonth.hasSame(date, 'month')
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user