Commit Graph

73 Commits

Author SHA1 Message Date
natib21
67ba168a22 fix: convert numeric strings to numbers in fuel calculations
Problem:
- purchasesData from API returns numeric columns as strings
- Calling .toFixed() on strings throws "toFixed is not a function"
- Occurs in stats cards and table rows

Solution:
- Wrap p.liters, p.costPerLiter, p.totalCost in Number() before calculations
- Total Liters stat card: sum + Number(p.liters)
- Total Cost stat card: sum + Number(p.totalCost)
- Avg Price/L stat card: use Number() on both divisor and dividend
- Table rows: Number(purchase.liters).toFixed(2), etc.

Fixes render error in FuelPurchasePage when loading fuel purchases list.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-06-30 14:21:16 +00:00
natib21
ea8198f8a8 style: reduce horizontal padding on fleet dashboards
Add px="lg" (24px) to all Container components:
- FleetDashboard
- FuelPurchasePage
- FuelStatsPage
- MaintenancePage
- FinancialReportsPage
- TrackingPage

Reduces left/right padding from default to 24px,
making better use of horizontal screen space.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-06-30 14:13:58 +00:00
natib21
2e1c720b86 feat: add vehicle tracking/GPS map
New TrackingPage with:
- Interactive map grid showing vehicle locations
- Real-time GPS coordinates (mock data)
- Vehicle speed & heading display
- Vehicle selector dropdown
- Live status indicators
- All vehicles list with speed
- Click-to-track functionality
- Location details sidebar:
  * Latitude/Longitude
  * Current speed
  * Heading direction
  * Last update timestamp
  * View history button

Features:
- Grid-based map (no external dependencies)
- Vehicle markers (color-coded selected/inactive)
- SVG grid background (lat/lng lines)
- Responsive layout (map + sidebar)
- Mantine UI + brand colors
- Mock GPS generation per vehicle

Route: /dashboard/tracking
Sidebar: "Track Vehicles" in Fleet Management

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-06-30 14:08:21 +00:00
natib21
69d1d3073f style: standardize dashboard padding
All fleet pages now use consistent layout:
- Container size: xl
- Vertical padding: xl

Pages updated:
- FleetDashboard: size="xl" py="xl" (unchanged)
- FuelPurchasePage: lg → xl
- FuelStatsPage: lg → xl
- MaintenancePage: Added Container wrapper (xl, xl)
- FinancialReportsPage: Added Container wrapper (xl, xl)

Uniform spacing across all fleet management dashboards.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-06-30 13:59:20 +00:00
natib21
5af7f0606b style: apply consistent branding across fleet pages
Import freightBrand theme from @/theme/freight-brand

Color updates:
- Primary buttons: color="edr-green"
- Stat cards: top border #1B9E7A (freightBrand.primary)
- Status badges:
  * Active/Completed: edr-green
  * In Progress: edr-amber-soft
  * Maintenance: edr-amber-soft
  * Overdue: edr-red
  * Unassigned: edr-slate
- Ring progress:
  * Fuel: edr-accent (#F2A516)
  * Maintenance: edr-red
- Progress bars: edr-green, edr-red, edr-amber-soft
- Icons: Use edr-green, edr-blue, edr-accent, edr-red per metric

Pages updated:
- FleetDashboard: All metrics, progress bars, badges
- FuelPurchasePage: Record button
- MaintenancePage: Schedule button, badges
- FinancialReportsPage: Ring progress colors

Consistent palette across all fleet pages.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-06-30 13:52:27 +00:00
natib21
6a4a3d464a improve: fleet dashboard UI + add drivers
UI Improvements:
- Better card design with gradient icons
- Added title + description section
- Improved stat card layout (gradient backgrounds)
- Added change percentage badges
- Better color scheme (blue, cyan, orange, red)
- Striped + highlight on hover for tables
- Tab interface for vehicles/drivers

Driver Management:
- Fetch drivers from /drivers API
- Display driver list in table
- Show driver name, license, contact info
- Display assigned/unassigned status
- Count total drivers + assigned drivers in metrics

Metrics now show:
1. Total Vehicles
2. Total Drivers (NEW)
3. Fuel Spend
4. Maintenance Spend
5. Status breakdowns
6. Cost breakdown pie chart

Tabs show:
- Vehicles with registration, plate, model, status
- Drivers with name, license, contact, assignment

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-06-30 13:46:58 +00:00
natib21
814db8a17d feat: fleet dashboard page
Shows fleet overview + key metrics:
- Total vehicles, active count
- Total fuel spending
- Total maintenance spending
- Average fuel efficiency
- Fleet status (active/idle/maintenance)
- Operating cost breakdown (fuel vs maintenance pie chart)
- Fleet vehicle list (first 10)

Route: /dashboard/fleet-dashboard
Sidebar: Added to Fleet Management section

Metrics aggregate from:
- /vehicles (fleet size)
- /fuel/stats (fuel spending + efficiency)
- /maintenance/stats (maintenance spending)

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-06-30 13:38:35 +00:00
natib21
8e0cc7d5ee fix: vehicles data extraction in maintenance + financial pages
Both MaintenancePage and FinancialReportsPage were calling
vehiclesService.getAll() but not extracting res.data property.
Result was vehicles being undefined, causing .map error.

Fixed to match FuelPurchasePage pattern:
  const res = await vehiclesService.getAll()
  return res.data || []

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-06-30 13:10:47 +00:00
natib21
373c0356f2 feat: maintenance + financial reports frontend
MaintenancePage:
- Schedule maintenance (PREVENTIVE/CORRECTIVE/INSPECTION/REPAIR)
- View upcoming by vehicle
- Modal form with date, cost, provider, notes

FinancialReportsPage:
- Aggregate fuel + maintenance costs
- Period selector (3/6/12 months)
- Cost breakdown (percentages, ring progress)
- Operating insights (purchases, efficiency, items, avg cost)
- Cost per month calculation

Routes:
- /dashboard/maintenance
- /dashboard/financial-reports

Sidebar:
- "Maintenance" in Fleet Management
- "Financial Reports" in Fleet Management

QUERY_KEYS:
- FUEL, MAINTENANCE, FINANCIAL_REPORTS cache patterns

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-06-30 12:41:23 +00:00
natib21
f27f00d480 fix: use vehiclesService and add VEHICLES QUERY_KEYS
- Add VEHICLES to QUERY_KEYS constant
- Use vehiclesService.getAll() instead of direct API call
- Remove duplicate Vehicle type definitions
- Fix TypeScript type references

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-06-30 10:15:43 +00:00
natib21
3f81bb77ad feat: add fuel management frontend pages
- FuelPurchasePage: Record fuel purchases, calculate total costs
- FuelStatsPage: View fuel consumption stats, efficiency metrics
- Routes: /dashboard/fuel-purchases and /dashboard/fuel-stats
- Sidebar menu items in Fleet Management section

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-06-30 10:11:13 +00:00
marshal
1c01c792fc merge conflict 2026-06-29 12:45:40 +03:00
Marshal
47c91cad03 feat: enhance locomotive creation and management with optional code generation and default max pull weight 2026-06-28 23:02:40 +00:00
hagiye
9112e70400 Merge branch 'dev' of github.com:Tria-plc/edr-platform into Interchange 2026-06-27 21:05:20 +03:00
hagiye
fee4365b70 Import operation gate pass 2026-06-27 21:04:27 +03:00
natib21
f5eaa87564 fix ui 2026-06-27 14:15:14 +00:00
hagiye
4efef9bab3 inspection status column fix 2026-06-26 13:20:26 +03:00
hagiye
75d4c9b7c1 Autounload on train arrival 2026-06-26 12:17:31 +03:00
marshal
f8036a617a merge 2026-06-25 10:37:21 +03:00
Marshal
c8377958a8 fix(routes): prevent synthetic event recycling issue in name input handler 2026-06-25 00:48:14 +00:00
natib21
a1bb458a91 fix ui 2026-06-24 14:37:45 +00:00
natib21
f7bdd19a07 fix ui 2026-06-24 14:32:04 +00:00
natib21
c43201639d Merge branch 'freight/feature/vehicle_2' of github.com:Tria-plc/edr-platform into freight/feature/vehicle_2 2026-06-24 14:25:27 +00:00
natib21
5b9fcc0f89 fix btn color 2026-06-24 14:25:04 +00:00
yaschalew
28675cd5dc fix vehicle 2026-06-24 17:05:25 +03:00
natib21
79860c807c fix 2026-06-24 09:30:11 +00:00
Nathnael
cbbad02b29 fix: type error and other fixes 2026-06-23 13:14:06 +00:00
Nathnael Wondisha
56968e0709 Merge branch 'freight/develop' into freight/style/ui-sync 2026-06-23 09:51:24 +03:00
Nathnael
2700a3edec refactor: migrate from most of the custom hooks into the api.ts 2026-06-22 13:46:38 +00:00
Nathnael
74e03f2067 refactor: migrate to use the central api obj 2026-06-22 11:52:59 +00:00
yaschalew
7f51f24a77 fix conflict 2026-06-22 14:23:43 +03:00
Nathnael
8fb432e30f style: finalize the style of the dashboard 2026-06-22 08:52:45 +00:00
Nathnael
feddce8a0c style: use the proper primary color 2026-06-22 08:11:11 +00:00
Nathnael
9a224e9baf style: WIP ui updates 2026-06-22 07:44:03 +00:00
natib21
f620547b56 fix data table 2026-06-20 09:42:55 +00:00
natib21
963392edb3 fix data table 2026-06-20 09:38:12 +00:00
natib21
abccdffc38 fix data table 2026-06-20 09:33:04 +00:00
natib21
4de2c512f3 fix data table 2026-06-20 09:26:56 +00:00
natib21
3793d2004f fix data table 2026-06-20 09:04:01 +00:00
natib21
baa37968c8 fix data tables 2026-06-20 08:33:04 +00:00
natib21
d7a3a057ce fix data tables 2026-06-20 08:26:38 +00:00
natib21
21884b674e fix data table 2026-06-20 07:57:49 +00:00
natib21
555ff9d897 fix data table 2026-06-20 07:55:41 +00:00
natib21
97feb7b66b fix data table 2026-06-20 07:53:23 +00:00
natib21
6c640f3dc7 fix data table 2026-06-20 07:48:11 +00:00
natib21
c71acce6b5 fix data table 2026-06-20 07:46:45 +00:00
natib21
3d81318fc5 fix data table 2026-06-20 07:44:34 +00:00
natib21
fcd112cc29 fix data table 2026-06-20 07:40:47 +00:00
natib21
d97085009e fix data table 2026-06-20 07:37:37 +00:00
natib21
fa2bfa2ca4 fix 2026-06-20 07:31:01 +00:00