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