import{jsxs as n,jsx as o}from"react/jsx-runtime";import{D as d}from"./delete-confirm-dialog-BurDnXvV.js";import{P as c}from"./pagination-CMRqHrdw.js";import"./badge-CFi7bqqA.js";import{A as g,a as h,b as u,c as f,d as D,e as w,f as C,g as T}from"./alert-dialog-xorwy8s8.js";import{B as A}from"./button-BvFBRYHq.js";import{C as N,b,c as P,a as v}from"./card-Zg0WOx-j.js";import{useState as p}from"react";import"./app-sidebar-header-BX2s-HO_.js";import{router as m,Head as x,Link as S}from"@inertiajs/react";import{A as O}from"./layout-CssQHtfO.js";import{Plus as y}from"lucide-react";import{NewsTable as I}from"./NewsTable-D7NG7wWK.js";import"clsx";import"./rich-text-editor-BK3mvong.js";import"@radix-ui/react-slot";import"class-variance-authority";import"./utils-CMbmcP35.js";import"tailwind-merge";import"@radix-ui/react-alert-dialog";import"@radix-ui/react-collapsible";import"./dropdown-menu-BP80qPHw.js";import"@radix-ui/react-dropdown-menu";import"./app-logo-icon-beRg1XGs.js";import"./fonts-CqawFh47.js";import"@radix-ui/react-dialog";import"@radix-ui/react-tooltip";import"@radix-ui/react-avatar";import"../app.js";/* empty css     */import"axios";import"sonner";import"react-dom/client";import"./toaster-DuLpwsc2.js";import"./table-BrXe3s2z.js";import"./NewsCategoryBadge-FrPLlbl8.js";import"./constants-B4vUcFwO.js";import"@tiptap/react";import"@tiptap/starter-kit";import"@tiptap/extension-text-align";import"@tiptap/extension-link";import"@tiptap/extension-color";import"@tiptap/extension-text-style";import"@tiptap/extension-highlight";import"@tiptap/extension-table";import"@tiptap/extension-table-row";import"@tiptap/extension-table-cell";import"@tiptap/extension-table-header";import"@tiptap/core";import"./separator-BDLxzoJ8.js";import"@radix-ui/react-separator";import"./popover-SprfKcRl.js";import"@radix-ui/react-popover";import"./input-qMvM9qch.js";import"./label-DMnntKPk.js";import"@radix-ui/react-label";import"./dialog-BfGkTFdF.js";function j(i){const[e,t]=p(null),a=s=>t(s),r=()=>t(null);return{deleteId:e,isOpen:e!==null,openDialog:a,closeDialog:r,handleDelete:()=>{e&&m.delete(i(e),{onSuccess:r})}}}function k(i){return{handlePageChange:t=>{m.get(route(i),{page:t},{preserveState:!0,preserveScroll:!0})}}}function H(i){const[e,t]=p(null),a=s=>t(s),r=()=>t(null);return{toggleId:e,isOpen:e!==null,openDialog:a,closeDialog:r,handleToggle:()=>{e&&m.post(i(e),{},{onSuccess:r})}}}const L=[{title:"Admin",href:"/admin"},{title:"News Management",href:"/admin/news"}];function _e({news:i}){const e=j(l=>route("admin.news.destroy",l)),t=H(l=>route("admin.news.toggle",l)),{handlePageChange:a}=k("admin.news.index"),r=()=>i.data.find(l=>l.id===t.toggleId);return n(O,{breadcrumbs:L,children:[o(x,{title:"News Management"}),n("div",{className:"space-y-6",children:[n(N,{children:[n(b,{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",children:[o(P,{children:"News Management"}),o(S,{href:route("admin.news.create"),children:n(A,{children:[o(y,{className:"h-4 w-4"}),o("span",{className:"ml-2 hidden md:inline",children:"Add News"})]})})]}),n(v,{children:[o(I,{news:i.data,onToggle:t.openDialog,onDelete:e.openDialog}),o(c,{data:i,onPageChange:a})]})]}),o(d,{open:e.isOpen,onOpenChange:e.closeDialog,onConfirm:e.handleDelete,description:"This action cannot be undone. This will permanently delete this news article."}),o(g,{open:t.isOpen,onOpenChange:t.closeDialog,children:n(h,{children:[n(u,{children:[o(f,{children:"Change News Status"}),o(D,{children:r()?.is_active?"This will deactivate the news article and hide it from public view.":"This will activate the news article and make it visible to public."})]}),n(w,{children:[o(C,{children:"Cancel"}),o(T,{onClick:t.handleToggle,children:"Confirm"})]})]})})]})]})}export{_e as default};
