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

This commit is contained in:
Jorge Penadés 2024-11-18 17:30:23 +01:00
parent 96e9d1a00a
commit 96e7bf78c5
4 changed files with 40 additions and 48 deletions

View File

@ -16,9 +16,8 @@ const companySizes = [
</script> </script>
<template> <template>
<FormModel <FormModel
:url="`Suppliers/${route.params.id}`"
:url-update="`Suppliers/${route.params.id}`" :url-update="`Suppliers/${route.params.id}`"
model="supplier" model="Supplier"
auto-load auto-load
:clear-store-on-unmount="false" :clear-store-on-unmount="false"
> >

View File

@ -2,11 +2,13 @@
import VnCard from 'components/common/VnCard.vue'; import VnCard from 'components/common/VnCard.vue';
import SupplierDescriptor from './SupplierDescriptor.vue'; import SupplierDescriptor from './SupplierDescriptor.vue';
import SupplierListFilter from '../SupplierListFilter.vue'; import SupplierListFilter from '../SupplierListFilter.vue';
import filter from './SupplierFilter.js';
</script> </script>
<template> <template>
<VnCard <VnCard
data-key="Supplier" data-key="Supplier"
url="Suppliers" url="Suppliers"
:filter="filter"
:descriptor="SupplierDescriptor" :descriptor="SupplierDescriptor"
:filter-panel="SupplierListFilter" :filter-panel="SupplierListFilter"
search-data-key="SupplierList" search-data-key="SupplierList"

View File

@ -7,9 +7,9 @@ import CardDescriptor from 'components/ui/CardDescriptor.vue';
import VnLv from 'src/components/ui/VnLv.vue'; import VnLv from 'src/components/ui/VnLv.vue';
import { toDateString } from 'src/filters'; import { toDateString } from 'src/filters';
import useCardDescription from 'src/composables/useCardDescription';
import { getUrl } from 'src/composables/getUrl'; import { getUrl } from 'src/composables/getUrl';
import { useState } from 'src/composables/useState'; import { useState } from 'src/composables/useState';
import filter from './SupplierFilter.js';
const $props = defineProps({ const $props = defineProps({
id: { id: {
@ -28,42 +28,6 @@ const { t } = useI18n();
const url = ref(); const url = ref();
const state = useState(); const state = useState();
const filter = {
fields: [
'id',
'name',
'nickname',
'nif',
'payMethodFk',
'payDemFk',
'payDay',
'isActive',
'isSerious',
'isTrucker',
'account',
],
include: [
{
relation: 'payMethod',
scope: {
fields: ['id', 'name'],
},
},
{
relation: 'payDem',
scope: {
fields: ['id', 'payDem'],
},
},
{
relation: 'client',
scope: {
fields: ['id', 'fi'],
},
},
],
};
onMounted(async () => { onMounted(async () => {
url.value = await getUrl(''); url.value = await getUrl('');
}); });
@ -72,11 +36,6 @@ const entityId = computed(() => {
return $props.id || route.params.id; return $props.id || route.params.id;
}); });
const data = ref(useCardDescription());
const setData = (entity) => {
data.value = useCardDescription(entity.ref, entity.id);
};
const supplier = computed(() => state.get('supplier')); const supplier = computed(() => state.get('supplier'));
const getEntryQueryParams = (supplier) => { const getEntryQueryParams = (supplier) => {
@ -105,11 +64,8 @@ const getEntryQueryParams = (supplier) => {
<CardDescriptor <CardDescriptor
module="Supplier" module="Supplier"
:url="`Suppliers/${entityId}`" :url="`Suppliers/${entityId}`"
:title="data.title"
:subtitle="data.subtitle"
:filter="filter" :filter="filter"
@on-fetch="setData" data-key="Supplier"
data-key="supplierDescriptor"
:summary="$props.summary" :summary="$props.summary"
> >
<template #body="{ entity }"> <template #body="{ entity }">

View File

@ -0,0 +1,35 @@
export default {
fields: [
'id',
'name',
'nickname',
'nif',
'payMethodFk',
'payDemFk',
'payDay',
'isActive',
'isSerious',
'isTrucker',
'account',
],
include: [
{
relation: 'payMethod',
scope: {
fields: ['id', 'name'],
},
},
{
relation: 'payDem',
scope: {
fields: ['id', 'payDem'],
},
},
{
relation: 'client',
scope: {
fields: ['id', 'fi'],
},
},
],
};