PageSourceSearch

https://ncsirt.gov.mn/_nuxt/BxCGWZB3.js

js ncsirt.gov.mn collected 2026-10-06 07:57:29 UTC 8,142 bytes, 1 lines download raw bytes

1import{d as z,E as S,y as U,w as x,p as _,o as n,e,f as m,_ as F,g as u,h as l,c as a,F as k,r as C,t as i,s as A,q as b,T as P,H as q}from"./CT_lRQyQ.js";import{_ as I}from"./KXeDuh-9.js";import{u as O}from"./CAK3otU-.js";import{u as R}from"./sMV4I-Dd.js";import{u as G}from"./B88HYWkc.js";import{u as J}from"./o98uOtdx.js";import"./YrMtblyk.js";const K={class:"flex items-center justify-between mb-6"},Q={class:"bg-white rounded-xl border border-slate-200 shadow-sm overflow-hidden"},W={key:0,class:"p-6 space-y-4"},X={key:1,class:"overflow-x-auto"},Y={class:"w-full text-sm"},Z={class:"divide-y divide-slate-100"},ee={class:"px-4 py-3"},te={class:"flex items-center gap-3"},se={class:"w-10 h-10 rounded-lg overflow-hidden bg-slate-100 flex-shrink-0"},le=["src","alt"],oe={key:1,class:"w-full h-full flex items-center justify-center bg-navy-100"},ne={class:"min-w-0"},ae={class:"font-medium text-slate-800 truncate max-w-xs"},ie={class:"text-slate-400 text-xs truncate max-w-xs"},re={class:"px-4 py-3 text-slate-500 hidden md:table-cell whitespace-nowrap"},de={class:"px-4 py-3 hidden xl:table-cell"},ce={class:"text-slate-700 text-xs"},ue={class:"text-slate-400"},pe={class:"px-4 py-3"},xe={class:"px-4 py-3"},fe={class:"flex items-center justify-end gap-1"},me=["onClick"],he={key:0,class:"px-4 py-3 border-t border-slate-100 flex items-center justify-between"},ve={class:"text-xs text-slate-500"},_e={class:"flex gap-1"},be=["disabled"],ye={class:"px-3 py-1.5 text-xs text-slate-600"},ge=["disabled"],we={key:2,class:"p-12 text-center text-slate-400"},ke={key:0,class:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 px-4"},Ce={class:"bg-white rounded-2xl shadow-xl p-6 max-w-sm w-full"},Ae={class:"text-slate-500 text-sm mb-5"},Be={class:"flex gap-3"},De=["disabled"],Me={key:0,class:"w-3.5 h-3.5 animate-spin",fill:"none",viewBox:"0 0 24 24"},je=z({__name:"index",async setup(Ve){let f,y;const g=O(),{adminRequestOptions:w}=R(),B=G(),r=_(1),c=_(null),p=_(!1),{data:d,pending:D,refresh:M}=([f,y]=S(()=>J(()=>`${g}/news/all?page=${r.value}&limit=${r.value,15}`,w.value,"$hwINVeLD-2")),f=await f,y(),f);function j(){r.value>1&&r.value--}function V(){d.value&&r.value<d.value.pages&&r.value++}function N(o){c.value=o}async function $(){if(c.value){p.value=!0;try{await $fetch(`${g}/news/${c.value._id}`,{...w.value,method:"DELETE"}),c.value=null,M()}finally{p.value=!1}}}function H(o){return o.replace(/<[^>]*>/g,"")}function L(o){return new Date(o).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"})}function h(o){return o?.titleMn||o?.title||o?.titleEn||""}function E(o){return o?.bodyMn||o?.body||o?.bodyEn||""}return(o,t)=>{const v=F,T=I;return n(),U(T,null,{default:x(()=>[e("div",null,[e("div",K,[t[2]||(t[2]=e("div",null,[e("h2",{class:"text-2xl font-bold text-slate-800"},"News Management"),e("p",{class:"text-slate-500 text-sm mt-1"},"Create, edit, and manage news articles")],-1)),m(v,{to:"/admin/news/create",class:"btn-primary text-sm py-2"},{default:x(()=>[...t[1]||(t[1]=[e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 4v16m8-8H4"})],-1),u(" New Article ",-1)])]),_:1})]),e("div",Q,[l(D)?(n(),a("div",W,[(n(),a(k,null,C(5,s=>e("div",{key:s,class:"h-16 bg-slate-100 rounded-lg animate-pulse"})),64))])):l(d)?.items?.length?(n(),a("div",X,[e("table",Y,[t[6]||(t[6]=e("thead",{class:"bg-slate-50 border-b border-slate-200"},[e("tr",null,[e("th",{class:"text-left px-4 py-3 font-semibold text-slate-600"},"Article"),e("th",{class:"text-left px-4 py-3 font-semibold text-slate-600 hidden md:table-cell"},"Date"),e("th",{class:"text-left px-4 py-3 font-semibold text-slate-600 hidden xl:table-cell"},"Author"),e("th",{class:"text-left px-4 py-3 font-semibold text-slate-600"},"Status"),e("th",{class:"text-right px-4 py-3 font-semibold text-slate-600"},"Actions")])],-1)),e("tbody",Z,[(n(!0),a(k,null,C(l(d).items,s=>(n(),a("tr",{key:s._id,class:"hover:bg-slate-50 transition-colors"},[e("td",ee,[e("div",te,[e("div",se,[s.image?(n(),a("img",{key:0,src:l(B)(s.image),alt:h(s),class:"w-full h-full object-cover"},null,8,le)):(n(),a("div",oe,[...t[3]||(t[3]=[e("svg",{class:"w-4 h-4 text-navy-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"})],-1)])]))]),e("div",ne,[e("p",ae,i(h(s)),1),e("p",ie,i(H(E(s)).slice(0,80)),1)])])]),e("td",re,i(L(s.createdAt)),1),e("td",de,[e
1("div",ce,[e("div",null,i(s.createdBy?.displayName||"Unknown"),1),e("div",ue,"@"+i(s.createdBy?.username||"system"),1)])]),e("td",pe,[e("span",{class:A(["inline-flex items-center gap-1 text-xs font-medium px-2 py-1 rounded-full",s.published?"bg-green-100 text-green-700":"bg-slate-100 text-slate-600"])},[e("span",{class:A(["w-1.5 h-1.5 rounded-full",s.published?"bg-green-500":"bg-slate-400"])},null,2),u(" "+i(s.published?"Published":"Draft"),1)],2)]),e("td",xe,[e("div",fe,[m(v,{to:`/admin/news/${s._id}`,class:"p-1.5 rounded-lg text-slate-500 hover:text-navy-700 hover:bg-navy-50 transition-colors",title:"Edit"},{default:x(()=>[...t[4]||(t[4]=[e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"})],-1)])]),_:1},8,["to"]),e("button",{onClick:Ne=>N(s),class:"p-1.5 rounded-lg text-slate-500 hover:text-red-600 hover:bg-red-50 transition-colors",title:"Delete"},[...t[5]||(t[5]=[e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})],-1)])],8,me)])])]))),128))])]),l(d).pages>1?(n(),a("div",he,[e("span",ve,i(l(d).total)+" articles total",1),e("div",_e,[e("button",{onClick:j,disabled:l(r)===1,class:"px-3 py-1.5 text-xs rounded border border-slate-200 disabled:opacity-40"},"Prev",8,be),e("span",ye,i(l(r))+" / "+i(l(d).pages),1),e("button",{onClick:V,disabled:l(r)===l(d).pages,class:"px-3 py-1.5 text-xs rounded border border-slate-200 disabled:opacity-40"},"Next",8,ge)])])):b("",!0)])):(n(),a("div",we,[t[8]||(t[8]=e("svg",{class:"w-12 h-12 mx-auto mb-3 opacity-40",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.5",d:"M19 20H5a2 2 0 01-2-2V6a2 2 0 012-2h10a2 2 0 012 2v1m2 13a2 2 0 01-2-2V7m2 13a2 2 0 002-2V9a2 2 0 00-2-2h-2m-4-3H9M7 16h6M7 8h6v4H7V8z"})],-1)),t[9]||(t[9]=e("p",{class:"font-medium mb-3"}
1,"No articles yet",-1)),m(v,{to:"/admin/news/create",class:"btn-primary text-sm py-2 inline-flex"},{default:x(()=>[...t[7]||(t[7]=[u("Create First Article",-1)])]),_:1})]))]),m(P,{name:"fade"},{default:x(()=>[l(c)?(n(),a("div",ke,[e("div",Ce,[t[13]||(t[13]=e("h3",{class:"font-bold text-slate-800 text-lg mb-2"},"Delete Article?",-1)),e("p",Ae,[t[10]||(t[10]=u(' Are you sure you want to delete "',-1)),e("strong",null,i(h(l(c))),1),t[11]||(t[11]=u('"? This cannot be undone. ',-1))]),e("div",Be,[e("button",{onClick:t[0]||(t[0]=s=>c.value=null),class:"flex-1 px-4 py-2 border border-slate-200 rounded-lg text-slate-600 hover:bg-slate-50 text-sm font-medium"},"Cancel"),e("button",{onClick:$,disabled:l(p),class:"flex-1 btn-danger text-sm py-2 justify-center"},[l(p)?(n(),a("svg",Me,[...t[12]||(t[12]=[e("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"},null,-1),e("path",{class:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"},null,-1)])])):b("",!0),u(" "+i(l(p)?"Deleting...":"Delete"),1)],8,De)])])])):b("",!0)]),_:1})])]),_:1})}}}),Ue=q(je,[["__scopeId","data-v-f33ef0e6"]]);export{Ue 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.