import{r as T,j as e,a$ as w}from"./react-vendor-xYZnmIII.js";import{a as f,k as v,m as S,J as E,K as A,B as p,M as D,e as I,l as y,a5 as B,y as H,z as c,D as o,aE as d,aI as x,aG as t,aJ as l,aF as h,aH as i}from"./ui-components-CQM92IK3.js";import $ from"./index-BEDhrcKd.js";import z 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 Y=({data:r,removing:u,courses:b,onRemove:g,onInsert:C})=>{var j;const[n,N]=T.useState("best"),a=(s,m)=>e.jsxs(t,{children:[e.jsx(i,{children:e.jsx("img",{src:s.thumbnail||"/placeholder.jpg",alt:s.title,className:"h-12 w-20 rounded object-cover"})}),e.jsx(i,{className:"font-medium",children:s.title}),e.jsxs(i,{children:[s.enrollments_count||0," enrollments"]}),e.jsx(i,{children:e.jsx(p,{variant:"ghost",size:"icon",onClick:()=>g("courses",m,s.id),disabled:u===`courses-${m}-${s.id}`,children:e.jsx(w,{className:"text-destructive h-4 w-4"})})})]},s.id);return e.jsxs(f,{className:"relative",children:[e.jsxs(v,{className:"flex flex-row flex-wrap items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx(S,{className:"text-xl font-bold",children:"Courses"}),e.jsx(z,{value:`api/collections/courses/${n}`})]}),e.jsxs(E,{children:[e.jsx(A,{children:e.jsxs(p,{className:"capitalize",children:["Select ",n," Course"]})}),e.jsx(D,{className:"p-0",children:e.jsx(I,{className:"max-h-[90vh] p-2",children:e.jsx($,{type:"courses",title:"Courses",data:b,selectedIds:n==="best"?[(j=r.best)==null?void 0:j.id]:n==="top"?r.top.map(s=>s.id):r.new.map(s=>s.id),onCourseSelect:s=>C("courses",n,s)})})})]})]}),e.jsx(y,{children:e.jsxs(B,{defaultValue:"best",className:"w-full",value:n,onValueChange:N,children:[e.jsxs(H,{className:"grid w-full grid-cols-3",children:[e.jsx(c,{value:"best",className:"cursor-pointer",children:"Best Course"}),e.jsx(c,{value:"top",className:"cursor-pointer",children:"Top Courses"}),e.jsx(c,{value:"new",className:"cursor-pointer",children:"New Courses"})]}),e.jsx(o,{value:"best",children:e.jsxs(d,{children:[e.jsx(x,{children:e.jsxs(t,{children:[e.jsx(l,{children:"Image"}),e.jsx(l,{children:"Title"}),e.jsx(l,{children:"Enrollments"}),e.jsx(l,{children:"Action"})]})}),e.jsx(h,{children:r.best?a(r.best,"best"):e.jsx(t,{children:e.jsx(i,{colSpan:5,className:"text-muted-foreground text-center",children:"No best course selected"})})})]})}),e.jsx(o,{value:"top",children:e.jsxs(d,{children:[e.jsx(x,{children:e.jsxs(t,{children:[e.jsx(l,{children:"Image"}),e.jsx(l,{children:"Title"}),e.jsx(l,{children:"Enrollments"}),e.jsx(l,{children:"Action"})]})}),e.jsx(h,{children:r.top&&r.top.length>0?r.top.map(s=>a(s,"top")):e.jsx(t,{children:e.jsx(i,{colSpan:5,className:"text-muted-foreground text-center",children:"No top courses selected"})})})]})}),e.jsx(o,{value:"new",children:e.jsxs(d,{children:[e.jsx(x,{children:e.jsxs(t,{children:[e.jsx(l,{children:"Image"}),e.jsx(l,{children:"Title"}),e.jsx(l,{children:"Enrollments"}),e.jsx(l,{children:"Action"})]})}),e.jsx(h,{children:r.new&&r.new.length>0?r.new.map(s=>a(s,"new")):e.jsx(t,{children:e.jsx(i,{colSpan:5,className:"text-muted-foreground text-center",children:"No new courses selected"})})})]})})]})})]})};export{Y as default};
