mirror of https://github.com/interlegis/sapl.git
				
				
			
			You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							114 lines
						
					
					
						
							4.5 KiB
						
					
					
				
			
		
		
		
			
			
			
		
		
	
	
							114 lines
						
					
					
						
							4.5 KiB
						
					
					
				| {% load i18n %}                                                                                                               | |
| {% load staticfiles %} | |
| <!DOCTYPE HTML> | |
| <!--[if IE 8]> <html class="no-js lt-ie9" lang="en"> <![endif]--> | |
| <!--[if gt IE 8]><!--> | |
| <html lang="en"> | |
| <!--<![endif]--> | |
| 
 | |
|     <head> | |
|       <meta charset="UTF-8"> | |
|       <!-- TODO: does it need this head_title here? --> | |
|       <title>{% block head_title %}{% trans 'SAPL - Sistema de Apoio ao Processo Legislativo' %}{% endblock %}</title> | |
|       <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
|       <script type="text/javascript" src="{% static 'foundation/js/vendor/jquery.js' %}"></script> | |
| 
 | |
|       <STYLE type="text/css"> | |
|         @media screen { | |
|             body {font-size: medium; color: white; line-height: 1em; background: black;} | |
|         } | |
|       </STYLE> | |
|        | |
|       <script type="text/javascript"> | |
|          $(document).ready(function() { | |
| 
 | |
|              //TODO: replace by a fancy jQuery clock | |
|              function checkTime(i) { | |
|                  if (i<10) {i = "0" + i};  // add zero in front of numbers < 10 | |
|                     return i; | |
|              } | |
|              function startTime() { | |
|                  var today=new Date(); | |
|                  var h=today.getHours(); | |
|                  var m=today.getMinutes(); | |
|                  var s=today.getSeconds(); | |
|                  m = checkTime(m); | |
|                  s = checkTime(s); | |
|                  $("#relogio").text(h+":"+m+":"+s) | |
|                  var t = setTimeout(function(){ | |
|                      startTime() | |
|                  },500); | |
|              } | |
| 
 | |
|              startTime(); | |
| 
 | |
|         var counter = 1; | |
|         (function poll() { | |
|             $.ajax({ | |
|                url: $("#json_url").val(), | |
|                type: "GET", | |
|                success: function(data) { | |
| 
 | |
|                   //TODO: json spitted out is very complex, have to simplify/flat it | |
|                   //TODO: probably building it by hand on REST side | |
|  | |
|                   console.debug(data) | |
| 
 | |
|                   var presentes = $("#parlamentares"); | |
|                   presentes.children().remove(); | |
| 
 | |
|                   presentes_ordem_dia = data.presentes_ordem_dia | |
|                   jQuery.each(presentes_ordem_dia, function(index, parlamentar) {                      | |
|                       $('<li />', {text: parlamentar.nome + '/' + parlamentar.partido }).appendTo(presentes); | |
|                       /*$('<li />', {text: parlamentar.nome + '/' + parlamentar.partido + ' ' + parlamentar.voto }).appendTo(presentes);*/                       | |
|                   }); | |
| 
 | |
|                   var votacao = $("#votacao") | |
|                   votacao.children().remove() | |
|                   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["presentes"] + "</li>") | |
|                   votacao.append("<li>Total votos: " + data["total_votos"] + "</li>") | |
| 
 | |
|                   $("#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"]) | |
| 
 | |
|                   $("#materia_legislativa_texto").text(data["materia_legislativa_texto"]) | |
|                   $("#observacao_materia").text(data["observacao_materia"]) | |
|                   $("#resultado_votacao").text(data["tipo_resultado"]) | |
| 
 | |
|                   $("#counter").text(counter); | |
|                   counter++; | |
|                }, | |
|                error: function(err) { | |
|                   console.error(err); | |
|                }, | |
|                dataType: "json", | |
|                //complete: setTimeout(function() {poll()}, 5000), | |
|                timeout: 20000 // TODO: decrease | |
|             }) | |
|           })(); | |
|          }); | |
|       </script> | |
|     </head> | |
|     <body> | |
|         <h1>{{ context.title }}</h1> | |
|         <input id="json_url" type="hidden" value="{% url 'dados_painel' %}">         | |
|         <h3> | |
|         <span id="sessao_plenaria"></span><br/><br/> | |
|         <span id="sessao_plenaria_data"></span><br/><br/> | |
|         <span id="sessao_plenaria_hora_inicio"></span></br><br/> | |
|         <h2><span id="relogio"></span></h2> | |
|         <table> | |
|             <tr> | |
|                <td> | |
|                   <ul id="parlamentares"> | |
|                   </ul> | |
|                </td> | |
|             </tr> | |
|         </table> | |
|         </h3> | |
|     </body> | |
| </html>
 | |
| 
 |