No description
Find a file
DEls 56f6dd8efc feat(plant): implement independent pagination for plant log entries
Added a new pagination system for the "Plant log entries" table in PlantView, allowing for separate page management from the main plant data. Introduced constants for log page size and updated the rendering logic to accommodate paginated logs, enhancing user experience when navigating through log entries.
2026-09-02 12:36:55 +02:00
.freebuff feat(ocr-result, po-items): enhance PO matching logic with fuzzy search 2026-08-26 21:39:59 +02:00
.opencode/openwork/inbox/chat-attachments Update package dependencies and remove unused API routes 2026-08-19 00:14:47 +02:00
.playwright-mcp docs(spec): fuel attention dismissal design 2026-08-28 12:19:59 +02:00
docs docs(plan): implement vehicle unit_type inline-edit UI on Fleet + Plant 2026-08-31 12:57:18 +02:00
public fix(pwa): restore static manifest.json + remove dead next-pwa config 2026-08-30 22:33:35 +02:00
RAW_DOCS fix(vehicles): handle empty unit_type during updates 2026-08-29 19:17:14 +02:00
scripts refactor(plant): enhance PlantPage and PlantView for fuel log integration 2026-09-02 12:36:10 +02:00
src feat(plant): implement independent pagination for plant log entries 2026-09-02 12:36:55 +02:00
.dockerignore Fix Coolify build: include scripts/ in Docker context 2026-08-09 20:30:29 +02:00
.env.coolify feat(delivery-notes): enhance delivery note upload and processing 2026-08-26 15:33:30 +02:00
.env.local.example docs(env): default MiniMax-M3 (vision + tools verified) 2026-08-30 12:56:30 +02:00
.gitignore feat(delivery-notes): enhance delivery note upload and processing 2026-08-26 15:33:30 +02:00
AGENTS.md Enhance PO upload error handling and validation 2026-08-19 15:03:48 +02:00
CLAUDE.md Enhance PO upload error handling and validation 2026-08-19 15:03:48 +02:00
cooler.env Enhance PO upload error handling and validation 2026-08-19 15:03:48 +02:00
COOLIFY.md Fix Coolify build: skip postinstall in deps stage 2026-08-09 02:29:48 +02:00
Copy of THE HILLS WAGES HRS AUGUST 2026.xlsx feat(timesheets): enhance import functionality to support XLSX and CSV formats 2026-08-25 18:38:02 +02:00
deployment-vptid1uo0jnz2q4t1mcbqjj9-all-logs-2026-08-19-00-23-06.txt Refactor Purchase Order upload flow documentation 2026-08-19 02:25:11 +02:00
docker-compose.yml Initial commit: MEGA INFRASTRUCTURE dashboard + Coolify Dockerfile 2026-08-09 01:37:40 +02:00
Dockerfile Fix Coolify build: skip postinstall in deps stage 2026-08-09 02:29:48 +02:00
next.config.js fix(pwa): restore static manifest.json + remove dead next-pwa config 2026-08-30 22:33:35 +02:00
package-lock.json feat(chat): render answers as dashboard-grade markdown 2026-08-29 21:00:35 +02:00
package.json build(pwa): wire build-icons.mjs into the build pipeline 2026-08-30 22:22:42 +02:00
postcss.config.mjs Initial commit: MEGA INFRASTRUCTURE dashboard + Coolify Dockerfile 2026-08-09 01:37:40 +02:00
README.md Initial commit: MEGA INFRASTRUCTURE dashboard + Coolify Dockerfile 2026-08-09 01:37:40 +02:00
tsconfig.json Initial commit: MEGA INFRASTRUCTURE dashboard + Coolify Dockerfile 2026-08-09 01:37:40 +02:00
vitest.config.ts Add Vitest + n8n env var documentation 2026-08-19 02:21:36 +02:00

MEGA INFRASTRUCTURE — Operations Dashboard

A Next.js 16 + TypeScript + Tailwind v4 dashboard for a construction company. Tracks fuel consumption per hour/day/week, delivery notes & outstanding items per purchase order, and weekly workforce hours with attendance flags.

The project is frontend-first with mock data, ready to be wired up to PocketBase (or any backend) for live data.


Modules

Path What it does
/login Numeric PIN gate. PIN lives in NEXT_PUBLIC_APP_PIN. Append ?demo=1 to any URL to skip the PIN during development.
/dashboard Operations overview — KPI cards, fuel chart, order status donut, "needs attention" rail, top suppliers.
/dashboard/fuel Per-vehicle consumption, theft detection, CSV ingest (papaparse), anomaly log.
/dashboard/orders Purchase-order table with filters, pagination, sort. Click any PO to see line items, delivery notes, outstanding items.
/dashboard/employees Weekly hours per employee with progress bar, overtime flag, role/site/attendance filters, mini daily-hours chart.

APIs

  • GET /api/health — counts and site list.
  • GET /api/mcp?module=all|fuel|orders|employees — compact JSON for an AI agent / MCP server / n8n workflow.
  • POST /api/upload — multipart upload of PDF / image / CSV (delivery notes, fuel attachments). 20 MB limit per file.

PWA

The app is installable on phone and desktop. Service worker is generated by @ducanh2912/next-pwa at build time (public/sw.js), manifest at public/manifest.json, icons at public/icons/.

Note: @ducanh2912/next-pwa uses the Webpack plugin, so next dev and next build must run with --webpack. Next 16 ships Turbopack by default; the package.json scripts already pass --webpack.


Run

cp .env.local.example .env.local       # change NEXT_PUBLIC_APP_PIN
npm install
npm run dev                            # http://localhost:3000

Default PIN is 2468.

Production

npm run build
npm run start

How the theft detection works

src/lib/fuel.ts defines EXPECTED_LITRES_TOLERANCE_PCT = 12. For every reading we compute:

expectedLitres = hoursWorked * expectedConsumptionPerHour
deltaPct       = (litresFilled - expectedLitres) / expectedLitres * 100

Severity buckets:

Over expected Severity
≤ 12 % ok
12 – 24 % watch
24 – 48 % alert
> 48 % critical

Adjust EXPECTED_LITRES_TOLERANCE_PCT to suit on-site practice.


CSV format for fuel upload

Required columns:

vehicleRegistration,date,hoursWorked,odometer,litresFilled,unitPrice,expectedConsumptionPerHour
MI-EX-01,2026-08-01,9.5,12480,90,24.50,9

The "Template" button on the Fuel page downloads a populated example.


Wiring a backend

Replace the imports in src/app/dashboard/*/page.tsx and src/app/api/mcp/route.ts with calls into PocketBase / your API. The shape of every type is in src/lib/types.ts.

Recommended PocketBase collections:

  • vehicles (registration, type, model, tankCapacityL, assignedSite)
  • fuel_readings (vehicleId, date, hoursWorked, odometer, litresFilled, unitPrice, expectedConsumptionPerHour, attachment?)
  • orders (reference, supplier, site, status, priority, placedAt, expectedAt, totalValue, notes)
  • order_lines (orderId, description, quantityOrdered, quantityDelivered, unit, unitPrice)
  • delivery_notes (orderId, scannedBy, file, mimeType, receivedAt)
  • employees (fullName, role, site, status, phone, hourlyRate, weeklyTargetHours)
  • daily_hours (employeeId, date, hours)