Merge branch 'master' of https://gitea.verdnatura.es/verdnatura/salix-front into test
gitea/salix-front/pipeline/pr-dev This commit looks good Details
gitea/salix-front/pipeline/head This commit looks good Details

This commit is contained in:
Alex Moreno 2025-01-07 15:05:33 +01:00
commit 621d98b32b
2 changed files with 38 additions and 9 deletions

View File

@ -113,8 +113,15 @@ const $props = defineProps({
});
const mixinRules = [requiredFieldRule, ...($attrs.rules ?? [])];
const { optionLabel, optionValue, optionFilter, optionFilterValue, options, modelValue } =
toRefs($props);
const {
optionLabel,
optionValue,
optionCaption,
optionFilter,
optionFilterValue,
options,
modelValue,
} = toRefs($props);
const myOptions = ref([]);
const myOptionsOriginal = ref([]);
const vnSelectRef = ref();
@ -321,6 +328,11 @@ function handleKeyDown(event) {
}
}
}
function getCaption(opt) {
if (optionCaption.value === false) return;
return opt[optionCaption.value] || opt[optionValue.value];
}
</script>
<template>
@ -391,8 +403,8 @@ function handleKeyDown(event) {
<QItemLabel>
{{ opt[optionLabel] }}
</QItemLabel>
<QItemLabel caption v-if="optionCaption !== false">
{{ `#${opt[optionCaption] || opt[optionValue]}` }}
<QItemLabel caption v-if="getCaption(opt)">
{{ `#${getCaption(opt)}` }}
</QItemLabel>
</QItemSection>
</QItem>

View File

@ -208,13 +208,30 @@ const getWorkedHours = async (from, to) => {
};
const getAbsences = async () => {
const params = {
workerFk: route.params.id,
businessFk: null,
year: startOfWeek.value.getFullYear(),
const startYear = startOfWeek.value.getFullYear();
const endYear = endOfWeek.value.getFullYear();
const defaultParams = { workerFk: route.params.id, businessFk: null };
const startData = (
await axios.get('Calendars/absences', {
params: { ...defaultParams, year: startYear },
})
).data;
let endData;
if (startYear !== endYear) {
endData = (
await axios.get('Calendars/absences', {
params: { ...defaultParams, year: endYear },
})
).data;
}
const data = {
holidays: [...(startData?.holidays || []), ...(endData?.holidays || [])],
absences: [...(startData?.absences || []), ...(endData?.absences || [])],
};
const { data } = await axios.get('Calendars/absences', { params });
if (data) addEvents(data);
};