1import{l as v,c as j,a2 as N,r as a,K as w,j as e,T as _,a3 as C,z as u}from"./index-C-TaAGmN.js";import{A as S}from"./AppShell-Q1pZnWHm.js";import{u as E}from"./usePageTitle-CEBpYjDi.js";import{B as k}from"./dateFormat-Bk-Flexx.js";import"./useMediaQuery-BotE5nYp.js";import"./crown-BPCHVQg4.js";import"./credit-card-Dt4NydP0.js";import"./shield-check-Cz_0e103.js";import"./trophy-PecPrR9l.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 U=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],A=v("send",U),T=w.t("notify.default_subject",{ns:"admin",defaultValue:"Bolão Elite - Nova versão disponÃvel"});function z(s){return`Uma nova versão do Bolão Elite está disponÃvel com novidades e melhorias para você. Confira o que há de novo: 2 3Novidades da versão ${s}: 4 51. [Descreva a primeira funcionalidade] 62. [Descreva a segunda funcionalidade] 73. [Descreva a terceira melhoria/correção] 8 9Acesse agora e aproveite todas as novidades!`}function H(){const{t:s}=j("admin");E(s("notify.page_title","Notificar Usuários"));const{version:n}=N(),l=n?.version??"...",[r,p]=a.useState(T),[o,d]=a.useState(()=>z("...")),[c,m]=a.useState(!1),[f,i]=a.useState(!1),[x,g]=a.useState(null),y=t=>{d(h=>h.replace(/versão \.\.\./g,`versão ${t}`))};n?.version&&l==="..."&&y(n.version);const b=async()=>{i(!1),m(!0);try{const t=await C.notifyAllUsers(r,o);g(t),u.success(t.message,{duration:6e3})}catch{u.error(s("notify.toast.error","Erro ao iniciar envio. Tente novamente."))}finally{m(!1)}};return e.jsx(S,{children:e.jsxs("div",{className:"max-w-3xl mx-auto",children:[e.jsxs("div",{className:"mb-6",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-1",children:[e.jsx(k,{className:"w-7 h-7 text-primary-600"}),e.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:s("notify.page_title","Notificar Usuários")})]}),e.jsx("p",{className:"text-sm text-gray-500 ml-10",children:s("notify.header_subtitle","Envie um e-mail para todos os usuários cadastrados no sistema.")})]}),e.jsxs("div",{className:"bg-white rounded-xl shadow-sm border border-gray-200 p-6 space-y-5",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:s("notify.subject_label","Assunto do e-mail")}),e.jsx("input",{type:"text",value:r,onChange:t=>p(t.target.value),maxLength:255,className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary-500 focus:border-transparent text-sm"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:s("notify.body_label","Corpo do e-mail")}),e.jsx("p",{className:"text-xs text-gray-400 mb-2",children:s("notify.body_hint","O destinatário receberá o e-mail com uma saudação personalizada pelo nome. Use linhas em branco para separar parágrafos.")}),e.jsx("textarea",{value:o,onChange:t=>d(t.target.value),rows:14,maxLength:1e4,className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary-500 focus:border-transparent text-sm font-mono resize-y"}),e.jsx("p",{className:"text-xs text-gray-400 mt-1 text-right",children:s("notify.char_count",{count:o.length,defaultValue:"{{count}}/10000 caracteres"})})]}),e.jsxs("div",{className:"bg-gray-50 rounded-lg border border-gray-200 p-4 text-sm text-gray-600",children:[e.jsx("p",{className:"font-medium text-gray-700 mb-1",children:s("notify.footer_preview_label","Prévia do rodapé do e-mail:")}),e.jsx("p",{className:"text-xs text-gray-500 italic",children:s("notify.footer_preview",{version:l,defaultValue:"Versão {{version}} ⢠© Bolão Elite â Este é um e-mail automático, não responda."})})]}),x&&e.jsxs("div",{className:"bg-green-50 border border-green-200 rounded-lg p-4 text-sm text-green-800",children:["â ",x.message]}),e.jsx("div",{className:"flex justify-end pt-2",children:e.jsxs("button",{onClick:()=>i(!0),disabled:c||!r.trim()||!o.trim(),className:"flex items-center gap-2 px-6 py-2.5 bg-primary-600 hover:bg-primary-700 text-white rounded-lg transition disabled:opacity-50 disabled:cursor-not-allowed font-medium text-sm",children:[e.jsx(A,{className:"w-4 h-4"}),c?s("notify.sending","Enviando..."):s("notify.send","Notificar todos os usuários")]})})]}),f&&e.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-40 z-50 flex items-center justify-center p-4",children:e.jsxs("div",{className:"bg-white rounded-xl shadow-xl p-6 max-w-sm w-full",children:[e.jsx("h3",{className:"text-lg font-bold text-gray-900 mb-2",children:s("notify.confirm_title","Confirmar envio")}),e.jsx("p",{className:"text-sm text-gray-600 mb-5",children:e.jsx(_,{i18nKey:"notify.confirm_text",t:s,values:{subject:r},components:{b:e.jsx("strong",{}),s:e.jsx("strong",{})}})}),e.jsxs("div",{className:"flex gap-3",children:[e.jsx("button",{onClick:()=>i(!1),className:"flex-1 px-4 py-2 border border-gray-300 rounded-lg text-sm hover:bg-gray-50 transition",children:s("notify.cancel","Cancelar")}
9),e.jsx("button",{onClick:b,className:"flex-1 px-4 py-2 bg-primary-600 hover:bg-primary-700 text-white rounded-lg text-sm font-medium transition",children:s("notify.confirm_send","Confirmar envio")})]})]})})]})})}export{H as default}; 10//# sourceMappingURL=NotifyUsers-Cor96isZ.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.