diff --git a/src/pages/05_quotation/peview/ViewForm.vue b/src/pages/05_quotation/peview/ViewForm.vue index fc1ffa89..97ee5e6c 100644 --- a/src/pages/05_quotation/peview/ViewForm.vue +++ b/src/pages/05_quotation/peview/ViewForm.vue @@ -15,7 +15,11 @@ import { commaInput } from 'stores/utils'; // NOTE Import Types import { BankBook, Branch } from 'stores/branch/types'; -import { QuotationPayload } from 'src/stores/quotations/types'; +import { + QuotationPayload, + CustomerBranchRelation, + Details, +} from 'src/stores/quotations/types'; // NOTE: Import Components import ViewHeader from './ViewHeader.vue'; @@ -49,13 +53,16 @@ type SummaryPrice = { finalPrice: number; }; +const customer = ref(); const branch = ref(); const productList = ref([]); const bankList = ref([]); const elements = ref([]); const chunks = ref([[]]); -const data = ref(); +const data = ref< + QuotationPayload & { customerBranch: CustomerBranchRelation } +>(); const summaryPrice = ref({ totalPrice: 0, @@ -102,6 +109,8 @@ function getHeight(el: HTMLElement) { return height; } +const details = ref
(); + onMounted(async () => { let str = localStorage.getItem('quotation-preview') || @@ -119,15 +128,29 @@ onMounted(async () => { data.value = 'data' in parsed ? parsed.data : undefined; + customer.value = parsed.meta.source.customerBranch; + if (data.value) { - const res = await branchStore.fetchById(data.value?.registeredBranchId); + details.value = { + code: parsed.meta.source.code, + createdAt: parsed.meta.source.createdAt, + createdBy: `${parsed.meta.createdBy} ${parsed.meta.source.createdBy.telephoneNo}`, + payCondition: parsed.meta.source.payCondition, + contactName: parsed.meta.source.contactName, + contactTel: parsed.meta.source.contactTel, + workName: parsed.meta.source.workName, + }; - if (res) { - branch.value = res; + const resBranch = await branchStore.fetchById( + data.value?.registeredBranchId, + ); - bankList.value = res.bank.map((v) => ({ + if (resBranch) { + branch.value = resBranch; + + bankList.value = resBranch.bank.map((v) => ({ ...v, - bankUrl: `${baseUrl}/branch/${res.id}/bank-qr/${v.id}?ts=${Date.now()}`, + bankUrl: `${baseUrl}/branch/${resBranch.id}/bank-qr/${v.id}?ts=${Date.now()}`, })); } @@ -200,7 +223,12 @@ function print() {
- +
- +
- + +import { dateFormat } from 'src/utils/datetime'; + // NOTE: Import stores // NOTE Import Types +import { Branch } from 'src/stores/branch/types'; +import { CustomerBranchRelation, Details } from 'src/stores/quotations/types'; // NOTE: Import Components + +defineProps<{ + branch: Branch; + customer: CustomerBranchRelation; + details: Details; +}>();