Merge branch 'dev' into 6111-modsRouteList
gitea/salix-front/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Carlos Satorres 2024-05-23 12:47:38 +00:00
commit 6388f08ffb
3 changed files with 25 additions and 12 deletions

View File

@ -59,12 +59,10 @@ const containerClasses = computed(() => {
// Clases para modificar el color de fecha seleccionada en componente QCalendarMonth
.q-dark div .q-calendar-mini .q-calendar-month__day.q-selected .q-calendar__button {
background-color: $primary !important;
color: white !important;
}
.q-calendar-mini .q-calendar-month__day.q-selected .q-calendar__button {
background-color: $primary !important;
color: white !important;
}
.q-calendar-month__head--weekday {
@ -112,7 +110,6 @@ const containerClasses = computed(() => {
cursor: pointer;
}
}
.q-calendar-month__week--days > div:nth-child(6),
.q-calendar-month__week--days > div:nth-child(7) {
// Cambia el color de los días sábado y domingo

View File

@ -82,6 +82,7 @@ const onFetchAbsences = (data) => {
type: type.code,
absenceId: absence.id,
isFestive: false,
isHoliday: false,
});
});
}

View File

@ -126,7 +126,7 @@ const handleEventSelected = (event, { year, month, day }) => {
}
const date = new Date(year, month - 1, day);
if (!event.absenceId) createEvent(date);
if (!event?.absenceId) createEvent(date);
else if (event.type == props.absenceType.code) deleteEvent(event, date);
else editEvent(event);
};
@ -136,24 +136,31 @@ const getEventByTimestamp = ({ year, month, day }) => {
return props.events[stamp] || null;
};
const isFestive = (timestamp) => {
const event = getEventByTimestamp(timestamp);
if (!event) return false;
const { isFestive } = event;
return isFestive;
};
const getEventAttrs = (timestamp) => {
const event = getEventByTimestamp(timestamp);
if (!event) return {};
const { name, color, isFestive } = event;
const { name, color, isFestive, type } = event;
// Atributos a asignar a cada slot que representa un evento en el calendario
const attrs = {
title: name,
style: color ? `background-color: ${color};` : '',
style: color ? `background-color: ${color};` : ``,
label: timestamp.day,
};
if (isFestive) {
attrs.class = '--festive';
attrs.label = event.absenceId ? timestamp.day : '';
}
attrs.label = event.absenceId ?? timestamp.day;
} else attrs.class = `--${type}`;
return attrs;
};
@ -162,7 +169,6 @@ const isToday = (timestamp) => {
const { year, month, day } = timestamp;
return todayTimestamp.value === new Date(year, month - 1, day).getTime();
};
onBeforeMount(() => {
updateSelectedDate(_year.value);
});
@ -203,7 +209,6 @@ watch(_year, (newValue) => {
<template #day="{ scope: { timestamp } }">
<!-- Este slot representa cada día del calendario y muestra un botón representando el correspondiente evento -->
<QBtn
v-if="getEventByTimestamp(timestamp)"
v-bind="{ ...getEventAttrs(timestamp) }"
@click="
handleEventSelected(getEventByTimestamp(timestamp), timestamp)
@ -223,6 +228,11 @@ watch(_year, (newValue) => {
</template>
<style lang="scss">
.q-calendar-month__day:has(.q-calendar-month__day--content):has(.q-btn.--festive)
.q-calendar-month__day--label__wrapper
button {
color: transparent;
}
.calendar-event {
display: flex;
justify-content: center;
@ -231,14 +241,19 @@ watch(_year, (newValue) => {
font-size: 13px;
line-height: 1.715em;
cursor: pointer;
color: white;
&.--today {
border: 2px solid $info;
}
&.--festive {
border: 2px solid $negative;
color: $negative;
}
&.--holiday {
& > span:nth-child(2) .block {
color: white;
}
}
&:hover {