fix: fallback no gender img

This commit is contained in:
puriphatt 2024-08-19 14:43:05 +07:00
parent 57c1bdc867
commit 9ffb327417

View file

@ -868,7 +868,7 @@ watch(
<!-- main --> <!-- main -->
<div <div
class="col surface-2 rounded justify-between column no-wrap bordered" class="col surface-2 rounded justify-between column no-wrap bordered full-height"
style="overflow: hidden" style="overflow: hidden"
> >
<div class="column"> <div class="column">
@ -1110,7 +1110,7 @@ watch(
</div> </div>
</div> </div>
<div class="col scroll q-pa-md full-width full-height"> <div class="flex full-width full-height q-pa-md surface-2 column col">
<template v-if="userData && userData.total > 0 && !inputSearch"> <template v-if="userData && userData.total > 0 && !inputSearch">
<q-table <q-table
flat flat
@ -1118,8 +1118,7 @@ watch(
:grid="modeView" :grid="modeView"
:rows="userData.result" :rows="userData.result"
:columns="columns" :columns="columns"
style="max-height: 100%" class="full-width"
class="full-width full-height"
card-container-class="q-col-gutter-md" card-container-class="q-col-gutter-md"
row-key="name" row-key="name"
:rows-per-page-options="[0]" :rows-per-page-options="[0]"
@ -1160,12 +1159,24 @@ watch(
> >
{{ (currentPage - 1) * pageSize + props.rowIndex + 1 }} {{ (currentPage - 1) * pageSize + props.rowIndex + 1 }}
</q-td> </q-td>
<q-td v-if="fieldSelected.includes('name')"> <q-td v-if="fieldSelected.includes('name')">
<div class="row items-center" style="flex-wrap: nowrap"> <div class="row items-center" style="flex-wrap: nowrap">
<div style="display: flex"> <div style="display: flex">
<div class="branch-card__icon q-mr-md"> <div class="q-mr-md">
<q-avatar size="md"> <q-avatar
size="md"
style="
background: linear-gradient(
135deg,
rgba(43, 137, 223, 1) 0%,
rgba(230, 51, 81, 1) 100%
);
"
>
<q-img <q-img
v-if="props.row.gender !== ''"
class="text-center"
:ratio="1" :ratio="1"
:src=" :src="
props.row.profileImageUrl props.row.profileImageUrl
@ -1179,6 +1190,10 @@ watch(
> >
<template #error> <template #error>
<q-img <q-img
v-if="
props.row.gender === 'male' ||
props.row.gender === 'female'
"
:src=" :src="
props.row.gender === 'male' props.row.gender === 'male'
? '/no-img-man.png' ? '/no-img-man.png'
@ -1187,16 +1202,43 @@ watch(
/> />
</template> </template>
</q-img> </q-img>
<q-icon
v-else
name="mdi-account-outline"
style="color: white"
/>
<q-badge
class="absolute-bottom-right no-padding"
style="
border-radius: 50%;
min-width: 8px;
min-height: 8px;
"
:style="{
background: `var(--${props.row.status === 'INACTIVE' ? 'stone-5' : 'green-6'})`,
}"
></q-badge>
</q-avatar> </q-avatar>
</div> </div>
</div> </div>
<div class="column"> <div class="column">
<div> <div class="col ellipsis" style="max-width: 20vw">
{{ {{
$i18n.locale === 'en-US' $i18n.locale === 'en-US'
? `${props.row.firstNameEN} ${props.row.lastNameEN}`.trim() ? `${props.row.firstNameEN} ${props.row.lastNameEN}`.trim()
: `${props.row.firstName} ${props.row.lastName}`.trim() : `${props.row.firstName} ${props.row.lastName}`.trim()
}} }}
<q-tooltip
anchor="bottom left"
self="center left"
:delay="300"
>
{{
$i18n.locale === 'en-US'
? `${props.row.firstNameEN} ${props.row.lastNameEN}`.trim()
: `${props.row.firstName} ${props.row.lastName}`.trim()
}}
</q-tooltip>
<q-icon <q-icon
class="q-pl-xs" class="q-pl-xs"
@ -1216,6 +1258,7 @@ watch(
</div> </div>
</div> </div>
</q-td> </q-td>
<q-td v-if="fieldSelected.includes('type')"> <q-td v-if="fieldSelected.includes('type')">
<span <span
class="tags" class="tags"
@ -1563,21 +1606,14 @@ watch(
:submit="() => onSubmit()" :submit="() => onSubmit()"
:close="() => onClose()" :close="() => onClose()"
> >
<InfoForm <InfoForm>
:readonly="!infoDrawerEdit"
v-model:address="formData.address"
v-model:addressEN="formData.addressEN"
v-model:provinceId="formData.provinceId"
v-model:districtId="formData.districtId"
v-model:subDistrictId="formData.subDistrictId"
v-model:zipCode="formData.zipCode"
>
<div class="q-px-lg q-pt-lg surface-2"> <div class="q-px-lg q-pt-lg surface-2">
<ProfileBanner <ProfileBanner
:active="formData.status !== 'INACTIVE'" :active="formData.status !== 'INACTIVE'"
useToggle useToggle
color="hsla(var(--pink-6-hsl)/1)" color="white"
bgColor="hsla(var(--pink-6-hsl)/0.15)" icon="mdi-account-outline"
bgColor="linear-gradient(135deg, rgba(43,137,223,1) 0%, rgba(230,51,81,1) 100%)"
v-model:toggle-status="formData.status" v-model:toggle-status="formData.status"
hideFade hideFade
:menu="formMenuIcon" :menu="formMenuIcon"
@ -1960,7 +1996,7 @@ watch(
<div <div
class="full-height full-width flex justify-center items-center" class="full-height full-width flex justify-center items-center"
:style="`background: ${ :style="`background: ${
modal modal || !formData.gender
? 'linear-gradient(135deg,rgba(43, 137, 223, 1) 0%,rgba(230, 51, 81, 1) 100%)' ? 'linear-gradient(135deg,rgba(43, 137, 223, 1) 0%,rgba(230, 51, 81, 1) 100%)'
: formData.gender === 'male' : formData.gender === 'male'
? '#78afb0' ? '#78afb0'
@ -1968,7 +2004,7 @@ watch(
}`" }`"
> >
<q-img <q-img
v-if="infoDrawer" v-if="infoDrawer && formData.gender"
fit="contain" fit="contain"
:src="`/no-img-${formData.gender === 'male' ? 'man' : 'female'}.png`" :src="`/no-img-${formData.gender === 'male' ? 'man' : 'female'}.png`"
style="height: 100%" style="height: 100%"
@ -1976,7 +2012,9 @@ watch(
<q-icon <q-icon
v-else v-else
size="15rem" size="15rem"
name="mdi-account-plus-outline" :name="
infoDrawer ? 'mdi-account-outline' : 'mdi-account-plus-outline'
"
style="color: white" style="color: white"
/> />
</div> </div>
@ -2052,7 +2090,7 @@ watch(
.branch-card__icon { .branch-card__icon {
background-color: hsla(var(--_branch-card-bg) / 0.15); background-color: hsla(var(--_branch-card-bg) / 0.15);
border-radius: 50%; border-radius: 50%;
padding: var(--size-1);
position: relative; position: relative;
transform: rotate(45deg); transform: rotate(45deg);