fix: image selection
Some checks failed
Spell Check / Spell Check with Typos (push) Failing after 6s

This commit is contained in:
puriphatt 2025-09-16 10:11:53 +07:00
parent 5a671a571b
commit cb63138b21
2 changed files with 15 additions and 8 deletions

View file

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

View file

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