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

Materials Module

The Materials Module in E-Trans Dashboard allows users to add, update, and manage materials handled or transported by vehicles. This module ensures proper tracking of materials associated with customer orders and routes.


๐Ÿ”น Features


๐Ÿ–ฅ๏ธ Form Fields

Field Type Description
Material Description Text Name or description of the material (Required)

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

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

const material = ref({
  materialDesc: 'Cement Bags'
})

const saveMaterial = async () => {
  try {
    await apiClient.post('/material', material.value)
    console.log('Material added successfully')
  } catch (error) {
    console.error('Error saving material', error)
  }
}

๐Ÿ”— API Endpoints

Action Method Endpoint Description
Add Material POST /material Add a new material
Update Material PUT /material/{id} Update an existing material
Get Material GET /material/{id} Fetch a single materialโ€™s details
List Materials GET /material Fetch all materials

โœ… Workflow

  1. Navigate to Materials from the sidebar.
  2. Click Add Material or Edit an existing material.
  3. Fill in the Material Description field.
  4. Click Save or Update.
  5. Toast notifications will appear:

    • โœ… Success
    • โš  Warning (duplicate material)
    • โŒ Error (validation or server error)
  6. On success, the page redirects to Materials List.

๐Ÿ“ท Screenshot (Example)

Materials Module