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
+8
View File
@@ -8,6 +8,7 @@ const TYPE_LABELS: Record<string, string> = {
environmental: 'Environmental',
security: 'Security',
fire: 'Fire / Emergency',
transport: 'Transport / Vehicle',
}
const STATUS_COLORS: Record<string, string> = {
@@ -42,6 +43,7 @@ export type Incident = {
type_details?: Record<string, string | boolean> | null
sites: { id: string; name: string } | null
zones: { id: string; name: string } | null
trucks: { id: string; truck_no: string; carrier: string | null } | null
reporter: { id: string; name: string; email: string } | null
evidence_files: Array<{
id: string
@@ -86,6 +88,12 @@ export function IncidentDetail({ incident }: Props) {
<dl className="grid grid-cols-2 gap-4 sm:grid-cols-3">
<Field label="Site" value={incident.sites?.name} />
<Field label="Zone" value={incident.zones?.name} />
{incident.trucks && (
<Field
label="Truck"
value={`${incident.trucks.truck_no}${incident.trucks.carrier ? `${incident.trucks.carrier}` : ''}`}
/>
)}
<Field label="Reported by" value={incident.reporter?.name} />
<Field label="Reported at" value={new Date(incident.reported_at).toLocaleString('en-MY', { timeZone: 'Asia/Kuala_Lumpur' })} />
<Field label="Severity" value={incident.severity ? `Level ${incident.severity}` : 'Not yet assigned'} />