Files
alrahma_sunday_school_api/apps/admin/.next/static/chunks/1upk0tvhu5p1u.js
T
2026-06-11 03:22:12 -04:00

1 line
3.7 KiB
JavaScript

(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,6655,e=>{"use strict";let t=e.i(47167).default.env.NEXT_PUBLIC_API_URL??"/admin/api/v1";e.s(["ADMIN_API_BASE",0,t])},29116,e=>{"use strict";var t=e.i(43476),s=e.i(71645),a=e.i(6655);let c={CREATE:"text-emerald-400 bg-emerald-950/40",UPDATE:"text-sky-400 bg-sky-950/40",DELETE:"text-red-400 bg-red-950/40",SUSPEND:"text-orange-400 bg-orange-950/40",ACTIVATE:"text-emerald-400 bg-emerald-950/40",LOGIN:"text-zinc-400 bg-zinc-800"};e.s(["default",0,function(){let[e,i]=(0,s.useState)([]),[n,r]=(0,s.useState)(!0),[l,d]=(0,s.useState)(null),[x,o]=(0,s.useState)("");(0,s.useEffect)(()=>{fetch(`${a.ADMIN_API_BASE}/admin/audit-logs`,{credentials:"include",cache:"no-store"}).then(e=>e.json()).then(e=>i(Array.isArray(e.data)?e.data:e.data?.data??[])).catch(e=>d(e.message)).finally(()=>r(!1))},[]);let m=x?e.filter(e=>e.action.toLowerCase().includes(x.toLowerCase())||e.resource.toLowerCase().includes(x.toLowerCase())):e;return(0,t.jsxs)("div",{className:"shell py-8 space-y-6",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-xs uppercase tracking-[0.2em] text-emerald-400",children:"Platform"}),(0,t.jsx)("h1",{className:"mt-1 text-3xl font-black",children:"Audit Logs"})]}),(0,t.jsx)("input",{className:"w-64 px-3 py-2 rounded-xl bg-zinc-800 border border-zinc-700 text-zinc-100 text-sm placeholder:text-zinc-500 focus:outline-none focus:ring-2 focus:ring-emerald-500",placeholder:"Filter by action or entity…",value:x,onChange:e=>o(e.target.value)})]}),l&&(0,t.jsx)("div",{className:"panel p-4 text-sm text-red-400",children:l}),(0,t.jsx)("div",{className:"panel overflow-hidden",children:(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)("table",{className:"w-full text-sm",children:[(0,t.jsx)("thead",{children:(0,t.jsxs)("tr",{className:"border-b border-zinc-800",children:[(0,t.jsx)("th",{className:"text-left px-6 py-3 text-xs font-medium text-zinc-500 uppercase tracking-wider",children:"Action"}),(0,t.jsx)("th",{className:"text-left px-6 py-3 text-xs font-medium text-zinc-500 uppercase tracking-wider",children:"Entity"}),(0,t.jsx)("th",{className:"text-left px-6 py-3 text-xs font-medium text-zinc-500 uppercase tracking-wider",children:"Entity ID"}),(0,t.jsx)("th",{className:"text-left px-6 py-3 text-xs font-medium text-zinc-500 uppercase tracking-wider",children:"Admin"}),(0,t.jsx)("th",{className:"text-left px-6 py-3 text-xs font-medium text-zinc-500 uppercase tracking-wider",children:"Time"})]})}),(0,t.jsx)("tbody",{className:"divide-y divide-zinc-800/60",children:n?(0,t.jsx)("tr",{children:(0,t.jsx)("td",{colSpan:5,className:"px-6 py-12 text-center text-zinc-500",children:"Loading…"})}):0===m.length?(0,t.jsx)("tr",{children:(0,t.jsx)("td",{colSpan:5,className:"px-6 py-12 text-center text-zinc-500",children:"No logs found"})}):m.map(e=>(0,t.jsxs)("tr",{className:"hover:bg-zinc-800/30 transition-colors",children:[(0,t.jsx)("td",{className:"px-6 py-3",children:(0,t.jsx)("span",{className:`inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium ${c[e.action]??"text-zinc-400 bg-zinc-800"}`,children:e.action})}),(0,t.jsx)("td",{className:"px-6 py-3 text-zinc-300",children:e.resource}),(0,t.jsx)("td",{className:"px-6 py-3 text-zinc-500 font-mono text-xs",children:e.resourceId?`${e.resourceId.slice(0,12)}`:"—"}),(0,t.jsx)("td",{className:"px-6 py-3 text-zinc-400",children:e.adminUser?`${e.adminUser.firstName} ${e.adminUser.lastName}`:"—"}),(0,t.jsx)("td",{className:"px-6 py-3 text-zinc-500 text-xs",children:new Date(e.createdAt).toLocaleString()})]},e.id))})]})})})]})}])}]);