HOTFIX: #6943 CustomerList form salesPersons options #790

Closed
jsegarra wants to merge 84 commits from hotfix_newCustomer_SalesPerson into master
3 changed files with 22 additions and 15 deletions
Showing only changes of commit 007abf307c - Show all commits

View File

@ -1,10 +1,11 @@
<script setup>
import { computed, onBeforeMount, onMounted, ref } from 'vue';
import { computed, onBeforeMount, ref } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router';
import { useAcl } from 'src/composables/useAcl';
import axios from 'axios';
import { useQuasar } from 'quasar';
import { getClientRisk } from '../composables/getClientRisk';
import { toCurrency, toDate, toDateHourMin } from 'src/filters';
import { useState } from 'composables/useState';
@ -168,21 +169,17 @@ onBeforeMount(() => {
companyId.value = companyUser.value;
});
Outdated
Review

Revisar bien la funcionalidad de este archivo, se usa en otro sitio

Revisar bien la funcionalidad de este archivo, se usa en otro sitio

he creado un composable

he creado un composable
async function getClientRisk() {
const { data } = await axios.get(`clientRisks`, {
params: {
filter: JSON.stringify({
include: { relation: 'company', scope: { fields: ['code'] } },
where: { clientFk: route.params.id, companyFk: companyUser.value },
}),
},
});
async function getClientRisks() {
const filter = {
where: { clientFk: route.params.id, companyFk: companyUser.value },
};
const { data } = await getClientRisk(filter);
clientRisk.value = data;
return clientRisk.value;
}
async function getCurrentBalance() {
const currentBalance = (await getClientRisk()).find((balance) => {
const currentBalance = (await getClientRisks()).find((balance) => {
return balance.companyFk === companyId.value;
});
return currentBalance && currentBalance.amount;

View File

@ -3,7 +3,7 @@ import { onBeforeMount, reactive, ref } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router';
import axios from 'axios';
import { getClientRisk } from '../composables/getClientRisk';
import { useDialogPluginComponent } from 'quasar';
import { usePrintService } from 'composables/usePrintService';
@ -158,9 +158,7 @@ async function getAmountPaid() {
},
};
const { data } = await axios(`ClientRisks`, {
params: { filter: JSON.stringify(filter) },
});
const { data } = await getClientRisk(filter);
initialData.amountPaid = (data?.length && data[0].amount) || undefined;
}
</script>

View File

@ -0,0 +1,12 @@
import axios from 'axios';
export async function getClientRisk(_filter) {
const filter = {
..._filter,
include: { relation: 'company', scope: { fields: ['code'] } },
};
return await axios(`ClientRisks`, {
params: { filter: JSON.stringify(filter) },
});
}