From ea9e0995231e442b21122a2810ca54b088ed21af Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Tue, 21 Jan 2025 14:53:48 +0100 Subject: [PATCH] perf: refs #7134 currencies fetch --- src/pages/Supplier/Card/SupplierBalance.vue | 24 +++++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/src/pages/Supplier/Card/SupplierBalance.vue b/src/pages/Supplier/Card/SupplierBalance.vue index 784c37c07..65420ee9d 100644 --- a/src/pages/Supplier/Card/SupplierBalance.vue +++ b/src/pages/Supplier/Card/SupplierBalance.vue @@ -12,6 +12,7 @@ import VnTable from 'src/components/VnTable/VnTable.vue'; import InvoiceInDescriptorProxy from 'src/pages/InvoiceIn/Card/InvoiceInDescriptorProxy.vue'; import SupplierBalanceFilter from './SupplierBalanceFilter.vue'; import { onMounted } from 'vue'; +import FetchData from 'src/components/FetchData.vue'; const { t } = useI18n(); @@ -24,13 +25,10 @@ const tableRef = ref(); const companyId = ref(); const companyUser = ref(user.value.companyFk); const balances = ref([]); -const userParams = computed(() => { - return { - supplierId: route.params.id, - companyId: companyId.value ?? companyUser.value, - isBooked: false, - currencyFk: 1, // EUR - }; +const userParams = ref({ + supplierId: route.params.id, + companyId: companyId.value ?? companyUser.value, + isBooked: false, }); const columns = computed(() => [ @@ -114,13 +112,25 @@ async function onFetch(data) { function round(value) { return Math.round(value * 100) / 100; } +const onFetchCurrencies = (data) => { + const eur = data.find((currency) => currency.code === 'EUR'); + userParams.value.currencyFk = eur?.id; +};