diff --git a/frontend/src/components/ReturnForm.tsx b/frontend/src/components/ReturnForm.tsx index 0b262f1..cd776a8 100644 --- a/frontend/src/components/ReturnForm.tsx +++ b/frontend/src/components/ReturnForm.tsx @@ -2,6 +2,8 @@ import { useState, type FormEvent } from "react"; import { Link } from "react-router-dom"; import { api, ApiError } from "../api/client"; import type { RegisterReturnRequest, RegisterReturnResult } from "../api/types"; +import { Icon } from "./Icons"; +import { StatusBadge } from "./Badge"; function newIdempotencyKey(): string { return typeof crypto.randomUUID === "function" @@ -11,11 +13,11 @@ function newIdempotencyKey(): string { export function ReturnResultPanel({ result }: { result: RegisterReturnResult }) { return ( -
-

Return registered

+
+

Committed locally

Return registered

Inspection
{result.inspection_ref}
-
Resulting vehicle status
{result.resulting_vehicle_status}
+
Resulting vehicle status
Quality issue
{result.quality_issue_ref ?? "None created"}
@@ -38,7 +40,7 @@ export function ReturnResultPanel({ result }: { result: RegisterReturnResult })

)}

- View vehicle {result.vehicle_ref} + View vehicle {result.vehicle_ref}

); @@ -60,9 +62,14 @@ export function ReturnForm({ const [submitting, setSubmitting] = useState(false); const [error, setError] = useState(null); const [idempotencyKey] = useState(newIdempotencyKey); + const [step, setStep] = useState<"capture" | "review">("capture"); async function handleSubmit(e: FormEvent) { e.preventDefault(); + if (step === "capture") { + setStep("review"); + return; + } setError(null); setSubmitting(true); try { @@ -93,10 +100,12 @@ export function ReturnForm({ return (
-

Register return

+
1 Capture2 Review3 Result
+

Booking {bookingRef}

{step === "capture" ? "Register vehicle return" : "Review return impact"}

{step === "capture" ? "Record the hand-back condition. Operational consequences are calculated on commit." : "Confirm the inspection facts before they update fleet state and queue automation."}

{error &&

{error}

} -