/* global window, React */ // ============================================================ // Trip detail — Tab 3: Fleet & Carrier // ============================================================ function DriverChip({ d }) { return ( {d.initial} {d.name} · {d.hos} · {d.score} {d.badges.map(b => {b})} ); } function FleetCard({ opt, onConfirm }) { const cls = [ 'fleet-card', opt.recommended && 'fleet-card--recommended', opt.unavailable && 'fleet-card--unavailable', opt.spot && 'fleet-card--spot', ].filter(Boolean).join(' '); const kindLabel = { private: 'Private fleet', dedicated: 'Dedicated', market: 'Market vehicle', spot: 'Spot market', }[opt.kind]; const kindPill = { private: 'green', dedicated: 'amber', market: 'blue', spot: 'red', }[opt.kind]; const c2s = opt.costToServe; const c2sBench = 7.5; // lane benchmark const c2sKind = c2s == null ? 'na' : c2s > c2sBench * 1.2 ? 'red' : c2s < c2sBench * 0.8 ? 'green' : 'amber'; return (
{opt.recommended && RECOMMENDED}
{kindLabel} {opt.name} {!opt.unavailable && c2s != null && ( cost-to-serve {c2s}% {c2s > c2sBench ? '+' : ''}{(c2s - c2sBench).toFixed(1)} vs lane )}
{opt.meta.map(([k, v], i) => ( {k}: {v} ))} {opt.costToServeDollar && ( Vs invoice ${opt.costToServeDollar.toLocaleString()} / ${(opt.costToServeDollar / (c2s / 100)).toLocaleString(undefined,{maximumFractionDigits:0})} )}
{opt.drivers && (
{opt.drivers.map(d => )}
)} {opt.note &&
{opt.note.text}
}
{opt.cta && ( )}
); } function FleetTab({ trip, onConfirm }) { const invoice = trip.loadInvoice; const c2sBench = 7.5; return (
{trip.fleetSummary}
{invoice && (
Load invoice${invoice.toLocaleString()} Lane benchmark CtS{c2sBench}% Eligible options{trip.fleetOptions.filter(o => !o.unavailable).length} of {trip.fleetOptions.length}
)}
{trip.fleetOptions.map((opt, i) => ( onConfirm(opt)} /> ))}
); } Object.assign(window, { FleetTab });