1import{d as E,u as I,a as N,e as F,x as M,s as $,o as s,f as o,g as e,t as i,i as r,h as y,w as h,j as _,F as w,k as A,A as L,n as d,m as T,l as k,v as c,p as z,y as j}from"./index-ZjbXsIqu.js";const O={class:"min-h-[calc(100vh-4rem)] flex flex-col bg-gray-50"},q={class:"bg-gradient-to-r from-green-700 to-green-900 text-white px-6 py-5"},G={class:"flex items-center justify-between"},H={class:"text-xl font-bold"},J={class:"text-green-200 text-sm"},K={class:"flex-1 p-6"},Q={key:0,class:"flex justify-center py-16"},R={key:1,class:"text-center py-20"},U={class:"text-gray-500 text-lg"},W={key:2,class:"space-y-3"},X=["src"],Y={key:1,class:"bi bi-journal-text text-green-300 text-xl"},Z={class:"flex-1 min-w-0"},ee={class:"font-semibold text-gray-800 truncate group-hover:text-green-700 transition-colors"},te={class:"flex items-center gap-2 mt-1.5"},se={class:"text-xs text-gray-400"},ne={class:"flex items-center gap-2 flex-shrink-0"},oe=["onClick"],le={key:0,class:"flex justify-center mt-6 gap-1"},ae=["onClick"],C=20,de=E({__name:"BlogAdminView",setup(ie){const{t:l}=I(),D=N(),p=F(),g=c([]),u=c(0),m=c(1),x=c(!0),v=z(()=>Math.ceil(u.value/C)),P=n=>n?new Date(n).toLocaleDateString("es-CO",{day:"numeric",month:"short",year:"numeric"}):"â",B=n=>({institucional:"bg-emerald-50 text-emerald-700",noticias:"bg-green-50 text-green-700",cultura:"bg-amber-50 text-amber-700",pernetflikso:"bg-red-50 text-red-700",eventos:"bg-blue-50 text-blue-700"})[n]||"bg-gray-50 text-gray-600";async function b(){x.value=!0;try{const{data:n}=await j.get("/blogo/artikoloj",{params:{page:m.value,limit:C}});g.value=n.items,u.value=n.total}finally{x.value=!1}}async function S(n){if(confirm(l("panelAdmin.blogAdmin.confirmDelete",{title:n.titleEs})))try{await j.delete(`/blogo/artikoloj/${n.id}`),p.success(l("panelAdmin.blogAdmin.toastDeleted")),b()}catch{p.error(l("panelAdmin.blogAdmin.toastDeleteError"))}}return M(b),(n,a)=>{const f=$("router-link");return s(),o("div",O,[e("div",q,[e("div",G,[e("div",null,[e("h1",H,i(r(l)("panelAdmin.blogAdmin.title")),1),e("p",J,i(r(l)("panelAdmin.blogAdmin.totalPosts",{n:u.value})),1)]),y(f,{to:{name:"blog-editor-new"},class:"px-4 py-2 rounded-lg text-sm font-semibold bg-white text-green-800 hover:bg-green-50 transition-colors shadow-sm"},{default:h(()=>[a[0]||(a[0]=e("i",{class:"bi bi-plus-lg me-1"},null,-1)),_(" "+i(r(l)("panelAdmin.blogAdmin.newPost")),1)]),_:1})])]),e("div",K,[x.value?(s(),o("div",Q,[...a[1]||(a[1]=[e("span",{class:"loading loading-spinner loading-lg text-green-600"},null,-1)])])):g.value.length===0?(s(),o("div",R,[a[2]||(a[2]=e("div",{class:"w-20 h-20 rounded-full bg-green-100 flex items-center justify-center mx-auto mb-4"},[e("i",{class:"bi bi-journal-text text-3xl text-green-400"})],-1)),e("p",U,i(r(l)("panelAdmin.blogAdmin.noPosts")),1),y(f,{to:{name:"blog-editor-new"},class:"inline-block mt-4 px-5 py-2 rounded-lg text-sm font-semibold bg-green-600 text-white hover:bg-green-700 transition-colors"},{default:h(()=>[_(i(r(l)("panelAdmin.blogAdmin.createFirst")),1)]),_:1})])):(s(),o("div",W,[(s(!0),o(w,null,A(g.value,t=>(s(),L(f,{key:t.id,to:{name:"blog-editor-edit",params:{id:t.id}},class:"bg-white rounded-xl shadow-sm hover:shadow-md transition-all flex items-center gap-4 p-4 group"},{default:h(()=>[e("div",{class:d(["w-16 h-16 rounded-lg flex-shrink-0 overflow-hidden",t.featuredImage?"":"bg-green-50 flex items-center justify-center"])},[t.featuredImage?(s(),o("img",{key:0,src:t.featuredImage,class:"w-full h-full object-cover"},null,8,X)):(s(),o("i",Y))],2),e("div",Z,[e("h3",ee,i(t.titleEs),1),e("div",te,[e("span",{class:d(["text-xs font-medium px-2 py-0.5 rounded-full",B(t.category)])},i(t.category),3),e("span",{class:d(["text-xs font-medium px-2 py-0.5 rounded-full",t.status==="published"?"bg-green-50 text-green-700":"bg-amber-50 text-amber-700"])},i(t.status==="published"?r(l)("panelAdmin.blogAdmin.published"):r(l)("panelAdmin.blogAdmin.draft")),3),e("span",se,i(P(t.publishedAt||t.createdAt)),1)])]),e("div",ne,[r(D).isAdmin?(s(),o("button",{key:0,class:"w-8 h-8 rounded-full flex items-center justify-center text-gray-400 hover:text-red-500 hover:bg-red-50 transition-colors",onClick:T(V=>S(t),["prevent"])},[...a[3]||(a[3]=[e("i",{class:"bi bi-trash text-sm"},null,-1)])],8,oe)):k("",!0),a[4]||(a[4]=e("i",{class:"bi bi-chevron-right text-gray-300 group-hover:text-green-500 transition-colors"},null,-1))])]),_:2},1032,["to"]))),128)),v.value>1?(s(),o("div",le,[(s(!0),o(w,null,A(v.value,t=>(s(),o("button",{key:t,onClick:V=>{m.value=t,b()},class:d(["w-8 h-8 rounded-lg text-sm font-medium transition-colors",m.value===t?"bg-green-600 text-white":"bg-white text-gray-600 hover:bg-green-50"])},i(t),11,ae))),128))])):k("",!0)]))])])}}});
1export{de as default};
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.