import Link from "next/link"; import { useLocale, useTranslations } from "next-intl"; import { ChevronRight, Clock, MapPin, Navigation, Siren } from "lucide-react"; import { cn } from "@/lib/utils"; import { fmtWindow } from "@/lib/field/format"; import type { OrderCard as OrderCardData } from "@/server/services/field/queries"; import { StatusBadge } from "./status-badge"; import { btnPrimary, toneClasses } from "./ui"; /** Large order card (Spec ยง22): number, customer, site address with map link, time window, status, primary button. */ export function OrderCard({ order }: { order: OrderCardData }) { const t = useTranslations("field.card"); const locale = useLocale(); const window = fmtWindow(order.plannedStart, order.plannedEnd, locale); return (
{order.number}

{order.title}

{order.customerName}

{(order.isEmergency || order.priority === "urgent" || order.priority === "high") && (

{order.isEmergency ? t("emergency") : order.priority === "urgent" ? t("urgent") : t("high")}

)}
{window ?? t("noDate")}
{order.address && (
{order.siteName && {order.siteName}} {order.address}
{order.mapsUrl && ( {t("route")} )}
)}
{t("open")}
); }