import{r as I,j as e,a$ as A}from"./react-vendor-xYZnmIII.js";import{a as S,k as E,m as D,J as y,K as B,B as g,M as H,e as $,l as z,a5 as P,y as R,z as a,D as o,aE as d,aI as x,aG as i,aJ as r,aF as h,aH as t}from"./ui-components-CQM92IK3.js";import V from"./index-BEDhrcKd.js";import k from"./api-copy-kRxB8Vsy.js";import"./inertia-vendor-cBbDTmhJ.js";import"./ui-vendor-Ds9iwIxa.js";import"./interactive-vendor-B1OgcAgP.js";import"./table-header-CjMHr8CW.js";import"./blogs-table-columns-BTIziXE_.js";import"./categories-table-columns-CBlgDcy1.js";import"./courses-table-columns-CGnsawL4.js";import"./instructors-table-columns-DOKTDX9Q.js";import"./table-filter-CqNe_5up.js";import"./table-page-size-CzF8rJAG.js";import"./route-D0xh7FtZ.js";import"./debounce-CWHP_ANh.js";import"./table-footer-BOe2S7IJ.js";const le=({data:l,removing:f,inserting:J,instructors:w,onRemove:C,onInsert:T})=>{var j;const[n,v]=I.useState("best"),c=(s,m)=>{var u,p,N,b;return e.jsxs(i,{children:[e.jsx(t,{children:e.jsx("img",{src:((u=s.user)==null?void 0:u.photo)||"/placeholder.jpg",alt:(p=s.user)==null?void 0:p.name,className:"h-12 w-12 rounded-full object-cover"})}),e.jsx(t,{className:"font-medium",children:((N=s.user)==null?void 0:N.name)||"N/A"}),e.jsx(t,{children:((b=s.user)==null?void 0:b.email)||"N/A"}),e.jsxs(t,{children:[s.courses_count||0," courses"]}),e.jsx(t,{children:e.jsx(g,{variant:"ghost",size:"icon",onClick:()=>C("instructors",m,s.id),disabled:f===`instructors-${m}-${s.id}`,children:e.jsx(A,{className:"text-destructive h-4 w-4"})})})]},s.id)};return e.jsxs(S,{className:"relative",children:[e.jsxs(E,{className:"flex flex-row flex-wrap items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx(D,{className:"text-xl font-bold",children:"Instructors"}),e.jsx(k,{value:`api/collections/instructors/${n}`})]}),e.jsxs(y,{children:[e.jsx(B,{children:e.jsxs(g,{className:"capitalize",children:["Select ",n," Instructor"]})}),e.jsx(H,{className:"p-0",children:e.jsx($,{className:"max-h-[90vh] p-2",children:e.jsx(V,{type:"instructors",title:"Instructors",data:w,selectedIds:n==="best"?[(j=l.best)==null?void 0:j.id]:n==="top"?l.top.map(s=>s.id):l.new.map(s=>s.id),onCourseSelect:s=>T("instructors",n,s)})})})]})]}),e.jsx(z,{children:e.jsxs(P,{defaultValue:"best",className:"w-full",value:n,onValueChange:v,children:[e.jsxs(R,{className:"grid w-full grid-cols-3",children:[e.jsx(a,{value:"best",className:"cursor-pointer",children:"Best Instructor"}),e.jsx(a,{value:"top",className:"cursor-pointer",children:"Top Instructors"}),e.jsx(a,{value:"new",className:"cursor-pointer",children:"New Instructors"})]}),e.jsx(o,{value:"best",children:e.jsxs(d,{children:[e.jsx(x,{children:e.jsxs(i,{children:[e.jsx(r,{children:"Photo"}),e.jsx(r,{children:"Name"}),e.jsx(r,{children:"Email"}),e.jsx(r,{children:"Courses"}),e.jsx(r,{children:"Action"})]})}),e.jsx(h,{children:l.best?c(l.best,"best"):e.jsx(i,{children:e.jsx(t,{colSpan:5,className:"text-muted-foreground text-center",children:"No best instructor selected"})})})]})}),e.jsx(o,{value:"top",children:e.jsxs(d,{children:[e.jsx(x,{children:e.jsxs(i,{children:[e.jsx(r,{children:"Photo"}),e.jsx(r,{children:"Name"}),e.jsx(r,{children:"Email"}),e.jsx(r,{children:"Courses"}),e.jsx(r,{children:"Action"})]})}),e.jsx(h,{children:l.top&&l.top.length>0?l.top.map(s=>c(s,"top")):e.jsx(i,{children:e.jsx(t,{colSpan:5,className:"text-muted-foreground text-center",children:"No top instructors selected"})})})]})}),e.jsx(o,{value:"new",children:e.jsxs(d,{children:[e.jsx(x,{children:e.jsxs(i,{children:[e.jsx(r,{children:"Photo"}),e.jsx(r,{children:"Name"}),e.jsx(r,{children:"Email"}),e.jsx(r,{children:"Courses"}),e.jsx(r,{children:"Action"})]})}),e.jsx(h,{children:l.new&&l.new.length>0?l.new.map(s=>c(s,"new")):e.jsx(i,{children:e.jsx(t,{colSpan:5,className:"text-muted-foreground text-center",children:"No new instructors selected"})})})]})})]})})]})};export{le as default};
