1import{f as P,g as U,r as d,e as k,j as e,a as D,C as y,B as v,U as I,T as F,F as M,aJ as R,d as Y,av as O}from"./index-BWQbUAvI.js";import{U as $}from"./user-B5uSCbg_.js";/** 2 * @license lucide-react v0.469.0 - ISC 3 * 4 * This source code is licensed under the ISC license. 5 * See the LICENSE file in the root directory of this source tree. 6 */const B=P("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);function _(){const b=U(),[r,x]=d.useState(null),[C,N]=d.useState(!0),[p,g]=d.useState(!1),[h,u]=d.useState(""),[a,n]=d.useState({yearsExperience:"",truckType:"box_truck",truckCapacityLbs:"",emergencyContactName:"",emergencyContactPhone:"",notes:"",backgroundCheckConsent:!1,serviceAreas:[]});d.useEffect(()=>{k.get("/onboarding/status").then(t=>{if(x(t.data),t.data.profile){const s=t.data.profile;n(i=>{var l,o;return{...i,yearsExperience:((l=s.yearsExperience)==null?void 0:l.toString())||"",truckType:s.truckType||"box_truck",truckCapacityLbs:((o=s.truckCapacityLbs)==null?void 0:o.toString())||"",emergencyContactName:s.emergencyContactName||"",emergencyContactPhone:s.emergencyContactPhone||"",notes:s.notes||"",backgroundCheckConsent:s.backgroundCheckConsent||!1,serviceAreas:s.serviceAreas||[]}})}}).catch(()=>u("Failed to load onboarding status")).finally(()=>N(!1))},[]);const f={pending:{color:"text-amber-600 bg-amber-50 border-amber-200",icon:v,label:"Profile Pending"},submitted:{color:"text-blue-600 bg-blue-50 border-blue-200",icon:v,label:"Under Review"},approved:{color:"text-green-600 bg-green-50 border-green-200",icon:y,label:"Approved â"},rejected:{color:"text-red-600 bg-red-50 border-red-200",icon:D,label:"Not Approved"}},j=[{value:"box_truck",label:"Box Truck"},{value:"semi",label:"Semi / 18-Wheeler"},{value:"pickup",label:"Pickup Truck"},{value:"cargo_van",label:"Cargo Van"},{value:"flatbed",label:"Flatbed"}],w=["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 S(t){n(s=>({...s,serviceAreas:s.serviceAreas.includes(t)?s.serviceAreas.filter(i=>i!==t):[...s.serviceAreas,t]}))}async function A(t){var s,i;if(t.preventDefault(),!a.backgroundCheckConsent){u("You must consent to the background check to submit your application.");return}g(!0),u("");try{const l=await k.post("/onboarding/submit",{yearsExperience:a.yearsExperience?Number(a.yearsExperience):null,truckType:a.truckType,truckCapacityLbs:a.truckCapacityLbs?Number(a.truckCapacityLbs):null,emergencyContactName:a.emergencyContactName,emergencyContactPhone:a.emergencyContactPhone,notes:a.notes,backgroundCheckConsent:a.backgroundCheckConsent,serviceAreas:a.serviceAreas});x(o=>o&&{...o,onboardingStatus:"submitted",profile:l.data,checklist:{...o.checklist,submitted:!0}})}catch(l){u(((i=(s=l==null?void 0:l.response)==null?void 0:s.data)==null?void 0:i.detail)||"Failed to save")}finally{g(!1)}}if(C)return e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-blue-600"})});const c=(r==null?void 0:r.onboardingStatus)||"pending",m=f[c]||f.pending,T=m.icon,E=(r==null?void 0:r.checklist)||{profileStarted:!1,cdlUploaded:!1,insuranceUploaded:!1,backgroundCheckConsent:!1,submitted:!1},L=[{key:"profileStarted",label:"Start Your Profile",desc:"Fill in your truck and contact info below"},{key:"cdlUploaded",label:"Upload CDL",desc:"Go to Profile â Documents and upload your CDL",action:()=>b("/profile")},{key:"insuranceUploaded",label:"Upload Insurance",desc:"Upload proof of insurance in your Profile â Documents",action:()=>b("/profile")},{key:"backgroundCheckConsent",label:"Background Check Consent",desc:"Check the consent box below"},{key:"submitted",label:"Submit Application",desc:"Submit your completed profile for admin review"}];return e.jsxs("div",{className:"max-w-3xl mx-auto space-y-6 pb-12",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold text-slate-900",children:"Driver Onboarding"}),e.jsx("p",{className:"text-slate-500 mt-1",children:"Complete all steps to get approved and start bid
6ding on loads."})]}),e.jsxs("div",{className:`flex items-center gap-3 px-4 py-3 rounded-xl border ${m.color}`,children:[e.jsx(T,{className:"w-5 h-5 flex-shrink-0"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-semibold",children:m.label}),c==="submitted"&&e.jsx("p",{className:"text-sm opacity-75",children:"Your profile is being reviewed by an admin. Usually within 24 hours."}),c==="approved"&&e.jsx("p",{className:"text-sm opacity-75",children:"You can now bid on available loads from the Load Board."}),c==="rejected"&&(r==null?void 0:r.profile)&&e.jsxs("p",{className:"text-sm opacity-75",children:["Reason: ",r.profile.rejectionReason||"Did not meet requirements"]})]})]}),e.jsxs("div",{className:"bg-white rounded-2xl border border-slate-200 p-5",children:[e.jsx("h2",{className:"font-semibold text-slate-800 mb-4",children:"Checklist"}),e.jsx("div",{className:"space-y-3",children:L.map(t=>{const s=E[t.key];return e.jsxs("div",{className:`flex items-center gap-3 p-3 rounded-xl ${s?"bg-green-50":"bg-slate-50"}`,children:[s?e.jsx(y,{className:"w-5 h-5 text-green-500 flex-shrink-0"}):e.jsx(B,{className:"w-5 h-5 text-slate-300 flex-shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:`text-sm font-medium ${s?"text-green-700":"text-slate-700"}`,children:t.label}),!s&&e.jsx("p",{className:"text-xs text-slate-500",children:t.desc})]}),!s&&t.action&&e.jsxs("button",{onClick:t.action,className:"flex items-center gap-1 text-xs text-blue-600 hover:text-blue-800",children:["Go ",e.jsx(I,{className:"w-3 h-3"})]})]},t.key)})})]}),c!=="approved"&&e.jsxs("form",{onSubmit:A,className:"bg-white rounded-2xl border border-slate-200 p-5 space-y-5",children:[e.jsxs("h2",{className:"font-semibold text-slate-800 flex items-center gap-2",children:[e.jsx(F,{className:"w-4 h-4"})," Truck & Experience"]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-slate-700 mb-1",children:"Years of Experience"}),e.jsx("input",{type:"number",min:"0",max:"50",value:a.yearsExperience,onChange:t=>n(s=>({...s,yearsExperience:t.target.value})),className:"w-full border border-slate-200 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:"e.g. 5"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-slate-700 mb-1",children:"Truck Type"}
6),e.jsx("select",{value:a.truckType,onChange:t=>n(s=>({...s,truckType:t.target.value})),className:"w-full border border-slate-200 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-500",children:j.map(t=>e.jsx("option",{value:t.value,children:t.label},t.value))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-slate-700 mb-1",children:"Truck Capacity (lbs)"}),e.jsx("input",{type:"number",min:"0",value:a.truckCapacityLbs,onChange:t=>n(s=>({...s,truckCapacityLbs:t.target.value})),className:"w-full border border-slate-200 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:"e.g. 20000"})]})]}),e.jsxs("h2",{className:"font-semibold text-slate-800 flex items-center gap-2 pt-2",children:[e.jsx($,{className:"w-4 h-4"})," Emergency Contact"]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-slate-700 mb-1",children:"Contact Name"}),e.jsx("input",{value:a.emergencyContactName,onChange:t=>n(s=>({...s,emergencyContactName:t.target.value})),className:"w-full border border-slate-200 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:"Full name"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-slate-700 mb-1",children:"Contact Phone"}),e.jsx("input",{value:a.emergencyContactPhone,onChange:t=>n(s=>({...s,emergencyContactPhone:t.target.value})),className:"w-full border border-slate-200 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:"(555) 000-0000"})]})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"block text-sm font-medium text-slate-700 mb-2 flex items-center gap-2",children:[e.jsx(M,{className:"w-4 h-4"})," Service Areas (states)"]}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:w.map(t=>e.jsx("button",{type:"button",onClick:()=>S(t),className:`px-2 py-1 rounded text-xs font-medium border transition-colors ${a.serviceAreas.includes(t)?"bg-blue-600 text-white border-blue-600":"bg-white text-slate-600 border-slate-200 hover:border-blue-400"}`,children:t},t))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-slate-700 mb-1",children:"Additional Notes"}),e.jsx("textarea",{rows:2,value:a.notes,onChange:t=>n(s=>({...s,notes:t.target.value})),className:"w-full border border-slate-200 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 resize-none",placeholder:"Special qualifications, endorsements, etc."})]}),e.jsxs("div",{className:`flex items-start gap-3 p-4 rounded-xl border ${a.backgroundCheckConsent?"bg-green-50 border-green-200":"bg-amber-50 border-amber-200"}`,children:[e.jsx(R,{className:`w-5 h-5 flex-shrink-0 mt-0.5 ${a.backgroundCheckConsent?"text-green-600":"text-amber-500"}`}),e.jsxs("label",{className:"flex-1 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:a.backgroundCheckConsent,onChange:t=>n(s=>({...s,backgroundCheckConsent:t.target.checked})),className:"mr-2"}),e.jsx("span",{className:"text-sm text-slate-700",children:"I consent to a background check and certify that all information provided is accurate and complete. I understand that my application will be reviewed by an administrator."})]})]}),h&&e.jsxs("div",{className:"flex items-center gap-2 text-red-600 bg-red-50 border border-red-200 px-4 py-3 rounded-xl text-sm",children:[e.jsx(Y,{className:"w-4 h-4 flex-shrink-0"})," ",h]}),c!=="submitted"&&e.jsx("button",{type:"submit",disabled:p,className:"w-full bg-gradient-to-r from-blue-600 to-violet-600 text-white font-semibold py-2.5 rounded-xl hover:opacity-90 disabled:opacity-50 flex items-center justify-center gap-2",children:p?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white"})," Saving..."]}):e.jsxs(e.Fragment,{children:[e.jsx(O,{className:"w-4 h-4"})," Submit Application"]})}),c==="submitted"&&e.jsx("div",{className:"text-center text-sm text-slate-500 py-2",children:"Application submitted â awaiting admin review."})]})]})}export{_ 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.