fix: bugs

This commit is contained in:
sajjadtalkhabi
2026-07-30 18:53:56 +03:30
parent bc9ce01d3f
commit 8fefb4568b
16 changed files with 529 additions and 52 deletions
+44 -24
View File
@@ -9,7 +9,7 @@
</template>
</BoxedIconTitleBlock>
<SkeletonLoaderBlock v-if="isLoading" :rows="1" :cols-per-row="3" />
<SkeletonLoaderBlock v-if="isLoading" :rows="2" :cols-per-row="3" />
<div v-else class="dashboard__stats">
<DashboardStatCard
v-for="(stat, i) in institutionStats"
@@ -19,6 +19,7 @@
:value="stat.value"
:unit="stat.unit"
:subtitle="stat.subtitle"
:to="stat.to"
/>
</div>
</section>
@@ -95,37 +96,56 @@ const ACCESS_LABELS = {
limited: 'محدود',
}
const formatThousands = (value) => {
const n = Number(value ?? 0)
return n >= 1000
? { value: toFaDigits(Math.round(n / 1000)), unit: 'هزار' }
: { value: toFaDigits(n), unit: 'نفر' }
}
const institutionStats = computed(() => {
const stats = dashboard.value.stats ?? {}
const users = formatThousands(stats.activeUsers)
return [
{
icon: 'user',
label: 'آمار کلی کاربران',
value: users.value,
unit: users.unit,
subtitle: 'کاربر فعال',
icon: 'users-three',
label: 'مجموع کل متقاضیان',
value: toFaDigits(stats.totalApplicants ?? 0),
unit: 'نفر',
subtitle: 'احراز شده و نشده',
to: { name: 'admin-users' },
},
{
icon: 'video',
label: 'دوره های ایجاد شده',
value: toFaDigits(stats.coursesCreated ?? 0),
unit: 'دوره',
subtitle: 'ایجاد شده',
icon: 'clock',
label: 'تعداد کاربران در انتظار ارزیابی',
value: toFaDigits(stats.awaitingEvaluation ?? 0),
unit: 'نفر',
subtitle: 'در انتظار ارزیابی',
to: { name: 'admin-user-verification' },
},
{
icon: 'shopping-bag',
label: 'دوره های فروش رفته',
value: toFaDigits(stats.coursesSold ?? 0),
unit: 'عدد',
subtitle: 'دوره فروش رفته',
icon: 'book',
label: 'آمار طلبه‌های ترم ۱',
value: toFaDigits(stats.term1Students ?? 0),
unit: 'نفر',
subtitle: 'ترم اول',
to: { name: 'admin-terms' },
},
{
icon: 'book',
label: 'آمار طلبه‌های ترم ۲',
value: toFaDigits(stats.term2Students ?? 0),
unit: 'نفر',
subtitle: 'ترم دوم',
to: { name: 'admin-terms' },
},
{
icon: 'book',
label: 'آمار طلبه‌های ترم ۳',
value: toFaDigits(stats.term3Students ?? 0),
unit: 'نفر',
subtitle: 'ترم سوم',
to: { name: 'admin-terms' },
},
{
icon: 'graduation-cap',
label: 'آمار فارغ‌التحصیلان',
value: toFaDigits(stats.graduates ?? 0),
unit: 'نفر',
subtitle: 'فارغ‌التحصیل',
to: { name: 'admin-users' },
},
]
})