feat: update authentication flow and user navigation
This commit is contained in:
@@ -9,7 +9,6 @@ import CitizenDashboard from '~/components/dashboard/CitizenDashboard.vue'
|
||||
import OperatorDashboard from '~/components/dashboard/OperatorDashboard.vue'
|
||||
import AdminDashboard from '~/components/dashboard/AdminDashboard.vue'
|
||||
|
||||
// Normalizziamo in uppercase nel caso il backend risponda con 'citizen' o 'CITIZEN'
|
||||
const currentDashboard = computed(() => {
|
||||
const role = user.value?.role?.toUpperCase()
|
||||
if (role === 'CITIZEN') return CitizenDashboard
|
||||
@@ -18,25 +17,24 @@ const currentDashboard = computed(() => {
|
||||
return null
|
||||
})
|
||||
|
||||
// Testi dinamici per l'Hero (la fascia blu in alto) in base al ruolo
|
||||
const heroTitle = computed(() => {
|
||||
const role = user.value?.role?.toUpperCase()
|
||||
if (role === 'ADMIN') return 'Pannello di Amministrazione'
|
||||
if (role === 'OPERATOR') return 'Gestione Operativa'
|
||||
return 'Le Mie Segnalazioni' // Cittadino
|
||||
return 'Dashboard'
|
||||
})
|
||||
|
||||
const heroSubtitle = computed(() => {
|
||||
const role = user.value?.role?.toUpperCase()
|
||||
if (role === 'ADMIN') return 'Gestione del sistema, delle aree e moderazione utenti'
|
||||
if (role === 'OPERATOR') return 'Prendi in carico e gestisci le segnalazioni in corso'
|
||||
return 'Traccia lo stato di tutte le tue segnalazioni e comunica con gli operatori' // Cittadino
|
||||
return 'Riepilogo rapido delle tue segnalazioni e dei punti cittadino'
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<div class="it-hero-wrapper it-primary">
|
||||
<div class="it-hero-wrapper it-primary hero-compact">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-12 text-center">
|
||||
@@ -53,7 +51,7 @@ const heroSubtitle = computed(() => {
|
||||
|
||||
<div class="container my-5">
|
||||
|
||||
<div class="row mb-4">
|
||||
<div class="row mb-3">
|
||||
<div class="col-12">
|
||||
<h4 class="mb-2 text-muted">
|
||||
Benvenuto, <strong>{{ user?.first_name }} {{ user?.last_name }}</strong>.
|
||||
@@ -61,7 +59,6 @@ const heroSubtitle = computed(() => {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Qui viene montato CitizenDashboard.vue, OperatorDashboard.vue o AdminDashboard.vue -->
|
||||
<component :is="currentDashboard" v-if="currentDashboard" />
|
||||
|
||||
<div v-else class="alert alert-warning" role="alert">
|
||||
|
||||
Reference in New Issue
Block a user