PageSourceSearch

https://remaker.web.app/assets/page-admin-providers-DbL32vH9.js

js remaker.web.app collected 2026-10-03 12:34:45 UTC 12,671 bytes, 1 lines download raw bytes

1import{aw as M,r as v,j as e,bi as k,B as j,bk as D,dK as N,T as i,bl as F,k as C,L as z,o as Q,s as w,aF as Z,aZ as g,a as H,bj as V,D as $}from"./index-BDiEssHn.js";import{d as T,b as W}from"./build-api-BLvlo4US.js";import{a as R,b as B}from"./api-types-DnJAr3OZ.js";import{s as K,l as G,q}from"./app-authenticated-BvBbyBEv.js";import{P as J}from"./plans-Cdkn3d4s.js";import{T as U}from"./table-search-BK7tgbxw.js";import{T as X}from"./Tooltip-DrpsYYW2.js";import{I as Y}from"./IconButton-X__XmbpX.js";import{Q as _}from"./QuestionMark-B7InMek8.js";import{S as m}from"./Stack-CXWKVZh_.js";import{u as ee,T as re}from"./use-table-sorting-Ge7-myLB.js";import{T as te}from"./TableContainer-C9SFMqpK.js";import{T as se,a as ne,b as P,c as oe,d as h}from"./TableRow-Bb3yrJlY.js";import{L as ie}from"./Link-ORVFSNT4.js";import{u as ae,t as le,C as p}from"./zod-BePCW_Y-.js";import{D as de}from"./dialog-server-error-DNngGgLI.js";import{c as ce,s as me}from"./dialog-button-props-C_q4LwbF.js";import{i as b}from"./integer-input-props-DNYn3RT9.js";import{D as pe}from"./dialog-container-2VjA24ND.js";import{F as ue}from"./form-yQ8gk1_x.js";import{c as he}from"./subscriptions.utils-CJe-mmuS.js";import{u as xe}from"./useMutation-C5vhthUb.js";import{T as x,I}from"./TextField-D6BFw314.js";import{F as A}from"./FormLabel-CMQSL7Vn.js";import{S}from"./Select-B7GTNccD.js";import{M as y}from"./MenuItem-CU0qyOVA.js";import{L as fe}from"./LoadingButton-D6Y2n285.js";import{D as je}from"./DatePicker-BPXDinWj.js";import{d as ge}from"./shared-dialog-props-DEKgnHkJ.js";import{u as be}from"./useQuery-DCbUCkEu.js";import{C as ve}from"./Container-DzXFxZrZ.js";import{S as f}from"./Skeleton-B1pLtSHP.js";import"./assign-calendar-vkZLSVqv.js";import"./search-bJ8KcxY3.js";import"./InputAdornment-DKnIX20H.js";import"./useFormControl-DqGML1YI.js";import"./Grow-DSZBs2Jx.js";import"./useControlled-BcBwlPcT.js";import"./Popper-i1gQI2_A.js";import"./styled-CPR2i_RB.js";import"./icons-BOIH0Wxz.js";import"./TableSortLabel-BYUgC0_2.js";import"./Alert-BUoCKiUu.js";import"./useSlot-T_e2qCNU.js";import"./Close-CjitFeO_.js";import"./input-utils-D4RB_YHO.js";import"./useSyncExternalStore-C-eh807s.js";import"./Menu-BD-Hv05d.js";import"./isMuiElement-CmlxUQOn.js";import"./listItemIconClasses-BFfKEQ0W.js";import"./listItemTextClasses-BveHhdOe.js";import"./dividerClasses-0FQLBXVG.js";import"./CircularProgress-DLlHYLn6.js";import"./index-BzUg049X.js";import"./colorManipulator-DMLURtwo.js";import"./ListItem-CuO2KfBK.js";import"./listItemButtonClasses-BM4ALIkC.js";import"./Chip-Csaun36R.js";import"./createContainer-By8SYXzi.js";const Oe=R,Pe=M(T.ZProvider),ye=W("api","getProviders",Oe,Pe),Ce=()=>{const[d,c]=v.useState(!1),o=()=>{c(!1)};return e.jsxs(e.Fragment,{children:[e.jsx(X,{title:"Questions & answers",arrow:!0,children:e.jsx(Y,{color:"primary",onClick:()=>{c(!0)},children:e.jsx(_,{})})}),e.jsx(k,{open:d,onClose:()=>{o()},maxWidth:"md",fullWidth:!0,children:e.jsxs(j,{sx:{borderRadius:"10px",border:"1px solid rgba(129, 254, 233, 0.5)",backgroundColor:"#202022"},children:[e.jsx(D,{children:e.jsx(N,{children:e.jsxs(m,{spacing:6,children:[e.jsxs(j,{children:[e.jsx(i,{variant:"h5",children:"How to delete a provider?"}),e.jsx(i,{paragraph:!0,children:"Contact the development team."}),e.jsx(i,{paragraph:!0,children:"Explain what to do with the users attached to the provider. Possible actions: [detach / attach to another provider]"}),e.jsx(i,{children:"Explain what to do with the provider's plans. Possible actions: [delete / export before deleting]"})]}),e.jsxs(j,{children:[e.jsx(i,{variant:"h5",children:"How to temporarily deactivate a provider, so that operators cannot access it?"}),e.jsx(i,{paragraph:!0,children:"Contact the development team."}),e.jsx(i,{children:"There's no such property as provider status, so deactivated providers will be visible in the admin portal just like active ones."})]}),e.jsxs(j,{children:[e.jsx(i,{variant:"h5",children:"How to change the provider name or reduce the number of seats?"}),e.jsx(i,{paragraph:!0,children:"Contact the development team."}),e.jsx(i,{children:"Explain what to do if number of seats gets smaller than the number of active and invited athletes. Possible actions: [deactivate some athletes]"})]})]})})}),e.jsx(F,{children:e.jsx(C,{color:"secondary",variant:"contained",onClick:()=>{o()},size:"large",children:"Close"})})]})})]})},Te=[{id:"name",label:"Provider name",sortField:"name"},{id:"numberOfOperatorLicenses",label:"Operators",sortField:"numberOfOperatorLicenses"},{id:"numberOfProfiles",label:"Profiles",sortField:"numberOfProfiles"},{id:"numberOfIndependentAthleteLicenses",label:"Independent Athletes",sortField:"numberOfIndependentAthleteLicenses"},{id:"subscriptionStatus",label:"Subscription Status",sortField:"subscriptionStatus"}],Le=({providers:d,search:c})=>{const{order:o,orderBy:a,setOrder:l,setOrderBy:O}=ee("name","asc"),u=v.useMemo(()=>a==="name"?K(d,t=>t.name,o):G.orderBy(d,[t=>{switch(a){case"numberOfProfiles":return t.numberOfProfiles;case"numberOfIndependentAthleteLicenses":return t.numberOfIndependentAthleteLicenses;default:return t.name}},t=>t.name.toLocaleLowerCase()],[o,"asc"]),[d,o,a]);return e.jsx(te,{children:e.jsxs(se,{size:"small",children:[e.jsx(ne,{sx:{backgroundColor:"rgba(0, 0, 0, 0.1)"},children:e.jsx(P,{children:Te.map(t=>e.jsx(re,{defaultOrder:"name",label:t.label,onOrderByChange:O,onOrderChange:l,order:o,orderBy:a,sortField:t.sortField},t.id))})}),e.jsxs(oe,{children:[c!==""&&u.length===0&&e.jsx(P,{children:e.jsx(h,{colSpan:10,align:"center",sx:{padding:4},children:"No results found"})}),u.map(t=>{var r;return e.jsxs(P,{hover:!0,sx:{"&:last-child td, &:last-child th":{border:0}},children:[e.jsx(h,{sx:{maxWidth:"300px"}
1,children:e.jsx(ie,{component:z,to:`/providers/${t.id}`,underline:"hover",color:"primary",title:t.name,children:e.jsx(i,{variant:"inherit",noWrap:!0,children:t.name})})}),e.jsx(h,{children:t.numberOfOperatorLicenses??0}),e.jsxs(h,{children:[t.numberOfTakenProfiles??0," /"," ",t.numberOfProfiles??0]}),e.jsxs(h,{children:[t.numberOfTakenIndependentAthleteLicenses??0," /"," ",t.numberOfIndependentAthleteLicenses??0]}),e.jsx(h,{style:{textTransform:"capitalize"},children:((r=t.subscriptionStatus)==null?void 0:r.status)??""})]},t.id)})]})]})})},E=Q({name:T.ZProviderName,origin:B,numberOfProfilesPerOperator:g(),numberOfIndependentAthleteLicenses:g(),numberOfOperatorLicenses:g(),numberOfOperatorAdditionalProfilesLicenses:g(),accessStatus:Z(["pending","active"]).default("active"),nextPaymentDate:w().optional(),notes:w().optional()}),we=T.ZProvider,Ie=W("api","createProvider",E,we),Ae=({onCancel:d,onProviderCreated:c})=>{const o=H(),a=xe({mutationFn:Ie,onSuccess:async()=>{await o.invalidateQueries(q.admin.providers),c()}}),{control:l,handleSubmit:O,watch:u}=ae({defaultValues:{name:"",origin:"other",accessStatus:"active",numberOfProfilesPerOperator:20,numberOfIndependentAthleteLicenses:0,numberOfOperatorLicenses:1,numberOfOperatorAdditionalProfilesLicenses:0,nextPaymentDate:"",notes:""},resolver:le(E)}),t=()=>{a.isLoading||d()};return e.jsx(pe,{children:e.jsxs(ue,{onSubmit:O(r=>{a.mutate(r)}),children:[e.jsx(V,{children:"Create provider"}),e.jsx(D,{children:e.jsxs(m,{spacing:4,children:[e.jsx(m,{spacing:2,children:e.jsx(p,{control:l,name:"name",render:({field:r,fieldState:n})=>{var s;return e.jsx(x,{...r,variant:"filled",label:"Provider name",color:"secondary",fullWidth:!0,required:!0,error:n.error!=null,helperText:(s=n.error)==null?void 0:s.message})}})}),e.jsxs(m,{spacing:2,children:[e.jsx(i,{variant:"caption",fontWeight:"bold",children:"System Access"}),e.jsxs(m,{direction:"row",spacing:2,width:"100%",children:[e.jsx(p,{control:l,name:"numberOfProfilesPerOperator",render:({field:r,fieldState:n})=>{var s;return e.jsx(x,{...r,...b({getValue:()=>r.value,onChange:r.onChange}),variant:"filled",label:"Profiles per operator",color:"secondary",fullWidth:!0,error:n.error!=null,helperText:(s=n.error)==null?void 0:s.message})}}),e.jsx(p,{control:l,name:"numberOfOperatorLicenses",render:({field:r,fieldState:n})=>{var s;return e.jsx(x,{...r,...b({getValue:()=>r.value,onChange:r.onChange}),required:!0,variant:"filled",label:"Operator licenses",color:"secondary",fullWidth:!0,error:n.error!=null,helperText:(s=n.error)==null?void 0:s.message})}})]}),e.jsxs(m,{direction:"row",spacing:2,width:"100%",children:[e.jsx(p,{control:l,name:"numberOfIndependentAthleteLicenses",render:({field:r,fieldState:n})=>{var s;return e.jsx(x,{...r,...b({getValue:()=>r.value,onChange:r.onChange}),variant:"filled",label:"Independent athlete licenses",color:"secondary",fullWidth:!0,error:n.error!=null,helperText:(s=n.error)==null?void 0:s.message})}}),e.jsx(p,{control:l,name:"numberOfOperatorAdditionalProfilesLicenses",render:({field:r,fieldState:n})=>{var s;return e.jsx(x,{...r,...b({getValue:()=>r.value,onChange:r.onChange}),variant:"filled",label:"Additional profile batches",color:"secondary",fullWidth:!0,error:n.error!=null,helperText:(s=n.error)==null?void 0:s.message})}})]}),e.jsxs(i,{variant:"caption",textAlign:"center",children:["Number of profiles:"," ",he({numberOfOperatorLicenses:u("numberOfOperatorLicenses"),numberOfOperatorAdditionalProfilesLicenses:u("numberOfOperatorAdditionalProfilesLicenses"),numberOfProfilesPerOperator:u("numberOfProfilesPerOperator")})]})]}),e.jsxs(m,{spacing:2,children:[e.jsx(i,{variant:"caption",fontWeight:"bold",children:"Subscription Details"}),e.jsxs(m,{direction:"row",spacing:2,width:"100%",children:[e.jsx(p,{control:l,name:"origin",render:({field:r,fieldState:n})=>e.jsxs(A,{variant:"filled",fullWidth:!0,children:[e.jsx(I,{id:"origin",color:"secondary",children:"Customer Access Reason *"}),e.jsx(S,{...r,id:"origin",variant:"filled",color:"secondary",fullWidth:!0,required:!0,error:n.error!=null,sx:{textTransform:"capitalize"},children:Object.keys(B.Values).map(s=>e.jsx(y,{value:s,sx:{textTransform:"capitalize"},children:s},s))})]})}),e.jsx(p,{control:l,name:"accessStatus",render:({field:r})=>e.jsxs(A,{variant:"filled",fullWidth:!0,children:[e.jsx(I,{id:"accessStatus",color:"secondary",children:"Initial Acce
1ss Status *"}),e.jsxs(S,{...r,required:!0,id:"accessStatus",variant:"filled",color:"secondary",fullWidth:!0,children:[e.jsx(y,{value:"active",children:"Active"}),e.jsx(y,{value:"pending",children:"Pending"})]})]})})]}),e.jsx(p,{control:l,name:"nextPaymentDate",render:({field:r,fieldState:n})=>{var s;return e.jsx(je,{label:"Next payment date",format:"dd MMMM yyyy",value:r.value?new Date(r.value):null,onChange:L=>{r.onChange(L?L.toISOString():"")},slotProps:{textField:{variant:"filled",color:"secondary",fullWidth:!0,error:n.error!=null,helperText:((s=n.error)==null?void 0:s.message)||"Access active until this date. Leave blank for indefinite access. Access is NOT revoked automatically."},desktopPaper:{sx:{backgroundColor:"#202022"}}}})}}),e.jsx(p,{control:l,name:"notes",render:({field:r,fieldState:n})=>{var s;return e.jsx(x,{...r,variant:"filled",label:"Notes",color:"secondary",fullWidth:!0,multiline:!0,rows:3,error:n.error!=null,helperText:(s=n.error)==null?void 0:s.message})}})]}),e.jsx(de,{error:a.error})]})}),e.jsxs(F,{children:[e.jsx(C,{...ce,onClick:t,disabled:a.isLoading,children:"Cancel"}),e.jsx(fe,{...me,loading:a.isLoading,children:"Create"})]})]})})},Se=()=>{const d=$(),[c,o]=v.useState(!1);return e.jsxs(e.Fragment,{children:[d&&e.jsx(C,{variant:"outlined",color:"primary",size:"large",onClick:()=>{o(!0)},children:"Create provider"}),e.jsx(k,{...ge,open:c,maxWidth:"sm",fullWidth:!0,children:e.jsx(Ae,{onCancel:()=>{o(!1)},onProviderCreated:()=>{o(!1)}})})]})},qr=()=>{var a;const d=be({queryKey:q.admin.providers,queryFn:()=>ye({})}),[c,o]=v.useState("");return e.jsxs(ve,{maxWidth:"xl",children:[e.jsxs(m,{direction:"row",alignItems:"center",spacing:2,pt:2,children:[e.jsx(J,{color:"primary"}),e.jsx(i,{color:"primary",variant:"h5",children:"Providers"})]}),e.jsxs(m,{width:"100%",direction:"row",alignItems:"center",justifyContent:"space-between",py:2,position:"relative",children:[e.jsx(U,{value:c,onChange:o}),e.jsxs(m,{direction:"row",alignItems:"center",justifyContent:"space-between",spacing:2,children:[e.jsx(Se,{}),e.jsx(Ce,{})]})]}),d.isLoading?e.jsxs(m,{spacing:2,children:[e.jsx(f,{width:"100%",height:"32px",variant:"rounded"}),e.jsx(f,{width:"100%",height:"32px",variant:"rounded"}),e.jsx(f,{width:"100%",height:"32px",variant:"rounded"}),e.jsx(f,{width:"100%",height:"32px",variant:"rounded"}),e.jsx(f,{width:"100%",height:"32px",variant:"rounded"})]}):e.jsx(Le,{providers:((a=d.data)==null?void 0:a.filter(l=>l.name.toLowerCase().includes(c.toLowerCase())))??[],search:c})]})};export{qr as PageAdminProviders};

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.