admin
938eb7e08d
feat(capa): wire owner notes form into capa-owner page and HSE detail view
2026-07-23 12:00:43 +08:00
admin and Claude Sonnet 4.6
71cf90e1de
feat(capa): add Close CAPA button for HSE after verification
...
Verified CAPAs now show a Close button on the detail page for
HSE/admin, transitioning status to closed.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com >
2026-07-23 11:41:56 +08:00
admin and Claude Sonnet 4.6
0e479b648f
fix(auth,capa): restore auth callback, fix CAPA status update
...
- auth callback: remove debug redirect, handle both code (PKCE) and
token_hash+type (recovery/magic link) flows correctly
- capa PATCH: use admin client to bypass RLS for status updates
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com >
Claude-Session: https://claude.ai/code/session_01WMymkhHZiaYZtUeH9MEHZQ
2026-07-22 19:43:38 +08:00
admin and Claude Sonnet 4.6
e30d583947
feat: split alcohol and urine test into separate fields
...
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com >
2026-07-17 19:08:27 +08:00
admin
e687510d0b
fix(capa): show all active users in Assigned To dropdown
2026-07-17 19:05:37 +08:00
admin and Claude Sonnet 4.6
e682162bbc
fix(auth): redirect to appUrl after invite callback
...
origin lacks /ims basePath; use NEXT_PUBLIC_APP_URL instead.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com >
Claude-Session: https://claude.ai/code/session_01BzvzV91UqHZKM9P58qtvrA
2026-07-16 21:44:12 +08:00
admin and Claude Sonnet 4.6
b08fec385d
fix(capa): filter owner dropdown by capa_owner role
...
Was filtering by non-null department, excluding capa_owner
users who had no department set.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com >
Claude-Session: https://claude.ai/code/session_01BzvzV91UqHZKM9P58qtvrA
2026-07-16 21:12:12 +08:00
admin and Claude Sonnet 4.6
f90bf4ed03
feat: transport incidents with truck number support
...
- DB: trucks table + incidents.truck_id FK + transport enum value
- Validation: transport type requires truck_id
- Create API: validates truck exists/active, persists truck_id
- Report form: truck dropdown shown when type=transport (required)
- Admin: TruckManager CRUD + /api/admin/trucks route
- Detail: trucks join surfaced in incident-detail + detail page query
- Inbox (HSE + supervisor): truck filter, transport in TYPE_OPTIONS,
fixed stale enum values (dropped dangerous_occurrence/mhe_asset/occupational_disease)
- List: transport label + truck number badge in rows
- i18n: transport + truckLabel/truckPlaceholder in en/ms/zh
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com >
Claude-Session: https://claude.ai/code/session_01CPf5Rc8QPx6V8KLEEgfKEQ
2026-07-13 10:56:07 +08:00
admin and Claude Sonnet 4.6
5416929cab
feat: show investigation panel on incident detail page
...
Fetches investigation record (5-Why steps, findings, root cause,
alcohol test, witness refs) and renders below incident details.
Shows completion status and investigator name.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com >
Claude-Session: https://claude.ai/code/session_01CPf5Rc8QPx6V8KLEEgfKEQ
2026-07-13 10:15:08 +08:00
admin and Claude Sonnet 4.6
e9fd29035a
fix: allow admin role to access triage and investigation pages
...
Role guard was hse-only — admin was redirected to inbox on click.
Both triage and investigation now accept hse or admin.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com >
Claude-Session: https://claude.ai/code/session_01CPf5Rc8QPx6V8KLEEgfKEQ
2026-07-13 10:00:17 +08:00
admin
3776bc20b3
fix: rename Anthropic→DeepSeek label in settings, darken text colors
2026-07-12 22:35:02 +08:00
admin
c0ec6660ef
feat: sticky incident header with top-positioned action buttons ( fix #5 )
2026-07-12 16:44:42 +08:00
admin and Claude 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
dfca872629
feat: CSV export endpoint for HSE and management dashboards
2026-07-11 18:44:52 +08:00
admin and Claude Sonnet 4.6
b9ab94c9da
feat: API key settings page — store ANTHROPIC/VOYAGE keys in DB with admin UI
...
- Migration: app_settings table with admin-only RLS (ANTHROPIC_API_KEY, VOYAGE_API_KEY)
- lib/settings.ts: getApiKey() reads DB first, falls back to env var
- lib/claude/client.ts: factory createAnthropicClient(apiKey) replaces singleton
- lib/claude/embed.ts: optional apiKey param, falls back to env
- 3 Claude AI routes + similar route: fetch key from settings before calling AI
- incidents/route.ts: fire-and-forget embed reads VOYAGE key from settings
- GET/POST /api/settings: admin-only masked key management endpoint
- /hse/settings page + ApiKeyForm client component
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com >
Claude-Session: https://claude.ai/code/session_01FFDuBhMKvoWjrWT3ZnGmmr
2026-07-11 17:46:40 +08:00
admin and Claude Sonnet 4.6
3473cf8ab7
feat: dashboard — leading/lagging, zone heatmap, CAPA on-time rate, DOSH filing status
...
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com >
Claude-Session: https://claude.ai/code/session_01FFDuBhMKvoWjrWT3ZnGmmr
2026-07-11 16:38:57 +08:00
admin and Claude Sonnet 4.6
547cc6e817
feat: pgvector similar-incident retrieval + SimilarIncidentsPanel
...
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com >
Claude-Session: https://claude.ai/code/session_01FFDuBhMKvoWjrWT3ZnGmmr
2026-07-11 16:31:02 +08:00
admin and Claude Opus 4.8
54332d0297
feat: JKKP 6/7 PDF generation via pdf-lib, download from incident detail
...
Also excludes node_modules.nosync from vitest test discovery to fix pre-existing bleed.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com >
Claude-Session: https://claude.ai/code/session_01FFDuBhMKvoWjrWT3ZnGmmr
2026-07-11 15:24:18 +08:00
admin and Claude Opus 4.8
804b1fbf33
feat: verification flow — HSE verify/reopen CAPA, auto-transition incident to verification
...
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com >
Claude-Session: https://claude.ai/code/session_01FFDuBhMKvoWjrWT3ZnGmmr
2026-07-11 15:18:17 +08:00
admin and Claude Opus 4.8
1780586185
feat: CAPA board — kanban/table view, create CAPA from incident, status tracking
...
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com >
Claude-Session: https://claude.ai/code/session_01FFDuBhMKvoWjrWT3ZnGmmr
2026-07-11 15:16:49 +08:00
admin and Claude Opus 4.8
63cb28f520
feat: investigation workspace — 5-Why/fishbone RCA, transitions triaged→investigating→capa_pending
...
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com >
Claude-Session: https://claude.ai/code/session_01FFDuBhMKvoWjrWT3ZnGmmr
2026-07-11 15:14:27 +08:00
admin and Claude Opus 4.8
e55c5284a7
feat: triage panel — severity + DOSH checklist, transitions reported→triaged
...
Also excludes node_modules.nosync from tsconfig to fix pre-existing TS type check bleed.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com >
Claude-Session: https://claude.ai/code/session_01FFDuBhMKvoWjrWT3ZnGmmr
2026-07-11 15:12:35 +08:00
admin and Claude Sonnet 4.6
33875395fb
fix: cast Supabase join types through unknown for TSC compatibility
...
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com >
Claude-Session: https://claude.ai/code/session_01AWxyMibCuGGtSQSqfajDQ7
2026-07-11 07:57:00 +08:00
admin and Claude Sonnet 4.6
7d3f8ec757
fix: export Incident types, replace any casts with typed unknown casts
...
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com >
Claude-Session: https://claude.ai/code/session_01AWxyMibCuGGtSQSqfajDQ7
2026-07-11 07:55:26 +08:00
admin and Claude Sonnet 4.6
b281420810
feat: HSE dashboard with incident stats by type and site
...
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com >
Claude-Session: https://claude.ai/code/session_01AWxyMibCuGGtSQSqfajDQ7
2026-07-11 07:40:22 +08:00
admin and Claude Sonnet 4.6
713556631b
feat: incident detail page with evidence gallery for HSE and supervisor roles
...
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com >
Claude-Session: https://claude.ai/code/session_01AWxyMibCuGGtSQSqfajDQ7
2026-07-11 07:40:06 +08:00
admin and Claude Sonnet 4.6
2f2018f27a
feat: incident inbox pages with filter/search for HSE and supervisor roles
...
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com >
Claude-Session: https://claude.ai/code/session_01AWxyMibCuGGtSQSqfajDQ7
2026-07-11 07:39:43 +08:00
admin and Claude Sonnet 4.6
c3ba543ebb
feat: add protected role dashboard placeholders
...
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com >
Claude-Session: https://claude.ai/code/session_01AWxyMibCuGGtSQSqfajDQ7
2026-07-09 22:32:29 +08:00