Commit Graph
10 Commits
Author SHA1 Message Date
adminandClaude Fable 5 576557181a feat: Phase 5 & 6 — usability, compliance hardening, analytics
Phase 5 (usability + compliance):
- In-app notification bell/badge: migration 016 adds read state + per-user
  RLS + create_in_app_notification SECURITY DEFINER RPC; /api/notifications;
  wired into incident creation, CAPA assign/verify, escalation cron
- Incident closure: new POST /api/incidents/[id]/close (requires verification
  status + all CAPAs verified); migration 017 locks closed incidents at DB
  level (update/delete triggers) with append-only incident_addenda + UI panel
- Server-side pagination on HSE/supervisor incident inboxes (.range, 25/page)
- Investigation form: alcohol/urine test result + witness statement refs
  (existing schema columns, now editable)
- Type-specific intake fields: migration 018 adds incidents.type_details
  JSONB; whitelist validation; environmental/asset/security/fire field
  groups in report form; EN/MS/ZH labels; offline queue support
- JKKP 8 annual register CSV export (/api/reports/jkkp8) + dashboard button
  + January statutory deadline banner
- Admin page: user invite (service-role client), role/site/active management,
  site + zone CRUD with QR report links — replaces Phase 0 stub
- Evidence gallery thumbnails via Supabase render transform with fallback

Phase 6 (analytics):
- 12-month stacked trend chart (leading/lagging/other) + top root causes
  (lib/dashboard/trends.ts pure helpers)
- AI rising-risk zones: /api/dashboard/ai/risk-flags aggregates 90-day
  zone stats, claude-opus-4-8 forced tool_use, panel on HSE + management
  dashboards, suggestion audit-logged

Also fixes 9 pre-existing missing /ims basePath prefixes in client fetches
and download links.

132 tests passing, tsc clean, next build clean.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CPf5Rc8QPx6V8KLEEgfKEQ
2026-07-12 10:25:08 +08:00
admin 8c88118b15 chore: update progress ledger — Phase 3 v2 review complete 2026-07-11 19:04:20 +08:00
admin c67c489ab3 chore: mark Phase 3 complete in progress ledger 2026-07-11 18:56:10 +08:00
admin 3297198179 chore: log Phase 3 final fixes in progress ledger 2026-07-11 16:49:18 +08:00
admin 28b4951b68 chore: mark Phase 3 complete in progress ledger 2026-07-11 16:41:17 +08:00
adminandClaude Opus 4.8 0e53d5c771 chore: mark Phase 2 Tasks 3-8 complete in progress ledger
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FFDuBhMKvoWjrWT3ZnGmmr
2026-07-11 15:24:32 +08:00
admin 8a9758c8a6 feat: Phase 1 foundation - incident components, storage, and migrations 2026-07-10 10:48:56 +08:00
adminandClaude Sonnet 4.6 152a6602d6 feat: add QR code generation script for seeded zones
Adds scripts/generate-qr.ts that generates one 400px PNG per warehouse
zone into public/qr/ (gitignored). Encodes /report?zone=<token> URL per
zone using NEXT_PUBLIC_APP_URL (default http://localhost:3000). Adds
public/qr/.gitkeep so the output directory is tracked. All 8 tests pass.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AWxyMibCuGGtSQSqfajDQ7
2026-07-09 22:36:50 +08:00
admin 9b5b21381f chore: fix layout metadata and mark Task 1 complete in ledger 2026-07-09 21:37:23 +08:00
admin f83686fcca chore: scaffold Next.js 15 + Supabase clients + vitest 2026-07-09 21:33:59 +08:00