fix: customer
This commit is contained in:
parent
cfaf1467a6
commit
4bf1a4a346
11 changed files with 1569 additions and 533 deletions
|
|
@ -18,20 +18,20 @@ export const useCustomerForm = defineStore('form-customer', () => {
|
|||
const branchStore = useMyBranch();
|
||||
|
||||
const defaultFormData: CustomerCreate = {
|
||||
code: '',
|
||||
// code: '',
|
||||
// namePrefix: '',
|
||||
// firstName: '',
|
||||
// lastName: '',
|
||||
// firstNameEN: '',
|
||||
// lastNameEN: '',
|
||||
// gender: '',
|
||||
// birthDate: new Date(),
|
||||
customerBranch: [],
|
||||
selectedImage: '',
|
||||
status: 'CREATED',
|
||||
customerType: 'CORP',
|
||||
namePrefix: '',
|
||||
firstName: '',
|
||||
lastName: '',
|
||||
firstNameEN: '',
|
||||
lastNameEN: '',
|
||||
gender: '',
|
||||
birthDate: new Date(),
|
||||
registeredBranchId: branchStore.currentMyBranch?.id || '',
|
||||
customerBranch: [],
|
||||
image: null,
|
||||
selectedImage: '',
|
||||
};
|
||||
let resetFormData = structuredClone(defaultFormData);
|
||||
|
||||
|
|
@ -138,9 +138,9 @@ export const useCustomerForm = defineStore('form-customer', () => {
|
|||
state.value.defaultCustomerImageUrl = `${baseUrl}/customer/${id}/image/${data.selectedImage}`;
|
||||
|
||||
resetFormData.registeredBranchId = data.registeredBranchId;
|
||||
resetFormData.code = data.code || '';
|
||||
resetFormData.status = data.status;
|
||||
resetFormData.customerType = data.customerType;
|
||||
resetFormData.code = data.code || '';
|
||||
resetFormData.namePrefix = data.namePrefix;
|
||||
resetFormData.firstName = data.firstName;
|
||||
resetFormData.lastName = data.lastName;
|
||||
|
|
@ -160,7 +160,8 @@ export const useCustomerForm = defineStore('form-customer', () => {
|
|||
districtId: v.districtId,
|
||||
subDistrictId: v.subDistrictId,
|
||||
wageRate: v.wageRate,
|
||||
payDate: new Date(v.payDate), // Convert the string to a Date object
|
||||
payDate: v.payDate, // Convert the string to a Date object
|
||||
payDateEN: v.payDateEN,
|
||||
saleEmployee: v.saleEmployee,
|
||||
jobDescription: v.jobDescription,
|
||||
jobPositionEN: v.jobPositionEN,
|
||||
|
|
@ -208,57 +209,77 @@ export const useCustomerForm = defineStore('form-customer', () => {
|
|||
currentFormData.value = structuredClone(resetFormData);
|
||||
}
|
||||
|
||||
function addCurrentCustomerBranch() {
|
||||
async function addCurrentCustomerBranch() {
|
||||
if (currentFormData.value.customerBranch?.some((v) => !v.id)) return;
|
||||
|
||||
currentFormData.value.customerBranch?.push({
|
||||
id: '',
|
||||
code:
|
||||
currentFormData.value.customerBranch.length !== 0
|
||||
? currentFormData.value.customerBranch?.[0].code === null
|
||||
? ''
|
||||
: currentFormData.value.customerBranch?.[0].code
|
||||
: '',
|
||||
|
||||
customerCode: '',
|
||||
provinceId: '',
|
||||
districtId: '',
|
||||
subDistrictId: '',
|
||||
wageRate: 0,
|
||||
payDate: new Date(), // Convert the string to a Date object
|
||||
saleEmployee: '',
|
||||
jobDescription: '',
|
||||
jobPositionEN: '',
|
||||
jobPosition: '',
|
||||
businessTypeEN: '',
|
||||
businessType: '',
|
||||
employmentOffice: '',
|
||||
telephoneNo: '',
|
||||
email: '',
|
||||
addressEN: '',
|
||||
address: '',
|
||||
workplaceEN: '',
|
||||
workplace: '',
|
||||
status: 'CREATED',
|
||||
customerId: '',
|
||||
citizenId:
|
||||
branchCode:
|
||||
currentFormData.value.customerBranch.length !== 0
|
||||
? currentFormData.value.customerBranch?.[0].citizenId === null
|
||||
? currentFormData.value.customerBranch?.[0].branchCode === null
|
||||
? ''
|
||||
: currentFormData.value.customerBranch?.[0].citizenId
|
||||
: currentFormData.value.customerBranch?.[0].branchCode
|
||||
: '',
|
||||
authorizedCapital: '',
|
||||
registerDate: new Date(), // Convert the string to a Date object
|
||||
registerNameEN: '',
|
||||
registerName: '',
|
||||
customerCode: '',
|
||||
|
||||
legalPersonNo:
|
||||
currentFormData.value.customerBranch.length !== 0
|
||||
? currentFormData.value.customerBranch?.[0].legalPersonNo === null
|
||||
? ''
|
||||
: currentFormData.value.customerBranch?.[0].legalPersonNo
|
||||
: '',
|
||||
registerCompanyName: '',
|
||||
citizenId:
|
||||
currentFormData.value.customerBranch.length !== 0
|
||||
? currentFormData.value.customerBranch?.[0].citizenId === null
|
||||
? ''
|
||||
: currentFormData.value.customerBranch?.[0].citizenId
|
||||
: '',
|
||||
namePrefix: '',
|
||||
firstName: '',
|
||||
lastName: '',
|
||||
firstNameEN: '',
|
||||
lastNameEN: '',
|
||||
telephoneNo: '',
|
||||
gender: '',
|
||||
birthDate: '',
|
||||
|
||||
businessType: '',
|
||||
jobPosition: '',
|
||||
jobDescription: '',
|
||||
payDate: '',
|
||||
payDateEN: '',
|
||||
wageRate: 0,
|
||||
wageRateText: '',
|
||||
homeCode: '',
|
||||
employmentOffice: '',
|
||||
employmentOfficeEN: '',
|
||||
|
||||
address: '',
|
||||
addressEN: '',
|
||||
street: '',
|
||||
streetEN: '',
|
||||
moo: '',
|
||||
mooEN: '',
|
||||
soi: '',
|
||||
soiEN: '',
|
||||
provinceId: '',
|
||||
districtId: '',
|
||||
subDistrictId: '',
|
||||
|
||||
contactName: '',
|
||||
email: '',
|
||||
contactTel: '',
|
||||
officeTel: '',
|
||||
agent: '',
|
||||
status: 'CREATED',
|
||||
|
||||
customerName: '',
|
||||
registerName: '',
|
||||
registerNameEN: '',
|
||||
registerDate: null,
|
||||
authorizedCapital: '',
|
||||
authorizedName: '',
|
||||
authorizedNameEN: '',
|
||||
file: [],
|
||||
});
|
||||
state.value.branchIndex =
|
||||
|
|
@ -329,7 +350,8 @@ export const useCustomerBranchForm = defineStore('form-customer-branch', () => {
|
|||
districtId: '',
|
||||
subDistrictId: '',
|
||||
wageRate: 0,
|
||||
payDate: new Date(), // Convert the string to a Date object
|
||||
payDate: '',
|
||||
payDateEN: '',
|
||||
saleEmployee: '',
|
||||
jobDescription: '',
|
||||
jobPositionEN: '',
|
||||
|
|
@ -395,7 +417,8 @@ export const useCustomerBranchForm = defineStore('form-customer-branch', () => {
|
|||
districtId: _data.districtId,
|
||||
subDistrictId: _data.subDistrictId,
|
||||
wageRate: _data.wageRate,
|
||||
payDate: new Date(_data.payDate), // Convert the string to a Date object
|
||||
payDate: _data.payDate, // Convert the string to a Date object
|
||||
payDateEN: _data.payDateEN,
|
||||
saleEmployee: _data.saleEmployee,
|
||||
jobDescription: _data.jobDescription,
|
||||
jobPositionEN: _data.jobPositionEN,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue