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
This commit is contained in:
2026-07-13 10:56:07 +08:00
co-authored by Claude Sonnet 4.6
parent 6c1ad71643
commit f90bf4ed03
16 changed files with 266 additions and 26 deletions
+12 -1
View File
@@ -32,6 +32,12 @@ export default async function ReportPage({ searchParams }: Props) {
}
}
const { data: trucks } = await supabase
.from('trucks')
.select('id, truck_no, carrier')
.eq('active', true)
.order('truck_no')
return (
<main className="min-h-screen bg-gray-50 py-6 px-4 max-w-lg mx-auto">
<div className="mb-6">
@@ -47,7 +53,12 @@ export default async function ReportPage({ searchParams }: Props) {
<p className="text-sm text-amber-600 mt-1">No zone detected zone will not be recorded</p>
)}
</div>
<ReportForm zoneToken={zone ?? null} zoneName={zoneName} siteName={siteName} />
<ReportForm
zoneToken={zone ?? null}
zoneName={zoneName}
siteName={siteName}
trucks={(trucks ?? []) as Array<{ id: string; truck_no: string; carrier: string | null }>}
/>
<OfflineSync />
</main>
)