import{jsxs as t,jsx as e}from"react/jsx-runtime";import{a as S,k as j,m as D,H,J as y,B as x,K as B,e as E,l as z,a4 as P,x as V,y as a,z as m,aD as d,aH as p,aF as s,aI as i,aE as h,aG as o}from"./ui-components-B24mpb8o.js";import{Trash2 as $}from"lucide-react";import{useState as k}from"react";import R from"./index-DTOqaW7s.js";import F from"./api-copy-DM3xOhFq.js";import"next-themes";import"sonner";import"@radix-ui/react-label";import"class-variance-authority";import"@radix-ui/react-checkbox";import"@radix-ui/react-avatar";import"@radix-ui/react-dropdown-menu";import"@radix-ui/react-scroll-area";import"@radix-ui/react-popover";import"@radix-ui/react-radio-group";import"@radix-ui/react-dialog";import"@radix-ui/react-slot";import"clsx";import"@radix-ui/react-separator";import"@radix-ui/react-tooltip";import"@radix-ui/react-tabs";import"@radix-ui/react-accordion";import"@radix-ui/react-progress";import"@radix-ui/react-select";import"cmdk";import"@radix-ui/react-switch";import"react-day-picker";import"@radix-ui/react-slider";import"embla-carousel-react";import"@radix-ui/react-toggle-group";import"vaul";import"tailwind-merge";import"./table-header-DXTJ1r7-.js";import"@tanstack/react-table";import"./blogs-table-columns-R2OpmtLM.js";import"@inertiajs/react";import"./categories-table-columns-CnxipLFz.js";import"./courses-table-columns-BQ4ep6nS.js";import"./instructors-table-columns-NXoZHDYh.js";import"./table-filter-h0ofTU44.js";import"./table-page-size-B94DPeOD.js";import"./route-D0xh7FtZ.js";import"./debounce-CWHP_ANh.js";import"./table-footer-D5myFeWO.js";const Ee=({data:l,removing:C,inserting:G,instructors:T,onRemove:v,onInsert:I})=>{var u;const[n,A]=k("best"),c=(r,N)=>{var b,f,g,w;return t(s,{children:[e(o,{children:e("img",{src:((b=r.user)==null?void 0:b.photo)||"/placeholder.jpg",alt:(f=r.user)==null?void 0:f.name,className:"h-12 w-12 rounded-full object-cover"})}),e(o,{className:"font-medium",children:((g=r.user)==null?void 0:g.name)||"N/A"}),e(o,{children:((w=r.user)==null?void 0:w.email)||"N/A"}),t(o,{children:[r.courses_count||0," courses"]}),e(o,{children:e(x,{variant:"ghost",size:"icon",onClick:()=>v("instructors",N,r.id),disabled:C===`instructors-${N}-${r.id}`,children:e($,{className:"text-destructive h-4 w-4"})})})]},r.id)};return t(S,{className:"relative",children:[t(j,{className:"flex flex-row flex-wrap items-center justify-between gap-3",children:[t("div",{children:[e(D,{className:"text-xl font-bold",children:"Instructors"}),e(F,{value:`api/collections/instructors/${n}`})]}),t(H,{children:[e(y,{children:t(x,{className:"capitalize",children:["Select ",n," Instructor"]})}),e(B,{className:"p-0",children:e(E,{className:"max-h-[90vh] p-2",children:e(R,{type:"instructors",title:"Instructors",data:T,selectedIds:n==="best"?[(u=l.best)==null?void 0:u.id]:n==="top"?l.top.map(r=>r.id):l.new.map(r=>r.id),onCourseSelect:r=>I("instructors",n,r)})})})]})]}),e(z,{children:t(P,{defaultValue:"best",className:"w-full",value:n,onValueChange:A,children:[t(V,{className:"grid w-full grid-cols-3",children:[e(a,{value:"best",className:"cursor-pointer",children:"Best Instructor"}),e(a,{value:"top",className:"cursor-pointer",children:"Top Instructors"}),e(a,{value:"new",className:"cursor-pointer",children:"New Instructors"})]}),e(m,{value:"best",children:t(d,{children:[e(p,{children:t(s,{children:[e(i,{children:"Photo"}),e(i,{children:"Name"}),e(i,{children:"Email"}),e(i,{children:"Courses"}),e(i,{children:"Action"})]})}),e(h,{children:l.best?c(l.best,"best"):e(s,{children:e(o,{colSpan:5,className:"text-muted-foreground text-center",children:"No best instructor selected"})})})]})}),e(m,{value:"top",children:t(d,{children:[e(p,{children:t(s,{children:[e(i,{children:"Photo"}),e(i,{children:"Name"}),e(i,{children:"Email"}),e(i,{children:"Courses"}),e(i,{children:"Action"})]})}),e(h,{children:l.top&&l.top.length>0?l.top.map(r=>c(r,"top")):e(s,{children:e(o,{colSpan:5,className:"text-muted-foreground text-center",children:"No top instructors selected"})})})]})}),e(m,{value:"new",children:t(d,{children:[e(p,{children:t(s,{children:[e(i,{children:"Photo"}),e(i,{children:"Name"}),e(i,{children:"Email"}),e(i,{children:"Courses"}),e(i,{children:"Action"})]})}),e(h,{children:l.new&&l.new.length>0?l.new.map(r=>c(r,"new")):e(s,{children:e(o,{colSpan:5,className:"text-muted-foreground text-center",children:"No new instructors selected"})})})]})})]})})]})};export{Ee as default};
