PageSourceSearch

https://rackety.tv/_next/static/chunks/pages/admin/clubs-76a83d56a96ad20a.js

js rackety.tv collected 2026-10-09 00:02:49 UTC 10,208 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1095],{14925:(e,l,n)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/admin/clubs",function(){return n(49046)}])},49046:(e,l,n)=>{"use strict";n.r(l),n.d(l,{__N_SSP:()=>U,default:()=>G});var a=n(15383),t=n(14343),r=n(27058),i=n(22895),s=n(55630),c=n(74098),u=n(94096),o=n(54972),d=n(73422),h=n(25258),b=n(6720),m=n(15823),x=n(8887),v=n(88720),g=n(55715),j=n(62223),f=n(82741),p=n(99170),I=n(49611),N=n(99385),A=n(58811),C=n(7199),S=n(90105),y=n(43226);function w(e){var l,n;if(!e.streamServiceId){let n=null==(l=e.nucs)?void 0:l[0];if(!(null==n?void 0:n.health))return"NA";if(!1===(0,I.a)(n.health))return"OFFLINE"}return(null!=(n=e.courts)?n:[]).map(e=>(0,I.a)(e.health)).includes(!1)?"CAM_OFFLINE":"ONLINE"}let T={NA:"text-foreground",ONLINE:"text-success",CAM_OFFLINE:"text-warning",OFFLINE:"text-destructive"};function E(e){if(e.distributor)return"DISTRIBUTOR";let l=e.billing;return l?l.onboardedAt?"ACTIVE":l.onboardingToken?l.onboardingExpiresAt&&new Date(l.onboardingExpiresAt)<new Date?"EXPIRED":"PENDING":"ACTIVE"===l.status?"ACTIVE":"INACTIVE":"NO_BILLING"}let k={NO_BILLING:"text-muted-foreground",PENDING:"text-warning",EXPIRED:"text-destructive",INACTIVE:"text-destructive",ACTIVE:"text-success",DISTRIBUTOR:"text-primary"},D=(0,x.FB)();function O(e){var l;let{clubs:n,handleUpdateCallback:i,search:o}=e,d=(0,c.A)("ClubsDataGrid"),h=(0,m.useRouter)(),b=(null==(l=(0,u.iU)((0,r.useSession)().data))?void 0:l.role)==="ADMIN",{confirm:x,dialog:I}=(0,N.S)(),[O,L]=(0,t.useState)(null),_=async e=>{if(await x({title:d("deleteClubTitle"),description:d("confirmDeleteClub"),confirmLabel:d("delete"),destructive:!0}))try{await s.A.delete("/club?clubId=".concat(e)),p.oR.success(d("clubDeleted")),await i()}catch(e){var l,n,a;console.error(e),p.oR.error(null!=(a=null==e||null==(n=e.response)||null==(l=n.data)?void 0:l.message)?a:d("deleteClubError"))}},R=(0,t.useMemo)(()=>[D.accessor(e=>{var l;return null!=(l=e.name)?l:""},{id:"name",header:d("name"),meta:{filter:"text"},cell:e=>(0,a.jsx)(y.N,{href:"/admin/clubs/".concat(e.row.original.id),className:"font-semibold hover:underline",children:e.getValue()})}),D.accessor(e=>d("health_".concat(w(e))),{id:"status",header:d("status"),filterFn:"arrIncludesSome",meta:{filter:"facet"},cell:e=>(0,a.jsx)("span",{className:(0,A.cn)("font-semibold",T[w(e.row.original)]),children:e.getValue()})}),D.accessor(e=>{var l,n,a;return null!=(a=null==(n=e.nucs)||null==(l=n[0])?void 0:l.ip)?a:""},{id:"ip",header:d("ip")}),D.accessor(e=>{var l;return null!=(l=e.location)?l:""},{id:"location",header:d("location"),meta:{filter:"text"}}),D.accessor(e=>{var l,n;return null!=(n=null==(l=e.courts)?void 0:l.length)?n:0},{id:"courts",header:d("courts"),meta:{align:"right"}}),D.accessor(e=>{var l;return(null!=(l=e.courts)?l:[]).filter(e=>null!=e.padelyticsId).length},{id:"calibrated",header:d("calibrated"),meta:{align:"right"}}),D.accessor(e=>d("onboarding_".concat(E(e))),{id:"billing",header:d("billing"),filterFn:"arrIncludesSome",meta:{filter:"facet"},cell:e=>{var l,n,t,r;let i=E(e.row.original),s="DISTRIBUTOR"===i?d("viaDistributor",{name:null!=(t=null==(l=e.row.original.distributor)?void 0:l.name)?t:d("distributorFallback")}):e.getValue();return(0,a.jsx)("span",{className:(0,A.cn)("font-semibold",k[i]),title:"DISTRIBUTOR"===i?d("billedViaDistributor",{name:null!=(r=null==(n=e.row.original.distributor)?void 0:n.name)?r:""}):void 0,children:s})}}),D.display({id:"actions",header:()=>(0,a.jsx)("span",{className:"block text-right",children:d("actions")}),meta:{className:"w-40"},cell:e=>{let l=e.row.original,n=E(l);return(0,a.jsx)(S.uX,{actions:[{label:d("view"),icon:(0,a.jsx)(v.A,{}),onSelect:()=>h.push("/admin/clubs/".concat(l.id))},{label:d("clubPanel"),icon:(0,a.jsx)(g.A,{}),onSelect:()=>h.push("/manager?clubId=".concat(l.id))},{label:d("generateOnboardingLink"),icon:(0,a.jsx)(j.A,{}),hidden:!b||"ACTIVE"===n||"DISTRIBUTOR"===n,onSelect:()=>{var e;return L({id:l.id,name:null!=(e=l.name)?e:""})}},{label:d("delete"),icon:(0,a.jsx)(f.A,{}),destructive:!0,onSelect:()=>_(l.id)}]})}})],[h,h.locale,b,i]);return(0,a.jsxs)(a.Fragment,{children:[I,(0,a.jsx)(S.bQ,{columns:R,data:n,getRowId:e=>e.id,globalFilter:o,pageSize:10,pageSizeOptions:[10,15,20]}),(0,a.jsx)(C.A,{open:!!O,closeCallback:()=>L(null),clubId:null==O?void 0:O.id,clubName:null==O?void 0:O.name,onGenerated:i})]})}var L=n(85098),_=n(8378),R=n(71234),z=n(34482),F=n(72810),B=n(95941),V=n(54136);let P=async e=>{try{var l;return null!=(l=(await s.A.get("/clubs/admin",{headers:{Authorization:"Bearer ".concat(e)}})).data)?l:[]}catch(e){return console.error(e),[]}};function q(e){let{id:l,label:n,children:t}=e;return(0,a.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,a.jsx)(V.J,{htmlFor:l,children:n}),t]})}var U=!0;function G(e){let{initialClubs:l}=e,n=(0,c.A)("pages.AdminClubsPage"),{data:m}=(0,r.useSession)(),x=(0,u.iU)(m),v=null==m?void 0:m.accessToken,[g,j]=(0,t.useState)(l),[f,p]=(0,t.useState)(!1),[I,N]=(0,t.useState)(""),[A,C]=(0,t.useState)(""),[S,y]=(0,t.useState)(""),[w,T]=(0,t.useState)("0"),[E,k]=(0,t.useState)(null),[D,V]=(0,t.useState)(""),[U,G]=(0,t.useState)(!1),[M,X]=(0,t.useState)(""),$=(null==x?void 0:x.role)==="DISTRIBUTOR"?d.T:o.P,J=async()=>j(await P(v)),Q=async e=>{e.preventDefault(),G(!0);try{await s.A.post("/club",JSON.stringify({name:I,location:A,server:S,numCourts:w,timezone:E}),{headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(v)}}),await J(),p(!1)}catch(e){V((0,L.f_)(e,n("somethingWentWrong"),n("serverError")))}finally{G(!1)}};return(0,a.jsx)(h.A,{roles:["DISTRIBUTOR","ADMIN"],children:(0,a.jsxs)(b.A,{menuLinks:$,children:[(0,a.jsx)(_.z,{title:n("headerTitle"),actions:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(L.DO,{value:M,onChange:X}),(0,a.jsxs)(z.$,{onClick:()=>p(!0),disabled:(null==x?void 0:x.role)!=="ADMIN",children:[(0,a.jsx)(i.A,{"data-icon":"inl
1ine-start"}),n("addClubButton")]})]})}),(0,a.jsx)("div",{className:"w-full",children:(0,a.jsx)(O,{clubs:g,search:M,handleUpdateCallback:J})}),(0,a.jsx)(F.lG,{open:f,onOpenChange:p,children:(0,a.jsx)(F.Cf,{className:"sm:max-w-md",children:(0,a.jsxs)("form",{onSubmit:Q,className:"flex flex-col gap-4",children:[(0,a.jsx)(F.c7,{children:(0,a.jsx)(F.L3,{children:n("addClub")})}),(0,a.jsx)(L.jQ,{children:D}),(0,a.jsx)(q,{id:"club-name",label:n("clubNameLabel"),children:(0,a.jsx)(B.p,{id:"club-name",value:I,onChange:e=>N(e.target.value),required:!0})}),(0,a.jsx)(q,{id:"club-location",label:n("locationLabel"),children:(0,a.jsx)(B.p,{id:"club-location",value:A,onChange:e=>C(e.target.value),required:!0})}),(0,a.jsx)(q,{id:"club-server",label:n("serverLabel"),children:(0,a.jsx)(B.p,{id:"club-server",value:S,onChange:e=>y(e.target.value),required:!0})}),(0,a.jsx)(q,{id:"club-courts",label:n("courtsLabel"),children:(0,a.jsx)(B.p,{id:"club-courts",type:"number",min:0,value:w,onChange:e=>T(e.target.value),required:!0})}),(0,a.jsx)(q,{id:"club-timezone",label:n("timezoneLabel"),children:(0,a.jsx)(R.A,{id:"club-timezone",value:E,onChange:k})}),(0,a.jsxs)(F.Es,{children:[(0,a.jsx)(z.$,{type:"button",variant:"outline",onClick:()=>p(!1),disabled:U,children:n("cancelButton")}),(0,a.jsx)(z.$,{type:"submit",pending:U,children:n("saveButton")})]})]})})})]})})}},49611:(e,l,n)=>{"use strict";n.d(l,{a:()=>a,i:()=>t});let a=e=>new Date(e)>Date.now()-3e5,t=e=>e.some(a)},62223:(e,l,n)=>{"use strict";n.d(l,{A:()=>r});var a=n(85343);let t={name:"share-2",size:24,node:[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]};t.node;let r=(0,a.A)(t)},71234:(e,l,n)=>{"use strict";n.d(l,{A:()=>s});var a=n(15383),t=n(42760),r=n(74098),i=n(98444);function s(e){let{value:l,onChange:n,id:s,className:c}=e,u=(0,r.A)("TimezoneSelector"),{options:o}=(0,t.pX)({labelStyle:"original",timezones:t._O}),d=o.map(e=>({value:e.value,label:e.label}));return l&&!d.some(e=>e.value===l)&&d.unshift({value:l,label:l}),(0,a.jsxs)(i.l6,{value:null!=l?l:null,items:d,onValueChange:e=>n(e?String(e):null),children:[(0,a.jsx)(i.bq,{id:s,className:null!=c?c:"w-full","aria-label":u("timezone"),children:(0,a.jsx)(i.yv,{placeholder:u("timezone")})}),(0,a.jsx)(i.gC,{className:"max-h-72",children:d.map(e=>(0,a.jsx)(i.eb,{value:e.value,children:e.label},e.value))})]})}},82741:(e,l,n)=>{"use strict";n.d(l,{A:()=>r});var a=n(85343);let t={name:"square-x",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],aliases:["x-square"]};t.node;let r=(0,a.A)(t)},91147:(e,l,n)=>{"use strict";n.d(l,{T:()=>s});var a=n(15383),t=n(14343),r=n(34482),i=n(72810);function s(e){let{open:l,onOpenChange:n,title:s,description:c,children:u,confirmLabel:o,cancelLabel:d,onConfirm:h,destructive:b=!1}=e,[m,x]=(0,t.useState)(!1),v=async()=>{x(!0);try{await h()}finally{x(!1)}};return(0,a.jsx)(i.lG,{open:l,onOpenChange:n,children:(0,a.jsxs)(i.Cf,{className:"sm:max-w-md",children:[(0,a.jsxs)(i.c7,{children:[(0,a.jsx)(i.L3,{children:s}),c&&(0,a.jsx)(i.rr,{children:c})]}),u,(0,a.jsxs)(i.Es,{children:[(0,a.jsx)(r.$,{variant:"outline",onClick:()=>n(!1),children:d}),(0,a.jsx)(r.$,{variant:b?"destructive":"default",pending:m,onClick:v,children:o})]})]})})}},99385:(e,l,n)=>{"use strict";n.d(l,{S:()=>s});var a=n(15383),t=n(14343),r=n(74098),i=n(91147);function s(){var e,l;let n=(0,r.A)("ConfirmDialog"),[s,c]=(0,t.useState)(null),u=(0,t.useRef)(null),o=(0,t.useCallback)(e=>new Promise(l=>{var n;null==(n=u.current)||n.call(u,!1),u.current=l,c(e)}),[]),d=e=>{var l;null==(l=u.current)||l.call(u,e),u.current=null,c(null)};return{confirm:o,dialog:s?(0,a.jsx)(i.T,{open:!0,onOpenChange:e=>!e&&d(!1),title:s.title,description:s.description,confirmLabel:null!=(e=s.confirmLabel)?e:n("confirm"),cancelLabel:null!=(l=s.cancelLabel)?l:n("cancel"),destructive:s.destructive,onConfirm:()=>d(!0)}):null}}}},e=>{e.O(0,[9999,3692,6839,3833,7217,4179,2276,25,6536,7098,4048,636,6593,8792],()=>e(e.s=14925)),_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.