1import{c as E,r,af as g,z as A,j as e,C as h,K as m}from"./index-C-TaAGmN.js";import{A as S}from"./AppShell-Q1pZnWHm.js";import{u as T}from"./usePageTitle-CEBpYjDi.js";import{B as u}from"./dateFormat-Bk-Flexx.js";import{C as f}from"./circle-x-NZoqGZyT.js";import{C as P}from"./clock-COxAn3RD.js";import{T as L}from"./trophy-PecPrR9l.js";import{S as b}from"./smartphone-DtqNqsoQ.js";import{G as y}from"./globe-BKE_KsiC.js";import"./useMediaQuery-BotE5nYp.js";import"./crown-BPCHVQg4.js";import"./credit-card-Dt4NydP0.js";import"./shield-check-Cz_0e103.js";import"./award-D22YU6tU.js";import"./chart-no-axes-column-DNi2on0A.js";import"./target-BWCUukSP.js";import"./users-B_d8OqAX.js";import"./info-BK4a7HNe.js";import"./chevron-left-BcdrX4IQ.js";const B=20;function o({icon:t,label:s,value:l,color:i}){return e.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 p-4 flex items-center gap-3",children:[e.jsx("div",{className:`w-10 h-10 rounded-lg flex items-center justify-center ${i}`,children:t}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-gray-500",children:s}),e.jsx("p",{className:"text-xl font-bold text-gray-900",children:l})]})]})}function M(t){const l={MATCH_REMINDER:{label:m.t("notiflogs.type_reminder",{ns:"admin",defaultValue:"Lembrete de jogo"}),cls:"bg-blue-100 text-blue-700"},ACHIEVEMENT:{label:m.t("notiflogs.type_achievement",{ns:"admin",defaultValue:"Conquista"}),cls:"bg-amber-100 text-amber-700"}}[t]??{label:t,cls:"bg-gray-100 text-gray-600"};return e.jsx("span",{className:`text-xs px-2 py-0.5 rounded-full font-medium ${l.cls}`,children:l.label})}function V(t,s){const l=t==="APP";return e.jsxs("span",{className:`inline-flex items-center gap-1 text-xs px-2 py-0.5 rounded-full font-medium ${l?"bg-purple-100 text-purple-700":"bg-emerald-100 text-emerald-700"}`,children:[l?e.jsx(b,{className:"w-3 h-3"}):e.jsx(y,{className:"w-3 h-3"}),l?m.t("notiflogs.channel_app",{ns:"admin",platform:s,defaultValue:"App ({{platform}})"}):m.t("notiflogs.channel_web",{ns:"admin",defaultValue:"Web"})]})}function ee(){const{t}=E("admin");T(t("notiflogs.page_title","Histórico de Notificações"));const[s,l]=r.useState(null),[i,j]=r.useState([]),[n,N]=r.useState(0),[c,v]=r.useState(0),[w,_]=r.useState(0),[C,p]=r.useState(!0),x=r.useCallback(a=>{p(!0),g.getLogs(a,B).then(d=>{j(d.content),v(d.totalPages),_(d.totalElements),N(d.page)}).catch(()=>A.error(t("notiflogs.toast.load_error","Erro ao carregar histórico de notificações"))).finally(()=>p(!1))},[t]);return r.useEffect(()=>{g.getStats().then(l).catch(()=>{})},[]),r.useEffect(()=>{x(0)},[x]),e.jsx(S,{children:e.jsxs("div",{className:"max-w-6xl mx-auto px-4 sm:px-6 lg:px-8 py-8",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[e.jsx("div",{className:"w-10 h-10 bg-primary-50 rounded-xl flex items-center justify-center",children:e.jsx(u,{className:"w-5 h-5 text-primary-600"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:t("notiflogs.page_title","Histórico de Notificações")}),e.jsx("p",{className:"text-sm text-gray-500",children:t("notiflogs.header_subtitle","Push enviados (App + Web), por tipo, plataforma e canal")})]})]}),s&&e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-7 gap-3 mb-6",children:[e.jsx(o,{icon:e.jsx(u,{className:"w-5 h-5 text-gray-600"}),label:t("notiflogs.stat_total","Total"),value:s.total,color:"bg-gray-100"}),e.jsx(o,{icon:e.jsx(h,{className:"w-5 h-5 text-green-600"}),label:t("notiflogs.stat_success","Sucesso"),value:s.success,color:"bg-green-100"}),e.jsx(o,{icon:e.jsx(f,{className:"w-5 h-5 text-red-600"}),label:t("notiflogs.stat_failure","Falha"),value:s.failure,color:"bg-red-100"}),e.jsx(o,{icon:e.jsx(P,{className:"w-5 h-5 text-blue-600"}),label:t("notiflogs.stat_reminders","Lembretes"),value:s.byType?.MATCH_REMINDER??0,color:"bg-blue-100"}),e.jsx(o,{icon:e.jsx(L,{className:"w-5 h-5 text-amber-600"}),label:t("notiflogs.stat_achievements","Conquistas"),value:s.byType?.ACHIEVEMENT??0,color:"bg-amber-100"}),e.jsx(o,{icon:e.jsx(b,{className:"w-5 h-5 text-purple-600"}
1),label:t("notiflogs.stat_channel_app","Canal App"),value:s.byChannel?.APP??0,color:"bg-purple-100"}),e.jsx(o,{icon:e.jsx(y,{className:"w-5 h-5 text-emerald-600"}),label:t("notiflogs.stat_channel_web","Canal Web"),value:s.byChannel?.WEB??0,color:"bg-emerald-100"})]}),e.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 overflow-hidden",children:[e.jsxs("div",{className:"px-4 py-3 border-b border-gray-100 flex items-center justify-between",children:[e.jsx("h2",{className:"text-sm font-semibold text-gray-700",children:t("notiflogs.sent_title","Notificações enviadas")}),e.jsx("span",{className:"text-xs text-gray-400",children:t("notiflogs.total",{count:w,defaultValue:"{{count}} no total"})})]}),C?e.jsx("div",{className:"p-8 text-center text-gray-400 text-sm",children:t("notiflogs.loading","Carregandoâ¦")}):i.length===0?e.jsx("div",{className:"p-8 text-center text-gray-400 text-sm",children:t("notiflogs.empty","Nenhuma notificação registrada ainda.")}):e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{className:"bg-gray-50 text-gray-500 text-xs uppercase",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-4 py-2 text-left",children:t("notiflogs.col_type","Tipo")}),e.jsx("th",{className:"px-4 py-2 text-left",children:t("notiflogs.col_content","TÃtulo / Corpo")}),e.jsx("th",{className:"px-4 py-2 text-left",children:t("notiflogs.col_channel","Canal")}),e.jsx("th",{className:"px-4 py-2 text-center",children:t("notiflogs.col_status","Status")}),e.jsx("th",{className:"px-4 py-2 text-left",children:t("notiflogs.col_sent_by","Enviado por")}),e.jsx("th",{className:"px-4 py-2 text-left",children:t("notiflogs.col_date","Data")})]})}),e.jsx("tbody",{className:"divide-y divide-gray-100",children:i.map(a=>e.jsxs("tr",{className:"hover:bg-gray-50",children:[e.jsx("td",{className:"px-4 py-3",children:M(a.type)}),e.jsxs("td",{className:"px-4 py-3 max-w-xs",children:[e.jsx("p",{className:"font-medium text-gray-900 truncate",children:a.title||"â"}),e.jsx("p",{className:"text-gray-500 text-xs truncate",children:a.body||""})]}),e.jsx("td",{className:"px-4 py-3",children:V(a.channel,a.platform)}),e.jsx("td",{className:"px-4 py-3 text-center",children:a.success?e.jsx(h,{className:"w-4 h-4 text-green-600 inline"}):e.jsx(f,{className:"w-4 h-4 text-red-600 inline"})}),e.jsx("td",{className:"px-4 py-3 text-gray-600 text-xs",children:a.sentBy==="SCHEDULER"?e.jsx("span",{className:"text-gray-400",children:t("notiflogs.automatic","Automático")}):a.sentBy}),e.jsx("td",{className:"px-4 py-3 text-gray-500 text-xs whitespace-nowrap",children:new Date(a.sentAt).toLocaleString("pt-BR")})]},a.id))})]})}),c>1&&e.jsxs("div",{className:"px-4 py-3 border-t border-gray-100 flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-gray-500",children:t("notiflogs.pagination",{current:n+1,total:c,defaultValue:"Página {{current}} de {{total}}"})}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:()=>x(Math.max(0,n-1)),disabled:n===0,className:"px-3 py-1.5 text-sm border border-gray-300 rounded-lg hover:bg-gray-50 disabled:opacity-40 disabled:cursor-not-allowed transition",children:t("notiflogs.prev","â Anterior")}),e.jsx("button",{onClick:()=>x(Math.min(c-1,n+1)),disabled:n>=c-1,className:"px-3 py-1.5 text-sm border border-gray-300 rounded-lg hover:bg-gray-50 disabled:opacity-40 disabled:cursor-not-allowed transition",children:t("notiflogs.next","Próxima â")})]})]})]})]})})}export{ee as default}; 2//# sourceMappingURL=NotificationLogsAdmin-B-5D_DyH.js.map
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.