PageSourceSearch

http://shuttle-quote-api.emergent.host/static/js/9105.319d8232.chunk.js

js shuttle-quote-api.emergent.host collected 2026-10-03 03:21:45 UTC 30,899 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunkfrontend=self.webpackChunkfrontend||[]).push([[9105],{557(e,a,t){t.r(a),t.d(a,{Label:()=>m});var s=t(9379),l=t(3986),n=t(9950),o=t(4128),r=t(4364),i=t(90),d=t(4414);const c=["className"],u=(0,r.cva)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),m=n.forwardRef((e,a)=>{let{className:t}=e,n=(0,l.default)(e,c);return(0,d.jsx)(o.Root,(0,s.default)({ref:a,className:(0,i.cn)(u(),t)},n))});m.displayName=o.Root.displayName},1455(e,a,t){t.r(a),t.d(a,{Select:()=>x,SelectContent:()=>w,SelectGroup:()=>h,SelectItem:()=>k,SelectLabel:()=>C,SelectScrollDownButton:()=>j,SelectScrollUpButton:()=>y,SelectSeparator:()=>S,SelectTrigger:()=>N,SelectValue:()=>v});var s=t(9379),l=t(3986),n=t(9950),o=t(1109),r=t(715),i=t(90),d=t(4414);const c=["className","children"],u=["className"],m=["className"],f=["className","children","position"],b=["className"],p=["className","children"],g=["className"],x=o.Root,h=o.Group,v=o.Value,N=n.forwardRef((e,a)=>{let{className:t,children:n}=e,u=(0,l.default)(e,c);return(0,d.jsxs)(o.Trigger,(0,s.default)((0,s.default)({ref:a,className:(0,i.cn)("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t)},u),{},{children:[n,(0,d.jsx)(o.Icon,{asChild:!0,children:(0,d.jsx)(r.ChevronDown,{className:"h-4 w-4 opacity-50"})})]}))});N.displayName=o.Trigger.displayName;const y=n.forwardRef((e,a)=>{let{className:t}=e,n=(0,l.default)(e,u);return(0,d.jsx)(o.ScrollUpButton,(0,s.default)((0,s.default)({ref:a,className:(0,i.cn)("flex cursor-default items-center justify-center py-1",t)},n),{},{children:(0,d.jsx)(r.ChevronUp,{className:"h-4 w-4"})}))});y.displayName=o.ScrollUpButton.displayName;const j=n.forwardRef((e,a)=>{let{className:t}=e,n=(0,l.default)(e,m);return(0,d.jsx)(o.ScrollDownButton,(0,s.default)((0,s.default)({ref:a,className:(0,i.cn)("flex cursor-default items-center justify-center py-1",t)},n),{},{children:(0,d.jsx)(r.ChevronDown,{className:"h-4 w-4"})}))});j.displayName=o.ScrollDownButton.displayName;const w=n.forwardRef((e,a)=>{let{className:t,children:n,position:r="popper"}=e,c=(0,l.default)(e,f);return(0,d.jsx)(o.Portal,{children:(0,d.jsxs)(o.Content,(0,s.default)((0,s.default)({ref:a,className:(0,i.cn)("relative z-50 max-h-[--radix-select-content-available-height] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-select-content-transform-origin]","popper"===r&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:r},c),{},{children:[(0,d.jsx)(y,{}),(0,d.jsx)(o.Viewport,{className:(0,i.cn)("p-1","popper"===r&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:n}),(0,d.jsx)(j,{})]}))})});w.displayName=o.Content.displayName;const C=n.forwardRef((e,a)=>{let{className:t}=e,n=(0,l.default)(e,b);return(0,d.jsx)(o.Label,(0,s.default)({ref:a,className:(0,i.cn)("px-2 py-1.5 text-sm font-semibold",t)},n))});C.displayName=o.Label.displayName;const k=n.forwardRef((e,a)=>{let{className:t,children:n}=e,c=(0,l.default)(e,p);return(0,d.jsxs)(o.Item,(0,s.default)((0,s.default)({ref:a,className:(0,i.cn)("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t)},c),{},{children:[(0,d.jsx)("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,d.jsx)(o.ItemIndicator,{children:(0,d.jsx)(r.Check,{className:"h-4 w-4"})})}),(0,d.jsx)(o.ItemText,{children:n})]}))});k.displayName=o.Item.displayName;const S=n.forwardRef((e,a)=>{let{className:t}=e,n=(0,l.default)(e,g);
1return(0,d.jsx)(o.Separator,(0,s.default)({ref:a,className:(0,i.cn)("-mx-1 my-1 h-px bg-muted",t)},n))});S.displayName=o.Separator.displayName},3079(e,a,t){t.r(a),t.d(a,{default:()=>L});var s=t(9379),l=t(9950),n=t(3023),o=t(3405),r=t(1111),i=t(3986),d=t(4174),c=t(4364),u=t(715),m=t(90),f=t(4414);const b=["className"],p=["side","className","children"],g=["className"],x=["className"],h=d.Root,v=(d.Trigger,d.Close,d.Portal),N=l.forwardRef((e,a)=>{let{className:t}=e,l=(0,i.default)(e,b);return(0,f.jsx)(d.Overlay,(0,s.default)((0,s.default)({className:(0,m.cn)("fixed inset-0 z-50 bg-black/80  data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t)},l),{},{ref:a}))});N.displayName=d.Overlay.displayName;const y=(0,c.cva)("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500 data-[state=open]:animate-in data-[state=closed]:animate-out",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"}},defaultVariants:{side:"right"}}),j=l.forwardRef((e,a)=>{let{side:t="right",className:l,children:n}=e,o=(0,i.default)(e,p);return(0,f.jsxs)(v,{children:[(0,f.jsx)(N,{}),(0,f.jsxs)(d.Content,(0,s.default)((0,s.default)({ref:a,className:(0,m.cn)(y({side:t}),l)},o),{},{children:[(0,f.jsxs)(d.Close,{className:"absolute right-4 top-4 roun
1ded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary",children:[(0,f.jsx)(u.X,{className:"h-4 w-4"}),(0,f.jsx)("span",{className:"sr-only",children:"Close"})]}),n]}))]})});j.displayName=d.Content.displayName;const w=l.forwardRef((e,a)=>{let{className:t}=e,l=(0,i.default)(e,g);return(0,f.jsx)(d.Title,(0,s.default)({ref:a,className:(0,m.cn)("text-lg font-semibold text-foreground",t)},l))});w.displayName=d.Title.displayName;l.forwardRef((e,a)=>{let{className:t}=e,l=(0,i.default)(e,x);return(0,f.jsx)(d.Description,(0,s.default)({ref:a,className:(0,m.cn)("text-sm text-muted-foreground",t)},l))}).displayName=d.Description.displayName;var C=t(6633),k=t(1473);const S={admin:[{to:"/admin",label:"Overview",icon:u.LayoutDashboard,end:!0,colorClass:"bg-slate-700"},{to:"/admin/calendar",label:"Calendar",icon:u.CalendarRange,colorClass:"bg-slate-700"},{to:"/admin/live-map",label:"Live Map",icon:u.MapPin,colorClass:"bg-slate-700"},{to:"/admin/flights",label:"Flights",icon:u.Plane,colorClass:"bg-slate-700"},{to:"/admin/clients",label:"Clients",icon:u.UserSquare,colorClass:"bg-slate-700"},{to:"/admin/reports",label:"Reports",icon:u.BarChart3,colorClass:"bg-slate-700"},{to:"/admin/receivables",label:"Receivables",icon:u.MessageSquare,colorClass:"bg-slate-700"},{to:"/admin/all-trips",label:"All Trips Board",icon:u.CalendarRange,colorClass:"bg-slate-700"},{to:"/driver",label:"My Trip Board",icon:u.CalendarRange,colorClass:"bg-slate-700"},{to:"/admin/vehicles",label:"Vehicles",icon:u.Car,colorClass:"bg-orange-600"},{to:"/admin/drivers",label:"Drivers",icon:u.UserCog,colorClass:"bg-orange-600"},{to:"/admin/driver-base",label:"Driver Base",icon:u.MapPin,colorClass:"bg-orange-600"},{to:"/admin/compliance",label:"Compliance",icon:u.ShieldCheck,colorClass:"bg-orange-600"},{to:"/admin/affiliates",label:"Affiliates",icon:u.Briefcase,colorClass:"bg-orange-600"},{to:"/admin/rates",label:"Rate Cards",icon:u.DollarSign,colorClass:"bg-zinc-500"},{to:"/admin/users",label:"Users",icon:u.Users,colorClass:"bg-zinc-500"},{to:"/admin/businesses",label:"Businesses",icon:u.Building2,colorClass:"bg-zinc-500"},{to:"/admin/config/occasions",label:"Occasions",icon:u.Settings,colorClass:"bg-sky-500"},{to:"/admin/config/fees",label:"Fees & Discounts",icon:u.DollarSign,colorClass:"bg-sky-500"},{to:"/admin/promo-codes",label:"Promo Codes",icon:u.Tag,colorClass:"bg-sky-500"},{to:"/admin/email-templates",label:"Email Templates",icon:u.Mail,colorClass:"bg-fuchsia-600"},{to:"/admin/sms-templates",label:"SMS Templates",icon:u.MessageSquare,colorClass:"bg-fuchsia-600"},{to:"/admin/sms-inbox",label:"SMS Inbox",icon:u.MessageSquare,colorClass:"bg-fuchsia-600",badgeSource:"sms-inbox-unhandled"},{to:"/admin/welcome-messages",label:"Welcome Messages",icon:u.MessageSquare,colorClass:"bg-fuchsia-600"},{to:"/admin/broadcast-templates",label:"Broadcast Templates",icon:u.MessageSquare,colorClass:"bg-fuchsia-600"},{to:"/admin/email-events",label:"Email Events",icon:u.Mail,colorClass:"bg-fuchsia-600"},{to:"/admin/applications",label:"Applications",icon:u.FileText,colorClass:"bg-fuchsia-600"},{to:"/admin/application-form",label:"Application Form",icon:u.FileText,colorClass:"bg-fuchsia-600"},{to:"/admin/data-import",label:"Data Import",icon:u.Upload,colorClass:"bg-green-500"},{to:"/admin/forms",label:"Form Settings",icon:u.Settings,colorClass:"bg-green-500"},{to:"/admin/custom-fields",label:"Custom Fields",icon:u.ListChecks,colorClass:"bg-green-500"},{to:"/admin/embed",label:"Embed Widget",icon:u.Code,colorClass:"bg-green-500"}],scheduler:[{to:"/admin",label:"Overview",icon:u.LayoutDashboard,end:!0,colorClass:"bg-slate-700"},{to:"/admin/calendar",label:"Calendar",icon:u.CalendarRange,colorClass:"bg-slate-700"},{to:"/admin/live-map",label:"Live Map",icon:u.MapPin,colorClass:"bg-slate-700"},{to:"/admin/flights",label:"Flights",icon:u.Plane,colorClass:"bg-slate-700"},{to:"/admin/clients",label:"Clients",icon:u.UserSquare,colorClass:"bg-slate-700"},{to:"/admin/reports",label:"Reports",icon:u.BarChart3,colorClass:"bg-slate-700"},{to:"/admin/all-trips",label:"All Trips Board",icon:u.CalendarRange,colorClass:"bg-slate-700"},{to:"/driver",label:"My Trip Board",icon:u.CalendarRange,colorClass:"bg-slate-700"}
1,{to:"/admin/sms-inbox",label:"SMS Inbox",icon:u.MessageSquare,colorClass:"bg-fuchsia-600",badgeSource:"sms-inbox-unhandled"},{to:"/admin/data-import",label:"Data Import",icon:u.Upload,colorClass:"bg-green-500"}],driver:[{to:"/driver",label:"My Trips",icon:u.CalendarRange}],affiliate:[{to:"/affiliate",label:"Allocated Trips",icon:u.CalendarRange}],client:[{to:"/account",label:"My Bookings",icon:u.CalendarRange},{to:"/account/quotes",label:"My Quotes",icon:u.FileText},{to:"/quote",label:"New Quote",icon:u.FileText}]},T={"sms-inbox-unhandled":async()=>{var e,a;return null!==(e=null===(a=(await k.default.get("/sms/inbox/unhandled-count")).data)||void 0===a?void 0:a.count)&&void 0!==e?e:0}};function R(e){let{links:a,currentPath:t,onNavigate:s,badgeCounts:l}=e;return(0,f.jsx)("nav",{className:"p-2",children:a.map(e=>{var a;const o=e.icon,r=e.end?t===e.to:t.startsWith(e.to),i=e.badgeSource&&null!==(a=null===l||void 0===l?void 0:l[e.badgeSource])&&void 0!==a?a:0;return(0,f.jsxs)(n.Link,{to:e.to,onClick:s,"data-testid":"nav-".concat(e.label.toLowerCase().replace(/\s+/g,"-")),className:"flex items-center gap-3 px-4 py-3 text-sm border-l-2 transition-colors ".concat(r?"border-klein bg-white text-klein font-semibold":"border-transparent ".concat(e.colorClass||"text-zinc-700"," ").concat(e.colorClass?"text-white font-bold hover:brightness-110":"hover:bg-white hover:text-klein")),children:[(0,f.jsx)(o,{size:16}),(0,f.jsx)("span",{className:"flex-1",children:e.label}),e.badgeSource&&i>0?(0,f.jsx)("span",{"data-testid":"nav-badge-".concat(e.badgeSource),className:"min-w-[1.5rem] h-5 inline-flex items-center justify-center rounded-full px-1.5 text-[10px] font-black tabular-nums ".concat(r?"bg-klein text-white":"bg-white text-fuchsia-700"),children:i>99?"99+":i}):null]},e.to)})})}function D(e){let{user:a,onLogout:t}=e;return(0,f.jsxs)("div",{className:"p-4 border-t border-border mt-4",children:[(0,f.jsx)("div",{className:"text-xs text-zinc-500 mb-2",children:"Signed in as"}),(0,f.jsx)("div",{className:"text-sm font-semibold truncate",children:null===a||void 0===a?void 0:a.name}),(0,f.jsx)("div",{className:"text-xs uppercase tracking-widest text-klein mb-3",children:null===a||void 0===a?void 0:a.role}),(0,f.jsxs)(r.Button,{"data-testid":"logout-btn",variant:"outline",className:"w-full rounded-none border-zinc-300",onClick:t,children:[(0,f.jsx)(u.LogOut,{size:14,className:"mr-2"})," Sign out"]})]})}function L(e){let{children:a}=e;const{user:t,logout:r}=(0,o.useAuth)(),i=(0,n.useLocation)(),d=(0,n.useNavigate)(),c=S[null===t||void 0===t?void 0:t.role]||[],[m,b]=(0,l.useState)(!1),p=function(e){const[a,t]=(0,l.useState)({}),n=(0,l.useRef)(null);return(0,l.useEffect)(()=>{const a=Array.from(new Set(e.map(e=>e.badgeSource).filter(Boolean)));if(!a.length)return;let l=!1;const o=async()=>{const e={};await Promise.all(a.map(async a=>{const t=T[a];if(t)try{e[a]=await t()}catch(s){}})),l||t(a=>(0,s.default)((0,s.default)({},a),e))};return o(),n.current=setInterval(o,3e4),()=>{l=!0,n.current&&clearInterval(n.current)}},[e]),a}(c);(0,l.useEffect)(()=>{b(!1)},[i.pathname]);const g=async()=>{await r(),d("/")};return(0,f.jsxs)("div",{className:"min-h-screen bg-white flex flex-col md:flex-row",children:[(0,f.jsxs)("header",{className:"md:hidden bg-white border-b border-border pt-[env(safe-area-inset-top)]","data-testid":"mobile-top-bar",children:[(0,f.jsxs)("div",{className:"flex items-center justify-between px-3 py-2",children:[(0,f.jsx)("button",{type:"button",onClick:()=>b(!0),"data-testid":"mobile-nav-open","aria-label":"Open navigation",className:"p-2 -ml-2 text-zinc-700 hover:text-klein transition",children:(0,f.jsx)(u.Menu,{size:22})}),(0,f.jsx)("span",{className:"label-eyebrow text-[10px] text-zinc-500",children:"Booking OS"}),(0,f.jsx)("div",{className:"w-9","aria-hidden":"true"})]}),(0,f.jsx)(n.Link,{to:"/",className:"block px-3 pb-2",children:(0,f.jsx)(C.default,{fill:!0})})]}),(0,f.jsxs)("aside",{className:"hidden md:block md:w-64 md:min-h-screen border-r border-border bg-[#FAFAFA]","data-testid":"desktop-sidebar",children:[(0,f.jsx)("div",{className:"p-6 border-b border-border",children:(0,f.jsxs)(n.Link,{to:"/",className:"block",children:[(0,f.jsx)("div",{className:"label-eyebrow mb-2",children:"Booking OS"}),(0,f.jsx)(C.default,{fill:!0})]})}),(0,f.jsx)(R,{links:c,currentPath:i.pathname,onNavigate:void 0,badgeCounts:p}),(0,f.jsx)(D,{user:t,onLogout:g})]}),(0,f.jsx)(h,{open:m,onOpenChange:b,children:(0,f.jsxs)(j,{side:"left",className:"p-0 w-72 bg-[#FAFAFA] overflow-y-auto pt-[env(safe-area-inset-top)]","data-testid":"mobile-drawer",children:[(0,f.jsx)(w,{className:"sr-only",children:"Navigation"}),(0,f.jsxs)("div",{className:"p-6 border-b border-border",children:[(0,f.jsx)("div",{className:"label-eyebrow mb-2",children:"Booking OS"}),(0,f.jsx)(C.default,{fill:!0})]}),(0,f.jsx)(R,{links:c,currentPath:i.pathname,onNavigate:()=>b(!1),badgeCounts:p}),(0,f.jsx)(D,{user:t,onLogout:async()=>{b(!1),await g()}})]})}),(0,f.jsx)("main",{className:"flex-1 min-w-0",children:a})]})}},3167(e,a,t){t.r(a),t.d(a,{Switch:()=>c});var s=t(9379),l=t(3986),n=t(9950),o=t(9222),r=t(90),i=t(4414);const d=["className"],c=n.forwardRef((e,a)=>{let{className:t}=e,n=(0,l.default)(e,d);return(0,i.jsx)(o.Root,(0,s.default)((0,s.default)({className:(0,r.cn)("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",t)},n),{},{ref:a,children:(0,i.jsx)(o.Thumb,{className:(0,r.cn)("pointer-events-none block h-4 w-4 roun
1ded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}))});c.displayName=o.Root.displayName},4779(e,a,t){t.r(a),t.d(a,{Input:()=>d});var s=t(9379),l=t(3986),n=t(9950),o=t(90),r=t(4414);const i=["className","type"],d=n.forwardRef((e,a)=>{let{className:t,type:n}=e,d=(0,l.default)(e,i);return(0,r.jsx)("input",(0,s.default)({type:n,className:(0,o.cn)("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t),ref:a},d))});d.displayName="Input"},5475(e,a,t){t.r(a),t.d(a,{Tabs:()=>m,TabsContent:()=>p,TabsList:()=>f,TabsTrigger:()=>b});var s=t(9379),l=t(3986),n=t(9950),o=t(3647),r=t(90),i=t(4414);const d=["className"],c=["className"],u=["className"],m=o.Root,f=n.forwardRef((e,a)=>{let{className:t}=e,n=(0,l.default)(e,d);return(0,i.jsx)(o.List,(0,s.default)({ref:a,className:(0,r.cn)("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",t)},n))});f.displayName=o.List.displayName;const b=n.forwardRef((e,a)=>{let{className:t}=e,n=(0,l.default)(e,c);return(0,i.jsx)(o.Trigger,(0,s.default)({ref:a,className:(0,r.cn)("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",t)},n))});b.displayName=o.Trigger.displayName;const p=n.forwardRef((e,a)=>{let{className:t}=e,n=(0,l.default)(e,u);return(0,i.jsx)(o.Content,(0,s.default)({ref:a,className:(0,r.cn)("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",t)},n))});p.displayName=o.Content.displayName},6633(e,a,t){t.r(a),t.d(a,{default:()=>l});var s=t(4414);function l(e){let{className:a="",height:t=96,fill:l=!1}=e;const n=l?{width:"100%",height:"auto"}:{height:t,width:"auto"};return(0,s.jsx)("img",{src:"/pdo-logo.png?v=2",alt:"Private Drivers Online / WSI Airport Transfers",style:n,className:"block ".concat(a),"data-testid":"brand-logo"})}},7255(e,a,t){t.r(a),t.d(a,{Dialog:()=>g,DialogClose:()=>v,DialogContent:()=>y,DialogDescription:()=>k,DialogFooter:()=>w,DialogHeader:()=>j,DialogOverlay:()=>N,DialogPortal:()=>h,DialogTitle:()=>C,DialogTrigger:()=>x});var s=t(9379),l=t(3986),n=t(9950),o=t(4174),r=t(715),i=t(90),d=t(4414);const c=["className"],u=["className","children"],m=["className"],f=["className"],b=["className"],p=["className"],g=o.Root,x=o.Trigger,h=o.Portal,v=o.Close,N=n.forwardRef((e,a)=>{let{className:t}=e,n=(0,l.default)(e,c);return(0,d.jsx)(o.Overlay,(0,s.default)({ref:a,className:(0,i.cn)("fixed inset-0 z-50 bg-black/80  data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t)},n))});N.displayName=o.Overlay.displayName;const y=n.forwardRef((e,a)=>{let{className:t,children:n}=e,c=(0,l.default)(e,u);return(0,d.jsxs)(h,{children:[(0,d.jsx)(N,{}),(0,d.jsxs)(o.Content,(0,s.default)((0,s.default)({ref:a,className:(0,i.cn)("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",t)},c),{},{children:[n,(0,d.jsxs)(o.Close,{className:"absolute right-4 top-4 roun
1ded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[(0,d.jsx)(r.X,{className:"h-4 w-4"}),(0,d.jsx)("span",{className:"sr-only",children:"Close"})]})]}))]})});y.displayName=o.Content.displayName;const j=e=>{let{className:a}=e,t=(0,l.default)(e,m);return(0,d.jsx)("div",(0,s.default)({className:(0,i.cn)("flex flex-col space-y-1.5 text-center sm:text-left",a)},t))};j.displayName="DialogHeader";const w=e=>{let{className:a}=e,t=(0,l.default)(e,f);return(0,d.jsx)("div",(0,s.default)({className:(0,i.cn)("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",a)},t))};w.displayName="DialogFooter";const C=n.forwardRef((e,a)=>{let{className:t}=e,n=(0,l.default)(e,b);return(0,d.jsx)(o.Title,(0,s.default)({ref:a,className:(0,i.cn)("text-lg font-semibold leading-none tracking-tight",t)},n))});C.displayName=o.Title.displayName;const k=n.forwardRef((e,a)=>{let{className:t}=e,n=(0,l.default)(e,p);return(0,d.jsx)(o.Description,(0,s.default)({ref:a,className:(0,i.cn)("text-sm text-muted-foreground",t)},n))});k.displayName=o.Description.displayName},9105(e,a,t){t.r(a),t.d(a,{default:()=>v});var s=t(9379),l=t(9950),n=t(1473),o=t(3079),r=t(1111),i=t(4779),d=t(557),c=t(9630),u=t(3167),m=t(1455),f=t(5475),b=t(7255),p=t(2033),g=t(4414);const x=["text","textarea","number","select","date","checkbox"];function h(e){return String(e||"").trim().toLowerCase().replace(/[^a-z0-9]+/g,"_").replace(/^_+|_+$/g,"").replace(/^[0-9]/,e=>"f_"+e)}function v(){const[e,a]=(0,l.useState)(null),[t,v]=(0,l.useState)("driver"),[N,y]=(0,l.useState)([]),[j,w]=(0,l.useState)(!1),[C,k]=(0,l.useState)(null),[S,T]=(0,l.useState)({label:"",key:"",type:"text",options:[],required:!1,visible:!0,order:0,helper_text:""}),R=async(e,a)=>{const{data:t}=await n.default.get("/custom-fields?business_id=".concat(e,"&entity=").concat(a));y(t)};(0,l.useEffect)(()=>{(async()=>{const{data:e}=await n.default.get("/businesses");a(e[0]),await R(e[0].id,t)})()},[]),(0,l.useEffect)(()=>{e&&R(e.id,t)},[t,e]);const D=()=>{k(null),T({label:"",key:"",type:"text",options:[],required:!1,visible:!0,order:N.length,helper_text:""}),w(!0)},L=(0,l.useMemo)(()=>(S.options||[]).join("\n"),[S.options]);return e?(0,g.jsx)(o.default,{children:(0,g.jsxs)("div",{className:"p-8 md:p-12",children:[(0,g.jsx)("div",{className:"label-eyebrow",children:"Schema"}),(0,g.jsx)("h1",{className:"font-display text-4xl md:text-5xl font-black tracking-tighter mt-2",children:"Custom Fields."}),(0,g.jsx)("p",{className:"text-zinc-600 mt-3 text-sm max-w-2xl",children:"Define extra fields admins should fill in on Drivers and Vehicles. Fields appear automatically in the relevant editor dialog."}),(0,g.jsxs)(f.Tabs,{value:t,onValueChange:v,className:"mt-6",children:[(0,g.jsxs)(f.TabsList,{className:"rounded-none",children:[(0,g.jsx)(f.TabsTrigger,{value:"driver","data-testid":"cf-tab-driver",className:"rounded-none",children:"Drivers"}),(0,g.jsx)(f.TabsTrigger,{value:"vehicle","data-testid":"cf-tab-vehicle",className:"rounded-none",children:"Vehicles"})]}),["driver","vehicle"].map(a=>(0,g.jsxs)(f.TabsContent,{value:a,children:[(0,g.jsxs)("div",{className:"flex items-end justify-between mt-4",children:[(0,g.jsxs)("p",{className:"text-xs text-zinc-500",children:[N.length," ",1===N.length?"field":"fields"," configured for ",a,"s."]}),(0,g.jsx)(r.Button,{"data-testid":"cf-new",onClick:D,className:"rounded-none bg-klein hover:bg-klein-dark text-white",children:"+ New field"})]}),(0,g.jsx)("div",{className:"mt-4 border border-border bg-white","data-testid":"cf-list",children:(0,g.jsxs)("table",{className:"w-full text-sm",children:[(0,g.jsx)("thead",{className:"bg-[#F4F4F5]",children:(0,g.jsx)("tr",{children:["Label","Key","Type","Required","Visible","Order",""].map(e=>(0,g.jsx)("th",{className:"text-left p-3 label-eyebrow",children:e},e))})}),(0,g.jsxs)("tbody",{children:[0===N.length&&(0,g.jsx)("tr",{children:(0,g.jsxs)("td",{colSpan:7,className:"p-6 text-center text-zinc-500",children:["No fields yet. Click ",(0,g.jsx)("strong",{children:"+ New field"})," to add one."]})}),N.map(a=>{var s;return(0,g.jsxs)("tr",{className:"border-t border-border","data-testid":"cf-row-".concat(a.id),children:[(0,g.jsx)("td",{className:"p-3",children:a.label}),(0,g.jsx)("td",{className:"p-3 mono text-xs",children:a.key}),(0,g.jsx)("td",{className:"p-3",children:(0,g.jsx)(c.Badge,{className:"rounded-none bg-zinc-700",children:a.type})}),(0,g.jsx)("td",{className:"p-3",children:a.required?"yes":"\u2014"}),(0,g.jsx)("td",{className:"p-3",children:!1===a.visible?"hidden":"yes"}),(0,g.jsx)("td",{className:"p-3 mono text-xs",children:null!==(s=a.order)&&void 0!==s?s:0}),(0,g.jsxs)("td",{className:"p-3 text-right space-x-2",children:[(0,g.jsx)(r.Button,{variant:"outline",className:"rounded-none",onClick:()=>(e=>{k(e),T({label:e.label,key:e.key,type:e.type,options:e.options||[],required:!!e.required,visible:!1!==e.visible,order:e.order||0,helper_text:e.helper_text||""}),w(!0)})(a),"data-testid":"cf-edit-".concat(a.id),children:"Edit"}),(0,g.jsx)(r.Button,{variant:"outline",className:"rounded-none text-red-600 border-red-200 hover:bg-red-50",onClick:()=>(async a=>{if(window.confirm("Delete this field? Existing data on drivers/vehicles will be preserved but no longer rendered in the editor."))try{await n.default.delete("/custom-fields/".concat(a)),R(e.id,t)}catch(o){var s,l;p.toast.error((null===(s=o.response)||void 0===s||null===(l=s.data)||void 0===l?void 0:l.detail)||"Failed")}})(a.id),"data-testid":"cf-del-".concat(a.id),children:"Delete"})]})]},a.id)})]})]})})]},a))]}),(0,g.jsx)(b.Dialog,{open:j,onOpenChange:w,children:(0,g.jsxs)(b.DialogContent,{className:"rounded-none max-w-lg","data-testid":"cf-editor-dialog",children:[(0,g.jsx)(b.DialogHeader,{children:(0,g.jsxs)(b.DialogTitle,{className:"font-display",children:[C?"Edit field":"New field"," \xb7 ",t]})}),(0,g.jsxs)("div",{className:"space-y-3",children:[(0,g.jsxs)("div",{children:[(0,g.jsx)(d.Label,{className:"label-eyebrow",children:"Label"}),(0,g.jsx)(i.Input,{"data-testid":"cf-label",className:"rounded-none mt-1",value:S.label,onChange:e=>T((0,s.default)((0,s.default)({},S),{},{label:e.target.value,key:C?S.key:h(e.target.value)}))})]}),(0,g.jsxs)("div",{children:[(0,g.jsx)(d.Label,{className:"label-eyebrow",children:"Storage key"}),(0,g.jsx)(i.Input,{"data-testid":"cf-key",className:"rounded-none mt-1 mono",disabled:!!C,value:S.key,onChange:e=>T((0,s.default)((0,s.default)({},S),{},{key:h(e.target.value)}))}),(0,g.jsx)("p",{className:"text-xs text-zinc-500 mt-1",children:"Snake-case identifier used in the database. Cannot be changed after creation."})]}),(0,g.jsxs)("div",{children:[(0,g.jsx)(d.Label,{className:"label-eyebrow",children:"Type"}),(0,g.jsxs)(m.Select,{value:S.type,onValueChange:e=>T((0,s.default)((0,s.default)({},S),{},{type:e})),children:[(0,g.jsx)(m.SelectTrigger,{"data-testid":"cf-type",className:"rounded-none mt-1",children:(0,g.jsx)(m.SelectValue,{})}),(0,g.jsx)(m.SelectContent,{children:x.map(e=>(0,g.jsx)(m.SelectItem,{value:e,children:e},e))})]})]}),"select"===S.type&&(0,g.jsxs)("div",{children:[(0,g.jsx)(d.Label,{className:"label-eyebrow",children:"Options (one per line)"}),(0,g.jsx)("textarea",{"data-testid":"cf-options",className:"w-full mt-1 border border-border p-2 text-sm",rows:4,value:L,onChange:e=>T((0,s.default)((0,s.default)({},S),{},{options:e.target.value.split("\n").map(e=>
1e.trim()).filter(Boolean)}))})]}),(0,g.jsxs)("div",{children:[(0,g.jsx)(d.Label,{className:"label-eyebrow",children:"Helper text"}),(0,g.jsx)(i.Input,{"data-testid":"cf-helper",className:"rounded-none mt-1",value:S.helper_text,onChange:e=>T((0,s.default)((0,s.default)({},S),{},{helper_text:e.target.value}))})]}),(0,g.jsxs)("div",{className:"grid grid-cols-3 gap-3",children:[(0,g.jsxs)("div",{children:[(0,g.jsx)(d.Label,{className:"label-eyebrow",children:"Order"}),(0,g.jsx)(i.Input,{type:"number",className:"rounded-none mt-1",value:S.order,onChange:e=>T((0,s.default)((0,s.default)({},S),{},{order:e.target.value}))})]}),(0,g.jsxs)("div",{className:"flex items-end gap-2",children:[(0,g.jsx)(u.Switch,{"data-testid":"cf-required",checked:S.required,onCheckedChange:e=>T((0,s.default)((0,s.default)({},S),{},{required:e}))}),(0,g.jsx)("span",{className:"text-sm",children:"Required"})]}),(0,g.jsxs)("div",{className:"flex items-end gap-2",children:[(0,g.jsx)(u.Switch,{"data-testid":"cf-visible",checked:S.visible,onCheckedChange:e=>T((0,s.default)((0,s.default)({},S),{},{visible:e}))}),(0,g.jsx)("span",{className:"text-sm",children:"Visible"})]})]}),(0,g.jsx)(r.Button,{"data-testid":"cf-save",onClick:async()=>{const a={business_id:e.id,entity:t,label:S.label,key:S.key||h(S.label),type:S.type,options:"select"===S.type?S.options:[],required:S.required,visible:S.visible,order:parseInt(S.order,10)||0,helper_text:S.helper_text};
1if(a.label&&a.key)try{C?await n.default.put("/custom-fields/".concat(C.id),a):await n.default.post("/custom-fields",a),p.toast.success("Saved"),w(!1),R(e.id,t)}catch(o){var s,l;p.toast.error((null===(s=o.response)||void 0===s||null===(l=s.data)||void 0===l?void 0:l.detail)||"Failed")}else p.toast.error("Label and key are required")},className:"rounded-none bg-klein hover:bg-klein-dark text-white w-full",children:"Save"})]})]})})]})}):(0,g.jsx)(o.default,{children:(0,g.jsx)("div",{className:"p-12 text-zinc-500",children:"Loading\u2026"})})}},9630(e,a,t){t.r(a),t.d(a,{Badge:()=>c,badgeVariants:()=>d});var s=t(9379),l=t(3986),n=(t(9950),t(4364)),o=t(90),r=t(4414);const i=["className","variant"],d=(0,n.cva)("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function c(e){let{className:a,variant:t}=e,n=(0,l.default)(e,i);return(0,r.jsx)("div",(0,s.default)({className:(0,o.cn)(d({variant:t}),a)},n))}}}]);

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.