expedir-processo.js
4.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
$(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 ='<br><br><div class="row">';
html += '<div class="span10">';
html += '<input type="text" id="selecionarHirarquiaPai" name="selecionarHirarquiaPai" value="" class="span10" placeholder="Selecionar"/>';
html += '</div>';
html += '</div>';
for (var i = 0; i < data.length; i++)
{
html += '<div class="row-colplay selecionar-sub-categoria" id="' + i + '" > ' + data[ i ].estrutura.nome + ' </div>';
html += '<div class="row-colplay-oculdo" id="estruturaFilha' + i + '">';
html += '<div class="row">';
html += '<div class="span10">';
html += '<input type="text" id="selecionarHirarquiaFilho" name="selecionarHirarquiaFilho" value="" class="span10" placeholder="Selecionar" />';
html += '</div>';
html += '</div>';
html += '<div class="row">';
html += '<div class="span10">';
html += '<ul>';
for (var j = 0; j < data[ i ].hierarquia.length; j++)
{
html += '<li class="selecionar-filter-hierarquia-filho"> <a href="#" class="selecionar-link-unidade" id=" ' + data[ i ].hierarquia[ j ].numeroDeIdentificacaoDaEstrutura + ' "> ' + data[ i ].hierarquia[ j ].nome + '</a></li>';
}
html += '</ul>';
html += '</div>';
html += '</div>';
html += '</div>';
}
$('#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();
});
}
});
})