When a scan is corrected from clock-in to clock-out, retain the scan date and clear only the arrival time so users can enter the actual arrival without re-entering the date.
Replace the last-slip field with cumulative spending since the latest top-up, falling back to the opening when no top-up exists. Update the management table to display the new amount and cover the calculation with server and UI tests.
Backdating before the latest assignment and future dates were refused, so a
wrong start date could never be corrected. Corrections still append a revision.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Checks for a duplicate before filing anything: the same document at the same site is
archived, and a PO number already in the system is tagged PO Duplicate for a human
instead of being filed twice. Successfully filed mail is tagged PO Ingested and moved
out of the inbox; PO Needs Review and PO Duplicate stay in the inbox for review and are
skipped on later runs.
Rebuilds the PO email intake on n8n's native Microsoft Outlook node so the mailbox
can be connected with a single sign-in instead of an Azure app registration, and
documents reading the same mailbox from Mail.app via AppleScript for one-off
backfills. Records the real-world site-matching gap: the site often appears only
inside the PDF, not in the email.
- Plant overview: monthly Actual vs Bill hours and Total vs Bill value across
all equipment, using the same rules as the equipment detail tiles
(billed-day logic moved to lib/metrics/plant-billing).
- Attention Needed moves under the KPI cards and now holds the missing hire
rate, readings-to-review and fuel price notices.
- Sidebar Plant mark also counts equipment with no hire rate.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Polls ai@megainfra.co.za through Microsoft Graph, downloads the PO attachment and
writes it into the same purchase_orders pending queue the browser upload uses, so
the existing MEGA - Purchase Order Ingest workflow OCRs and finalises it. The
source email is archived once filed; POs that cannot be matched to a site are
tagged PO Needs Review instead of being filed against the wrong site.
Munyaka model: 27 stormwater structures and 26 pipes from the issued structure table
(MH/KI/outlet by CAD block), water node points, and the information-stage village network
(services, ponds, boundary, lots, hydrants) aligned from the SDP Rev C PDF.
Map 3: selected Progress section is outlined and its row highlighted; Show-on-map gains
ground surface, contours, kerbs, markings, toes, reserve, signs, studs and HOLD switches;
the ground fades when underground services are ticked; pipes and manholes are chunkier.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The person scanner now reads the phone location when it opens and when the app
returns to the front, and selects the nearest site unless one was picked by hand.
The Fix missing clock time button stays available, accepts 5:00 style times and
leaves out-of-range times for the server to explain.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
- Clock slip form: no cost code (a slip is booked to its site). Each photo
is previewed, with "Add another page" for the invoice behind a bank slip,
up to 5 pages in order; extra pages can be removed.
- Slip API takes 1-5 photos; the photo route serves ?page=N and is now
holder-or-admin only (the shared-login rule was left over).
- Movements sheet shows every page; CSV drops the cost code column.
- Cash Floats table: a card under its limit gets a red row, and the card
number opens its movements.
- Sidebar: the low-card mark shows on Cash Floats only, not on Management.
- Migration: slip_photo holds up to 5 files (applied to production
2026-10-28).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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>
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>
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
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>
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>
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.
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.
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>
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>
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>
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>