> ## Documentation Index
> Fetch the complete documentation index at: https://docs.encoreos.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Vehicles

> Manage fleet vehicles and drivers — status, fuel type, and site filters, with trip, fuel, mileage, and maintenance history.

This screen lists all fleet vehicles and is available at `/fm/fleet/vehicles`.

## Overview

The Fleet Vehicles page uses `useFleetVehicles` to load a paginated list of vehicles (page size 20). Filters include: text search (VIN, plate, make, model), **Status** (from `VEHICLE_STATUSES`), **Fuel Type** (from `FUEL_TYPES`), and **Site** (fetched from `pf_sites`). URL query parameters sync with filter state and page number. The data table shows: Vehicle (year/make/model with vehicle number), VIN (truncated, last 6), Plate, Status badge, Odometer, Assigned Driver, and Site. An **Add Vehicle** button opens `FleetVehicleFormDialog`. Pagination controls appear when total pages exceed one.

## Who it's for

Requires permission `fm.dashboard.view`. Adding vehicles requires `fm.fleet.create`.

## Before you start

* Hold `fm.dashboard.view`.
* Sites must be configured for the site filter to populate.

## Finding a vehicle

1. Navigate to `/fm/fleet/vehicles` via the Fleet Dashboard or sidebar.
2. Use the search bar and Status, Fuel Type, and Site dropdowns.
3. Click **Add Vehicle** to open the form dialog; provide VIN, make, model, year, fuel type, and other required fields.
4. Click any vehicle row to navigate to `/fm/fleet/vehicles/:id`.
5. Use Previous/Next buttons to page through large vehicle lists.

* **VIN** — Vehicle Identification Number, displayed truncated (last 6 characters) in the table.
* **Vehicle status** — values from `VEHICLE_STATUS_LABELS`: active, maintenance, retired, disposed.
* **Fuel type** — values from `FUEL_TYPE_LABELS` (from `FUEL_TYPES` array).

## Viewing a vehicle

The Vehicle Detail page (`/fm/fleet/vehicles/:id`) loads a vehicle via `useFleetVehicleDetail`. The header shows year/make/model, status badge, and vehicle number. The right side has action buttons: Assign/Reassign Driver, Change Status, and Edit. A two-column grid holds: a **Vehicle Details** card (VIN, plate, color, fuel type, odometer), a **Registration & Insurance** card (registration expiration, insurance expiration, inspection expiration — each in warning color if within 30 days), and a tabbed **History** card with four tabs: **Trips** (date, type, destination, miles), **Fuel** (date, gallons, station, cost, MPG), **Mileage** (odometer readings), and **Maintenance** (schedules with next due date/odometer and overdue badge). A sidebar contains: Assignment (site, assigned driver), Odometer (current reading with Record Reading button), Quick Actions (Log Trip, Log Fuel), and conditional Expiration Alerts.

Requires `fm.dashboard.view`. Driver assignment requires `fm.fleet.edit`; confirm with SME.

Before you start: the vehicle must exist and not have been deleted.

1. From the Vehicles list, click any row to navigate to `/fm/fleet/vehicles/:id`.
2. Check VIN, plate, color, fuel type, and odometer.
3. Review expiration dates; warnings appear 30 days before expiry.
4. Click **Assign Driver** (or **Reassign**) to open `AssignDriverDialog`.
5. Click **Change Status** to open `ChangeVehicleStatusDialog`.
6. In the sidebar Odometer card, click **Record Reading** to open `RecordMileageDialog`.
7. Click **Log Trip** in the Quick Actions sidebar card to open `FleetTripFormDialog`.
8. Click **Log Fuel** in the Quick Actions sidebar card to open `FleetFuelLogFormDialog`.
9. Use the Trips, Fuel, Mileage, and Maintenance tabs to audit vehicle activity.

* **Expiration alerts** — registration, insurance, and inspection expirations within 30 days surface a warning sidebar card.
* **Maintenance schedules** — from `vehicle.maintenance_schedules`; overdue schedules show a destructive badge.
* **MPG calculated** — computed and stored per fuel log entry.

## Viewing a driver

The Driver Detail page (`/fm/fleet/drivers/:id`) loads a driver via `useFleetDriverDetail`. The header shows first/last name, active/inactive badge, CDL badge (if applicable), and email. Action buttons include Activate/Deactivate toggle and Edit. A two-column grid holds: **Contact Information** (email with mailto link, phone with tel link, linked user profile with avatar), **License & CDL** (license number in monospace, state, class, expiration — with warning/destructive color based on days remaining; CDL endorsements displayed as `CDL_ENDORSEMENT_LABELS` badge tooltips and CDL expiration), and tabbed **History** (Assigned Vehicles list linked to vehicle detail pages, Recent Trips with type/destination/miles). A sidebar contains: Status card with Activate/Deactivate button, conditional Expiration Alerts (license and CDL), Notes, and Quick Stats (assigned vehicle and trip counts). A Delete button opens a destructive confirmation dialog.

Requires `fm.dashboard.view`. Deactivation and deletion require `fm.fleet.edit` or `fm.fleet.delete` — confirm with SME.

Before you start: the driver must exist and not have been soft-deleted.

1. Navigate to `/fm/fleet/drivers/:id` (typically by clicking a driver in the Fleet Dashboard or from a vehicle's assigned driver).
2. Check email, phone, and linked user profile.
3. Check license number, state, class, and expiration; CDL endorsements and expiration if applicable.
4. If the Expiration Alerts sidebar card is visible, license or CDL is expiring within 30 days.
5. Use the Deactivate/Activate button to toggle the driver's active status.
6. Click **Edit** to open `FleetDriverFormDialog` and update driver information.
7. Click **Delete** and confirm the destructive dialog to soft-delete the driver. The driver is unassigned from all vehicles.

* **CDL endorsements** — labels from `CDL_ENDORSEMENT_LABELS`, displayed as tooltip badges.
* **Expiration alerts** — license and CDL expiration within 30 days; expired dates shown in destructive color.
* **Soft delete** — the `softDeleteDriver` mutation; confirm whether data is preserved (confirm with SME).

## Related

<Columns cols={2}>
  <Card title="Facilities & Inventory" icon="warehouse" href="/fm/overview">
    Facilities & Inventory core overview.
  </Card>

  <Card title="Governance & parity" icon="scale-balanced" href="/governance/index">
    Documentation coverage and governance.
  </Card>
</Columns>

<Note>
  This page documents shipped product behavior. It is not medical, legal, or
  billing advice. Verify against your organization's policies and applicable
  regulations before using it for clinical, compliance, or billing decisions.
  Protected health information (PHI) shown in the product is governed by your
  tenant's access controls and is never exposed in this documentation.
</Note>

<Accordion title="Documentation sources">
  * src/routes/fm.tsx
  * src/cores/fm/pages/FleetVehiclesPage.tsx
  * src/cores/fm/pages/FleetVehicleDetailPage.tsx
  * src/cores/fm/pages/FleetDriverDetailPage.tsx
</Accordion>
