feat: employee image and type
This commit is contained in:
parent
93697fd8cc
commit
26402c0de4
5 changed files with 53 additions and 46 deletions
|
|
@ -56,9 +56,8 @@ const useEmployeeStore = defineStore('api-employee', () => {
|
|||
},
|
||||
) {
|
||||
const { image, ...payload } = data;
|
||||
|
||||
const res = await api.post<
|
||||
Employee & { imageUrl: string; imageUploadUrl: string }
|
||||
Employee & { profileImageUrl: string; profileImageUploadUrl: string }
|
||||
>('/employee', payload, {
|
||||
headers: {
|
||||
'X-Session-Id': flow?.sessionId,
|
||||
|
|
@ -67,12 +66,13 @@ const useEmployeeStore = defineStore('api-employee', () => {
|
|||
},
|
||||
});
|
||||
|
||||
await axios
|
||||
.put(res.data.imageUploadUrl, image, {
|
||||
headers: { 'Content-Type': image.type },
|
||||
onUploadProgress: (e) => console.log(e),
|
||||
})
|
||||
.catch((e) => console.error(e));
|
||||
image &&
|
||||
(await axios
|
||||
.put(res.data.profileImageUploadUrl, image, {
|
||||
headers: { 'Content-Type': image?.type },
|
||||
onUploadProgress: (e) => console.log(e),
|
||||
})
|
||||
.catch((e) => console.error(e)));
|
||||
|
||||
if (!res) return false;
|
||||
|
||||
|
|
|
|||
|
|
@ -46,14 +46,14 @@ export type Employee = {
|
|||
};
|
||||
|
||||
export type EmployeeCreate = {
|
||||
image: File;
|
||||
image: File | null;
|
||||
customerBranchId: string;
|
||||
|
||||
status?: Status;
|
||||
|
||||
nrcNo: string;
|
||||
|
||||
dateOfBirth: Date;
|
||||
dateOfBirth: Date | null;
|
||||
gender: string;
|
||||
nationality: string;
|
||||
|
||||
|
|
@ -68,20 +68,20 @@ export type EmployeeCreate = {
|
|||
|
||||
passportType: string;
|
||||
passportNumber: string;
|
||||
passportIssueDate: Date;
|
||||
passportExpiryDate: Date;
|
||||
passportIssueDate: Date | null;
|
||||
passportExpiryDate: Date | null;
|
||||
passportIssuingCountry: string;
|
||||
passportIssuingPlace: string;
|
||||
previousPassportReference?: string;
|
||||
|
||||
visaType: string;
|
||||
visaNumber: string;
|
||||
visaIssueDate: Date;
|
||||
visaExpiryDate: Date;
|
||||
visaIssueDate: Date | null;
|
||||
visaExpiryDate: Date | null;
|
||||
visaIssuingPlace: string;
|
||||
visaStayUntilDate: Date;
|
||||
visaStayUntilDate: Date | null;
|
||||
tm6Number: string;
|
||||
entryDate: Date;
|
||||
entryDate: Date | null;
|
||||
workerStatus: string;
|
||||
|
||||
subDistrictId?: string | null;
|
||||
|
|
@ -145,8 +145,8 @@ export type EmployeeCheckup = {
|
|||
};
|
||||
|
||||
export type EmployeeCheckupCreate = {
|
||||
coverageExpireDate?: Date;
|
||||
coverageStartDate?: Date;
|
||||
coverageExpireDate?: Date | null;
|
||||
coverageStartDate?: Date | null;
|
||||
insuranceCompany?: string;
|
||||
medicalBenefitScheme?: string;
|
||||
remark?: string;
|
||||
|
|
@ -175,9 +175,9 @@ export type EmployeeWork = {
|
|||
};
|
||||
|
||||
export type EmployeeWorkCreate = {
|
||||
workEndDate?: Date;
|
||||
workPermitExpireDate?: Date;
|
||||
workPermitIssuDate?: Date;
|
||||
workEndDate?: Date | null;
|
||||
workPermitExpireDate?: Date | null;
|
||||
workPermitIssuDate?: Date | null;
|
||||
workPermitNo?: string;
|
||||
workplace?: string;
|
||||
jobType?: string;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue