feat: enhance employee form to support image uploads and track image edits
Some checks failed
Spell Check / Spell Check with Typos (push) Failing after 7s

This commit is contained in:
puriphatt 2025-07-07 17:54:03 +07:00
parent 34f5b6474b
commit b9f1d04105
2 changed files with 11 additions and 3 deletions

View file

@ -664,6 +664,14 @@ watch(
},
);
watch(
() => currentFromDataEmployee.value.image,
() => {
if (currentFromDataEmployee.value.image !== null)
employeeFormState.value.isImageEdit = true;
},
);
const emptyCreateDialog = ref(false);
</script>

View file

@ -810,7 +810,7 @@ export const useEmployeeForm = defineStore('form-employee', () => {
ocr: false,
});
const defaultFormData: EmployeeCreate = {
const defaultFormData: EmployeeCreate & { image?: File } = {
id: '',
code: '',
customerBranchId: '',
@ -937,7 +937,7 @@ export const useEmployeeForm = defineStore('form-employee', () => {
};
let resetEmployeeData = structuredClone(defaultFormData);
const currentFromDataEmployee = ref<EmployeeCreate>(
const currentFromDataEmployee = ref<EmployeeCreate & { image?: File }>(
structuredClone(defaultFormData),
);
@ -1250,7 +1250,7 @@ export const useEmployeeForm = defineStore('form-employee', () => {
await assignFormDataEmployee(currentFromDataEmployee.value.id);
}
async function submitPersonal(imgList: {
async function submitPersonal(imgList?: {
selectedImage: string;
list: { url: string; imgFile: File | null; name: string }[];
}) {