|
|
|
@ -3,8 +3,10 @@ |
|
|
|
|
|
|
|
{% load render_bundle from webpack_loader %} |
|
|
|
{% load webpack_static from webpack_loader %} |
|
|
|
|
|
|
|
<!DOCTYPE HTML> |
|
|
|
<!--[if IE 8]> <html class="no-js lt-ie9" lang="pt-br"> <![endif]--> |
|
|
|
<!--[if IE 8]> |
|
|
|
<html class="no-js lt-ie9" lang="pt-br"> <![endif]--> |
|
|
|
<!--[if gt IE 8]><!--> |
|
|
|
<html lang="pt-br"> |
|
|
|
<!--<![endif]--> |
|
|
|
@ -13,12 +15,13 @@ |
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
|
|
|
<!-- TODO: does it need this head_title here? --> |
|
|
|
<title>{% block head_title %}{% trans 'SAPL - Sistema de Apoio ao Processo Legislativo' %}{% endblock %}</title> |
|
|
|
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> |
|
|
|
|
|
|
|
{% block webpack_loader_css %} |
|
|
|
{% render_chunk_vendors 'css' %} |
|
|
|
{% render_bundle 'global' 'css' %} |
|
|
|
{% render_bundle 'painel' 'css' %} |
|
|
|
{% endblock webpack_loader_css %} |
|
|
|
{% block webpack_loader_css %} |
|
|
|
{% render_chunk_vendors 'css' %} |
|
|
|
{% render_bundle 'global' 'css' %} |
|
|
|
{% render_bundle 'painel' 'css' %} |
|
|
|
{% endblock webpack_loader_css %} |
|
|
|
|
|
|
|
|
|
|
|
<style type="text/css"> |
|
|
|
@ -31,336 +34,214 @@ |
|
|
|
list-style-type: none; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
</style> |
|
|
|
</head> |
|
|
|
<body class="painel-principal"> |
|
|
|
<audio type="hidden" id="audio" src="{% webpack_static 'audio/ring.mp3' %}"></audio> |
|
|
|
|
|
|
|
<div class="d-flex justify-content-center"> |
|
|
|
<h1 id="sessao_plenaria" class="title text-title"></h1> |
|
|
|
</div> |
|
|
|
<div class="row "> |
|
|
|
<div class="col text-center"> |
|
|
|
<span id="sessao_plenaria_data" class="text-value"></span> |
|
|
|
<body class="painel-principal"> |
|
|
|
|
|
|
|
<!--<div id="display">00:00:00.00</div>--> |
|
|
|
<!--<button id="startBtn">Start</button>--> |
|
|
|
<!--<button id="stopBtn">Stop</button>--> |
|
|
|
<!--<button id="resumeBtn">Resume</button>--> |
|
|
|
<!--<button id="resetBtn">Reset</button>--> |
|
|
|
|
|
|
|
<audio type="hidden" id="alarm" src="{% webpack_static 'audio/ring.mp3' %}"></audio> |
|
|
|
|
|
|
|
<div class="d-flex justify-content-center"> |
|
|
|
<h1 id="sessao_plenaria" class="title text-title"></h1> |
|
|
|
</div> |
|
|
|
|
|
|
|
<div class="row "> |
|
|
|
<div class="col text-center"> |
|
|
|
<span id="sessao_plenaria_data" class="text-value"></span> |
|
|
|
</div> |
|
|
|
<div class="col text-center"> |
|
|
|
<span id="sessao_plenaria_hora_inicio" class="text-value"></span> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
{% block vue_content %} |
|
|
|
<div id="painel" class="col text-center"> |
|
|
|
<div v-for="parlamentar in parlamentares" class="text-value"> |
|
|
|
<strong>[[ parlamentar.nome ]]</strong> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
{% endblock %} |
|
|
|
|
|
|
|
<div class="row justify-content-center"> |
|
|
|
<div class="col-1"> |
|
|
|
<img src="" id="logo-painel" class="logo-painel" alt=""/> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
<div class="row justify-content-center"> |
|
|
|
<h2 class="text-danger"><span id="message"></span></h2> |
|
|
|
</div> |
|
|
|
|
|
|
|
<div class="row"> |
|
|
|
<div class="col text-center"><span class="text-value data-hora" id="date"></span></div> |
|
|
|
<div class="col text-center"><span class="text-value data-hora" id="relogio"></span></div> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<div class=""> |
|
|
|
<div class="d-flex justify-content-start"> |
|
|
|
<div class="col-md-4"> |
|
|
|
<div class="text-center painel"> |
|
|
|
<h2 class="text-subtitle">Parlamentares</h2> |
|
|
|
<span id="parlamentares" class="text-value text-center"></span> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="col text-center"> |
|
|
|
<span id="sessao_plenaria_hora_inicio" class="text-value"></span> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
<div class="row justify-content-center"> |
|
|
|
<div class="col-1"> |
|
|
|
<img src="" id="logo-painel" class="logo-painel" alt=""/> |
|
|
|
<div class="d-flex col-md-8 painels"> |
|
|
|
<div class="col-md-6 text-center painel" id="aparecer_oradores"> |
|
|
|
<h2 class="text-subtitle">Oradores</h2> |
|
|
|
<span id="orador"></span> |
|
|
|
</div> |
|
|
|
|
|
|
|
<div class="col-md-6 text-left painel"> |
|
|
|
<div class="d-flex align-items-left justify-content-left mb-2"> |
|
|
|
<h2 class="text-subtitle mb-0">Cronômetros</h2> |
|
|
|
<button class="btn btn-sm btn-secondary ms-2" onclick="changeFontSize('box_cronometros', -1)"> |
|
|
|
A- |
|
|
|
</button> |
|
|
|
<button class="btn btn-sm btn-secondary ms-2" onclick="changeFontSize('box_cronometros', 1)"> |
|
|
|
A+ |
|
|
|
</button> |
|
|
|
</div> |
|
|
|
<div class="text-value" id="box_cronometros"> |
|
|
|
Discurso: <span id="cronometro_discurso"></span><br> |
|
|
|
Aparte: <span id="cronometro_aparte"></span><br> |
|
|
|
Questão de Ordem: <span id="cronometro_ordem"></span><br> |
|
|
|
Considerações Finais: <span id="cronometro_consideracoes"></span> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
<div class="col-md-6 text-left painel" id="resultado_votacao_div"> |
|
|
|
<div class="d-flex align-items-left justify-content-left mb-2"> |
|
|
|
<h2 class="text-subtitle mb-0">Resultado</h2> |
|
|
|
<button class="btn btn-sm btn-secondary ms-2" onclick="changeFontSize('box_votacao', -1)"> |
|
|
|
A- |
|
|
|
</button> |
|
|
|
<button class="btn btn-sm btn-secondary ms-2" onclick="changeFontSize('box_votacao', 1)"> |
|
|
|
A+ |
|
|
|
</button> |
|
|
|
</div> |
|
|
|
<div id="box_votacao"> |
|
|
|
<span id="votacao" class="text-value"></span> |
|
|
|
<span id="resultado_votacao" lass="text-title"></span> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
<div class="col-md-6 text-center painel" id="obs_materia_div"> |
|
|
|
<h2 class="text-subtitle" id="mat_em_votacao">Matéria em Votação</h2> |
|
|
|
<span id="materia_legislativa_texto" class="text-value"></span> |
|
|
|
<br> |
|
|
|
<span id="materia_legislativa_ementa" class="text-value"></span> |
|
|
|
<br> |
|
|
|
<span id="observacao_materia" class="text-value"></span> |
|
|
|
</div> |
|
|
|
|
|
|
|
<div class="col-md-6 text-center painel" id="tema_solene_div" style="display: none"> |
|
|
|
<h2 class="text-subtitle">Tema da Sessão Solene</h2> |
|
|
|
<span id="sessao_solene_tema" class="text-value"></span> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
<div class="row justify-content-center"> |
|
|
|
<h2 class="text-danger"><span id="message"></span></h2> |
|
|
|
</div> |
|
|
|
|
|
|
|
<div class="row"> |
|
|
|
<div class="col text-center"><span class="text-value data-hora" id="date"></span></div> |
|
|
|
<div class="col text-center"><span class="text-value data-hora" id="relogio"></span></div> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<div class=""> |
|
|
|
<div class="d-flex justify-content-start"> |
|
|
|
<div class="col-md-4"> |
|
|
|
<div class="text-center painel"> |
|
|
|
<h2 class="text-subtitle">Parlamentares</h2> |
|
|
|
<span id="parlamentares" class="text-value text-center"></span> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="d-flex col-md-8 painels"> |
|
|
|
<div class="col-md-6 text-center painel" id="aparecer_oradores"> |
|
|
|
<h2 class="text-subtitle">Oradores</h2> |
|
|
|
<span id="orador"></span> |
|
|
|
</div> |
|
|
|
|
|
|
|
<div class="col-md-6 text-left painel"> |
|
|
|
<div class="d-flex align-items-left justify-content-left mb-2"> |
|
|
|
<h2 class="text-subtitle mb-0">Cronômetros</h2> |
|
|
|
<button class="btn btn-sm btn-secondary ms-2" onclick="changeFontSize('box_cronometros', -1)"> |
|
|
|
A- |
|
|
|
</button> |
|
|
|
<button class="btn btn-sm btn-secondary ms-2" onclick="changeFontSize('box_cronometros', 1)"> |
|
|
|
A+ |
|
|
|
</button> |
|
|
|
</div> |
|
|
|
<div class="text-value" id="box_cronometros"> |
|
|
|
Discurso: <span id="cronometro_discurso"></span><br> |
|
|
|
Aparte: <span id="cronometro_aparte"></span><br> |
|
|
|
Questão de Ordem: <span id="cronometro_ordem"></span><br> |
|
|
|
Considerações Finais: <span id="cronometro_consideracoes"></span> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
<div class="col-md-6 text-left painel" id="resultado_votacao_div"> |
|
|
|
<div class="d-flex align-items-left justify-content-left mb-2"> |
|
|
|
<h2 class="text-subtitle mb-0">Resultado</h2> |
|
|
|
<button class="btn btn-sm btn-secondary ms-2" onclick="changeFontSize('box_votacao', -1)"> |
|
|
|
A- |
|
|
|
</button> |
|
|
|
<button class="btn btn-sm btn-secondary ms-2" onclick="changeFontSize('box_votacao', 1)"> |
|
|
|
A+ |
|
|
|
</button> |
|
|
|
</div> |
|
|
|
<div id="box_votacao"> |
|
|
|
<span id="votacao" class="text-value"></span> |
|
|
|
<span id="resultado_votacao" lass="text-title"></span> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
<div class="col-md-6 text-center painel" id="obs_materia_div"> |
|
|
|
<h2 class="text-subtitle" id="mat_em_votacao">Matéria em Votação</h2> |
|
|
|
<span id="materia_legislativa_texto" class="text-value"></span> |
|
|
|
<br> |
|
|
|
<span id="materia_legislativa_ementa" class="text-value"></span> |
|
|
|
<br> |
|
|
|
<span id="observacao_materia" class="text-value"></span> |
|
|
|
</div> |
|
|
|
|
|
|
|
<div class="col-md-6 text-center painel" id="tema_solene_div" style="display: none"> |
|
|
|
<h2 class="text-subtitle">Tema da Sessão Solene</h2> |
|
|
|
<span id="sessao_solene_tema" class="text-value"></span> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</body> |
|
|
|
{% block webpack_loader_js %} |
|
|
|
{% render_chunk_vendors 'js' %} |
|
|
|
{% render_bundle 'global' 'js' %} |
|
|
|
{% render_bundle 'painel' 'js' %} |
|
|
|
{% endblock webpack_loader_js %} |
|
|
|
|
|
|
|
{% block webpack_loader_chunks_js %} |
|
|
|
{% endblock webpack_loader_chunks_js %} |
|
|
|
<script> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</body> |
|
|
|
{% block webpack_loader_js %} |
|
|
|
{% render_chunk_vendors 'js' %} |
|
|
|
{% render_bundle 'global' 'js' %} |
|
|
|
{% render_bundle 'painel' 'js' %} |
|
|
|
{% endblock webpack_loader_js %} |
|
|
|
|
|
|
|
{% block webpack_loader_chunks_js %} |
|
|
|
{% endblock webpack_loader_chunks_js %} |
|
|
|
<script> |
|
|
|
$(document).ready(function() { |
|
|
|
const controllerId = "{{ controller_id }}"; |
|
|
|
const proto = location.protocol === "https:" ? "wss" : "ws"; |
|
|
|
let ws, backoff = 500, timer; |
|
|
|
let ws, backoff = 500, connTimer; |
|
|
|
const url = `${proto}://${location.host}/ws/painel/${controllerId}/` |
|
|
|
|
|
|
|
function update_view(data) { |
|
|
|
$("#sessao_plenaria").text(data["sessao_plenaria"]) |
|
|
|
$("#sessao_plenaria_data").text("Data Início: " + data["sessao_plenaria_data"]) |
|
|
|
$("#sessao_plenaria_hora_inicio").text("Hora Início: " + data["sessao_plenaria_hora_inicio"]) |
|
|
|
$("#sessao_solene_tema").text(data["tema_solene"]) |
|
|
|
if (data["status_painel"] == false) { |
|
|
|
console.log(data) |
|
|
|
let sessao = data.sessao |
|
|
|
|
|
|
|
// DADOS SESSAO |
|
|
|
$("#sessao_plenaria").text(sessao.sessao_plenaria) |
|
|
|
$("#sessao_plenaria_data").text("Data Início: " + sessao.sessao_plenaria_data) |
|
|
|
$("#sessao_plenaria_hora_inicio").text("Hora Início: " + sessao.sessao_plenaria_hora_inicio) |
|
|
|
$("#sessao_solene_tema").text(sessao.tema_solene) |
|
|
|
|
|
|
|
|
|
|
|
// PANEL CONFIG |
|
|
|
if (sessao.status_painel === false) { |
|
|
|
$("#message").text("PAINEL ENCONTRA-SE FECHADO"); |
|
|
|
} |
|
|
|
else { |
|
|
|
$("#message").text(""); |
|
|
|
} |
|
|
|
|
|
|
|
if (data["sessao_solene"]){ |
|
|
|
if (sessao.sessao_solene){ |
|
|
|
$("#resultado_votacao_div").hide(); |
|
|
|
$("#obs_materia_div").hide(); |
|
|
|
$('#tema_solene_div').show(); |
|
|
|
} |
|
|
|
|
|
|
|
if (data["brasao"] != null) |
|
|
|
$("#logo-painel").attr("src", data["brasao"]); |
|
|
|
if (sessao.brasao != null) |
|
|
|
$("#logo-painel").attr("src", sessao.brasao); |
|
|
|
|
|
|
|
// PARLAMENTARES |
|
|
|
var presentes_list = data.presentes; |
|
|
|
var presentes = $("#parlamentares"); |
|
|
|
var votacao = $("#votacao"); |
|
|
|
var oradores = $("#orador") |
|
|
|
$("#votacao").text(''); |
|
|
|
presentes.children().remove(); |
|
|
|
votacao.children().remove(); |
|
|
|
oradores.children().remove(); |
|
|
|
|
|
|
|
var oradores_list = data["oradores"]; |
|
|
|
var presentes_list = data["presentes"]; |
|
|
|
|
|
|
|
if (data["status_painel"] == true) { |
|
|
|
mostrar_voto = data["mostrar_voto"]; |
|
|
|
presentes.append('<table id="parlamentares_list">'); |
|
|
|
$.each(presentes_list, function (index, parlamentar) { |
|
|
|
|
|
|
|
|
|
|
|
if (parlamentar.voto == 'Voto Informado' && mostrar_voto == false){ |
|
|
|
$('#parlamentares_list').append('<tr><td style="padding-right:20px; color:yellow" >' + |
|
|
|
parlamentar.nome + |
|
|
|
console.log(presentes_list.length); |
|
|
|
presentes.append('<table id="parlamentares_list">'); |
|
|
|
$.each(presentes_list, function (index, parlamentar) { |
|
|
|
$('#parlamentares_list').append('<tr><td style="padding-right:20px; color:yellow" >' + |
|
|
|
parlamentar.nome_parlamentar + |
|
|
|
'</td> <td style="padding-right:20px; color:yellow">' + |
|
|
|
parlamentar.partido + '</td> <td style="padding-right:20px; color:yellow">' |
|
|
|
+ '</td></tr>') |
|
|
|
} |
|
|
|
else{ |
|
|
|
$('#parlamentares_list').append(show_voto(parlamentar)) |
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
presentes.append('</table>') |
|
|
|
|
|
|
|
if (data["oradores"].length > 0){ |
|
|
|
$('#aparecer_oradores').show(); |
|
|
|
oradores.append('<table id="oradores_list">'); |
|
|
|
$.each(oradores_list, function (index, orador) { |
|
|
|
$('#oradores_list').append('<tr><td style="padding-right:20px; color:white" >' + |
|
|
|
orador.numero + 'º  ' + |
|
|
|
orador.nome +'</td></tr>') |
|
|
|
}); |
|
|
|
oradores.append('</table>'); |
|
|
|
} |
|
|
|
else { |
|
|
|
$('#aparecer_oradores').hide(); |
|
|
|
} |
|
|
|
} |
|
|
|
else{ |
|
|
|
presentes.append('<span style="color:white" id="parlamentares_list">'); |
|
|
|
$('#parlamentares_list').append( |
|
|
|
'<center>A listagem de parlamentares só aparecerá quando o painel estiver aberto.</center>') |
|
|
|
presentes.append('</span>'); |
|
|
|
|
|
|
|
oradores.append('<span style="color:white" id="oradores_list">'); |
|
|
|
$('#oradores_list').append( |
|
|
|
'<center>A listagem de oradores só aparecerá quando o painel estiver aberto.</center>') |
|
|
|
oradores.append('</span>'); |
|
|
|
|
|
|
|
votacao.append('<span id="votacao">'); |
|
|
|
$("#votacao").append('<center>A votação só aparecerá quando o painel estiver aberto</center>'); |
|
|
|
votacao.append('</span>'); |
|
|
|
} |
|
|
|
|
|
|
|
if(data["status_painel"]){ |
|
|
|
if (data['materia_legislativa_texto']){ |
|
|
|
var votacao = $("#votacao"); |
|
|
|
|
|
|
|
votacao.append("<li>Sim: " + data["numero_votos_sim"] + "</li>"); |
|
|
|
votacao.append("<li>Não: " + data["numero_votos_nao"] + "</li>"); |
|
|
|
votacao.append("<li>Abstenções: " + data["numero_abstencoes"] + "</li>"); |
|
|
|
votacao.append("<li>Presentes: " + data["num_presentes"] + "</li>"); |
|
|
|
votacao.append("<li>Total votos: " + data["total_votos"] + "</li>"); |
|
|
|
} |
|
|
|
else{ |
|
|
|
$("#votacao").append('<center>Não há votação, pois não há nenhuma matéria aberta ou já votada.</center>'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
var discurso_current = data["cronometro_discurso"]; |
|
|
|
if (!discurso_previous){ |
|
|
|
discurso_previous = '' |
|
|
|
} |
|
|
|
|
|
|
|
if (discurso_current != discurso_previous) { |
|
|
|
$('#cronometro_discurso').runner(discurso_current); |
|
|
|
discurso_previous = discurso_current; |
|
|
|
} |
|
|
|
|
|
|
|
var aparte_current = data["cronometro_aparte"]; |
|
|
|
if (!aparte_previous){ |
|
|
|
aparte_previous = '' |
|
|
|
} |
|
|
|
|
|
|
|
if (aparte_current != aparte_previous) { |
|
|
|
$('#cronometro_aparte').runner(aparte_current); |
|
|
|
aparte_previous = aparte_current; |
|
|
|
} |
|
|
|
|
|
|
|
var ordem_current = data["cronometro_ordem"]; |
|
|
|
if (!ordem_previous){ |
|
|
|
ordem_previous = '' |
|
|
|
} |
|
|
|
|
|
|
|
if (ordem_current != ordem_previous) { |
|
|
|
$('#cronometro_ordem').runner(ordem_current); |
|
|
|
ordem_previous = ordem_current; |
|
|
|
} |
|
|
|
|
|
|
|
var consideracoes_current = data["cronometro_consideracoes"]; |
|
|
|
if (!consideracoes_previous){ |
|
|
|
consideracoes_previous = '' |
|
|
|
} |
|
|
|
parlamentar.filiacao + '</td> <td style="padding-right:20px; color:yellow">' |
|
|
|
+ '</td></tr>'); |
|
|
|
}); |
|
|
|
|
|
|
|
if (consideracoes_current != consideracoes_previous) { |
|
|
|
$('#cronometro_consideracoes').runner(consideracoes_current); |
|
|
|
consideracoes_previous = consideracoes_current; |
|
|
|
} |
|
|
|
|
|
|
|
if($('#cronometro_discurso').runner('info').formattedTime == "00:00:30") { |
|
|
|
audioAlertFinish.play(); |
|
|
|
} |
|
|
|
|
|
|
|
if($('#cronometro_aparte').runner('info').formattedTime == "00:00:30") { |
|
|
|
audioAlertFinish.play(); |
|
|
|
} |
|
|
|
// VOTOS |
|
|
|
var votos = data.votacao; |
|
|
|
var votacao = $("#votacao"); |
|
|
|
// retornar o total no JSON |
|
|
|
let total_votos = votos["sim"] + votos["não"] + votos["abstencoes"] |
|
|
|
|
|
|
|
if($('#cronometro_ordem').runner('info').formattedTime == "00:00:30") { |
|
|
|
audioAlertFinish.play(); |
|
|
|
} |
|
|
|
votacao.append("<li>Sim: " + votos["sim"] + "</li>"); |
|
|
|
votacao.append("<li>Não: " + votos["não"] + "</li>"); |
|
|
|
votacao.append("<li>Abstenções: " + votos["abstencoes"] + "</li>"); |
|
|
|
votacao.append("<li>Presentes: " + presentes_list.length + "</li>"); |
|
|
|
votacao.append("<li>Total votos: " + total_votos + "</li>"); |
|
|
|
|
|
|
|
if($('#cronometro_consideracoes').runner('info').formattedTime == "00:00:30") { |
|
|
|
audioAlertFinish.play(); |
|
|
|
} |
|
|
|
// ORADORES |
|
|
|
var oradores_list = data.oradores; |
|
|
|
var oradores = $("#orador") |
|
|
|
oradores.children().remove(); |
|
|
|
|
|
|
|
if(data['sessao_finalizada']){ |
|
|
|
$("#obs_materia_div").hide(); |
|
|
|
$("#resultado_votacao_div").hide(); |
|
|
|
if (oradores_list.length > 0){ |
|
|
|
$('#aparecer_oradores').show(); |
|
|
|
oradores.append('<table id="oradores_list">'); |
|
|
|
$.each(oradores_list, function (index, orador) { |
|
|
|
$('#oradores_list').append('<tr><td style="padding-right:20px; color:white" >' + |
|
|
|
orador.ordem_pronunciamento + 'º  ' + |
|
|
|
orador.nome_parlamentar +'</td></tr>') |
|
|
|
}); |
|
|
|
oradores.append('</table>'); |
|
|
|
} |
|
|
|
else if (data['materia_legislativa_texto']){ |
|
|
|
if (data["status_painel"] == true){ |
|
|
|
$("#materia_legislativa_texto").text(data["materia_legislativa_texto"]); |
|
|
|
$("#materia_legislativa_ementa").text(data["materia_legislativa_ementa"]); |
|
|
|
} |
|
|
|
else{ |
|
|
|
$("#materia_legislativa_texto").text('A Matéria em votação só aparecerá quando o painel estiver aberto'); |
|
|
|
} |
|
|
|
} |
|
|
|
else{ |
|
|
|
$("#materia_legislativa_texto").text('Não há nenhuma matéria votada ou para votação.'); |
|
|
|
else { |
|
|
|
$('#aparecer_oradores').hide(); |
|
|
|
} |
|
|
|
|
|
|
|
if (data['observacao_materia'] && data["status_painel"] == true){ |
|
|
|
var texto = data['observacao_materia']; |
|
|
|
if(texto.length > 151) { |
|
|
|
$("#observacao_materia").text(texto.substr(0, 145).concat('(...)')); |
|
|
|
} |
|
|
|
else{ |
|
|
|
$("#observacao_materia").text(texto); |
|
|
|
} |
|
|
|
} |
|
|
|
else{ |
|
|
|
$("#observacao_materia").text(''); |
|
|
|
} |
|
|
|
if (data['tipo_resultado'] && data['status_painel'] == true){ |
|
|
|
if(data['tipo_votacao'] != 'Leitura' && !data['sessao_finalizada'] && !data["sessao_solene"]){ |
|
|
|
$("#resultado_votacao").css("color", "#45919D"); |
|
|
|
$("#mat_em_votacao").text("Matéria em Votação"); |
|
|
|
$("#resultado_votacao_div").show(); |
|
|
|
} |
|
|
|
else{ |
|
|
|
$("#resultado_votacao_div").hide(); |
|
|
|
$("#mat_em_votacao").text("Matéria em Leitura"); |
|
|
|
} |
|
|
|
console.log(data["tipo_resultado"], data['tipo_votacao']); |
|
|
|
$("#resultado_votacao").text(data["tipo_resultado"]); |
|
|
|
|
|
|
|
var resultado_votacao_upper = $("#resultado_votacao").text().toUpperCase(); |
|
|
|
console.log(resultado_votacao_upper, data['tipo_resultado']); |
|
|
|
if (resultado_votacao_upper.search("APROV") != -1){ |
|
|
|
$("#resultado_votacao").css("color", "#7CFC00"); |
|
|
|
$("#mat_em_votacao").text("Matéria Votada"); |
|
|
|
} |
|
|
|
else if (resultado_votacao_upper.search("REJEIT") != -1){ |
|
|
|
$("#resultado_votacao").css("color", "red"); |
|
|
|
$("#mat_em_votacao").text("Matéria Votada"); |
|
|
|
} |
|
|
|
else if (resultado_votacao_upper.search("LIDA") != -1){ |
|
|
|
$("#mat_em_votacao").text("Matéria Lida"); |
|
|
|
} |
|
|
|
} |
|
|
|
else{ |
|
|
|
$("#resultado_votacao").text(''); |
|
|
|
if(data['tipo_votacao'] != 'Leitura') |
|
|
|
$("#mat_em_votacao").text("Matéria em Votação"); |
|
|
|
else{ |
|
|
|
$("#mat_em_votacao").text("Matéria em Leitura"); |
|
|
|
} |
|
|
|
} |
|
|
|
// Matéria |
|
|
|
$("#materia_legislativa_texto").text(data["materia_legislativa_texto"]); |
|
|
|
$("#materia_legislativa_ementa").text(data["materia_legislativa_ementa"]); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -373,7 +254,7 @@ |
|
|
|
ws.onopen = function () { |
|
|
|
console.log("✅ WebSocket connected"); |
|
|
|
// Optionally send an initial message to the server |
|
|
|
ws.send(JSON.stringify({ type: "hello", message: "Client connected" })); |
|
|
|
ws.send(JSON.stringify({ type: "echo", message: "Client connected" })); |
|
|
|
|
|
|
|
// Ping keep-alive |
|
|
|
pingTimer = setInterval(() => { |
|
|
|
@ -390,9 +271,18 @@ |
|
|
|
if (data.type === "data") { |
|
|
|
console.log("📩 Message from server:", data); |
|
|
|
update_view(data); |
|
|
|
//if (data.text) { |
|
|
|
// document.getElementById("output").textContent = data.text; |
|
|
|
//} |
|
|
|
} |
|
|
|
if (data.type == "notify") { |
|
|
|
console.log("command from backend:", data); |
|
|
|
if (data.stopwatch === "start") { |
|
|
|
startTimer(); |
|
|
|
} else if (data.stopwatch === "stop") { |
|
|
|
stopTimer(); |
|
|
|
} else if (data.stopwatch === "resume") { |
|
|
|
resumeTimer(); |
|
|
|
} else if (data.stopwatch === "reset") { |
|
|
|
resetTimer(); |
|
|
|
} |
|
|
|
} |
|
|
|
} catch (e) { |
|
|
|
console.error(e); |
|
|
|
@ -404,10 +294,10 @@ |
|
|
|
console.log("❌ WebSocket closed:", event); |
|
|
|
|
|
|
|
clearInterval(pingTimer); |
|
|
|
clearTimeout(timer); |
|
|
|
clearTimeout(connTimer); |
|
|
|
|
|
|
|
// retry with capped exponential backoff |
|
|
|
timer = setTimeout(connect, Math.min(backoff, 10000)); |
|
|
|
connTimer = setTimeout(connect, Math.min(backoff, 10000)); |
|
|
|
backoff *= 2; |
|
|
|
}; |
|
|
|
|
|
|
|
@ -417,7 +307,78 @@ |
|
|
|
}; |
|
|
|
} |
|
|
|
|
|
|
|
let startTime = 0; |
|
|
|
let elapsed = 0; |
|
|
|
let timer = null; |
|
|
|
let durationMs = 1 * 60 * 1000; // <-- initial time (1 minutes) |
|
|
|
let remaining = durationMs; |
|
|
|
let alarmPlayed = false; |
|
|
|
|
|
|
|
$("#cronometro_discurso").text(formatTime(durationMs)); |
|
|
|
|
|
|
|
function formatTime(ms) { |
|
|
|
const totalSeconds = Math.floor(ms / 1000); |
|
|
|
const hours = String(Math.floor(totalSeconds / 3600)).padStart(2, '0'); |
|
|
|
const minutes = String(Math.floor((totalSeconds % 3600) / 60)).padStart(2, '0'); |
|
|
|
const seconds = String(totalSeconds % 60).padStart(2, '0'); |
|
|
|
const centis = String(Math.floor((ms % 1000) / 10)).padStart(2, '0'); |
|
|
|
return `${hours}:${minutes}:${seconds}.${centis}`; |
|
|
|
} |
|
|
|
|
|
|
|
function updateDisplay() { |
|
|
|
const now = Date.now(); |
|
|
|
const diff = remaining - (now - startTime); |
|
|
|
const display = Math.max(0, diff); |
|
|
|
$("#cronometro_discurso").text(formatTime(display)); |
|
|
|
|
|
|
|
if (diff <= 0 && !alarmPlayed) { |
|
|
|
alarmPlayed = true; |
|
|
|
$("#alarm")[0].play(); |
|
|
|
clearInterval(timer); |
|
|
|
timer = null; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
function startTimer() { |
|
|
|
console.log("start"); |
|
|
|
if (timer) return; |
|
|
|
alarmPlayed = false; |
|
|
|
startTime = Date.now(); |
|
|
|
timer = setInterval(updateDisplay, 10); |
|
|
|
} |
|
|
|
|
|
|
|
function stopTimer() { |
|
|
|
if (!timer) return; |
|
|
|
clearInterval(timer); |
|
|
|
timer = null; |
|
|
|
remaining -= Date.now() - startTime; |
|
|
|
} |
|
|
|
|
|
|
|
function resumeTimer() { |
|
|
|
if (timer) return; |
|
|
|
startTime = Date.now(); |
|
|
|
timer = setInterval(updateDisplay, 10); |
|
|
|
} |
|
|
|
|
|
|
|
function resetTimer() { |
|
|
|
clearInterval(timer); |
|
|
|
timer = null; |
|
|
|
remaining = durationMs; |
|
|
|
alarmPlayed = false; |
|
|
|
$("#cronometro_discurso").text(formatTime(remaining)); |
|
|
|
} |
|
|
|
|
|
|
|
// Bind buttons |
|
|
|
/* |
|
|
|
$("#startBtn").click(startTimer); |
|
|
|
$("#stopBtn").click(stopTimer); |
|
|
|
$("#resumeBtn").click(resumeTimer); |
|
|
|
$("#resetBtn").click(resetTimer); |
|
|
|
*/ |
|
|
|
|
|
|
|
// ENTRYPOINT |
|
|
|
connect(); |
|
|
|
</script> |
|
|
|
}) |
|
|
|
|
|
|
|
</script> |
|
|
|
</html> |