refactor: use session storage instead

This commit is contained in:
Methapon Metanipat 2024-10-21 11:13:34 +07:00
parent d165d3bb81
commit 425fd71d2c
2 changed files with 66 additions and 49 deletions

View file

@ -187,21 +187,18 @@ function triggerQuotationDialog(opts: {
branchId?: string;
}) {
const url = new URL('/quotation/add-quotation', window.location.origin);
url.searchParams.set(
'branchId',
opts.branchId !== undefined ? opts.branchId : branchId.value,
);
url.searchParams.set(
'customerBranchId',
quotationFormData.value.customerBranchId,
);
url.searchParams.set('agentPrice', agentPrice.value.toString());
url.searchParams.set('special', special.value.toString());
url.searchParams.set('statusDialog', opts.statusDialog);
if (opts.quotationId !== undefined) {
url.searchParams.set('quotationId', opts.quotationId);
}
localStorage.setItem(
'new-quotation',
JSON.stringify({
customerBranchId: quotationFormData.value.customerBranchId,
branchId: opts.branchId ?? branchId.value,
agentPrice: agentPrice.value,
special: special.value,
statusDialog: opts.statusDialog,
quotationId: opts.quotationId,
}),
);
window.open(url.toString(), '_blank');
}