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

View File

@ -208,13 +208,30 @@ const getWorkedHours = async (from, to) => {
}; };
const getAbsences = async () => { const getAbsences = async () => {
const params = { const startYear = startOfWeek.value.getFullYear();
workerFk: route.params.id, const endYear = endOfWeek.value.getFullYear();
businessFk: null, const defaultParams = { workerFk: route.params.id, businessFk: null };
year: startOfWeek.value.getFullYear(),
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); if (data) addEvents(data);
}; };