refactor: refs #8388 reorganize variable declarations and improve DMS handling in EntryPreAccount.vue
gitea/salix-front/pipeline/pr-dev This commit is unstable
Details
gitea/salix-front/pipeline/pr-dev This commit is unstable
Details
This commit is contained in:
parent
ce8127b723
commit
dd3a7c7755
|
@ -27,8 +27,6 @@ const user = useState().getUser();
|
|||
const stateStore = useStateStore();
|
||||
const updateDialog = ref();
|
||||
const uploadDialog = ref();
|
||||
let maxDays;
|
||||
let defaultDays;
|
||||
const dataKey = 'entryPreaccountingFilter';
|
||||
const url = 'Entries/preAccountingFilter';
|
||||
const arrayData = useArrayData(dataKey);
|
||||
|
@ -45,12 +43,16 @@ const defaultDmsDescription = ref();
|
|||
const dmsTypeId = ref();
|
||||
const selectedRows = ref([]);
|
||||
const totalAmount = ref();
|
||||
const hasDiferentDms = ref(false);
|
||||
let maxDays;
|
||||
let defaultDays;
|
||||
let supplierRef;
|
||||
let dmsFk;
|
||||
const totalSelectedAmount = computed(() => {
|
||||
if (!selectedRows.value.length) return 0;
|
||||
return selectedRows.value.reduce((acc, entry) => acc + entry.amount, 0);
|
||||
});
|
||||
let supplierRef;
|
||||
let dmsFk;
|
||||
|
||||
const columns = computed(() => [
|
||||
{
|
||||
name: 'id',
|
||||
|
@ -238,8 +240,14 @@ function filterByDaysAgo(val) {
|
|||
async function preAccount() {
|
||||
const entries = selectedRows.value;
|
||||
const { companyFk, isAgricultural, landed } = entries.at(0);
|
||||
supplierRef = null;
|
||||
dmsFk = undefined;
|
||||
hasDiferentDms.value = false;
|
||||
try {
|
||||
dmsFk = entries.find(({ gestDocFk }) => gestDocFk)?.gestDocFk;
|
||||
entries.forEach(({ gestDocFk }) => {
|
||||
if (!dmsFk) dmsFk = gestDocFk;
|
||||
if (gestDocFk && dmsFk && dmsFk !== gestDocFk) hasDiferentDms.value = true;
|
||||
});
|
||||
if (isAgricultural) {
|
||||
const year = new Date(landed).getFullYear();
|
||||
supplierRef = (
|
||||
|
@ -296,8 +304,6 @@ async function createInvoice() {
|
|||
} catch (e) {
|
||||
throw e;
|
||||
} finally {
|
||||
supplierRef = null;
|
||||
dmsFk = undefined;
|
||||
selectedRows.value.length = 0;
|
||||
table.value.reload();
|
||||
}
|
||||
|
@ -358,6 +364,7 @@ async function createInvoice() {
|
|||
:search-remove-params="false"
|
||||
/>
|
||||
<VnTable
|
||||
v-if="isBooked !== undefined && daysAgo !== undefined"
|
||||
v-model:selected="selectedRows"
|
||||
:data-key
|
||||
:columns
|
||||
|
@ -376,7 +383,6 @@ async function createInvoice() {
|
|||
@on-fetch="
|
||||
(data) => (totalAmount = data?.reduce((acc, entry) => acc + entry.amount, 0))
|
||||
"
|
||||
auto-load
|
||||
>
|
||||
<template #top-left>
|
||||
<QBtn
|
||||
|
@ -436,6 +442,11 @@ async function createInvoice() {
|
|||
:title="t('entry.preAccount.dialog.title')"
|
||||
:message="t('entry.preAccount.dialog.message')"
|
||||
>
|
||||
<template #customHTML v-if="hasDiferentDms">
|
||||
<p class="text-negative">
|
||||
{{ t('differentGestdoc') }}
|
||||
</p>
|
||||
</template>
|
||||
<template #actions>
|
||||
<QBtn
|
||||
data-cy="updateFileYes"
|
||||
|
@ -470,9 +481,11 @@ en:
|
|||
IntraCommunity: Intra-community
|
||||
NonCommunity: Non-community
|
||||
CanaryIslands: Canary Islands
|
||||
differentGestdoc: The entries have different gestdoc
|
||||
es:
|
||||
IntraCommunity: Intracomunitaria
|
||||
NonCommunity: Extracomunitaria
|
||||
CanaryIslands: Islas Canarias
|
||||
National: Nacional
|
||||
differentGestdoc: Las entradas tienen diferentes gestdoc
|
||||
</i18n>
|
||||
|
|
Loading…
Reference in New Issue