fix(03): fallback image

This commit is contained in:
puriphatt 2024-08-07 02:33:41 +00:00
parent 3f5387c26c
commit 6b25788e53

View file

@ -9,7 +9,7 @@ import { calculateAge, dateFormat } from 'src/utils/datetime';
import useCustomerStore from 'stores/customer'; import useCustomerStore from 'stores/customer';
import useEmployeeStore from 'stores/employee'; import useEmployeeStore from 'stores/employee';
import useMyBranchStore from 'stores/my-branch'; import useMyBranchStore from 'stores/my-branch';
import useUtilsStore, { dialog } from 'stores/utils'; import useUtilsStore, { dialog, notify } from 'stores/utils';
import useFlowStore from 'stores/flow'; import useFlowStore from 'stores/flow';
import { Status } from 'stores/types'; import { Status } from 'stores/types';
import { CustomerStats, Customer, CustomerBranch } from 'stores/customer/types'; import { CustomerStats, Customer, CustomerBranch } from 'stores/customer/types';
@ -558,7 +558,7 @@ watch(
? 'hsla(var(--violet-11-hsl))' ? 'hsla(var(--violet-11-hsl))'
: 'hsla(var(--pink-6-hsl))', : 'hsla(var(--pink-6-hsl))',
}" }"
@click="" @click="console.log('add-branch')"
padding="xs" padding="xs"
icon="mdi-office-building" icon="mdi-office-building"
:label="$t('formDialogTitleCreateSubBranch')" :label="$t('formDialogTitleCreateSubBranch')"
@ -615,8 +615,8 @@ watch(
? customerStats.map((v) => ({ ? customerStats.map((v) => ({
count: count:
v.name === 'CORP' v.name === 'CORP'
? statsCustomerType?.CORP ?? 0 ? (statsCustomerType?.CORP ?? 0)
: statsCustomerType?.PERS ?? 0, : (statsCustomerType?.PERS ?? 0),
label: label:
v.name === 'CORP' v.name === 'CORP'
? 'customerLegalEntity' ? 'customerLegalEntity'
@ -947,12 +947,14 @@ watch(
<div class="branch-card__icon"> <div class="branch-card__icon">
<q-avatar size="md"> <q-avatar size="md">
<q-img <q-img
:src=" :src="`
props.row.imageUrl ?? '/no-profile.png' ${props.row.imageUrl ?? '/images/customer-' + props.row.customerType + '-avartar.png'}
" `"
> >
<template #error> <template #error>
<q-img src="/no-profile.png" /> <q-img
src="/images/customer-CORP-avartar.png"
/>
</template> </template>
</q-img> </q-img>
</q-avatar> </q-avatar>
@ -1144,7 +1146,11 @@ watch(
$i18n.locale === 'en-US' $i18n.locale === 'en-US'
? `${props.row.customerName} `.trim() ? `${props.row.customerName} `.trim()
: `${props.row.customerNameEN} `.trim(), : `${props.row.customerNameEN} `.trim(),
img: props.row.imageUrl, img:
props.row.imageUrl ||
'/images/customer-' +
props.row.customerType +
'-avartar.png',
male: undefined, male: undefined,
female: undefined, female: undefined,
detail: [ detail: [
@ -1180,7 +1186,7 @@ watch(
`/customer-management/${props.row.id}/branch`, `/customer-management/${props.row.id}/branch`,
) )
" "
@view-card="" @view-card="console.log('view customer')"
@delete-card="deleteCustomerById(props.row.id)" @delete-card="deleteCustomerById(props.row.id)"
@toggle-status=" @toggle-status="
triggerChangeStatus(props.row.id, props.row.status) triggerChangeStatus(props.row.id, props.row.status)
@ -1343,11 +1349,13 @@ watch(
<q-img <q-img
:src=" :src="
props.row.profileImageUrl ?? props.row.profileImageUrl ??
'/no-profile.png' '/images/employee-avatar.png'
" "
> >
<template #error> <template #error>
<q-img src="/no-profile.png" /> <q-img
src="/images/employee-avatar.png"
/>
</template> </template>
</q-img> </q-img>
</q-avatar> </q-avatar>
@ -1592,7 +1600,9 @@ watch(
$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(),
img: props.row.profileImageUrl, img:
props.row.profileImageUrl ||
'/images/employee-avatar.png',
male: props.row.gender === 'male', male: props.row.gender === 'male',
female: props.row.gender === 'female', female: props.row.gender === 'female',
detail: [ detail: [
@ -1604,7 +1614,7 @@ watch(
{ {
icon: 'mdi-clock-outline', icon: 'mdi-clock-outline',
value: props.row.dateOfBirth value: props.row.dateOfBirth
? calculateAge(props.row.dateOfBirth) ?? '' ? (calculateAge(props.row.dateOfBirth) ?? '')
: '', : '',
}, },
], ],
@ -1617,8 +1627,8 @@ watch(
]" ]"
:disabled="props.row.status === 'INACTIVE'" :disabled="props.row.status === 'INACTIVE'"
@history="openHistory(props.row.id)" @history="openHistory(props.row.id)"
@update-card="" @update-card="console.log('update emp')"
@enter-card="" @enter-card="console.log('enter-emp')"
@delete-card="deleteEmployeeById(props.row.id)" @delete-card="deleteEmployeeById(props.row.id)"
@toggle-status=" @toggle-status="
triggerChangeStatus(props.row.id, props.row.status) triggerChangeStatus(props.row.id, props.row.status)
@ -2245,7 +2255,7 @@ watch(
v-model:current-tab="employeeFormState.currentTab" v-model:current-tab="employeeFormState.currentTab"
v-model:cover-url="employeeFormState.profileUrl" v-model:cover-url="employeeFormState.profileUrl"
fallbackCover="images/employee-banner.png" fallbackCover="images/employee-banner.png"
:img="`images/employee-avatar.png`" :img="`/images/employee-avatar.png`"
:tabs-list="[ :tabs-list="[
{ name: 'personalInfo', label: 'personalInfo' }, { name: 'personalInfo', label: 'personalInfo' },
{ name: 'healthCheck', label: 'healthCheck' }, { name: 'healthCheck', label: 'healthCheck' },