252 lines
6.0 KiB
Vue
252 lines
6.0 KiB
Vue
<template>
|
|
<div class="verification-item">
|
|
<div class="verification-item__user">
|
|
<div v-if="user.avatarUrl" class="verification-item__avatar">
|
|
<img :src="user.avatarUrl" :alt="fullName" />
|
|
</div>
|
|
<div v-else class="verification-item__avatar verification-item__avatar--placeholder">
|
|
<SvgIcon name="user" :size="24" color="#bcbcbc" />
|
|
</div>
|
|
<div class="verification-item__info">
|
|
<p class="verification-item__name">{{ fullName }}</p>
|
|
<p class="verification-item__location">
|
|
<span>{{ user?.province?.name || '—' }}</span>
|
|
<span class="verification-item__sep">،</span>
|
|
<span>{{ user?.city?.name || '—' }}</span>
|
|
</p>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="verification-item__meta">
|
|
<div class="verification-item__date">
|
|
<span class="verification-item__date-label">تاریخ ثبت نام:</span>
|
|
<span class="verification-item__date-value">
|
|
{{ user.faSubmittedAt || formatJalaaliDate(user.submittedAt) || '—' }}
|
|
</span>
|
|
</div>
|
|
<div
|
|
v-if="user.status === 'pending'"
|
|
class="verification-item__badge verification-item__badge--pending"
|
|
>
|
|
<span class="verification-item__dot" />
|
|
<span>در انتظار تایید</span>
|
|
</div>
|
|
<button
|
|
v-else-if="user.status === 'rejected'"
|
|
type="button"
|
|
class="verification-item__badge verification-item__badge--rejected"
|
|
@click="emit('show-reject-reason', user)"
|
|
>
|
|
<span class="verification-item__dot" />
|
|
<span>رد شده</span>
|
|
</button>
|
|
</div>
|
|
|
|
<div class="verification-item__actions">
|
|
<CircleButton
|
|
tooltip="تایید"
|
|
bg-color="rgba(0, 154, 18, 0.08)"
|
|
size="2.5rem"
|
|
@click="emit('verify-user', { id: user.id, status: 'approved' })"
|
|
>
|
|
<template #icon>
|
|
<SvgIcon name="check" :size="20" color="var(--color-secondary)" />
|
|
</template>
|
|
</CircleButton>
|
|
<CircleButton
|
|
v-if="user.status !== 'rejected'"
|
|
tooltip="عدم تایید"
|
|
bg-color="rgba(204, 40, 49, 0.08)"
|
|
size="2.5rem"
|
|
@click="emit('verify-user', { id: user.id, status: 'rejected' })"
|
|
>
|
|
<template #icon>
|
|
<SvgIcon name="close" :size="20" color="var(--color-error)" />
|
|
</template>
|
|
</CircleButton>
|
|
<BaseButton
|
|
custom-class="verification-item__details-btn"
|
|
text="جزئیات احراز هویت"
|
|
:loading="detailsLoading"
|
|
@click="emit('show-details', user.id)"
|
|
>
|
|
<template #appendIcon>
|
|
<SvgIcon name="caret-left" :size="16" color="#fff" />
|
|
</template>
|
|
</BaseButton>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup>
|
|
import { computed } from 'vue'
|
|
import BaseButton from '@/components/BaseButton.vue'
|
|
import SvgIcon from '@/components/icons/SvgIcon.vue'
|
|
import { formatJalaaliDate } from '@/utils/date-utils'
|
|
import CircleButton from '@/components/CircleButton.vue'
|
|
|
|
const props = defineProps({
|
|
user: { type: Object, required: true },
|
|
detailsLoading: { type: Boolean, default: false },
|
|
})
|
|
|
|
const emit = defineEmits(['show-details', 'show-reject-reason', 'verify-user'])
|
|
|
|
const fullName = computed(
|
|
() => `${props.user.firstName || ''} ${props.user.lastName || ''}`.trim() || '—'
|
|
)
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.verification-item {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 0.625rem;
|
|
padding: 0.75rem;
|
|
background: rgba(255, 255, 255, 50%);
|
|
box-shadow: 0 4px 10px -6px rgba(241, 241, 241, 70%);
|
|
border-radius: 0.875rem;
|
|
margin-bottom: 0.625rem;
|
|
|
|
@media (min-width: 768px) {
|
|
flex-direction: row;
|
|
align-items: center;
|
|
gap: 0.625rem;
|
|
}
|
|
|
|
&__user {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 0.625rem;
|
|
flex: 1 1 33%;
|
|
}
|
|
|
|
&__avatar {
|
|
height: 3rem;
|
|
width: 3rem;
|
|
border-radius: 9999px;
|
|
overflow: hidden;
|
|
border: 1px solid #eee;
|
|
flex-shrink: 0;
|
|
|
|
img {
|
|
height: 100%;
|
|
width: 100%;
|
|
object-fit: cover;
|
|
}
|
|
|
|
&--placeholder {
|
|
background: #f5f5f5;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
border: none;
|
|
}
|
|
}
|
|
|
|
&__info {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 0.25rem;
|
|
min-width: 0;
|
|
}
|
|
|
|
&__name {
|
|
font-family: var(--font-family-fa);
|
|
font-weight: 400;
|
|
font-size: 1rem;
|
|
color: #4b4b4b;
|
|
margin: 0;
|
|
white-space: nowrap;
|
|
}
|
|
|
|
&__location {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 0.25rem;
|
|
font-family: var(--font-family-fa);
|
|
font-size: 0.75rem;
|
|
font-weight: 300;
|
|
color: #848484;
|
|
margin: 0;
|
|
white-space: nowrap;
|
|
}
|
|
|
|
&__sep {
|
|
color: #c4c4c4;
|
|
}
|
|
|
|
&__meta {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 0.375rem;
|
|
flex: 1 1 33%;
|
|
}
|
|
|
|
&__date {
|
|
background: rgba(107, 107, 107, 5%);
|
|
padding: 0.25rem 1rem;
|
|
border-radius: 0.875rem;
|
|
white-space: nowrap;
|
|
line-height: 1.5;
|
|
}
|
|
|
|
&__date-label {
|
|
font-family: var(--font-family-fa);
|
|
font-weight: 300;
|
|
font-size: 0.75rem;
|
|
color: #848484;
|
|
margin-inline-end: 0.25rem;
|
|
}
|
|
|
|
&__date-value {
|
|
font-family: var(--font-family-en);
|
|
font-size: 0.75rem;
|
|
}
|
|
|
|
&__badge {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: 0.375rem;
|
|
padding: 0.25rem 1rem;
|
|
border-radius: 0.875rem;
|
|
font-family: var(--font-family-fa);
|
|
font-size: 0.7rem;
|
|
line-height: 1.5;
|
|
border: none;
|
|
cursor: default;
|
|
|
|
&--pending {
|
|
background: rgba(0, 255, 68, 6%);
|
|
color: #009a12;
|
|
}
|
|
|
|
&--rejected {
|
|
background: rgba(204, 40, 49, 6%);
|
|
color: var(--color-error);
|
|
cursor: pointer;
|
|
}
|
|
}
|
|
|
|
&__dot {
|
|
width: 0.375rem;
|
|
height: 0.375rem;
|
|
border-radius: 9999px;
|
|
background: currentcolor;
|
|
}
|
|
|
|
&__actions {
|
|
display: flex;
|
|
justify-content: flex-end;
|
|
align-items: center;
|
|
gap: 0.375rem;
|
|
flex: 1 1 33%;
|
|
}
|
|
|
|
&__details-btn {
|
|
min-width: 9rem;
|
|
padding: 0 0.625rem;
|
|
}
|
|
}
|
|
</style>
|