import{jsx as e,jsxs as l}from"react/jsx-runtime";import{T as d,a as m,b as o,c as i,d as h,e as t}from"./table-BrXe3s2z.js";import{B as s}from"./button-BvFBRYHq.js";import{EyeOff as g,Eye as p,Edit as f,Trash2 as u}from"lucide-react";import{Link as v}from"@inertiajs/react";import"react";import"./alert-dialog-xorwy8s8.js";import{B as N}from"./badge-CFi7bqqA.js";import{NewsCategoryBadge as b}from"./NewsCategoryBadge-FrPLlbl8.js";import"./utils-CMbmcP35.js";import"clsx";import"tailwind-merge";import"@radix-ui/react-slot";import"class-variance-authority";import"@radix-ui/react-alert-dialog";import"./constants-B4vUcFwO.js";function w({active:r,activeLabel:c="Active",inactiveLabel:n="Inactive"}){return e(N,{className:r?"bg-green-500":"bg-gray-500",children:r?c:n})}const y=r=>new Date(r).toLocaleDateString();function R({news:r,onToggle:c,onDelete:n}){return r.length===0?e("div",{className:"text-center text-gray-400 py-8",children:'No news available. Click "Add News" to create one.'}):l(d,{children:[e(m,{children:l(o,{children:[e(i,{children:"Title"}),e(i,{children:"Category"}),e(i,{children:"Image"}),e(i,{children:"Status"}),e(i,{children:"Created At"}),e(i,{children:"Actions"})]})}),e(h,{children:r.map(a=>l(o,{children:[e(t,{className:"font-medium",children:a.title}),e(t,{children:e(b,{category:a.category})}),e(t,{children:a.image?e("img",{src:`/storage/${a.image}`,alt:a.title,className:"w-16 h-16 object-cover rounded"}):e("span",{className:"text-gray-400",children:"No image"})}),e(t,{children:e(w,{active:a.is_active})}),e(t,{children:y(a.created_at)}),e(t,{children:l("div",{className:"flex gap-2",children:[e(s,{size:"sm",variant:"outline",onClick:()=>c(a.id),title:a.is_active?"Deactivate":"Activate",children:a.is_active?e(g,{className:"h-4 w-4"}):e(p,{className:"h-4 w-4"})}),e(v,{href:route("admin.news.edit",a.id),children:e(s,{size:"sm",variant:"outline",title:"Edit",children:e(f,{className:"h-4 w-4"})})}),e(s,{size:"sm",variant:"destructive",onClick:()=>n(a.id),title:"Delete",children:e(u,{className:"h-4 w-4"})})]})})]},a.id))})]})}export{R as NewsTable};
