import{jsxs as t,Fragment as u,jsx as e}from"react/jsx-runtime";import{D as g}from"./delete-modal-DdJyKUdO.js";import{B as o,a as s,j as l,l as d,g as f}from"./ui-components-B24mpb8o.js";import{u as x}from"./use-auth-cj50aT3v.js";import{D as N}from"./layout-CZk01yM3.js";import{Head as y}from"@inertiajs/react";import{Plus as c,Pencil as v,Trash2 as C}from"lucide-react";import{DynamicIcon as n}from"lucide-react/dynamic";import m from"./category-form-5OdPXHKQ.js";import"react";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"./main-Cv60h411.js";import"./theme-colors-CLpwvDr4.js";import"./appearance-zLWEcDPI.js";import"./language-79bZLpyc.js";import"./notification-BBQVVMqD.js";import"date-fns";import"./app-logo-CAnM-q9p.js";import"./route-D0xh7FtZ.js";import"./use-lang-Cw_jKJYs.js";import"./icon-picker-dialog-C9VejAFv.js";import"./icon-picker-DlQKexqz.js";import"./debounce-CWHP_ANh.js";import"./icon-picker-tooltip-BfucLgKc.js";import"./input-error-BbsDx4-P.js";import"./loading-button-B_LaGOAp.js";import"./inertia-FIn3q7f1.js";const b=({categories:i})=>{const{isAdmin:p}=x(),a=i.find(r=>r.slug==="default"),h=i.filter(r=>r.slug!=="default");return t(u,{children:[e(y,{title:"Exam Categories"}),t("div",{className:"space-y-6",children:[t("div",{className:"flex items-center justify-between",children:[t("div",{children:[e("h1",{className:"text-3xl font-bold text-gray-900",children:"Exam Categories"}),e("p",{className:"mt-1 text-sm text-gray-600",children:"Manage exam categories and organize your exams"})]}),e(m,{title:"Create Category",handler:t(o,{children:[e(c,{className:"mr-2 h-4 w-4"}),"Add Category"]})})]}),i.length>0?t("div",{className:"mt-6 grid grid-cols-1 gap-6 border-t border-gray-300 py-6 md:grid-cols-2 lg:grid-cols-3",children:[a&&t(s,{className:"p-6",children:[t("div",{className:"flex items-center gap-2",children:[e(n,{size:20,name:a.icon}),e("h2",{children:a.title})]}),e(l,{className:"my-4"}),e("p",{className:"text-muted-foreground text-sm",children:"When a category is deleted, its exams are moved to the default category. The default category cannot be edited or removed."})]},a.id),h.map(r=>t(s,{className:"p-6",children:[t("div",{className:"relative text-center",children:[t("div",{className:"flex items-center gap-2",children:[e(n,{size:20,name:r.icon}),e("h2",{children:r.title})]}),t("div",{className:"absolute -top-1 flex w-full items-center justify-end space-x-1",children:[e(m,{title:"Edit Category",category:r,handler:e(o,{size:"icon",variant:"ghost",className:"bg-muted hover:bg-muted-foreground/10 h-8 w-8 rounded-full p-0",children:e(v,{className:"text-sm"})})}),p&&e(g,{message:"Are you sure you want to delete this category?",routePath:route("exam-categories.destroy",r.id),actionComponent:e(o,{size:"icon",variant:"ghost",className:"bg-destructive/8 hover:bg-destructive/6 h-8 w-8 rounded-full p-0",children:e(C,{className:"text-destructive text-sm"})})})]})]}),e(l,{className:"my-4"}),t(d,{className:"p-0",children:[e("p",{className:"mb-3 text-sm text-gray-600",children:r.description||"No description"}),t("div",{className:"flex items-center justify-between",children:[e(f,{variant:r.status?"default":"secondary",children:r.status?"Active":"Inactive"}),t("span",{className:"text-sm text-gray-500",children:[r.exams_count||0," exams"]})]})]})]},r.id))]}):e("div",{className:"col-span-full",children:e(s,{children:t(d,{className:"flex flex-col items-center justify-center py-12",children:[e("p",{className:"mb-4 text-gray-600",children:"No categories found. Create your first category!"}),e(m,{title:"Create Category",handler:t(o,{children:[e(c,{className:"mr-2 h-4 w-4"}),"Add Category"]})})]})})})]})]})};b.layout=i=>e(N,{children:i});export{b as default};
