fix: general type checks fixes
This commit is contained in:
@@ -18,7 +18,7 @@ const { data: statsRes, pending } = useAsyncData('admin-stats', () => getOvervie
|
|||||||
<div class="card-wrapper card-space">
|
<div class="card-wrapper card-space">
|
||||||
<div class="card card-bg text-center">
|
<div class="card card-bg text-center">
|
||||||
<div class="card-body">
|
<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>
|
<p class="card-text">Utenti Registrati</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -28,7 +28,9 @@ const { data: statsRes, pending } = useAsyncData('admin-stats', () => getOvervie
|
|||||||
<div class="card-wrapper card-space">
|
<div class="card-wrapper card-space">
|
||||||
<div class="card card-bg text-center">
|
<div class="card card-bg text-center">
|
||||||
<div class="card-body">
|
<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>
|
<p class="card-text">Segn. Aperte</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -82,7 +82,8 @@ const getStatusLabel = (status: string): string => {
|
|||||||
return labels[status] || status
|
return labels[status] || status
|
||||||
}
|
}
|
||||||
|
|
||||||
const formatDate = (dateString: string): string => {
|
const formatDate = (dateString?: string): string => {
|
||||||
|
if (!dateString) return ''
|
||||||
return new Date(dateString).toLocaleDateString('it-IT', {
|
return new Date(dateString).toLocaleDateString('it-IT', {
|
||||||
day: '2-digit', month: '2-digit', year: '2-digit',
|
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">
|
<div class="col-12 col-lg-6 mb-4">
|
||||||
<h3 class="mb-3 border-bottom pb-2">Da prendere in carico (OPEN)</h3>
|
<h3 class="mb-3 border-bottom pb-2">Da prendere in carico (OPEN)</h3>
|
||||||
<div class="list-group">
|
<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.
|
Nessuna nuova segnalazione in ingresso.
|
||||||
</div>
|
</div>
|
||||||
<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"
|
class="list-group-item d-flex justify-content-between align-items-center"
|
||||||
>
|
>
|
||||||
<div>
|
<div>
|
||||||
@@ -40,11 +40,11 @@ const handleTakeReport = async (id: number) => {
|
|||||||
<div class="col-12 col-lg-6 mb-4">
|
<div class="col-12 col-lg-6 mb-4">
|
||||||
<h3 class="mb-3 border-bottom pb-2">Le mie assegnazioni</h3>
|
<h3 class="mb-3 border-bottom pb-2">Le mie assegnazioni</h3>
|
||||||
<div class="list-group">
|
<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.
|
Non hai segnalazioni in carico.
|
||||||
</div>
|
</div>
|
||||||
<NuxtLink
|
<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}`"
|
:to="`/operator/reports/${report.id}`"
|
||||||
class="list-group-item list-group-item-action d-flex justify-content-between align-items-center"
|
class="list-group-item list-group-item-action d-flex justify-content-between align-items-center"
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -205,7 +205,7 @@ const formatDate = (dateString: string): string => {
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div v-for="(m, idx) in media" :key="m.id" class="col-6 col-md-4 mb-3">
|
<div v-for="(m, idx) in media" :key="m.id" class="col-6 col-md-4 mb-3">
|
||||||
<div v-if="m.media_kind === 'IMAGE'" class="ratio ratio-1x1 bg-light rounded overflow-hidden">
|
<div v-if="m.media_kind === 'IMAGE'" class="ratio ratio-1x1 bg-light rounded overflow-hidden">
|
||||||
<img :src="runtimeConfig.public.api + m.url" :alt="`Allegato ${idx + 1}`" class="object-fit-cover" />
|
<img :src="runtimeConfig.public.api + m.url" :alt="`Allegato ${Number(idx) + 1}`" class="object-fit-cover" />
|
||||||
</div>
|
</div>
|
||||||
<div v-else class="ratio ratio-1x1 bg-dark rounded d-flex align-items-center justify-content-center">
|
<div v-else class="ratio ratio-1x1 bg-dark rounded d-flex align-items-center justify-content-center">
|
||||||
<BIIcon name="it-video" size="xl" color="white" />
|
<BIIcon name="it-video" size="xl" color="white" />
|
||||||
|
|||||||
Vendored
+2
@@ -406,4 +406,6 @@ export interface OverviewStatsResponse {
|
|||||||
monthly_reports: { month: string; total: number }[];
|
monthly_reports: { month: string; total: number }[];
|
||||||
avg_resolution_hours_by_category: { category: string; value: number }[];
|
avg_resolution_hours_by_category: { category: string; value: number }[];
|
||||||
avg_resolution_hours_by_area: { area: string; value: number }[];
|
avg_resolution_hours_by_area: { area: string; value: number }[];
|
||||||
|
total_users?: number;
|
||||||
|
open_reports?: number;
|
||||||
}
|
}
|
||||||
+1
-1
@@ -17,7 +17,7 @@ export default defineNuxtConfig({
|
|||||||
},
|
},
|
||||||
|
|
||||||
site: {
|
site: {
|
||||||
url: 'http://localhost:3000',
|
url: 'https://visione.studentindipendenti.it',
|
||||||
name: 'Visione - Un\'occhio per la sicurezza del cittadino.',
|
name: 'Visione - Un\'occhio per la sicurezza del cittadino.',
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user