feat: implement dynamic dashboard routing with role-specific views
- Create unified dashboard page that renders dashboard view based on user role - Implement CitizenDashboard with local filtering, pagination, and user rewards points visualization - Implement OperatorDashboard with list of open/assigned reports and assignment actions - Implement AdminDashboard with admin statistics overview card components and management links
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
<script setup lang="ts">
|
||||
const { getOpenReports, getAssignedReports, takeReport } = useOperator()
|
||||
|
||||
const { data: openReportsRes, refresh: refreshOpen } = useAsyncData('open-reports', () => getOpenReports({ per_page: 5 }))
|
||||
const { data: assignedReportsRes, refresh: refreshAssigned } = useAsyncData('assigned-reports', () => getAssignedReports({ per_page: 5 }))
|
||||
|
||||
const handleTakeReport = async (id: number) => {
|
||||
const res = await takeReport(id)
|
||||
if (res.ok) {
|
||||
await Promise.all([refreshOpen(), refreshAssigned()])
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="row">
|
||||
<!-- Colonna Sinistra: Segnalazioni da prendere in carico -->
|
||||
<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">
|
||||
Nessuna nuova segnalazione in ingresso.
|
||||
</div>
|
||||
<div
|
||||
v-for="report in openReportsRes?.data?.items" :key="report.id"
|
||||
class="list-group-item d-flex justify-content-between align-items-center"
|
||||
>
|
||||
<div>
|
||||
<h6 class="mb-1">{{ report.address }}</h6>
|
||||
<small class="text-muted">{{ report.created_at }}</small>
|
||||
</div>
|
||||
<button @click="handleTakeReport(report.id)" class="btn btn-outline-primary btn-sm">
|
||||
Prendi in carico
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Colonna Destra: Segnalazioni in gestione dell'operatore -->
|
||||
<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">
|
||||
Non hai segnalazioni in carico.
|
||||
</div>
|
||||
<NuxtLink
|
||||
v-for="report in assignedReportsRes?.data?.items" :key="report.id"
|
||||
:to="`/operator/reports/${report.id}`"
|
||||
class="list-group-item list-group-item-action d-flex justify-content-between align-items-center"
|
||||
>
|
||||
<div>
|
||||
<h6 class="mb-1">{{ report.address }}</h6>
|
||||
<span class="badge bg-warning text-dark">{{ report.status }}</span>
|
||||
</div>
|
||||
<BIIcon name="it-chevron-right" size="sm" color="primary" />
|
||||
</NuxtLink>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
Reference in New Issue
Block a user