PageSourceSearch

https://crppr.org.br/assets/PlenariaConvocacaoPublica-BoeVxteb.js

js crppr.org.br collected 2026-09-25 02:53:18 UTC 10,829 bytes, 1 lines download raw bytes

1import{P as $,j as e,R as P,T as b,v as A,E as V,G as I,A as L,U as R}from"./index-BCp-6lKF.js";import{h as T,f as O,r as n}from"./vendor-react-CpRvMXaC.js";import{F as h}from"./XCircleIcon-NhNmjvEf.js";import{F as G}from"./ClockIcon-Kl7pZviT.js";import"./vendor-pdf-CLXYJc0c.js";import"./vendor-ui-5rZvml82.js";import"./vendor-editor-DoAMYjM7.js";function Q(){var k;const{token:l}=T(),c=O(),{isAuthenticated:d,isLoading:u}=$(),[S,f]=n.useState(!0),[j,y]=n.useState(!1),[m,i]=n.useState(null),[F,v]=n.useState(!1),[a,N]=n.useState(null),[w,_]=n.useState("");n.useEffect(()=>{!u&&!d&&(localStorage.setItem("redirect_after_login",`/plenaria/convocacao/${l}`),c("/login"))},[d,u,l,c]),n.useEffect(()=>{d&&(async()=>{try{(await fetch(`${L.BASE_URL}/sanctum/csrf-cookie`,{method:"GET",credentials:"include"})).ok,g()}catch(s){console.error("Erro ao obter CSRF cookie:",s),g()}})()},[l,d]);const g=async()=>{var r;try{f(!0),i(null);const s=await R.buscarConvocacaoPorToken(l);N(s)}catch(s){if(s.status===403&&((r=s.response)!=null&&r.data)){const o=s.response.data;o.confirmacao&&o.plenaria?(N({confirmacao:o.confirmacao,plenaria:o.plenaria,user:o.user}),i(o.message||"Esta convocação não é mais válida.")):i(o.message||"Erro ao carregar dados da convocação")}else i(s.message||"Erro ao carregar dados da convocação");console.error("Erro ao carregar dados:",s)}finally{f(!1)}},C=async r=>{var s,o;if(!(r==="recusado"&&!window.confirm("Tem certeza que deseja recusar esta convocação? Você será removido da lista de participantes.")))try{y(!0),i(null),v(!1),await R.responderConvocacaoPorToken(l,{status:r,observacao:w||null}),v(!0),setTimeout(()=>{c("/admin/plenarias/minhas")},3e3)}catch(E){i(((o=(s=E.response)==null?void 0:s.data)==null?void 0:o.message)||"Erro ao responder convocação"),console.error("Erro ao responder convocação:",E)}finally{y(!1)}},p=r=>r?new Date(r).toLocaleDateString("pt-BR",{day:"2-digit",month:"long",year:"numeric"}):"-";if(u||S)return e.jsx("div",{className:"min-h-screen bg-gray-50 flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"inline-block animate-spin rounded-full h-12 w-12 border-b-2 border-primary-600"}),e.jsx("p",{className:"mt-4 text-sm text-gray-600",children:"Carregando dados da convocação..."})]})});if(!d)return null;if(((k=a==null?void 0:a.confirmacao)==null?void 0:k.status)==="recusado")return e.jsx("div",{className:"min-h-screen bg-gray-50 flex items-center justify-center p-4",children:e.jsx("div",{className:"bg-white rounded-xl shadow-sm border border-gray-200 p-8 max-w-2xl w-full",children:e.jsxs("div",{className:"text-center",children:[e.jsx(h,{className:"h-16 w-16 text-orange-500 mx-auto mb-4"}),e.jsx("h1",{className:"text-2xl font-bold text-gray-900 mb-2",children:"Convocação Recusada"}),e.jsx("p",{className:"text-sm text-gray-600 mb-4",children:"Esta convocação para a plenária já foi recusada anteriormente."}),(a==null?void 0:a.plenaria)&&e.jsxs("div",{className:"bg-gray-50 rounded-lg p-4 mb-6 text-left",children:[e.jsx("p",{className:"text-sm font-medium text-gray-700 mb-2",children:"Plenária:"}),e.jsx("p",{className:"text-base text-gray-900 font-semibold",children:a.plenaria.nome||"Sem nome"}),a.plenaria.data_inicio&&e.jsxs("p",{className:"text-sm text-gray-600 mt-1",children:["Data: ",p(a.plenaria.data_inicio),a.plenaria.hora&&` às ${P(a.plenaria.hora)}`]})]}),e.jsx("p",{className:"text-sm text-gray-500 mb-6",children:"Como você recusou esta convocação, você foi removido da lista de participantes e este link não é mais válido."}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-center gap-3",children:[e.jsx("button",{onClick:()=>c("/"),className:"px-6 py-3 text-sm font-medium text-gray-700 bg-white border border-gray-300 hover:bg-gray-50 rounded-lg transition-colors",children:"Voltar para o Site"}),e.jsx("button",{onClick:()=>c("/admin/plenarias/minhas"),className:"px-6 py-3 text-sm font-medium text-white bg-primary-600 hover:bg-primary-700 rounded-lg transition-colors",children:"Ir para o Painel"})]})]})})});if(m&&!a)return e.jsx("div",{className:"min-h-screen bg-gray-50 flex items-center justify-center p-4",children:e.jsx("div",{className:"bg-white rounded-xl shadow-sm border border-gray-200 p-8 max-w-md w-full",children:e.jsxs("div",{className:"text-center",children:[e.jsx(h,{className:"h-16 w-16 text-red-500 mx-auto mb-4"}),e.jsx("h1",{className:"text-2xl font-bold text-gray-900 mb-2",children:"Erro"}),e.jsx("p",{className:"text-sm text-gray-600 mb-6",children:m}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-center gap-3",children:[e.jsx("button",{onClick:()=>c("/"),className:"px-6 py-3 text-sm font-medium text-gray-700 bg-white border border-gray-300 hover:bg-gray-50 rounded-lg transition-colors",children:"Voltar para o Site"}),e.jsx("button",{onClick:()=>
1c("/admin/plenarias/minhas"),className:"px-6 py-3 text-sm font-medium text-white bg-primary-600 hover:bg-primary-700 rounded-lg transition-colors",children:"Ir para o Painel"})]})]})})});if(!a||!a.plenaria)return e.jsx("div",{className:"min-h-screen bg-gray-50 flex items-center justify-center p-4",children:e.jsx("div",{className:"bg-white rounded-xl shadow-sm border border-gray-200 p-8 max-w-md w-full",children:e.jsx("div",{className:"text-center",children:e.jsx("p",{className:"text-sm text-gray-600",children:"Convocação não encontrada."})})})});const{plenaria:t,confirmacao:x,user:D}=a;return x.status!=="pendente"?e.jsx("div",{className:"min-h-screen bg-gray-50 flex items-center justify-center p-4",children:e.jsx("div",{className:"bg-white rounded-xl shadow-sm border border-gray-200 p-8 max-w-2xl w-full",children:e.jsxs("div",{className:"text-center",children:[x.status==="confirmado"?e.jsx(b,{className:"h-16 w-16 text-green-500 mx-auto mb-4"}):e.jsx(h,{className:"h-16 w-16 text-red-500 mx-auto mb-4"}),e.jsx("h1",{className:"text-2xl font-bold text-gray-900 mb-2",children:x.status==="confirmado"?"Presença Confirmada":"Presença Recusada"}),e.jsx("p",{className:"text-sm text-gray-600 mb-6",children:"Você já respondeu esta convocação."}),e.jsx("button",{onClick:()=>window.location.href="/",className:"px-4 py-2 text-sm font-medium text-white bg-primary-600 hover:bg-primary-700 rounded-lg transition-colors",children:"Voltar para o início"})]})})}):e.jsx("div",{className:"min-h-screen bg-gray-50 py-12 px-4",children:e.jsxs("div",{className:"max-w-3xl mx-auto",children:[e.jsxs("div",{className:"bg-white rounded-xl shadow-sm border border-gray-200 p-6 mb-6",children:[e.jsx("h1",{className:"text-3xl font-bold text-gray-900 mb-2",children:"Convocação para Plenária"}),e.jsxs("p",{className:"text-sm text-gray-500",children:["Olá, ",A(D),"!"]})]}),e.jsxs("div",{className:"bg-white rounded-xl shadow-sm border border-gray-200 p-6 mb-6",children:[e.jsx("h2",{className:"text-xl font-semibold text-gray-900 mb-4",children:"Informações da Plenária"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-gray-500",children:"Nome"}),e.jsx("p",{className:"text-base font-medium text-gray-900",children:t.nome||"Sem nome"})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(V,{className:"h-5 w-5 text-gray-400 mt-1"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-gray-500",children:"Data"}),e.jsxs("p",{className:"text-base text-gray-900",children:[p(t.data_inicio),t.data_fim&&` até ${p(t.data_fim)}`]})]})]}),t.hora&&e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(G,{className:"h-5 w-5 text-gray-400 mt-1"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-gray-500",children:"Horário"}),e.jsx("p",{className:"text-base text-gray-900",children:P(t.hora)})]})]}),t.local&&e.jsxs("div",{className:"flex items-start gap-3 md:col-span-2",children:[e.jsx(I,{className:"h-5 w-5 text-gray-400 mt-1"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-gray-500",children:"Local"}),e.jsx("p",{className:"text-base text-gray-900",children:t.local})]})]})]}),t.observacao&&e.jsxs("div",{className:"pt-4 border-t border-gray-200",children:[e.jsx("p",{className:"text-sm font-medium text-gray-500 mb-2",children:"Observação"}),e.jsx("p",{className:"text-base text-gray-900 whitespace-pre-wrap",children:t.observacao})]})]})]}),F?e.jsxs("div",{className:"bg-green-50 border border-green-200 rounded-xl p-6 text-center",children:[e.jsx(b,{className:"h-12 w-12 text-green-500 mx-auto mb-4"}),e.jsx("p",{className:"text-sm font-medium text-green-800",children:x.status==="confirmado"?"Presença confirmada com sucesso!":"Presença recusada. Você foi removido da convocação."}),e.jsx("p",{className:"text-sm text-green-700 mt-2",children:"Redirecionando..."})]}):e.jsxs("div",{className:"bg-white rounded-xl shadow-sm border border-gray-200 p-6",children:[m&&e.jsx("div",{className:"bg-red-50 border border-red-200 rounded-lg p-4 mb-6",children:e.jsx("p",{className:"text-sm text-red-600",children:m})}),e.jsxs("div",{className:"bg-yellow-50 border border-yellow-200 rounded-lg p-4 mb-6",children:[e.jsx("p",{className:"text-sm font-medium text-yellow-800 mb
1-1",children:"Você foi convocado(a) para esta plenária"}),e.jsx("p",{className:"text-sm text-yellow-700",children:"Por favor, confirme se você irá comparecer ou recuse a convocação."})]}),e.jsxs("div",{className:"mb-6",children:[e.jsx("label",{htmlFor:"observacao",className:"block text-sm font-medium text-gray-700 mb-2",children:"Observação (opcional)"}),e.jsx("textarea",{id:"observacao",value:w,onChange:r=>_(r.target.value),rows:4,className:"block w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary-500 focus:border-primary-500 text-sm",placeholder:"Adicione alguma observação sobre sua presença..."})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-stretch sm:items-center justify-end gap-3 pt-4 border-t border-gray-200",children:[e.jsxs("button",{type:"button",onClick:()=>C("recusado"),disabled:j,className:"px-6 py-3 text-sm font-medium text-white bg-red-600 hover:bg-red-700 rounded-lg disabled:opacity-50 disabled:cursor-not-allowed transition-colors flex items-center justify-center gap-2",children:[e.jsx(h,{className:"h-5 w-5"}),"Recusar Convocação"]}),e.jsxs("button",{type:"button",onClick:()=>C("confirmado"),disabled:j,className:"px-6 py-3 text-sm font-medium text-white bg-green-600 hover:bg-green-700 rounded-lg disabled:opacity-50 disabled:cursor-not-allowed transition-colors flex items-center justify-center gap-2",children:[e.jsx(b,{className:"h-5 w-5"}),"Aceitar Convocação"]})]})]})]})})}export{Q 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.