refactor: add show img

This commit is contained in:
Net 2024-08-02 18:00:29 +07:00
parent a9890c0968
commit 5f26c8bcdc
3 changed files with 43 additions and 11 deletions

View file

@ -8,7 +8,9 @@ defineProps<{
branchLabelTel: string; branchLabelTel: string;
branchLabelAddress: string; branchLabelAddress: string;
branchLabelType: string; branchLabelType: string;
branchImgUrl: string;
}; };
metadata?: unknown; metadata?: unknown;
badgeField?: string[]; badgeField?: string[];
fieldSelected?: ( fieldSelected?: (
@ -19,6 +21,8 @@ defineProps<{
)[]; )[];
footer?: boolean; footer?: boolean;
}>(); }>();
const baseUrl = import.meta.env.VITE_API_BASE_URL;
</script> </script>
<template> <template>
@ -36,13 +40,22 @@ defineProps<{
> >
<div class="branch-card__header"> <div class="branch-card__header">
<div class="branch-card__wrapper"> <div class="branch-card__wrapper">
<div class="branch-card__icon"> <q-img
<q-icon :src="baseUrl + data.branchImgUrl"
size="md" style="
style="scale: 0.8" height: 3rem;
name="mdi-office-building-outline" width: 3rem;
/> border-radius: 50%;
</div> aspect-ratio: 1;
overflow: visible;
"
>
<template #error>
<div class="branch-card__icon">
<q-icon size="sm" name="mdi-office-building-outline" />
</div>
</template>
</q-img>
</div> </div>
<div class="branch-card__name"> <div class="branch-card__name">
<b>{{ data.branchLabelName }}</b> <b>{{ data.branchLabelName }}</b>
@ -95,10 +108,14 @@ defineProps<{
& .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); padding: var(--size-2);
position: relative; position: relative;
width: 3rem;
transform: rotate(45deg); transform: rotate(45deg);
aspect-ratio: 1; aspect-ratio: 1;
display: flex;
align-items: center;
justify-content: center;
&::after { &::after {
content: ' '; content: ' ';

View file

@ -1257,6 +1257,7 @@ watch(currentHq, () => {
? 'branchHQLabel' ? 'branchHQLabel'
: 'branchLabel', : 'branchLabel',
), ),
branchImgUrl: `/branch/${props.row.id}/branch-image`,
}" }"
:field-selected="fieldSelected" :field-selected="fieldSelected"
:badge-field="['branchLabelStatus']" :badge-field="['branchLabelStatus']"

View file

@ -1129,11 +1129,21 @@ watch(
<q-avatar size="md"> <q-avatar size="md">
<q-img <q-img
:src=" :src="
props.row.profileImageUrl ?? '/no-profile.png' props.row.profileImageUrl
? props.row.profileImageUrl
: props.row.gender === 'male'
? '/no-img-man.png'
: '/no-img-female.png'
" "
> >
<template #error> <template #error>
<q-img src="/no-profile.png" /> <q-img
:src="
props.row.gender === 'male'
? '/no-img-man.png'
: '/no-img-female.png'
"
/>
</template> </template>
</q-img> </q-img>
</q-avatar> </q-avatar>
@ -1354,7 +1364,11 @@ 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
? props.row.profileImageUrl
: props.row.gender === 'male'
? '/no-img-man.png'
: '/no-img-female.png',
male: props.row.gender === 'male', male: props.row.gender === 'male',
female: props.row.gender === 'female', female: props.row.gender === 'female',
detail: [ detail: [