From 34eeb20ea6f4ddc201e278918985b90ee7b22e88 Mon Sep 17 00:00:00 2001 From: Thanaphon Frappet Date: Mon, 21 Oct 2024 12:03:19 +0700 Subject: [PATCH 001/899] refactor: get customerBranch by id --- src/pages/05_quotation/peview/ViewForm.vue | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/pages/05_quotation/peview/ViewForm.vue b/src/pages/05_quotation/peview/ViewForm.vue index e3ec346c..8534a494 100644 --- a/src/pages/05_quotation/peview/ViewForm.vue +++ b/src/pages/05_quotation/peview/ViewForm.vue @@ -11,9 +11,11 @@ import { useQuotationForm } from 'pages/05_quotation/form'; import { useConfigStore } from 'stores/config'; import useBranchStore from 'stores/branch'; import { baseUrl } from 'stores/utils'; +import useCustomerStore from 'stores/customer'; import { commaInput } from 'stores/utils'; // NOTE Import Types +import { CustomerBranch } from 'stores/customer/types'; import { BankBook, Branch } from 'stores/branch/types'; import { QuotationPayload, @@ -31,6 +33,7 @@ const quotationForm = useQuotationForm(); const optionStore = useOptionStore(); const configStore = useConfigStore(); const branchStore = useBranchStore(); +const customerStore = useCustomerStore(); const { data: config } = storeToRefs(configStore); @@ -53,7 +56,7 @@ type SummaryPrice = { finalPrice: number; }; -const customer = ref(); +const customer = ref(); const branch = ref(); const productList = ref([]); const bankList = ref([]); @@ -128,9 +131,15 @@ onMounted(async () => { data.value = 'data' in parsed ? parsed.data : undefined; - customer.value = parsed.meta.source.customerBranch; - if (data.value) { + const resCustomerBranch = await customerStore.getBranchById( + data.value.customerBranchId, + ); + + if (resCustomerBranch) { + customer.value = resCustomerBranch; + } + details.value = { code: parsed.meta.source.code, createdAt: parsed.meta.source.createdAt, From 55a6a8b4e93197271000877a54386d3a55be1164 Mon Sep 17 00:00:00 2001 From: Thanaphon Frappet Date: Mon, 21 Oct 2024 12:04:00 +0700 Subject: [PATCH 002/899] refactor: handle telephoneNo --- src/pages/05_quotation/peview/ViewForm.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/05_quotation/peview/ViewForm.vue b/src/pages/05_quotation/peview/ViewForm.vue index 8534a494..d8120b26 100644 --- a/src/pages/05_quotation/peview/ViewForm.vue +++ b/src/pages/05_quotation/peview/ViewForm.vue @@ -143,7 +143,7 @@ onMounted(async () => { details.value = { code: parsed.meta.source.code, createdAt: parsed.meta.source.createdAt, - createdBy: `${parsed.meta.createdBy} ${parsed.meta.source.createdBy.telephoneNo}`, + createdBy: `${parsed.meta.createdBy} ${!parsed.meta.source.createdBy ? '' : parsed.meta.source.createdBy.telephoneNo}`, payCondition: parsed.meta.source.payCondition, contactName: parsed.meta.source.contactName, contactTel: parsed.meta.source.contactTel, From c5aa7e94a115e08752edee2353bac6570065aec7 Mon Sep 17 00:00:00 2001 From: Thanaphon Frappet Date: Mon, 21 Oct 2024 12:04:25 +0700 Subject: [PATCH 003/899] refactor: handle show moo --- src/pages/05_quotation/peview/ViewHeader.vue | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/pages/05_quotation/peview/ViewHeader.vue b/src/pages/05_quotation/peview/ViewHeader.vue index 00700947..21e0e2b8 100644 --- a/src/pages/05_quotation/peview/ViewHeader.vue +++ b/src/pages/05_quotation/peview/ViewHeader.vue @@ -33,10 +33,11 @@ defineProps<{
บริษัท {{ branch.name }} - หมู่.{{ branch.moo }} ต.{{ branch.subDistrict?.name }} อ.{{ - branch.district?.name + {{ !branch.moo ? '' : `หมู่.${branch.moo}` }} ต.{{ + branch.subDistrict?.name }} - จ.{{ branch.province?.name }} {{ branch.subDistrict?.zipCode }} + อ.{{ branch.district?.name }} จ.{{ branch.province?.name }} + {{ branch.subDistrict?.zipCode }} เลขประจำตัวผู้เสียภาษี {{ branch.taxNo }} เบอร์โทร {{ branch.telephoneNo }} From 226da5ccfe6d0e0d35a3ac004420356d80d0006d Mon Sep 17 00:00:00 2001 From: Thanaphon Frappet Date: Mon, 21 Oct 2024 12:05:49 +0700 Subject: [PATCH 004/899] refactor: assign after submit --- src/pages/05_quotation/form.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/pages/05_quotation/form.ts b/src/pages/05_quotation/form.ts index 479e30b1..889a9eac 100644 --- a/src/pages/05_quotation/form.ts +++ b/src/pages/05_quotation/form.ts @@ -143,10 +143,12 @@ export const useQuotationForm = defineStore('form-quotation', () => { } async function submitQuotation() { + let status = false; if (currentFormState.value.mode === 'create') { const res = await quotationStore.createQuotation(currentFormData.value); if (res !== null) { + currentFormData.value.id = res.id; fileItemNewWorker.value.forEach(async (v) => { if (v.group === undefined) return; await employeeStore.postMeta({ @@ -156,7 +158,7 @@ export const useQuotationForm = defineStore('form-quotation', () => { file: v.file, }); }); - return true; + status = true; } } if (currentFormState.value.mode === 'edit' && currentFormData.value.id) { @@ -169,11 +171,16 @@ export const useQuotationForm = defineStore('form-quotation', () => { id: currentFormData.value.id, }); - if (res) return true; + if (res) status = true; } currentFormState.value.mode = 'info'; + + if (currentFormData.value.id !== undefined) { + assignFormData(currentFormData.value.id, 'info'); + } currentFormState.value.createdBy = (_) => getName() || ''; + return status; } function injectNewEmployee( From 53c7764f06584d6a454f5f33f9a67e77f5d3ff7f Mon Sep 17 00:00:00 2001 From: Thanaphon Frappet Date: Mon, 21 Oct 2024 12:06:50 +0700 Subject: [PATCH 005/899] refactor: format value before peview --- src/pages/05_quotation/QuotationForm.vue | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/pages/05_quotation/QuotationForm.vue b/src/pages/05_quotation/QuotationForm.vue index 5b9bde0d..cc44ee05 100644 --- a/src/pages/05_quotation/QuotationForm.vue +++ b/src/pages/05_quotation/QuotationForm.vue @@ -653,12 +653,29 @@ async function searchEmployee(text: string) { } function storeDataLocal() { + quotationFormData.value.productServiceList = productServiceList.value; + localStorage.setItem( 'quotation-preview', JSON.stringify({ data: quotationFormData.value, meta: { - source: quotationFormState.value.source, + source: { + ...quotationFormState.value.source, + code: + quotationFormState.value.mode === 'create' + ? '-' + : quotationFormState.value?.source?.code, + createAt: + quotationFormState.value.mode === 'create' + ? Date.now() + : quotationFormState.value?.source?.createdAt, + createBy: quotationFormState.value?.source?.createdBy, + payCondition: quotationFormData.value.payCondition, + contactName: quotationFormData.value.contactName, + contactTel: quotationFormData.value.contactTel, + workName: quotationFormData.value.workName, + }, createdBy: quotationFormState.value.createdBy('tha'), }, }), From 7f6e0ee97019a7ceccef4f12e607be14f96f6004 Mon Sep 17 00:00:00 2001 From: Thanaphon Frappet Date: Mon, 21 Oct 2024 12:23:11 +0700 Subject: [PATCH 006/899] refactor: add id --- src/pages/04_product-service/MainPage.vue | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pages/04_product-service/MainPage.vue b/src/pages/04_product-service/MainPage.vue index 74ec5849..c33b1d80 100644 --- a/src/pages/04_product-service/MainPage.vue +++ b/src/pages/04_product-service/MainPage.vue @@ -509,7 +509,6 @@ const onCreateImageList = ref<{ }>({ selectedImage: '', list: [] }); async function searchProduct(isAdd: boolean = true) { - console.log('spd'); const res = await fetchListProduct({ query: inputSearchWorkProduct.value, }); @@ -3823,6 +3822,7 @@ watch( }} Date: Mon, 21 Oct 2024 13:25:14 +0700 Subject: [PATCH 007/899] fix: i18n --- src/i18n/tha/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/i18n/tha/index.ts b/src/i18n/tha/index.ts index 4a8a2658..5bcebf50 100644 --- a/src/i18n/tha/index.ts +++ b/src/i18n/tha/index.ts @@ -65,7 +65,7 @@ export default { licenseNumber: 'เลขที่ใบอนุญาต', dateOfIssue: 'วันที่อนุญาต', expirationDate: 'วันที่หมดอายุ', - document: 'ชื่อเอกสาร', + document: 'เอกสาร', uploadDate: 'วันที่อัปโหลด', information: 'ข้อมูล{msg}', itemNo: 'เลขที่{msg}', From e7c932ed9f24f66f1882a6853f317a0bad8ad91b Mon Sep 17 00:00:00 2001 From: Thanaphon Frappet Date: Mon, 21 Oct 2024 13:33:36 +0700 Subject: [PATCH 008/899] refactor: add query --- src/stores/quotations/index.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/stores/quotations/index.ts b/src/stores/quotations/index.ts index 4237501f..168f52e2 100644 --- a/src/stores/quotations/index.ts +++ b/src/stores/quotations/index.ts @@ -44,6 +44,7 @@ export const useQuotationStore = defineStore('quotation-store', () => { page?: number; pageSize?: number; payCondition?: 'Full' | 'Split' | 'BillFull' | 'BillSplit'; + query?: string; }) { const params = new URLSearchParams(); for (const [k, v] of Object.entries(opts || {})) { From 6df13d034e37bdee671572a9fdb1e0ae87185fa1 Mon Sep 17 00:00:00 2001 From: Thanaphon Frappet Date: Mon, 21 Oct 2024 13:34:12 +0700 Subject: [PATCH 009/899] refactor: search quotation --- src/pages/05_quotation/MainPage.vue | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/pages/05_quotation/MainPage.vue b/src/pages/05_quotation/MainPage.vue index 0ae2a3bc..2c0d8b9f 100644 --- a/src/pages/05_quotation/MainPage.vue +++ b/src/pages/05_quotation/MainPage.vue @@ -256,6 +256,7 @@ async function fetchQuotationList() { } as const )[pageState.currentTab] : undefined, + query: pageState.inputSearch, }); if (ret) { @@ -275,6 +276,7 @@ async function fetchQuotationList() { } watch(() => pageState.currentTab, fetchQuotationList); +watch(() => pageState.inputSearch, fetchQuotationList); async function storeDataLocal(id: string) { await quotationFormStore.assignFormData(id, 'assign'); From 8d87368a7cc7fe82deb0057bb96faa0151e295c6 Mon Sep 17 00:00:00 2001 From: puriphatt Date: Mon, 21 Oct 2024 13:51:18 +0700 Subject: [PATCH 010/899] fix: receipt dialog --- src/pages/05_quotation/ReceiptDialog.vue | 113 ++++++++++++++++++----- src/stores/quotations/index.ts | 58 +++++++++++- 2 files changed, 149 insertions(+), 22 deletions(-) diff --git a/src/pages/05_quotation/ReceiptDialog.vue b/src/pages/05_quotation/ReceiptDialog.vue index c1451245..5edc3764 100644 --- a/src/pages/05_quotation/ReceiptDialog.vue +++ b/src/pages/05_quotation/ReceiptDialog.vue @@ -1,12 +1,13 @@ + + + + -
-
- -
- - {{ $t('quotation.summary') }} - -
-
-
- {{ $t('general.total') }} - - {{ formatNumberDecimal(summaryPrice.totalPrice, 2) }} - ฿ +
+
+
+ +
+ + {{ $t('quotation.summary') }}
-
- {{ $t('quotation.discountList') }} - - {{ formatNumberDecimal(summaryPrice.totalDiscount, 2) || 0 }} ฿ - -
-
- {{ $t('general.totalAfterDiscount') }} - +
+
+ {{ $t('general.total') }} + + {{ formatNumberDecimal(summaryPrice.totalPrice, 2) }} + ฿ + +
+
+ {{ $t('quotation.discountList') }} + + {{ formatNumberDecimal(summaryPrice.totalDiscount, 2) || 0 }} ฿ + +
+
+ {{ $t('general.totalAfterDiscount') }} + + {{ + formatNumberDecimal( + summaryPrice.totalPrice - summaryPrice.totalDiscount, + 2, + ) + }} + ฿ + +
+
+ {{ $t('general.totalVatExcluded') }} + + {{ formatNumberDecimal(summaryPrice.vatExcluded, 2) || 0 }} + ฿ + +
+
{{ - formatNumberDecimal( - summaryPrice.totalPrice - summaryPrice.totalDiscount, - 2, - ) + $t('general.vat', { + msg: `${config && Math.round(config.vat * 100)}%`, + }) + }} + + {{ formatNumberDecimal(summaryPrice.vat, 2) }} ฿ + +
+
+ {{ $t('general.totalVatIncluded') }} + + {{ + formatNumberDecimal( + summaryPrice.totalPrice - + summaryPrice.totalDiscount + + summaryPrice.vat, + 2, + ) + }} + ฿ + +
+
+ {{ $t('general.discountAfterVat') }} + + +
+
+
+ {{ $t('quotation.totalPriceBaht') }} + + + {{ + formatNumberDecimal(Math.max(summaryPrice.finalPrice, 0), 2) || 0 }} ฿
-
- {{ $t('general.totalVatExcluded') }} - - {{ formatNumberDecimal(summaryPrice.vatExcluded, 2) || 0 }} - ฿ - -
-
- {{ - $t('general.vat', { - msg: `${config && Math.round(config.vat * 100)}%`, - }) - }} - - {{ formatNumberDecimal(summaryPrice.vat, 2) }} ฿ - -
-
- {{ $t('general.totalVatIncluded') }} - - {{ - formatNumberDecimal( - summaryPrice.totalPrice - - summaryPrice.totalDiscount + - summaryPrice.vat, - 2, - ) - }} - ฿ - -
-
- {{ $t('general.discountAfterVat') }} - - -
-
-
- {{ $t('quotation.totalPriceBaht') }} - - - {{ formatNumberDecimal(Math.max(summaryPrice.finalPrice, 0), 2) || 0 }} - ฿ -
@@ -648,9 +481,13 @@ watch( .bg-color-orange-light { --_color: var(--yellow-7-hsl); - background: hsla(var(--_color) / 0.2); + background: hsla(var(--_color) / 0.1); } .dark .bg-color-orange { --_color: var(--orange-6-hsl / 0.2); } + +.price-container > * { + padding: var(--size-2); +} diff --git a/src/pages/05_quotation/QuotationFormMetadata.vue b/src/pages/05_quotation/QuotationFormMetadata.vue new file mode 100644 index 00000000..21e43ce9 --- /dev/null +++ b/src/pages/05_quotation/QuotationFormMetadata.vue @@ -0,0 +1,95 @@ + + + diff --git a/src/pages/05_quotation/form.ts b/src/pages/05_quotation/form.ts index 889a9eac..92809a2c 100644 --- a/src/pages/05_quotation/form.ts +++ b/src/pages/05_quotation/form.ts @@ -71,10 +71,12 @@ export const useQuotationForm = defineStore('form-quotation', () => { const currentFormState = ref<{ mode: null | 'info' | 'create' | 'edit'; source?: QuotationFull; + createdAt: string | Date; createdBy: (locale: string) => string; }>({ mode: null, createdBy: (_) => getName() || '', + createdAt: '', }); function isFormDataDifferent() { @@ -137,6 +139,8 @@ export const useQuotationForm = defineStore('form-quotation', () => { ? data.createdBy.firstNameEN + ' ' + data.createdBy.lastNameEN : data.createdBy.firstName + ' ' + data.createdBy.lastName; + currentFormState.value.createdAt = data.createdAt; + if (mode === 'assign') return; currentFormState.value.mode = mode; From c16732dd1ab9cf56bcf7e68e6cd589150a62e26c Mon Sep 17 00:00:00 2001 From: Methapon Metanipat Date: Mon, 21 Oct 2024 15:08:47 +0700 Subject: [PATCH 016/899] fix(quotation-preview): discount not show --- src/pages/05_quotation/peview/ViewForm.vue | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/pages/05_quotation/peview/ViewForm.vue b/src/pages/05_quotation/peview/ViewForm.vue index d8120b26..bfd72ae7 100644 --- a/src/pages/05_quotation/peview/ViewForm.vue +++ b/src/pages/05_quotation/peview/ViewForm.vue @@ -347,6 +347,13 @@ function print() { {{ formatNumberDecimal(summaryPrice.vat, 2) }} ฿ + + {{ $t('general.discountAfterVat') }} + + {{ formatNumberDecimal(data?.discount || 0, 2) }} + ฿ + + From 00a04edd1d9707fdf3d1c07464f9f287c1dff276 Mon Sep 17 00:00:00 2001 From: Thanaphon Frappet Date: Mon, 21 Oct 2024 15:14:11 +0700 Subject: [PATCH 017/899] refactor: add type Payment --- src/stores/quotations/types.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/stores/quotations/types.ts b/src/stores/quotations/types.ts index 92b3af32..d05b35fe 100644 --- a/src/stores/quotations/types.ts +++ b/src/stores/quotations/types.ts @@ -364,3 +364,10 @@ export type Details = { contactTel: string; workName: string; }; + +export type PaymentPayload = { + paymentStatus: string; + remark: string; + date: Date; + amount: number; +}; From 5774dfcf5cbd39cf029411c67a4013eb7106dc75 Mon Sep 17 00:00:00 2001 From: Thanaphon Frappet Date: Mon, 21 Oct 2024 15:17:27 +0700 Subject: [PATCH 018/899] refactor: create payment file --- src/stores/quotations/index.ts | 86 ++++++++++++---------------------- src/stores/utils/index.ts | 22 +++++++-- 2 files changed, 47 insertions(+), 61 deletions(-) diff --git a/src/stores/quotations/index.ts b/src/stores/quotations/index.ts index f17dc4de..e4718017 100644 --- a/src/stores/quotations/index.ts +++ b/src/stores/quotations/index.ts @@ -9,11 +9,15 @@ import { QuotationPayload, QuotationPaymentData, QuotationStats, + PaymentPayload, } from './types'; import { PaginationResult } from 'src/types'; -import { AxiosInstance } from 'axios'; +import { AxiosInstance, AxiosProgressEvent } from 'axios'; + +import { baseUrl, manageAttachment } from '../utils'; export const useQuotationStore = defineStore('quotation-store', () => { + const base = ref(''); const data = ref([]); const page = ref(1); const pageMax = ref(1); @@ -129,61 +133,6 @@ export const useQuotationStore = defineStore('quotation-store', () => { }; }); -function managePaymentFile(api: AxiosInstance) { - return { - listFile: async (opts: { quotationId: string; paymentId: string }) => { - const res = await api.get(`/${base}/${opts.quotationId}/file`); - if (res.status >= 400) return false; - return res.data; - }, - getFile: async (opts: { - group: T; - parentId: string; - fileId: string; - download?: boolean; - }) => { - const url = `/${base}/${opts.parentId}/file-${opts.group}/${opts.fileId}`; - const res = await api.get(url); - if (opts.download) { - fetch(res.data) - .then(async (res) => await res.blob()) - .then((blob) => { - const a = document.createElement('a'); - a.download = opts.fileId; - a.href = window.URL.createObjectURL(blob); - a.click(); - a.remove(); - }); - } - return res.data; - }, - putFile: async (opts: { - group: T; - parentId: string; - fileId: string; - file: File; - }) => { - const res = await api.put( - `/${base}/${opts.parentId}/file-${opts.group}/${opts.fileId}`, - opts.file, - { - headers: { 'Content-Type': opts.file.type }, - onUploadProgress: (e) => console.log(e), - }, - ); - if (res.status < 400) return true; - return false; - }, - delFile: async (opts: { group: T; parentId: string; fileId: string }) => { - const res = await api.delete( - `/${base}/${opts.parentId}/file-${opts.group}/${opts.fileId}`, - ); - if (res.status < 400) return true; - return false; - }, - }; -} - export const useQuotationPayment = defineStore('quotation-payment', () => { async function getQuotationPayment(quotationId: string) { const res = await api.get< @@ -195,7 +144,32 @@ export const useQuotationPayment = defineStore('quotation-payment', () => { return null; } + async function updateQuotationPayment( + quotationId: string, + paymentId: string, + payload: PaymentPayload, + ) { + const res = await api.put( + `/quotation/${quotationId}/payment/${paymentId}`, + payload, + ); + if (res.status < 400) { + return res.data; + } + return null; + } + + function createPaymentFileManager( + api: AxiosInstance, + quotationId: string, + opts?: { onUploadProgress: (e: AxiosProgressEvent) => void }, + ) { + return manageAttachment(api, `/quotation/${quotationId}/payment`, opts); + } + return { getQuotationPayment, + createPaymentFileManager, + updateQuotationPayment, }; }); diff --git a/src/stores/utils/index.ts b/src/stores/utils/index.ts index 25dbb240..da415c64 100644 --- a/src/stores/utils/index.ts +++ b/src/stores/utils/index.ts @@ -5,7 +5,7 @@ import { ComposerTranslation } from 'vue-i18n'; import { defineStore } from 'pinia'; import { Ref, ref } from 'vue'; import { getRole } from 'src/services/keycloak'; -import { AxiosInstance } from 'axios'; +import { AxiosInstance, AxiosProgressEvent } from 'axios'; export const baseUrl = import.meta.env.VITE_API_BASE_URL; @@ -251,7 +251,11 @@ export function resetScrollBar(elementId: string) { } } -export function manageAttachment(api: AxiosInstance, base: string) { +export function manageAttachment( + api: AxiosInstance, + base: string, + option?: { onUploadProgress?: (e: AxiosProgressEvent) => void }, +) { return { listAttachment: async (opts: { parentId: string }) => { const res = await api.get( @@ -290,7 +294,9 @@ export function manageAttachment(api: AxiosInstance, base: string) { opts.file, { headers: { 'Content-Type': opts.file.type }, - onUploadProgress: (e) => console.log(e), + onUploadProgress: option?.onUploadProgress + ? option.onUploadProgress + : (e) => console.log(e), }, ); if (res.status < 400) return true; @@ -306,7 +312,11 @@ export function manageAttachment(api: AxiosInstance, base: string) { }; } -export function manageFile(api: AxiosInstance, base: string) { +export function manageFile( + api: AxiosInstance, + base: string, + option?: { onUploadProgress?: (e: AxiosProgressEvent) => void }, +) { return { listFile: async (opts: { group: T; parentId: string }) => { const res = await api.get( @@ -347,7 +357,9 @@ export function manageFile(api: AxiosInstance, base: string) { opts.file, { headers: { 'Content-Type': opts.file.type }, - onUploadProgress: (e) => console.log(e), + onUploadProgress: option?.onUploadProgress + ? option.onUploadProgress + : (e) => console.log(e), }, ); if (res.status < 400) return true; From 07656eccde6eb585b033b2818ddd2a3b1e191998 Mon Sep 17 00:00:00 2001 From: Methapon Metanipat Date: Mon, 21 Oct 2024 15:18:52 +0700 Subject: [PATCH 019/899] fix: price calc --- src/pages/05_quotation/peview/ViewForm.vue | 30 ++++++++++++---------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/src/pages/05_quotation/peview/ViewForm.vue b/src/pages/05_quotation/peview/ViewForm.vue index bfd72ae7..1c6b3f9f 100644 --- a/src/pages/05_quotation/peview/ViewForm.vue +++ b/src/pages/05_quotation/peview/ViewForm.vue @@ -198,7 +198,10 @@ onMounted(async () => { ? a.vatExcluded : precisionRound(a.vat + vat); a.finalPrice = precisionRound( - a.totalPrice - a.totalDiscount + a.vat - Number(obj.discount || 0), + a.totalPrice - + a.totalDiscount + + a.vat - + Number(data.value?.discount || 0), ); return a; @@ -253,7 +256,7 @@ function print() { - + @@ -264,7 +267,7 @@ function print() { - + @@ -290,7 +293,7 @@ function print() { class="q-mb-md" cellpadding="0" > - + - + - + - + + + + - - - -
{{ $t('peview.rank') }} {{ $t('peview.productCode') }}{{ $t('peview.vat') }} {{ $t('peview.value') }}
{{ i + 1 }} {{ v.code }} {{ v.detail }}
{{ $t('general.total') }} @@ -299,7 +302,7 @@ function print() {
{{ $t('general.discount') }} {{ formatNumberDecimal(summaryPrice.totalDiscount, 2) || 0 }} ฿ @@ -318,14 +321,19 @@ function print() {
{{ $t('general.totalVatExcluded') }} {{ formatNumberDecimal(summaryPrice.vatExcluded, 2) || 0 }} ฿
{{ $t('general.vat', { msg: '7%' }) }} + {{ formatNumberDecimal(summaryPrice.vat, 2) }} ฿ +
{{ $t('general.totalVatIncluded') }} @@ -341,12 +349,6 @@ function print() {
{{ $t('general.vat', { msg: '7%' }) }} - {{ formatNumberDecimal(summaryPrice.vat, 2) }} ฿ -
{{ $t('general.discountAfterVat') }} @@ -498,7 +500,7 @@ td { background-color: hsla(var(--orange-5-hsl) / 0.1); } -.color-tr:nth-child(odd) { +.color-tr > tr:nth-child(odd) { background-color: hsla(var(--orange-5-hsl) / 0.1); } From d9ba382f87575160e4ddcac4976fa129d7625b6d Mon Sep 17 00:00:00 2001 From: Thanaphon Frappet Date: Mon, 21 Oct 2024 17:19:41 +0700 Subject: [PATCH 020/899] fix: Changing language doesn't work --- src/pages/05_quotation/QuotationFormInfo.vue | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/pages/05_quotation/QuotationFormInfo.vue b/src/pages/05_quotation/QuotationFormInfo.vue index ff7afe0c..64fc8521 100644 --- a/src/pages/05_quotation/QuotationFormInfo.vue +++ b/src/pages/05_quotation/QuotationFormInfo.vue @@ -1,6 +1,6 @@ From e39f65808f4480e133698698b7bb84518e4d3eec Mon Sep 17 00:00:00 2001 From: Thanaphon Frappet Date: Fri, 25 Oct 2024 11:40:35 +0700 Subject: [PATCH 067/899] refactor: delete title product --- src/components/05_quotation/ProductItem.vue | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/src/components/05_quotation/ProductItem.vue b/src/components/05_quotation/ProductItem.vue index 174345e9..3ca36321 100644 --- a/src/components/05_quotation/ProductItem.vue +++ b/src/components/05_quotation/ProductItem.vue @@ -224,21 +224,6 @@ watch( :key="i" class="q-pb-md" > -
- - - - {{ item.title }} -
- Date: Fri, 25 Oct 2024 13:26:09 +0700 Subject: [PATCH 068/899] refactor: add installmentNo --- src/pages/04_product-service/MainPage.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pages/04_product-service/MainPage.vue b/src/pages/04_product-service/MainPage.vue index c137213b..971d9ec5 100644 --- a/src/pages/04_product-service/MainPage.vue +++ b/src/pages/04_product-service/MainPage.vue @@ -1319,6 +1319,7 @@ function cloneServiceData() { return { ...productOnWorkItem.product, nameEn: productOnWorkItem.product.name, + installmentNo: productOnWorkItem.installmentNo, }; }), }; From deed7dc639cee94a305f57f5804cb6491d842ef1 Mon Sep 17 00:00:00 2001 From: Thanaphon Frappet Date: Fri, 25 Oct 2024 13:26:38 +0700 Subject: [PATCH 069/899] refactor: edit layout input --- .../WorkManagementComponent.vue | 31 ++++++++++--------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/src/components/04_product-service/WorkManagementComponent.vue b/src/components/04_product-service/WorkManagementComponent.vue index 84784100..66085da1 100644 --- a/src/components/04_product-service/WorkManagementComponent.vue +++ b/src/components/04_product-service/WorkManagementComponent.vue @@ -309,18 +309,6 @@ watch( class="row items-center col-md col-12 no-wrap" v-if="productItems" > - - + +
+ งวดที่จ่าย +
+ {{ !readonly ? '' : product.installmentNo }} + +
{{ $t('productService.product.processingTime') }} - - {{ product.process }} {{ $t('general.day') }} From be91428197960d03d845dbca32c4fa4186480e6e Mon Sep 17 00:00:00 2001 From: Thanaphon Frappet Date: Fri, 25 Oct 2024 14:07:26 +0700 Subject: [PATCH 070/899] refactor: edit status --- src/pages/05_quotation/QuotationForm.vue | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/pages/05_quotation/QuotationForm.vue b/src/pages/05_quotation/QuotationForm.vue index 92a230b7..a2f667e5 100644 --- a/src/pages/05_quotation/QuotationForm.vue +++ b/src/pages/05_quotation/QuotationForm.vue @@ -671,19 +671,19 @@ const statusQuotationForm = ref< >([ { title: 'ใบเสนอราคา', - status: 'done', + status: 'doing', }, { title: 'ลูกค้าตอบรับ', - status: 'done', + status: 'waiting', }, { title: 'ใบแจ้งหนี้', - status: 'done', + status: 'waiting', }, { title: 'ชำระเงิน', - status: 'doing', + status: 'waiting', }, { title: 'ใบเสร็จรับเงิน', From 88f5bb717c33f77a7366a168f15a99768c96d1fc Mon Sep 17 00:00:00 2001 From: puriphatt Date: Fri, 25 Oct 2024 14:22:03 +0700 Subject: [PATCH 071/899] refactor: tel i18n --- src/i18n/eng/index.ts | 1 + src/i18n/tha/index.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/src/i18n/eng/index.ts b/src/i18n/eng/index.ts index c80c257c..a589b739 100644 --- a/src/i18n/eng/index.ts +++ b/src/i18n/eng/index.ts @@ -445,6 +445,7 @@ export default { contactPhone: 'Contact Phone', totalEmployee: 'Total Employee', officeTel: 'Headoffice Telephone', + tel: 'Contact Number', }, }, diff --git a/src/i18n/tha/index.ts b/src/i18n/tha/index.ts index 59ff1943..d0e9a664 100644 --- a/src/i18n/tha/index.ts +++ b/src/i18n/tha/index.ts @@ -441,6 +441,7 @@ export default { contactPhone: 'โทรศัพท์ผู้ติดต่อ', totalEmployee: 'ลูกจ้างทั้งหมด', officeTel: 'เบอร์โทรสำนักงาน', + tel: 'เบอร์โทรติดต่อ', }, }, From 157944f4708de1db4ee60670ee86129133ba934e Mon Sep 17 00:00:00 2001 From: puriphatt Date: Fri, 25 Oct 2024 14:23:21 +0700 Subject: [PATCH 072/899] fix(03): tel --- src/pages/03_customer-management/constant.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/03_customer-management/constant.ts b/src/pages/03_customer-management/constant.ts index 965998df..d8720231 100644 --- a/src/pages/03_customer-management/constant.ts +++ b/src/pages/03_customer-management/constant.ts @@ -306,7 +306,7 @@ export const columnsCustomer = [ { name: 'officeTel', align: 'left', - label: 'customer.table.officeTel', + label: 'customer.table.tel', field: 'officeTel', }, ] satisfies QTableProps['columns']; From 6f887edd4215410c4821cf3cf616d04297ef92b2 Mon Sep 17 00:00:00 2001 From: puriphatt Date: Fri, 25 Oct 2024 15:18:50 +0700 Subject: [PATCH 073/899] fix: comma input --- .../components/employer/EmployerFormAbout.vue | 3 ++- src/stores/utils/index.ts | 7 +++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/pages/03_customer-management/components/employer/EmployerFormAbout.vue b/src/pages/03_customer-management/components/employer/EmployerFormAbout.vue index 00bbb70c..a97e9932 100644 --- a/src/pages/03_customer-management/components/employer/EmployerFormAbout.vue +++ b/src/pages/03_customer-management/components/employer/EmployerFormAbout.vue @@ -228,7 +228,8 @@ watch( :model-value="authorizedCapital" @update:model-value=" (v) => { - if (typeof v === 'string') authorizedCapital = commaInput(v); + if (typeof v === 'string') + authorizedCapital = commaInput(v, 'string'); } " /> diff --git a/src/stores/utils/index.ts b/src/stores/utils/index.ts index c2423210..2d85dda6 100644 --- a/src/stores/utils/index.ts +++ b/src/stores/utils/index.ts @@ -461,7 +461,10 @@ export async function waitAll[]>(arr: T) { return await Promise.all(arr); } -export function commaInput(text: string): string { +export function commaInput( + text: string, + type: 'string' | 'number' = 'number', +): string { if (typeof text !== 'string') return '0'; if (!text) return '0'; @@ -469,7 +472,7 @@ export function commaInput(text: string): string { const parts = num.toString().split('.'); const integerPart = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ','); - const decimalPart = parts[1]?.slice(0, 2) || '00'; + const decimalPart = parts[1]?.slice(0, 2) || (type === 'number' && '00'); return integerPart + (decimalPart ? `.${decimalPart}` : ''); } From b0cb6061aff6ae583cb47f615dae94ae3084c789 Mon Sep 17 00:00:00 2001 From: puriphatt Date: Fri, 25 Oct 2024 15:23:09 +0700 Subject: [PATCH 074/899] refactor(04 flow): type and create function --- src/stores/workflow-template/index.ts | 7 +++++++ src/stores/workflow-template/types.ts | 1 + 2 files changed, 8 insertions(+) diff --git a/src/stores/workflow-template/index.ts b/src/stores/workflow-template/index.ts index 360544a7..77e561ec 100644 --- a/src/stores/workflow-template/index.ts +++ b/src/stores/workflow-template/index.ts @@ -32,6 +32,12 @@ export const useWorkflowTemplate = defineStore('workkflow-store', () => { return res.data; } + async function creatWorkflowTemplate(data: WorkflowTemplatePayload) { + const res = await api.post('/workflow-template', data); + if (res.status >= 400) return null; + return res; + } + async function editWorkflowTemplate( data: WorkflowTemplatePayload & { id: string }, ) { @@ -60,6 +66,7 @@ export const useWorkflowTemplate = defineStore('workkflow-store', () => { getWorkflowTemplate, getWorkflowTemplateList, + creatWorkflowTemplate, editWorkflowTemplate, deleteWorkflowTemplate, }; diff --git a/src/stores/workflow-template/types.ts b/src/stores/workflow-template/types.ts index 3df9c540..f6a629d7 100644 --- a/src/stores/workflow-template/types.ts +++ b/src/stores/workflow-template/types.ts @@ -29,6 +29,7 @@ export type WorkflowTemplate = { }; export type WorkflowTemplatePayload = { + registeredBranchId?: string; name: string; step: { name: string; From 1fe2c3a96c7b6db05f542750a497582f1c14193c Mon Sep 17 00:00:00 2001 From: puriphatt Date: Fri, 25 Oct 2024 16:06:13 +0700 Subject: [PATCH 075/899] refactor: flow --- .../04_flow-management/FormFlow.vue | 210 ++++++++++++++++-- src/components/05_quotation/QuotationCard.vue | 1 - src/pages/04_flow-managment/MainPage.vue | 145 +++++++++++- src/pages/04_product-service/FlowDialog.vue | 22 +- 4 files changed, 348 insertions(+), 30 deletions(-) diff --git a/src/components/04_flow-management/FormFlow.vue b/src/components/04_flow-management/FormFlow.vue index b23c4ac7..6ba0ecf0 100644 --- a/src/components/04_flow-management/FormFlow.vue +++ b/src/components/04_flow-management/FormFlow.vue @@ -1,12 +1,23 @@