refactor: refs #7869 merged changes with #8606
gitea/salix-front/pipeline/pr-dev This commit is unstable
Details
gitea/salix-front/pipeline/pr-dev This commit is unstable
Details
This commit is contained in:
parent
74692a6107
commit
268d723eb1
|
@ -83,7 +83,8 @@ const exclusionCreate = async () => {
|
|||
const body = {
|
||||
dated: dated.value,
|
||||
};
|
||||
for (const id of props.zoneIds) {
|
||||
const zoneIds = props.zoneIds?.length ? props.zoneIds : [route.params.id];
|
||||
for (const id of zoneIds) {
|
||||
const url = `Zones/${id}/exclusions`;
|
||||
let today = moment(dated.value);
|
||||
let lastDay = today.clone().add(4, 'months').endOf('month');
|
||||
|
|
|
@ -3,6 +3,12 @@ import { ref, computed, onMounted } from 'vue';
|
|||
import { useI18n } from 'vue-i18n';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { useQuasar } from 'quasar';
|
||||
import axios from 'axios';
|
||||
import moment from 'moment';
|
||||
|
||||
import { useArrayData } from 'src/composables/useArrayData';
|
||||
import { useWeekdayStore } from 'src/stores/useWeekdayStore';
|
||||
import { useVnConfirm } from 'composables/useVnConfirm';
|
||||
|
||||
import VnRow from 'components/ui/VnRow.vue';
|
||||
import FormPopup from 'components/FormPopup.vue';
|
||||
|
@ -10,10 +16,7 @@ import VnInputDate from 'src/components/common/VnInputDate.vue';
|
|||
import VnWeekdayPicker from 'src/components/common/VnWeekdayPicker.vue';
|
||||
import VnInputTime from 'components/common/VnInputTime.vue';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import { useArrayData } from 'src/composables/useArrayData';
|
||||
import { useWeekdayStore } from 'src/stores/useWeekdayStore';
|
||||
import { useVnConfirm } from 'composables/useVnConfirm';
|
||||
import axios from 'axios';
|
||||
import { toDateFormat } from 'src/filters/date';
|
||||
|
||||
const props = defineProps({
|
||||
date: {
|
||||
|
@ -79,6 +82,27 @@ const createEvent = async () => {
|
|||
|
||||
const zoneIds = props.zoneIds?.length ? props.zoneIds : [route.params.id];
|
||||
for (const id of zoneIds) {
|
||||
let today = moment(eventInclusionFormData.value.dated);
|
||||
let lastDay = today.clone().add(4, 'months').endOf('month');
|
||||
|
||||
const { data } = await axios.get(`Zones/getEventsFiltered`, {
|
||||
params: {
|
||||
zoneFk: id,
|
||||
started: today,
|
||||
ended: lastDay,
|
||||
},
|
||||
});
|
||||
const existsExclusion = data.exclusions.find(
|
||||
(exclusion) =>
|
||||
toDateFormat(exclusion.dated) ===
|
||||
toDateFormat(eventInclusionFormData.value.dated),
|
||||
);
|
||||
if (existsExclusion) {
|
||||
await axios.delete(
|
||||
`Zones/${existsExclusion?.zoneFk}/exclusions/${existsExclusion?.id}`,
|
||||
);
|
||||
}
|
||||
|
||||
if (isNew.value)
|
||||
await axios.post(`Zones/${id}/events`, eventInclusionFormData.value);
|
||||
else
|
||||
|
|
|
@ -213,28 +213,6 @@ const closeEventForm = () => {
|
|||
</script>
|
||||
|
||||
<template>
|
||||
<VnSubToolbar>
|
||||
<template #st-actions>
|
||||
<QBtnGroup style="column-gap: 10px">
|
||||
<QBtn
|
||||
color="primary"
|
||||
icon-right="event_available"
|
||||
:disable="!hasSelectedRows"
|
||||
@click="openForm(true, selectedRows)"
|
||||
>
|
||||
<QTooltip>{{ t('list.includeEvent') }}</QTooltip>
|
||||
</QBtn>
|
||||
<QBtn
|
||||
color="primary"
|
||||
icon-right="event_busy"
|
||||
:disable="!hasSelectedRows"
|
||||
@click="openForm(false, selectedRows)"
|
||||
>
|
||||
<QTooltip>{{ t('list.excludeEvent') }}</QTooltip>
|
||||
</QBtn>
|
||||
</QBtnGroup>
|
||||
</template>
|
||||
</VnSubToolbar>
|
||||
<VnSection
|
||||
:data-key="dataKey"
|
||||
:columns="columns"
|
||||
|
@ -247,6 +225,28 @@ const closeEventForm = () => {
|
|||
}"
|
||||
>
|
||||
<template #body>
|
||||
<VnSubToolbar>
|
||||
<template #st-actions>
|
||||
<QBtnGroup style="column-gap: 10px">
|
||||
<QBtn
|
||||
color="primary"
|
||||
icon-right="event_available"
|
||||
:disable="!hasSelectedRows"
|
||||
@click="openForm(true, selectedRows)"
|
||||
>
|
||||
<QTooltip>{{ t('list.includeEvent') }}</QTooltip>
|
||||
</QBtn>
|
||||
<QBtn
|
||||
color="primary"
|
||||
icon-right="event_busy"
|
||||
:disable="!hasSelectedRows"
|
||||
@click="openForm(false, selectedRows)"
|
||||
>
|
||||
<QTooltip>{{ t('list.excludeEvent') }}</QTooltip>
|
||||
</QBtn>
|
||||
</QBtnGroup>
|
||||
</template>
|
||||
</VnSubToolbar>
|
||||
<div class="table-container">
|
||||
<div class="column items-center">
|
||||
<VnTable
|
||||
|
|
Loading…
Reference in New Issue