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

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