1!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="d387d3cb-aa1e-4eb3-86e8-94a6c556af85",e._sentryDebugIdIdentifier="sentry-dbid-d387d3cb-aa1e-4eb3-86e8-94a6c556af85")}catch(e){}}(),(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[72012],{70456:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/dashboard/vans",function(){return t(21761)}])},80444:function(e,n,t){"use strict";t.d(n,{n:function(){return f}});var r=t(85893),i=t(9404),a=t(95052),s=t(20348),l=t(14685),o=t(67294);let d=()=>{let[e,n]=(0,o.useState)(null),t=e=>n(e),r=()=>n(null);return{currentAction:e,openDialog:t,closeDialog:r}};var c=t(31158),u=t(41664),h=t.n(u);let x=e=>{let{title:n,description:t,onConfirm:i,onCancel:a,confirmText:l="Confirm",confirmVariant:o="default"}=e;return(0,r.jsxs)(s._T,{children:[(0,r.jsxs)(s.fY,{children:[(0,r.jsx)(s.f$,{children:n}),(0,r.jsx)(s.yT,{children:t})]}),(0,r.jsxs)(s.xo,{children:[(0,r.jsx)(s.le,{onClick:a,children:"Cancel"}),(0,r.jsx)(s.OL,{onClick:i,className:"destructive"===o?"bg-red-600":"",children:l})]})]})},f=e=>{let{entity:n,actions:t,editDialog:u,editLink:f,manageImagesDialog:p}=e,{currentAction:v,openDialog:b,closeDialog:j}=d(),[m,g]=(0,o.useState)(!1),[y,w]=(0,o.useState)(!1);return n?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(a.h_,{children:[(0,r.jsx)(a.$F,{asChild:!0,children:(0,r.jsx)(l.z,{variant:"ghost",className:"h-8 w-8 p-0",children:(0,r.jsx)(i.default,{className:"h-4 w-4"})})}),(0,r.jsxs)(a.AW,{align:"end",children:[(0,r.jsx)(a.Ju,{children:"Actions"}),f?(0,r.jsx)(a.Xi,{asChild:!0,children:(0,r.jsx)(h(),{href:f,children:"Edit"})}):u?(0,r.jsx)(a.Xi,{onSelect:()=>g(!0),children:"Edit"}):null,p&&(0,r.jsx)(a.Xi,{onSelect:()=>w(!0),children:"Manage images"}),Object.keys(t).map(e=>(0,r.jsx)(a.Xi,{onSelect:()=>b(e),className:"destructive"===t[e].confirmVariant?"text-red-600":void 0,children:t[e].confirmText},e))]})]}),v&&(0,r.jsx)(s.aR,{open:!!v,onOpenChange:e=>!e&&j(),children:(0,r.jsx)(x,{...t[v],onCancel:j})}),u&&(0,r.jsx)(c.Vq,{open:m,onOpenChange:g,children:(0,r.jsxs)(c.cZ,{children:[(0,r.jsx)(c.fK,{children:(0,r.jsx)(c.$N,{children:u.title})}),u.renderContent(()=>g(!1))]})}),p&&(0,r.jsx)(c.Vq,{open:y,onOpenChange:w,children:(0,r.jsxs)(c.cZ,{className:"max-h-[90vh] overflow-hidden flex flex-col ",children:[(0,r.jsx)(c.fK,{children:(0,r.jsx)(c.$N,{children:p.title})}),(0,r.jsx)("div",{className:"flex-1 overflow-y-auto",children:p.renderContent(()=>w(!1))}),(0,r.jsx)(c.cN,{children:(0,r.jsx)(l.z,{onClick:p.onConfirm,children:"Submit"})})]})})]}):null}},44567:function(e,n,t){"use strict";t.d(n,{r:function(){return l}});var r=t(85893),i=t(67294),a=t(60761),s=t(26806);let l=i.forwardRef((e,n)=>{let{className:t,...i}=e;return(0,r.jsx)(a.fC,{className:(0,s.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),...i,ref:n,children:(0,r.jsx)(a.bU,{className:(0,s.cn)("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})})});l.displayName=a.fC.displayName},21761:function(e,n,t){"use strict";t.r(n),t.d(n,{__N_SSP:function(){return S},default:function(){return _}});var r=t(85893),i=t(12854),a=t(31158),s=t(61667),l=t(56967),o=t(67294),d=t(14685),c=t(32383),u=t(50381),h=t(2750),x=t(44567),f=t(56312),p=t(87536),v=t(1604);let b=v.z.object({registration:v.z.string().min(1),vanVariations:v.z.string().array().min(1),published:v.z.boolean()}),j=e=>{var n,t,i;let{onConfirm:a,vanVariations:s,defaultValues:l={registration:"",vanVariations:[],published:!0}}=e,o=null!==(i=null==s?void 0:s.vanVariations.map(e=>({label:null!==(n=null==e?void 0:e.name)&&void 0!==n?n:"",value:null!==(t=null==e?void 0:e.id.toString())&&void 0!==t?t:""})))&&void 0!==i?i:[],v=(0,p.cI)({resolver:(0,f.F)(b),defaultValues:l}),j=e=>{a({...e,vanVariations:e.vanVariations.map(e=>Number(e))})};return(0,r.jsx)(c.l0,{...v,children:(0,r.jsxs)("form",{onSubmit:v.handleSubmit(j),className:"space-y-6",children:[(0,r.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,r.jsx)(c.Wi,{
1control:v.control,name:"registration",render:e=>{let{field:n}=e;return(0,r.jsxs)(c.xJ,{children:[(0,r.jsx)(c.lX,{children:"Registration"}),(0,r.jsx)(c.NI,{children:(0,r.jsx)(u.I,{placeholder:"Enter registration",...n})}),(0,r.jsx)(c.zG,{})]})}}),(0,r.jsx)(c.Wi,{control:v.control,name:"vanVariations",render:e=>{let{field:n}=e;return(0,r.jsxs)(c.xJ,{children:[(0,r.jsx)(c.lX,{children:"Van variations"}),(0,r.jsx)(c.NI,{children:(0,r.jsx)(h.N,{...n,options:o,onValueChange:n.onChange})}),(0,r.jsx)(c.zG,{})]})}}),(0,r.jsx)(c.Wi,{control:v.control,name:"published",render:e=>{let{field:n}=e;return(0,r.jsxs)(c.xJ,{className:"col-span-2",children:[(0,r.jsx)(c.lX,{className:"pr-4",children:"Published"}),(0,r.jsx)(c.NI,{children:(0,r.jsx)(x.r,{checked:n.value,onCheckedChange:n.onChange,defaultChecked:l.published})}),(0,r.jsx)(c.zG,{})]})}})]}),(0,r.jsx)("div",{className:"flex justify-end",children:(0,r.jsx)(d.z,{type:"submit",children:"Submit"})})]})})},m=e=>{let{trigger:n}=e,{refetch:t}=(0,s.T)(),{data:d}=(0,s.Ue)(),[c]=(0,s.By)(),[u,h]=(0,o.useState)(!1),{toast:x}=(0,l.pm)(),f=async e=>{try{await c({variables:{createVanInput:e}}),x({title:"Van created"}),h(!1),t()}catch(e){x({title:"Something went wrong, please try again",variant:"destructive"})}};return(0,r.jsxs)(a.Vq,{open:u,onOpenChange:h,children:[(0,r.jsx)(i.hg,{asChild:!0,children:n}),(0,r.jsxs)(a.cZ,{children:[(0,r.jsx)(a.fK,{children:(0,r.jsx)(a.$N,{children:"Create van"})}),(0,r.jsx)(j,{vanVariations:d,onConfirm:f})]})]})};var g=t(23112),y=t(4992),w=t(80444),N=t(54673),C=t(61932);let k=e=>{var n,t,i,a;let{van:l,onEdit:d,onDelete:c}=e,{data:u}=(0,s.Ue)(),h=(0,o.useMemo)(()=>({publish:{title:"".concat(l.published?"Unpublish":"Publish"," van?"),description:"You're about to ".concat(l.published?"unpublish":"publish"," this van. Are you sure?"),confirmText:l.published?"Unpublish":"Publish",onConfirm:async()=>{await d(l.id,{published:!l.published})}},delete:{title:"Delete van",description:"This action cannot be undone. Are you sure you want to delete this van?",confirmText:"Delete",confirmVariant:"destructive",onConfirm:async()=>{await c(l.id)}}}),[l,d,c]);return(0,r.jsx)(w.n,{entity:l,actions:h,editDialog:{title:"Edit Van",renderContent:e=>{var s;return(0,r.jsx)(j,{vanVariations:u,onConfirm:async n=>{await d(l.id,n),e()},defaultValues:{registration:null!==(n=l.registration)&&void 0!==n?n:"",vanVariations:null!==(i=null==l?void 0:null===(s=l.vanVariations)||void 0===s?void 0:s.map(e=>null!==(t=null==e?void 0:e.id.toString())&&void 0!==t?t:""))&&void 0!==i?i:[],published:null!==(a=l.published)&&void 0!==a&&a}})}}})},V=e=>{let{onDelete:n,onEdit:t}=e;return[{accessorKey:"registration",header:e=>{let{column:n}=e;return(0,r.jsxs)(d.z,{className:"px-0 hover:bg-transparent",variant:"ghost",onClick:()=>n.toggleSorting("asc"===n.getIsSorted()),children:["Registration",(0,r.jsx)(C.default,{className:"ml-2 h-4 w-4"})]})}},{accessorKey:"vanVariations",header:"Van variations",cell:e=>{let{row:n}=e,t=n.original.vanVariations||[];return 0===t.length?(0,r.jsx)("span",{className:"text-sm text-gray-500",children:"No variations"}):(0,r.jsxs)(N.zs,{openDelay:100,children:[(0,r.jsx)(N.Yi,{children:(0,r.jsxs)("span",{className:"text-sm font-medium text-blue-600 hover:text-blue-800 hover:underline cursor-pointer",children:[t.length," ",1===t.length?"variation":"variations"]})}),(0,r.jsx)(N.bZ,{className:"w-64 p-4 bg-white shadow-lg rounded-lg border border-gray-200",children:(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)("h4",{className:"font-semibold text-sm text-gray-900 mb-2",children:"Selected Variations"}),t.map(e=>(0,r.jsx)("div",{className:"flex items-center justify-between bg-green-50 text-green-700 text-sm px-3 py-2 rounded-md",children:(0,r.jsx)("span",{className:"font-medium",children:null==e?void 0:e.name})},null==e?void 0:e.id))]})})]})}},{accessorKey:"published",header:e=>{let{column:n}=e;return(0,r.jsxs)(d.z,{className:"px-0 hover:bg-transparent",variant:"ghost",onClick:()=>n.toggleSorting("asc"===n.getIsSorted()),children:["Published",(0,r.jsx)(C.default,{className:"ml-2 h-4 w-4"})]})},cell:e=>{let{row:n}=e;return n.original.published?"Yes":"No"}},{id:"actions",cell:e=>{let{row:i}=e;return(0,r.jsx)(k,{van:i.original,onDelete:n,onEdit:t})}}]};var S=!0;function _(){let{data:e,refetch:n}=(0,s.T)(),[t]=(0,s.pz)(),[i]=(0,s.jy)(),{toast:a}=(0,l.pm)(),o=async(e,r)=>{try{await t({variables:{updateVanId:e,updateVanInput:r}}),a({title:"Van updated"}),n()}catch(e){a({title:"Something went wrong, please try again",variant:"destructive"})}},c=async e=>{try{await i({variables:{removeVanId:e}}),a({title:"Van deleted"}),n()}catch(e){a({title:"Something went wrong, please try again",variant:"destructive"})}};if(e)return(0,r.jsx)(r.Fragment,{children:(0,r.jsxs)(g.c,{children:[(0,r.jsxs)("div",{className:"flex justify-between items-center mb-5",children:[(0,r.jsx)("h1",{className:"text-2xl font-semibold",children:"Vans"}),(0,r.jsx)(m,{trigger:(0,r.jsx)(d.z,{children:"Create"})})]}),(0,r.jsx)(y.w,{columns:V({onDelete:c,onEdit:o}),data:e.vans})]})})}},60761:function(e,n,t){"use strict";t.d(n,{bU:function(){return N},fC:function(){return w}});var r=t(67294),i=t(36206),a=t(28771),s=t(25360),l=t(77342),o=t(57898),d=t(7546),c=t(75320),u=t(85893),h="Switch",[x,f]=(0,s.b)(h),[p,v]=x(h),b=r.forwardRef((e,n
1)=>{let{__scopeSwitch:t,name:s,checked:o,defaultChecked:d,required:h,disabled:x,value:f="on",onCheckedChange:v,form:b,...j}=e,[m,w]=r.useState(null),N=(0,a.e)(n,e=>w(e)),C=r.useRef(!1),k=!m||b||!!m.closest("form"),[V=!1,S]=(0,l.T)({prop:o,defaultProp:d,onChange:v});return(0,u.jsxs)(p,{scope:t,checked:V,disabled:x,children:[(0,u.jsx)(c.WV.button,{type:"button",role:"switch","aria-checked":V,"aria-required":h,"data-state":y(V),"data-disabled":x?"":void 0,disabled:x,value:f,...j,ref:N,onClick:(0,i.M)(e.onClick,e=>{S(e=>!e),k&&(C.current=e.isPropagationStopped(),C.current||e.stopPropagation())})}),k&&(0,u.jsx)(g,{control:m,bubbles:!C.current,name:s,value:f,checked:V,required:h,disabled:x,form:b,style:{transform:"translateX(-100%)"}})]})});b.displayName=h;var j="SwitchThumb",m=r.forwardRef((e,n)=>{let{__scopeSwitch:t,...r}=e,i=v(j,t);return(0,u.jsx)(c.WV.span,{"data-state":y(i.checked),"data-disabled":i.disabled?"":void 0,...r,ref:n})});m.displayName=j;var g=e=>{let{control:n,checked:t,bubbles:i=!0,...a}=e,s=r.useRef(null),l=(0,o.D)(t),c=(0,d.t)(n);return r.useEffect(()=>{let e=s.current,n=window.HTMLInputElement.prototype,r=Object.getOwnPropertyDescriptor(n,"checked"),a=r.set;if(l!==t&&a){let n=new Event("click",{bubbles:i});a.call(e,t),e.dispatchEvent(n)}},[l,t,i]),(0,u.jsx)("input",{type:"checkbox","aria-hidden":!0,defaultChecked:t,...a,tabIndex:-1,ref:s,style:{...e.style,...c,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function y(e){return e?"checked":"unchecked"}var w=b,N=m}},function(e){e.O(0,[45738,95475,87536,33397,77763,74094,75977,72126,18550,61667,79647,7966,49774,92888,40179],function(){return e(e.s=70456)}),_N_E=e.O()}]);
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.