fix: image selection

This commit is contained in:
puriphatt 2025-09-16 10:11:53 +07:00 committed by Methapon2001
parent e6f8870cdf
commit 49897ff007
2 changed files with 15 additions and 8 deletions

View file

@ -1390,7 +1390,6 @@ onMounted(async () => {
:index="idx" :index="idx"
prefixId="form" prefixId="form"
v-if="customerFormData.customerBranch" v-if="customerFormData.customerBranch"
v-model:customer="customerFormData"
v-model:customer-branch="customerFormData.customerBranch[idx]" v-model:customer-branch="customerFormData.customerBranch[idx]"
:onCreate="customerFormState.dialogType === 'create'" :onCreate="customerFormState.dialogType === 'create'"
:customer-type="customerFormData.customerType" :customer-type="customerFormData.customerType"
@ -1848,7 +1847,9 @@ onMounted(async () => {
v-model:image-url="customerFormState.customerImageUrl" v-model:image-url="customerFormState.customerImageUrl"
v-model:data-list="imageList" v-model:data-list="imageList"
v-model:on-create-data-list="onCreateImageList" v-model:on-create-data-list="onCreateImageList"
:on-create="customerFormState.dialogModal" :on-create="
customerFormState.dialogModal && !customerFormState.editCustomerId
"
:default-url="customerFormState.defaultCustomerImageUrl" :default-url="customerFormState.defaultCustomerImageUrl"
:hidden-footer="!customerFormState.isImageEdit" :hidden-footer="!customerFormState.isImageEdit"
@add-image=" @add-image="
@ -1885,7 +1886,10 @@ onMounted(async () => {
" "
@submit=" @submit="
async (v) => { async (v) => {
if (customerFormState.dialogModal) { if (
customerFormState.dialogModal &&
!customerFormState.editCustomerId
) {
customerFormState.customerImageUrl = v; customerFormState.customerImageUrl = v;
customerFormState.imageDialog = false; customerFormState.imageDialog = false;
} else { } else {
@ -1897,13 +1901,16 @@ onMounted(async () => {
await customerFormStore.submitFormCustomer(); await customerFormStore.submitFormCustomer();
customerFormState.imageDialog = false; customerFormState.imageDialog = false;
refreshImageState = false; refreshImageState = false;
await fetchListCustomer();
} }
} }
" "
> >
<template #title> <template #title>
<span <span
v-if="!customerFormState.dialogModal" v-if="
!customerFormState.dialogModal || customerFormState.editCustomerId
"
class="justify-center flex text-bold" class="justify-center flex text-bold"
> >
{{ $t('general.image') }} {{ $t('general.image') }}

View file

@ -2009,7 +2009,7 @@ onMounted(async () => {
v-model:image-url="employeeFormState.profileUrl" v-model:image-url="employeeFormState.profileUrl"
v-model:data-list="imageList" v-model:data-list="imageList"
v-model:on-create-data-list="onCreateImageList" v-model:on-create-data-list="onCreateImageList"
:on-create="employeeFormState.dialogModal" :on-create="employeeFormState.dialogModal && !currentFromDataEmployee.id"
:hidden-footer="!employeeFormState.isImageEdit" :hidden-footer="!employeeFormState.isImageEdit"
@add-image=" @add-image="
async (v) => { async (v) => {
@ -2042,7 +2042,7 @@ onMounted(async () => {
" "
@submit=" @submit="
async (v) => { async (v) => {
if (employeeFormState.dialogModal) { if (employeeFormState.dialogModal && !currentFromDataEmployee.id) {
employeeFormState.profileUrl = v; employeeFormState.profileUrl = v;
employeeFormState.imageDialog = false; employeeFormState.imageDialog = false;
} else { } else {
@ -2064,13 +2064,13 @@ onMounted(async () => {
> >
<template #title> <template #title>
<span <span
v-if="!employeeFormState.dialogModal" v-if="!employeeFormState.dialogModal || currentFromDataEmployee.id"
class="justify-center flex text-bold" class="justify-center flex text-bold"
> >
{{ $t('general.image') }} {{ $t('general.image') }}
{{ {{
$i18n.locale === 'eng' $i18n.locale === 'eng'
? `${currentFromDataEmployee.firstNameEN} ${currentFromDataEmployee.lastNameEN}` ? `${currentFromDataEmployee.firstNameEN || currentFromDataEmployee.firstName} ${currentFromDataEmployee.lastNameEN || currentFromDataEmployee.lastName}`
: `${currentFromDataEmployee.firstName} ${currentFromDataEmployee.lastName}` : `${currentFromDataEmployee.firstName} ${currentFromDataEmployee.lastName}`
}} }}
</span> </span>