-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathadmin.html
115 lines (94 loc) · 3.69 KB
/
admin.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
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<!-- Bootstrap 4 -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css"
integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm"
crossorigin="anonymous">
<script src="/resources/js/main.js"></script>
<script src="/resources/js/request.js"></script>
<!-- JQuery -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
</head>
<style>
#search-result img{
width: 60px;
height: 60px;
}
</style>
<script>
function toggleText(button_id, user_id) {
console.log('hey');
var token = getCookie('token');
var user = getCookie('username');
var el = document.getElementById(button_id);
if (el.firstChild.data == "Verificado")
{
el.firstChild.data = "No verificado";
}
else
{
el.firstChild.data = "Verificado";
}
}
function logout() {
unsetCookie('token');
unsetCookie('username');
window.location = "http://127.0.0.1:4000/login.html";
}
function deleteUser(i, user_id) {
if( confirm('¿Eliminar usuario?') ){
/*TODO DELETE USER*/
alert("Eliminado con exito");
document.getElementById("row"+i).style.display = "none";
}
}
function searchUser() {
var term = document.getElementById("termino");
for(var i = 0; i < 3; i++){
var user_id = i;
var inner =
"<hr>\n" +
" <div id='row" + i + "' class=\"row\">\n" +
" <div class=\"col-sm-2\">\n" +
" </div>\n" +
" <div class=\"col-sm-1\">\n" +
" <img src=\"resources/imgs/user.png\">\n" +
" </div>\n" +
" <div class=\"col-sm-4\">\n" +
" <h5 style=\"font-size: 22px\">Username</h5>\n" +
" <h6>NOMBRE</h6>\n" +
" </div>\n" +
" <div class=\"col-sm-2\">\n" +
" <button type=\"button\" id=\"verif-"+i+"\" class=\"btn btn-outline-success\" onclick=\"toggleText(this.id," + user_id + ")\">No verificado</button>\n" +
" </div>\n" +
" <div class=\"col-sm-2\">\n" +
" <button type=\"button\" class=\"btn btn-outline-danger\" onclick='deleteUser("+ i + ","+ user_id + ")'>Eliminar</button>\n" +
" </div>\n" +
$("#search-fill").append(inner);
}
}
$(document).ready( function () {
$('#search').click(function(){
searchUser();
});
});
</script>
<body>
<div id="admin-content">
<div >
<h1 style=" width: 30%; margin: auto; margin-top: 40px">ADMIN PAGE <button class="btn btn-outline-danger" onclick="logout()">CERRAR</button> </h1>
<div id="search-data" style=" width: 30%; margin: auto; margin-top: 40px; margin-bottom: 40px">
<input id="termino" type="text">
<button class="btn btn-outline-success" id="search">Buscar</button>
</div>
</div>
<div id="search-result">
<div class="container-fluid" id="search-fill">
</div>
</div>
</div>
</body>
</html>