feat: refs #8277 changes

This commit is contained in:
Jorge Penadés 2025-03-28 12:14:16 +01:00
parent 1117d3d07a
commit 61a9676c32
2 changed files with 20 additions and 1 deletions
src
pages/Entry
router/modules

View File

@ -16,11 +16,15 @@ import VnConfirm from 'src/components/ui/VnConfirm.vue';
import VnDms from 'src/components/common/VnDms.vue';
import { useState } from 'src/composables/useState';
import { useQuasar } from 'quasar';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
import InvoiceInDescriptorProxy from '../InvoiceIn/Card/InvoiceInDescriptorProxy.vue';
import { useStateStore } from 'src/stores/useStateStore';
const { t } = useI18n();
const quasar = useQuasar();
const { notify } = useNotify();
const user = useState().getUser();
const stateStore = useStateStore();
const dialog = ref();
const dmsDialog = ref();
const MAXDAYS = 365;
@ -181,6 +185,7 @@ const columns = computed(() => [
name: 'isAgricultural',
label: t('entry.control.isAgricultural'),
component: 'checkbox',
isEditable: false,
},
{
name: 'isBooked',
@ -191,6 +196,7 @@ const columns = computed(() => [
name: 'received',
label: t('entry.control.received'),
component: 'checkbox',
isEditable: false,
},
// {
// name: 'travelFk',
@ -214,9 +220,12 @@ const columns = computed(() => [
onBeforeMount(() => {
daysAgo.value = arrayData.store.userParams.daysAgo || DEFAULTDAYS;
isBooked.value = arrayData.store.userParams.isBooked || false;
stateStore.leftDrawer = false;
});
watch(selectedRows, (nVal, oVal) => {
const lastRow = nVal.at(-1);
if (lastRow?.isBooked) selectedRows.value.pop();
if (nVal.length > oVal.length && nVal.at(-1).invoiceInFk)
quasar.dialog({
component: VnConfirm,
@ -310,6 +319,7 @@ async function createInvoice(isAgricultural) {
table.value.reload();
supplierRef = null;
selectedGestDoc = null;
selectedRows.value.length = 0;
}
}
</script>
@ -351,12 +361,14 @@ async function createInvoice(isAgricultural) {
:info="t('entry.control.searchInfo')"
:search-remove-params="false"
/>
<VnSubToolbar />
<VnTable
v-model:selected="selectedRows"
:data-key
:columns
:url
:search-url="dataKey"
save-url="Entries/crud"
ref="table"
:disable-option="{ card: true }"
redirect="Entry"
@ -368,7 +380,7 @@ async function createInvoice(isAgricultural) {
:limit="0"
:footer="true"
@on-fetch="
(data) => (totalAmount = data.reduce((acc, entry) => acc + entry.amount, 0))
(data) => (totalAmount = data?.reduce((acc, entry) => acc + entry.amount, 0))
"
>
<template #top-left>
@ -405,6 +417,12 @@ async function createInvoice(isAgricultural) {
<SupplierDescriptorProxy :id="row.supplierFk" />
</span>
</template>
<template #column-invoiceInFk="{ row }">
<span class="link" @click.stop>
{{ row.invoiceInFk }}
<InvoiceInDescriptorProxy :id="row.invoiceInFk" />
</span>
</template>
<template #column-footer-amount>
<div v-text="toCurrency(totalSelectedAmount)" />
<div v-text="toCurrency(totalAmount)" />

View File

@ -95,6 +95,7 @@ export default {
name: 'EntryMain',
path: '',
component: () => import('src/components/common/VnModule.vue'),
props: (route) => ({ leftDrawer: route.name !== 'EntryControl' }),
redirect: { name: 'EntryIndexMain' },
children: [
{