diff --git a/src/components/form/AddressForm.vue b/src/components/form/AddressForm.vue
index 7b3835fd..8fc8cd98 100644
--- a/src/components/form/AddressForm.vue
+++ b/src/components/form/AddressForm.vue
@@ -289,6 +289,7 @@ watch(districtId, fetchSubDistrict);
hide-bottom-space
class="col-3"
v-model="homeCode"
+ mask="###########"
:dense="dense"
:label="$t('customer.form.homeCode')"
:readonly="readonly || sameWithEmployer"
@@ -365,7 +366,7 @@ watch(districtId, fetchSubDistrict);
outlined
hide-bottom-space
class="col-md-1 col-4"
- v-model="moo"
+ :model-value="readonly ? moo || '-' : moo"
:dense="dense"
:label="$t('form.moo')"
:readonly="readonly || sameWithEmployer"
@@ -375,7 +376,7 @@ watch(districtId, fetchSubDistrict);
outlined
hide-bottom-space
class="col-md-3 col-6"
- v-model="soi"
+ :model-value="readonly ? soi || '-' : soi"
:dense="dense"
:label="$t('form.soi')"
:readonly="readonly || sameWithEmployer"
@@ -385,7 +386,7 @@ watch(districtId, fetchSubDistrict);
outlined
hide-bottom-space
class="col-md-3 col-6"
- v-model="street"
+ :model-value="readonly ? street || '-' : street"
:dense="dense"
:label="$t('form.street')"
:readonly="readonly || sameWithEmployer"
@@ -593,7 +594,7 @@ watch(districtId, fetchSubDistrict);
outlined
hide-bottom-space
class="col-md-1 col-4"
- v-model="mooEN"
+ :model-value="readonly ? mooEN || '-' : mooEN"
:dense="dense"
label="Moo"
:readonly="readonly || sameWithEmployer"
@@ -603,7 +604,7 @@ watch(districtId, fetchSubDistrict);
outlined
hide-bottom-space
class="col-md-3 col-6"
- v-model="soiEN"
+ :model-value="readonly ? soiEN || '-' : soiEN"
:dense="dense"
label="Soi"
:readonly="readonly || sameWithEmployer"
@@ -613,7 +614,7 @@ watch(districtId, fetchSubDistrict);
outlined
hide-bottom-space
class="col-md-3 col-6"
- v-model="streetEN"
+ :model-value="readonly ? streetEN || '-' : streetEN"
:dense="dense"
label="Street"
:readonly="readonly || sameWithEmployer"
diff --git a/src/i18n/eng/index.ts b/src/i18n/eng/index.ts
index c6749bd2..ab23a967 100644
--- a/src/i18n/eng/index.ts
+++ b/src/i18n/eng/index.ts
@@ -155,6 +155,7 @@ export default {
invalidCustomeMessage: 'Invalid value. {msg}',
letterOnly: 'Only letters are allowed',
letterAndNumOnly: 'Only letters and number are allowed',
+ numOnly: 'Only number are allowed',
requireLength: 'Please enter {msg} character',
},
warning: {
diff --git a/src/i18n/tha/index.ts b/src/i18n/tha/index.ts
index 31d40ac1..24031afd 100644
--- a/src/i18n/tha/index.ts
+++ b/src/i18n/tha/index.ts
@@ -155,6 +155,7 @@ export default {
invalidCustomeMessage: 'ข้อมูลไม่ถูกต้อง {msg}',
letterOnly: 'โปรดใช้เฉพาะตัวอักษรภาษาอังกฤษเท่านั้น',
letterAndNumOnly: 'โปรดใช้เฉพาะตัวอักษรภาษาอังกฤษและตัวเลขเท่านั้น',
+ numOnly: 'โปรดใช้เฉพาะตัวเลขเท่านั้น',
requireLength: 'กรุณากรอกให้ครบ {msg} หลัก',
},
warning: {
diff --git a/src/pages/03_customer-management/BranchPage.vue b/src/pages/03_customer-management/BranchPage.vue
index d4249112..4b88d9e4 100644
--- a/src/pages/03_customer-management/BranchPage.vue
+++ b/src/pages/03_customer-management/BranchPage.vue
@@ -718,25 +718,25 @@ watch([customerId, inputSearch, currentStatus], async () => {
diff --git a/src/pages/03_customer-management/MainPage.vue b/src/pages/03_customer-management/MainPage.vue
index 378db314..a5af371a 100644
--- a/src/pages/03_customer-management/MainPage.vue
+++ b/src/pages/03_customer-management/MainPage.vue
@@ -1,5 +1,5 @@
@@ -239,7 +185,7 @@ watch(
-
-
-
-
diff --git a/src/pages/03_customer-management/components/employer/EmployerFormBranch.vue b/src/pages/03_customer-management/components/employer/EmployerFormBranch.vue
index 65ee5414..947ea1b3 100644
--- a/src/pages/03_customer-management/components/employer/EmployerFormBranch.vue
+++ b/src/pages/03_customer-management/components/employer/EmployerFormBranch.vue
@@ -47,6 +47,7 @@ withDefaults(
customerName: string;
readonly?: boolean;
prefixId?: string;
+ onCreate?: boolean;
actionDisabled?: boolean;
customerType?: 'CORP' | 'PERS';
hideAction?: boolean;
@@ -69,37 +70,37 @@ withDefaults(
? $t('customer.form.headQuarters.title')
: $t('customer.form.branch.title', { name: index || 0 })
}}
-
-
-
+
+
+
+
+
+
@@ -140,13 +141,13 @@ withDefaults(
v-model:birthDate="item.birthDate"
v-model:customerName="item.customerName"
v-model:legalPersonNo="item.legalPersonNo"
- v-model:branchCode="item.branchCode"
+ v-model:branchCode="item.code"
v-model:registerName="item.registerName"
v-model:registerNameEN="item.registerNameEN"
v-model:registerDate="item.registerDate"
v-model:authorizedCapital="item.authorizedCapital"
v-model:telephoneNo="item.telephoneNo"
- v-model:customerCode="item.customerCode"
+ v-model:codeCustomer="item.codeCustomer"
/>
diff --git a/src/pages/03_customer-management/components/employer/EmployerFormBusiness.vue b/src/pages/03_customer-management/components/employer/EmployerFormBusiness.vue
index 35a4b7c5..c5846c73 100644
--- a/src/pages/03_customer-management/components/employer/EmployerFormBusiness.vue
+++ b/src/pages/03_customer-management/components/employer/EmployerFormBusiness.vue
@@ -110,6 +110,7 @@ let jobPositionENFilter = selectFilterOptionRefMod(
map-options
hide-selected
hide-bottom-space
+ hide-dropdown-icon
input-debounce="0"
option-value="value"
option-label="label"
@@ -142,6 +143,7 @@ let jobPositionENFilter = selectFilterOptionRefMod(
map-options
hide-selected
hide-bottom-space
+ hide-dropdown-icon
input-debounce="0"
option-value="value"
option-label="label"
@@ -170,6 +172,7 @@ let jobPositionENFilter = selectFilterOptionRefMod(
map-options
hide-selected
hide-bottom-space
+ hide-dropdown-icon
input-debounce="0"
option-value="value"
option-label="label"
@@ -200,6 +203,7 @@ let jobPositionENFilter = selectFilterOptionRefMod(
map-options
hide-selected
hide-bottom-space
+ hide-dropdown-icon
input-debounce="0"
option-value="value"
option-label="label"
diff --git a/src/pages/03_customer-management/form.ts b/src/pages/03_customer-management/form.ts
index ffe095fe..21199cc4 100644
--- a/src/pages/03_customer-management/form.ts
+++ b/src/pages/03_customer-management/form.ts
@@ -140,28 +140,21 @@ export const useCustomerForm = defineStore('form-customer', () => {
resetFormData.registeredBranchId = data.registeredBranchId;
resetFormData.status = data.status;
resetFormData.customerType = data.customerType;
- resetFormData.code = data.code || '';
- resetFormData.namePrefix = data.namePrefix;
- resetFormData.firstName = data.firstName;
- resetFormData.lastName = data.lastName;
- resetFormData.firstNameEN = data.firstNameEN;
- resetFormData.lastNameEN = data.lastNameEN;
- resetFormData.gender = data.gender;
- resetFormData.birthDate = new Date(data.birthDate);
resetFormData.image = null;
resetFormData.selectedImage = data.selectedImage;
resetFormData.customerBranch = await Promise.all(
data.branch.map(async (v) => ({
- id: v.id,
- code: v.code || '',
- customerCode: '',
- provinceId: v.provinceId,
- districtId: v.districtId,
- subDistrictId: v.subDistrictId,
+ firstName: v.firstName,
+ firstNameEN: v.firstNameEN,
+ lastName: v.lastName,
+ lastNameEN: v.lastNameEN,
+ gender: v.gender,
+ birthDate: v.birthDate,
+ namePrefix: v.namePrefix,
wageRate: v.wageRate,
- payDate: v.payDate, // Convert the string to a Date object
- payDateEN: v.payDateEN,
+ wageRateText: v.wageRateText,
+ payDate: v.payDate,
saleEmployee: v.saleEmployee,
jobDescription: v.jobDescription,
jobPositionEN: v.jobPositionEN,
@@ -169,23 +162,49 @@ export const useCustomerForm = defineStore('form-customer', () => {
businessTypeEN: v.businessTypeEN,
businessType: v.businessType,
employmentOffice: v.employmentOffice,
+ employmentOfficeEN: v.employmentOfficeEN,
telephoneNo: v.telephoneNo,
+ contactName: v.contactName,
email: v.email,
+ subDistrictId: v.subDistrictId,
+ districtId: v.districtId,
+ provinceId: v.provinceId,
+ streetEN: v.streetEN,
+ street: v.street,
+ mooEN: v.mooEN,
+ moo: v.moo,
+ soiEN: v.soiEN,
+ soi: v.soi,
addressEN: v.addressEN,
address: v.address,
workplaceEN: v.workplaceEN,
workplace: v.workplace,
+ authorizedCapital: v.authorizedCapital,
+ registerDate: v.registerDate,
+ registerNameEN: v.registerNameEN,
+ registerName: v.registerName,
+ legalPersonNo: v.legalPersonNo,
+ citizenId: v.citizenId,
+ codeCustomer: v.codeCustomer,
+ updatedByUserId: v.updatedByUserId,
+ updatedAt: v.updatedAt,
+ createdByUserId: v.createdByUserId,
+ createdAt: v.createdAt,
+ code: v.code,
+ statusOrder: v.statusOrder,
status: v.status,
customerId: v.customerId,
- citizenId: v.citizenId || '',
- authorizedCapital: v.authorizedCapital || '',
- registerDate: new Date(v.registerDate), // Convert the string to a Date object
- registerNameEN: v.registerNameEN || '',
- registerName: v.registerName || '',
- legalPersonNo: v.legalPersonNo || '',
- registerCompanyName: '',
+ id: v.id,
+ homeCode: v.homeCode,
+ contactTel: v.contactTel,
+ officeTel: v.officeTel,
+ agent: v.agent,
+ customerName: v.customerName,
+ authorizedName: v.authorizedName,
+ authorizedNameEN: v.authorizedNameEN,
+
+ payDateEN: v.payDateEN,
statusSave: true,
- contactName: v.contactName || '',
file: await customerStore.listAttachment(v.id).then(async (r) => {
if (r) {
return await Promise.all(
@@ -220,7 +239,7 @@ export const useCustomerForm = defineStore('form-customer', () => {
? ''
: currentFormData.value.customerBranch?.[0].branchCode
: '',
- customerCode: '',
+ codeCustomer: '',
legalPersonNo:
currentFormData.value.customerBranch.length !== 0
@@ -373,7 +392,6 @@ export const useCustomerBranchForm = defineStore('form-customer-branch', () => {
registerNameEN: '',
registerName: '',
legalPersonNo: '',
- registerCompanyName: '',
statusSave: false,
contactName: '',
file: [],
@@ -441,7 +459,6 @@ export const useCustomerBranchForm = defineStore('form-customer-branch', () => {
registerName: _data.registerName,
legalPersonNo: _data.legalPersonNo,
contactName: _data.contactName,
- registerCompanyName: '',
statusSave: false,
file: [],
};
diff --git a/src/stores/customer/index.ts b/src/stores/customer/index.ts
index 6820db62..6ec939f4 100644
--- a/src/stores/customer/index.ts
+++ b/src/stores/customer/index.ts
@@ -335,7 +335,6 @@ const useCustomerStore = defineStore('api-customer', () => {
) {
if (data.customerBranch) {
if (data.customerBranch[0].citizenId) {
- console.log('1');
delete data.customerBranch[0]['authorizedNameEN'];
delete data.customerBranch[0]['authorizedName'];
delete data.customerBranch[0]['authorizedCapital'];
@@ -368,7 +367,7 @@ const useCustomerStore = defineStore('api-customer', () => {
branchCode: undefined,
id: undefined,
customerId: undefined,
- customerCode: undefined,
+ codeCustomer: undefined,
})),
selectedImage: imgList.selectedImage,
},
@@ -404,18 +403,6 @@ const useCustomerStore = defineStore('api-customer', () => {
},
) {
const { customerBranch, image, ...payload } = data;
- // const attachment = payload.customerBranch?.map((v) => v.file);
-
- // payload.customerBranch = payload.customerBranch?.map((v) => {
- // const { code: _code, ...rest } = v;
- // return { ...rest };
- // });
-
- // if (payload.customerBranch?.length) {
- // for (let i = 0; i < payload.customerBranch?.length; i++) {
- // delete payload.customerBranch[i].file;
- // }
- // }
const res = await api.put<
Customer & {
@@ -423,28 +410,32 @@ const useCustomerStore = defineStore('api-customer', () => {
imageUrl: string;
imageUploadUrl: string;
}
- >(`/customer/${id}`, payload, {
- headers: {
- 'X-Session-Id': flow?.sessionId,
- 'X-Rtid': flow?.refTransactionId || flowStore.rtid,
- 'X-Tid': flow?.transactionId,
+ >(
+ `/customer/${id}`,
+ {
+ ...payload,
+ branch: data.customerBranch?.map((v) => ({
+ ...v,
+ file: undefined,
+ branchCode: undefined,
+ id: undefined,
+ customerId: undefined,
+ codeCustomer: undefined,
+ createAt: undefined,
+ createdByUserId: undefined,
+ statusOrder: undefined,
+ updatedAt: undefined,
+ updatedByUserId: undefined,
+ })),
},
- });
-
- // await Promise.allSettled([
- // ...res.data.branch.map(async (v, i) => {
- // const fileList = attachment?.[i];
- // if (fileList)
- // return await addBranchAttachment(v.id, { file: fileList });
- // }),
- // image &&
- // (await axios
- // .put(res.data.imageUploadUrl, image, {
- // headers: { 'Content-Type': image.type },
- // onUploadProgress: (e) => console.log(e),
- // })
- // .catch((e) => console.error(e)));
- // ]);
+ {
+ headers: {
+ 'X-Session-Id': flow?.sessionId,
+ 'X-Rtid': flow?.refTransactionId || flowStore.rtid,
+ 'X-Tid': flow?.transactionId,
+ },
+ },
+ );
if (!res) return false;
@@ -494,30 +485,35 @@ const useCustomerStore = defineStore('api-customer', () => {
}
async function createBranch(
- data: CustomerBranchCreate & { id?: string; customerId: string },
+ data: CustomerBranchCreate & {
+ id?: string;
+ customerId: string;
+ codeCustomer: string;
+ },
flow?: {
sessionId?: string;
refTransactionId?: string;
transactionId?: string;
},
) {
- const {
- customerCode,
- registerCompanyName,
- statusSave,
- code,
- file,
- ...payload
- } = data;
+ const { codeCustomer, statusSave, code, file, birthDate, ...payload } =
+ data;
- if (!!payload.citizenId) {
- delete payload['registerDate'];
- delete payload['registerName'];
- delete payload['registerNameEN'];
- delete payload['authorizedCapital'];
- delete payload['legalPersonNo'];
+ if (data.citizenId) {
+ delete data['authorizedNameEN'];
+ delete data['authorizedName'];
+ delete data['registerDate'];
+ delete data['authorizedCapital'];
+ delete data['registerNameEN'];
+ delete data['registerName'];
+ delete data['legalPersonNo'];
} else {
- delete payload['citizenId'];
+ delete data['citizenId'];
+ }
+ console.log(data.birthDate);
+ console.log(!data.birthDate);
+ if (!data.birthDate) {
+ delete data['birthDate'];
}
const res = await api.post('/customer-branch', payload, {
@@ -536,20 +532,44 @@ const useCustomerStore = defineStore('api-customer', () => {
async function editBranchById(
id: string,
- data: Partial,
+ data: Partial<
+ CustomerBranch & {
+ id?: string;
+ customerId: string;
+ codeCustomer: string;
+ }
+ >,
flow?: {
sessionId?: string;
refTransactionId?: string;
transactionId?: string;
},
) {
+ if (data.citizenId) {
+ delete data['authorizedNameEN'];
+ delete data['authorizedName'];
+ delete data['registerDate'];
+ delete data['authorizedCapital'];
+ delete data['registerNameEN'];
+ delete data['registerName'];
+ delete data['legalPersonNo'];
+ } else {
+ delete data['citizenId'];
+ }
+ if (!data.birthDate) delete data['birthDate'];
+
const {
- customerCode,
- registerCompanyName,
- statusSave,
code,
status,
+ codeCustomer,
+ createdAt,
+ createdByUserId,
+ statusOrder,
+ updatedAt,
+ updatedByUserId,
file,
+ registerCompanyName,
+ statusSave,
...payload
} = data;
diff --git a/src/stores/customer/types.ts b/src/stores/customer/types.ts
index 9d331655..40e3744c 100644
--- a/src/stores/customer/types.ts
+++ b/src/stores/customer/types.ts
@@ -30,33 +30,57 @@ export type Customer = {
};
export type CustomerBranch = {
- customerId: string;
- contactName: string;
- wageRate: number;
- payDate: string;
- payDateEN: string;
- jobDescription: string;
- jobPosition: string;
- businessType: string;
- employmentOffice: string;
- authorizedCapital: string;
- registerDate: Date | null;
- registerNameEN: string;
- registerName: string;
- legalPersonNo?: string;
- citizenId: string;
- updatedByUserId: string;
- createdByUserId: string;
- statusOrder: number;
- telephoneNo: string;
- email: string;
- subDistrictId: string;
- districtId: string;
- provinceId: string;
- addressEN: string;
- address: string;
- code: string;
- id: string;
+ customerCode?: string;
+ wageRateText: 'string';
+ wageRate: 0;
+ payDateEN: 'string';
+ payDate: 'string';
+ jobDescription: 'string';
+ jobPosition: 'string';
+ businessType: 'string';
+ agent: 'string';
+ contactName: 'string';
+ officeTel: 'string';
+ contactTel: 'string';
+ email: 'string';
+ subDistrictId: 'string';
+ districtId: 'string';
+ provinceId: 'string';
+ streetEN: 'string';
+ street: 'string';
+ mooEN: 'string';
+ moo: 'string';
+ soiEN: 'string';
+ soi: 'string';
+ addressEN: 'string';
+ address: 'string';
+ employmentOfficeEN: 'string';
+ employmentOffice: 'string';
+ homeCode: 'string';
+ authorizedNameEN: 'string';
+ authorizedName: 'string';
+ authorizedCapital: 'string';
+ registerDate: '2024-09-16T07:52:42.627Z';
+ registerNameEN: 'string';
+ registerName: 'string';
+ legalPersonNo: 'string';
+ citizenId: 'string';
+ birthDate: '2024-09-16T07:52:42.627Z';
+ gender: 'string';
+ lastNameEN: 'string';
+ lastName: 'string';
+ firstNameEN: 'string';
+ firstName: 'string';
+ namePrefix: 'string';
+ telephoneNo: 'string';
+ codeCustomer: 'string';
+ customerName: 'string';
+ updatedByUserId: 'string';
+ createdByUserId: 'string';
+ code: 'string';
+ statusOrder: 0;
+ customerId: 'string';
+ id: 'string';
status: Status;
createdBy: string | null;
@@ -72,6 +96,7 @@ export type CustomerBranch = {
};
export type CustomerBranchCreate = {
+ customerCode?: string;
customerId: string;
legalPersonNo?: string;
citizenId?: string;
@@ -117,6 +142,7 @@ export type CustomerBranchCreate = {
authorizedCapital?: string;
authorizedName?: string;
authorizedNameEN?: string;
+ code?: 'string';
file?: {
name?: string;
group?: string;
@@ -129,7 +155,7 @@ export type CustomerCreate = {
customerBranch?: (CustomerBranchCreate & {
id?: string;
branchCode?: string;
- customerCode?: string;
+ codeCustomer?: string;
})[];
selectedImage?: string;
status?: Status;
@@ -145,7 +171,7 @@ export type CustomerUpdate = {
customerBranch?: (CustomerBranchCreate & {
id?: string;
branchCode?: string;
- customerCode?: string;
+ codeCustomer?: string;
})[];
image?: File;
registeredBranchId: string;