The ISBO admin dashboard gives staff a real-time view of all equipment loans: who has what, which loans are overdue, and a full searchable history. It is protected behind a username/password login backed by PHP sessions, and it exposes tools for manually marking items as returned, undoing accidental returns, editing loan details, and exporting PDF reports — all without touching the database directly.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/gavafue/registroComponentesMultimedia/llms.txt
Use this file to discover all available pages before exploring further.
Accessing the Admin Panel
Click the lock icon (🔒) button in the top-right corner of the application header. This callsUI.switchView('view-admin') and immediately attempts loadAdminDashboard() to restore an active session if one already exists.
#admin-login-card) is displayed. If a session is already active (for example, the page was refreshed), the dashboard appears directly without re-entering credentials.
Logging In
Enter your Usuario and Contraseña and click Ingresar. The form submits viaAPI.login():
API.login() sends a POST to auth.php?action=login:
password_verify() against the stored bcrypt hash, then sets the PHP session:
loadAdminDashboard() hides the login card, shows #admin-dashboard, loads the KPI metrics, and populates the Pendientes table.
PHP sessions are stored on disk in
api/sesiones/ (relative to the project root) rather than the system default session path. If the web server restarts, all session files in that directory are lost and administrators will need to log in again.KPI Metric Cards
The dashboard header displays four animated metric cards populated byAPI.getStats() → GET loans.php?action=stats:
easeOutCubic curve over 600 ms.
| Card | Element ID | SQL logic |
|---|---|---|
| Préstamos Hoy | metric-today | COUNT(*) WHERE DATE(checkout_time) = TODAY |
| Activos | metric-active | COUNT(*) WHERE status = 'active' |
| Devueltos Hoy | metric-returned | COUNT(*) WHERE status = 'returned' AND DATE(return_time) = TODAY |
| Atrasados | metric-delayed | COUNT(*) WHERE status = 'active' AND checkout_time < NOW() - INTERVAL 12 HOUR |
$_SESSION['user_id'] is not set:
Admin Tabs
The dashboard is organised into three tabs, toggled by clicking the tab buttons at the top of the panel:Pendientes / Alertas
Lists all loans with
status = 'active', ordered by checkout time ascending (oldest first). Highlights overdue items with an alert badge.Historial Completo
All loans in the database, newest first, with full filter controls and pagination.
Reportes
Summary statistics and PDF export buttons.
Pendientes / Alertas Tab
The Pendientes table is loaded automatically when the dashboard appears. Columns:| Column | Description |
|---|---|
| Fecha Retiro | Formatted checkout date/time (DD/MM/YY HH:MM) |
| Cédula | Student’s national ID |
| Nombre | Full name |
| Grupo | Class group (or – if not provided) |
| Equipamiento | Equipment description |
| Firma Retiro | Thumbnail of the checkout signature image; click to enlarge |
| Alerta | Status badge (see below) |
| Acción | Edit and mark-as-returned buttons |
Alerta Badge
Each row evaluates whether the loan is overdue. If more than 12 hours have elapsed sincecheckout_time, the badge shows an orange exclamation-triangle icon; otherwise a grey clock icon is shown:
delayed metric in the stats endpoint.
Row Actions
Each row in Pendientes has two action buttons:- Edit (pencil icon,
data-action="edit-details") — Opens the inline edit modal. - Mark as returned (check icon,
data-action="mark-returned") — Closes the loan server-side without requiring a student signature, useful when a student forgets to register the return themselves.
Historial Completo Tab
The full history table is loaded on first click of the Historial Completo tab. It shows every loan record in the database, sorted newest-first.Columns
| Column | Notes |
|---|---|
| ID | Internal record ID, prefixed with # |
| Retiro | Checkout date/time |
| Cédula | National ID |
| Nombre | Full name |
| Grupo | Class group |
| Equipamiento | Equipment description |
| Firma Retiro | Clickable thumbnail |
| Devolución | Return date/time, or – if still active |
| Firma Devolución | Clickable thumbnail, or – if still active |
| Observaciones | Return observations, or – |
| Estado | Icon: ✓ returned, ⏱ pending, ⚠ delayed |
| Acción | Edit + toggle status buttons |
Filters
The filter bar above the history table supports four simultaneous criteria:| Filter | Control | Behaviour |
|---|---|---|
| Buscar | #admin-search text input | Live search as you type; matches name or CI (case-insensitive) |
| Desde | #date-from date picker | Lower bound on checkout_time date |
| Hasta | #date-to date picker | Upper bound on checkout_time date |
| Estado | #status-filter dropdown | Todos / Pendientes (active) / Devueltos (returned) |
Pagination
The history table paginates at 10 records per page. Navigation controls appear below the table when there is more than one page:Página N de M.
Row Actions in History
| Button | data-action | Behaviour |
|---|---|---|
| Pencil icon | edit-details | Opens the edit modal for the loan’s equipment description |
| Check icon | mark-returned | Marks an active loan as returned (admin action, no signature required) |
| Undo icon | mark-active | Reverts a returned loan back to active status |
PUT request that clears return_time, return_signature, and return_observation on the database row:
Signature Thumbnails
Anywhere a signature image is displayed (both in Pendientes and Historial), it appears as a small thumbnail. Clicking any thumbnail opens a full-screen modal with the enlarged image:Editing a Loan Record
Clicking the pencil icon on any row (in either table) opens the Editar Préstamo modal. The modal pre-fills the#edit-loan-equipment textarea with the current equipment description. After editing, click Guardar cambios to save.
The modal calls API.updateLoanDetails():
PUT to loans.php with the new value. This endpoint requires an active admin session ($_SESSION['user_id'] must be set). Attempting to save an empty description is blocked client-side with an error toast.
Close the modal without saving by clicking the ban icon cancel button, the × close button, or clicking the backdrop outside the modal.
Reportes Tab
The Reportes tab shows a summary of three aggregate figures and provides two PDF export buttons.Total Histórico
report-total — total number of loan records ever created (all statuses).Sin Devolver
report-active — current count of loans with status = 'active'.Atrasados
report-delayed — loans active for more than 12 hours.API.getStats() each time the Reportes tab is opened.
PDF Export
Two buttons generate downloadable PDF files using the html2pdf.js library:| Button | ID | Output file | Contents |
|---|---|---|---|
| Reporte Completo (PDF) | #btn-pdf-full | Reporte_Completo_ISBO.pdf | All loan records |
| Solo Pendientes (PDF) | #btn-pdf-pending | Reporte_Pendientes_ISBO.pdf | Active loans only |
#btn-export-filtered-pdf) in the Historial toolbar exports only the currently filtered result set as Reporte_Filtrado_ISBO.pdf.
All PDFs are rendered landscape A4, include signature images inline, and carry an ISBO header with generation timestamp. The PDF is built by temporarily appending a styled div to document.body, capturing it with html2canvas at 2× scale, and then removing the element after saving.
Logging Out
Click the Salir button in the dashboard header. This callsAPI.logout():
#admin-dashboard, shows #admin-login-card, and resets the login form — the dashboard data is no longer accessible until the next successful login.