PageSourceSearch

https://anpg.co.ao/assets/AdminNotificationAuditPage-DHS4k0T0.js

js anpg.co.ao collected 2026-10-02 16:46:06 UTC 7,922 bytes, 2 lines download raw bytes

1/* ANPG DEVTEAM - 29/09/2026, 14:34:20 */
2import{u as M,j as e}from"./data-vendor-BRYI0K8G.js";import{r as i}from"./react-vendor-Bj9LQV-u.js";import{w as R,b as k,af as O,ag as $,ah as I,ai as V,bf as P,cM as z}from"./index-B5fS5HUA.js";import{A as K,B as Q}from"./AdminLayout-h_nmul7P.js";import{I as f}from"./input-CtWCrhgd.js";import{B as g}from"./badge-jukGcCw8.js";import{C as G,b as J,c as U,d as W,a as X}from"./card-SWKDiSm6.js";import{T as Y,a as Z,b as v,c,d as ee,e as o}from"./table-BTascmHv.js";import{S as b,a as _,b as D,c as S,d as n}from"./select-CIRt4Z_4.js";import{S as se}from"./search-B8XA8FkL.js";import{E as te}from"./eye-D_wcHN_j.js";import{f as w,p as T}from"./pt-C0cLzuL-.js";import"./charts-vendor-Cs07Jtv5.js";import"./motion-vendor-DMc3mo8t.js";import"./i18n-vendor-BSIZ7LIS.js";import"./message-square-3F19oJ7J.js";import"./newspaper-B1VsFBcy.js";import"./tag-zpo8YYRH.js";import"./camera-DF73IPZH.js";import"./shield-check-DBFg_Isw.js";import"./sliders-horizontal-CI8TRfgr.js";import"./user-check-Omtv7yGv.js";import"./network-Bioht48n.js";import"./clock-DjVV6Aw0.js";import"./book-open-BvZy1lzn.js";import"./bot-Ckp6pNDt.js";import"./gavel-D8KhpCGX.js";import"./presentation-Bg7Ve6-F.js";import"./star-BMTUmwlW.js";import"./clipboard-check-AscQTU3D.js";import"./folder-open-DBolFNfs.js";import"./settings-2-5vee-iyr.js";import"./label-ByFBDaC1.js";import"./rocket-OwwOM41y.js";import"./user-B2J0vviq.js";import"./arrow-left-B5pHXlkl.js";import"./circle-check-big-R1zEC76Q.js";import"./index-BdQq_4o_.js";import"./index-BatE7gkT.js";import"./index-D6PzSG9l.js";import"./chevron-up-CYP72WxE.js";function N(l){return l?l.split(",").map(p=>p.trim()).filter(Boolean):[]}function ze(){const[l,p]=i.useState(""),[d,E]=i.useState("all"),[m,A]=i.useState("all"),[x,B]=i.useState(""),[u,H]=i.useState(""),[t,C]=i.useState(null),{data:h,isLoading:L}=M({queryKey:["admin-notification-audit-logs"],queryFn:async()=>(await z.list({sort:"-created_at",limit:1e3})).data||[]}),q=i.useMemo(()=>Array.from(new Set((h||[]).map(a=>
2a.category_code).filter(Boolean))).sort((a,r)=>a.localeCompare(r)),[h]),j=i.useMemo(()=>(h||[]).filter(s=>{if(d!=="all"&&s.category_code!==d||m!=="all"&&s.status!==m)return!1;if(x){const r=new Date(`${x}T00:00:00`).getTime();if(new Date(s.created_at).getTime()<r)return!1}if(u){const r=new Date(`${u}T23:59:59`).getTime();if(new Date(s.created_at).getTime()>r)return!1}const a=l.trim().toLowerCase();return a?[s.category_code,s.event_key,s.subject||"",s.requester_email||"",s.to_emails||"",s.cc_emails||"",s.bcc_emails||"",s.status].join(" ").toLowerCase().includes(a):!0}),[h,d,m,x,u,l]);return e.jsxs(K,{title:"Auditoria de Notificações",subtitle:"Registo de envios por categoria, evento e estado",children:[e.jsx("main",{className:"container mx-auto px-4 py-8",children:e.jsxs(G,{children:[e.jsxs(J,{children:[e.jsx(U,{children:"Centro de Auditoria de Notificações"}),e.jsx(W,{children:"Consulte histórico de envio, falhas e destinatários resolvidos por categoria."})]}),e.jsxs(X,{children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-5 gap-3 mb-6",children:[e.jsxs("div",{className:"relative md:col-span-2 xl:col-span-2",children:[e.jsx(se,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(f,{value:l,onChange:s=>p(s.target.value),placeholder:"Pesquisar por categoria, evento, email ou assunto",className:"pl-10"})]}),e.jsxs(b,{value:d,onValueChange:E,children:[e.jsx(_,{children:e.jsx(D,{placeholder:"Categoria"})}),e.jsxs(S,{children:[e.jsx(n,{value:"all",children:"Todas as categorias"}),q.map(s=>e.jsx(n,{value:s,children:s},s))]})]}),e.jsxs(b,{value:m,onValueChange:A,children:[e.jsx(_,{children:e.jsx(D,{placeholder:"Estado"})}),e.jsxs(S,{children:[e.jsx(n,{value:"all",children:"Todos os estados"}),e.jsx(n,{value:"success",children:"Sucesso"}),e.jsx(n,{value:"failed",children:"Falha"})]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(f,{type:"date",value:x,onChange:s=>B(s.target.value),title:"Data inicial"}),e.jsx(f,{type:"date",value:u,onChange:s=>H(s.target.value),title:"Data final"})]})]}),L?e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx(R,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):e.jsx("div",{className:"rounded-md border overflow-x-auto",children:e.jsxs(Y,{children:[e.jsx(Z,{children:e.jsxs(v,{children:[e.jsx(c,{children:"Data/Hora"}),e.jsx(c,{children:"Categoria"}),e.jsx(c,{children:"Evento"}),e.jsx(c,{children:"Estado"}),e.jsx(c,{children:"Destinatários"}),e.jsx(c,{className:"text-right",children:"Detalhes"})]})}),e.jsx(ee,{children:j.length===0?e.jsx(v,{children:e.jsx(o,{colSpan:6,className:"text-center py-10 text-muted-foreground",children:"Nenhum registo encontrado para os filtros seleccionados."})}):j.map(s=>{const a=N(s.to_emails).length,r=N(s.cc_emails).length,y=N(s.bcc_emails).length,F=a+r+y;return e.jsxs(v,{children:[e.jsx(o,{className:"font-mono text-xs",children:w(new Date(s.created_at),"dd/MM/yyyy HH:mm:ss",{locale:T})}),e.jsx(o,{children:e.jsx(g,{variant:"outline",children:s.category_code})}),e.jsx(o,{className:"font-mono text-xs",children:s.event_key}),e.jsx(o,{children:s.status==="success"?e.jsx(g,{className:"bg-status-success text-white",children:"Sucesso"}):e.jsx(g,{variant:"destructive",children:"Falha"})}),e.jsxs(o,{className:"text-sm text-muted-foreground",children:[F," total (TO ",a," / CC ",r," / BCC ",y,")"]}),e.jsx(o,{className:"text-right",children:e.jsx(k,{variant:"ghost",size:"icon",onClick:()=>C(s),children:e.jsx(te,{className:"h-4 w-4"})})})]},s.id)})})]})}),e.jsxs("div",{className:"mt-4 text-sm text-muted-foreground inline-flex items-center gap-2",children:[e.jsx(Q,{className:"h-4 w-4"}),j.length," registo(s) de notificação"]})]})]})}),e.jsx(O,{open:!!t,onOpenChange:()=>C(null),children:e.jsxs($,{className:"sm:max-w-[760px] max-h-[90vh] overflow-y-auto",children:[e.jsxs(I,{children:[e.jsx(V,{children:"Detalhes da Notificação"}),e.jsx(P,{children:t?`${t.category_code} • ${w(new Date(t.created_at),"dd/MM/yyyy 'às' HH:mm:ss",{locale:T})}`:""})]}),t&&e.jsxs("div",{className:"space-y-4 py-2",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3 text-sm",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-muted-foreground",children:"Categoria"}),e.jsx("p",{className:"font-medium",children:t.category_code})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-muted-foreground",children:"Evento"}),e.jsx("p",{className:"font-mono text-xs",children:t.event_key})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-muted-foreground",children:"Estado"}),e.jsx("p",{className:"font-medium",children:t.status==="success"?"Sucesso":"Falha"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-muted-foreground",children:"Requerente"}),e.jsx("p",{className:"font-medium",children:t.requester_email||"—"})]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-muted-foreground text-sm mb-1",children:"Assu
2nto"}),e.jsx("p",{className:"text-sm",children:t.subject||"—"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-muted-foreground text-sm mb-1",children:"TO"}),e.jsx("p",{className:"text-sm",children:t.to_emails||"—"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-muted-foreground text-sm mb-1",children:"CC"}),e.jsx("p",{className:"text-sm",children:t.cc_emails||"—"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-muted-foreground text-sm mb-1",children:"BCC"}),e.jsx("p",{className:"text-sm",children:t.bcc_emails||"—"})]})]}),t.error_message&&e.jsxs("div",{children:[e.jsx("p",{className:"text-muted-foreground text-sm mb-1",children:"Erro"}),e.jsx("pre",{className:"text-xs bg-destructive/5 border border-destructive/20 rounded-lg p-3 whitespace-pre-wrap break-words",children:t.error_message})]})]})]})})]})}export{ze 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.