Skip to content

[Frontend] Build New Shipment Form Page #577

@mftee

Description

@mftee

Description:
Build the multi-section form for shippers to create a new shipment. The form uses react-hook-form + zod and is grouped into logical card sections: Route, Cargo Details, Pricing, Schedule & Notes.

Create frontend/app/(dashboard)/shipments/new/page.tsx.

Acceptance Criteria:

  • 'use client' directive
  • Zod schema validates all fields — see CreateShipmentDto for rules
  • Form sections (each in a <Card>):
    1. Route — origin, destination (side by side on sm+)
    2. Cargo Details — description textarea (min 10), weight, optional volume
    3. Pricing — price, currency (default USD)
    4. Schedule & Notes — pickupDate, estimatedDeliveryDate (datetime-local inputs), notes textarea
  • Submit calls shipmentApi.create(payload), then toast.success + router.push(/shipments/${shipment.id})
  • On error: toast.error()
  • Submit button disabled + shows "Creating…" while submitting
  • Cancel button calls router.back()
  • All field errors shown inline below the relevant input

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions