import{jsxs as l,jsx as e}from"react/jsx-runtime";import{a as T,k as v,m as S,H as A,J as I,B as C,K as D,e as H,l as B,a4 as j,x as y,y as a,z as d,aD as m,aH as h,aF as t,aI as i,aE as p,aG as c}from"./ui-components-B24mpb8o.js";import{Trash2 as z}from"lucide-react";import{DynamicIcon as V}from"lucide-react/dynamic";import{useState as $}from"react";import k 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 je=({data:o,removing:f,inserting:R,categories:N,onRemove:b,onInsert:w})=>{var u;const[s,x]=$("best"),n=(r,g)=>l(t,{children:[e(c,{children:r.icon?e(V,{name:r.icon,className:"text-primary h-8 w-8"}):e("div",{className:"bg-muted h-12 w-12 rounded"})}),e(c,{className:"font-medium",children:r.title}),e(c,{children:r.slug||"N/A"}),l(c,{children:[r.courses_count||0," courses"]}),e(c,{children:e(C,{variant:"ghost",size:"icon",onClick:()=>b("course_categories",g,r.id),disabled:f===`course_categories-${g}-${r.id}`,children:e(z,{className:"text-destructive h-4 w-4"})})})]},r.id);return l(T,{className:"relative",children:[l(v,{className:"flex flex-row flex-wrap items-center justify-between gap-3",children:[l("div",{children:[e(S,{className:"text-xl font-bold",children:"Course Categories"}),e(F,{value:`api/collections/course_categories/${s}`})]}),l(A,{children:[e(I,{children:l(C,{className:"capitalize",children:["Select ",s," Category"]})}),e(D,{className:"p-0",children:e(H,{className:"max-h-[90vh] p-2",children:e(k,{type:"course_categories",title:"Course Categories",data:N,selectedIds:s==="best"?[(u=o.best)==null?void 0:u.id]:s==="top"?o.top.map(r=>r.id):s==="new"?o.new.map(r=>r.id):o.featured.map(r=>r.id),onCourseSelect:r=>w("course_categories",s,r)})})})]})]}),e(B,{children:l(j,{defaultValue:"best",className:"w-full",value:s,onValueChange:x,children:[l(y,{className:"grid w-full grid-cols-4",children:[e(a,{value:"best",className:"cursor-pointer",children:"Best Course Category"}),e(a,{value:"top",className:"cursor-pointer",children:"Top Course Categories"}),e(a,{value:"new",className:"cursor-pointer",children:"New Course Categories"}),e(a,{value:"featured",className:"cursor-pointer",children:"Featured Course Categories"})]}),e(d,{value:"best",children:l(m,{children:[e(h,{children:l(t,{children:[e(i,{children:"Icon"}),e(i,{children:"Title"}),e(i,{children:"Slug"}),e(i,{children:"Courses"}),e(i,{children:"Action"})]})}),e(p,{children:o.best?n(o.best,"best"):e(t,{children:e(c,{colSpan:5,className:"text-muted-foreground text-center",children:"No best course category selected"})})})]})}),e(d,{value:"top",children:l(m,{children:[e(h,{children:l(t,{children:[e(i,{children:"Icon"}),e(i,{children:"Title"}),e(i,{children:"Slug"}),e(i,{children:"Courses"}),e(i,{children:"Action"})]})}),e(p,{children:o.top&&o.top.length>0?o.top.map(r=>n(r,"top")):e(t,{children:e(c,{colSpan:5,className:"text-muted-foreground text-center",children:"No top course categories selected"})})})]})}),e(d,{value:"new",children:l(m,{children:[e(h,{children:l(t,{children:[e(i,{children:"Icon"}),e(i,{children:"Title"}),e(i,{children:"Slug"}),e(i,{children:"Courses"}),e(i,{children:"Action"})]})}),e(p,{children:o.new&&o.new.length>0?o.new.map(r=>n(r,"new")):e(t,{children:e(c,{colSpan:5,className:"text-muted-foreground text-center",children:"No new course categories selected"})})})]})}),e(d,{value:"featured",children:l(m,{children:[e(h,{children:l(t,{children:[e(i,{children:"Icon"}),e(i,{children:"Title"}),e(i,{children:"Slug"}),e(i,{children:"Courses"}),e(i,{children:"Action"})]})}),e(p,{children:o.featured&&o.featured.length>0?o.featured.map(r=>n(r,"featured")):e(t,{children:e(c,{colSpan:5,className:"text-muted-foreground text-center",children:"No featured course categories selected"})})})]})})]})})]})};export{je as default};
