0
0
Fork 0

Fix feedback

This commit is contained in:
Kevin Martinez 2024-02-02 08:33:37 -03:00
parent 4cf9548234
commit ea9a9323e7
2 changed files with 11 additions and 3 deletions

View File

@ -1,7 +1,7 @@
<script setup> <script setup>
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { ref } from 'vue'; import { ref } from 'vue';
import { useRoute } from 'vue-router'; import { useRoute, useRouter } from 'vue-router';
import VnRow from 'components/ui/VnRow.vue'; import VnRow from 'components/ui/VnRow.vue';
import FetchData from 'components/FetchData.vue'; import FetchData from 'components/FetchData.vue';
import FormModel from 'components/FormModel.vue'; import FormModel from 'components/FormModel.vue';
@ -10,11 +10,12 @@ import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
const { t } = useI18n(); const { t } = useI18n();
const route = useRoute(); const route = useRoute();
const router = useRouter();
const shelvingId = route.params?.id || null; const shelvingId = route.params?.id || null;
const isNew = Boolean(!shelvingId); const isNew = Boolean(!shelvingId);
const defaultInitialData = { const defaultInitialData = {
parkingFk: null, parkingFk: null,
priority: 0, priority: null,
code: null, code: null,
isRecyclable: false, isRecyclable: false,
}; };
@ -58,6 +59,12 @@ const shelvingFilter = {
{ relation: 'parking' }, { relation: 'parking' },
], ],
}; };
const onSave = () => {
if (isNew) {
router.push({ name: 'ShelvingList' });
}
};
</script> </script>
<template> <template>
<VnSubToolbar /> <VnSubToolbar />
@ -75,6 +82,7 @@ const shelvingFilter = {
model="shelving" model="shelving"
:auto-load="!isNew" :auto-load="!isNew"
:form-initial-data="defaultInitialData" :form-initial-data="defaultInitialData"
@on-data-saved="onSave"
> >
<template #form="{ data, validate, filter }"> <template #form="{ data, validate, filter }">
<VnRow class="row q-gutter-md q-mb-md"> <VnRow class="row q-gutter-md q-mb-md">

View File

@ -9,7 +9,7 @@ const { t } = useI18n();
data-key="ShelvingList" data-key="ShelvingList"
url="Shelvings" url="Shelvings"
:label="t('Search shelving')" :label="t('Search shelving')"
:info="t('You can search by search reference')" :info="t('You can search by shelving reference')"
/> />
</template> </template>