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.
π Fleet Dispatch Β· πΊοΈ Route Mapping Β· π Analytics Charts Β· π¨οΈ Print & PDF Reports Β· π Address Book Β· π§ Fleet Registry Β· πΎ Local SQLite Storage Β· π Password Lock
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.
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.
- 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
- 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 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.
- 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
- 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/PDF Reports β Filtered, paginated reports in portrait/landscape
- Excel Export β Export filtered orders to
.xlsx - JSON/SQL Backup β Full database export and restore
- 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
- 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
- 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
| 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 |
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 inindex.htmlor convert the modules to non-modules. The inline script assumes the modules have loaded beforeDOMContentLoadedfires.
- A modern web browser (Chrome 100+, Firefox 100+, Edge 100+)
- No server or build process required
- Safari is untested
- Clone or download this repository:
git clone https://github.com/bernando-minguita/DispatchDesk.git- Open
index.htmlin your browser. Any of these work:
# Windows
start index.html
# macOS
open index.html
# Linux
xdg-open index.htmlOr 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.
- 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.
- 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)
- Tractor heads β
- Import/export fleet data via CSV
- Fleet units are validated when creating or updating 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
- Click Monitor to see orders grouped by status
- Use the Branch / Reporting Terminal toggle and dropdown to narrow results
- 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
- 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
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) |
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.
| 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.
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.
| 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.
| 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.
- 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
No automated tests are included. The app is manually tested on:
- Chrome (latest)
- Firefox (latest)
- Edge (latest)
- Fork the repository
- Create a feature branch:
git checkout -b feature/my-feature - Make your changes
- Test thoroughly in multiple browsers
- Submit a pull request
Important for contributors: Do not commit .sqlite, .db, or .sqlite3 files. They contain personal data. The .gitignore already excludes them.
MIT License β see LICENSE for details.
You are free to use this project for personal or commercial purposes.
For issues, questions, or feature requests, please open an issue on GitHub.
Built with β€οΈ for fleet operations teams