Sistema de Apoio ao Processo Legislativo
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.
 
 
 
 
 

57 lines
2.2 KiB

{% extends "crud/form.html" %}
{% load i18n %}
{% load crispy_forms_tags %}
{% block extra_js %}
<script type="text/javascript">
$(document).ready(function(){
$("input[name=tipo_texto]").change(function(event) {
if (this.value == 'D' && this.checked)
$("#div_id_texto_original").removeClass('hidden');
else if (this.value == 'D' && !this.checked)
$("#div_id_texto_original").addClass('hidden');
});
$("select[name=tipo]").change(function(event) {
if (this.selectedOptions[0].getAttribute('data-has-perfil') === "True") {
$("input[name=tipo_texto]").closest('label').removeClass('disabled');
$("input[name=tipo_texto]").closest('.form-group').parent().removeClass('hidden');
$("input[name=tipo_texto]").prop('disabled', false);
}
else {
$("input[name=tipo_texto]").closest('label').addClass('disabled');
$("input[name=tipo_texto]").closest('.form-group').parent().addClass('hidden');
$("input[name=tipo_texto]").prop('disabled', true);
}
if ($("input[name=tipo_texto]:checked").length == 0) {
$("input[name=tipo_texto]").first().prop('checked', true);
$("input[name=tipo_texto]").first().closest('label').addClass('checked');
}
});
$("select[name=tipo_materia], input[name=numero_materia], input[name=ano_materia]").change(function(event) {
var url = '{% url 'sapl.api:materialegislativa-list'%}'
var formData = {
'tipo' : $("select[name=tipo_materia]").val(),
'ano' : $("input[name=ano_materia]").val(),
'numero' : $("input[name=numero_materia]").val(),
}
if (formData.tipo == '' || formData.ano == '' || formData.numero == '')
return;
$.get(url, formData).done(function(data) {
if (data.pagination.total_entries == 1)
$(".ementa_materia").html(data.results[0].ementa).removeClass('hidden');
else
$(".ementa_materia").html('').addClass('hidden');
});
});
$("input[name=tipo_texto], select[name=tipo_materia], select[name=tipo]").trigger('change');
});
</script>
{% endblock %}