1import{j as e,B as T,a3 as $,z as O,a8 as q,a9 as w,aa as W,ab as G,ac as l,$ as J,S as K,m as Q,ae as V}from"./vendor-mui-1Pi3BFuh.js";import{A as X}from"./ActionCell-Bio4YNfT.js";import{C as Y}from"./ConfirmDelete-C1l8uxuZ.js";import{D as Z}from"./DateCell-C1nHfRjE.js";import{E as ee}from"./EnhancedTableHead-BUFi7wgS.js";import{E as te}from"./EnhancedTableToolbar-B3zFeloX.js";import{F as ae}from"./FilterTable-xKkt675s.js";import{N as se}from"./NavHeader-D3CJrNLB.js";import{u as re,a as ie,f as b,P as ne,g as le}from"./index-BxBYWNob.js";import{P as ce}from"./Pagination-BEr3PSlh.js";import{u as oe}from"./useToggleSelection-B5hv0vDo.js";import{f as de,d as me,a as he}from"./Trainers-CQ2AxXPJ.js";import{A as ue}from"./Add-CrYLnFWR.js";import{a as i,k as pe,L as y}from"./vendor-react-CrXZvyk_.js";import"./Delete-CRJ2jk6I.js";import"./useDebouncedValue-CkrckZR6.js";import"./Search-D6VRuAfp.js";import"./Home-CMDHSwXo.js";import"./vendor-redux-Bi3kFs4E.js";import"./vendor-utils-Bdq6QFHX.js";import"./vendor-form-Df9-JY-v.js";const fe="https://id.movevn.com",xe=[{id:"id",label:"ID"},{id:"user_info",label:"Instructor Info"},{id:"email",label:"Email"},{id:"phone_number",label:"Phone number"},{id:"class",label:"Class"},{id:"created_at",label:"Created at"},{id:"actions",label:"Actions"}];function He(){const{t:r}=re(),{selected:m,toggle:I,selectAll:P,clearAll:D}=oe(),[g,C]=i.useState([]),[k,u]=i.useState(null),[A,p]=i.useState(!1),[c,E]=pe(),[j,v]=i.useState(!1),{showMessage:o,startProgress:L,completeProgress:M}=ie(),[N,z]=i.useState({total:0,current_page:0,from:0,last_page:0,per_page:0}),[n,S]=i.useState({search:c.get("search"),order:c.get("order"),start_date:c.get("start_date"),end_date:c.get("end_date"),paged:c.get("paged")||1,per_page:c.get("per_page")||12}),h=async t=>{try{L();const a=b(t);E(a);const s=await de(a);if(s&&!s.error){const{data:f,meta:d}=s;Array.isArray(f)?(C(f),z(d)):C([])}v(!0)}catch{}finally{M()}};async function B(t){try{p(!0);const a=await me(t);if(a&&!a.error){const{id:s}=a;s&&(h(n),o("success","Delete item successfully!"))}else o("error",r("An error occurred during delete item!"))}catch{o("error",r("An error occurred during delete item!"))}finally{p(!1),u(null)}}async function F(t){try{p(!0);const a=await he({ids:t});a&&!a.error?(h(n),o("success",r("Delete item successfully!"))):o("error",r("An error occurred during delete item!"))}catch{o("error",r("An error occurred during delete item!"))}finally{p(!1),u(null)}}i.useEffect(()=>{h(n)},[]),i.useEffect(()=>{j&&h(b(n))},[n]),i.useEffect(()=>{j&&h(b(n))},[n]);const H=t=>{t.target.checked?P(g.map(s=>s.id)):D()},R=(t,a)=>{I(a)},U=t=>m.indexOf(t)!==-1;return j?e.jsxs(T,{sx:{width:"100%"},children:[e.jsx(se,{title:r("Instructors"),breadcrumb:[{title:r("Instructor")}],endAction:e.jsx(y,{to:"/admin/trainers/create",children:e.jsx($,{startIcon:e.jsx(ue,{}),variant:"contained",size:"small",color:"primary",children:r("Create")})})}),e.jsxs(T,{children:[e.jsx(ae,{filter:n,setFilter:S}),e.jsxs(O,{sx:{width:"100%",overflow:"hidden"},children:[e.jsxs(q,{sx:{maxHeight:640,maxWidth:"calc(100vw - 54px)"},children:[e.jsxs(w,{stickyHeader:!0,"aria-label":"sticky table",size:"medium",children:[e.jsx(ee,{headCells:xe,numSelected:m.length,onSelectAllClick:H,rowCount:g?.length}),e.jsx(W,{children:g.map((t,a)=>{const s=U(t.id),f=`enhanced-table-checkbox-${a}`,{academic_classes:d}=t;return e.jsxs(G,{hover:!0,role:"checkbox","aria-checked":s,tabIndex:-1,selected:s,sx:{cursor:"pointer"},children:[e.jsx(l,{padding:"checkbox",children:e.jsx(J,{color:"primary",checked:s,onClick:x=>R(x,t?.id),inputProps:{"aria-labelledby":f}})}),e.jsx(l,{children:e.jsx("p",{children:t?.id})}),e.jsx(l,{children:e.jsxs(K,{direction:"row",spacing:2,alignItems:"center",children:[e.jsx(Q,{src:fe+"/"+t?.thumbnail?.file_path,sx:{bgcolor:"#000"},children:le(t?.full_name)}),e.jsx(y,{to:"/admin/trainers/"+t?.id,children:e.jsx("p",{children:e.jsx("strong",{className:"uppercase",children:t?.full_name})})}),!t?.user&&e.jsx(V,{size:"small",color:"warning",variant:"outlined",label:r("No user linked"),title:r('This instructor cannot open their schedule, check-in or pay-period count. Edit the profile and set "User to manage this profile".')})]})}),e.jsx(l,{children:e.jsx("p",{children:t?.email})}),e.jsx(l,{children:e.jsx("p",{children:t?.phone_number})}),e.jsx(l,{children:Array.isArray(d)&&d?.length?d.map((x,_)=>e.jsxs(y,{className:"mr-1 uppercase",to:`/admin/classes/${x.id}`,children:[x.title,_<d?.length-1?",":""]},_)):"-"}),e.jsx(l,{children:e.jsx(Z,{time:t?.created_at})}),e.jsx(l,{sx:{width:120},children:e.jsx(X,{rowData:t,editUrl:"/admin/trainers/",setDeleteItem:u})})]},t?.id)})})]}),m.length?e.jsx(te,{numSelected:m.length,isLoading:A,onSubmit:()=>F(m)}):""]}),e.jsx(ce,{meta:N,onChange:t=>S(a=>({...a,...t}))})]})]}),e.jsx(Y,{open:!!k,setOpen:u,isLoading:A,onSubmit:()=>B(k)})]}):e.jsx(ne,{height:500})}export{He 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.