The admin dashboard, rendered byDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/fredy-rizo/despacho-frontend/llms.txt
Use this file to discover all available pages before exploring further.
dashboardPage.vue at the /dashboard route, gives authorized staff a full view of all reservation submissions made through the public booking form. Every API call is authenticated with a Bearer token extracted from localStorage, and every response is passed through ValidateSession to catch expired or invalid sessions before they cause silent failures. The page loads automatically on mount and supports real-time client-side search across client names and email addresses.
Access Control
The dashboard is not guarded by Vue Router navigation guards. Instead, protection is enforced at the data-layer: every function that touches the API first callsgetAuthHeaders(), which internally invokes validateUser({ rol: 1 }).
Session Validation
After each API response,ValidateSession(data, router) is called with the parsed JSON and the Vue Router instance. If the server returns a 401 or 403 status code embedded in the response body, ValidateSession clears localStorage and redirects to /login automatically:
validateUser before the request, ValidateSession after) ensures stale tokens are handled both proactively and reactively.
Loading Reservations
cargarReservas(modo) is called on onMounted() (defaulting to 'all') and again whenever a filter button is clicked. The modo argument determines which endpoint is targeted:
cargarReservas('all') — All reservations
cargarReservas('all') — All reservations
reservation_accepted status.cargarReservas('true') — Accepted reservations
cargarReservas('true') — Accepted reservations
reservation_accepted === true.cargarReservas('false') — Pending reservations
cargarReservas('false') — Pending reservations
reservation_accepted === false.| Button label | cargarReservas argument |
|---|---|
| Todas | 'all' |
| Aceptadas | 'true' |
| Pendientes | 'false' |
Reservations Table
Reservations are displayed in aq-table with row-key="_id", a loading state controlled by loading.value, and rows sourced from the filteredRows computed property.
Table Columns
name | label | field | align |
|---|---|---|---|
full_name | Nombre | full_name | left |
email | email | left | |
required_service | Servicio | required_service | center |
preferred_date | Fecha | preferred_date | center |
preferred_hour | Hora | preferred_hour | center |
actions | Acciones | actions | center |
Client-Side Search
The search input (q-input, outlined, dense, clearable, rounded) is bound to the search ref. The filteredRows computed property filters reservas on every keystroke:
.toLowerCase() on both the row value and the search term.
Row Actions
Each row in theactions column renders up to four q-btn elements (unelevated, rounded, dense). The Confirmar button is conditionally rendered only when props.row.reservation_accepted === false.
1 — Ver (View Detail)
Clicking Ver setsdetalle.value = row and opens the modalDetalle dialog. The modal displays every field from the reservation:
Fields shown
full_name, email, phone, required_service, preferred_date, preferred_hour, additional_message (falls back to “Sin mensaje” when empty)Status chip
A
— Confirmada (
— Pendiente (
q-chip at the top of the modal shows the reservation state:— Confirmada (
color="green-7") when reservation_accepted === true— Pendiente (
color="orange-7") when reservation_accepted === false2 — Confirmar (Confirm Reservation)
Trigger
Staff clicks Confirmar on any row where
reservation_accepted is false. The button is hidden for already-confirmed reservations.Build request
confirmarReserva(row) calls getAuthHeaders() to obtain a valid Bearer token, then serializes the row’s existing date and time:3 — Modificar (Edit Date/Time)
Clicking Modificar opens themodalModificar dialog pre-populated with the row’s existing date and time:
q-input fields:
preferred_date—type="date", outlined, densepreferred_hour—type="time", outlined, dense
confirmarModificacion() calls the same POST /api/form/reserve/accept/:id/reserve endpoint with the new values, closes the modal on success, shows a positive notify ("Reserva modificada correctamente"), and re-fetches the list.
4 — Eliminar (Delete)
cargarReservas() after the request completes.
API Reference
All dashboard endpoints require a valid Bearer token in theAuthorization header.
The primary status field on every reservation object.
true means the reservation has been confirmed by staff; false means it is still pending review.MongoDB ObjectId used as the
row-key in q-table and as the :id path parameter in accept/remove endpoints.Client’s full name as submitted through the public booking form.
Client’s email address.
Client’s phone number.
One of the six legal service areas:
Derecho civil, Derecho familiar, Derecho mercantil, Derecho penal, Derecho laboral, or Derecho inmobiliario.Preferred consultation date in
YYYY-MM-DD format.Preferred consultation time in
H:MM AM/PM format (e.g., "10:30 AM").Optional message from the client. May be an empty string or absent.
Logout
The Cerrar sesión button in the page header executes a one-liner that wipes all local storage and redirects to the public landing page:/dashboard will trigger the validateUser redirect back to /login.