Merge branch 'master' into hotfix_negative_available
gitea/salix-front/pipeline/pr-master This commit is unstable
Details
gitea/salix-front/pipeline/pr-master This commit is unstable
Details
This commit is contained in:
commit
de359043af
|
@ -4,7 +4,6 @@ import { useI18n } from 'vue-i18n';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
|
|
||||||
import { QBtn, useQuasar } from 'quasar';
|
import { QBtn, useQuasar } from 'quasar';
|
||||||
|
|
||||||
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
|
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
|
||||||
import { toDateTimeFormat } from 'src/filters/date';
|
import { toDateTimeFormat } from 'src/filters/date';
|
||||||
import VnTable from 'src/components/VnTable/VnTable.vue';
|
import VnTable from 'src/components/VnTable/VnTable.vue';
|
||||||
|
@ -34,7 +33,7 @@ const columns = computed(() => [
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
format: (row) => row.type.description,
|
format: (row) => row?.type?.description,
|
||||||
label: t('Description'),
|
label: t('Description'),
|
||||||
name: 'description',
|
name: 'description',
|
||||||
},
|
},
|
||||||
|
@ -74,12 +73,11 @@ const tableRef = ref();
|
||||||
<template>
|
<template>
|
||||||
<VnTable
|
<VnTable
|
||||||
ref="tableRef"
|
ref="tableRef"
|
||||||
data-key="ClientSamples"
|
data-key="CustomerSamples"
|
||||||
auto-load
|
auto-load
|
||||||
:filter="filter"
|
:user-filter="filter"
|
||||||
url="ClientSamples"
|
url="ClientSamples"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
:pagination="{ rowsPerPage: 12 }"
|
|
||||||
:disable-option="{ card: true }"
|
:disable-option="{ card: true }"
|
||||||
:right-search="false"
|
:right-search="false"
|
||||||
:rows="rows"
|
:rows="rows"
|
||||||
|
|
|
@ -42,7 +42,11 @@ const groupedStates = ref([]);
|
||||||
auto-load
|
auto-load
|
||||||
/>
|
/>
|
||||||
<FetchData url="Warehouses" @on-fetch="(data) => (warehouses = data)" auto-load />
|
<FetchData url="Warehouses" @on-fetch="(data) => (warehouses = data)" auto-load />
|
||||||
<VnFilterPanel :data-key="props.dataKey" :search-button="true">
|
<VnFilterPanel
|
||||||
|
:data-key="props.dataKey"
|
||||||
|
:search-button="true"
|
||||||
|
:unremovableParams="['from', 'to']"
|
||||||
|
>
|
||||||
<template #tags="{ tag, formatFn }">
|
<template #tags="{ tag, formatFn }">
|
||||||
<div class="q-gutter-x-xs">
|
<div class="q-gutter-x-xs">
|
||||||
<strong>{{ t(`params.${tag.label}`) }}: </strong>
|
<strong>{{ t(`params.${tag.label}`) }}: </strong>
|
||||||
|
|
|
@ -68,7 +68,7 @@ const arrayData = useArrayData('ZoneEvents');
|
||||||
const exclusionGeoCreate = async () => {
|
const exclusionGeoCreate = async () => {
|
||||||
const params = {
|
const params = {
|
||||||
zoneFk: parseInt(route.params.id),
|
zoneFk: parseInt(route.params.id),
|
||||||
date: dated,
|
date: dated.value,
|
||||||
geoIds: tickedNodes.value,
|
geoIds: tickedNodes.value,
|
||||||
};
|
};
|
||||||
await axios.post('Zones/exclusionGeo', params);
|
await axios.post('Zones/exclusionGeo', params);
|
||||||
|
@ -101,9 +101,17 @@ const exclusionCreate = async () => {
|
||||||
const existsEvent = data.events.find(
|
const existsEvent = data.events.find(
|
||||||
(event) => toDateFormat(event.dated) === toDateFormat(dated.value),
|
(event) => toDateFormat(event.dated) === toDateFormat(dated.value),
|
||||||
);
|
);
|
||||||
|
const existsGeoEvent = data.geoExclusions.find(
|
||||||
|
(event) => toDateFormat(event.dated) === toDateFormat(dated.value),
|
||||||
|
);
|
||||||
if (existsEvent) {
|
if (existsEvent) {
|
||||||
await axios.delete(`Zones/${existsEvent?.zoneFk}/events/${existsEvent?.id}`);
|
await axios.delete(`Zones/${existsEvent?.zoneFk}/events/${existsEvent?.id}`);
|
||||||
}
|
}
|
||||||
|
if (existsGeoEvent) {
|
||||||
|
await axios.delete(
|
||||||
|
`Zones/${existsGeoEvent?.zoneFk}/exclusions/${existsGeoEvent?.zoneExclusionFk}`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (isNew.value || props.event?.type) await axios.post(`${url}`, [body]);
|
if (isNew.value || props.event?.type) await axios.post(`${url}`, [body]);
|
||||||
else await axios.put(`${url}/${props.event?.id}`, body);
|
else await axios.put(`${url}/${props.event?.id}`, body);
|
||||||
|
|
|
@ -56,6 +56,7 @@ const isNew = computed(() => props.isNewMode);
|
||||||
const eventInclusionFormData = ref({ wdays: [] });
|
const eventInclusionFormData = ref({ wdays: [] });
|
||||||
const dated = ref(props.date || Date.vnNew());
|
const dated = ref(props.date || Date.vnNew());
|
||||||
const _inclusionType = ref('indefinitely');
|
const _inclusionType = ref('indefinitely');
|
||||||
|
const hasDeletedEvent = ref(false);
|
||||||
const inclusionType = computed({
|
const inclusionType = computed({
|
||||||
get: () => _inclusionType.value,
|
get: () => _inclusionType.value,
|
||||||
set: (val) => {
|
set: (val) => {
|
||||||
|
@ -84,7 +85,7 @@ 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 zoneId of zoneIds) {
|
||||||
let today = eventInclusionFormData.value.dated
|
let today = eventInclusionFormData.value.dated
|
||||||
? moment(eventInclusionFormData.value.dated)
|
? moment(eventInclusionFormData.value.dated)
|
||||||
: moment(dated.value);
|
: moment(dated.value);
|
||||||
|
@ -92,7 +93,7 @@ const createEvent = async () => {
|
||||||
|
|
||||||
const { data } = await axios.get(`Zones/getEventsFiltered`, {
|
const { data } = await axios.get(`Zones/getEventsFiltered`, {
|
||||||
params: {
|
params: {
|
||||||
zoneFk: id,
|
zoneFk: zoneId,
|
||||||
started: today,
|
started: today,
|
||||||
ended: lastDay,
|
ended: lastDay,
|
||||||
},
|
},
|
||||||
|
@ -106,15 +107,19 @@ const createEvent = async () => {
|
||||||
await axios.delete(
|
await axios.delete(
|
||||||
`Zones/${existsExclusion?.zoneFk}/exclusions/${existsExclusion?.id}`,
|
`Zones/${existsExclusion?.zoneFk}/exclusions/${existsExclusion?.id}`,
|
||||||
);
|
);
|
||||||
|
await refetchEvents();
|
||||||
|
hasDeletedEvent.value = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isNew.value)
|
delete eventInclusionFormData.value.id;
|
||||||
await axios.post(`Zones/${id}/events`, eventInclusionFormData.value);
|
if (isNew.value || hasDeletedEvent.value)
|
||||||
|
await axios.post(`Zones/${zoneId}/events`, eventInclusionFormData.value);
|
||||||
else
|
else
|
||||||
await axios.put(
|
await axios.put(
|
||||||
`Zones/${id}/events/${props.event?.id}`,
|
`Zones/${zoneId}/events/${props.event?.id}`,
|
||||||
eventInclusionFormData.value,
|
eventInclusionFormData.value,
|
||||||
);
|
);
|
||||||
|
hasDeletedEvent.value = false;
|
||||||
}
|
}
|
||||||
quasar.notify({
|
quasar.notify({
|
||||||
message: t('globals.dataSaved'),
|
message: t('globals.dataSaved'),
|
||||||
|
|
Loading…
Reference in New Issue