/* global window, React, LoadCompositionTab, RoutingTab, FleetTab, LoadViewTab */ // ============================================================ // Trip detail panel — header + tab nav + content // ============================================================ const { useState: useDetailState } = React; function DetailHeader({ trip, focus, onToggleFocus, onConfirm, onClose, onHold, onSplit, onCancel, onEdit, lpStatus }) { // Status pill — lpStatus overrides let statusLabel = trip.status; let statusKind = 'pill--grey'; if (lpStatus && lpStatus.status === 'PENDING') { statusLabel = 'WAITING · LOAD PLANNER'; statusKind = 'pill--amber'; } else if (lpStatus && lpStatus.status === 'CONFIRMED') { statusLabel = 'LP-CONFIRMED · ' + trip.status; statusKind = 'pill--green'; } return (
{onClose && ( )} {trip.id} · {statusLabel} · {trip.wave}
{trip.route.from} {trip.route.to}
{trip.fleetLabel} Window{trip.window.icon} {trip.window.value} Mode{trip.mode} Weight{trip.weight} Est. cost{trip.cost} {trip.chips.some(c => /OTIF/i.test(c.label)) && ( <> OTIF risk )}
); } function DetailPanel({ trip, focus, onToggleFocus, onConfirm, onClose, onHold, onSplit, onCancel, onEdit, lpStatus, onSendToLoadPlanner }) { const [tab, setTab] = useDetailState('load'); // Reset to load tab when trip changes React.useEffect(() => { setTab('load'); }, [trip.id]); const tabs = [ { id: 'load', num: '1', label: 'Load composition' }, { id: 'routing', num: '2', label: 'Routing feasibility' }, { id: 'fleet', num: '3', label: 'Fleet & carrier' }, { id: 'view', num: '4', label: '3D load view' }, ]; return (
{tabs.map(t => ( ))}
{tab === 'load' && } {tab === 'routing' && } {tab === 'fleet' && } {tab === 'view' && }
); } Object.assign(window, { DetailPanel });