Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Nyverie/reservafacil/llms.txt

Use this file to discover all available pages before exploring further.

Users with the ADMIN role gain access to a dedicated management area at /admin. From here, admins can monitor all platform activity, confirm or cancel pending reservations, complete confirmed sessions, and maintain the catalogue of sports courts — without needing superadmin privileges.

Admin Dashboard Overview

The dashboard at /admin provides an at-a-glance summary of platform health through four stat cards:

Total Reservas

The total count of all reservations ever made on the platform, across all statuses and users.

Pendientes

Reservations currently awaiting admin review. A high number here signals a backlog that needs attention.

Canchas Activas

The number of courts currently marked as active and bookable by regular users.

Ingresos (S/)

The sum of total across all CONFIRMADA reservations — a real-time revenue figure in Peruvian soles.
Below the stat cards, a Reservas recientes table lists the 8 most recently created reservations with user name, court name, date, total amount, and status badge. A Ver todas → link leads to the full reservation management page.

Managing Reservations

Navigate to /admin/reservas to see every reservation on the platform ordered by creation date. The table columns are:
ColumnDescription
UsuarioBooking user’s full name and email address
CanchaName of the reserved court
Fecha / HoraDate and time window of the session
TotalBooking amount in soles
EstadoColoured status badge
AccionesAction buttons rendered by GestionReservaBtn

Action Buttons

The GestionReservaBtn component renders different controls depending on the reservation’s current status:

PENDIENTE

Two buttons appear: ✅ Confirmar promotes the reservation to CONFIRMADA, and ❌ Cancelar moves it directly to CANCELADA. Both send a PATCH /api/reservas/{id} request with the target status.

CONFIRMADA

A single 🏁 Completar button is shown. Clicking it marks the reservation as COMPLETADA once the session has taken place.

CANCELADA / COMPLETADA

No action buttons are rendered. The column shows Sin acciones to indicate the reservation is in a terminal state.
Each state transition is sent as:
PATCH /api/reservas/{id}
Content-Type: application/json

{ "estado": "CONFIRMADA" }   // or "CANCELADA" or "COMPLETADA"

Court Management

Navigate to /admin/canchas to access the full GestionCanchasPanel. This panel lists every court (active and inactive) in a grid and provides controls to create, edit, and toggle their availability.

Creating a New Court

Click the + Nueva Cancha button to open the creation modal. Fill in the following fields:
1

Nombre (required)

A human-readable name for the court, e.g. "Cancha Fútbol 1" or "Pista de Tenis Norte". This name appears on CanchaCard tiles and in all reservation records.
2

Tipo (required)

Select the sport type from the dropdown. The four available options map directly to the Prisma enum values:
ValueSportEmoji
FUTBOLFootball
TENISTennis🎾
BASQUETBasketball🏀
VOLLEYBALLVolleyball🏐
3

Precio/hora (required)

Set the hourly rate in soles (S/). This value is used by ReservaForm to calculate the booking total automatically.
Field: precioPorHora
Type: number (min: 1)
Example: 50
4

Capacidad (required)

Maximum number of persons the court can accommodate. Displayed on the CanchaCard to help users decide whether their group fits.
Field: capacidad
Type: integer (min: 1)
Example: 10
5

Descripción (optional)

Free-text description covering surface type, lighting, amenities, etc. Shown in smaller text on the court card.
6

Save

Click Crear cancha. The panel sends a POST /api/canchas request — only ADMIN and SUPERADMIN roles are permitted by the API. On success, the new court appears in the grid immediately.
{
  "nombre": "Cancha Fútbol 1",
  "tipo": "FUTBOL",
  "descripcion": "Césped sintético, iluminación LED",
  "precioPorHora": 50,
  "capacidad": 10
}

Editing an Existing Court

Click the ✏️ Editar button on any court card to open the same modal pre-populated with the court’s current values. Make your changes and click Guardar cambios — the panel sends a PUT /api/canchas/{id} request with the updated fields.

Toggling a Court Active / Inactive

Each court card shows a lock button (🔒 when active, 🔓 when inactive). Clicking it flips the activa flag via PUT /api/canchas/{id}. Inactive courts are hidden from the user-facing /dashboard/canchas grid and cannot be booked until reactivated.
Only SUPERADMIN users can permanently delete a court. Admins can deactivate courts using the toggle, which hides them from users while preserving all historical reservation data linked to that court.

Build docs developers (and LLMs) love