fix: general type checks fixes

This commit is contained in:
2026-06-12 22:58:34 +02:00 Unverified
parent 1d8ad90151
commit 1dbbfbaa2e
6 changed files with 14 additions and 9 deletions
+4 -2
View File
@@ -18,7 +18,7 @@ const { data: statsRes, pending } = useAsyncData('admin-stats', () => getOvervie
<div class="card-wrapper card-space">
<div class="card card-bg text-center">
<div class="card-body">
<h2 class="text-primary">{{ statsRes.data?.total_users || 0 }}</h2>
<h2 class="text-primary">{{ statsRes.total_users || 0 }}</h2>
<p class="card-text">Utenti Registrati</p>
</div>
</div>
@@ -28,7 +28,9 @@ const { data: statsRes, pending } = useAsyncData('admin-stats', () => getOvervie
<div class="card-wrapper card-space">
<div class="card card-bg text-center">
<div class="card-body">
<h2 class="text-warning">{{ statsRes.data?.open_reports || 0 }}</h2>
<h2 class="text-warning">
{{ statsRes.open_reports ?? statsRes.reports_by_status?.find(s => s.status === 'OPEN')?.total ?? 0 }}
</h2>
<p class="card-text">Segn. Aperte</p>
</div>
</div>
@@ -82,7 +82,8 @@ const getStatusLabel = (status: string): string => {
return labels[status] || status
}
const formatDate = (dateString: string): string => {
const formatDate = (dateString?: string): string => {
if (!dateString) return ''
return new Date(dateString).toLocaleDateString('it-IT', {
day: '2-digit', month: '2-digit', year: '2-digit',
})
@@ -18,11 +18,11 @@ const handleTakeReport = async (id: number) => {
<div class="col-12 col-lg-6 mb-4">
<h3 class="mb-3 border-bottom pb-2">Da prendere in carico (OPEN)</h3>
<div class="list-group">
<div v-if="openReportsRes?.ok && openReportsRes.data?.items.length === 0" class="text-muted">
<div v-if="openReportsRes?.ok && openReportsRes.reports.length === 0" class="text-muted">
Nessuna nuova segnalazione in ingresso.
</div>
<div
v-for="report in openReportsRes?.data?.items" :key="report.id"
v-for="report in openReportsRes?.reports" :key="report.id"
class="list-group-item d-flex justify-content-between align-items-center"
>
<div>
@@ -40,11 +40,11 @@ const handleTakeReport = async (id: number) => {
<div class="col-12 col-lg-6 mb-4">
<h3 class="mb-3 border-bottom pb-2">Le mie assegnazioni</h3>
<div class="list-group">
<div v-if="assignedReportsRes?.ok && assignedReportsRes.data?.items.length === 0" class="text-muted">
<div v-if="assignedReportsRes?.ok && assignedReportsRes.reports.length === 0" class="text-muted">
Non hai segnalazioni in carico.
</div>
<NuxtLink
v-for="report in assignedReportsRes?.data?.items" :key="report.id"
v-for="report in assignedReportsRes?.reports" :key="report.id"
:to="`/operator/reports/${report.id}`"
class="list-group-item list-group-item-action d-flex justify-content-between align-items-center"
>