E-Trans Documentation
Developed by Pratik Dimble | Tested by Swapnil Kharat Contact Me

Routes Module

The Routes Module in E-Trans Dashboard allows users to add, update, and manage transportation routes between source and destination locations. This ensures proper route planning and logistics management.


πŸ”Ή Features


πŸ–₯️ Form Fields

Field Type Description
Source Text Starting point of the route (Required)
Destination Text Ending point of the route (Required)

⚑ Validations


πŸ“ Example Usage (Vue 3 + Pinia)

import { ref } from 'vue'
import apiClient from '@/axios'

const routeData = ref({
  source: 'Mumbai',
  destination: 'Pune'
})

const saveRoute = async () => {
  try {
    await apiClient.post('/routes', routeData.value)
    console.log('Route added successfully')
  } catch (error) {
    console.error('Error saving route', error)
  }
}

πŸ”— API Endpoints

Action Method Endpoint Description
Add Route POST /routes Add a new route
Update Route PUT /routes/{id} Update an existing route
Get Route GET /routes/{id} Fetch a single route’s details
List Routes GET /routes Fetch all routes

βœ… Workflow

  1. Navigate to Routes from the sidebar.
  2. Click Add Route or Edit an existing route.
  3. Fill in Source and Destination fields.
  4. Click Save or Update.
  5. Toast notifications will appear:

    • βœ… Success
    • ⚠ Warning (duplicate route)
    • ❌ Error (validation or server error)
  6. On success, the page redirects to Routes List.

πŸ“· Screenshot (Example)

Routes Module