From 78d3e17d0232deebe32f8aea5928eb6c9ded4046 Mon Sep 17 00:00:00 2001 From: Simone Bierti Date: Tue, 7 Apr 2026 12:34:03 +0200 Subject: [PATCH] Implement role-based booking list views for ROLE_USER and ROLE_INCARICATO Co-Authored-By: Claude Sonnet 4.6 --- frontend-changes.md | 59 ++ .../prenotazione/prenotazione.component.ts | 74 ++- .../entities/prenotazione/prenotazione.vue | 503 ++++++++++++------ src/main/webapp/i18n/it/prenotazione.json | 27 +- 4 files changed, 491 insertions(+), 172 deletions(-) diff --git a/frontend-changes.md b/frontend-changes.md index a353c22..84c81c6 100644 --- a/frontend-changes.md +++ b/frontend-changes.md @@ -731,3 +731,62 @@ A profile completion check is shown on the home page to prompt users to complete - Bootstrap responsive design - Complete Italian translations - Security: users can only edit their own profile + +--- + +# Frontend Changes: Gestione e Visualizzazione Prenotazioni per Ruolo + +## Date + +2026-04-07 + +## Overview + +Implemented role-based booking management views as specified in `features/visualizzazione-prenotazioni.md`. The `prenotazione` list page now renders different UIs depending on the user's role: + +- **ROLE_USER**: sees their own bookings in a single table. Edit and Delete actions are hidden when a `Conferma` exists for that booking. A "Vedi conferma" button appears instead. +- **ROLE_INCARICATO**: sees two separate tables — *Prenotazioni in attesa* (no `Conferma`) and *Prenotazioni gestite* (with `Conferma`). A "Prendi in carico" button opens a modal to create the `Conferma` record; after saving, the row moves reactively from the first table to the second without a page reload. + +## Files Modified + +### 1. Component Logic + +**File:** `src/main/webapp/app/entities/prenotazione/prenotazione.component.ts` + +- Imported `useAccountStore`, `Authority`, `TipoConferma`, `ConfermaService` +- Added `isIncaricato` computed property (checks `account.authorities`) +- Added `prenotazioniPendenti` and `prenotazioniCompletate` computed arrays (derived from `prenotaziones`) +- Added modal state: `showPrendiInCaricoModal`, `selectedPrenotazione`, `confermaForm`, `isSubmittingConferma` +- Added methods: `prendiInCarico()`, `closePrendiInCaricoModal()`, `submitConferma()` + - `submitConferma()` calls `ConfermaService.create()` with `id` set to the prenotazione id (shared PK), then refreshes the list reactively + +### 2. Vue Template + +**File:** `src/main/webapp/app/entities/prenotazione/prenotazione.vue` + +- Split into two `