Create and edit vehicles
Multi-step add vehicle wizard and edit dialog fields.
Add vehicle
Where: Vehicles list → Add vehicle (requires create_vehicle and list_vehicle_type, list_device, list_nationality).
API: Vehicles.create with a cleaned payload built from the form.
Wizard structure (4 steps)
-
Basic information
- Vehicle type (required; from vehicle types list).
- Plate number (required; plate input).
- Previous plate number (optional).
- Secondary plate number (optional).
- Make, Model.
- Manufacturing year (select from generated year list).
- Chassis number.
- Motor engine number.
- Color (color combobox).
- Device (device picker).
- Status (status combobox).
-
Engine & dimension
- Engine capacity (L), Engine power (KW), Engine torque (Nm).
- Number of cylinders.
- Max speed, Distance per liter, Liters per hour (numeric fields as shown in the form).
-
Vehicle specification
- Width, Height, Passenger capacity, Cargo capacity, Ground clearance, Fuel capacity, Oil capacity (numeric fields).
-
Owner information
- Owner full name, Phone (phone input), House number, Nationality (nationality combobox).
Use Next / Back to move between steps; validation runs per step via the schema. Submit on the final step creates the vehicle and closes the dialog on success.
Edit vehicle
Where: Vehicles table → row Actions → Edit vehicle (requires update_vehicle and the same list permissions as add: list_vehicle_type, list_device, list_nationality).
The edit dialog reuses the same four-step structure and schema as add, pre-filled from the selected vehicle. Saving calls the update mutation with a cleaned payload analogous to create.
Troubleshooting
- Button not visible: Missing
create_vehicleor one of the dependent list permissions; admin must update the role. - Comboboxes empty: Backend lists (vehicle types, devices, nationalities) returned no rows for your scope.
- Validation errors: Complete required fields on the current step before Next; check plate and numeric formats.