feat: add additional info to preview

This commit is contained in:
Methapon Metanipat 2024-10-18 12:32:55 +07:00
parent 5a8e17f236
commit 859c6b7961
3 changed files with 16 additions and 4 deletions

View file

@ -281,7 +281,12 @@ async function storeDataLocal(id: string) {
localStorage.setItem(
'quotation-preview',
JSON.stringify(quotationFormData.value),
JSON.stringify({
data: quotationFormData.value,
meta: {
createdBy: quotationFormState.value.createdBy('tha'),
},
}),
);
window.open('/quotation/document-view', '_blank');

View file

@ -619,7 +619,12 @@ async function searchEmployee(text: string) {
function storeDataLocal() {
localStorage.setItem(
'quotation-preview',
JSON.stringify(quotationFormData.value),
JSON.stringify({
data: quotationFormData.value,
meta: {
createdBy: quotationFormState.value.createdBy('tha'),
},
}),
);
window.open('/quotation/document-view', '_blank');

View file

@ -115,7 +115,9 @@ onMounted(async () => {
delete localStorage['quotation-preview'];
data.value = JSON.parse(sessionStorage.getItem('quotation-preview') || '{}');
const parsed = JSON.parse(sessionStorage.getItem('quotation-preview') || '');
data.value = 'data' in parsed ? parsed.data : undefined;
if (data.value) {
const res = await branchStore.fetchById(data.value?.registeredBranchId);
@ -149,7 +151,7 @@ onMounted(async () => {
})) || [];
}
summaryPrice.value = obj.productServiceList.reduce(
summaryPrice.value = (data.value?.productServiceList || []).reduce(
(a, c) => {
const price = precisionRound((c.pricePerUnit || 0) * c.amount);
const vat = precisionRound(