Commit graph

841 commits

Author SHA1 Message Date
DEls
bb94dccfce fix(sites): split certificate chart into certified invoice and retention
Retention is about a tenth of the certified invoice, so on one shared
scale its bars were barely visible and paired bars sat off their month
labels. Each figure now gets its own chart and scale.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 10:55:50 +02:00
DEls
05f6d551f2 feat(sites): import payment certificates into Inflows with cumulative chart
Inflows (claims) now shows only Certified invoice (VAT incl) and Retention
(ex VAT), fed by an Import certificate dialog that reads the PDF (INVOICE
TOTAL, this month's Less RETENTION, valuation number, date) for review
before saving. Adds a monthly + cumulative chart and a certificates table
linking each stored PDF.

- income_claims gains retention_amount and certificate (migration applied)
- pdftotext with an unpdf fallback for machines without poppler

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 10:53:54 +02:00
DEls
dd1638aaba feat(plant): fuel price admin screen with monthly cost check
Adds a /dashboard/plant/fuel-prices page to view, add, edit and delete
dated diesel prices, plus a monthly check that prices each fuel log at
the rate in force on its own date.

- admin-only POST/PATCH/DELETE /api/fuel-prices with zod validation
- monthly cost helper flags months that fall back to the default rate
- plant landing and fuel logs pages link to the new screen and show the
  current rate per litre
- /api/fuel-prices added to the plant module path access list
2026-10-27 10:22:58 +02:00
DEls
580870ceb4 Merge branch 'main' into feat/inbox-3 2026-10-26 20:33:58 +02:00
DEls
1c77a84b6e fix(dn): a standard unit conversion (kg to ton) still auto-readies a line
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 20:02:46 +02:00
DEls
004fa9cf78 chore(dn): inbox 3 queue re-run script
Co-Authored-By: MiniMax (Pinchy)
2026-10-26 20:01:09 +02:00
DEls
d88e2dc0d1 fix(dn): inbox 3 table gives the descriptions room at laptop width
Stack the slip line over its PO line picker in one column and show
value with left-on-PO beneath it, so every column fits beside a 300px
documents column without horizontal scroll.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 19:57:24 +02:00
DEls
533c61bbca fix(dn): inbox 3 screen fixes from live review
Co-Authored-By: MiniMax (Pinchy)
2026-10-26 19:51:47 +02:00
DEls
3e4b9d0fb0 fix(dn): keep the unit list out of the browser's node imports
Co-Authored-By: MiniMax (Pinchy)
2026-10-26 19:43:36 +02:00
DEls
7464879c02 feat(dn): existing inbox confirms ready lines of part-done slips
Co-Authored-By: MiniMax (Pinchy)
2026-10-26 19:38:09 +02:00
DEls
402824e018 feat(dn): inbox 3 slip-first matching screen
Co-Authored-By: MiniMax (Pinchy)
2026-10-26 19:36:18 +02:00
DEls
1514d514b3 fix(dn): validate inbox 3 line edits
Co-Authored-By: MiniMax (Pinchy)
2026-10-26 19:30:59 +02:00
DEls
bc138bcae7 fix(dn): over-PO quantities need an explicit accept, never from the assistant
Co-Authored-By: MiniMax (Pinchy)
2026-10-26 19:27:29 +02:00
DEls
e7e8a2ff3d feat(dn): inbox 3 assistant edits lines by number, never posts
Co-Authored-By: MiniMax (Pinchy)
2026-10-26 19:20:10 +02:00
DEls
9db3b2fb6c fix(dn): a combined line saves even when the supplier rule cannot be remembered
Co-Authored-By: MiniMax (Pinchy)
2026-10-26 19:15:44 +02:00
DEls
3ca3021d33 feat(dn): save inbox 3 line edits without posting
Co-Authored-By: MiniMax (Pinchy)
2026-10-26 19:09:58 +02:00
DEls
e65bfcdd72 feat(dn): inbox 3 line rows with unit factor, price and left on PO
Co-Authored-By: MiniMax (Pinchy)
2026-10-26 19:03:06 +02:00
DEls
4107bbec9a fix(dn): only a remembered unit connection auto-readies a unit change
Co-Authored-By: MiniMax (Pinchy)
2026-10-26 18:55:48 +02:00
DEls
0404688c75 fix(dn): confirm refuses a slip on another supplier's PO
Co-Authored-By: MiniMax (Pinchy)
2026-10-26 18:53:56 +02:00
DEls
e0c07cbf5f feat(fuel): delete a test or mistaken meter reading with a reason
Clock scanner: double-tap the previous reading to remove the latest
scanner-entered reading. Fuel Logs and vehicle pages: double-click a
meter-only row to delete it. Reason, actor and values are logged.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-26 17:16:01 +02:00
DEls
2dfe92b7d6 feat(dn): block slips linked to another supplier's PO
Co-Authored-By: MiniMax (Pinchy)
2026-10-26 16:00:57 +02:00
DEls
ddccdd8cfd feat(dn): confirm posts the ready lines and leaves the rest open
Co-Authored-By: MiniMax (Pinchy)
2026-10-26 15:46:52 +02:00
DEls
2ccb6efadc feat(dn): per-line readiness and price tolerance for inbox 3
Co-Authored-By: MiniMax (Pinchy)
2026-10-26 15:38:51 +02:00
DEls
c36fc5fb82 feat(dn): inbox 3 is office and admin only while testing
Co-Authored-By: MiniMax (Pinchy)
2026-10-26 15:28:30 +02:00
DEls
7d755961f4 docs(dn): Inbox 3 build plan
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 13:28:24 +02:00
DEls
841947a161 docs(dn): Inbox 3 matching screen design
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 13:25:54 +02:00
DEls
ca7d6c94e3 fix(build): unbreak next build type check on vitest NODE_ENV
The deployment failed at "Running TypeScript ..." with:

  vitest.config.ts(7,13): error TS2540: Cannot assign to 'NODE_ENV'
  because it is a read-only property.

Next's next/types/global declares NODE_ENV on ProcessEnv as `readonly`.
tsconfig includes **/*.ts, so next build type-checks vitest.config.ts and
the direct assignment from 34017d8 took every deploy down with it.

Object.assign has no source-to-target assignability constraint, so it
compiles while still writing NODE_ENV through process.env's setter —
React still gets its development build, which is what exposes `act`.

Verified: tsc --noEmit clean, 3839 tests pass, npm run build succeeds.
2026-10-26 02:22:44 +02:00
DEls
88a3a1e1be feat(workforce): keep the hourly rate off the workers roster
The Rate / hr column put every worker's wage on a wide table that is
glanceable, projected and exported. The rate already lives on the worker
detail page, where it is a deliberate lookup.

Drop the column from the roster and the rate from its CSV export — the
export is the wider accidental leak, since that file gets emailed and
opened on shared machines. Site managers can still see a worker's rate by
opening the worker, which stays deliberate access.
2026-10-26 01:10:08 +02:00
DEls
34017d8630 chore(tooling): ignore foreman in lint, relax script rules, force NODE_ENV=test in vitest
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 23:12:57 +02:00
DEls
18fb7ef99d feat(surveying): Maps move to a Surveying section; Sites is opt-in for site managers
Surveying → Maps is open to every dashboard user, scoped to their sites.
Sites (contracts and profitability) shows for admins, and for site managers
only when "Can see Sites" is ticked on their account. Old map links redirect.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 13:31:53 +02:00
DEls
9f0fce988e feat(cash-floats): petty-cash cards on users, one log, clock Slips tab
Each cash float card lives on its holder's user record (card number, last
4-6 digits of the physical card, low limit, assigned date). Every movement
goes in one cash_float_log collection: opening, top-up, slip, handover and
correction rows with signed amounts. Balances are always summed from the log.

- Management -> Cash Floats: cards table (lowest balance first), add, edit,
  top up, hand over, correct balance, retire, movements sheet with slip
  photos and CSV export. Admin-only.
- Settings -> Users: card section in the edit form and the balance per holder.
- Clock app: Slips tab, shown only to a user who holds a card. Photo, site,
  supplier and amount; the slip comes off that user's own card.
- Sidebar needs-attention mark when a card is under its limit.
- Slips count as site spend ("Cash float slips" on the site page).
- Migration scripts/migrations/2026-10-24-cash-floats.py (already applied to
  production on 2026-10-24).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 13:17:06 +02:00
DEls
706d3bbd63 feat(workforce): payroll export, labour cost by site, all-sites totals in the site matrix
Adds an all-sites payroll (Excel/PDF/CSV, one row per worker, per-site split and
site wage cost), a period-selectable labour cost by site table on the Workforce
dashboard, and each worker's all-sites total plus site wage cost in the
timesheet matrix and its exports.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-21 07:00:48 +02:00
DEls
708e0b2742 feat(clock): a scan at another site moves workers and vehicles there automatically
A destination scan now ends the worker's previous site session at that moment
(transfer OUT, hours booked at the origin) and opens the new one, so nothing is
left for the office to review. Vehicle scans take a scanning site, move the unit
there and log the reading against it. Adds a script to close already-flagged moves.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-21 06:34:05 +02:00
DEls
527446d1ce fix(site-map): size every Maps thumbnail to the same 4:3 frame
Tall and wide sites were framed on their own bounding box and then letterboxed, so some looked zoomed out. Widen the shorter side to 4:3 so each plan fills its card.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-21 06:00:51 +02:00
DEls
2933251b2e fix(site-map): Map 3 Progress tab Show in 3D flew to a blank spot
The section's height was passed as 0, so the camera target sat far below the map. Use the design surface height, and make the camera fly-to fall back to the surface height when given a wrong one.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-21 05:43:57 +02:00
DEls
36da7f9f20 feat(site-model): Nellmapius Ext. 25 roads, kerbs and benchmarks from the 100_ROADS and 400_KERBING drawings
Road areas (5,221 m²) in 20 m sections along the ring roads and the Igwali Street spur, 1.74 km of kerb measured once, stand lines, and the four survey benchmarks with an indicative ground plane. No services or ground levels are placed; the supplied survey and sewer sheets cannot yield them.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-21 05:29:17 +02:00
DEls
d6cf3d1144 feat(site-map): Map 3 Progress tab showing pavement-layer progress by section
Strips the map back to the road and tints each section by how many of the chosen build layers are done, with done/shown labels, a layer filter, a per-section checklist and a link into the tick-off popup.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-21 05:11:08 +02:00
DEls
5141f7783a feat(site-map): Cedar Gate stormwater and sewer pipes and manholes from the long sections
Extract 23 stormwater structures / 22 pipes and 18 sewer manholes / 17 pipes with sizes, inverts, ground levels and positions from the C3277 long-section tables (superseded sewer copies dropped by matching the issued PDFs). New model folder 2026-10-21. Map 3 draws them as round pipes and manholes, adds status popups for pipes and manholes, and reuses Map 2's services panel; water stays plan routes.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-21 05:04:42 +02:00
DEls
1a67125b61 feat(site-map): Map 3 with ground survey, cut & fill, progress glow and service routes
New /dashboard/sites/[id]/map3: a 3D map forked from Map 2 (Map 1 and 2 untouched) with ground heat map, contours, cut & fill from the Chris survey, a longitudinal profile, yellow/green progress glow, a Services tab for stormwater/sewer/water routes, and status popups on earthworks strips and routes. Pure logic and tests in src/lib/site-map-v3.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-21 04:43:56 +02:00
DEls
2b411404da fix(management): drop 95% cost line from income chart; purple/green cumulative result
Remove the planned-cost line from the actual vs forecast income chart and colour the Turnover Overview cumulative result purple (planned) or green (actual).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-21 04:43:56 +02:00
DEls
6036506d70 chore: tidy repo root and commit October data work
- Move loose September fuel exports, chat export and deploy log into archive/
- Move the Hills wages test spreadsheet into src/lib/__fixtures__/
- Add Buildsite fuel exports and the 18 Oct fuel review audit under reports/
- Add PocketBase schema backups from 17-18 Oct
- Ignore .playwright-mcp/ and duplicate report zips; stop tracking cooler.env (already in .gitignore)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 18:49:34 +02:00
DEls
07b12e98b4 feat(management): list every planned project on Retention
Awarded (not started) and non-calculated projects now appear on the
Retention table, labelled, blank until values are entered. Entered values
count towards totals and the company balance, and the retention save
endpoint accepts any project in the plan.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 12:58:02 +02:00
DEls
cb4a1ce461 feat(site-map): Maps page with previews, double-click progress popup, Cedar Gate cut & fill
- Sites → Maps in the sidebar replaces the per-site Site map / Map 2 links.
  The Maps page shows each site's model as a plan preview (built sections
  solid) with % of road layerworks built and links to Site map and Map 2.
- Double-clicking a road section opens its progress tick-boxes over the map
  (Site map saves to the server; Map 2 stays a local scenario).
- Cedar Gate: 40 drawn cross-sections extracted from C3277-912-001 Rev A
  (extract_cedar_gate_xs.py), cut/fill limited to Cedar Gate Road, a Cut &
  fill workspace in Map 2 with a chainage chart, and pavement layers shown
  in their material colours.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 12:55:51 +02:00
DEls
0dfb129696 feat: update management comparisons and Cedar Gate site model
Add planned vs actual turnover dashboards, monthly actual costs, editable retention forecasts and actuals, starting retention, payouts and running balances. Preserve manual values across workbook imports and include retention backfill tooling.

Add Cedar Gate model extraction and reports, measured service routes and ground surfaces, plus site-map section totals and quantity refinements.
2026-10-20 12:23:44 +02:00
DEls
db53a82809 feat(management): rework Turnover Overview layout, KPI band and colours
Show invoiced, forecast and awarded split in the turnover KPI; pin the
cash result column and add per-month invoiced/forecast lines; stack the
side panels in a column with a year comparison chart so both columns end
level; reword the income-less-cost chart labels. KPI band follows the
app greys in dark mode and a light grey in light mode, with all figures
neutral except the accent-coloured turnover.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-20 03:40:58 +02:00
DEls
d9cf20dd02 feat(management): income KPI tiles match chart colours, align table, purple forecast line
Income tab shows Actual, Forecast, Planned and a combined total with
colour stripes matching the chart; month columns right-align with their
headers; the forecast line under an actual uses the forecast purple;
the red stack falls back to the forecast bar when a month has no
invoiced figure yet.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-20 03:19:02 +02:00
DEls
a96f35366d feat(management): store planning data in PocketBase with editable income, add job and forecast vs actual chart
Move the Management planning snapshots into PocketBase collections
(plans, projects, per-year project plans, retention, edit log), loaded
with a bundled-JSON fallback. Admins can double-click an income cell to
enter forecast and actual, edit awarded jobs' planned amounts, change
status and costs, and add jobs, with revision checks and an audit trail.
Income chart now shows forecast and invoiced bars with not-yet-started
money stacked in red; Income is in the sidebar. Adds schema and import
scripts, and jsdom/Testing Library dev dependencies for UI tests.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-20 03:04:01 +02:00
DEls
97f62d7cc8 fix(deliveries): reader must not invent lines on rotated or cluttered photos
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-19 21:24:15 +02:00
DEls
ce238700a5 fix(deliveries): clear a batch's attention flag when its last document posts; read MEGA PO number variants; haulier is not the supplier
- 37 of 54 'needs attention' batches had every document finished: the flag
  was set while reading and never cleared by posting. Posting the last open
  document now marks the batch processed (batchSettledMutation).
- PO prefix variants (MEGA PO, MEGP0, MEDCPO, MEGCPC, extra leading zero)
  resolve when the supplier is confirmed and the digits are unchanged;
  dropped or changed digits stay unresolved.
- Reader prompt: supplier is the seller on the letterhead, never the
  transporter/haulier on a weighbridge ticket; copy the order number
  exactly. Prompt version unchanged so stored pages are not re-read.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-19 20:08:15 +02:00
DEls
a738b890bc fix(auth): keep named user sessions for 60 days 2026-10-19 20:04:14 +02:00