import{d as C,o as a,a as d,b as o,e,h as k,w as l,f as t,l as p,i as x,F as h,n as $,E as b,s as f,D as m,p as j,t as u,q as A,j as N}from"./app-D9-EssCM.js";import{_}from"./ListTableActionLabel.vue_vue_type_script_setup_true_lang-DE9qVKFa.js";import{a as i,_ as S}from"./AppLayout.vue_vue_type_script_setup_true_lang-C-UlPCqH.js";import{P as v}from"./plus-DvsdL45k.js";import{T}from"./tag-CRVXG2f8.js";import{S as M}from"./square-pen-CvugRQ9Y.js";import{T as P}from"./trash-2-Dis-KatR.js";import"./index-CcjNLu6f.js";import"./index-CMWG4mbA.js";import"./useForwardExpose-MNmriUeS.js";import"./VisuallyHidden-DG35s1YI.js";import"./RovingFocusGroup-Diffidi3.js";import"./useArrowNavigation-C6Y-ieo6.js";import"./x-DwmBYYXD.js";import"./_plugin-vue_export-helper-DmjF0He4.js";const V={class:"p-4"},B={class:"mb-6 flex items-center justify-between"},D={key:0,class:"rounded-lg border bg-white p-8 text-center"},E={class:"mt-6"},K={key:1,class:"grid gap-6 md:grid-cols-2 lg:grid-cols-3"},q=["onClick","onKeydown"],z={class:"mb-4 flex items-start justify-between"},F={class:"flex items-center gap-3"},I={class:"font-semibold text-gray-900"},G={class:"text-sm text-gray-500"},L={key:0,class:"mb-4 text-sm text-gray-600 line-clamp-2"},O={class:"mb-4 text-sm text-gray-500"},H=["onClick"],ae=C({__name:"Index",props:{categories:{}},setup(y){const g=y;function w(n){if(n.products_count>0){alert(`Cannot delete "${n.name}" because it has ${n.products_count} products. Please move or delete the products first.`);return}confirm(`Are you sure you want to delete "${n.name}"?`)&&m.delete(i.categories.destroy(n.id).url)}return(n,r)=>(a(),d(h,null,[o(e(k),{title:"Category Management"}),o(S,{breadcrumbs:[{title:"Administration",href:e(i).index().url},{title:"Categories",href:"#"}]},{default:l(()=>[t("div",V,[t("div",B,[r[2]||(r[2]=t("div",null,[t("h1",{class:"text-2xl font-bold text-gray-900"},"Category Management"),t("p",{class:"text-gray-600"},"Manage product and service categories")],-1)),o(e(p),{href:e(i).categories.create().url,class:"flex items-center gap-2 rounded-md bg-blue-600 px-4 py-2 text-white hover:bg-blue-700"},{default:l(()=>[o(e(v),{class:"h-4 w-4"}),r[1]||(r[1]=x(" Add Category ",-1))]),_:1},8,["href"])]),g.categories.length===0?(a(),d("div",D,[o(e(T),{class:"mx-auto h-12 w-12 text-gray-400"}),r[4]||(r[4]=t("h3",{class:"mt-2 text-lg font-medium text-gray-900"},"No categories found",-1)),r[5]||(r[5]=t("p",{class:"mt-1 text-gray-500"},"Get started by creating your first category.",-1)),t("div",E,[o(e(p),{href:e(i).categories.create().url,class:"inline-flex items-center gap-2 rounded-md bg-blue-600 px-4 py-2 text-white hover:bg-blue-700"},{default:l(()=>[o(e(v),{class:"h-4 w-4"}),r[3]||(r[3]=x(" Add Category ",-1))]),_:1},8,["href"])])])):(a(),d("div",K,[(a(!0),d(h,null,$(g.categories,s=>(a(),d("div",{key:s.id,class:"cursor-pointer rounded-lg border bg-white p-6 shadow-sm transition-shadow hover:shadow-md focus:outline-none focus:ring-2 focus:ring-inset focus:ring-blue-500",tabindex:"0",role:"link",onClick:c=>e(m).visit(e(i).categories.show(s.id).url),onKeydown:[b(f(c=>e(m).visit(e(i).categories.show(s.id).url),["prevent"]),["enter"]),b(f(c=>e(m).visit(e(i).categories.show(s.id).url),["prevent"]),["space"])]},[t("div",z,[t("div",F,[t("div",{class:"h-4 w-4 rounded-full",style:j({backgroundColor:s.color})},null,4),t("div",null,[t("h3",I,u(s.name),1),t("p",G,u(s.products_count)+" products",1)])]),t("span",{class:A(["rounded-full px-2 py-1 text-xs font-medium",s.is_active?"bg-green-100 text-green-800":"bg-red-100 text-red-800"])},u(s.is_active?"Active":"Inactive"),3)]),s.description?(a(),d("p",L,u(s.description),1)):N("",!0),t("div",O," Sort Order: "+u(s.sort_order),1),t("div",{class:"flex items-center gap-2",onClick:r[0]||(r[0]=f(()=>{},["stop"]))},[o(e(p),{href:e(i).categories.edit(s.id).url,class:"inline-flex items-center justify-center rounded border px-2 py-1.5 text-sm text-gray-700 hover:bg-gray-50 md:px-3 md:py-1"},{default:l(()=>[o(_,{label:"Edit"},{default:l(()=>[o(e(M),{class:"h-4 w-4"})]),_:1})]),_:1},8,["href"]),t("button",{type:"button",onClick:c=>w(s),class:"inline-flex items-center justify-center rounded border border-red-300 px-2 py-1.5 text-sm text-red-700 hover:bg-red-50 md:px-3 md:py-1"},[o(_,{label:"Delete"},{default:l(()=>[o(e(P),{class:"h-4 w-4"})]),_:1})],8,H)])],40,q))),128))]))])]),_:1},8,["breadcrumbs"])],64))}});export{ae as default};
