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

@ -32,6 +32,8 @@ const prop = defineProps<{
isDebitNote?: boolean;
}>();
const firstCodePayment = defineModel<string>('firstCodePayment');
const refQFile = ref<InstanceType<typeof QFile>[]>([]);
const refQMenu = ref<InstanceType<typeof QMenu>[]>([]);
const paymentData = ref<QuotationPaymentData[]>([]);
@ -206,10 +208,15 @@ onMounted(async () => {
});
if (ret) {
paymentData.value = ret.result;
slipFile.value = paymentData.value.map((v) => ({
paymentId: v.id,
data: [],
}));
slipFile.value = paymentData.value.map((v, i) => {
if (i === 0) {
firstCodePayment.value = v.code;
}
return {
paymentId: v.id,
data: [],
};
});
}
});
</script>

View file

@ -196,7 +196,7 @@ const selectedWorkerItem = computed(() => {
];
});
const workerList = ref<Employee[]>([]);
const firstCodePayment = ref('');
const selectedProductGroup = ref('');
const selectedInstallmentNo = ref<number[]>([]);
const installmentAmount = ref<number>(0);
@ -1093,12 +1093,14 @@ watch(
// }
function storeDataLocal() {
quotationFormData.value.productServiceList = productServiceList.value;
quotationFormData.value.productServiceList = productService.value;
localStorage.setItem(
'quotation-preview',
JSON.stringify({
data: {
codeInvoice: code.value,
codePayment: firstCodePayment.value,
...quotationFormData.value,
productServiceList: productService.value,
},
@ -1939,6 +1941,7 @@ function covertToNode() {
view !== View.Complete
"
:data="quotationFormState.source"
v-model:first-code-payment="firstCodePayment"
@fetch-status="
() => {
fetchQuotation();
@ -2105,6 +2108,8 @@ function covertToNode() {
installmentAmount = props.row.amount;
view = View.Invoice;
console.log(code);
}
}
"

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 || ''),