-
Notifications
You must be signed in to change notification settings - Fork 43
/
buscaAlunos.html
86 lines (81 loc) · 2.89 KB
/
buscaAlunos.html
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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Sistema de Busca - Fatec Franca</title>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
</head>
<body>
<div class="container" id="searchApp">
<br />
<h3 align="center">
<img src="https://site.fatecfranca.edu.br/images/logo-fatec-franca-15-anos.png" width=50% height=50%
alt="logo fatec"><br /><br />
<strong>Busca de Alunos</strong>
</h3>
<br />
<div class="panel panel-default">
<div class="panel-heading">
<div class="row">
<div class="col-md-9">
<h3 class="panel-title">Busca Alunos</h3>
</div>
<div class="col-md-3" align="right">
<input type="text" class="form-control input-sm" placeholder="Search Data" v-model="query"
@keyup="fetchData()" />
</div>
</div>
</div>
<div class="panel-body">
<div class="table-responsive">
<table class="table table-bordered table-striped">
<tr>
<th>First Name</th>
<th>Last Name</th>
</tr>
<tr v-for="row in allData">
<td>{{ row.first_name }}</td>
<td>{{ row.last_name }}</td>
</tr>
<tr v-if="nodata">
<td colspan="2" align="center">No Data Found</td>
</tr>
</table>
</div>
</div>
</div>
</div>
</body>
</html>
<script>
var application = new Vue({
el: '#searchApp',
data: {
allData: '',
query: '',
nodata: false
},
methods: {
fetchData: function () {
axios.post('busca.php', {
query: this.query
}).then(function (response) {
if (response.data.length > 0) {
application.allData = response.data;
application.nodata = false;
}
else {
application.allData = '';
application.nodata = true;
}
});
}
},
created: function () {
this.fetchData();
}
});
</script>