From 74e50fc67c3f7f71b65ec740d84203e880458dad Mon Sep 17 00:00:00 2001 From: Thanaphon Frappet Date: Mon, 24 Feb 2025 10:55:00 +0700 Subject: [PATCH 01/23] refactor: edit label --- src/i18n/tha.ts | 2 +- src/pages/05_quotation/QuotationFormWorkerSelect.vue | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/i18n/tha.ts b/src/i18n/tha.ts index 139b2070..e6a6bd30 100644 --- a/src/i18n/tha.ts +++ b/src/i18n/tha.ts @@ -761,7 +761,7 @@ export default { branch: 'สาขาที่ออกใบเสนอราคา', branchVirtual: 'จุดรับบริการที่ออกใบเสนอราคา', customer: 'ลูกค้า', - newCustomer: 'ลูกค้าใหม่', + newCustomer: 'แรงงานใหม่', employeeList: 'รายชื่อแรงงาน', employee: 'แรงงาน', employeeName: 'ชื่อ-นามสกุล แรงงาน', diff --git a/src/pages/05_quotation/QuotationFormWorkerSelect.vue b/src/pages/05_quotation/QuotationFormWorkerSelect.vue index 90c1cc41..9520092a 100644 --- a/src/pages/05_quotation/QuotationFormWorkerSelect.vue +++ b/src/pages/05_quotation/QuotationFormWorkerSelect.vue @@ -445,7 +445,7 @@ watch(() => state.search, getWorkerList); class="text-weight-medium q-mr-md" style="font-size: 18px" > - {{ $t('quotation.customer') }} + {{ $t('quotation.employee') }} From d70e98d7c82ae649ed53fe385268616a2c520a4a Mon Sep 17 00:00:00 2001 From: puriphatt Date: Mon, 24 Feb 2025 11:15:33 +0700 Subject: [PATCH 02/23] refactor: i18n => update credit and debit note approval messages in translations --- src/i18n/eng.ts | 4 +++- src/i18n/tha.ts | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/i18n/eng.ts b/src/i18n/eng.ts index 7a9cf43c..0dd77ec4 100644 --- a/src/i18n/eng.ts +++ b/src/i18n/eng.ts @@ -1241,7 +1241,8 @@ export default { 'The customer returned all or part of the goods because they did not meet their requirements.', reasonCanceled: 'The customer canceled certain items or services listed on the invoice.', - submit: 'Approve the credit note', + request: 'Request Credit Note Approval', + submit: 'Approve Credit Note', refund: 'Refund', refundMethod: 'Refund Method', totalRefund: 'Total refund amount', @@ -1303,6 +1304,7 @@ export default { quotationWorkName: 'Work Name', quotationPayment: 'Payment Method', value: 'Net Value', + request: 'Request Debit Note Approval', submit: 'Approve Debit Note', }, diff --git a/src/i18n/tha.ts b/src/i18n/tha.ts index e6a6bd30..f9c3b3a6 100644 --- a/src/i18n/tha.ts +++ b/src/i18n/tha.ts @@ -1224,6 +1224,7 @@ export default { 'ลูกค้าคืนสินค้าทั้งหมดหรือบางส่วน เนื่องจากสินค้าไม่ตรงตามความต้องการ', reasonCanceled: 'ลูกค้ายกเลิกคำสั่งซื้อบางรายการหรือบริการที่ระบุในใบแจ้งหนี้', + request: 'ขออนุมัติใบลดหนี้', submit: 'อนุมัติใบลดหนี้', refund: 'การคืนเงิน', refundMethod: 'วิธีการคืนเงิน', @@ -1285,6 +1286,7 @@ export default { quotationWorkName: 'ชื่อใบงาน', quotationPayment: 'วิธีการชำระ', value: 'มูลค่าสุทธิ', + request: 'ขออนุมัติใบเพิ่มหนี้', submit: 'อนุมัติใบเพิ่มหนี้', }, From 18022fcfb707a0c3f2b3577de7aa73575d478c1e Mon Sep 17 00:00:00 2001 From: Thanaphon Frappet Date: Mon, 24 Feb 2025 11:26:22 +0700 Subject: [PATCH 03/23] refactor: move field quotation code --- src/pages/09_task-order/TableEmployee.vue | 23 +++++++++++++---------- src/pages/09_task-order/constants.ts | 12 ++++++------ 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/src/pages/09_task-order/TableEmployee.vue b/src/pages/09_task-order/TableEmployee.vue index 33e685bf..ea78c7d4 100644 --- a/src/pages/09_task-order/TableEmployee.vue +++ b/src/pages/09_task-order/TableEmployee.vue @@ -232,14 +232,14 @@ function disableCheckAll() { :columns=" stepOn ? [ - ...employeeColumn.slice(0, 2), + ...employeeColumn.slice(0, 3), { name: 'periodNo', align: 'center', label: 'flow.step', field: (v) => v.product.code, }, - ...employeeColumn.slice(2), + ...employeeColumn.slice(3), ] : statusOn ? [ @@ -463,6 +463,16 @@ function disableCheckAll() { {{ props.row.request.code }} + + + + {{ props.row.request.quotation?.code }} + + +
{{ props.row._template.templateName }} @@ -528,14 +538,7 @@ function disableCheckAll() { :expiration-date="new Date(props.row.request.quotation?.dueDate)" /> - - - {{ props.row.request.quotation?.code }} - - + Date: Mon, 24 Feb 2025 11:59:09 +0700 Subject: [PATCH 04/23] feat: i18n debit note accept msg --- src/i18n/eng.ts | 3 +++ src/i18n/tha.ts | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/i18n/eng.ts b/src/i18n/eng.ts index 0dd77ec4..6146106a 100644 --- a/src/i18n/eng.ts +++ b/src/i18n/eng.ts @@ -779,6 +779,7 @@ export default { specialCondition: 'Special Conditions', selectInvoice: 'Select Invoice', approveInvoice: 'Approve the invoice', + approveDebitNote: 'Approve Debit Note', paymentCondition: 'Payment Terms', payType: 'Payment Methods', bank: 'Select Payment Account', @@ -1022,6 +1023,7 @@ export default { importWorker: 'Import Worker', confirmLogout: 'Confirm Logout', confirmQuotationAccept: 'Confirm acceptance of the quotation.', + confirmDebitNoteAccept: 'Confirm acceptance of the debit note.', }, message: { quotationAccept: 'Once accepted, no further modifications can be made', @@ -1317,6 +1319,7 @@ export default { }, viewMode: { + accepted: 'Accept', payment: 'Payment', receipt: 'Receipt/Tax Invoice', processComplete: 'Completed', diff --git a/src/i18n/tha.ts b/src/i18n/tha.ts index f9c3b3a6..0cd09c4a 100644 --- a/src/i18n/tha.ts +++ b/src/i18n/tha.ts @@ -1,5 +1,3 @@ -import { title } from 'process'; - export default { general: { ok: 'ตกลง', @@ -772,6 +770,7 @@ export default { specialCondition: 'เงื่อนไขพิเศษ', selectInvoice: 'เลือกใบแจ้งหนี้', approveInvoice: 'อนุมัติใบแจ้งหนี้', + approveDebitNote: 'อนุมัติใบเพิ่มหนี้', customerAcceptance: 'ลูกค้าตอบรับ', additionalFile: 'ไฟล์เอกสารเพิ่มเติม', @@ -1010,6 +1009,7 @@ export default { importWorker: 'นำเข้าคนงาน', confirmLogout: 'ยืนยันการออกจากระบบ', confirmQuotationAccept: 'ยืนยันการตอบรับใบเสนอราคา', + confirmDebitNoteAccept: 'ยืนยันการตอบรับใบเพิ่มหนี้', }, message: { quotationAccept: 'เมื่อตอบรับเเล้วจะไม่สามารถแก้ไขได้อีก', @@ -1299,6 +1299,7 @@ export default { }, viewMode: { + accepted: 'ตอบรับ', payment: 'ชำระเงิน', receipt: 'ใบเสร็จรับเงิน/ใบกำกับภาษี', processComplete: 'เสร็จสิ้น', From 644dca2bf7b60f44e7c9c87f8244cc75a707d74c Mon Sep 17 00:00:00 2001 From: Thanaphon Frappet Date: Mon, 24 Feb 2025 12:00:28 +0700 Subject: [PATCH 05/23] refactor: show field code --- src/i18n/eng.ts | 2 ++ src/i18n/tha.ts | 1 + src/pages/08_request-list/RequestListView.vue | 17 ++++++++++++++++- src/stores/request-list/types.ts | 7 ++++++- 4 files changed, 25 insertions(+), 2 deletions(-) diff --git a/src/i18n/eng.ts b/src/i18n/eng.ts index 6146106a..10188913 100644 --- a/src/i18n/eng.ts +++ b/src/i18n/eng.ts @@ -898,6 +898,8 @@ export default { caption: 'All Request List', quotationCode: 'Quotation Code', requestListCode: 'Request List Code', + + referenceNo: 'Reference No.', invoiceCode: 'Invoice Code', receiptCode: 'Receipt Code', alienIdCard: 'Alien Identification Card"', diff --git a/src/i18n/tha.ts b/src/i18n/tha.ts index 0cd09c4a..01b8b16d 100644 --- a/src/i18n/tha.ts +++ b/src/i18n/tha.ts @@ -889,6 +889,7 @@ export default { caption: 'ใบรายการคำขอทั้งหมด', quotationCode: 'เลขที่ใบเสนอราคา', requestListCode: 'เลขที่ใบรายการคำขอ', + referenceNo: 'เลขที่ใบอ้างอิง', invoiceCode: 'เลขที่ใบแจ้งหนี้', receiptCode: 'เลขที่ใบเสร็จ/กำกับภาษี', alienIdCard: 'บัตรประจำตัวต่างด้าว', diff --git a/src/pages/08_request-list/RequestListView.vue b/src/pages/08_request-list/RequestListView.vue index 574e8244..116ae387 100644 --- a/src/pages/08_request-list/RequestListView.vue +++ b/src/pages/08_request-list/RequestListView.vue @@ -314,7 +314,7 @@ function goToQuotation( customerBranchId: quotation.customerBranchId, agentPrice: quotation.agentPrice, statusDialog: 'info', - quotationId: quotation.id, + quotationId: opt && opt.id ? opt.id : quotation.id, }), ); @@ -565,6 +565,21 @@ function goToDebitNote(opt?: { tab?: string; id?: string }) { : goToQuotation(data.quotation, { tab: 'receipt' }) " /> + + +
diff --git a/src/stores/request-list/types.ts b/src/stores/request-list/types.ts index bca8637d..124a8c99 100644 --- a/src/stores/request-list/types.ts +++ b/src/stores/request-list/types.ts @@ -9,7 +9,12 @@ export type RequestData = { createdAt: string; updatedAt: string; - quotation: QuotationFull & { isDebitNote: boolean }; + quotation: QuotationFull & { + debitNoteQuotationId: string; + isDebitNote: boolean; + debitNoteQuotation: { code: string }; + }; + quotationId: string; flow: Record; From ab5d85d8148039825ed9e9eeb1d20643afc21a6d Mon Sep 17 00:00:00 2001 From: Thanaphon Frappet Date: Mon, 24 Feb 2025 12:03:13 +0700 Subject: [PATCH 06/23] fix: new worker duplicate name --- src/pages/12_debit-note/FormPage.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pages/12_debit-note/FormPage.vue b/src/pages/12_debit-note/FormPage.vue index 838401cc..973aa1a3 100644 --- a/src/pages/12_debit-note/FormPage.vue +++ b/src/pages/12_debit-note/FormPage.vue @@ -778,6 +778,7 @@ async function submit() { : await debitNote.createDebitNote(payload); if (res) { + newWorkerList.value = []; await router.push(`/debit-note/${res.id}/?mode=info`); if (attachmentList.value && pageState.mode === 'create') { From 44aed63677e91a7e5fd699d992bb483981ff5fb4 Mon Sep 17 00:00:00 2001 From: Methapon2001 <61303214+Methapon2001@users.noreply.github.com> Date: Mon, 24 Feb 2025 13:06:32 +0700 Subject: [PATCH 07/23] feat: add accepted function --- src/pages/12_debit-note/FormPage.vue | 127 +++++++++++++++++++-------- 1 file changed, 88 insertions(+), 39 deletions(-) diff --git a/src/pages/12_debit-note/FormPage.vue b/src/pages/12_debit-note/FormPage.vue index 973aa1a3..d6d96a65 100644 --- a/src/pages/12_debit-note/FormPage.vue +++ b/src/pages/12_debit-note/FormPage.vue @@ -44,7 +44,7 @@ import { import { RequestWork } from 'src/stores/request-list/types'; import { storeToRefs } from 'pinia'; import useOptionStore from 'src/stores/options'; -import { deleteItem, dialogWarningClose } from 'src/stores/utils'; +import { deleteItem, dialog, dialogWarningClose } from 'src/stores/utils'; import { useI18n } from 'vue-i18n'; import { Employee } from 'src/stores/employee/types'; import QuotationFormWorkerSelect from '../05_quotation/QuotationFormWorkerSelect.vue'; @@ -101,7 +101,7 @@ const productGroup = ref([]); const agentPrice = ref(false); const debitNoteData = ref(); const quotationData = ref(); -const view = ref(null); +const view = ref(QuotationStatus.Issued); const fileList = ref(); const receiptList = ref([]); @@ -258,6 +258,7 @@ const selectedInstallmentNo = ref([]); const installmentAmount = ref(0); const QUOTATION_STATUS = [ + 'Accepted', 'PaymentPending', 'PaymentSuccess', 'ProcessComplete', @@ -419,16 +420,23 @@ async function initStatus() { { title: 'title', status: debitNoteData.value?.id !== undefined ? 'done' : 'doing', - active: () => view.value === null, - handler: () => { - view.value = null; - }, + active: () => view.value === QuotationStatus.Issued, + handler: () => (view.value = QuotationStatus.Issued), + }, + { + title: 'accepted', + status: + debitNoteData.value?.id !== undefined + ? getStatus(debitNoteData.value.quotationStatus, 1, -1) + : 'waiting', + active: () => view.value === QuotationStatus.Accepted, + handler: () => (view.value = QuotationStatus.Accepted), }, { title: 'payment', status: debitNoteData.value?.id !== undefined - ? getStatus(debitNoteData.value.quotationStatus, 1, -1) + ? getStatus(debitNoteData.value.quotationStatus, 2, 1) : 'waiting', active: () => view.value === QuotationStatus.PaymentPending, handler: async () => { @@ -438,7 +446,7 @@ async function initStatus() { { title: 'receipt', - status: getStatus(debitNoteData.value?.quotationStatus, 1, 1), + status: getStatus(debitNoteData.value?.quotationStatus, 2, 2), active: () => view.value === QuotationStatus.PaymentSuccess, handler: () => { view.value = QuotationStatus.PaymentSuccess; @@ -447,7 +455,7 @@ async function initStatus() { { title: 'processComplete', - status: getStatus(debitNoteData.value?.quotationStatus, 2, 1), + status: getStatus(debitNoteData.value?.quotationStatus, 3, 2), active: () => view.value === QuotationStatus.ProcessComplete, handler: () => { view.value = QuotationStatus.ProcessComplete; @@ -786,7 +794,6 @@ async function submit() { } pageState.mode = 'info'; - assignFormData(res.id); initStatus(); @@ -877,7 +884,8 @@ onMounted(async () => { } if (typeof route.query['mode'] === 'string') { - pageState.mode = route.query['mode'] as 'create' | 'edit' | 'info'; + pageState.mode = + (route.query['mode'] as 'create' | 'edit' | 'info') || 'info'; } if (typeof route.query['tab'] === 'string') { @@ -885,11 +893,34 @@ onMounted(async () => { { payment: QuotationStatus.PaymentPending, receipt: QuotationStatus.PaymentSuccess, - }[route.query['tab']] || null; + }[route.query['tab']] || QuotationStatus.Issued; } await useConfigStore().getConfig(); }); + +async function submitAccepted() { + dialog({ + color: 'info', + icon: 'mdi-account-check', + title: t('dialog.title.confirmDebitNoteAccept'), + actionText: t('general.confirm'), + persistent: true, + message: t('dialog.message.quotationAccept'), + action: async () => { + if (!currentFormData.value.id) return; + + const res = await debitNote.action.acceptDebitNote( + currentFormData.value.id, + ); + + if (res && typeof route.params['id'] === 'string') { + await assignFormData(route.params['id']); + } + }, + cancel: () => {}, + }); +}