Vehicle Module
The Vehicle Module in E-Trans Dashboard allows users to add, update, and manage vehicles associated with transporters. This module ensures accurate tracking of all vehicles used for logistics operations.
πΉ Features
- Add new vehicles
- Edit existing vehicle details
- Real-time toast notifications for success, warning, or error
- Automatic redirection after save/update
π₯οΈ Form Fields
| Field | Type | Description |
|---|---|---|
| Transporter Name | Text | Name of the transporter (Required) |
| Vehicle Number | Text | Unique vehicle registration number (Required) |
| Vehicle Type | Text | Type of vehicle (Truck, Van, etc.) (Required) |
π Example Usage (Vue 3 + Pinia)
import { ref } from 'vue'
import apiClient from '@/axios'
const vehicle = ref({
transporterName: 'ABC Transport',
number: 'MH12AB1234',
type: 'Truck'
})
const saveVehicle = async () => {
try {
await apiClient.post('/vehicle', vehicle.value)
console.log('Vehicle added successfully')
} catch (error) {
console.error('Error saving vehicle', error)
}
}
π API Endpoints
| Action | Method | Endpoint | Description |
|---|---|---|---|
| Add Vehicle | POST | /vehicle |
Add a new vehicle |
| Update Vehicle | PUT | /vehicle/{id} |
Update an existing vehicle |
| Get Vehicle | GET | /vehicle/{id} |
Fetch a single vehicleβs details |
| List Vehicles | GET | /vehicle |
Fetch all vehicles |
β Workflow
- Navigate to Vehicles from the sidebar.
- Click Add Vehicle or Edit an existing vehicle.
- Fill in all required fields.
- Click Save or Update.
-
Toast notifications will appear:
- β Success
- β Warning (e.g., duplicate vehicle number)
- β Error (validation failure or server error)
- On success, the page redirects to Vehicle List.
π· Screenshot (Example)
