fix: Unable to edit employee information

This commit is contained in:
Net 2024-09-26 14:03:49 +07:00
parent 828eab36f2
commit d77bd3250b
3 changed files with 90 additions and 36 deletions

View file

@ -663,19 +663,6 @@ export const useEmployeeForm = defineStore('form-employee', () => {
districtId: '',
provinceId: '',
employeeWork: [
{
workEndDate: null,
workPermitExpireDate: null,
workPermitIssuDate: null,
workPermitNo: '',
workplace: '',
jobType: '',
positionName: '',
ownerName: '',
remark: '',
},
],
employeeCheckup: [
{
coverageExpireDate: null,
@ -689,6 +676,59 @@ export const useEmployeeForm = defineStore('form-employee', () => {
checkupType: '',
},
],
employeeWork: [
{
workEndDate: null,
workPermitExpireDate: null,
workPermitIssuDate: null,
workPermitNo: '',
workplace: '',
jobType: '',
positionName: '',
ownerName: '',
remark: '',
},
],
employeeInCountryNotice: [
{
noticeNumber: '',
noticeDate: '',
nextNoticeDate: new Date(),
tmNumber: '',
entryDate: new Date(),
travelBy: '',
travelFrom: '',
},
],
employeeVisa: [
{
number: '',
type: '',
entryCount: 0,
issueCountry: '',
issuePlace: '',
issueDate: new Date(),
expireDate: new Date(),
mrz: '',
remark: '',
},
],
employeePassport: [
{
number: '',
type: '',
issueDate: new Date(),
expireDate: new Date(),
issueCountry: '',
issuePlace: '',
previousPassportRef: '',
},
],
employeeOtherInfo: {
citizenId: '',
fatherFirstName: '',
@ -703,7 +743,6 @@ export const useEmployeeForm = defineStore('form-employee', () => {
motherLastNameEN: '',
motherBirthPlace: '',
},
image: null,
};
let resetEmployeeData = structuredClone(defaultFormData);
@ -944,7 +983,7 @@ export const useEmployeeForm = defineStore('form-employee', () => {
updatedByUserId,
createdBy,
updatedBy,
profileImageUrl,
...payload
} = _data;
@ -1001,10 +1040,6 @@ export const useEmployeeForm = defineStore('form-employee', () => {
state.value.profileUrl =
`${baseUrl}/employee/${id}/image/${_data.selectedImage}` || '';
profileImageUrl
? (state.value.profileSubmit = true)
: (state.value.profileSubmit = false);
state.value.formDataEmployeeOwner = { ...foundBranch };
if (
@ -1019,11 +1054,9 @@ export const useEmployeeForm = defineStore('form-employee', () => {
if (
state.value.infoEmployeePersonCard &&
Array.isArray(state.value.infoEmployeePersonCard) &&
state.value.infoEmployeePersonCard.length > 0 &&
profileImageUrl !== null
state.value.infoEmployeePersonCard.length > 0
) {
if (typeof state.value.infoEmployeePersonCard[0] === 'object') {
state.value.infoEmployeePersonCard[0].img = profileImageUrl;
}
}
flowStore.rotate();