fix: refs #7869 fixed dated when adding an indefinetely or range event
gitea/salix-front/pipeline/pr-dev This commit is unstable Details

This commit is contained in:
Jon Elias 2025-03-07 13:13:18 +01:00
parent 268d723eb1
commit dd5356f45c
1 changed files with 6 additions and 2 deletions

View File

@ -54,7 +54,7 @@ const { openConfirmationModal } = useVnConfirm();
const quasar = useQuasar(); const quasar = useQuasar();
const isNew = computed(() => props.isNewMode); const isNew = computed(() => props.isNewMode);
const eventInclusionFormData = ref({ wdays: [] }); const eventInclusionFormData = ref({ wdays: [] });
const dated = ref(props.date || Date.vnNew());
const _inclusionType = ref('indefinitely'); const _inclusionType = ref('indefinitely');
const inclusionType = computed({ const inclusionType = computed({
get: () => _inclusionType.value, get: () => _inclusionType.value,
@ -82,7 +82,9 @@ const createEvent = async () => {
const zoneIds = props.zoneIds?.length ? props.zoneIds : [route.params.id]; const zoneIds = props.zoneIds?.length ? props.zoneIds : [route.params.id];
for (const id of zoneIds) { for (const id of zoneIds) {
let today = moment(eventInclusionFormData.value.dated); let today = eventInclusionFormData.value.dated
? moment(eventInclusionFormData.value.dated)
: moment(dated.value);
let lastDay = today.clone().add(4, 'months').endOf('month'); let lastDay = today.clone().add(4, 'months').endOf('month');
const { data } = await axios.get(`Zones/getEventsFiltered`, { const { data } = await axios.get(`Zones/getEventsFiltered`, {
@ -136,9 +138,11 @@ const refetchEvents = async () => {
onMounted(() => { onMounted(() => {
if (props.event) { if (props.event) {
dated.value = props.event?.dated;
eventInclusionFormData.value = { ...props.event }; eventInclusionFormData.value = { ...props.event };
inclusionType.value = props.event?.type || 'day'; inclusionType.value = props.event?.type || 'day';
} else if (props.date) { } else if (props.date) {
dated.value = props.date;
eventInclusionFormData.value.dated = props.date; eventInclusionFormData.value.dated = props.date;
inclusionType.value = 'day'; inclusionType.value = 'day';
} else inclusionType.value = 'indefinitely'; } else inclusionType.value = 'indefinitely';