From 0986200910cce31b9f56d13275a7e5b419138970 Mon Sep 17 00:00:00 2001 From: Net <162551325+ThanaphonFrappet@users.noreply.github.com> Date: Thu, 31 Oct 2024 10:00:35 +0700 Subject: [PATCH] feat: adjust payment page (#31) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: add installment no label * feat: update types * refactor: add i18n * refactor: view receipt * refactor: add type * refactor: add dateFormatTh * fixup! refactor: add i18n * fixup! refactor: add dateFormatTh * refactor: use dateFormatJS in monthDisplay * refactor: handle year th-TH * ลบ log * refactor: handle color view mod --- src/pages/05_quotation/PaymentForm.vue | 172 ++++++++++--------- src/pages/05_quotation/QuotationForm.vue | 43 ++++- src/pages/05_quotation/QuotationFormInfo.vue | 8 +- src/pages/05_quotation/constants.ts | 2 +- src/pages/05_quotation/form.ts | 3 +- src/stores/payment/types.ts | 4 +- src/stores/quotations/index.ts | 6 + src/stores/quotations/types.ts | 12 +- src/utils/datetime.ts | 43 ++++- 9 files changed, 201 insertions(+), 92 deletions(-) diff --git a/src/pages/05_quotation/PaymentForm.vue b/src/pages/05_quotation/PaymentForm.vue index 47ed2a6c..e8251077 100644 --- a/src/pages/05_quotation/PaymentForm.vue +++ b/src/pages/05_quotation/PaymentForm.vue @@ -3,6 +3,8 @@ import { baseUrl } from 'stores/utils'; import { storeToRefs } from 'pinia'; import { useConfigStore } from 'stores/config'; import { formatNumberDecimal } from 'stores/utils'; +import { MainButton } from 'components/button'; + import { reactive, ref } from 'vue'; import { useQuotationPayment } from 'src/stores/quotations'; import { @@ -11,7 +13,7 @@ import { QuotationFull, QuotationPaymentData, } from 'src/stores/quotations/types'; -import { dateFormat } from 'src/utils/datetime'; +import { dateFormatJS } from 'src/utils/datetime'; import { QFile, QMenu } from 'quasar'; import UploadFileCard from 'src/components/upload-file/UploadFileCard.vue'; import { onMounted } from 'vue'; @@ -60,10 +62,12 @@ const state = reactive({ payExpansion: [] as boolean[], }); +defineEmits<{ + (e: 'view', id: string): void; +}>(); + function monthDisplay(date: Date | string) { - const arr = dateFormat(date, true).split(' '); - arr.shift(); - return arr.join(' '); + return dateFormatJS({ date, monthStyle: 'long', locale: 'th-Th' }); } function pickFile(index: number) { @@ -463,83 +467,97 @@ onMounted(async () => { class="row full-width items-center surface-2 bordered-b q-px-md q-py-sm" > - {{ $t('quotation.receiptDialog.allInstallments') }} - {{ monthDisplay(p.date) }} - - {{ $t('quotation.receiptDialog.paymentDueDate') }} - {{ - data.payCondition !== 'BillFull' - ? dateFormat(p.date, true) - : dateFormat(data.payBillDate) - }} - + {{ $t('quotation.periodNo') }} {{ i + 1 }} + {{ monthDisplay(p.createdAt) }} + + + + + + + + + + + + - - - - {{ $t(`quotation.receiptDialog.${p.paymentStatus}`) }} - - - + - - + + + +
{{ $t('quotation.receiptDialog.amountToBePaid') }} diff --git a/src/pages/05_quotation/QuotationForm.vue b/src/pages/05_quotation/QuotationForm.vue index bb4d1f9a..54ca5ab4 100644 --- a/src/pages/05_quotation/QuotationForm.vue +++ b/src/pages/05_quotation/QuotationForm.vue @@ -845,6 +845,7 @@ function storeDataLocal() { 3: 'invoice', 4: 'payment', 6: 'receipt', + 7: 'receipt', }; const documentType = documentTypes[view.value] || ''; @@ -1221,6 +1222,7 @@ const view = ref(View.Quotation);