|
|
@ -51,109 +51,6 @@ function refreshMask() { |
|
|
$('.cronometro').mask("00:00:00", {placeholder:"hh:mm:ss"}); |
|
|
$('.cronometro').mask("00:00:00", {placeholder:"hh:mm:ss"}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function autorModal() { |
|
|
|
|
|
|
|
|
|
|
|
$(function() { |
|
|
|
|
|
var dialog = $("#modal_autor").dialog({ |
|
|
|
|
|
autoOpen: false, |
|
|
|
|
|
modal: true, |
|
|
|
|
|
width: 500, |
|
|
|
|
|
height: 340, |
|
|
|
|
|
show: { |
|
|
|
|
|
effect: "blind", |
|
|
|
|
|
duration: 500}, |
|
|
|
|
|
hide: { |
|
|
|
|
|
effect: "explode", |
|
|
|
|
|
duration: 500 |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
$("#button-id-limpar").click(function() { |
|
|
|
|
|
$("#nome_autor").text(''); |
|
|
|
|
|
|
|
|
|
|
|
function clean_if_exists(fieldname) { |
|
|
|
|
|
if ($(fieldname).length > 0) { |
|
|
|
|
|
$(fieldname).val(''); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
clean_if_exists("#id_autor"); |
|
|
|
|
|
clean_if_exists("#id_autoria__autor"); |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
$("#button-id-pesquisar").click(function() { |
|
|
|
|
|
$("#q").val(''); |
|
|
|
|
|
$("#div-resultado").children().remove(); |
|
|
|
|
|
$("#modal_autor").dialog( "open" ); |
|
|
|
|
|
$("#selecionar").attr("hidden", "hidden"); |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
$("#pesquisar").click(function() { |
|
|
|
|
|
var name_in_query = $("#q").val() |
|
|
|
|
|
//var q_0 = "q_0=nome__icontains"
|
|
|
|
|
|
//var q_1 = name_in_query
|
|
|
|
|
|
//query = q_1
|
|
|
|
|
|
|
|
|
|
|
|
$.get("/api/autor?q=" + name_in_query, function(data, status) { |
|
|
|
|
|
$("#div-resultado").children().remove(); |
|
|
|
|
|
if (data.pagination.total_entries == 0) { |
|
|
|
|
|
$("#selecionar").attr("hidden", "hidden"); |
|
|
|
|
|
$("#div-resultado").html( |
|
|
|
|
|
"<span class='alert'><strong>Nenhum resultado</strong></span>"); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var select = $( |
|
|
|
|
|
'<select id="resultados" \ |
|
|
|
|
|
style="min-width: 90%; max-width:90%;" size="5"/>'); |
|
|
|
|
|
|
|
|
|
|
|
data.results.forEach(function(item, index) { |
|
|
|
|
|
select.append($("<option>").attr('value', item.value).text(item.text)); |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
$("#div-resultado").append("<br/>").append(select); |
|
|
|
|
|
$("#selecionar").removeAttr("hidden", "hidden"); |
|
|
|
|
|
|
|
|
|
|
|
if (data.pagination.total_pages > 1) |
|
|
|
|
|
$("#div-resultado").prepend('<span><br/>Mostrando 10 primeiros autores relativos a sua busca.<br/></span>'); |
|
|
|
|
|
|
|
|
|
|
|
$("#selecionar").click(function() { |
|
|
|
|
|
res = $("#resultados option:selected"); |
|
|
|
|
|
id = res.val(); |
|
|
|
|
|
nome = res.text(); |
|
|
|
|
|
|
|
|
|
|
|
$("#nome_autor").text(nome); |
|
|
|
|
|
|
|
|
|
|
|
// MateriaLegislativa pesquisa Autor via a tabela Autoria
|
|
|
|
|
|
if ($('#id_autoria__autor').length) { |
|
|
|
|
|
$('#id_autoria__autor').val(id); |
|
|
|
|
|
} |
|
|
|
|
|
// Protocolo pesquisa a própria tabela de Autor
|
|
|
|
|
|
if ($('#id_autor').length) { |
|
|
|
|
|
$("#id_autor").val(id); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
dialog.dialog( "close" ); |
|
|
|
|
|
}); |
|
|
|
|
|
}); |
|
|
|
|
|
}); |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
/*function get_nome_autor(fieldname) { |
|
|
|
|
|
if ($(fieldname).length > 0) { // se campo existir
|
|
|
|
|
|
if ($(fieldname).val() != "") { // e não for vazio
|
|
|
|
|
|
var id = $(fieldname).val(); |
|
|
|
|
|
$.get("/proposicao/get-nome-autor?id=" + id, function(data, status){ |
|
|
|
|
|
$("#nome_autor").text(data.nome); |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
get_nome_autor("#id_autor"); |
|
|
|
|
|
get_nome_autor("#id_autoria__autor");*/ |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function OptionalCustomFrontEnd() { |
|
|
function OptionalCustomFrontEnd() { |
|
|
// Adaptações opcionais de layout com a presença de JS.
|
|
|
// Adaptações opcionais de layout com a presença de JS.
|
|
|
// Não implementar customizações que a funcionalidade que fique dependente.
|
|
|
// Não implementar customizações que a funcionalidade que fique dependente.
|
|
|
@ -228,7 +125,6 @@ function OptionalCustomFrontEnd() { |
|
|
$(document).ready(function(){ |
|
|
$(document).ready(function(){ |
|
|
refreshDatePicker(); |
|
|
refreshDatePicker(); |
|
|
refreshMask(); |
|
|
refreshMask(); |
|
|
autorModal(); |
|
|
|
|
|
initTinymce("texto-rico"); |
|
|
initTinymce("texto-rico"); |
|
|
|
|
|
|
|
|
//OptionalCustomFrontEnd();
|
|
|
//OptionalCustomFrontEnd();
|
|
|
|