PageSourceSearch

https://crppr.org.br/assets/Protocolos-B1KvEeXQ.js

js crppr.org.br collected 2026-09-25 02:54:39 UTC 6,997 bytes, 1 lines download raw bytes

1import{j as e,c as v}from"./index-BCp-6lKF.js";import{f as w,r as s}from"./vendor-react-CpRvMXaC.js";import{p as k}from"./protocoloService-Cv2DTkSb.js";import{F as g}from"./PlusIcon-DEsYe4eY.js";import"./vendor-pdf-CLXYJc0c.js";import"./vendor-ui-5rZvml82.js";import"./vendor-editor-DoAMYjM7.js";function M(){const o=w(),[m,h]=s.useState([]),[u,x]=s.useState(!0),[n,y]=s.useState(""),[d,b]=s.useState(""),[a,l]=s.useState(1),[r,f]=s.useState(1),j=async()=>{try{x(!0);const t={search:n||void 0,status:d||void 0,per_page:15,page:a},i=await k.listar(t);h(i.data||[]),l(i.current_page||1),f(i.last_page||1)}catch(t){console.error("Erro ao carregar protocolos:",t)}finally{x(!1)}};s.useEffect(()=>{j()},[n,d,a]);const N=t=>{const i={aberto:{bg:"bg-blue-100",text:"text-blue-800",label:"Aberto"},em_andamento:{bg:"bg-purple-100",text:"text-purple-800",label:"Em Andamento"},fechado:{bg:"bg-gray-100",text:"text-gray-800",label:"Finalizado"}},c=i[t]||i.aberto;return e.jsx("span",{className:`px-2 py-1 rounded-full text-xs font-semibold ${c.bg} ${c.text}`,children:c.label})},p=t=>t?new Date(t).toLocaleDateString("pt-BR",{day:"2-digit",month:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit"}):"-";return e.jsx("div",{className:"min-h-screen bg-gray-50 py-8",children:e.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:[e.jsx("div",{className:"mb-8",children:e.jsxs("div",{className:"flex justify-between items-center mb-4",children:[e.jsx("h1",{className:"text-3xl font-bold text-gray-900",children:"Meus Protocolos"}),e.jsxs("button",{onClick:()=>o("/protocolos/novo"),className:"inline-flex items-center px-4 py-2 bg-primary-600 text-white rounded-lg hover:bg-primary-700 transition-colors",children:[e.jsx(g,{className:"h-5 w-5 mr-2"}),"Novo Protocolo"]})]})}),e.jsx("div",{className:"bg-white rounded-lg shadow p-4 mb-6",children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[e.jsxs("div",{className:"relative",children:[e.jsx(v,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-5 w-5 text-gray-400"}),e.jsx("input",{type:"text",placeholder:"Buscar protocolos...",value:n,onChange:t=>y(t.target.value),className:"w-full pl-10 pr-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary-500 focus:border-transparent"})]}),e.jsxs("select",{value:d,onChange:t=>b(t.target.value),className:"px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary-500 focus:border-transparent",children:[e.jsx("option",{value:"",children:"Todos os status"}),e.jsx("option",{value:"aberto",children:"Aberto"}),e.jsx("option",{value:"em_andamento",children:"Em Andamento"}),e.jsx("option",{value:"fechado",children:"Finalizado"})]})]})}),u?e.jsxs("div",{className:"text-center py-12",children:[e.jsx("div",{className:"inline-block animate-spin rounded-full h-8 w-8 border-b-2 border-primary-600"}),e.jsx("p",{className:"mt-2 text-gray-600",children:"Carregando protocolos..."})]}):m.length===0?e.jsxs("div",{className:"bg-white rounded-lg shadow p-12 text-center",children:[e.jsx("p",{className:"text-gray-600 text-lg",children:"Nenhum protocolo encontrado."}),e.jsxs("button",{onClick:()=>o("/protocolos/novo"),className:"mt-4 inline-flex items-center px-4 py-2 bg-primary-600 text-white rounded-lg hover:bg-primary-700 transition-colors",children:[e.jsx(g,{className:"h-5 w-5 mr-2"}),"Criar Primeiro Protocolo"]})]}):e.jsxs("div",{className:"bg-white rounded-lg shadow overflow-hidden",children:[e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"min-w-full divide-y divide-gray-200",children:[e.jsx("thead",{className:"bg-gray-50",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Número"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Título"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Status"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Data Abertura"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Última Resposta"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Ações"})]})}),e.jsx("tbody",{className:"bg-white divide-y divide-gray-200",children:m.map(t=>e.jsxs("tr",{className:"hover:bg-gray-50",children:[e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900",children:t.numero}),e.jsx("td",{className:"px-6 py-4 text-sm text-gray-900",children:t.titulo}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:N(t.status)}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-500",children:p(t.data_abertura)}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-500",children:p(t.data_ultima_resposta)}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm",children:e.jsx("button",{onClick:()=>o(`/protocolos/${t.numero}`),className:"text-primary-600 hover:text-primary-900 font-medium",children:"Ver Detalhes"})})]},t.id))})]})}),r>1&&e.jsxs("div",{className:"bg-gray-50 px-4 py-3 flex items-center justify-between border-t border-gray-200",children:[e.jsxs("div",{className:"flex-1 flex justify-between sm:hidden",children:[e.jsx("button",{onClick:()=>l(t=>Math.max(1,t-1)),disabled:a===1,className:"relative inline-flex items-center px-4 py-2 border border-gray-300 text-sm font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50 disabled:opacity-50",children:"Anterior"}),e.jsx("button",{onClick:()=>l(t=>Math.min(r,t+1)),disabled:a===r,className:"ml-3 relative inline-flex items-center px-4 py-2 border border-gray-300 text-sm font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50 disabled:opacity-50",children:"Próxima"})]}),e.jsxs("div",{className:"hidden sm:flex-1 sm:flex sm:items-center sm:justify-between",children:[e.jsx("div",{children:e.jsxs("p",{className:"text-sm text-gray-700",children:["Página ",e.jsx("span",{className:"font-medium",children:a})," de"," ",e.jsx("span",{className:"font-medium",children:r})]})}),e.jsx("div",{children:e.jsxs("nav",{className:"relative z-0 inline-flex rounded-md shadow-sm -space-x-px","aria-label":"Pagination",children:[e.jsx("button",{onClick:()=>l(t=>Math.max(1,t-1)),disabled:a===1,className:"relative inline-flex items-center px-2 py-2 rounded-l-md border border-gray-300 bg-white text-sm font-medium text-gray-500 hover:bg-gray-50 disabled:opacity-50",children:"Anterior"}),e.jsx("button",{onClick:()=>l(t=>Math.min(r,t+1)),disabled:a===r,className:"relative inline-flex items-center px-2 py-2 rounded-r-md border border-gray-300 bg-white text-sm font-medium text-gray-500 hover:bg-gray-50 disabled:opacity-50",children:"Próxima"})]})})]})]})]})]})})}export{M 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.