1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/DriverCalendar-SfAGVw4f.js","assets/index-U8D282DB.js","assets/index-CbU5sPxh.css","assets/badge-BmpMbrZ9.js","assets/select-DGSESBU1.js","assets/index-BdQq_4o_.js","assets/index-Dyyrzgm7.js","assets/check-fK4IDB-m.js","assets/chevron-up-B1n65gyY.js","assets/input-DFtjl8GZ.js","assets/useComposition-DGvQVl2f.js","assets/label-BdqAIGhN.js","assets/textarea-DE9S6YvS.js","assets/dateUtils-xDUjtiFQ.js","assets/driver-meta-B5sBeA3y.js","assets/chevron-left-Bq9CJL-3.js","assets/calendar-x-2-SFDa9r_D.js","assets/calendar-Ctb75UO1.js","assets/pencil-nUwvNNUo.js","assets/save-Ct3G3QJk.js","assets/plane-Dqqn_g8f.js"])))=>i.map(i=>d[i]); 2import{h as de,t as j,r as n,J as b,j as e,B as l,U as F,ag as oe,b as P,c as S,L as T,as as O,ap as me,s as xe,o as M,V as Q,X as Y,Y as J,Z as G,_ as W,$ as X,aC as pe}from"./index-U8D282DB.js";import{B as x}from"./badge-BmpMbrZ9.js";import{I as d}from"./input-DFtjl8GZ.js";import{L as c}from"./label-BdqAIGhN.js";import{T as q}from"./textarea-DE9S6YvS.js";import{S as L,a as E,b as H,c as U,d as o}from"./select-DGSESBU1.js";import{T as ve,a as ge,b as Z,c as p,d as ue,e as v}from"./table-YbOamqaD.js";import{T as he,a as De,b as K,c as ee}from"./tabs-Bk8lnsux.js";import{i as se,a as je,D as fe,g as Ne}from"./driver-meta-B5sBeA3y.js";import{P as be}from"./plus-DHOMwzdP.js";import{P as ae}from"./pencil-nUwvNNUo.js";import{A as ye}from"./award-Dz02xMOL.js";import"./useComposition-DGvQVl2f.js";import"./index-BdQq_4o_.js";import"./index-Dyyrzgm7.js";import"./check-fK4IDB-m.js";import"./chevron-up-B1n65gyY.js";const Ae=de("Link2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]),Ce=n.lazy(()=>pe(()=>import("./DriverCalendar-SfAGVw4f.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20])));function $e(){const y=j.useUtils(),{data:g,isLoading:ie}=j.drivers.list.useQuery({}),{data:f}=j.users.listAll.useQuery(),w=j.drivers.create.useMutation({onSuccess:()=>{y.drivers.list.invalidate(),y.users.listAll.invalidate(),h(!1),b.success("Driver added"),I()}}),u=j.drivers.update.useMutation({onSuccess:()=>{y.drivers.list.invalidate(),y.users.listAll.invalidate(),h(!1),b.success("Driver updated"),I()}}),[re,h]=n.useState(!1),[D,z]=n.useState(null),[m,N]=n.useState(null),[A,C]=n.useState(""),[B,k]=n.useState(!1),te=j.dispatchChat.sendToDriver.useMutation({onSuccess:()=>{b.success(`SMS sent to ${m?.name}`),N(null),C(""),k(!1)},onError:s=>{b.error(`Failed to send SMS: ${s.message}`),k(!1)}}),[i,t]=n.useState({name:"",email:"",phone:"",licenseNumber:"",commissionPercent:"70",notes:"",userId:"",requiresAcceptance:!1,acceptanceTimeoutHours:"2",tier:"",bio:"",specialtyTags:"",vehicleCertifications:"",academyProgress:"",slug:"",employmentType:"internal",affiliateProvider:""}),_=n.useMemo(()=>{if(!g)return new Set;const s=new Set;return g.forEach(a=>{a.userId&&a.id!==D&&s.add(a.userId)}),s},[g,D]),ce=n.useMemo(()=>f?f.filter(s=>!_.has(s.id)):[],[f,_]),I=()=>{z(null),t({name:"",email:"",phone:"",licenseNumber:"",commissionPercent:"70",notes:"",userId:"",requiresAcceptance:!1,acceptanceTimeoutHours:"2",tier:"",bio:"",specialtyTags:"",vehicleCertifications:"",academyProgress:"",slug:"",employmentType:"internal",affiliateProvider:""})},V=s=>{z(s.id),t({name:s.name,email:s.email||"",phone:s.phone||"",licenseNumber:s.licenseNumber||"",commissionPercent:s.commissionPercent,notes:s.notes||"",userId:s.userId?String(s.userId):"",requiresAcceptance:!!s.requiresAcceptance,acceptanceTimeoutHours:s.acceptanceTimeoutHours?String(s.acceptanceTimeoutHours):"2",tier:s.tier||"",bio:s.bio||"",specialtyTags:s.specialtyTags||"",vehicleCertifications:s.vehicleCertifications||"",academyProgress:s.academyProgress||"",slug:s.slug||"",employmentType:s.employmentType==="affiliate"?"affiliate":"internal",affiliateProvider:s.affiliateProvider||""}),h(!0)},le=()=>{if(!i.name){b.error("Name is required");return}const s=i.userId?parseInt(i.userId):void 0,a={tier:i.tier||void 0,employmentType:i.employmentType,affiliateProvider:i.employmentType==="affiliate"&&i.affiliateProvider.trim()||void 0,bio:i.bio||void 0,specialtyTags:i.specialtyTags||void 0,vehicleCertifications:i.vehicleCertifications||void 0,academyProgress:i.academyProgress||void 0,slug:i.slug||void 0};D?u.mutate({id:D,name:i.name,email:i.email||void 0,phone:i.phone||void 0,licenseNumber:i.licenseNumber||void 0,commissionPercent:i.commissionPercent,notes:i.notes||void 0,userId:s??null,requiresAcceptance:i.requiresAcceptance,acceptanceTimeoutHours:i.requiresAcceptance?parseInt(i.acceptanceTimeoutHours)||2:void 0,...a}):w.mutate({name:i.name,email:i.email||void 0,phone:i.phone||void 0,licenseNumber:i.licenseNumber||void 0,commissionPercent:i.commissionPercent,notes:i.notes||void 0,userId:s,requiresAcceptance:i.requiresAcceptance,acceptanceTimeoutHours:i.requiresAcceptance?parseInt(i.acceptanceTimeoutHours)||2:void 0,...a})},ne=s=>{if(!s||!f)return null;const a=f.find(r=>r.id===s);return a?a.name||a.email||`User #${a.id}`:null},R=n.useMemo(()=>(g||[]).filter(s=>!se(s)),[g]),$=n.useMemo(()=>{const s=new Map;for(const a of(g||[]).filter(r=>se(r))){const r=je(a)||"Independent affiliate";s.has(r)||s.set(r,[]),s.get(r).push(a)}return Array.from(s.entries()).sort(([a],[r])=>a.localeCompare(r))},[g]);return e.jsxs("div",{"data-loc":"client/src/pages/admin/Drivers.tsx:149",className:"space-y-6",children:[e.jsxs("div",{"data-loc":"client/src/pages/admin/Drivers.tsx:150",className:"flex items-center justify-between",children:[e.jsxs("div",{"data-loc":"client/src/pages/admin/Drivers.tsx:151",children:[e.jsx("h1",{"data-loc":"client/src/pages/admin/Drivers.tsx:152",className:"text-2xl font-bold tracking-tight",children:"Drivers"}),e.jsx("p",{"data-loc":"client/src/pages/admin/Drivers.tsx:153",className:"text-muted-foreground",children:"Manage your driver roster, link user accounts, and set commission rates"})]}),e.jsxs(l,{"data-loc":"client/src/pages/admin/Drivers.tsx:155",onClick:()=>{I(),h(!0)},className:"gap-2",children:[e.jsx(be,{"data-loc":"client/src/pages/admin/Drivers.tsx:156",className:"h-4 w-4"})," Add Driver"]})]}),e.jsxs(he,{"data-loc":"client/src/pages/admin/Drivers.tsx:160",defaultValue:"roster",children:[e.jsxs(De,{"data-loc":"client/src/pages/admin/Drivers.tsx:161",children:[e.jsxs(K,{"data-loc":"client/src/pages/admin/Drivers.tsx:162",value:"roster",className:"gap-1.5",children:[e.jsx(F,{"data-loc":"client/src/pages/admin/Drivers.tsx:162",className:"h-4 w-4"})," Roster"]}),e.jsxs(K,{"data-loc":"client/src/pages/admin/Drivers.tsx:163",value:"calendar",className:"gap-1.5",children:[e.jsx(oe,{"data-loc":"client/src/pages/admin/Drivers.tsx:163",className:"h-4 w-4"})," Calendar"]})]}),e.jsx(ee,{"data-loc":"client/src/pages/admin/Drivers.tsx:166",value:"calendar",className:"mt-4",children:e.jsx(P,{"data-loc":"client/src/pages/admin/Drivers.tsx:167",children:e.jsx(S,{"data-loc":"client/src/pages/admin/Drivers.tsx:168",className:"p-4",children:e.jsx(n.Suspense,{"data-loc":"client/src/pages/admin/Drivers.tsx:169",fallback:e.jsx("div",{"data-loc":"client/src/pages/admin/Drivers.tsx:169",className:"flex justify-center py-12",children:e.jsx(T,{"data-loc":"client/src/pages/admin/Drivers.tsx:169",className:"h-8 w-8 animate-spin text-primary"})}),children:e.jsx(Ce,{"data-loc":"client/src/pages/admin/Drivers.tsx:170"})})})})}),e.jsxs(ee,{"data-loc":"client/src/pages/admin/Drivers.tsx:176",value:"roster",className:"mt-4",children:[e.jsxs("div",{"data-loc":"client/src/pages/admin/Drivers.tsx:177",className:"mb-3",children:[e.jsx("h2",{"data-loc":"client/src/pages/admin/Drivers.tsx:178",className:"text-lg font-semibold",children:"Your Drivers"}),e.jsx("p",{"data-loc":"client/src/pages/admin/Drivers.tsx:179",className:"text-sm text-muted-foreground",children:"Internal Drive4u chauffeurs, listed before outsourced providers."})]}),e.jsx(P,{"data-loc":"client/src/pages/admin/Drivers.tsx:181",children:e.jsx(S,{"data-loc":"client/src/pages/admin/Drivers.tsx:182",className:"p-0",children:ie?e.jsx("div",{"data-loc":"client/src/pages/admin/Drivers.tsx:184",className:"flex justify-center py-12",children:e.jsx(T,{"data-loc":"client/src/pages/admin/Drivers.tsx:184",className:"h-8 w-8 animate-spin text-primary"})}):R.length===0?e.jsxs("div",{"data-loc":"client/src/pages/admin/Drivers.tsx:186",className:"text-center py-12 text-muted-foreground",children:[e.jsx(F,{"data-loc":"client/src/pages/admin/Drivers.tsx:187",className:"h-10 w-10 mx-auto mb-3 opacity-30"}),e.jsx("p",{"data-loc":"client/src/pages/admin/Drivers.tsx:188",className:"mb-4",children:"No drivers yet"}),e.jsx(l,{"data-loc":"client/src/pages/admin/Drivers.tsx:189",onClick:()=>h(!0),children:"Add Driver"})]}):e.jsx("div",{"data-loc":"client/src/pages/admin/Drivers.tsx:192",className:"overflow-x-auto",children:e.jsxs(ve,{"data-loc":"client/src/pages/admin/Drivers.tsx:193",children:[e.jsx(ge,{"data-loc":"client/src/pages/admin/Drivers.tsx:194",children:e.jsxs(Z,{"data-loc":"client/src/pages/admin/Drivers.tsx:195",children:[e.jsx(p,{"data-loc":"client/src/pages/admin/Drivers.tsx:196",children:"Name"}),e.jsx(p,{"data-loc":"client/src/pages/admin/Drivers.tsx:197",children:"Tier"}),e.jsx(p,{"data-loc":"client/src/pages/admin/Drivers.tsx:198",children:"Contact"}),e.jsx(p,{"data-loc":"client/src/pages/admin/Drivers.tsx:199",children:"Linked A
2ccount"}),e.jsx(p,{"data-loc":"client/src/pages/admin/Drivers.tsx:200",children:"License"}),e.jsx(p,{"data-loc":"client/src/pages/admin/Drivers.tsx:201",children:"Commission"}),e.jsx(p,{"data-loc":"client/src/pages/admin/Drivers.tsx:202",children:"Status"}),e.jsx(p,{"data-loc":"client/src/pages/admin/Drivers.tsx:203",children:"Actions"})]})}),e.jsx(ue,{"data-loc":"client/src/pages/admin/Drivers.tsx:206",children:R.map(s=>e.jsxs(Z,{"data-loc":"client/src/pages/admin/Drivers.tsx:208",children:[e.jsx(v,{"data-loc":"client/src/pages/admin/Drivers.tsx:209",className:"font-medium",children:e.jsxs("div",{"data-loc":"client/src/pages/admin/Drivers.tsx:210",className:"flex items-center gap-2",children:[s.name,s.slug&&e.jsx("a",{"data-loc":"client/src/pages/admin/Drivers.tsx:213",href:`/driver/${s.slug}`,target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:text-primary",children:e.jsx(O,{"data-loc":"client/src/pages/admin/Drivers.tsx:214",className:"h-3 w-3"})})]})}),e.jsx(v,{"data-loc":"client/src/pages/admin/Drivers.tsx:219",children:s.tier?e.jsx(x,{"data-loc":"client/src/pages/admin/Drivers.tsx:221",className:`text-xs ${s.tier==="master"?"bg-purple-100 text-purple-800 border-purple-200":s.tier==="senior"?"bg-amber-100 text-amber-800 border-amber-200":s.tier==="chauffeur"?"bg-cyan-100 text-cyan-800 border-cyan-200":s.tier==="certified"?"bg-green-100 text-green-800 border-green-200":"bg-blue-100 text-blue-800 border-blue-200"}`,children:fe[s.tier]||s.tier}):e.jsx("span",{"data-loc":"client/src/pages/admin/Drivers.tsx:231",className:"text-xs text-muted-foreground",children:"â"})}),e.jsx(v,{"data-loc":"client/src/pages/admin/Drivers.tsx:234",children:e.jsxs("div",{"data-loc":"client/src/pages/admin/Drivers.tsx:235",className:"text-sm",children:[s.email&&e.jsx("p",{"data-loc":"client/src/pages/admin/Drivers.tsx:236",children:s.email}),s.phone&&e.jsx("p",{"data-loc":"client/src/pages/admin/Drivers.tsx:237",className:"text-muted-foreground",children:s.phone})]})}),e.jsx(v,{"data-loc":"client/src/pages/admin/Drivers.tsx:240",children:s.userId?e.jsxs("div",{"data-loc":"client/src/pages/admin/Drivers.tsx:242",className:"flex items-center gap-1.5",children:[e.jsx(me,{"data-loc":"client/src/pages/admin/Drivers.tsx:243",className:"h-3.5 w-3.5 text-green-500"}),e.jsx("span",{"data-loc":"client/src/pages/admin/Drivers.tsx:244",className:"text-sm text-green-700",children:ne(s.userId)||`User #${s.userId}`})]}):e.jsx("span",{"data-loc":"client/src/pages/admin/Drivers.tsx:247",className:"text-xs text-muted-foreground",children:"Not linked"})}),e.jsx(v,{"data-loc":"client/src/pages/admin/Drivers.tsx:250",className:"text-sm",children:s.licenseNumber||"â"}),e.jsx(v,{"data-loc":"client/src/pages/admin/Drivers.tsx:251",children:e.jsxs("div",{"data-loc":"client/src/pages/admin/Drivers.tsx:252",className:"flex items-center gap-1",children:[e.jsx(xe,{"data-loc":"client/src/pages/admin/Drivers.tsx:253",className:"h-3.5 w-3.5 text-green-500"}),e.jsxs("span",{"data-loc":"client/src/pages/admin/Drivers.tsx:254",className:"font-medium",children:[s.commissionPercent,"%"]})]})}),e.jsx(v,{"data-loc":"client/src/pages/admin/Drivers.tsx:257",children:e.jsxs("div",{"data-loc":"client/src/pages/admin/Drivers.tsx:258",className:"flex gap-1",children:[e.jsx(x,{"data-loc":"client/src/pages/admin/Drivers.tsx:259",variant:s.isActive?"default":"secondary",children:s.isActive?"Active":"Inactive"}),s.isActive&&e.jsx(x,{"data-loc":"client/src/pages/admin/Drivers.tsx:261",variant:s.isAvailable?"outline":"secondary",className:s.isAvailable?"border-green-300 text-green-700":"",children:s.isAvailable?"Available":"Busy"}),s.requiresAcceptance&&e.jsx(x,{"data-loc":"client/src/pages/admin/Drivers.tsx:266",variant:"outline",className:"border-amber-300 text-amber-700 bg-amber-50",children:"â³ Acceptance"})]})}),e.jsx(v,{"data-loc":"client/src/pages/admin/Drivers.tsx:272",children:e.jsxs("div",{"data-loc":"client/src/pages/admin/Drivers.tsx:273",className:"flex gap-1",children:[e.jsxs(l,{"data-loc":"client/src/pages/admin/Drivers.tsx:274",size:"sm",variant:"outline",className:"h-7 text-xs gap-1",onClick:()=>V(s),children:[e.jsx(ae,{"data-loc":"client/src/pages/admin/Drivers.tsx:275",className:"h-3 w-3"})," Edit"]}),e.jsx(l,{"data-loc":"client/src/pages/admin/Drivers.tsx:277",size:"sm",variant:s.isAvailable?"secondary":"outline",className:"h-7 text-xs",onClick:()=>u.mutate({id:s.id,isAvailable:!s.isAvailable}),children:s.isAvailable?"Set Busy":"Set Available"}),e.jsx(l,{"data-loc":"client/src/pages/admin/Drivers.tsx:281",size:"sm",variant:s.isActive?"secondary":"default",className:"h-7 text-xs",onClick:()=>u.mutate({id:s.id,isActive:!s.isActive}),children:s.isActive?"Deactivate":"Activate"}),s.phone&&e.jsxs(l,{"data-loc":"client/src/pages/admin/Drivers.tsx:286",size:"sm",variant:"outline",className:"h-7 text-xs gap-1 border-blue-300 text-blue-700 hover:bg-blue-50",onClick:a=>{a.stopPropagation(),N(s)},children:[e.jsx(M,{"data-loc":"client/src/pages/admin/Drivers.tsx:288",className:"h-3 w-3"})," SMS"]})]})})]},s.id))})]})})})}),e.jsxs("div",{"data-loc":"client/src/pages/admin/Drivers.tsx:301",className:"mt-8 space-y-4 border-t pt-6",children:[e.jsxs("div",{"data-loc":"client/src/pages/admin/Drivers.tsx:302",children:[e.jsxs("div",{"data-loc":"client/src/pages/admin/Drivers.tsx:303",className:"flex items-center gap-2",children:[e.jsx(Q,{"data-loc":"client/src/pages/admin/Drivers.tsx:304",className:"h-5 w-5 text-violet-700"}),e.jsx("h2",{"data-loc":"client/src/pages/admin/Drivers.tsx:305",className:"text-lg font-semibold",children:"Affiliate Partners"})]}),e.jsx("p",{"data-loc":"client/src/pages/admin/Drivers.tsx:307",className:"text-sm text-muted-foreground",children:"Outsourced overflow providers. Each remains directly assignable to bookings and calendar jobs."})]}),$.length===0?e.jsx(P,{"data-loc":"client/src/pages/admin/Drivers.tsx:310",children:e.jsx(S,{"data-loc":"client/src/pages/admin/Drivers.tsx:310",className:"py-12 text-center text-muted-foreground",children:"No affiliate providers yet."})}):$.map(([s,a])=>e.jsx(P,{"data-loc":"client/src/pages/admin/Drivers.tsx:312",children:e.jsxs(S,{"data-loc":"client/src/pages/admin/Drivers.tsx:313",className:"p-0",children:[e.jsxs("div",{"data-loc":"client/src/pages/admin/Drivers.tsx:314",className:"flex items-center justify-between gap-3 border-b bg-slate-50 px-4 py-3",children:[e.jsxs("div",{"data-loc":"client/src/pages/admin/Drivers.tsx:315",className:"flex items-center gap-2",children:[e.jsx(Q,{"data-loc":"client/src/pages/admin/Drivers.tsx:316",className:"h-4 w-4 text-primary"}),e.jsx("span",{"data-loc":"client/src/pages/admin/Drivers.tsx:317",className:"font-semibold",children:s}),e.jsxs(x,{"data-loc":"client/src/pages/admin/Drivers.tsx:318",variant:"secondary",children:[a.length," allocation option",a.length===1?"":"s"]})]}),e.jsxs(l,{"data-loc":"client/src/pages/admin/Drivers.tsx:320",size:"sm",variant:"outline",className:"h-8 shrink-0 gap-1.5 text-xs",onClick:()=>window.open(`/admin/affiliate-preview/${encodeURIComponent(s)}`,"_blank","noopener,noreferrer"),children:[e.jsx(O,{"data-loc":"client/src/pages/admin/Drivers.tsx:326",className:"h-3.5 w-3.5"})," Preview Portal"]})]}),e.jsx("div",{"data-loc":"client/src/pages/admin/Drivers.tsx:329",className:"divide-y",children:a.map(r=>e.jsxs("div",{"data-loc":"client/src/pages/admin/Drivers.tsx:331",className:"flex flex-col gap-3 p-4 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{"data-loc":"client/src/pages/admin/Drivers.tsx:332",className:"min-w-0",children:[e.jsxs("div",{"data-loc":"client/src/pages/admin/Drivers.tsx:333",className:"flex flex-wrap items-center gap-2",children:[e.jsx("span",{"data-loc":"client/src/pages/admin/Drivers.tsx:334",className:"font-medium",children:r.name}),e.jsx(x,{"data-loc":"client/src/pages/admin/Drivers.tsx:335",className:"border-violet-200 bg-vi
2olet-50 text-violet-700",children:"Affiliate"}),e.jsx(x,{"data-loc":"client/src/pages/admin/Drivers.tsx:336",variant:r.isActive?"default":"secondary",children:r.isActive?"Active":"Inactive"}),r.requiresAcceptance&&e.jsx(x,{"data-loc":"client/src/pages/admin/Drivers.tsx:337",variant:"outline",className:"border-amber-300 bg-amber-50 text-amber-700",children:"â³ Acceptance"})]}),e.jsx("p",{"data-loc":"client/src/pages/admin/Drivers.tsx:339",className:"mt-1 text-sm text-muted-foreground",children:Ne(r)}),e.jsxs("p",{"data-loc":"client/src/pages/admin/Drivers.tsx:340",className:"text-xs text-muted-foreground",children:[r.email||r.phone||"Allocation-only profile â contact details pending"," · ",r.commissionPercent,"% payout"]})]}),e.jsxs("div",{"data-loc":"client/src/pages/admin/Drivers.tsx:342",className:"flex flex-wrap gap-1",children:[e.jsxs(l,{"data-loc":"client/src/pages/admin/Drivers.tsx:343",size:"sm",variant:"outline",className:"h-7 text-xs gap-1",onClick:()=>V(r),children:[e.jsx(ae,{"data-loc":"client/src/pages/admin/Drivers.tsx:343",className:"h-3 w-3"})," Edit"]}),e.jsx(l,{"data-loc":"client/src/pages/admin/Drivers.tsx:344",size:"sm",variant:r.isAvailable?"secondary":"outline",className:"h-7 text-xs",onClick:()=>u.mutate({id:r.id,isAvailable:!r.isAvailable}),children:r.isAvailable?"Set Busy":"Set Available"}),e.jsx(l,{"data-loc":"client/src/pages/admin/Drivers.tsx:345",size:"sm",variant:r.isActive?"secondary":"default",className:"h-7 text-xs",onClick:()=>u.mutate({id:r.id,isActive:!r.isActive}),children:r.isActive?"Deactivate":"Activate"}),r.phone&&e.jsxs(l,{"data-loc":"client/src/pages/admin/Drivers.tsx:346",size:"sm",variant:"outline",className:"h-7 text-xs gap-1 border-blue-300 text-blue-700",onClick:()=>N(r),children:[e.jsx(M,{"data-loc":"client/src/pages/admin/Drivers.tsx:346",className:"h-3 w-3"})," SMS"]})]})]},r.id))})]})},s))]})]})]}),e.jsx(Y,{"data-loc":"client/src/pages/admin/Drivers.tsx:359",open:re,onOpenChange:h,children:e.jsxs(J,{"data-loc":"client/src/pages/admin/Drivers.tsx:360",className:"max-w-md",children:[e.jsx(G,{"data-loc":"client/src/pages/admin/Drivers.tsx:361",children:e.jsx(W,{"data-loc":"client/src/pages/admin/Drivers.tsx:361",children:D?"Edit Driver":"Add Driver"})}),e.jsxs("div",{"data-loc":"client/src/pages/admin/Drivers.tsx:362",className:"space-y-4",children:[e.jsxs("div",{"data-loc":"client/src/pages/admin/Drivers.tsx:363",children:[e.jsx(c,{"data-loc":"client/src/pages/admin/Drivers.tsx:363",children:"Name *"}),e.jsx(d,{"data-loc":"client/src/pages/admin/Drivers.tsx:363",value:i.name,onChange:s=>t(a=>({...a,name:s.target.value}))})]}),e.jsxs("div",{"data-loc":"client/src/pages/admin/Drivers.tsx:364",className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{"data-loc":"client/src/pages/admin/Drivers.tsx:365",children:[e.jsx(c,{"data-loc":"client/src/pages/admin/Drivers.tsx:365",children:"Email"}),e.jsx(d,{"data-loc":"client/src/pages/admin/Drivers.tsx:365",type:"email",value:i.email,onChange:s=>t(a=>({...a,email:s.target.value}))})]}),e.jsxs("div",{"data-loc":"client/src/pages/admin/Drivers.tsx:366",children:[e.jsx(c,{"data-loc":"client/src/pages/admin/Drivers.tsx:366",children:"Phone"}),e.jsx(d,{"data-loc":"client/src/pages/admin/Drivers.tsx:366",type:"tel",value:i.phone,onChange:s=>t(a=>({...a,phone:s.target.value}))})]})]}),e.jsxs("div",{"data-loc":"client/src/pages/admin/Drivers.tsx:368",children:[e.jsx(c,{"data-loc":"client/src/pages/admin/Drivers.tsx:368",children:"License Number"}),e.jsx(d,{"data-loc":"client/src/pages/admin/Drivers.tsx:368",value:i.licenseNumber,onChange:s=>t(a=>({...a,licenseNumber:s.target.value}))})]}),e.jsxs("div",{"data-loc":"client/src/pages/admin/Drivers.tsx:369",className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{"data-loc":"client/src/pages/admin/Drivers.tsx:370",children:[e.jsx(c,{"data-loc":"client/src/pages/admin/Drivers.tsx:371",children:"Driver Type"}),e.jsxs(L,{"data-loc":"client/src/pages/admin/Drivers.tsx:372",value:i.employmentType,onValueChange:s=>t(a=>({...a,employmentType:s,affiliateProvider:s==="affiliate"?a.affiliateProvider:"",commissionPercent:D?a.commissionPercent:s==="affiliate"?"90":"70"})),children:[e.jsx(E,{"data-loc":"client/src/pages/admin/Drivers.tsx:378",children:e.jsx(H,{"data-loc":"client/src/pages/admin/Drivers.tsx:378"})}),e.jsxs(U,{"data-loc":"client/src/pages/admin/Drivers.tsx:379",children:[e.jsx(o,{"data-loc":"client/src/pages/admin/Drivers.tsx:380",value:"internal",children:"Internal team"}),e.jsx(o,{"data-loc":"client/src/pages/admin/Drivers.tsx:381",value:"affiliate",children:"Affiliate provider"})]})]})]}),i.employmentType==="affiliate"&&e.jsxs("div",{"data-loc":"client/src/pages/admin/Drivers.tsx:386",children:[e.jsx(c,{"data-loc":"client/src/pages/admin/Drivers.tsx:386",children:"Provider / Business"}),e.jsx(d,{"data-loc":"client/src/pages/admin/Drivers.tsx:386",placeholder:"e.g. Private Drivers Online",value:i.affiliateProvider,onCh
2ange:s=>t(a=>({...a,affiliateProvider:s.target.value}))})]})]}),e.jsxs("div",{"data-loc":"client/src/pages/admin/Drivers.tsx:389",children:[e.jsx(c,{"data-loc":"client/src/pages/admin/Drivers.tsx:390",children:"Commission Percentage (%)"}),e.jsx(d,{"data-loc":"client/src/pages/admin/Drivers.tsx:391",type:"number",step:"0.01",min:"0",max:"100",value:i.commissionPercent,onChange:s=>t(a=>({...a,commissionPercent:s.target.value}))}),e.jsx("p",{"data-loc":"client/src/pages/admin/Drivers.tsx:392",className:"text-xs text-muted-foreground mt-1",children:i.employmentType==="affiliate"?"Defaults to 90% of the booking fee. Edit this for fixed or exceptional provider arrangements.":"Percentage of booking price paid to this driver"})]}),e.jsxs("div",{"data-loc":"client/src/pages/admin/Drivers.tsx:396",children:[e.jsxs(c,{"data-loc":"client/src/pages/admin/Drivers.tsx:397",className:"flex items-center gap-1.5",children:[e.jsx(Ae,{"data-loc":"client/src/pages/admin/Drivers.tsx:397",className:"h-3.5 w-3.5"})," Link User Account"]}),e.jsxs(L,{"data-loc":"client/src/pages/admin/Drivers.tsx:398",value:i.userId,onValueChange:s=>t(a=>({...a,userId:s==="none"?"":s})),children:[e.jsx(E,{"data-loc":"client/src/pages/admin/Drivers.tsx:399",children:e.jsx(H,{"data-loc":"client/src/pages/admin/Drivers.tsx:400",placeholder:"Select a user account to link..."})}),e.jsxs(U,{"data-loc":"client/src/pages/admin/Drivers.tsx:402",children:[e.jsx(o,{"data-loc":"client/src/pages/admin/Drivers.tsx:403",value:"none",children:"No linked account"}),ce.map(s=>e.jsxs(o,{"data-loc":"client/src/pages/admin/Drivers.tsx:405",value:String(s.id),children:[s.name||"Unnamed"," â ",s.email||"No email"," (ID: ",s.id,")"]},s.id))]})]}),e.jsx("p",{"data-loc":"client/src/pages/admin/Drivers.tsx:411",className:"text-xs text-muted-foreground mt-1",children:`Link to a user account so the driver can access the Driver Portal. The user's role will be set to "driver" automatically.`})]}),e.jsxs("div",{"data-loc":"client/src/pages/admin/Drivers.tsx:415",children:[e.jsx(c,{"data-loc":"client/src/pages/admin/Drivers.tsx:415",children:"Notes"}),e.jsx(q,{"data-loc":"client/src/pages/admin/Drivers.tsx:415",value:i.notes,onChange:s=>t(a=>({...a,notes:s.target.value})),rows:2})]}),i.employmentType==="internal"&&e.jsxs("div",{"data-loc":"client/src/pages/admin/Drivers.tsx:417",className:"border rounded-lg p-3 space-y-3 bg-indigo-50/50",children:[e.jsxs("div",{"data-loc":"client/src/pages/admin/Drivers.tsx:418",className:"flex items-center gap-2 mb-2",children:[e.jsx(ye,{"data-loc":"client/src/pages/admin/Drivers.tsx:419",className:"h-4 w-4 text-indigo-600"}),e.jsx(c,{"data-loc":"client/src/pages/admin/Drivers.tsx:420",className:"text-sm font-semibold text-indigo-900",children:"Driver Profile / Portfolio"})]}),e.jsxs("div",{"data-loc":"client/src/pages/admin/Drivers.tsx:422",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"data-loc":"client/src/pages/admin/Drivers.tsx:423",children:[e.jsx(c,{"data-loc":"client/src/pages/admin/Drivers.tsx:424",className:"text-xs",children:"Tier"}),e.jsxs(L,{"data-loc":"client/src/pages/admin/Drivers.tsx:425",value:i.tier,onValueChange:s=>t(a=>({...a,tier:s==="none"?"":s})),children:[e.jsx(E,{"data-loc":"client/src/pages/admin/Drivers.tsx:426",className:"h-8 text-sm",children:e.jsx(H,{"data-loc":"client/src/pages/admin/Drivers.tsx:426",placeholder:"Select tier..."})}),e.jsxs(U,{"data-loc":"client/src/pages/admin/Drivers.tsx:427",children:[e.jsx(o,{"data-loc":"client/src/pages/admin/Drivers.tsx:428",value:"none",children:"Not set"}),e.jsx(o,{"data-loc":"client/src/pages/admin/Drivers.tsx:429",value:"academy",children:"Academy"}),e.jsx(o,{"data-loc":"client/src/pages/admin/Drivers.tsx:430",value:"certified",children:"Certified"}),e.jsx(o,{"data-loc":"client/src/pages/admin/Drivers.tsx:431",value:"chauffeur",children:"Chauffeur"}),e.jsx(o,{"data-loc":"client/src/pages/admin/Drivers.tsx:432",value:"senior",children:"Senior"}),e.jsx(o,{"data-loc":"client/src/pages/admin/Drivers.tsx:433",value:"master",children:"Master"})]})]})]}),e.jsxs("div",{"data-loc":"client/src/pages/admin/Drivers.tsx:437",children:[e.jsx(c,{"data-loc":"client/src/pages/admin/Drivers.tsx:438",className:"text-xs",children:"Profile Slug"}),e.jsx(d,{"data-loc":"client/src/pages/admin/Drivers.tsx:439",className:"h-8 text-sm",placeholder:"scott-fischer",value:i.slug,onChange:s=>t(a=>({...a,slug:s.target.value.toLowerCase().replace(/[^a-z0-9-]/g,"-")}))}),e.jsxs("p",{"data-loc":"client/src/pages/admin/Drivers.tsx:440",className:"text-xs text-muted-foreground mt-0.5",children:["/driver/",i.slug||"slug"]})]})]}),e.jsxs("div",{"data-loc":"client/src/pages/admin/Drivers.tsx:443",children:[e.jsx(c,{"data-loc":"client/src/pages/admin/Drivers.tsx:444",className:"text-xs",children:"Bio"}),e.jsx(q,{"data-loc":"client/src/pages/admin/Drivers.tsx:445",className:"text-sm",rows:2,placeholder:"Professional background and experience...",value:i.bio,onChange:s=>t(a=>({...a,bio:s.target.value}))})]}),e.jsxs("div",{"data-loc":"client/src/pages/admin/Drivers.tsx:447",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"data-loc":"client/src/pages/admin/Drivers.tsx:448",children:[e.jsx(c,{"data-loc":"client/src/pages/admin/Drivers.tsx:449",className:"text-xs",children:"Specialty Tags"}),e.jsx(d,{"data-loc":"client/src/pages/admin/Drivers.tsx:450",className:"h-8 text-sm",placeholder:"Corporate, Airport, VIP",value:i.specialtyTags,onChange:s=>t(a=>({...a,specialtyTags:s.target.value}))}),e.jsx("p",{"data-loc":"client/src/pages/admin/Drivers.tsx:451",className:"text-xs text-muted-foreground mt-0.5",children:"Comma-separated"})]}),e.jsxs("div",{"data-loc":"client/src/pages/admin/Drivers.tsx:453",children:[e.jsx(c,{"data-loc":"client/src/pages/admin/Drivers.tsx:454",className:"text-xs",children:"Vehicle Certifications"}),e.jsx(d,{"data-loc":"client/src/pages/admin/Drivers.tsx:455",className:"h-8 text-sm",placeholder:"S-Class, EQS, V-Class",value:i.vehicleCertifications,onChange:s=>t(a=>({...a,vehicleCertifications:s.target.value}))}),e.jsx("p",{"data-loc":"client/src/pages/admin/Drivers.tsx:456",className:"text-xs text-muted-foreground mt-0.5",children:"Comma-separated"})]})]}),i.tier==="academy"&&e.jsxs("div",{"data-loc":"client/src/pages/admin/Drivers.tsx:460",children:[e.jsx(c,{"data-loc":"client/src/pages/admin/Drivers.tsx:461",className:"text-xs",children:"Academy Progress"}),e.jsx(d,{"data-loc":"client/src/pages/admin/Drivers.tsx:462",className:"h-8 text-sm",placeholder:"e.g. Module 3 of 5",value:i.academyProgress,onChange:s=>t(a=>({...a,academyProgress:s.target.value}))})]})]}),e.jsxs("div",{"data-loc":"client/src/pages/admin/Drivers.tsx:467",className:"border rounded-lg p-3 space-y-3 bg-amber-50/50",children:[e.jsxs("div",{"data-loc":"client/src/pages/admin/Drivers.tsx:468",className:"flex items-center justify-between",children:[e.jsxs("div",{"data-loc":"client/src/pages/admin/Drivers.tsx:469",children:[e.jsx(c,{"data-loc":"client/src/pages/admin/Drivers.tsx:470",className:"text-sm font-semibold",children:"Requires Job Acceptance"}),e.jsx("p",{"data-loc":"client/src/pages/admin/Drivers.tsx:471",className:"text-xs text-muted-foreground mt-0.5",children:"When enabled, this driver must accept/decline each assigned job before it's confirmed"})]}),e.jsx("button",{"data-loc":"client/src/pages/admin/Drivers.tsx:473",type:"button",role:"switch","aria-checked":i.requiresAcceptance,onClick:()=>t(s=>({...s,requiresAcceptance:!s.requiresAcceptance})),className:`relative inline-flex h-6 w-11 items-center rounded-full transition-colors ${i.requiresAcceptance?"bg-amber-500":"bg-gray-300"}`,children:e.jsx("span",{"data-loc":"client/src/pages/admin/Drivers.tsx:480",className:`inline-block h-4 w-4 transform rounded-full bg-white transition-transform ${i.requiresAcceptance?"translate-x-6":"translate-x-1"}`})})]}),i.requiresAcceptance&&e.jsxs("div",{"data-loc":"client/src/pages/admin/Drivers.tsx:484",children:[e.jsx(c,{"data-loc":"client/src/pages/admin/Drivers.tsx:485",className:"text-xs",children:"Reminder timeout (hours)"}),e.jsx(d,{"data-loc":"client/src/pages/admin/Drivers.tsx:486",type:"number",min:"1",max:"48",value:i.acceptanceTimeoutHours,onChange:s=>t(a=>({...a,acceptanceTimeoutHours:s.target.value})),className:"w-24 h-8 text-sm mt-1"}),e.jsx("p",{"data-loc":"client/src/pages/admin/Drivers.tsx:487",className:"text-xs text-muted-foreground mt-1",children:"You'll be notified if the driver hasn't responded within this time"})]})]})]}),e.jsxs(X,{"data-loc":"client/src/pages/admin/Drivers.tsx:492",children:[e.jsx(l,{"data-loc":"client/src/pages/admin/Drivers.tsx:493",variant:"outline",onClick:()=>h(!1),children:"Cancel"}),e.jsxs(l,{"data-loc":"client/src/pages/admin/Drivers.tsx:494",onClick:le,disabled:w.isPending||u.isPending,children:[(w.isPending||u.isPending)&&e.jsx(T,{"data-loc":"client/src/pages/admin/Drivers.tsx:495",className:"h-4 w-4 animate-spin mr-2"}),D?"Update":"Add"," Driver"]})]})]})}),e.jsx(Y,{"data-loc":"client/src/pages/admin/Drivers.tsx:503",open:!!m,onOpenChange:s=>{s||(N(null),C(""))},children:e.jsxs(J,{"data-loc":"client/src/pages/admin/Drivers.tsx:504",className:"max-w-md",children:[e.jsx(G,{"data-loc":"client/src/pages/admin/Drivers.tsx:505",children:e.jsxs(W,{"data-loc":"client/src/pages/admin/Drivers.tsx:506",className:"flex items-center gap-2",children:[e.jsx(M,{"data-loc":"client/src/pages/admin/Drivers.tsx:507",className:"h-5 w-5 text-blue-600"}),"Send SMS to ",m?.name]})}),e.jsxs("div",{"data-loc":"client/src/pages/admin/Drivers.tsx:511",className:"space-y-3",children:[e.jsxs("div",{"data-loc":"client/src/pages/admin/Drivers.tsx:512",className:"text-sm text-muted-foreground",children:["Sending to: ",e.jsx("span",{"data-loc":"client/src/pages/admin/Drivers.tsx:513",className:"font-medium text-foreground",children:m?.phone})]}),e.jsx(q,{"data-loc":"client/src/pages/admin/Drivers.tsx:515",placeholder:"Type your message...",value:A,onChange:s=>C(s.target.value),rows:4,className:"resize-none"}),e.jsx("p",{"data-loc":"client/src/pages/admin/Drivers.tsx:522",className:"text-xs text-muted-foreground",children:"Message will be sent from Drive4u (+61428072935) and logged in Dispatch SMS"})]}),e.jsxs(X,{"data-loc":"client/src/pages/admin/Drivers.tsx:526",children:[e.jsx(l,{"data-loc":"client/src/pages/admin/Drivers.tsx:527",variant:"outline",onClick:()=>{N(null),C("")},children:"Cancel"}),e.jsxs(l,{"data-loc":"client/src/pages/admin/Drivers.tsx:528",disabled:!A.trim()||B,onClick:()=>{!m?.phone||!A.trim()||(k(!0),te.mutate({driverPhone:m.phone,driverName:m.name,driverId:m.id,message:A.trim(),customerName:"Dispatch",customerPhone:"0408886230"}))},children:[B&&e.jsx(T,{"data-loc":"client/src/pages/admin/Drivers.tsx:543",className:"h-4 w-4 animate-spin mr-2"}),"Send SMS"]})]})]})})]})}export{$e 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.