refactor: customer, employee upload profile after created

This commit is contained in:
puriphatt 2025-09-18 09:55:07 +07:00 committed by Methapon2001
parent 0d708405f6
commit 4e887fdff8
2 changed files with 29 additions and 2 deletions

View file

@ -239,7 +239,17 @@ const mrz = defineModel<Awaited<ReturnType<typeof parseResultMRZ>>>('mrz');
} }
" "
@edit=" @edit="
employeeFormState.imageDialog = employeeFormState.isImageEdit = true () => {
if (currentFromDataEmployee.id) {
fetchImageList(
currentFromDataEmployee.id,
currentFromDataEmployee.selectedImage || '',
'employee',
);
}
employeeFormState.imageDialog =
employeeFormState.isImageEdit = true;
}
" "
@update:toggle-status=" @update:toggle-status="
() => { () => {

View file

@ -1145,7 +1145,17 @@ onMounted(async () => {
} }
" "
@edit=" @edit="
customerFormState.imageDialog = customerFormState.isImageEdit = true () => {
if (customerFormState.editCustomerId) {
fetchImageList(
customerFormState.editCustomerId,
customerFormData.selectedImage,
'customer',
);
}
customerFormState.imageDialog =
customerFormState.isImageEdit = true;
}
" "
/> />
</div> </div>
@ -1893,24 +1903,31 @@ onMounted(async () => {
" "
@submit=" @submit="
async (v) => { async (v) => {
console.log(customerFormState.editCustomerId);
if ( if (
customerFormState.dialogModal && customerFormState.dialogModal &&
!customerFormState.editCustomerId !customerFormState.editCustomerId
) { ) {
console.log(1);
customerFormState.customerImageUrl = v; customerFormState.customerImageUrl = v;
customerFormState.imageDialog = false; customerFormState.imageDialog = false;
} else { } else {
console.log(2);
refreshImageState = true; refreshImageState = true;
customerFormData.selectedImage = v; customerFormData.selectedImage = v;
customerFormState.imageList customerFormState.imageList
? (customerFormState.imageList.selectedImage = v) ? (customerFormState.imageList.selectedImage = v)
: ''; : '';
customerFormState.customerImageUrl = `${baseUrl}/customer/${customerFormState.editCustomerId && customerFormState.editCustomerId}/image/${v}`; customerFormState.customerImageUrl = `${baseUrl}/customer/${customerFormState.editCustomerId && customerFormState.editCustomerId}/image/${v}`;
console.log(customerFormData.selectedImage);
customerFormStore.resetForm(); customerFormStore.resetForm();
console.log(customerFormData.selectedImage);
await customerFormStore.submitFormCustomer(); await customerFormStore.submitFormCustomer();
console.log(customerFormData.selectedImage);
customerFormState.imageDialog = false; customerFormState.imageDialog = false;
refreshImageState = false; refreshImageState = false;
await fetchListCustomer(); await fetchListCustomer();
console.log(customerFormData.selectedImage);
} }
} }
" "