#7134 - supplierBalance #1306

Merged
jsegarra merged 52 commits from 7134-supplierBalance into dev 2025-01-29 15:16:50 +00:00
2 changed files with 2 additions and 25 deletions
Showing only changes of commit 252dd21492 - Show all commits

View File

@ -1,23 +0,0 @@
import axios from 'axios';
const method = {
supplier: 'SupplierRisks',
customer: 'ClientRisks',
};
export async function getRisk(module, _filter) {
const filter = {
..._filter,
include: { relation: 'company', scope: { fields: ['code'] } },
};
return await axios(module, {
params: { filter: JSON.stringify(filter) },
});
}
export async function getClientRisk(_filter) {
return await getRisk(method.customer, _filter);
}
export async function getSupplierRisk(_filter) {
return await getRisk(method.supplier, _filter);
}

View File

@ -170,7 +170,7 @@ onBeforeMount(() => {
companyId.value = companyUser.value;
});
async function getRisks() {
async function getClientRisks() {
const filter = {
where: { clientFk: route.params.id, companyFk: companyUser.value },
};
@ -180,7 +180,7 @@ async function getRisks() {
}
async function getCurrentBalance() {
const currentBalance = (await getRisks()).find((balance) => {
const currentBalance = (await getClientRisks()).find((balance) => {
return balance.companyFk === companyId.value;
});
return currentBalance && currentBalance.amount;