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:
@@ -11,6 +11,7 @@ const TYPE_LABELS: Record<string, string> = {
|
||||
environmental: 'Environmental',
|
||||
security: 'Security',
|
||||
fire: 'Fire / Emergency',
|
||||
transport: 'Transport / Vehicle',
|
||||
}
|
||||
|
||||
const STATUS_COLORS: Record<string, string> = {
|
||||
@@ -31,6 +32,7 @@ export type Incident = {
|
||||
reported_at: string
|
||||
sites: { name: string } | null
|
||||
zones: { name: string } | null
|
||||
trucks: { truck_no: string } | null
|
||||
reporter: { name: string } | null
|
||||
}
|
||||
|
||||
@@ -113,6 +115,9 @@ export function IncidentList({ incidents, basePath }: Props) {
|
||||
{TYPE_LABELS[inc.incident_type] ?? inc.incident_type}
|
||||
{inc.zones?.name && ` · ${inc.zones.name}`}
|
||||
{inc.sites?.name && ` · ${inc.sites.name}`}
|
||||
{inc.trucks?.truck_no && (
|
||||
<span className="ml-1 text-xs text-gray-400">· {inc.trucks.truck_no}</span>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
<div className="ml-4 text-right">
|
||||
|
||||
Reference in New Issue
Block a user