PageSourceSearch

https://tudienav.com/_nuxt/GriaSGzu.js

js tudienav.com collected 2026-10-02 01:47:49 UTC 13,008 bytes, 1 lines download raw bytes

1import{f as E,g as w,o as n,c as r,j as y,a as e,k as d,F as u,r as x,n as m,t as o,C,d as T,q as _,p as N}from"./tzJnjie6.js";import{u as G}from"./Cwj1v93E.js";import{u as $}from"./Bl4xsHaL.js";const j={key:0,class:"mb-7"},P={key:1,class:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-5 gap-3 mb-8"},q={class:"text-[13px] font-semibold text-gray-500 mb-1.5 whitespace-nowrap truncate"},Q={key:2,class:"grid grid-cols-1 md:grid-cols-2 gap-6 mb-8"},R={key:0,class:"bg-white p-6 rounded-lg shadow"},K={class:"space-y-3"},F=["href"],X={class:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},Z=["d"],J={class:"truncate font-semibold text-gray-700 group-hover:text-gray-900"},Y={class:"flex flex-col shrink-0"},W=["disabled","onClick"],tt=["disabled","onClick"],et={key:1,class:"bg-white p-6 rounded-lg shadow"},at={class:"mb-5"},st={key:0,class:"text-xs text-gray-400 py-2"},nt={key:1,class:"text-xs text-gray-400 py-2 italic"},rt={key:2,class:"space-y-1.5 max-h-52 overflow-y-auto pr-1"},it={class:"shrink-0 text-gray-400 font-semibold tabular-nums text-right mt-px",style:{"min-width":"2.5rem"}},ot={class:"min-w-0 flex-1"},lt={class:"font-medium text-gray-800"},dt={key:0,class:"text-gray-400 font-normal"},ct={key:0,class:"text-gray-500"},ut={class:"inline-flex items-center rounded bg-orange-200 text-orange-800 font-medium px-1.5 py-0.5 mx-0.5"},mt={class:"inline-flex items-center rounded bg-yellow-200 text-yellow-800 font-medium px-1.5 py-0.5 mx-0.5"},pt={key:3,class:"font-medium text-gray-700"},ht={class:"shrink-0 text-gray-400 whitespace-nowrap"},gt={key:0,class:"text-xs text-gray-400 py-2"},yt={key:1,class:"text-xs text-gray-400 py-2 italic"},vt={key:2,class:"space-y-1.5 max-h-40 overflow-y-auto pr-1"},bt={class:"shrink-0 text-gray-400 font-semibold tabular-nums text-right mt-px",style:{"min-width":"2.5rem"}},xt={class:"min-w-0 flex-1"},_t={class:"font-medium text-gray-800"},ft={key:0,class:"text-gray-400 font-normal"},kt={class:"inline-flex items-center rounded bg-purple-200 text-purple-800 font-medium px-1.5 py-0.5 mx-0.5"},wt={key:1,class:"text-gray-500"},At={class:"font-medium text-gray-700"},Vt={class:"shrink-0 text-gray-400 whitespace-nowrap"},Mt={key:3,class:"bg-white rounded-xl border border-gray-200 shadow-sm p-8 sm:p-10 text-center"},z="admin_quick_actions_order",It={__name:"index",setup(Ct){E();const{get:A}=G(),{can:l,fetchPermissions:f}=$();w(f);const I=[{key:"manage_users",perm:"manage_users",href:"/admin/users",label:"Quản lý User",chip:"from-blue-500 to-indigo-600",icon:"M12 4.354a4 4 0 110 5.292M15 21H3v-1a6 6 0 0112 0v1zm0 0h6v-1a6 6 0 00-9-5.197m3 5.197H9m12 0a9 9 0 11-18 0 9 9 0 0118 0z"},{key:"create_document",perm:"create_document",href:"/admin/documents/create",label:"Tạo tài liệu mới",chip:"from-amber-500 to-orange-600",icon:"M9 13h6m-3-3v6m5 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"},{key:"create_article",perm:"create_article",href:"/admin/articles/create",label:"Tạo Bài viết Mới",chip:"from-emerald-500 to-green-600",icon:"M12 6v6m0 0v6m0-6h6m-6 0H6"},{key:"image_library",perm:"image_library",href:"/admin/images",label:"Thư viện hình",chip:"from-fuchsia-500 to-purple-600",icon:"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"},{key:"video",perm:"video",href:"/admin/videos",label:"Video",chip:"from-red-500 to-rose-600",icon:"M15 10l4.553-2.069A1 1 0 0121 8.82v6.36a1 1 0 01-1.447.894L15 14M3 8a2 2 0 012-2h10a2 2 0 012 2v8a2 2 0 01-2 2H5a2 2 0 01-2-2V8z"},{key:"chung_toi",perm:"chung_toi",href:"/admin/gioi-thieu",label:"Giới thiệu",chip:"from-cyan-500 to-teal-600",icon:"M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0z"}],v=_([]);function S(){try{const s=localStorage.getItem(z);v.value=s?JSON.parse(s):[]}catch{v.value=[]}}function L(){try{localStorage.setItem(z,JSON.stringify(v.value))}catch{}}const p=N(()=>{const s=I.filter(t=>l(t.perm)),a=t=>{const i=v.value.indexOf(t);return i===-1?Number.MAX_SAFE_INTEGER:i};return[...s].sort((t,i)=>a(t.key)-a(i.key))});function V(s,a){const t=p.value.map(D=>D.key),i=t.indexOf(s),g=i+a;i<0||g<0||g>=t.length||([t[i],t[g]]=[t[g],t[i]],v.value=t,L())}w(S);const h=_({totalUsers:0,totalArticles:0,viewsToday:0,totalViews:0,activeGoldUsers:0}),U=s=>
1Number(s||0).toLocaleString("vi-VN"),B=N(()=>[{label:"Tổng user",value:h.value.totalUsers,text:"text-blue-600",bar:"bg-blue-500"},{label:"Tổng bài viết",value:h.value.totalArticles,text:"text-emerald-600",bar:"bg-emerald-500"},{label:"Xem hôm nay",value:h.value.viewsToday,text:"text-amber-600",bar:"bg-amber-500"},{label:"Tổng xem",value:h.value.totalViews,text:"text-rose-600",bar:"bg-rose-500"},{label:"VIP user",value:h.value.activeGoldUsers,text:"text-purple-600",bar:"bg-purple-500"}]),c=_({vip_activations:[],subadmin_changes:[]}),b=_(!1);w(()=>{H(),O()});async function H(){if(await f(),!!l("dashboard"))try{const s=await A("/admin/dashboard-stats",{},!1);s&&(h.value={totalUsers:Number(s.totalUsers)||0,totalArticles:Number(s.totalArticles)||0,viewsToday:Number(s.viewsToday)||0,totalViews:Number(s.totalViews)||0,activeGoldUsers:Number(s.activeGoldUsers)||0})}catch(s){console.error("Error loading dashboard data:",s)}}async function O(){if(await f(),!!l("recent_activity")){b.value=!0;try{const s=await A("/admin/activity-log",{},!1);s&&(c.value=s)}catch(s){console.error("Error loading activity log:",s)}finally{b.value=!1}}}function k(s){const a=Number(s);return!a||a<=0?"Vĩnh viễn":a%12===0?`${a/12} năm`:`${a} tháng`}function M(s){if(!s)return"";try{const a=/[zZ]$|[+-]\d{2}:?\d{2}$/.test(s);return new Date(a?s:s+"Z").toLocaleString("en-GB",{timeZone:"Asia/Ho_Chi_Minh",day:"2-digit",month:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}).replace(",","")}catch{return s}}return(s,a)=>(n(),r("div",null,[y(l)("dashboard")?(n(),r("div",j,[...a[0]||(a[0]=[e("h1",{class:"text-2xl sm:text-3xl font-extrabold tracking-tight text-gray-500"},"Bảng Dashboard",-1),e("p",{class:"text-sm text-gray-500 mt-1"},"Tổng quan hệ thống Từ Điển AV",-1)])])):d("",!0),y(l)("dashboard")?(n(),r("div",P,[(n(!0),r(u,null,x(B.value,t=>(n(),r("div",{key:t.label,class:"stat-card relative overflow-hidden bg-white rounded-xl border border-gray-200 shadow-sm hover:shadow-md transition-shadow duration-200 pl-4 pr-3 py-3.5"},[e("span",{class:m(["absolute left-0 top-0 h-full w-1",t.bar])},null,2),e("p",q,o(t.label),1),e("p",{class:m(["text-[22px] font-extrabold leading-none tabular-nums tracking-tight whitespace-nowrap",t.text])},o(U(t.value)),3)]))),128))])):d("",!0),p.value.length||y(l)("recent_activity")?(n(),r("div",Q,[p.value.length?(n(),r("div",R,[a[2]||(a[2]=e("h3",{class:"text-lg font-medium text-gray-900 mb-4"},"Quick Actions",-1)),e("div",K,[(n(!0),r(u,null,x(p.value,(t,i)=>(n(),r("div",{key:t.key,class:"flex items-center gap-2"},[e("a",{href:t.href,target:"_blank",rel:"noopener noreferrer",class:"group flex-1 min-w-0 flex items-center gap-3 bg-white border border-gray-200 rounded-xl px-3.5 py-2.5 shadow-sm hover:shadow-md hover:border-gray-300 hover:-translate-y-0.5 transition-all duration-200"},[e("span",{class:m(["shrink-0 w-9 h-9 rounded-lg flex items-center justify-center text-white shadow-sm bg-gradient-to-br",t.chip])},[(n(),r("svg",X,[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:t.icon},null,8,Z)]))],2),e("span",J,o(t.label),1),a[1]||(a[1]=e("svg",{class:"ml-auto w-4 h-4 shrink-0 text-gray-300 group-hover:text-gray-500 group-hover:translate-x-0.5 transition-transform",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 5l7 7-7 7"})],-1))],8,F),e("div",Y,[e("button",{type:"button",title:"Lên",disabled:i===0,onClick:g=>V(t.key,-1),class:"px-1.5 leading-none text-gray-400 hover:text-gray-700 disabled:opacity-30 disabled:cursor-not-allowed"},"▲",8,W),e("button",{type:"button",title:"Xuống",disabled:i===p.value.length-1,onClick:g=>V(t.key,1),class:"px-1.5 leading-none text-gray-400 hover:text-gray-700 disabled:opacity-30 disabled:cursor-not-allowed"},"▼",8,tt)])]))),128))])])):d("",!0),y(l)("recent_activity")?(n(),r("div",et,[a[11]||(a[11]=e("h3",{class:"text-lg font-medium text-gray-900 mb-4"},"Recent Activity",-1)),e("div",at,[a[7]||(a[7]=C('<div class="flex items-center gap-2 mb-2"><span class="inline-flex items-center justify-center w-5 h-5 rounded-full bg-yellow-400"><svg class="w-3 h-3 text-white" fill="currentColor" viewBox="0 0 20 20"><path d="M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z"></path></svg></span><span class="text-sm font-semibold text-gray-700">Kích hoạt / Gỡ VIP <span class="text-gray-400 font-normal">(10000 gần nhất)</span></span></div>',1)),b.value?(n(),r("div",st,"Đang tải...")):c.value.vip_activations.length===0?(n(),r("div",nt,"Chưa có hoạt động")):(n(),r("ul",rt,[(n(!0),r(u,null,x(c.value.vip_activations,(t,i)=>(n(),r("li",{key:t.id,class:m(["flex items-start gap-2 text-xs rounded px-2.5 py-1.5 border",t.action_type==="vip_deactivated"?"bg-gray-50 border-gray-200":t.action_type==="vip_expired"?"bg-orange-50 border-orange-100":"bg-yellow-50 border-yellow-100"])},[e("span",it,o(c.value.vip_activations.length-i)+".",1),e("span",{class:m(["shrink-0 w-1.5 h-1.5 rounded-full mt-1.5",t.action_type==="vip_deactivated"?"bg-gray-400":t.action_type==="vip_expired"?"bg-orange-400":"bg-yellow-400"])},null,2),e("div",ot,[e("span",lt,[T(o(t.target_name||t.target_email||`#${t.target_id}`),1),t.target_id?(n(),r("span",dt," (ID:"+o(t.target_id)+")",1)):d("",!0)]),t.action_type==="vip_deactivated"?(n(),r("span",ct," bị gỡ VIP bởi ")):t.action_type==="vip_expired"?(n(),r(u,{key:1},[a[3]||(a[3]=e("span",{class:"text-orange-600"}," hết hạn VIP ",-1)),e("span",ut,o(k(t.plan_months)),1),a[4]||(a[4]=e("span",{class:"text-gray-500"}," → về thường ",-1))],64)):(n(),r(u,{key:2},[a[5]||(a[5]=e("span",{class:"text-gray-500"}," được kích hoạt VIP ",-1)),e("span",mt,o(k(t.plan_months)),1),a[6]||(a[6]=e("span",{class:"text-gray-500"}," bởi ",-1))],64)),t.action_type!=="vip_expired"?(n(),r("span",pt,o(t.actor_name||"Admin"),1)):d("",!0)]),e("span",ht,o(M(t.created_at)),1)],2))),128))]))]),a[12]||(a[12]=e("div",{class:"border-t border-gray-100 my-4"},null,-1)),e("div",null,[a[10]||(a[10]=C('<div class="flex items-center gap-2 mb-2"><span class="inline-flex items-center justify-center w-5 h-5 rounded-full bg-purple-500"><svg class="w-3 h-3 text-white" fill="currentColor" viewBox="0 0 20 20"><path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-6-3a2 2 0 11-4 0 2 2 
10 014 0zm-2 4a5 5 0 00-4.546 2.916A5.986 5.986 0 0010 16a5.986 5.986 0 004.546-2.084A5 5 0 0010 11z" clip-rule="evenodd"></path></svg></span><span class="text-sm font-semibold text-gray-700">Thay đổi Sub-admin <span class="text-gray-400 font-normal">(500 gần nhất)</span></span></div>',1)),b.value?(n(),r("div",gt,"Đang tải...")):c.value.subadmin_changes.length===0?(n(),r("div",yt,"Chưa có hoạt động")):(n(),r("ul",vt,[(n(!0),r(u,null,x(c.value.subadmin_changes,(t,i)=>(n(),r("li",{key:t.id,class:m(["flex items-start gap-2 text-xs rounded px-2.5 py-1.5 border",t.action_type==="subadmin_set"?"bg-purple-50 border-purple-100":"bg-gray-50 border-gray-200"])},[e("span",bt,o(c.value.subadmin_changes.length-i)+".",1),e("span",{class:m(["shrink-0 w-1.5 h-1.5 rounded-full mt-1.5",t.action_type==="subadmin_set"?"bg-purple-500":"bg-gray-400"])},null,2),e("div",xt,[e("span",_t,[T(o(t.target_name||t.target_email||`#${t.target_id}`),1),t.target_id?(n(),r("span",ft," (ID:"+o(t.target_id)+")",1)):d("",!0)]),t.action_type==="subadmin_set"?(n(),r(u,{key:0},[a[8]||(a[8]=e("span",{class:"text-purple-700"}," được gán Sub-admin ",-1)),e("span",kt,o(k(t.plan_months)),1)],64)):(n(),r("span",wt," bị gỡ Sub-admin")),a[9]||(a[9]=e("span",{class:"text-gray-500"}," bởi ",-1)),e("span",At,o(t.actor_name||"Admin"),1)]),e("span",Vt,o(M(t.created_at)),1)],2))),128))]))])])):d("",!0)])):d("",!0),!y(l)("dashboard")&&!p.value.length&&!y(l)("recent_activity")?(n(),r("div",Mt,[...a[13]||(a[13]=[e("div",{class:"text-4xl mb-3"},"👋",-1),e("p",{class:"text-lg font-semibold text-gray-700"},"Chào mừng bạn đến trang quản trị",-1),e("p",{class:"text-sm text-gray-500 mt-1"},"Hãy chọn một chức năng ở menu bên trái để bắt đầu.",-1)])])):d("",!0)]))}};export{It 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.