Skip to content

About

Vehicle/order movement tracker and fleet management app for logistics operations. Single HTML file, local SQLite via sql.js, Leaflet maps, audit logging, password lock.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🚚 DispatchDesk

A browser-based Single Page Application (SPA) for managing and tracking vehicle dispatch orders. Built with vanilla HTML/CSS/JS and sql.js β€” no server, no build process, no database installation required.

Status License JavaScript SQLite Leaflet

πŸš› Fleet Dispatch Β· πŸ—ΊοΈ Route Mapping Β· πŸ“Š Analytics Charts Β· πŸ–¨οΈ Print & PDF Reports Β· πŸ“’ Address Book Β· πŸ”§ Fleet Registry Β· πŸ’Ύ Local SQLite Storage Β· πŸ”’ Password Lock


πŸ“‹ Overview

Track, manage, and optimize fleet dispatch operations from a single HTML file. All data is stored locally in your browser using SQLite (via sql.js) and synchronized to IndexedDB for persistence.


⚠️ Note on API Keys

Built-in API keys are provided for evaluation only and are shared across all users of this repository. They may be rate-limited or exhausted at any time. For production use, add your own keys in Settings β†’ Map & Routing.

The app degrades gracefully without keys: routing falls back to straight lines, reverse geocoding returns empty, and map tiles use a free fallback. Nothing will crash β€” you'll just lose the enhanced features.


✨ Features

πŸ“¦ Order Management

  • Single & Bulk Entry β€” Add orders one-by-one or via the grid-based multiple entry form
  • Full CRUD β€” Create, read, update, and delete orders with automatic audit logging
  • Duplicate Detection β€” Warns on duplicate ERP-style order numbers
  • Field Validation β€” Required field checks and date logic (ETA must be β‰₯ dispatch date)
  • Fleet Validation β€” Head and attachment numbers validated against fleet registry
  • Address Book Validation β€” Driver badge and customer number validated against address book

πŸ“’ Address Book

  • Driver & Customer Registry β€” Store and reuse driver and customer details
  • CSV Import/Export β€” Bulk manage entries via CSV
  • Type Filtering β€” Quick filter between drivers and customers
  • Order Form Integration β€” Select entries directly from order forms

πŸš› Fleet Management

  • Fleet Registry β€” Track tractor heads, trailers, tippers, and rigid trucks using standardized three-letter prefixes
  • Supported Prefixes β€” TRK- (tractor head), FBT- (flatbed trailer), CST- (curtain trailer), EXT- (extendable trailer), BLK- (bulker), DVN- (box trailer), DMP- (tipper), MDT- (medium truck)
  • CRUD Operations β€” Add, edit, delete fleet units with branch assignment
  • CSV Import/Export β€” Bulk manage fleet units via CSV
  • Order Integration β€” Select fleet units directly from order forms
  • Validation β€” Orders can only use registered fleet units

Prefix conventions are documented in fleet_asset_prefixes.csv.

πŸ—ΊοΈ Route Mapping

  • Leaflet Integration β€” Visualize order routes on an interactive map
  • Multiple Tile Styles:
    • 🌍 OSM Standard (with automatic fallbacks)
    • πŸ›°οΈ Stadia Alidade Satellite
    • πŸ—ΊοΈ Esri National Geographic
    • 🎨 CartoDB Voyager (requires CARTO API key)
    • πŸ—ΊοΈ MapTiles English (requires MapTiles API key)
    • πŸ”οΈ MapTiler Topo-4 (requires MapTiler API key)
    • πŸ™οΈ Jawg Streets (requires Jawg access token)
  • Geoapify Routing β€” Truck-aware route calculation with vehicle profile, dimensions, traffic, and toll avoidance
  • Reverse Geocoding β€” Auto-fill location names from coordinates via Geoapify
  • Map Style Selector β€” Switch map styles directly from the map view

πŸ“Š Analytics & Reports

  • Status Distribution β€” Doughnut chart with count/percentage labels
  • Daily Dispatch Trend β€” Line chart of orders over time
  • Dispatch by Branch β€” Horizontal bar chart
  • Customer Performance β€” Top 10 customers by order volume

πŸ–¨οΈ Print & Export

  • Print/PDF Reports β€” Filtered, paginated reports in portrait/landscape
  • Excel Export β€” Export filtered orders to .xlsx
  • JSON/SQL Backup β€” Full database export and restore

⚑ Productivity

  • Keyboard Shortcuts β€” Alt+N (new order), Alt+M (monitor), Alt+F (search), Esc (close modal)
  • Column Customization β€” Rename columns and toggle visibility in the main table
  • Monitor Columns β€” Show/hide columns and click-to-sort in the Order Monitor
  • Bulk Operations β€” Multi-row entry with confirmation
  • Auto-scroll Modals β€” Modals open scrolled to top

πŸ–₯️ Monitoring

  • Tabbed Monitor β€” In Progress / Completed / Cancelled views
  • Branch / Terminal Toggle β€” Filter by branch or by reporting terminal
  • Real-time Status β€” Latest tracking status per order via SQLite view

πŸ”’ Data & Security

  • Local-First β€” All data stays in your browser
  • IndexedDB Persistence β€” Automatic backup to browser storage
  • Audit Trail β€” Full history of create/update/delete/import/export actions
  • Password Lock β€” SHA-256 hashed password with configurable auto-lock timeout
  • No External Accounts β€” No login, no cloud sync, no tracking

πŸ› οΈ Tech Stack

Component Technology
Frontend Vanilla HTML5, CSS3, JavaScript (ES6+)
Styling Tailwind CSS (vendored Play CDN) + custom CSS
Database SQLite via sql.js
Persistence IndexedDB (automatic sync)
Maps Leaflet + Geoapify
Charts Chart.js v4
Export ExcelJS

πŸ—‚οΈ Project Structure

DispatchDesk/
β”œβ”€β”€ index.html                 # Entire application: UI, styles, and app logic (single file)
β”œβ”€β”€ README.md
β”œβ”€β”€ LICENSE
β”œβ”€β”€ .gitignore
β”œβ”€β”€ fleet_asset_prefixes.csv   # Asset category β†’ three-letter prefix conventions
β”œβ”€β”€ js/                        # ES modules
β”‚   β”œβ”€β”€ db-access.js             # Loaded by index.html; imports db.js
β”‚   β”œβ”€β”€ db.js                    # Imported by db-access.js (schema, migrations, sample data)
β”‚   β”œβ”€β”€ validation.js            # Loaded by index.html
β”‚   β”œβ”€β”€ utils.js                 # Loaded by index.html
β”‚   └── toast.js                 # Loaded by index.html
└── vendor/                    # Vendored libraries (no CDN required)
    β”œβ”€β”€ tailwind/                # Tailwind CSS Play CDN
    β”œβ”€β”€ fontawesome/             # Font Awesome icons
    β”œβ”€β”€ exceljs/                 # ExcelJS (Excel export)
    β”œβ”€β”€ chartjs/                 # Chart.js (analytics)
    β”œβ”€β”€ sqljs/                   # sql.js (SQLite in the browser)
    └── leaflet/                 # Leaflet (maps)

The application logic lives in a single inline <script> block at the end of index.html. The four modules it loads (db-access.js, validation.js, utils.js, toast.js) attach their public functions to window at load time so the inline script can call them. db-access.js additionally imports db.js, which exports the SQLite schema, migration helpers, and sample data.

Note: Do not change the <script> order in index.html or convert the modules to non-modules. The inline script assumes the modules have loaded before DOMContentLoaded fires.


πŸš€ Getting Started

Prerequisites

  • A modern web browser (Chrome 100+, Firefox 100+, Edge 100+)
  • No server or build process required
  • Safari is untested

Installation

  1. Clone or download this repository:
git clone https://github.com/bernando-minguita/DispatchDesk.git
  1. Open index.html in your browser. Any of these work:
# Windows
start index.html

# macOS
open index.html

# Linux
xdg-open index.html

Or simply double-click index.html in your file manager.

That's it. The app initializes with sample data on first load. To remove sample data, use Settings β†’ Data β†’ Remove Sample Data.


πŸ“– Usage

Adding Orders

  • Single Order: Click Add New Order (or press Alt+N) and choose Single Order
  • Multiple Orders: Click Add New Order (or press Alt+N) and choose Multiple Orders (Grid)
  • Fill in required fields (marked with *). The app validates dates and required fields before saving.
  • Use the Fleet button next to Head/Attachment fields to select from registered fleet units.

Managing Fleet

  • Click Fleet in the header to open the fleet management modal
  • Add tractor heads, trailers, tippers, and rigid trucks using the prefixes documented in fleet_asset_prefixes.csv:
    • Tractor heads β€” TRK-* (prime mover / pulling unit)
    • Trailers β€” FBT-* (flatbed), CST-* (curtain), EXT-* (extendable), BLK-* (bulker), DVN-* (box)
    • Tippers β€” DMP-* (hydraulic dump trailer)
    • Medium trucks β€” MDT-* (rigid truck / straight box)
  • Import/export fleet data via CSV
  • Fleet units are validated when creating or updating orders

Tracking Orders

  • Expand any order row to see tracking history
  • Click the + button to add tracking updates with location, status, and remarks
  • Use the Track button to visualize the route on the map

Monitoring

  • Click Monitor to see orders grouped by status
  • Use the Branch / Reporting Terminal toggle and dropdown to narrow results

Analytics

  • Click Charts to view status distribution, trends, and performance metrics
  • Charts respect the chart date range (initialized from the active month); branch filters apply to the main table and monitor only

Printing/Exporting

  • Click Print Report to generate a filtered, paginated report (portrait/landscape)
  • Use the Data dialog for Export JSON / Export Excel of the filtered view
  • Use Settings β†’ Data β†’ Database Manager β†’ Export Backup (.sqlite) for full database backups
  • JSON import (Data dialog) merges by order number: existing orders are updated, new orders are added, with an optional vehicle-profile override

πŸš› Fleet Asset Prefix Reference

Asset categories and their standardized three-letter prefixes are documented in fleet_asset_prefixes.csv:

Asset Category Prefix Description
Tractor Head TRK Motorized pulling unit / prime mover for hauling trailers
Box Trailer DVN Dry van / fully enclosed cargo trailer
Curtain Trailer CST Curtainside trailer for flexible side-loading
Flatbed Trailer FBT Standard open flatbed for oversized or side-loaded freight
Extendable Trailer EXT Telescopic or lowboy trailer for extra-long / heavy hauls
Tipper DMP Dump trailer with hydraulic lifting for bulk unloading
Bulker BLK Dry bulk silo tanker for powders, grains, or cement
Medium Truck MDT Medium-duty rigid truck / straight box truck (non-articulated)

βš™οΈ Configuration

Access settings via the Settings button:

  • Branch β€” Set your active branch
  • Active Month β€” Filter orders by month
  • Time Format β€” Toggle between 12h and 24h time display
  • CARTO API Key β€” Optional key for CartoDB Voyager map tiles
  • Geoapify API Key β€” Required for reverse geocoding and routing
  • Routing Mode β€” Choose drive, light_truck, medium_truck, truck, heavy_truck, truck_dangerous_goods, or long_truck
  • Vehicle Profile β€” Preset profiles: Light Truck (Dyna), Medium Truck (Rigid 6x4), Heavy Truck Partial, Heavy Truck Full, Extra Heavy, or Custom
  • Traffic β€” Approximated or Free Flow
  • Avoid Tolls β€” Yes or No
  • Vehicle Dimensions β€” Weight (tons), Height (m), Width (m), Length (m)
  • Password Lock β€” Enable app lock with SHA-256 hashing and auto-lock timeout (1–30 minutes)

Settings are saved to localStorage and persist across sessions.


πŸ—ΊοΈ Map Styles

Style Description Key Required
🌍 OSM Standard Standard OSM tile server with automatic fallbacks No
πŸ›°οΈ Stadia Alidade Satellite Satellite imagery No
πŸ—ΊοΈ Esri National Geographic National Geographic world map No
🎨 CartoDB Voyager Clean vector-style tiles Yes β€” CARTO API Key
πŸ—ΊοΈ MapTiles English MapTiles English OSM layer Yes β€” MapTiles API Key
πŸ”οΈ MapTiler Topo-4 MapTiler topographic vector tiles Yes β€” MapTiler API Key
πŸ™οΈ Jawg Streets Jawg Streets vector-style tiles Yes β€” Jawg Access Token

Reminder: Defaults are shared and may be exhausted. Add your own keys in Settings β†’ Map & Routing.


🌍 Branches

DispatchDesk ships with these branches pre-configured:

Dammam Β· Riyadh Β· Jeddah Β· Makkah Β· Madinah Β· Rabigh Β· Yanbu Β· Taif

You can add, rename, or delete branches at any time via Settings β†’ Branches. Branches are used to scope orders, fleet units, address book entries, and reporting terminals.


⌨️ Keyboard Shortcuts

Shortcut Action
Alt + N Open new order modal
Alt + M Open monitor modal
Alt + F Focus search input
Ctrl + Click header Rename that column
Esc Close topmost modal

Shortcuts are suppressed when typing in text fields.


πŸ—‚οΈ Data Storage

Layer Purpose
SQLite (sql.js) In-memory database with full SQL support
IndexedDB Persistent backup of the SQLite binary
localStorage Settings, map preferences

Note: Data is stored locally in your browser. Clearing browser data will reset the app. Use Settings β†’ Data β†’ Database Manager β†’ Export Backup (.sqlite) to preserve your data.

The repository's .gitignore excludes *.sqlite, *.db, and *.sqlite3 files so that local backups are never committed by accident.


πŸ”’ Privacy

  • No data is sent to external servers (except tile/geocoding requests to CARTO, Geoapify, MapTiles, MapTiler, Jawg, and OSM/Esri/Stadia)
  • No accounts, no login, no telemetry
  • All order data, tracking history, and audit logs remain in your browser
  • Sample data is fictional and randomized

πŸ§ͺ Testing

No automated tests are included. The app is manually tested on:

  • Chrome (latest)
  • Firefox (latest)
  • Edge (latest)

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/my-feature
  3. Make your changes
  4. Test thoroughly in multiple browsers
  5. Submit a pull request

Important for contributors: Do not commit .sqlite, .db, or .sqlite3 files. They contain personal data. The .gitignore already excludes them.


πŸ“„ License

MIT License β€” see LICENSE for details.

You are free to use this project for personal or commercial purposes.


πŸ™‹ Support

For issues, questions, or feature requests, please open an issue on GitHub.


Built with ❀️ for fleet operations teams

About

Vehicle/order movement tracker and fleet management app for logistics operations. Single HTML file, local SQLite via sql.js, Leaflet maps, audit logging, password lock.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages