1import{j as e,B as Y,z as $,a1 as j,T as f,a8 as ce,a9 as de,aa as me,af as he,ab as R,ac as c,a0 as g,R as ue,Z as xe,ag as pe}from"./vendor-mui-DFXKyM2E.js";import{u as L,a as fe,P as be,j as D,d as ye}from"./index-DGSpuRBj.js";import{f as ge,T as _e,a as je,b as ke,c as we}from"./TrainerSessions-DPT9gtUk.js";import{u as Ce}from"./UserInformation-D7XOpBWw.js";import{l as Se,a as m,L as k}from"./vendor-react-CrXZvyk_.js";import{N as Te}from"./NavHeader-BROh2czj.js";import{t as w,f as M,b as z}from"./timezone-DGogyvEL.js";import"./vendor-redux-Bi3kFs4E.js";import"./vendor-utils-BFUpClQh.js";import"./vendor-form-Df9-JY-v.js";import"./Home-CqZgsyW_.js";const ze=()=>{const{id:C}=Se(),{t:r}=L(),{showMessage:n,startProgress:S,completeProgress:T}=fe(),[b,d]=m.useState(!1),[o,E]=m.useState(null),[I,B]=m.useState(null),[F,H]=m.useState(null),[N,O]=m.useState([]);async function V(a,s){try{S();const t=await Ce(a,s);t&&!t.error?h():n("error",t?.data?.message||r("An error occurred, please try later"))}catch{n("error",r("An error occurred, please try later"))}finally{T()}}async function h(){try{S();const a=await ge(C);if(a&&!a.error){const{data:s}=a;if(s){const{title:t,description:x,capacity:l,trainer:i,start_time:p,end_time:u,class_sessions:_,class_type:y,class_types:ie}=s,P=s?.class;H(P),B(i);const oe=Array.isArray(_)?_.filter(le=>le?.status=="active"):[];O(oe),E({title:t,description:x,capacity:l,start_time:p,end_time:u,class:P,class_type:y,class_types:ie})}}else n("error",a?.data?.response?.status===403?r("You don't have permission to open the check-in page"):r("An error occurred, please try later"))}catch{n("error",r("An error occurred, please try later"))}finally{T()}}const W=async a=>{try{d("no_show_"+a);const s=await je(a);s&&!s.error?(n("success",r("Successfully updated no show status!")),h()):n("error",s?.data?.message||r("An error occurred, please try again later"))}catch{n("error",r("An error occurred, please try again later"))}finally{d(!1)}},G=async a=>{try{d("undo_no_show_"+a);const s=await _e(a);s&&!s.error?(n("success",r("Successfully reversed no-show and restored penalty!")),h()):n("error",s?.data?.message||r("An error occurred, please try again later"))}catch{n("error",r("An error occurred, please try again later"))}finally{d(!1)}},Z=async a=>{try{d("check_in_"+a);const s=await ke(a);s&&!s.error?(n("success",r("Successfully updated check-in status!")),h()):n("error",s?.data?.message||r("An error occurred, please try again later"))}catch{n("error",r("An error occurred, please try again later"))}finally{d(!1)}},q=async a=>{try{d("check_out_"+a);const s=await we(a);s&&!s.error?(n("success",r("Successfully updated check-out status!")),h()):n("error",s?.data?.message||r("An error occurred, please try again later"))}catch{n("error",r("An error occurred, please try again later"))}finally{d(!1)}};if(m.useEffect(()=>{h()},[]),!o)return e.jsx(be,{height:500});const J=[{id:"user_info",numeric:!1,disablePadding:!1,label:"User Info"},{id:"Subscription",numeric:!1,disablePadding:!1,label:"Subscription"},{id:"remaining",numeric:!1,disablePadding:!1,label:"Remaining"},{id:"expiry",numeric:!1,disablePadding:!1,label:"Expiry date"},{id:"noshow",numeric:!1,disablePadding:!1,label:"No show"},{id:"check_in",numeric:!1,disablePadding:!1,label:"Check in"},{id:"check_out",numeric:!1,disablePadding:!1,label:"Check out"},{id:"apply_bonus",numeric:!1,disablePadding:!1,label:"Apply bonus"}];function K(a){const{order:s,orderBy:t}=a,{t:x}=L();return e.jsx(he,{children:e.jsx(R,{children:J.map(l=>e.jsx(c,{align:l.numeric?"right":"left",padding:l.disablePadding?"none":"normal",sortDirection:t===l.id?s:!1,children:e.jsx("p",{className:"font-bold",children:x(l.label)})},l.id))})})}const Q=({rowData:a})=>{const{id:s,user:t,is_shared:x,name_shared:l,subscription:i,check_out_time:p,check_in_time:u,membership:_,apply_bonus:y}=a;return e.jsx(m.Fragment,{children:e.jsxs(R,{hover:!0,role:"checkbox",tabIndex:-1,sx:{cursor:"pointer"},children:[e.jsxs(c,{children:[x?e.jsxs(k,{to:"/admin/users/"+t?.id,children:[e.jsx("p",{className:"text-sm font-bold",children:l}),e.jsxs("span",{className:"text-slate-2 bg-slate-200 px-1 text-xs",children:[r("Shared by:")," ",D(t)||t?.email]})]}):e.jsx(k,{to:"/admin/users/"+t?.id,children:e.jsx("p",{className:"text-sm font-bold",children:D(t)||t?.email})}),e.jsx("p",{className:"text-xs",children:t?.email}),a?.late_cancel&&e.jsx("span",{className:"border border-orange-200 bg-orange-100 text-orange-600 px-1 text-xs mt-1 inline-block",children:r("Late Cancelled")})]}),e.jsx(c,{children:i?.membership?e.jsx(k,{to:"/admin/memberships/"+i?.membership?.id,children:e.jsx("p",{className:"font-bold",children:i?.membership?.title})}):"-"}),e.jsx(c,{children:e.jsx("p",{children:i?i?.max_sessions==-1?r("Unlimited"):`${Math.max(0,i?.max_sessions-i?.class_session_user_count)}/${i?.max_sessions}`:"-"})}),e.jsx(c,{children:i?e.jsx("p",{className:"font-bold",children:i?.end_date?ye(i?.end_date,"YYYY-MM-DD").format("DD/MM/YYYY"):"-"}):"-"}),e.jsx(c,{children:e.jsx("p",{children:a?.no_show?e.jsx(g,{loading:b==`undo_no_show_${s}`,sx:{borderRadius:0},size:"small",onClick:()=>{G(s)},variant:"contained",color:"warning",children:r("Undo No-Show")}):e.jsx(g,{loading:b==`no_show_${s}`,sx:{borderRadius:0},size:"small",onClick:()=>{W(s)},variant:"outlined",color:"secondary",disabled:!!u||a?.status==="cancelled"||a?.late_cancel===!0,title:u?r("Cannot mark as no-show: user has already checked in"):a?.status==="cancelled"||a?.late_cancel===!0?r("Cannot mark as no-show: penalty already applied"):"",children:r("No show")})})}),e.jsx(c,{children:e.jsx("p",{children:u?z(u):e.jsx(g,{loading:b==`check_in_${s}`,sx:{borderRadius:0},onClick:()=>{Z(s)},variant:"contained",size:"small",color:"secondary",children:r("Check-in")})})}),e.jsx(c,{children:e.jsx("p",{children:p?z(p):e.jsx(g,{loading:b==`check_out_${s}`,sx:{borderRadius:0},size:"small",onClick:()=>{p?n("error",r("This user has checked out!")):q(s)},variant:"outlined",color:"secondary",children:r("Check-Out")})})}),e.jsx(c,{children:e.jsx(ue,{sx:{width:"100%",mb:3},children:e.jsx(xe,{control:e.jsx(pe,{}),checked:y,onChange:()=>V(s,{apply_bonus:y?0:1}),name:"un_send_email"})})})]})})},X=o?.start_time?w(o.start_time).format("DD/MM/YYYY"):"-",ee=o?.start_time?M(o.start_time):"-",se=o?.end_time?M(o.end_time):"-",ae=`${ee} - ${se}`,U=o?.start_time&&o?.end_time?w(o.end_time).diff(w(o.start_time),"minute"):0,re=U?`(${U} minutes)`:"",ne=I?.full_name||"-",v=F?.title||"-",A=o?.class_types||"",te=A?`${v} - ${A}`:v;return e.jsxs(Y,{sx:{width:"100%"},children:[e.jsx(Te,{title:r("Session checkin"),breadcrumb:[{title:r("Session checkin")}],backLink:`/admin/sessions/${C}`}),e.jsx($,{sx:{mb:2,p:2,backgroundColor:"background.paper"},children:e.jsxs(j,{container:!0,spacing:2,children:[e.jsx(j,{item:!0,xs:12,md:6,children:e.jsxs(Y,{sx:{display:"flex",flexDirection:"column",gap:1},children:[e.jsxs(f,{variant:"body1",sx:{fontWeight:500},children:["ð
",X]}),e.jsxs(f,{variant:"body1",sx:{fontWeight:500},children:["ð¤ ",ne]}),e.jsxs(f,{variant:"body1",sx:{fontWeight:500},children:["ð¯ ",te]})]})}),e.jsxs(j,{item:!0,xs:12,md:6,sx:{display:"flex",flexDirection:"column",alignItems:{xs:"flex-start",md:"flex-end"},justifyContent:"center"},children:[e.jsxs(f,{variant:"h6",sx:{fontWeight:600},children:["â° ",ae]}),e.jsx(f,{variant:"body2",color:"text.secondary",children:re})]})]})}),e.jsx($,{sx:{width:"100%",overflow:"hidden"},children:e.jsx(ce,{sx:{maxHeight:640,maxWidth:"calc(100vw - 54px)"},children:e.jsxs(de,{stickyHeader:!0,"aria-label":"sticky table",size:"medium",children:[e.jsx(K,{rowCount:N?.length}),e.jsx(me,{children:N.map((a,s)=>e.jsx(Q,{rowData:a},a.id))})]})})})]})};export{ze 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.