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

View File

@ -2,11 +2,13 @@
import VnCard from 'components/common/VnCard.vue';
import SupplierDescriptor from './SupplierDescriptor.vue';
import SupplierListFilter from '../SupplierListFilter.vue';
import filter from './SupplierFilter.js';
</script>
<template>
<VnCard
data-key="Supplier"
url="Suppliers"
:filter="filter"
:descriptor="SupplierDescriptor"
:filter-panel="SupplierListFilter"
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 { toDateString } from 'src/filters';
import useCardDescription from 'src/composables/useCardDescription';
import { getUrl } from 'src/composables/getUrl';
import { useState } from 'src/composables/useState';
import filter from './SupplierFilter.js';
const $props = defineProps({
id: {
@ -28,42 +28,6 @@ const { t } = useI18n();
const url = ref();
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 () => {
url.value = await getUrl('');
});
@ -72,11 +36,6 @@ const entityId = computed(() => {
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 getEntryQueryParams = (supplier) => {
@ -105,11 +64,8 @@ const getEntryQueryParams = (supplier) => {
<CardDescriptor
module="Supplier"
:url="`Suppliers/${entityId}`"
:title="data.title"
:subtitle="data.subtitle"
:filter="filter"
@on-fetch="setData"
data-key="supplierDescriptor"
data-key="Supplier"
:summary="$props.summary"
>
<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'],
},
},
],
};