Compare commits
5 Commits
d681cec9a6
...
94f433de6e
Author | SHA1 | Date | |
---|---|---|---|
94f433de6e | |||
a9c476cb8e | |||
5c3833d4cb | |||
6e627d11c8 | |||
eb644fa494 |
@ -1,39 +0,0 @@
|
|||||||
import { h, ref } from 'vue'
|
|
||||||
|
|
||||||
const ActiveComponent = function(props, { attrs, slots }) {
|
|
||||||
const key = props.pkey
|
|
||||||
const isActive = ref(false)
|
|
||||||
|
|
||||||
function onMouseover() {
|
|
||||||
console.log('activated ' + key)
|
|
||||||
isActive.value = true
|
|
||||||
}
|
|
||||||
|
|
||||||
function onMouseleave() {
|
|
||||||
console.log('disabled ' + key)
|
|
||||||
isActive.value = false
|
|
||||||
}
|
|
||||||
|
|
||||||
return h(props.as, {
|
|
||||||
...attrs,
|
|
||||||
class: 'hello',
|
|
||||||
onMouseover,
|
|
||||||
onMouseleave,
|
|
||||||
}, [
|
|
||||||
slots,
|
|
||||||
slots.default({ isActive }),
|
|
||||||
])
|
|
||||||
}
|
|
||||||
|
|
||||||
ActiveComponent.props = {
|
|
||||||
as: {
|
|
||||||
type: String,
|
|
||||||
default: 'div',
|
|
||||||
},
|
|
||||||
pkey: {
|
|
||||||
type: Number,
|
|
||||||
required: true,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
export default ActiveComponent
|
|
@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div
|
<div
|
||||||
:class="[ (day.isVacation || day.isPendingVacation) && 'border-b-2 border-dashed', day.isPendingVacation && 'border-lime-500', day.isVacation && 'border-blumilk-500' ]"
|
:class="[ (day.isVacation || day.isPendingVacation) && `border-b-2 border-dashed ${getVacationBorder(day)}` ]"
|
||||||
>
|
>
|
||||||
<Popper
|
<Popper
|
||||||
v-if="day.isHoliday"
|
v-if="day.isHoliday"
|
||||||
@ -39,13 +39,23 @@
|
|||||||
{{ day.dayNumber }}
|
{{ day.dayNumber }}
|
||||||
</time>
|
</time>
|
||||||
<template #content>
|
<template #content>
|
||||||
<div class="py-2 px-6 text-sm font-semibold text-left text-gray-700 bg-white rounded-lg border border-gray-400">
|
<VacationPopup :vacation="getVacationInfo(day)" />
|
||||||
{{ getHolidayDescription(day) }}
|
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
</Popper>
|
</Popper>
|
||||||
<div
|
<div
|
||||||
|
v-else-if="day.isWeekend"
|
||||||
|
>
|
||||||
|
<time
|
||||||
|
:datetime="day.date"
|
||||||
|
:class="{ 'flex h-6 w-6 items-center justify-center rounded-full bg-blumilk-500 font-semibold text-white': day.isToday }"
|
||||||
|
>
|
||||||
|
{{ day.dayNumber }}
|
||||||
|
</time>
|
||||||
|
</div>
|
||||||
|
<InertiaLink
|
||||||
v-else
|
v-else
|
||||||
|
href="/vacation/requests/create"
|
||||||
|
:data="{ 'from_date': day.date }"
|
||||||
@mouseover.passive="onMouseover"
|
@mouseover.passive="onMouseover"
|
||||||
@mouseleave="onMouseleave"
|
@mouseleave="onMouseleave"
|
||||||
>
|
>
|
||||||
@ -55,20 +65,27 @@
|
|||||||
>
|
>
|
||||||
{{ day.dayNumber }}
|
{{ day.dayNumber }}
|
||||||
</time>
|
</time>
|
||||||
</div>
|
</InertiaLink>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import Popper from 'vue3-popper'
|
import Popper from 'vue3-popper'
|
||||||
import { defineProps, ref } from 'vue'
|
import { defineProps, ref } from 'vue'
|
||||||
|
import VacationPopup from '@/Shared/VacationPopup'
|
||||||
|
|
||||||
const props = defineProps({
|
defineProps({
|
||||||
day: {
|
day: {
|
||||||
type: Object,
|
type: Object,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
holidayDescription: {
|
getHolidayDescription: {
|
||||||
|
type: Function,
|
||||||
|
},
|
||||||
|
getVacationBorder: {
|
||||||
|
type: Function,
|
||||||
|
},
|
||||||
|
getVacationInfo: {
|
||||||
type: Function,
|
type: Function,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
@ -84,9 +101,4 @@ function onMouseleave() {
|
|||||||
if (isActive.value)
|
if (isActive.value)
|
||||||
isActive.value = false
|
isActive.value = false
|
||||||
}
|
}
|
||||||
|
|
||||||
function getHolidayDescription(day) {
|
|
||||||
return props.holidayDescription(day)
|
|
||||||
}
|
|
||||||
|
|
||||||
</script>
|
</script>
|
@ -120,13 +120,15 @@
|
|||||||
class="w-full grid grid-cols-7 gap-px"
|
class="w-full grid grid-cols-7 gap-px"
|
||||||
:class="{ 'grid-rows-1': calendarState.viewMode.isWeek }"
|
:class="{ 'grid-rows-1': calendarState.viewMode.isWeek }"
|
||||||
>
|
>
|
||||||
<DateComponent
|
<DayComponent
|
||||||
v-for="(day, index) in days"
|
v-for="(day, index) in days"
|
||||||
:key="index"
|
:key="index"
|
||||||
:day="day"
|
:day="day"
|
||||||
class="flex flex-col relative py-2 px-3"
|
class="flex flex-col relative py-2 px-3"
|
||||||
:class="[day.isCurrentMonth ? 'bg-white' : 'bg-gray-50 text-gray-500', { 'hover:bg-blumilk-25': day.isCurrentMonth && !day.isWeekend }, { 'day': calendarState.viewMode.isWeek }, { 'bg-red-100': day.isCurrentMonth && day.isWeekend }, { 'bg-red-50': !day.isCurrentMonth && day.isWeekend }, { 'text-red-800': day.isWeekend }]"
|
:class="[day.isCurrentMonth ? 'bg-white' : 'bg-gray-50 text-gray-500', { 'hover:bg-blumilk-25': day.isCurrentMonth && !day.isWeekend }, { 'day': calendarState.viewMode.isWeek }, { 'bg-red-100': day.isCurrentMonth && day.isWeekend }, { 'bg-red-50': !day.isCurrentMonth && day.isWeekend }, { 'text-red-800': day.isWeekend }]"
|
||||||
:holiday-description="getHolidayDescription"
|
:get-holiday-description="getHolidayDescription"
|
||||||
|
:get-vacation-border="getVacationBorder"
|
||||||
|
:get-vacation-info="getVacationInfo"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -139,10 +141,11 @@ import { CheckIcon, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon } from '@
|
|||||||
import { Menu, MenuButton, MenuItem, MenuItems } from '@headlessui/vue'
|
import { Menu, MenuButton, MenuItem, MenuItems } from '@headlessui/vue'
|
||||||
import { ref, watch, computed, reactive } from 'vue'
|
import { ref, watch, computed, reactive } from 'vue'
|
||||||
import { DateTime } from 'luxon'
|
import { DateTime } from 'luxon'
|
||||||
|
import useVacationTypeInfo from '@/Composables/vacationTypeInfo'
|
||||||
import useCurrentYearPeriodInfo from '@/Composables/yearPeriodInfo'
|
import useCurrentYearPeriodInfo from '@/Composables/yearPeriodInfo'
|
||||||
import { useMonthInfo } from '@/Composables/monthInfo'
|
import { useMonthInfo } from '@/Composables/monthInfo'
|
||||||
import { viewModes, find as findViewMode } from '@/Shared/Widgets/Calendar/ViewModeOptions'
|
import { viewModes, find as findViewMode } from '@/Shared/Widgets/Calendar/ViewModeOptions'
|
||||||
import DateComponent from '@/Shared/Widgets/Calendar/DateComponent'
|
import DayComponent from '@/Shared/Widgets/Calendar/DayComponent'
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
holidays: Object,
|
holidays: Object,
|
||||||
@ -159,6 +162,7 @@ function getCurrentDate() {
|
|||||||
const currentDate = getCurrentDate()
|
const currentDate = getCurrentDate()
|
||||||
|
|
||||||
const months = useMonthInfo().getMonths()
|
const months = useMonthInfo().getMonths()
|
||||||
|
const { findType } = useVacationTypeInfo()
|
||||||
const selectedYear = useCurrentYearPeriodInfo().year.value
|
const selectedYear = useCurrentYearPeriodInfo().year.value
|
||||||
|
|
||||||
const calendar = {
|
const calendar = {
|
||||||
@ -349,6 +353,14 @@ function isVacation(date) {
|
|||||||
function isPendingVacation(date) {
|
function isPendingVacation(date) {
|
||||||
return props.pendingVacations[date.toISODate()] !== undefined
|
return props.pendingVacations[date.toISODate()] !== undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getVacationBorder(day) {
|
||||||
|
return findType(getVacationInfo(day).type)?.border
|
||||||
|
}
|
||||||
|
|
||||||
|
function getVacationInfo(day) {
|
||||||
|
return day.isVacation ? props.approvedVacations[day.date] : props.pendingVacations[day.date]
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="css">
|
<style lang="css">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user