$(function () {
$.ajax({
url: PEN_BASE_PATH + '/util/url.php',
type: 'post',
dataType: 'json',
data:
{
'class': 'ExpedirProcedimentoRN',
'action': 'consultarUnidadesHierarquia',
'selRepositorioEstruturas': opener.document.frmExpedirProcedimento.selRepositorioEstruturas.value
},
success: function (data)
{
var html ='
';
html += '
';
html += '';
html += '
';
html += '
';
for (var i = 0; i < data.length; i++)
{
html += ' ' + data[ i ].estrutura.nome + '
';
html += '';
html += '
';
html += '
';
html += '';
html += '
';
html += '
';
html += '
';
html += '
';
}
$('#recebeUnudadesHierarquias').html(html);
$('.selecionar-sub-categoria').click(function () {
var idSel = $(this).attr('id');
$('.row-colplay-oculdo').css({'display': 'none'});
$('#estruturaFilha' + idSel).css({'display': 'block'});
});
$('#selecionarHirarquiaPai').on('keyup', function (event) {
event.preventDefault();
var encontrou = false;
var termo = $('#selecionarHirarquiaPai').val().toLowerCase();
$('.selecionar-sub-categoria').each(function () {
if ($(this).text().toLowerCase().indexOf(termo) > -1)
{
encontrou = true;
}
if (!encontrou)
{
$(this).hide();
}
else
{
$(this).show();
}
encontrou = false;
});
});
$('#selecionarHirarquiaFilho').on('keyup', function (event) {
event.preventDefault();
var encontrou = false;
var termo = $('#selecionarHirarquiaFilho').val().toLowerCase();
$('.selecionar-filter-hierarquia-filho').each(function () {
if ($(this).text().toLowerCase().indexOf(termo) > -1)
{
encontrou = true;
}
if (!encontrou)
{
$(this).hide();
}
else
{
$(this).show();
}
encontrou = false;
});
});
$('.selecionar-link-unidade').click(function(event){
event.preventDefault();
var numeroDeIdentificacaoDaEstrutura = $(this).attr('id');
opener.document.frmExpedirProcedimento.txtUnidade.value= $(this).text();
opener.document.frmExpedirProcedimento.hdnIdUnidade.value= numeroDeIdentificacaoDaEstrutura;
window.close();
});
}
});
})