From 2b758e57f8207db279631b8b3b6f63ade4913741 Mon Sep 17 00:00:00 2001 From: Methapon Metanipat <162551568+Methapon-Frappet@users.noreply.github.com> Date: Tue, 14 Jan 2025 16:12:30 +0700 Subject: [PATCH] feat: receipt (#176) * feat: receipt #173 * chore: clean up --------- Co-authored-by: nwpptrs Co-authored-by: Methapon2001 <61303214+Methapon2001@users.noreply.github.com> --- src/i18n/eng.ts | 6 + src/i18n/tha.ts | 6 + src/layouts/DrawerComponent.vue | 3 +- src/pages/13_receipt/MainPage.vue | 379 ++++++++++++++++++++++++++ src/pages/13_receipt/TableReceipt.vue | 131 +++++++++ src/pages/13_receipt/constants.ts | 95 +++++++ src/router/routes.ts | 10 + src/stores/payment/types.ts | 11 +- 8 files changed, 638 insertions(+), 3 deletions(-) create mode 100644 src/pages/13_receipt/MainPage.vue create mode 100644 src/pages/13_receipt/TableReceipt.vue create mode 100644 src/pages/13_receipt/constants.ts diff --git a/src/i18n/eng.ts b/src/i18n/eng.ts index 2e1fc0c7..d2858d0a 100644 --- a/src/i18n/eng.ts +++ b/src/i18n/eng.ts @@ -1198,5 +1198,11 @@ export default { PaymentSuccess: 'Payment Success', PaymentWait: 'Waiting For Payment', }, + receipt: { + title: 'Receipt / Tax Invoice', + caption: 'All Receipt / Tax Invoice', + dataSum: 'Summary of all receipts/tax invoices', + workSheetName: 'Worksheet name', + }, }, }; diff --git a/src/i18n/tha.ts b/src/i18n/tha.ts index 60d6d66d..1975480e 100644 --- a/src/i18n/tha.ts +++ b/src/i18n/tha.ts @@ -1179,5 +1179,11 @@ export default { PaymentSuccess: 'ชำระเงินแล้ว', PaymentWait: 'ยังไม่ชำระ', }, + receipt: { + title: 'ใบเสร็จรับเงิน/กำกับภาษี', + caption: 'ใบเสร็จรับเงิน/กำกับภาษีทั้งหมด', + dataSum: 'สรุปใบเสร็จรับเงิน/กำกับภาษีทั้งหมด', + workSheetName: 'ชื่อใบงาน', + }, }, }; diff --git a/src/layouts/DrawerComponent.vue b/src/layouts/DrawerComponent.vue index cc80c525..bcdd4cc7 100644 --- a/src/layouts/DrawerComponent.vue +++ b/src/layouts/DrawerComponent.vue @@ -157,8 +157,7 @@ onMounted(async () => { icon: 'mdi-bank-outline', disabled: false, children: [ - { label: 'uploadSlip', route: '', disabled: true }, - { label: 'receipt', route: '', disabled: true }, + { label: 'receipt', route: '/receipt' }, { label: 'creditNote', route: '/credit-note', disabled: true }, { label: 'debitNote', route: '', disabled: true }, ], diff --git a/src/pages/13_receipt/MainPage.vue b/src/pages/13_receipt/MainPage.vue new file mode 100644 index 00000000..d851ded5 --- /dev/null +++ b/src/pages/13_receipt/MainPage.vue @@ -0,0 +1,379 @@ + + + diff --git a/src/pages/13_receipt/TableReceipt.vue b/src/pages/13_receipt/TableReceipt.vue new file mode 100644 index 00000000..09d1c64f --- /dev/null +++ b/src/pages/13_receipt/TableReceipt.vue @@ -0,0 +1,131 @@ + + + + + diff --git a/src/pages/13_receipt/constants.ts b/src/pages/13_receipt/constants.ts new file mode 100644 index 00000000..a4cb9ad6 --- /dev/null +++ b/src/pages/13_receipt/constants.ts @@ -0,0 +1,95 @@ +import { QTableProps } from 'quasar'; +import { Invoice, Receipt } from 'src/stores/payment/types'; +import { formatNumberDecimal } from 'src/stores/utils'; +import { dateFormatJS } from 'src/utils/datetime'; + +export const columns = [ + { + name: '#order', + align: 'center', + label: 'general.order', + field: (v: Receipt & { _index: number }) => v._index + 1, + }, + + { + name: 'quotation', + align: 'center', + label: 'requestList.quotationCode', + field: 'code', + }, + + { + name: 'workSheetName', + align: 'center', + label: 'receipt.workSheetName', + field: (v: Receipt) => v.invoice.quotation.workName, + }, + + { + name: 'issueDate', + align: 'center', + label: 'taskOrder.issueDate', + field: (v: Receipt) => + dateFormatJS({ + date: v.invoice.quotation.createdAt, + withTime: true, + }), + }, + + { + name: 'value', + align: 'center', + label: 'preview.value', + field: (v: Receipt) => formatNumberDecimal(v.amount, 2), + }, + { + name: '#action', + align: 'center', + label: '', + field: (_) => '#action', + }, +] as const satisfies QTableProps['columns']; + +export const docColumn = [ + { + name: 'order', + align: 'center', + label: 'general.order', + field: 'no', + }, + { + name: 'document', + align: 'left', + label: 'general.document', + field: 'document', + }, + { + name: 'attachment', + align: 'left', + label: 'requestList.attachment', + field: 'attachment', + }, + { + name: 'amount', + align: 'center', + label: 'general.amount', + field: 'amount', + }, + { + name: 'documentInSystem', + align: 'center', + label: 'requestList.documentInSystem', + field: 'documentInSystem', + }, + { + name: 'status', + align: 'center', + label: 'general.status', + field: 'status', + }, +] as const satisfies QTableProps['columns']; + +export const hslaColors: Record = { + PaymentWait: '--orange-5-hsl', + PaymentSuccess: '--green-8-hsl', +}; diff --git a/src/router/routes.ts b/src/router/routes.ts index 9830d39e..cc44863b 100644 --- a/src/router/routes.ts +++ b/src/router/routes.ts @@ -115,6 +115,11 @@ const routes: RouteRecordRaw[] = [ name: '/Invoice', component: () => import('pages/10_invoice/MainPage.vue'), }, + { + path: '/receipt', + name: 'receipt', + component: () => import('pages/13_receipt/MainPage.vue'), + }, ], }, @@ -168,6 +173,11 @@ const routes: RouteRecordRaw[] = [ name: 'CreditNoteView', component: () => import('pages/11_credit-note/FormPage.vue'), }, + { + path: '/receipt/:id', + name: 'receiptform', + component: () => import('pages/13_receipt/MainPage.vue'), + }, // Always leave this as last one, // but you can also remove it diff --git a/src/stores/payment/types.ts b/src/stores/payment/types.ts index 273bac5a..f8c73b81 100644 --- a/src/stores/payment/types.ts +++ b/src/stores/payment/types.ts @@ -44,7 +44,16 @@ export type Payment = { paymentStatus: string; date: Date; amount: number; - invoice: { id: string; amount: number; installments: { no: number }[] }; + invoice: { + id: string; + amount: number; + installments: { no: number }[]; + quotation: Quotation; + }; }; +export enum PaymentDataStatus { + Success = 'PaymentSuccess', + Wait = 'PaymentWait', +} export type Receipt = Payment;