feat: refs #6919 sync entry data
gitea/salix-front/pipeline/pr-dev This commit looks good Details

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
/>
<FormModel
:url="`Entries/${route.params.id}`"
:url-update="`Entries/${route.params.id}`"
model="entry"
model="Entry"
auto-load
:clear-store-on-unmount="false"
>

View File

@ -2,11 +2,56 @@
import VnCard from 'components/common/VnCard.vue';
import EntryDescriptor from './EntryDescriptor.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>
<template>
<VnCard
data-key="Entry"
base-url="Entries"
:filter="filter"
:descriptor="EntryDescriptor"
:filter-panel="EntryFilter"
search-data-key="EntryList"

View File

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