1import{q as j,r as c,j as t}from"./app-belrbPXN.js";import{Paginated as g}from"./Paginated-jeXNJLzx.js";import{_ as w}from"./Lang-BxT6IC8I.js";import{HeadTable as N}from"./HeadTable-CW-UPSGa.js";import{VerticalDotsIcon as k}from"./VerticalDotsIcon-yy0sx5Wc.js";import{d as v,a as C,b as E,m as S}from"./chunk-L6QJ42W6-W9sOl383.js";import{c as y}from"./chunk-OFH6WYRQ-3bGIEbWe.js";import{t as A,a as F,b as O,c as z,d as P,e as R}from"./chunk-YRZGWF2W-PNkKtaL1.js";import{b as T}from"./chunk-NXTXE2B3-LSC6jqGg.js";import"./ChevronIcon-2kwZXCOy.js";import"./chunk-TNTFQBEK-SFGRqfrY.js";import"./index-taukuCH3.js";import"./chunk-2PIR7DFM-PKNoTa34.js";import"./chunk-3TAVD5Y3-JLEfvKNw.js";import"./chunk-XHQUSKIE-9yTKuk0T.js";import"./chunk-6BQDBGF4-B566eCa_.js";import"./chunk-MCFSCOSB--WO4Tv9A.js";import"./PlusIcon-YI9O2wg5.js";import"./SearchIcon-IcEPHXgu.js";import"./chunk-TC4QW7OA-U26paOyA.js";import"./import-0kiaZdOS.js";import"./import-p5sRK1qG.js";import"./import-_-a0l05m.js";import"./import-1bjV9P8v.js";import"./chunk-BSXPKUBX-mpJVaeDf.js";import"./chunk-M3MASYO7-ql8iGmnH.js";import"./chunk-AMSULWPV-n_7pBk8y.js";import"./chunk-3XT5V4LF-zg9JoeIL.js";import"./import-FK7Wx42j.js";import"./index-2kllFQyz.js";import"./chunk-RFUEKIFS-kjMkjToG.js";import"./import-QsBJSc9f.js";import"./chunk-ZFWMN6TD-fFfH3jAH.js";import"./import-Ho6b8CK9.js";import"./real-module-p6qORkc6.js";import"./index-Cg9dHLmZ.js";import"./use-force-update-VB-OXXUy.js";import"./import-Q-bWrGRz.js";import"./import-FZEXr2Df.js";import"./import-CF4r66r5.js";import"./chunk-3YBC73XM-2g_LxT9c.js";import"./chunk-EB2I5ZVA-WHwNbYK3.js";import"./chunk-44JHHBS2-Enupn3hy.js";import"./chunk-WUWNKKWR-zu7Kmz1i.js";import"./chunk-7F3ZLNJ6-m2dcUC9z.js";import"./chunk-YOBXD5IP-I7dSNQUW.js";import"./chunk-LSZJW3GU-QPv3TR7N.js";import"./Combination-asPpbgkX.js";import"./tslib.es6-gPgTONGq.js";import"./chunk-VMAPMSPF-sN-l8vC5.js";import"./chunk-MCG5YV3A-mwckgY4f.js";const V=async n=>{try{const o=await fetch(route("backoffice.noticia.search",{filters:{...n}}));if(!o.ok)throw new Error("Network response was not ok");return await o.json()}catch(o){return console.error("Error:",o),[]}},Rt=()=>{const{noticias:n,status:o}=j().props,[i,u]=c.useState({name:"",deleted:!1,status:"publicado"}),[e,m]=c.useState([]);c.useEffect(()=>{(async()=>{if(Object.values(i).some(r=>r!==""&&r!==!1)){const r=await V(i);m(r)}else m(n)})()},[n,i]);const f=c.useCallback(a=>{Object.entries(a).forEach(([s,r])=>{u(l=>({...l,[s]:r}))})},[]),h=c.useCallback((a,s)=>{const{name:r,status:l,id:p,updated_at:x,deleted_at:_}=a;switch(s){case"name":return r;case"status":return t.jsxs("div",{className:"flex flex-col",children:[t.jsx(y,{className:"capitalize border-none gap-1 text-default-600",color:_?d.deleted:d[l],size:"sm",variant:"dot",children:l}),l==="publicado"&&t.jsx("small",{className:"text-[10px]",children:x})]});case"actions":return t.jsx("div",{className:"relative flex justify-start items-center gap-2",children:t.jsxs(v,{className:"bg-background border-1 border-default-200",children:[t.jsx(C,{children:t.jsx(T,{isIconOnly:!0,radius:"full",size:"sm",variant:"light",children:t.jsx(k,{className:"text-default-400"})})}),t.jsx(E,{children:t.jsx(S,{href:route("backoffice.noticia.edit",p),children:"Edit"})})]})});default:return p}},[]),b=[{name:"News",uid:"name"},{name:"Status",uid:"status"},{name:"Actions",uid:"actions"}],d={publicado:"success",manuscrito:"default",deleted:"danger"};return t.jsx("div",{children:t.jsxs(A,{"aria-label":"NoticiaTable",bottomContent:e!=null&&e.data?t.jsx(g,{total:e.total||0,from:e.from||0,currentPage:e.current_page||1,lastPage:e.last_page||1}):null,topContent:t.jsx(N,{total:e==null?void 0:e.total,filterValue:i,onSearchChange:f,statusOptions:o}),children:[t.jsx(F,{children:b.map(a=>t.jsx(O,{children:w(a.name)},a.uid))}),t.jsx(z,{items:(e==null?void 0:e.data)??[],children:a=>t.jsx(P,{children:s=>t.jsx(R,{children:h(a,s)})},a.id)})]})})};export{Rt as NoticiaTable};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.