-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconsultarCondominios.php
153 lines (139 loc) · 6.92 KB
/
consultarCondominios.php
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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
<?php
include ('session.php');
if($user_rank == 'C'){
header('Location: menu.php');
}
?>
<script>
function doIt() {
var texto = document.getElementById('texto').value;
window.open('consultarCondomino.php?condo_morada=' + texto, '_self');
}
</script>
<script>
function procurar() {
var input, filter, table, tr, td, i;
input = document.getElementById("procurar");
filter = input.value.toUpperCase();
table = document.getElementById("tabela");
tr = table.getElementsByTagName("tr");
for (i = 0; i < tr.length; i++) {
td = tr[i].getElementsByTagName("td")[3];
if (td) {
if (td.innerHTML.toUpperCase().indexOf(filter) > -1) {
tr[i].style.display = "";
} else {
tr[i].style.display = "none";
}
}
}
}
</script>
<!--<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function(){
function search(){
var title=$("#search").val();
if(title!=""){
$("#result").html("<img alt="ajax search" src='ajax-loader.gif'/>");
$.ajax({
type:"post",
url:"search.php",
data:"title="+title,
success:function(data){
$("#result").html(data);
$("#search").val("");
}
});
}
}
$("#button").click(function(){
search();
});
$('#search').keyup(function(e) {
if(e.keyCode == 13) {
search();
}
});
});
</script>-->
<section class="wrapper">
<h3><i class="fa fa-angle-right"></i> Lista de Condomínios</h3>
<form class="form-horizontal style-form" method="post" id="condtable" action="condominioStatus.php" onsubmit="return checkForm(this);">
<div class="row mt">
<div class="col-lg-12">
<div class="input-group stylish-input-group">
<input type="text" id="procurar" onkeyup="procurar()" class="form-control" placeholder="Introduza a morada do condomínio" >
<span class="input-group-addon">
<button type="submit" id="button" value="Procurar">
<span class="glyphicon glyphicon-search"></span>
</button>
</span>
</div>
</div>
</div>
<div class="row mt">
<div id="result">
</div>
<div class="col-md-12">
<div class="content-panel">
<table class="table" id="tabela">
<thead>
<tr>
<th>#</th>
<th>Id</th>
<th>Responsável</th>
<th>Morada</th>
<th>Código Postal</th>
<th>Modalidade</th>
<th>Número de Andares</th>
<th>Total de Despesas</th>
<th>Dia de Pagamento</th>
<th>Juros Mora (%)</th>
<th>Estado</th>
</tr>
</thead>
<tbody>
<?php
$query = "SELECT * FROM condominios";
$results = mysqli_query($connection, $query);
while($row = mysqli_fetch_assoc($results)) {
$ref = $row['id_condo'];
?>
<tr>
<td><input type="radio" name="selecionado" value="<?php echo $ref; ?>"/></td>
<td><?php echo $row['id_condo']?></td>
<td><?php echo $row['id_condo_resp']?></td>
<td><?php echo $row['condo_morada']?></td>
<td><?php echo $row['condo_cod_postal']?></td>
<td><?php echo $row['condo_modalidade']?></td>
<td><?php echo $row['condo_andares']?></td>
<td><?php echo $row['condo_despesas']?></td>
<td><?php echo $row['condo_prazo_limite']?></td>
<td><?php echo $row['juros_mora']?></td>
<td><?php echo $row['estado']?></td>
</tr>
<?php
}
?>
</tbody>
<?php if ($user_rank == 'A'){ ?>
<button type="submit" name="ativar" class="btn btn-theme" style="background-color: #4CAF50;">Ativar</button>
<button type="submit" name="eliminar" class="btn btn-theme" style="background-color: #f44336;">Desativar</button>
<?php } ?>
<button type="button" class="btn btn-theme" onclick="editCondInfo()">Editar</button>
<button type="button" onclick="carregaCond()" class="btn btn-theme">Consultar</button>
<hr>
<?php
if (isset($_GET['condo_morada']) && isset($_GET['condo_morada'])) {
$texto = str_replace('*', '%', $_GET['condo_morada']);
$texto = str_replace('?', '_', $texto);
$query = $query . " WHERE condo_morada LIKE '$texto'";
} ?>
</table>
</div>
</div>
</div>
</form>
</section>