diff --git a/static/js/app.js b/static/js/app.js index 87d7b099f..c07bf4b2e 100644 --- a/static/js/app.js +++ b/static/js/app.js @@ -16,7 +16,81 @@ function refreshMask() { $('.hora_hms').mask("00:00:00", {placeholder:"hh:mm:ss"}); } +function autorModal() { + + $(function() { + var dialog = $("#modal_autor").dialog({ + autoOpen: false, + modal: true, + width: 500, + height: 300, + show: { + effect: "blind", + duration: 500 }, + hide: { + effect: "explode", + duration: 500 + } + }); + + $( "#button-id-limpar" ).click(function() { + $("#nome_autor").text(''); + $("#id_autor").val(null); + }); + + $("#button-id-pesquisar").click(function() { + $("#q").val(''); + $("#div-resultado").children().remove(); + $("#modal_autor").dialog( "open" ); + $("#selecionar").attr("hidden", "hidden"); + }); + + $( "#pesquisar" ).click(function() { + var query = $("#q").val() + + $.get("/proposicoes/pesquisar_autores?q="+ query, function( + data, status){ + + $("#div-resultado").children().remove(); + + if (data.length == 0) { + $("#selecionar").attr("hidden", "hidden"); + $("#div-resultado").html( + "Nenhum resultado"); + return; + } + + var select = $( + '