fix: installment force push
Some checks failed
Spell Check / Spell Check with Typos (push) Failing after 8s

This commit is contained in:
Thanaphon Frappet 2025-03-06 11:14:11 +07:00
parent e6f2a8df4e
commit 87de5b48ac
6 changed files with 52 additions and 17 deletions

View file

@ -86,10 +86,22 @@ const summaryPrice = ref<SummaryPrice>({
finalPrice: 0,
});
async function fetchQuotationById(id: string) {
async function fetchQuotationById(id: string, codeInvoice: string) {
const res = await quotationStore.getQuotation(id);
if (res) {
const installmentNo = res.paySplit.find(
(v) => codeInvoice === v.invoice?.code,
)?.no;
if (res) data.value = res;
data.value = {
...res,
productServiceList: !!installmentNo
? res.productServiceList.filter(
(v) => installmentNo === v.installmentNo,
)
: res.productServiceList,
};
}
}
async function getAttachment(quotationId: string) {
@ -190,7 +202,8 @@ onMounted(async () => {
if (data.value) {
if (!!data.value.id) {
await getAttachment(data.value.id);
await fetchQuotationById(data.value.id);
if (parsed.data.fetch)
await fetchQuotationById(data.value.id, parsed.data.codeInvoice);
}
const resCustomerBranch = await customerStore.getBranchById(
@ -203,8 +216,15 @@ onMounted(async () => {
agentPrice.value = data.value.agentPrice || parsed?.meta?.agentPrice;
const currentCode =
view.value === View.Invoice
? parsed.data.codeInvoice
: view.value === View.Payment
? parsed.data.codePayment
: (parsed?.meta?.source?.code ?? data.value?.code);
details.value = {
code: parsed?.meta?.source?.code ?? data.value?.code,
code: currentCode,
createdAt:
parsed?.meta?.source?.createdAt ??
new Date(data.value?.createdAt || ''),