PageSourceSearch

https://khanuul.mn/assets/AdminContent-BLvpsLO3.js

js khanuul.mn collected 2026-10-02 21:21:09 UTC 4,884 bytes, 6 lines download raw bytes

1import{c as g,h as w,r as i,t as d,j as e,i as b,a as c,g as t}from"./index-wYRL2VEK.js";import{g as v,d as C}from"./content-Dqk1r3hp.js";import{C as x,d as h,a as _,b as I}from"./card-zTPp62oJ.js";import{P as L}from"./plus-BO83R4gm.js";import{S as T}from"./square-pen-BFsibcJV.js";import{T as k}from"./trash-2-DXiOPiT1.js";import{F as j}from"./file-text-BvLicUiN.js";import{I as A}from"./image-C08HKcfq.js";/**
2 * @license lucide-react v0.553.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const P=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}]],z=g("file",P);function q(){const{menuId:r}=w(),[n,m]=i.useState([]),[p,o]=i.useState(!0);i.useEffect(()=>{r&&u()},[r]);const u=async()=>{o(!0);try{const s=await v(r),a=s.data?.data||s.data||s,l=Array.isArray(a)?a:[];m(l)}catch(s){console.error("Контент авахад алдаа:",s),d.error("Контент авахад алдаа гарлаа")}o(!1)},f=async s=>{if(window.confirm("Та энэ контентийг устгахдаа итгэлтэй байна уу?"))try{await C(s),m(a=>a.filter(l=>l.id!==s)),d.success("Контент амжилттай устгалаа")}catch(a){console.error("Контент устгахад алдаа:",a),d.error("Контент устгахад алдаа гарлаа")}},N=s=>{switch(s){case"news":return e.jsx(j,{className:"w-5 h-5 text-blue-600"});case"pdf":return e.jsx(z,{className:"w-5 h-5 text-red-600"});case"image":return e.jsx(A,{className:"w-5 h-5 text-green-600"});default:return e.jsx(j,{className:"w-5 h-5 text-gray-600"})}},y=s=>{switch(s){case"news":return"Мэдээ";case"pdf":return"PDF";case"image":return"Зураг";default:return"Текст"}};return p?e.jsx("div",{className:"flex items-center justify-center min-h-screen",children:e.jsxs("div",{className:"text-center",children:[e.jsx(b,{className:"h-8 w-8 animate-spin mx-auto mb-4 text-primary"}),e.jsx("p",{className:"text-muted-foreground",children:"Мэдээлэл ачааллаж байна..."})]})}):e.jsxs("div",{className:"p-6 max-w-6xl mx-auto",children:[e.jsxs("div",{className:"flex justify-between items-center mb-6",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold",children:"Контент удирдлага"}),e.jsxs("p",{className:"text-gray-600 mt-1",children:["Menu ID: ",r]})]}),e.jsx(c,{to:`/admin/content/add/${r}`,children:e.jsxs(t,{className:"bg-red-600 hover:bg-red-700",children:[e.jsx(L,{className:"mr-2 h-4 w-4"}),"Шинэ контент нэмэх"]})})]}),n.length===0?e.jsx(x,{children:e.jsxs(h,{className:"text-center py-12",children:[e.jsx("p",{className:"text-muted-foreground text-lg mb-4",children:"Контент олдсонгүй."}),e.jsx(c,{to:`/admin/content/add/${r}`,children:e.jsx(t,{className:"bg-red-600 hover:bg-red-700",children:"Эхний контент нэмэх"})})]})}):e.jsx("div",{className:"space-y-4",children:n.sort((s,a)=>(s.order_number||0)-(a.order_number||0)).map(s=>e.jsxs(x,{className:"hover:shadow-lg transition-shadow",children:[e.jsx(_,{children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex items-start gap-3 flex-1",children:[N(s.type),e.jsxs("div",{className:"flex-1",children:[e.jsx(I,{className:"line-clamp-2",children:s.title}),e.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[e.jsx("span",{className:"text-xs bg-gray-100 px-2 py-1 rounded",children:y(s.type)}),s.order_number!==void 0&&e.jsxs("span",{className:"text-xs text-gray-500",children:["Эрэмбэ: ",s.order_number]})]})]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(c,{to:`/admin/content/${s.id}`,children:e.jsxs(t,{variant:"outline",size:"sm",className:"bg-yellow-50 hover:bg-yellow-100 border-yellow-300",children:[e.jsx(T,{className:"mr-2 h-4 w-4"}),"Засах"]})}),e.jsxs(t,{variant:"destructive",size:"sm",onClick:()=>f(s.id),children:[e.jsx(k,{className:"mr-2 h-4 w-4"}),"Устгах"]})]})]})}),e.jsx(h,{children:e.jsxs("div",{className:"space-y-2 text-sm",children:[s.type==="news"&&s.news_id&&e.jsxs("div",{children:[e.jsx("span",{className:"text-gray-600 font-semibold",children:"Мэдээний ID:"}),e.jsx("p",{className:"mt-1",children:s.news_id})]}),(s.type==="pdf"||s.type==="image")&&s.file_url&&e.jsxs("div",{children:[e.jsx("span",{className:"text-gray-600 font-semibold",children:"Файлын URL:"}),e.jsx("p",{className:"mt-1 line-clamp-1 break-all",children:s.file_url})]}),s.body&&e.jsxs("div",{children:[e.jsx("span",{className:"text-gray-600 font-semibold",children:"Агуулга:"}),e.jsx("p",{className:"mt-1 line-clamp-3",children:s.body})]})]})})]},s.id))})]})}export{q 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.