The dashboard is the central hub of Avalúo Vehicular. Every time an authenticated user lands onDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/alber1802/AvaluoVehicular/llms.txt
Use this file to discover all available pages before exploring further.
GET /dashboard, the server computes live KPI figures, assembles the complete vehicle list with progress metadata, and passes everything to the React front-end in a single Inertia response. From here, evaluators can scan pending work, spot vehicles that still need attention, and jump directly into any step of an appraisal — all without leaving the page.
KPI Cards
TheStatsCards React component renders animated metric cards derived from the data the DashboardController sends down:
| Inertia prop | Label | How it is computed |
|---|---|---|
vehiculosHoy | Vehículos Evaluados Hoy | Vehiculo::whereDate('created_at', now()->toDateString())->count() — scoped to the evaluator when not admin |
comparacionAyer | Comparación vs. ayer | Same query shifted one day back; displayed as a trend figure on the card |
vehiculos | Vehículos Totales | Full vehicle collection owned by the user (or all records for admin) |
avaluos | Avalúos Completados | Count of rows in the avaluos table that belong to the user’s vehicles |
valoracionPromedio | Valor Promedio de Avalúo | SUM(final_estimacion) / COUNT(avaluos); defaults to 0 when no appraisals exist yet |
pendientes | Informes Pendientes | max(0, count_vehiculos - count_avaluos) — vehicles registered but without a completed appraisal |
$us) with two decimal places, calculated server-side as:
Vehicle List
Below the KPI cards is a full vehicle list built from a single eager-loaded query:- Brand (
id_marca) — populated fromMarcaVehiculo::all() - Year (
año_fabricacion) — distinct years ordered descending - Evaluator (
id) — list of users; admins see all users ordered by name, evaluators see all non-admin users excluding themselves
All search and filtering logic runs entirely client-side inside the React
evaluation-filters component. No additional HTTP request is made when a user types in the search box or changes a filter — the full dataset is already in memory, which keeps interaction instant regardless of list size.Progress Tracking
Before returning the vehicle collection,DashboardController maps a progreso object onto every vehicle. The three steps and the percentage are derived purely from relationship counts:
ProgressBar React component renders the percentage as a visual bar alongside the step labels, making it easy to identify exactly which step is still outstanding.
| Step | Relation checked | Table |
|---|---|---|
| Inspección de fallas | inspecciones | inspeccion |
| Sistemas / Mecánica | sistemas | sistemas |
| Imágenes del vehículo | imagenes | vehiculo_imagen |
Admin vs. Evaluator View
The controller readsAuth::user()->hasRole('admin') once and branches every query accordingly:
Admin (isAdmin = true)
- KPI queries run without a
WHERE id_evaluadorclause — figures reflect the entire platform. - The vehicle list includes all vehicles from all evaluators.
- The evaluator filter dropdown contains every registered user, ordered by name.
isAdmin = false)
- All queries are scoped to
WHERE id_evaluador = Auth::id(). - The
avaluoscount uses a nestedwhereHasto join throughvehiculo: - The evaluator filter shows all non-admin users except the evaluator themselves, useful when searching by colleague.
Route Reference
| Method | URI | Name | Middleware | Controller method |
|---|---|---|---|---|
GET | /dashboard | dashboard | auth, verified | DashboardController@index |