0
0
Fork 0

feat: refs #6919 sync entry data

This commit is contained in:
Jorge Penadés 2024-11-12 11:08:45 +01:00
parent cc12250109
commit efd66ea02a
3 changed files with 50 additions and 60 deletions

View File

@ -44,9 +44,8 @@ const onFilterTravelSelected = (formData, id) => {
auto-load auto-load
/> />
<FormModel <FormModel
:url="`Entries/${route.params.id}`"
:url-update="`Entries/${route.params.id}`" :url-update="`Entries/${route.params.id}`"
model="entry" model="Entry"
auto-load auto-load
:clear-store-on-unmount="false" :clear-store-on-unmount="false"
> >

View File

@ -2,11 +2,56 @@
import VnCard from 'components/common/VnCard.vue'; import VnCard from 'components/common/VnCard.vue';
import EntryDescriptor from './EntryDescriptor.vue'; import EntryDescriptor from './EntryDescriptor.vue';
import EntryFilter from '../EntryFilter.vue'; import EntryFilter from '../EntryFilter.vue';
const filter = {
include: [
{
relation: 'travel',
scope: {
fields: [
'id',
'landed',
'shipped',
'agencyModeFk',
'warehouseOutFk',
'daysInForward',
],
include: [
{
relation: 'agency',
scope: {
fields: ['name'],
},
},
{
relation: 'warehouseOut',
scope: {
fields: ['name'],
},
},
{
relation: 'warehouseIn',
scope: {
fields: ['name'],
},
},
],
},
},
{
relation: 'supplier',
scope: {
fields: ['id', 'nickname'],
},
},
],
};
</script> </script>
<template> <template>
<VnCard <VnCard
data-key="Entry" data-key="Entry"
base-url="Entries" base-url="Entries"
:filter="filter"
:descriptor="EntryDescriptor" :descriptor="EntryDescriptor"
:filter-panel="EntryFilter" :filter-panel="EntryFilter"
search-data-key="EntryList" search-data-key="EntryList"

View File

@ -1,11 +1,10 @@
<script setup> <script setup>
import { ref, computed, watch, onMounted } from 'vue'; import { ref, computed, onMounted } from 'vue';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import CardDescriptor from 'components/ui/CardDescriptor.vue'; import CardDescriptor from 'components/ui/CardDescriptor.vue';
import VnLv from 'src/components/ui/VnLv.vue'; import VnLv from 'src/components/ui/VnLv.vue';
import useCardDescription from 'src/composables/useCardDescription';
import { toDate } from 'src/filters'; import { toDate } from 'src/filters';
import { usePrintService } from 'composables/usePrintService'; import { usePrintService } from 'composables/usePrintService';
@ -25,50 +24,6 @@ const { openReport } = usePrintService();
const entryDescriptorRef = ref(null); const entryDescriptorRef = ref(null);
const url = ref(); const url = ref();
const entryFilter = {
include: [
{
relation: 'travel',
scope: {
fields: [
'id',
'landed',
'shipped',
'agencyModeFk',
'warehouseOutFk',
'daysInForward',
],
include: [
{
relation: 'agency',
scope: {
fields: ['name'],
},
},
{
relation: 'warehouseOut',
scope: {
fields: ['name'],
},
},
{
relation: 'warehouseIn',
scope: {
fields: ['name'],
},
},
],
},
},
{
relation: 'supplier',
scope: {
fields: ['id', 'nickname'],
},
},
],
};
const entityId = computed(() => { const entityId = computed(() => {
return $props.id || route.params.id; return $props.id || route.params.id;
}); });
@ -76,10 +31,6 @@ onMounted(async () => {
url.value = await getUrl(''); url.value = await getUrl('');
}); });
const data = ref(useCardDescription());
const setData = (entity) =>
(data.value = useCardDescription(entity.supplier?.nickname, entity.id));
const getEntryRedirectionFilter = (entry) => { const getEntryRedirectionFilter = (entry) => {
let entryTravel = entry && entry.travel; let entryTravel = entry && entry.travel;
@ -104,8 +55,6 @@ const getEntryRedirectionFilter = (entry) => {
const showEntryReport = () => { const showEntryReport = () => {
openReport(`Entries/${route.params.id}/entry-order-pdf`); openReport(`Entries/${route.params.id}/entry-order-pdf`);
}; };
watch;
</script> </script>
<template> <template>
@ -113,11 +62,8 @@ watch;
ref="entryDescriptorRef" ref="entryDescriptorRef"
module="Entry" module="Entry"
:url="`Entries/${entityId}`" :url="`Entries/${entityId}`"
:filter="entryFilter" title="supplier.nickname"
:title="data.title" data-key="Entry"
:subtitle="data.subtitle"
@on-fetch="setData"
data-key="entry"
> >
<template #menu="{ entity }"> <template #menu="{ entity }">
<QItem v-ripple clickable @click="showEntryReport(entity)"> <QItem v-ripple clickable @click="showEntryReport(entity)">
@ -165,7 +111,7 @@ watch;
<template #actions="{ entity }"> <template #actions="{ entity }">
<QCardActions> <QCardActions>
<QBtn <QBtn
:to="`/supplier/${entity.supplier.id}`" :to="`/supplier/${entity.supplier?.id}`"
size="md" size="md"
icon="vn:supplier" icon="vn:supplier"
color="primary" color="primary"