1import{j as e}from"./motion-vendor-Cz_00NEr.js";import{C as We,a as Ye,b as Ke,c as Ge}from"./card-D5T867nV.js";import{B as N}from"./badge-HIStf8Mt.js";import{B as E}from"./button-DOchPDrV.js";import{D as ke,a as ye,b as we,c as Ce,e as Se}from"./dialog-C7qXZicC.js";import{S as f}from"./skeleton-Do8alTNQ.js";import{u as _e,L as Je}from"./app-aTdzWBDu.js";import{r as c}from"./chart-vendor-B-VQbykd.js";import{az as Te,c as B,bu as Ze,G as Qe,a4 as De,T as v,b$ as es,O as ss,br as je,F as ts,j as as,S as ls,X as T,W as se,E as rs,C as is,a as ns}from"./lucide-vendor-8-PKSlXP.js";import{I as z}from"./input--S9SS-6I.js";import{P as V}from"./pro-feature-badge-DePHEn1a.js";import{S as ge,a as Ne,b as fe,c as be,d as A}from"./select-CmxhGi0o.js";import{U as cs}from"./upgrade-plan-badge-D-mh-X0G.js";import{u as te,E as ae}from"./use-entitlement-Wq2b9INw.js";import{g as ds}from"./equipment-0PXFJfn4.js";import"./utils-xkQX3TMC.js";import"./radix-vendor-DJL5Jd1K.js";import"./map-vendor-BpJlxU9q.js";import"./index-DOxD5jeF.js";/* empty css */import"./popover-BYflJnU-.js";import"./upgrade-button-BlI5qPok.js";const os={filing:{label:"Filing",icon:es,badge:"border-sky-200 bg-sky-50 text-sky-700 dark:border-sky-800 dark:bg-sky-950/40 dark:text-sky-300",border:"border-sky-200 dark:border-sky-800",dot:"bg-sky-500 dark:bg-sky-400",iconColor:"text-sky-600 dark:text-sky-300"},fleet:{label:"Fleet",icon:v,badge:"border-emerald-200 bg-emerald-50 text-emerald-700 dark:border-emerald-800 dark:bg-emerald-950/40 dark:text-emerald-300",border:"border-emerald-200 dark:border-emerald-800",dot:"bg-emerald-500 dark:bg-emerald-400",iconColor:"text-emerald-600 dark:text-emerald-300"},drivers:{label:"Drivers",icon:De,badge:"border-violet-200 bg-violet-50 text-violet-700 dark:border-violet-800 dark:bg-violet-950/40 dark:text-violet-300",border:"border-violet-200 dark:border-violet-800",dot:"bg-violet-500 dark:bg-violet-400",iconColor:"text-violet-600 dark:text-violet-300"},mileage:{label:"Mileage",icon:Qe,badge:"border-amber-200 bg-amber-50 text-amber-700 dark:border-amber-800 dark:bg-amber-950/40 dark:text-amber-300",border:"border-amber-200 dark:border-amber-800",dot:"bg-amber-500 dark:bg-amber-400",iconColor:"text-amber-600 dark:text-amber-300"}};function ms({dotNumber:t,isOpen:r,onOpenChange:k}){const[g,p]=c.useState(null),[b,D]=c.useState(!1),[F,I]=c.useState(!1),{shared_domain_id:W}=_e().props;c.useEffect(()=>{r&&t&&P(t)},[r,t]),c.useEffect(()=>{r||(p(null),I(!1))},[r]);const P=async h=>{D(!0),I(!1);try{const d=await fetch(route("company.result.mcs150-change-history",{dotNumber:h}),{headers:{Accept:"application/json","Content-Type":"application/json","X-Shared-Domain-Id":W?.toString()??""}});if(d.ok){const w=await d.json();p(w.data)}else console.error("Error fetching MCS-150 history:",d),p(null),I(!0)}catch(d){console.error("Error fetching MCS-150 history:",d),p(null),I(!0)}finally{D(!1)}},i=g?.events??[],L=c.useMemo(()=>i.reduce((h,d)=>{const w=d.date||"unknown";return h[w]??=[],h[w].push(d),h},{}),[i]),Y=c.useMemo(()=>Object.keys(L).sort((h,d)=>new Date(d).getTime()-new Date(h).getTime()),[L]);return e.jsx(ke,{open:r,onOpenChange:k,children:e.jsxs(ye,{className:"max-h-[90vh] max-w-[95vw] overflow-y-auto sm:max-w-2xl",children:[e.jsxs(we,{className:"max-w-full text-left",children:[e.jsxs(Ce,{className:"flex min-w-0 items-center",children:[e.jsx(Te,{className:"mr-2 h-5 w-5 shrink-0"}),e.jsx("span",{className:"min-w-0 truncate",children:"MCS-150 Change History"})]}),e.jsx(Se,{children:t?`Historical fleet, driver, filing, and mileage changes for DOT ${t}`:"View MCS-150 history"})]}),b?e.jsxs("div",{className:"space-y-3 py-4","aria-live":"polite","aria-label":"Loading MCS-150 history",children:[e.jsx(f,{className:"h-20 w-full"}),e.jsx(f,{className:"h-20 w-full"}),e.jsx(f,{className:"h-20 w-full"})]}):F?e.jsxs("div",{className:"py-8 text-center text-slate-500 dark:text-slate-400","aria-live":"polite",children:[e.jsx(B,{className:"mx-auto mb-2 h-8 w-8 text-slate-400 dark:text-slate-500","aria-hidden":!0}),e.jsx("p",{children:"Unable to load MCS-150 history"}),t&&e.jsx(E,{variant:"outline",size:"sm",className:"mt-3",onClick:()=>P(t),children:"Try again"})]}):i.length>0?e.jsxs("div",{className:"space-y-4 py-2",children:[e.jsxs("div",{className:"mb-2 text-sm text-slate-500 dark:text-slate-400",children:[i.length.toLocaleStr
1ing()," change",i.length===1?"":"s"," found"]}),e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute top-2 bottom-2 left-4 w-0.5 bg-slate-200 dark:bg-slate-700","aria-hidden":!0}),Y.map(h=>e.jsxs("div",{className:"mb-6",children:[e.jsxs("div",{className:"relative pb-2 pl-10",children:[e.jsx("div",{className:"absolute top-1 left-2 flex h-4 w-4 items-center justify-center rounded-full border-2 border-white bg-slate-300 dark:border-slate-900 dark:bg-slate-600",children:e.jsx(Ze,{className:"h-2.5 w-2.5 text-slate-600 dark:text-slate-300","aria-hidden":!0})}),e.jsx("time",{className:"text-sm font-semibold text-slate-700 dark:text-slate-200",dateTime:h,children:Ie(h)})]}),L[h].map(d=>e.jsx(xs,{event:d},d.id))]},h))]})]}):e.jsxs("div",{className:"py-8 text-center text-slate-500 dark:text-slate-400",children:[e.jsx(B,{className:"mx-auto mb-2 h-8 w-8 text-slate-400 dark:text-slate-500","aria-hidden":!0}),e.jsx("p",{children:"No MCS-150 changes found"}),e.jsx("p",{className:"mt-1 text-xs",children:"Fleet, driver, filing, and mileage changes will appear here when they occur."})]})]})})}function xs({event:t}){const r=os[t.field_group],k=r.icon,g=ve(t.old_value,t.value_type,"Empty"),p=ve(t.new_value,t.value_type,"Empty");return e.jsxs("article",{className:"relative pb-3 pl-10",children:[e.jsx("div",{className:`absolute top-2 left-2.5 h-3 w-3 rounded-full border-2 border-white ${r.dot} dark:border-slate-900`,"aria-hidden":!0}),e.jsxs("div",{className:`rounded-lg border bg-white p-3 dark:bg-slate-800/50 ${r.border}`,children:[e.jsxs("div",{className:"mb-2 flex min-w-0 items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx(k,{className:`h-4 w-4 shrink-0 ${r.iconColor}`,"aria-hidden":!0}),e.jsx("span",{className:"min-w-0 truncate text-sm font-medium text-slate-700 dark:text-slate-200",title:t.field_label,children:t.field_label})]}),e.jsx(N,{variant:"outline",className:`shrink-0 ${r.badge}`,children:r.label})]}),e.jsxs("div",{className:"grid min-w-0 grid-cols-[minmax(0,1fr)_auto_minmax(0,1fr)] items-center gap-2 text-sm",children:[e.jsx("span",{className:"min-w-0 truncate text-slate-500 line-through [font-variant-numeric:tabular-nums] dark:text-slate-400",title:g,children:g}),e.jsx(ss,{className:"h-4 w-4 shrink-0 text-slate-400 dark:text-slate-500","aria-hidden":!0}),e.jsx("span",{className:"min-w-0 truncate font-medium text-slate-700 [font-variant-numeric:tabular-nums] dark:text-slate-200",title:p,children:p})]})]})]})}function ve(t,r,k="-"){if(t===null||t==="")return k;if(r==="number"){const g=typeof t=="number"?t:Number(String(t).replaceAll(",",""));if(Number.isFinite(g))return new Intl.NumberFormat().format(g)}return r==="date"?Ie(String(t)):String(t)}function Ie(t){if(!t)return"-";const r=new Date(t.length===10?`${t}T00:00:00`:t);return Number.isNaN(r.getTime())?t:new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",year:"numeric"}).format(r)}const hs=["AL","AK","AZ","AR","CA","CO","CT","DE","FL","GA","HI","ID","IL","IN","IA","KS","KY","LA","ME","MD","MA","MI","MN","MS","MO","MT","NE","NV","NH","NJ","NM","NY","NC","ND","OH","OK","OR","PA","RI","SC","SD","TN","TX","UT","VT","VA","WA","WV","WI","WY"];function Ps({company:t}){const[r,k]=c.useState(),[g,p]=c.useState(!0),[b,D]=c.useState(null),[F,I]=c.useState(!1),[W,P]=c.useState(!1),[i,L]=c.useState(null),[Y,h]=c.useState(!1),[d,w]=c.useState(null),[Le,le]=c.useState(!0),{shared_domain_id:M,csrf_token:re,auth:ie,features:ne}=_e().props,n=te(ae.EquipmentDetails),Ee=te(ae.EquipmentDatabaseTool),Me=te(ae.CompanyChangeHistory),[us,O]=c.useState(!1),[C,H]=c.useState(1),[K,$e]=c.useState(5),[a,ce]=c.useState({type:"all",vin:"",licensePlate:"",licenseState:"",make:"",model:"",unitNumber:""}),[de,Ve]=c.useState(a),[G,Ae]=c.useState(!1),U=n&&(a.type!=="all"||a.vin!==""||a.licensePlate!==""||a.licenseState!==""||a.make!==""||a.model!==""||a.unitNumber!==""),oe=n?[a.type!=="all",a.vin!=="",a.licensePlate!=="",a.licenseState!=="",a.make!=="",a.model!=="",a.unitNumber!==""].filter(Boolean).length:0;c.useEffect(()=>{const s=setTimeout(()=>{Ve(a)},500);return()=>clearTimeout(s)},[a]);const u=(s,l)=>{ce(o=>({...o,[s]:l})),H(1)},Fe=()=>{ce({type:"all",vin:"",licensePlate:"",licenseState:"",make:"",model:"",unitNumber:""}),H(1)};c.useEffect(()=>{(async()=>{le(!0);try{const l=await fetch(route("company.result.equipment-summary",{dotNumber:t.dot_number}),{headers:{Accept:"application/json","Content-Type":"application/json","X-CSRF-TOKEN":re,"X-Shared-Domain-Id":M?.toString()??""}});if(l.ok){const o=await l.json();w(o.data)}else console.error("Error fetching equipment summary:",l),w(null)}catch(l){console.error("Error fetching equipment summary:",l),w(null)}finally{le(!1)}})()},[t.dot_number,M,re]),c.useEffect(()=>{const s=async(l,o=1,j=5,m,ee=!1)=>{performance.now();const q="company.result.equipment";let _=route(q,{dotNumber:l})+`?page=${o}&perPage=${j}`;return ee&&(m.type!=="all"&&(_+=`&equipmentType=${m.type}`),m.vin.trim()&&(_+=`&vin=${encodeURIComponent(m.vin.trim())}`),m.licensePlate.trim()&&(_+=`&licensePlate=${encodeURIComponent(m.licensePlate.trim())}`),m.licenseState.trim()&&(_+=`&licenseState=${encodeURIComponent(m.licenseState.trim())}`),m.make.trim()&&(_+=`&make=${encodeURIComponent(m.make.trim())}`),m.model.trim()&&(_+=`&model=${encodeURIComponent(m.model.trim())}`),m.unitNumber.trim()&&(_+=`&unitNumber=${encodeURIComponent(m.unitNumber.trim())}`)),await fetch(_,{headers:{Accept:"application/json","Content-Type":"application/json","X-Shared-Domain-Id":M?.toString()??""}}).then(R=>R.ok?R.json().then(Be=>(performance.now(),Be)):(console.error(`Error fetching ${q}:`,R),{data:[],meta:{current_page:1,last_page:1,total:0}})).catch(R=>(console.error(`Error fetching ${q}:`,R),{data:[],meta:{current_page:1,last_page:1,total:0}}))};p(!0),s(t.dot_number,C,K,de,n).then(l=>{k(l),p(!1)})},[t.dot_number,C,K,de,n]),c.useEffect(()=>{if(M||!ie.user){O(!1);return}const s=String(ne["repowr-hint-mode"]||"auto");if(s==="never"){O(!1);return}if(s==="always"){O(!0);return}const l=Number(t.truck_units)||0,o=t.owntrail!=null?Number(t.owntrail):null,j=t.trmtrail!=null?Number(t.trmtrail):null,m=o!==null||j!==null,ee=(o||0)+(j||0),q=l===0||!m||ee<l;O(q)},[M,ie.user,ne,t.truck_units,t.owntrail,t.trmtrail]);const me=()=>r?.data||[],X=r?.meta?.last_page||1,xe=r?.meta?.total||0,Pe=()=>{r?.meta&&C<r.meta.last_page&&H(C+1)},He=()=>{C>1&&H(C-1)},Ue=s=>{$e(s),H(1)},he=s=>s.type||"Unknown",qe=s=>{const l=he(s).toLowerCase();return l.includes("truck")?e.jsx(v,{className:"mr-2 h-4 w-4 text-blue-500"}):l.includes("trailer")?e.jsx(v,{className:"mr-2 h-4 w-4 text-green-500"}):l.includes("chassis")?e.jsx(v,{className:"mr-2 h-4 w-4 text-amber-500"}):e.jsx(se,{className:"mr-2 h-4 w-4 text-orange-500"})},S=s=>{if(s==null)return null;const l=String(s).trim();if(l==="")return null;const o=Number.parseInt(l,10);return Number.isNaN(o)?null:o},y=s=>s===null?"-":s,$=(()=>{const s=S(t.truck_units),l=S(t.power_units),o=S(t.owntrail),j=S(t.trmtrail),m=o!==null&&j!==null?o+j:null;return{trucks:s,powerUnits:l,ownedTrailers:o,leasedTrailers:j,totalTrailers:m,totalUnits:s!==null&&m!==null?s+m:null}})(),J=S(t.total_drivers),Z=S(t.total_cdl),Re=J!==null&&Z!==null?Math.max(0,J-Z):null,Q={totalDrivers:J,cdlDrivers:Z,nonCdlDrivers:Re},ue=S(t.mcs150_mileage),pe=S(t.mcs150_mileage_year),ze=ue!==null?`${ue.toLocaleStr
1ing()} mi`:"-",Oe=async s=>{h(!0);try{const l=await fetch(route("equipment.details",{vin:s}),{headers:{Accept:"application/json","Content-Type":"application/json","X-Shared-Domain-Id":M?.toString()??""}});if(l.ok){const o=await l.json();L(o.data)}else console.error("Error fetching equipment details:",l),L(null)}catch(l){console.error("Error fetching equipment details:",l),L(null)}finally{h(!1)}},Xe=s=>{D(s),I(!0),Oe(s),setTimeout(()=>{const l=document.querySelector('[role="dialog"]');l&&l.scrollIntoView({behavior:"smooth",block:"center"})},100)};return e.jsxs(e.Fragment,{children:[e.jsxs(We,{className:"overflow-hidden",children:[e.jsx(Ye,{className:"bg-slate-50 py-1 dark:bg-slate-800/50",children:e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs(Ke,{className:"flex items-center text-xl font-semibold text-slate-800 dark:text-slate-100",children:[e.jsx(v,{className:"mr-2 h-5 w-5 text-slate-600 dark:text-slate-300"}),"Fleet Information"]})})}),e.jsxs(Ge,{className:"px-6",children:[e.jsxs("div",{className:"mb-8 grid grid-cols-1 gap-6 md:grid-cols-2",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("h3",{className:"text-md flex items-center font-medium text-slate-700 dark:text-slate-200",children:[e.jsx(v,{className:"mr-1 h-4 w-4 text-slate-600 dark:text-slate-300"}),"Equipment Summary",!n&&e.jsx(V,{size:"sm",className:"ml-2",plan:"search"})]}),n?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(x,{label:"Trucks",value:y($.trucks),isLoading:!1}),e.jsx(x,{label:"Trailers (Owned)",value:y($.ownedTrailers),isLoading:!1}),e.jsx("div",{}),e.jsx(x,{label:"Trailers (Leased)",value:y($.leasedTrailers),isLoading:!1})]}),!Le&&d&&d.total_count>0&&e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:`${n?"":"relative"}`,children:[e.jsx(x,{label:"Avg Truck Age",value:n&&d.truck_average_age?`${Math.round(d.truck_average_age)} years`:"-",isLoading:!1,small:!0,valueClassName:n?"":"blur-sm select-none"}),!n&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center rounded-lg bg-white/50 dark:bg-slate-800/50",children:e.jsx(V,{size:"sm",plan:"search"})})]}),e.jsxs("div",{className:`${n?"":"relative"}`,children:[e.jsx(x,{label:"Avg Trailer Age",value:n&&d.trailer_average_age?`${Math.round(d.trailer_average_age)} years`:"-",isLoading:!1,small:!0,valueClassName:n?"":"blur-sm select-none"}),!n&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center rounded-lg bg-white/50 dark:bg-slate-800/50",children:e.jsx(V,{size:"sm",plan:"search"})})]}),e.jsxs("div",{className:`${n?"":"relative"}`,children:[e.jsx(x,{label:"Popular Truck Make",value:n&&d.truck_most_popular_make?d.truck_most_popular_make:"Freightliner",isLoading:!1,small:!0,valueClassName:n?"":"blur-sm select-none"}),!n&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center rounded-lg bg-white/50 dark:bg-slate-800/50",children:e.jsx(V,{size:"sm",plan:"search"})})]}),e.jsxs("div",{className:`${n?"":"relative"}`,children:[e.jsx(x,{label:"Popular Trailer Make",value:n&&d.trailer_most_popular_make?d.trailer_most_popular_make:"Utility",isLoading:!1,small:!0,valueClassName:n?"":"blur-sm select-none"}),!n&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center rounded-lg bg-white/50 dark:bg-slate-800/50",children:e.jsx(V,{size:"sm",plan:"search"})})]})]})]}):e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(x,{label:"Trucks",value:y($.trucks),isLoading:!1}),e.jsx(x,{label:"Trailers (Owned)",value:y($.ownedTrailers),isLoading:!1}),e.jsx(x,{label:"Trailers (Leased)",value:y($.leasedTrailers),isLoading:!1})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("h3",{className:"text-md flex items-center font-medium text-slate-700 dark:text-slate-200",children:[e.jsx(De,{className:"mr-1 h-4 w-4 text-slate-600 dark:text-slate-300"}),"Driver Summary"]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(x,{label:"Total Drivers",value:y(Q.totalDrivers),isLoading:!1,className:"bg-indigo-50/50 dark:bg-indigo-900/20",larger:!0}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"text-sm font-medium text-slate-700 dark:text-slate-300",children:"Driver Details"}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsx(x,{label:"CDL Drivers",value:y(Q.cdlDrivers),isLoading:!1,small:!0}),e.jsx(x,{label:"Non-CDL Drivers",value:y(Q.nonCdlDrivers),isLoading:!1,small:!0})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsx(x,{label:"Interstate",value:parseInt(t.interstate_beyond_100_miles)+parseInt(t.interstate_within_100_miles)||0,isLoading:!1,small:!0}),e.jsx(x,{label:"Intrastate",value:parseInt(t.intrastate_beyond_100_miles)+parseInt(t.intrastate_within_100_miles)||0,isLoading:!1,small:!0})]})]})]}),e.jsxs("div",{className:"space-y-2 md:col-span-2",children:[e.jsxs("div",{className:"text-sm font-medium text-slate-700 dark:text-slate-300",children:["MCS-150 Mileage",pe!==null&&e.jsxs("span",{className:"ml-1 text-xs font-normal text-slate-500 dark:text-slate-400",children:["(",pe,")"]})]}),e.jsxs("div",{className:"flex flex-wrap items-end justify-between gap-2",children:[e.jsx("div",{className:"w-full min-w-0 sm:w-64",children:e.jsx(x,{label:"Annual Miles",value:ze,isLoading:!1,small:!0})}),Me?e.jsxs(E,{variant:"outline",size:"sm",onClick:()=>P(!0),className:"ml-auto h-11 shrink-0 text-xs md:h-8","aria-label":`View MCS-150 change history for DOT ${t.dot_number}`,children:[e.jsx(Te,{className:"mr-1.5 h-3.5 w-3.5"}),"View Historical"]}):e.jsx(cs,{plan:"search",size:"sm",showLabel:!0,hintSuffix:"MCS-150 change history",tooltip:"Upgrade to Search to view MCS-150 change history",className:"ml-auto"})]})]})]}),e.jsxs("div",{className:"mt-6",children:[e.jsxs("div",{className:"mb-4 flex flex-wrap items-center justify-between gap-2",children:[e.jsxs("h3",{className:"text-md flex items-center font-medium text-slate-700 dark:text-slate-200",children:[e.jsx(je,{className:"mr-1 h-4 w-4 text-slate-600 dar
1k:text-slate-300"}),"Equipment Details",!n&&e.jsx(V,{size:"sm",className:"ml-2",plan:"search"})]}),n&&e.jsxs(E,{variant:"outline",size:"sm",onClick:()=>Ae(!G),className:"flex items-center gap-1 text-xs",children:[e.jsx(ts,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"hidden sm:inline",children:"Search"}),oe>0&&e.jsx(N,{className:"ml-1 flex h-5 w-5 items-center justify-center bg-blue-500 p-0 text-xs text-white",children:oe}),e.jsx(as,{className:`h-3.5 w-3.5 transition-transform ${G?"rotate-180":""}`})]})]}),n&&G&&e.jsxs("div",{className:"mb-4 rounded-lg border border-slate-200 bg-slate-50 p-4 dark:border-slate-700 dark:bg-slate-800/50",children:[e.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center text-sm font-medium text-slate-700 dark:text-slate-300",children:[e.jsx(ls,{className:"mr-1 h-4 w-4"}),"Search Equipment"]}),U&&e.jsxs(E,{variant:"ghost",size:"sm",onClick:Fe,className:"h-7 px-2 text-xs text-slate-500 hover:text-slate-700 dark:text-slate-400 dark:hover:text-slate-200",children:[e.jsx(T,{className:"mr-1 h-3 w-3"}),"Clear All"]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-3 lg:grid-cols-6",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-xs text-slate-500 dark:text-slate-400",children:"Type"}),e.jsxs(ge,{value:a.type,onValueChange:s=>u("type",s),children:[e.jsx(Ne,{className:"h-8 text-xs",children:e.jsx(fe,{placeholder:"All Types"})}),e.jsxs(be,{children:[e.jsx(A,{value:"all",children:"All Types"}),e.jsx(A,{value:"truck",children:e.jsxs("span",{className:"flex items-center",children:[e.jsx(v,{className:"mr-1 h-3 w-3 text-blue-500"}),"Truck"]})}),e.jsx(A,{value:"trailer",children:e.jsxs("span",{className:"flex items-center",children:[e.jsx(v,{className:"mr-1 h-3 w-3 text-green-500"}),"Trailer"]})}),e.jsx(A,{value:"other",children:e.jsxs("span",{className:"flex items-center",children:[e.jsx(se,{className:"mr-1 h-3 w-3 text-orange-500"}),"Other"]})})]})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-xs text-slate-500 dark:text-slate-400",children:"VIN"}),e.jsx(z,{type:"text",placeholder:"Search VIN...",value:a.vin,onChange:s=>{const l=s.target.value.toUpperCase().replace(/[^A-HJ-NPR-Z0-9]/g,"");u("vin",l)},className:"h-8 font-mono text-xs",maxLength:17})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-xs text-slate-500 dark:text-slate-400",children:"License Plate"}),e.jsx(z,{type:"text",placeholder:"Plate #...",value:a.licensePlate,onChange:s=>u("licensePlate",s.target.value.toUpperCase()),className:"h-8 text-xs",maxLength:20})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-xs text-slate-500 dark:text-slate-400",children:"State"}),e.jsxs(ge,{value:a.licenseState||"all",onValueChange:s=>u("licenseState",s==="all"?"":s),children:[e.jsx(Ne,{className:"h-8 text-xs",children:e.jsx(fe,{placeholder:"All States"})}),e.jsxs(be,{className:"max-h-60",children:[e.jsx(A,{value:"all",children:"All States"}),hs.map(s=>e.jsx(A,{value:s,children:s},s))]})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-xs text-slate-500 dark:text-slate-400",children:"Make"}),e.jsx(z,{type:"text",placeholder:"e.g. Freightliner",value:a.make,onChange:s=>u("make",s.target.value),className:"h-8 text-xs",maxLength:50})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-xs text-slate-500 dark:text-slate-400",children:"Model"}),e.jsx(z,{type:"text",placeholder:"e.g. Cascadia",value:a.model,onChange:s=>u("model",s.target.value),className:"h-8 text-xs",maxLength:50})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-xs text-slate-500 dark:text-slate-400",children:"Unit #"}),e.jsx(z,{type:"text",placeholder:"e.g. 101",value:a.unitNumber,onChange:s=>u("unitNumber",s.target.value),className:"h-8 text-xs",maxLength:50})]})]}),U&&e.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-2 border-t border-slate-200 pt-3 dark:border-slate-600",children:[e.jsx("span",{className:"text-xs text-slate-500 dark:text-slate-400",children:"Active:"}),a.type!=="all"&&e.jsxs(N,{variant:"secondary",className:"h-6 gap-1 text-xs",children:["Type: ",a.type,e.jsx("button",{type:"button",className:"inline-flex h-3 w-3 cursor-pointer items-center justify-center hover:text-red-500",onClick:s=>{s.preventDefault(),s.stopPropagation(),u("type","all")},children:e.jsx(T,{className:"h-3 w-3"})})]}),a.vin&&e.jsxs(N,{variant:"secondary",className:"h-6 gap-1 font-mono text-xs",children:["VIN: ",a.vin.substring(0,8),"...",e.jsx("button",{type:"button",className:"inline-flex h-3 w-3 cursor-pointer items-center justify-center hover:text-red-500",onClick:s=>{s.preventDefault(),s.stopPropagation(),u("vin","")},children:e.jsx(T,{className:"h-3 w-3"})})]}),a.licensePlate&&e.jsxs(N,{variant:"secondary",className:"h-6 gap-1 text-xs",children:["Plate: ",a.licensePlate,e.jsx("button",{type:"button",className:"inline-flex h-3 w-3 cursor-pointer items-center justify-center hover:text-red-500",onClick:s=>{s.preventDefault(),s.stopPropagation(),u("licensePlate","")},children:e.jsx(T,{className:"h-3 w-3"})})]}),a.licenseState&&e.jsxs(N,{variant:"secondary",className:"h-6 gap-1 text-xs",children:["State: ",a.licenseState,e.jsx("button",{type:"button",className:"inline-flex h-3 w-3 cursor-pointer items-center justify-center hover:text-red-500",onClick:s=>{s.preventDefault(),s.stopPropagation(),u("licenseState","")},children:e.jsx(T,{className:"h-3 w-3"})})]}),a.make&&e.jsxs(N,{variant:"secondary",className:"h-6 gap-1 text-xs",children:["Make: ",a.make,e.jsx("button",{type:"button",className:"inline-flex h-3 w-3 cursor-pointer items-center justify-center hover:text-red-500",onClick:s=>{s.preventDefault(),s.stopPropagation(),u("make","")},children:e.jsx(T,{className:"h-3 w-3"})})]}),a.model&&e.jsxs(N,{variant:"secondary",className:"h-6 gap-1 text-xs",children:["Model: ",a.model,e.jsx("button",{type:"button",className:"inline-flex h-3 w-3 cursor-pointer items-center justify-center hover:text-red-500",onClick:s=>{s.preventDefault(),s.stopPropagation(),u("model","")},children:e.jsx(T,{className:"h-3 w-3"})})]}),a.unitNumber&&e.jsxs(N,{variant:"secondary",className:"h-6 gap-1 text-xs",children:["Unit #: ",a.unitNumber,e.jsx("button",{type:"button",className:"inline-flex h-3 w-3 cursor-pointer items-center justify-center hover:text-red-500",onClick:s=>{s.preventDefault(),s.stopPropagation(),u("unitNumber","")},children:e.jsx(T,{className:"h-3 w-3"})})]})]})]}),g?e.jsxs("div",{className:"space-y-2",children:[e.jsx(f,{className:"h-8 w-full"}),e.jsx(f,{className:"h-16 w-full"}),e.jsx(f,{className:"h-16 w-full"})]}):e.jsx(e.Fragment,{children:me().length?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mb-2 flex items-center justify-between",children:e.jsxs("div",{className:"text-xs text-slate-500 dark:text-slate-400",children:["Page ",r?.meta?.current_page||1," of ",X,U?e.jsx(e.Fragment,{children:" (filtered results)"}):e.jsxs(e.Fragment,{children:[" (",xe," total)"]})]})}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full border-collapse",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-slate-200 bg-slate-50 dark:border-slate-700 dark:bg-slate-800",children:[e.jsx("th",{className:"px-4 py-2 text-left text-sm font-medium text-slate-700 dark:text-slate-300",children:"Type"}),e.jsx("th",{className:"px-4 py-2 text-left text-sm font-medium text-slate-700 dark:text-slate-300",children:"Make"}),e.jsx("th",{className:"px-4 py-2 text-left text-sm font-medium text-slate-700 dark:text-slate-300",children:"Sub Type"}),e.jsx("th",{className:"px-4 py-2 text-left text-sm font-medium text-slate-700 dark:text-slate-300",children:"License"}),e.jsx("th",{className:"px-4 py-2 text-left text-sm font-medium text-slate-700 dark:text-slate-300",children:"#"}),e.jsx("th",{className:"px-4 py-2 text-right text-sm font-medium text-slate-700 dark:text-slate-300",children:e.jsx("span",{className:"sr-only",children:"Details"})})]})}),e.jsx("tbody",{children:me().map((s,l)=>e.jsxs("tr",{className:"border-b border-slate-200 hover:bg-slate-50 dark:border-slate-700 dark:hover:bg-slate-800/50",children:[e.jsx("td",{className:"px-4 py-3 text-sm",children:e.jsxs("div",{className:"flex items-center",children:[qe(s),e.jsx("span",{children:he(s)||"-"})]})}),e.jsx("td",{className:"px-4 py-3 text-sm",children:n?s.make||"-":e.jsx("span",{className:"blur-sm select-none hover:cursor-not-allowed",title:"Pro feature",children:s.make||"-"})}),e.jsx("td",{className:"px-4 py-3 text-sm",children:n?e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{children:ds(s)||"-"}),s.year&&e.jsx("span",{className:"text-xs text-slate-500 dark:text-slate-400",children:s.year})]}):e.jsxs("div",{className:"flex flex-col blur-sm select-none hover:cursor-not-allowed",title:"Pro feature",children:[e.jsx("span",{children:"Subtype"}),e.jsx("span",{className:"text-xs text-slate-500 dark:text-slate-400",children:"Year"})]})}),e.jsx("td",{className:"px-4 py-3 text-sm",children:n?s.license_number?`${s.license_number} (${s.license_state||"-"})`:"-":e.jsx("span",{className:"blur-sm select-none hover:cursor-not-allowed",title:"Pro feature",children:s.license_number?"XXX-XXX (XX)":"-"})}),e.jsx("td",{className:"px-4 py-3 text-sm",children:n?e.jsx("span",{className:"rounded bg-slate-100 px-2 py-1 text-xs dar
1k:bg-slate-700",children:s.company_vehicle_number||"-"}):e.jsx("span",{className:"rounded bg-slate-100 px-2 py-1 text-xs blur-sm select-none hover:cursor-not-allowed dark:bg-slate-700",title:"Pro feature",children:s.company_vehicle_number?"XX":"-"})}),e.jsx("td",{className:"px-4 py-3 text-right",children:n&&s.vin&&s.vin.match(/^[A-HJ-NPR-Z0-9]{17}$/i)?e.jsxs(E,{variant:"outline",size:"sm",className:"ml-auto flex items-center gap-1 text-xs",onClick:()=>Xe(s.vin),children:[e.jsx(rs,{className:"h-3.5 w-3.5"}),"View"]}):e.jsx("span",{className:"inline-block h-8 w-8"})})]},l))})]})}),X>1&&e.jsxs("div",{className:"mt-4 flex flex-wrap items-center justify-between gap-3",children:[e.jsxs(E,{variant:"outline",size:"sm",onClick:He,disabled:C===1,className:"h-8 px-2 py-1 text-xs",children:[e.jsx(is,{className:"mr-1 h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Previous"})]}),e.jsxs("div",{className:"flex min-w-[150px] flex-1 flex-col items-center justify-center gap-2 sm:flex-row sm:justify-between",children:[e.jsxs("div",{className:"text-center text-xs text-slate-600 sm:text-left dark:text-slate-400",children:[r?.meta?.current_page||1," of ",X,U?e.jsx(e.Fragment,{children:" (filtered)"}):e.jsxs(e.Fragment,{children:[" (",xe,")"]})]}),e.jsxs("select",{value:K,onChange:s=>Ue(Number(s.target.value)),className:"h-7 w-24 rounded border border-slate-200 bg-white py-0 pr-8 pl-2 text-xs text-slate-700 dark:border-slate-700 dark:bg-slate-800 dark:text-slate-300",children:[e.jsx("option",{value:5,children:"5 per page"}),e.jsx("option",{value:10,children:"10 per page"}),e.jsx("option",{value:20,children:"20 per page"})]})]}),e.jsxs(E,{variant:"outline",size:"sm",onClick:Pe,disabled:C===X,className:"h-8 px-2 py-1 text-xs",children:[e.jsx("span",{className:"hidden sm:inline",children:"Next"}),e.jsx(ns,{className:"ml-1 h-4 w-4"})]})]})]}):e.jsx("div",{className:"rounded-md border border-dashed border-slate-300 p-8 text-center text-slate-500 dark:border-slate-700 dark:text-slate-400",children:U?e.jsx(e.Fragment,{children:"No equipment found matching the current filters"}):e.jsx(e.Fragment,{children:"No equipment details available"})})})]})]})]}),e.jsx(ms,{dotNumber:t.dot_number,isOpen:W,onOpenChange:P}),e.jsx(ke,{open:F,onOpenChange:I,children:e.jsxs(ye,{className:"max-h-[90vh] max-w-[95vw] overflow-y-auto sm:max-w-2xl",children:[e.jsxs(we,{className:"max-w-full text-left",children:[e.jsx(Ce,{children:"Equipment Details"}),e.jsx(Se,{children:b?Ee&&i?.id?e.jsxs(e.Fragment,{children:["VIN:"," ",e.jsx(Je,{href:route("equipment.show",{equipment:i.id}),className:"font-medium text-blue-600 underline hover:text-blue-800 dark:text-blue-400 dark:hover:text-blue-300",children:b})]}):`VIN: ${b}`:"View equipment details"})]}),Y?e.jsxs("div",{className:"space-y-3 py-4",children:[e.jsx(f,{className:"h-6 w-full"}),e.jsx(f,{className:"h-6 w-3/4"}),e.jsx(f,{className:"h-12 w-full"}),e.jsx(f,{className:"h-20 w-full"})]}):i?e.jsxs("div",{className:"space-y-4 py-2",children:[e.jsxs("div",{className:"grid grid-cols-1 gap-4",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-md font-medium text-slate-700 dark:text-slate-200",children:"Vehicle Information"}),e.jsxs("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 sm:gap-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"text-xs text-slate-500 dark:text-slate-400",children:"Type"}),e.jsx("div",{className:"text-sm font-medium",children:e.jsxs("div",{className:"flex items-center",children:[i.type?.toLowerCase().includes("truck")?e.jsx(v,{className:"mr-1 h-4 w-4 text-blue-500"}):i.type?.toLowerCase().includes("trailer")?e.jsx(v,{className:"mr-1 h-4 w-4 text-green-500"}):e.jsx(se,{className:"mr-1 h-4 w-4 text-orange-500"}),i.type||"Unknown"]})})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"text-xs text-slate-500 dark:text-slate-400",children:"Sub Type"}),e.jsx("div",{className:"text-sm font-medium",children:i.sub_type??"-"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"text-xs text-slate-500 dark:text-slate-400",children:"Make"}),e.jsx("div",{className:"text-sm font-medium",children:i.make||"-"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"text-xs text-slate-500 dark:text-slate-400",children:"Model"}),e.jsx("div",{className:"text-sm font-medium",children:i.model||"-"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"text-xs text-slate-500 dark:text-slate-400",children:"Year"}),e.jsx("div",{className:"text-sm font-medium",children:i.year||"-"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"text-xs text-slate-500 dark:text-slate-400",children:"VIN"}),e.jsxs("div",{className:"font-mono text-sm font-medium break-all",children:[i.vin||"-",i.vin_errors&&e.jsxs(N,{variant:"destructive",className:"mt-1 ml-2 inline-flex",title:"This VIN has errors and may not be accurate",children:[e.jsx(B,{className:"mr-1 h-3 w-3"}),"VIN Error"]})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"text-xs text-slate-500 dark:text-slate-400",children:"License"}),e.jsx("div",{className:"text-sm font-medium",children:i.license_number?`${i.license_number} (${i.license_state||"-"})`:"-"})]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-md font-medium text-slate-700 dark:text-slate-200",children:"Additional Information"}),e.jsxs("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 sm:gap-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"text-xs text-slate-500 dark:text-slate-400",children:"Company Vehicle #"}),e.jsx("div",{className:"text-sm font-medium",children:e.jsx("span",{className:"rounded bg-slate-100 px-2 py-1 text-xs dar
1k:bg-slate-700",children:i.company_vehicle_number||"-"})})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"text-xs text-slate-500 dark:text-slate-400",children:"GVWR"}),e.jsx("div",{className:"text-sm font-medium",children:i.gvwr||"-"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"text-xs text-slate-500 dark:text-slate-400",children:"Trim"}),e.jsx("div",{className:"text-sm font-medium",children:i.trim||"-"})]}),i.type?.toLowerCase().includes("trailer")&&i.length&&e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"text-xs text-slate-500 dark:text-slate-400",children:"Length"}),e.jsxs("div",{className:"text-sm font-medium",children:[i.length," feet"]})]})]})]})]}),e.jsxs("div",{className:"mt-4 border-t border-slate-200 pt-2 dark:border-slate-700",children:[e.jsxs("h3",{className:"text-md mb-3 flex items-center font-medium text-slate-700 dark:text-slate-200",children:[e.jsx(je,{className:"mr-1 h-4 w-4 text-slate-600 dark:text-slate-400"}),"Inspection History"]}),i.unit_inspections&&i.unit_inspections.length>0?e.jsx("div",{className:"-mx-4 overflow-x-auto sm:mx-0",children:e.jsx("div",{className:"inline-block min-w-[600px] min-w-full align-middle",children:e.jsx("div",{className:"overflow-hidden",children:e.jsxs("table",{className:"min-w-full divide-y divide-slate-200 dark:divide-slate-700",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"bg-slate-50 dark:bg-slate-800",children:[e.jsx("th",{scope:"col",className:"px-3 py-2 text-left text-xs font-medium text-slate-700 dark:text-slate-300",children:"Date"}),e.jsx("th",{scope:"col",className:"px-3 py-2 text-left text-xs font-medium text-slate-700 dark:text-slate-300",children:"Inspection ID"}),e.jsx("th",{scope:"col",className:"px-3 py-2 text-left text-xs font-medium text-slate-700 dark:text-slate-300",children:"Level"}),e.jsx("th",{scope:"col",className:"px-3 py-2 text-left text-xs font-medium text-slate-700 dark:text-slate-300",children:"State"}),e.jsx("th",{scope:"col",className:"px-3 py-2 text-left text-xs font-medium text-slate-700 dark:text-slate-300",children:"Violations"})]})}),e.jsx("tbody",{className:"divide-y divide-slate-200 dark:divide-slate-700",children:i.unit_inspections.map((s,l)=>e.jsxs("tr",{className:"hover:bg-slate-50 dark:hover:bg-slate-800/50",children:[e.jsx("td",{className:"px-3 py-2 text-xs whitespace-nowrap",children:s.inspection_date?new Date(s.inspection_date).toLocaleDateString():"-"}),e.jsx("td",{className:"px-3 py-2 font-mono text-xs whitespace-nowrap",children:s.inspection_id||"-"}),e.jsx("td",{className:"px-3 py-2 text-xs whitespace-nowrap",children:s.inspection_level||"-"}),e.jsx("td",{className:"px-3 py-2 text-xs whitespace-nowrap",children:s.insp_unit_license_state||"-"}),e.jsx("td",{className:"px-3 py-2 text-xs whitespace-nowrap",children:(()=>{const o=s.violation_count??s.violations?.length??0;let j="bg-green-100 dark:bg-green-900/30 text-green-800 dark:text-green-300";return o>=3?j="bg-red-100 dark:bg-red-900/30 text-red-800 dark:text-red-300":o>0&&(j="bg-amber-100 dark:bg-amber-900/30 text-amber-800 dark:text-amber-300"),e.jsx(N,{className:j,children:o})})()})]},l))})]})})})}):e.jsx("div",{className:"rounded-md border border-dashed border-slate-200 p-3 text-center text-sm text-slate-500 dark:border-slate-700 dark:text-slate-400",children:"No inspection history available for this vehicle"})]})]}):e.jsxs("div",{className:"py-4 text-center text-slate-500 dark:text-slate-400",children:[e.jsx(B,{className:"mx-auto mb-2 h-8 w-8 text-slate-400 dark:text-slate-500"}),"No details available for this vehicle"]})]})})]})}function x({label:t,value:r,suffix:k="",isLoading:g,className:p="",small:b=!1,larger:D=!1,valueClassName:F=""}){return e.jsxs("div",{className:`rounded-lg border border-slate-200 bg-white p-3 dark:border-slate-700 dark:bg-slate-800 ${p} ${b?"p-2":""}`,children:[e.jsx("div",{className:`text-xs text-slate-500 dark:text-slate-400 ${b?"text-xs":""}`,children:t}),g?e.jsx(f,{className:`mt-1 h-6 w-16 ${b?"h-5 w-14":""} ${D?"h-8 w-20":""}`}):e.jsx("div",{className:`font-semibold text-slate-700 dark:text-slate-200 ${b?"text-sm":"text-lg"} ${D?"text-2xl":""} ${F}`,children:r!=null?`${r}${k}`:"N/A"})]})}
1export{Ps as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.