Hardware store driver & delivery - same-day route and loading tool - paste in today's dozen delivery tickets (zone / pieces and weight / floor and elevator / time window / rush) and get three outputs back: the run order (zone clustering plus time windows plus rush-first), the loading order (last delivered rides deepest, heavy goods ride lowest, tile stays upright), and a handoff checklist - pure local single file, no network, no maps; ten years of routing instinct become the driver's ten minutes each morning
You are a coding agent. Build a single-file HTML "Same-Day
Route & Loading Tool" for the delivery driver of a hardware and
building-materials store to plan each morning. Runs locally, no
network, no install, no dependencies.
Scenario (design to this; do not build fleet software): the
driver starts the morning with a dozen delivery tickets - cement
and sand, tile, sheet goods, fittings - some going upstairs,
some on a deadline (a site waiting on materials to start), some
across town in different zones. A badly ordered day burns two
extra runs of fuel. Today the veteran routes by instinct; a new
driver cannot take over the job.
Input (one paste box for the batch plus per-ticket manual entry,
fixed fields):
- Ticket no. / customer, zone (preset dropdown with the store's
own zone names)
- Pieces, total weight (kilograms, estimated is fine)
- Floor, elevator or not
- Time window (none / morning / afternoon / before a set time)
- Rush flag (a site standing idle waiting on this delivery)
- Notes (handle gently / fragile / do not stack under)
Sorting logic (the core rules, implement as specified):
1. Rush first: rush tickets take the earliest feasible slot - a
rush ticket means a job site standing idle; everything else
yields
2. Zone clustering: same-zone tickets run adjacent - finish one
zone before entering the next; interleaving zones is
forbidden
3. Time windows: all morning tickets ahead of all afternoon
tickets; deadline tickets land at the latest feasible slot
before their cutoff
4. Conflict flag: when clustering and time windows collide
(morning tickets spread across two distant zones), do not
force a sequence - emit a prompt and let the driver decide.
The tool sorts; the driver judges
Loading order (a separate output, fixed rules):
- Last delivered rides deepest, first delivered nearest the
door - unload in reverse
- Heavy goods (cement, sand) ride lowest; light goods (fittings,
plates) on top
- Tile and sheet goods upright or padded flat, with nothing
heavy stacked on them - chipped corners mostly trace back to
loading order
- Spare pieces for rush tickets (on-the-spot swaps) within
arm's reach of the driver's seat
Three outputs:
1. Run order table: position / ticket / customer / zone /
pieces / window / rush flag - printable and phone-readable
2. Loading plan: from the deepest part of the cargo bed
outward, one column per layer, marking which tickets ride
upright and which get stacked
3. Handoff checklist: one row per ticket (ticket / pieces /
notes), ticked as each delivery is unloaded - a missed bag
discovered on the last run home costs half a day; ticked on
the spot, it costs a walk back to the truck
Hard constraints:
- Pure front end, nothing leaves the browser, refresh clears
everything; delivery tickets carry customer phones and
addresses, which are not uploadable material
- No maps, no navigation, no distance computation - the tool
sorts by zones and rules using data the driver enters; the
roads belong to the driver, who knows them better than any
map. Touch maps and the tool needs a network, an API key and
a maintenance contract - and dies
- Preload a demo dataset (including one rush ticket and one
cross-zone conflict) so opening the page shows the whole
picture
You must not:
- No "intelligent optimization" - no promises of "optimal
routes"; the four sorting rules above are the whole engine,
and every result is explainable. Drivers want an order they
can inspect, not a black box
- No customer SMS, driver attendance, photo proof-of-delivery -
those belong to other systems; this tool routes and loads,
period
- No accounts, login, payment, watermarks
Why it is written this way
The four sorting rules being fully explainable, plus conflicts escalating instead of resolving, is the boundary between this tool and "smart dispatch" products. Drivers do not trust black boxes - software announcing "optimal route" reads to a driver as detours; software announcing "rush first, same zone adjacent, mornings before afternoons - and these two rules collide here, you call it" reads as the driver's own instinct being handed back to him. Routing is rules plus exceptions: rules go to the code, exceptions stay with the human. The conflict prompt (clustering versus time windows) is precisely the part of the tool that behaves most like the veteran.
"Tile upright, nothing heavy on top" as a hard rule exists because loading is the first scene of every chipped-corner incident - this and the stair-carry SOP are two ends of one liability chain. The run order optimizes fuel; the loading order optimizes payouts, and for the driver the second matters far more. Presenting the loading plan layer by layer means the driver can physically follow it while loading - an output format decides whether a tool gets used or merely viewed.
The handoff checklist - tick per delivery - looks primitive and guards against the most expensive failure in the chain: discovering a shortage too late. A missing bag found on the last run home costs tomorrow's first trip plus the customer's trust; found while unloading the third stop, it costs a walk back to the truck. Embedding the check into each unload instead of the end-of-day reconciliation turns the time lag into the loss gap.
"No maps" is the precondition for this tool surviving at all. Navigation requires a network, an API, updates; the moment a single-file tool depends on the network it becomes one more login-and-maintain-and-pay app, and drivers' phones already carry too many of those. The tool owns order (zones, windows, weights, stacking rules - all driver-entered data), and the road belongs to the driver: after ten years on the same city, the driver's head holds better traffic than any live map. A tool that refuses what it cannot do is what does well what it can.
Variables
| Variable | Description |
|---|---|
| Zone division | How the delivery area is cut (east / west / new district...) - follow the driver's actual habit, not administrative streets; preset the names in the tool so each pasted ticket just picks one |
| Weight estimates | Per-piece estimated weights of common goods (a bag of cement, a box of tile) - maintain a small table from the store's actual goods; precision is unnecessary, a heavy/light split is all the rules consume |
| Rush-ticket criteria | What counts as rush (site standing idle / customer needs it today) - the store sets one defining sentence and drivers flag by the criteria, not by mood; an overused rush flag turns the whole sorting engine over |