import{j as e,aR as h,cO as o,b9 as d,d8 as j,a$ as p}from"./react-vendor-xYZnmIII.js";import{D as u}from"./delete-modal-h3jQBOO6.js";import{B as r,a as i,j as m,l as c,g}from"./ui-components-CQM92IK3.js";import{u as f}from"./use-auth-l-ShkEGs.js";import{D as N}from"./layout-DC6VQ8xV.js";import l from"./category-form-CHpDdP9r.js";import"./inertia-vendor-cBbDTmhJ.js";import"./ui-vendor-Ds9iwIxa.js";import"./interactive-vendor-B1OgcAgP.js";import"./main-CnGu8e_N.js";import"./theme-colors-CLpwvDr4.js";import"./appearance-5ivIjthu.js";import"./language-C7bQIqs2.js";import"./notification-C3MPMjX2.js";import"./app-logo-BQGZ7CFC.js";import"./route-D0xh7FtZ.js";import"./use-lang-Dg6I_Fym.js";import"./icon-picker-dialog-jzY0-ZNJ.js";import"./icon-picker-e9MMAA5U.js";import"./debounce-CWHP_ANh.js";import"./icon-picker-tooltip-CR2ZyXZ1.js";import"./input-error-_LAmvivg.js";import"./loading-button-D7aXR3K4.js";import"./inertia-FIn3q7f1.js";const y=({categories:t})=>{const{isAdmin:n}=f(),a=t.find(s=>s.slug==="default"),x=t.filter(s=>s.slug!=="default");return e.jsxs(e.Fragment,{children:[e.jsx(h,{title:"Exam Categories"}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold text-gray-900",children:"Exam Categories"}),e.jsx("p",{className:"mt-1 text-sm text-gray-600",children:"Manage exam categories and organize your exams"})]}),e.jsx(l,{title:"Create Category",handler:e.jsxs(r,{children:[e.jsx(o,{className:"mr-2 h-4 w-4"}),"Add Category"]})})]}),t.length>0?e.jsxs("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&&e.jsxs(i,{className:"p-6",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(d,{size:20,name:a.icon}),e.jsx("h2",{children:a.title})]}),e.jsx(m,{className:"my-4"}),e.jsx("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),x.map(s=>e.jsxs(i,{className:"p-6",children:[e.jsxs("div",{className:"relative text-center",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(d,{size:20,name:s.icon}),e.jsx("h2",{children:s.title})]}),e.jsxs("div",{className:"absolute -top-1 flex w-full items-center justify-end space-x-1",children:[e.jsx(l,{title:"Edit Category",category:s,handler:e.jsx(r,{size:"icon",variant:"ghost",className:"bg-muted hover:bg-muted-foreground/10 h-8 w-8 rounded-full p-0",children:e.jsx(j,{className:"text-sm"})})}),n&&e.jsx(u,{message:"Are you sure you want to delete this category?",routePath:route("exam-categories.destroy",s.id),actionComponent:e.jsx(r,{size:"icon",variant:"ghost",className:"bg-destructive/8 hover:bg-destructive/6 h-8 w-8 rounded-full p-0",children:e.jsx(p,{className:"text-destructive text-sm"})})})]})]}),e.jsx(m,{className:"my-4"}),e.jsxs(c,{className:"p-0",children:[e.jsx("p",{className:"mb-3 text-sm text-gray-600",children:s.description||"No description"}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(g,{variant:s.status?"default":"secondary",children:s.status?"Active":"Inactive"}),e.jsxs("span",{className:"text-sm text-gray-500",children:[s.exams_count||0," exams"]})]})]})]},s.id))]}):e.jsx("div",{className:"col-span-full",children:e.jsx(i,{children:e.jsxs(c,{className:"flex flex-col items-center justify-center py-12",children:[e.jsx("p",{className:"mb-4 text-gray-600",children:"No categories found. Create your first category!"}),e.jsx(l,{title:"Create Category",handler:e.jsxs(r,{children:[e.jsx(o,{className:"mr-2 h-4 w-4"}),"Add Category"]})})]})})})]})]})};y.layout=t=>e.jsx(N,{children:t});export{y as default};
