refactor: refs #8388 compute totalAmount dynamically from arrayData
gitea/salix-front/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Jorge Penadés 2025-05-13 16:37:44 +02:00
parent 07f58bbec0
commit 2d0cb72774
1 changed files with 6 additions and 5 deletions

View File

@ -53,12 +53,16 @@ const warehouses = ref([]);
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 totalAmount = computed(() => {
return arrayData.store.data.totalAmount ?? 0;
});
const totalSelectedAmount = computed(() => {
if (!selectedRows.value.length) return 0;
return selectedRows.value.reduce((acc, entry) => acc + entry.amount, 0);
@ -397,13 +401,10 @@ async function createInvoice() {
:user-params="{ daysAgo, isBooked }"
:row-click="false"
:table="{ selection: 'multiple' }"
:limit="0"
:footer="true"
@on-fetch="
(data) => (totalAmount = data?.reduce((acc, entry) => acc + entry.amount, 0))
"
:selection-fn="(rows) => rows.filter((row) => !row.isBooked)"
auto-load
key-data="preAccounting"
>
<template #top-left>
<QBtn