Spaces:
Build error
Build error
| <html lang="pt-br"> | |
| <head> | |
| <meta charset="UTF-8" /> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
| <title>Consulta de Processo - Monitoramento Judicial</title> | |
| <style> | |
| body { | |
| margin: 0; | |
| font-family: 'Segoe UI', sans-serif; | |
| background-color: #f4f6f8; | |
| color: #333; | |
| } | |
| header { | |
| background-color: #1e3a8a; | |
| color: white; | |
| padding: 15px 30px; | |
| display: flex; | |
| justify-content: space-between; | |
| align-items: center; | |
| } | |
| header h1 { | |
| margin: 0; | |
| font-size: 1.5rem; | |
| } | |
| nav button { | |
| background-color: white; | |
| color: #1e3a8a; | |
| font-size: 1rem; | |
| padding: 8px 16px; | |
| margin-left: 20px; | |
| border: none; | |
| border-radius: 4px; | |
| cursor: pointer; | |
| } | |
| nav button:hover { | |
| background-color: #f0f0f0; | |
| } | |
| .container { | |
| max-width: 700px; | |
| margin: 50px auto; | |
| padding: 20px; | |
| background: white; | |
| border-radius: 8px; | |
| box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); | |
| } | |
| h2 { | |
| text-align: center; | |
| } | |
| .form-group { | |
| margin-bottom: 20px; | |
| } | |
| .form-group label { | |
| display: block; | |
| margin-bottom: 5px; | |
| } | |
| .form-group input, .form-group select { | |
| width: 100%; | |
| padding: 10px; | |
| font-size: 1rem; | |
| border: 1px solid #ccc; | |
| border-radius: 4px; | |
| } | |
| button.submit { | |
| background-color: #1e3a8a; | |
| color: white; | |
| padding: 10px 20px; | |
| font-size: 1rem; | |
| border: none; | |
| border-radius: 4px; | |
| cursor: pointer; | |
| } | |
| button.submit:hover { | |
| background-color: #163c74; | |
| } | |
| .result { | |
| margin-top: 30px; | |
| } | |
| .movimentacao { | |
| background-color: #eef2f7; | |
| padding: 10px 15px; | |
| border-radius: 6px; | |
| margin-bottom: 10px; | |
| } | |
| .data { | |
| font-weight: bold; | |
| color: #1e3a8a; | |
| } | |
| #verMaisBtn { | |
| background-color: #d3d3d3; | |
| border: none; | |
| border-radius: 4px; | |
| padding: 8px 16px; | |
| margin: 20px auto 0; | |
| display: none; | |
| cursor: pointer; | |
| font-size: 0.95rem; | |
| } | |
| #carregando { | |
| text-align: center; | |
| margin-top: 20px; | |
| font-weight: bold; | |
| color: #1e3a8a; | |
| } | |
| </style> | |
| </head> | |
| <body> | |
| <header> | |
| <h1>Consulta de Processo</h1> | |
| <nav> | |
| <button onclick="window.location.href='/dashboard'">Dashboard</button> | |
| <button onclick="logout()">Sair</button> | |
| </nav> | |
| </header> | |
| <div class="container"> | |
| <h2>Consultar Processo no Tribunal</h2> | |
| <div class="form-group"> | |
| <label for="uf">UF:</label> | |
| <select id="uf"> | |
| <option value="PR">PR</option> | |
| <option value="SC">SC</option> | |
| <option value="SP">SP</option> | |
| </select> | |
| </div> | |
| <div class="form-group"> | |
| <label for="process-number">Número do Processo:</label> | |
| <input type="text" id="process-number" placeholder="0000000-00.0000.0.00.0000"> | |
| </div> | |
| <button class="submit" onclick="consultarProcesso()">Consultar</button> | |
| <div id="carregando"></div> | |
| <div id="resultado" class="result"></div> | |
| <button id="verMaisBtn" onclick="alternarVerMais()">Ver mais</button> | |
| </div> | |
| <script> | |
| const token = localStorage.getItem('token'); | |
| function logout() { | |
| localStorage.clear(); | |
| window.location.href = '/'; | |
| } | |
| let todasMovimentacoes = []; | |
| let mostrandoTodas = false; | |
| function renderizarMovimentacoes() { | |
| const resultado = document.getElementById("resultado"); | |
| resultado.innerHTML = ""; | |
| const movimentacoesParaMostrar = mostrandoTodas | |
| ? todasMovimentacoes | |
| : todasMovimentacoes.slice(0, 5); | |
| movimentacoesParaMostrar.forEach(mov => { | |
| const div = document.createElement("div"); | |
| div.className = "movimentacao"; | |
| const data = mov.data || mov.data_hora || ""; | |
| const evento = mov.evento || ""; | |
| const descricao = mov.descricao || evento; | |
| const documentos = mov.documentos || ""; | |
| div.innerHTML = ` | |
| <div class="data">${data}</div> | |
| <div style="white-space: pre-wrap; margin: 5px 0;">${descricao}</div> | |
| ${documentos ? `<a href="${documentos}" target="_blank" style="color: #1e3a8a; text-decoration: none;">📄 Ver documento</a>` : ""} | |
| `; | |
| resultado.appendChild(div); | |
| }); | |
| const verMaisBtn = document.getElementById("verMaisBtn"); | |
| if (todasMovimentacoes.length > 5) { | |
| verMaisBtn.style.display = "block"; | |
| verMaisBtn.textContent = mostrandoTodas ? "Ver menos" : "Ver mais"; | |
| } else { | |
| verMaisBtn.style.display = "none"; | |
| } | |
| } | |
| function alternarVerMais() { | |
| mostrandoTodas = !mostrandoTodas; | |
| renderizarMovimentacoes(); | |
| } | |
| async function consultarProcesso() { | |
| const uf = document.getElementById('uf').value; | |
| const numero = document.getElementById('process-number').value; | |
| document.getElementById("carregando").innerText = "Consultando processo..."; | |
| document.getElementById("resultado").innerHTML = ""; | |
| document.getElementById("verMaisBtn").style.display = "none"; | |
| try { | |
| const res = await fetch(`/api/monitoramento-processual/consulta/tjs?uf=${uf}&process_number=${encodeURIComponent(numero)}`, { | |
| headers: { 'Authorization': `Bearer ${token}` } | |
| }); | |
| const data = await res.json(); | |
| todasMovimentacoes = data?.results?.movimentacoes || []; | |
| mostrandoTodas = false; | |
| renderizarMovimentacoes(); | |
| } catch (e) { | |
| document.getElementById("resultado").innerText = "Erro ao consultar processo."; | |
| } finally { | |
| document.getElementById("carregando").innerText = ""; | |
| } | |
| } | |
| </script> | |
| </body> | |
| </html> | |