feat(admin): truck report link + pre-fill form via ?truck_id=

Scanning truck QR opens /ims/report?truck_id=<id>, which pre-selects
incident_type=transport and the truck in the form. TruckManager shows
"Report link / QR target" per truck, mirroring zones.

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 11:49:56 +08:00
co-authored by Claude Sonnet 4.6
parent f90bf4ed03
commit 370b985375
3 changed files with 26 additions and 15 deletions
+3 -2
View File
@@ -7,11 +7,11 @@ import { LanguageSwitcher } from '@/components/language-switcher'
import { OfflineSync } from '@/components/incidents/offline-sync'
interface Props {
searchParams: Promise<{ zone?: string }>
searchParams: Promise<{ zone?: string; truck_id?: string }>
}
export default async function ReportPage({ searchParams }: Props) {
const { zone } = await searchParams
const { zone, truck_id } = await searchParams
const supabase = await createClient()
const { data, error: authError } = await supabase.auth.getUser()
@@ -58,6 +58,7 @@ export default async function ReportPage({ searchParams }: Props) {
zoneName={zoneName}
siteName={siteName}
trucks={(trucks ?? []) as Array<{ id: string; truck_no: string; carrier: string | null }>}
initialTruckId={truck_id ?? null}
/>
<OfflineSync />
</main>