|  | @ -1,23 +1,20 @@ | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  |  | 
			
		
	
		
		
			
				
					|  |  | {% extends "crud/form.html" %} |  |  | {% extends "crud/form.html" %} | 
			
		
	
		
		
			
				
					|  |  | {% load i18n %} |  |  | {% load i18n %} | 
			
		
	
		
		
			
				
					|  |  | {% load crispy_forms_tags %} |  |  | {% load crispy_forms_tags %} | 
			
		
	
		
		
			
				
					|  |  | {% load common_tags %} |  |  | {% load common_tags %} | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  | {% block extra_js %} |  |  | {% block extra_js %} | 
			
		
	
		
		
			
				
					
					|  |  | 
 |  |  |   <script language="Javascript"> | 
			
				
				
			
		
	
		
		
			
				
					|  |  | <script language="Javascript"> |  |  |  | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  |  | 
			
		
	
		
		
	
		
		
			
				
					|  |  |     function recuperar_numero_ano() { |  |  |     function recuperar_numero_ano() { | 
			
		
	
		
		
			
				
					|  |  |       var tipo = $("#id_tipo").val() |  |  |       var tipo = $("#id_tipo").val() | 
			
		
	
		
		
			
				
					|  |  |       var ano = $("#id_ano").val() |  |  |       var ano = $("#id_ano").val() | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |     if (tipo) { |  |  |       if (tipo){ | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |       $.get("/materia/recuperar-materia",{tipo: tipo, ano: ano}, |  |  |         $.get("/materia/recuperar-materia", { tipo: tipo, ano: ano }, | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |                                         function(data, status) { |  |  |           function (data, status) { | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					|  |  |             $("#id_numero").val(data.numero); |  |  |             $("#id_numero").val(data.numero); | 
			
		
	
		
		
			
				
					|  |  |             $("#id_ano").val(data.ano); |  |  |             $("#id_ano").val(data.ano); | 
			
		
	
		
		
			
				
					
					|  |  |                                           console.log(data) |  |  |             console.log(data); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |         }); |  |  |         }); | 
			
		
	
		
		
			
				
					|  |  |       } |  |  |       } | 
			
		
	
		
		
			
				
					|  |  |     } |  |  |     } | 
			
		
	
	
		
		
			
				
					|  | @ -55,27 +52,29 @@ | 
			
		
	
		
		
			
				
					|  |  |         +'Compreendo e quero continuar</button>' |  |  |         +'Compreendo e quero continuar</button>' | 
			
		
	
		
		
			
				
					|  |  |       +'</div></div>'; |  |  |       +'</div></div>'; | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |   function verifica_ano(){ |  |  |     function verifica_ano() { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |       let ano = $("select#id_ano.select").val(); |  |  |       let ano = $("select#id_ano.select").val(); | 
			
		
	
		
		
			
				
					|  |  |       let data_apresentacao = $("input#id_data_apresentacao.dateinput").val(); |  |  |       let data_apresentacao = $("input#id_data_apresentacao.dateinput").val(); | 
			
		
	
		
		
			
				
					|  |  |       let ano_apresentacao = data_apresentacao.substr(data_apresentacao.length - 4); |  |  |       let ano_apresentacao = data_apresentacao.substr(data_apresentacao.length - 4); | 
			
		
	
		
		
			
				
					|  |  |      |  |  |      | 
			
		
	
		
		
			
				
					
					|  |  |     if(ano && ano_apresentacao && ano_apresentacao != ano){ |  |  |       if (ano && ano_apresentacao && ano_apresentacao != ano){ | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |         $('#fundo_modal').fadeIn(); |  |  |         $('#fundo_modal').fadeIn(); | 
			
		
	
		
		
			
				
					|  |  |       } |  |  |       } | 
			
		
	
		
		
			
				
					|  |  |     } |  |  |     } | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |   $(document).ready(function() { |  |  |     $(document).ready( function() { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |     $("#id_tipo_autor").change(function() { |  |  |       $("#id_tipo_autor, #id_data_apresentacao").change( function() { | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					|  |  |         var tipo_selecionado = $("#id_tipo_autor").val(); |  |  |         var tipo_selecionado = $("#id_tipo_autor").val(); | 
			
		
	
		
		
			
				
					|  |  |         var autor_selecionado = $("#id_autor").val(); |  |  |         var autor_selecionado = $("#id_autor").val(); | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  |         $("#id_autor option").remove() |  |  |         $("#id_autor option").remove() | 
			
		
	
		
		
			
				
					
					|  |  |       if (tipo_selecionado !== undefined && tipo_selecionado !== null) { |  |  | 
 | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |  |  |  |         if (tipo_selecionado !== undefined && tipo_selecionado !== null){ | 
			
		
	
		
		
			
				
					|  |  |           var json_data = { |  |  |           var json_data = { | 
			
		
	
		
		
			
				
					|  |  |             tipo : tipo_selecionado, |  |  |             tipo : tipo_selecionado, | 
			
		
	
		
		
			
				
					|  |  |             data_relativa : $("#id_data_apresentacao").val() |  |  |             data_relativa : $("#id_data_apresentacao").val() | 
			
		
	
		
		
			
				
					|  |  |           } |  |  |           } | 
			
		
	
		
		
			
				
					
					|  |  |         $.getJSON("/api/autor/possiveis", json_data, function(data){ |  |  |           $.getJSON("/api/autor/possiveis", json_data, function(data) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |             if (data) { |  |  |             if (data) { | 
			
		
	
		
		
			
				
					|  |  |               var results = data.sort(compare); |  |  |               var results = data.sort(compare); | 
			
		
	
		
		
			
				
					|  |  |               if (results.length > 1) { |  |  |               if (results.length > 1) { | 
			
		
	
	
		
		
			
				
					|  | @ -96,16 +95,15 @@ | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  |       $("body").append(meu_modal); |  |  |       $("body").append(meu_modal); | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |     $("#fundo_modal, #close_model_btn").click(function(){ $("#fundo_modal").hide(); }); |  |  |       $("#fundo_modal, #close_model_btn").click( function() { $("#fundo_modal").hide(); }); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |     $("#meu_modal").click(function(e){ e.stopPropagation(); }); |  |  |       $("#meu_modal").click( function(e) { e.stopPropagation(); }); | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |     $("select#id_ano.select.form-control").change(function(){ |  |  |       $("select#id_ano.select.form-control").change( function() { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |         verifica_ano(); |  |  |         verifica_ano(); | 
			
		
	
		
		
			
				
					|  |  |       }); |  |  |       }); | 
			
		
	
		
		
			
				
					
					|  |  |     $("input#id_data_apresentacao.dateinput.form-control").change(function(){ |  |  |       $("input#id_data_apresentacao.dateinput.form-control").change( function() { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |         verifica_ano(); |  |  |         verifica_ano(); | 
			
		
	
		
		
			
				
					|  |  |       }); |  |  |       }); | 
			
		
	
		
		
			
				
					|  |  |     }); |  |  |     }); | 
			
		
	
		
		
			
				
					
					|  |  | </script> |  |  |   </script> | 
			
				
				
			
		
	
		
		
			
				
					|  |  | 
 |  |  |  | 
			
		
	
		
		
	
		
		
			
				
					|  |  | {% endblock %} |  |  | {% endblock %} | 
			
		
	
	
		
		
			
				
					|  | 
 |