|
@@ -2,127 +2,33 @@
|
2
|
2
|
<html>
|
3
|
3
|
<head>
|
4
|
4
|
<title>Miembros</title>
|
5
|
|
- <style>
|
6
|
|
- body {
|
7
|
|
- margin:0px;
|
8
|
|
- }
|
9
|
|
-
|
10
|
|
- .container {
|
11
|
|
- height:100%;
|
12
|
|
- width:100%;
|
13
|
|
- position: fixed;
|
14
|
|
- z-index: -1
|
15
|
|
- }
|
16
|
|
-
|
17
|
|
- .members {
|
18
|
|
- margin-top: 8px;
|
19
|
|
- margin-left: 1em;
|
20
|
|
- margin-right: 1em;
|
21
|
|
- }
|
22
|
|
-
|
23
|
|
- /* Add a black background color to the top navigation */
|
24
|
|
- .topnav {
|
25
|
|
- background-color: #ED7D31;
|
26
|
|
- overflow: hidden;
|
27
|
|
- box-shadow: 0 4px 2px 0px gray;
|
28
|
|
- }
|
29
|
|
-
|
30
|
|
- /* Style the links inside the navigation bar */
|
31
|
|
- .topnav a {
|
32
|
|
- float: left;
|
33
|
|
- color: black;
|
34
|
|
- text-align: center;
|
35
|
|
- padding: 14px 16px;
|
36
|
|
- text-decoration: none;
|
37
|
|
- font-size: 23px;
|
38
|
|
- }
|
39
|
|
-
|
40
|
|
- .topnav a:hover {
|
41
|
|
- background-color: #BA6127;
|
42
|
|
- }
|
43
|
|
-
|
44
|
|
- .logo {
|
45
|
|
- padding: 0px 0px ! important;
|
46
|
|
- }
|
47
|
|
-
|
48
|
|
- .logo img {
|
49
|
|
- float: left;
|
50
|
|
- height: 54px;
|
51
|
|
- }
|
52
|
|
-
|
53
|
|
- /* The Modal (background) */
|
54
|
|
- .modal {
|
55
|
|
- display: none; /* Hidden by default */
|
56
|
|
- position: fixed; /* Stay in place */
|
57
|
|
- z-index: 1; /* Sit on top */
|
58
|
|
- padding-top: 100px; /* Location of the box */
|
59
|
|
- left: 0;
|
60
|
|
- top: 0;
|
61
|
|
- width: 100%; /* Full width */
|
62
|
|
- height: 100%; /* Full height */
|
63
|
|
- overflow: auto; /* Enable scroll if needed */
|
64
|
|
- background-color: rgb(0,0,0); /* Fallback color */
|
65
|
|
- background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
|
66
|
|
- }
|
67
|
|
-
|
68
|
|
- /* Modal Content */
|
69
|
|
- .modal-content {
|
70
|
|
- background-color: #fefefe;
|
71
|
|
- margin: auto;
|
72
|
|
- padding: 20px;
|
73
|
|
- border: 1px solid #888;
|
74
|
|
- max-width: 10%;
|
75
|
|
- }
|
76
|
|
-
|
77
|
|
- /* The Close Button */
|
78
|
|
- .close {
|
79
|
|
- color: #aaaaaa;
|
80
|
|
- float: right;
|
81
|
|
- font-size: 28px;
|
82
|
|
- font-weight: bold;
|
83
|
|
- }
|
84
|
|
-
|
85
|
|
- .close:hover, .close:focus {
|
86
|
|
- color: #000;
|
87
|
|
- text-decoration: none;
|
88
|
|
- cursor: pointer;
|
89
|
|
- }
|
90
|
|
-
|
91
|
|
- table.dataTable tbody th, table.dataTable tbody td {
|
92
|
|
- text-align: center;
|
93
|
|
- }
|
94
|
|
-}
|
95
|
|
-
|
96
|
|
- </style>
|
|
5
|
+ <link rel="stylesheet" type="text/css" href="style.css" />
|
97
|
6
|
<link rel="stylesheet" type="text/css" href="//cdn.datatables.net/1.10.21/css/jquery.dataTables.min.css"/>
|
98
|
7
|
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
|
99
|
|
- <script type="text/javascript" src="//cdn.datatables.net/1.10.21/js/jquery.dataTables.min.js">
|
100
|
|
- </script>
|
|
8
|
+ <script type="text/javascript" src="//cdn.datatables.net/1.10.21/js/jquery.dataTables.min.js"></script>
|
|
9
|
+
|
101
|
10
|
<script>
|
102
|
11
|
$(document).ready(function() {
|
103
|
12
|
$('#membersTable').DataTable({
|
104
|
13
|
"columnDefs": [ {
|
105
|
14
|
"targets": 0,
|
106
|
15
|
"orderable": false
|
107
|
|
- }, {
|
108
|
|
- "targets": 11,
|
109
|
|
- "orderable": false
|
110
|
|
- }, {
|
111
|
|
- "targets": 12,
|
112
|
|
- "orderable": false
|
113
|
|
- } ],
|
114
|
|
- "order": [[ 1, "asc" ]]
|
|
16
|
+ }],
|
|
17
|
+ "order": [[ 1, "asc" ]],
|
|
18
|
+ language: {
|
|
19
|
+ url: '//cdn.datatables.net/plug-ins/1.10.22/i18n/Spanish.json'
|
|
20
|
+ }
|
115
|
21
|
});
|
116
|
22
|
|
117
|
23
|
$('.editor').click(function(e) {
|
118
|
24
|
e.preventDefault();
|
119
|
25
|
|
120
|
26
|
$.ajax({
|
121
|
|
- url: '/editMembers.php',
|
|
27
|
+ url: '/api/editMembers.php',
|
122
|
28
|
type: 'POST',
|
123
|
29
|
data: {
|
124
|
30
|
userid: $('#rowID').val(),
|
125
|
|
- username: $('#username').val(),
|
|
31
|
+ correo: $('#correo').val(),
|
126
|
32
|
nombre: $('#nombre').val(),
|
127
|
33
|
organizacion: $('#organizacion').val(),
|
128
|
34
|
puesto: $('#puesto').val(),
|
|
@@ -131,17 +37,19 @@
|
131
|
37
|
pueblo: $('#pueblo').val(),
|
132
|
38
|
cpostal: $('#cpostal').val(),
|
133
|
39
|
telefono: $('#telefono').val(),
|
134
|
|
- correo: $('#correo').val()
|
|
40
|
+ membresia: $('#membresia').val(),
|
|
41
|
+ vigencia: $('#vigencia').val(),
|
|
42
|
+ horasTrabajadas: $('#horasTrabajadas').val()
|
135
|
43
|
},
|
136
|
44
|
|
137
|
45
|
success: function(msg) {
|
138
|
46
|
alert("Usuario editado");
|
139
|
47
|
|
140
|
|
- document.getElementById("myModal").style.display = "none";
|
|
48
|
+ document.getElementById("editModal").style.display = "none";
|
141
|
49
|
|
142
|
50
|
var id = $('#rowID').val();
|
143
|
51
|
|
144
|
|
- document.getElementById(id).childNodes[1].innerText = $('#username').val();
|
|
52
|
+ document.getElementById(id).childNodes[1].innerText = $('#correo').val();
|
145
|
53
|
document.getElementById(id).childNodes[2].innerText = $('#nombre').val();
|
146
|
54
|
document.getElementById(id).childNodes[3].innerText = $('#organizacion').val();
|
147
|
55
|
document.getElementById(id).childNodes[4].innerText = $('#puesto').val();
|
|
@@ -150,11 +58,13 @@
|
150
|
58
|
document.getElementById(id).childNodes[7].innerText = $('#pueblo').val();
|
151
|
59
|
document.getElementById(id).childNodes[8].innerText = $('#cpostal').val();
|
152
|
60
|
document.getElementById(id).childNodes[9].innerText = $('#telefono').val();
|
153
|
|
- document.getElementById(id).childNodes[10].innerText = $('#correo').val();
|
|
61
|
+ document.getElementById(id).childNodes[10].innerText = $('#membresia').val();
|
|
62
|
+ document.getElementById(id).childNodes[11].innerText = $('#vigencia').val();
|
|
63
|
+ document.getElementById(id).childNodes[12].innerText = $('#horasTrabajadas').val();
|
154
|
64
|
},
|
155
|
65
|
|
156
|
66
|
error: function(request, status, error) {
|
157
|
|
- alert(status + ": " + error);
|
|
67
|
+ alert(JSON.parse(request.responseText)["error"]);
|
158
|
68
|
}
|
159
|
69
|
});
|
160
|
70
|
});
|
|
@@ -162,20 +72,20 @@
|
162
|
72
|
});
|
163
|
73
|
|
164
|
74
|
function openModal(id){
|
165
|
|
- document.getElementById("myModal").style.display = "block";
|
|
75
|
+ document.getElementById("editModal").style.display = "block";
|
166
|
76
|
|
167
|
77
|
document.getElementsByClassName("close")[0].onclick = function() {
|
168
|
|
- document.getElementById("myModal").style.display = "none";
|
|
78
|
+ document.getElementById("editModal").style.display = "none";
|
169
|
79
|
}
|
170
|
80
|
|
171
|
81
|
window.onclick = function(event) {
|
172
|
|
- if (event.target == document.getElementById("myModal")) {
|
173
|
|
- document.getElementById("myModal").style.display = "none";
|
|
82
|
+ if (event.target == document.getElementById("editModal")) {
|
|
83
|
+ document.getElementById("editModal").style.display = "none";
|
174
|
84
|
}
|
175
|
85
|
}
|
176
|
86
|
|
177
|
87
|
document.getElementById("rowID").value = id;
|
178
|
|
- document.getElementById("username").value = document.getElementById(id).childNodes[1].innerText;
|
|
88
|
+ document.getElementById("correo").value = document.getElementById(id).childNodes[1].innerText;
|
179
|
89
|
document.getElementById("nombre").value = document.getElementById(id).childNodes[2].innerText;
|
180
|
90
|
document.getElementById("organizacion").value = document.getElementById(id).childNodes[3].innerText;
|
181
|
91
|
document.getElementById("puesto").value = document.getElementById(id).childNodes[4].innerText;
|
|
@@ -184,7 +94,11 @@
|
184
|
94
|
document.getElementById("pueblo").value = document.getElementById(id).childNodes[7].innerText;
|
185
|
95
|
document.getElementById("cpostal").value = document.getElementById(id).childNodes[8].innerText;
|
186
|
96
|
document.getElementById("telefono").value = document.getElementById(id).childNodes[9].innerText;
|
187
|
|
- document.getElementById("correo").value = document.getElementById(id).childNodes[10].innerText;
|
|
97
|
+
|
|
98
|
+ document.getElementById("membresia").value = document.getElementById(id).childNodes[10].innerText;
|
|
99
|
+ document.getElementById("vigencia").value = document.getElementById(id).childNodes[11].innerText;
|
|
100
|
+
|
|
101
|
+ document.getElementById("horasTrabajadas").value = document.getElementById(id).childNodes[12].innerText;
|
188
|
102
|
}
|
189
|
103
|
</script>
|
190
|
104
|
</head>
|
|
@@ -199,19 +113,18 @@
|
199
|
113
|
<?php
|
200
|
114
|
|
201
|
115
|
if ($_SERVER["REQUEST_METHOD"] == "GET") {
|
202
|
|
- include 'db.php';
|
|
116
|
+ include '../api/db.php';
|
203
|
117
|
|
204
|
118
|
# Select username row
|
205
|
|
- $sql = "SELECT userid, username, nombre, organizacion, puesto, urbanizacion, calle,
|
206
|
|
- pueblo, cpostal, telefono, correo, membresia, vigencia FROM login NATURAL JOIN miembros;";
|
|
119
|
+ $sql = "SELECT userid, correo, nombre, organizacion, puesto, urbanizacion, calle,
|
|
120
|
+ pueblo, cpostal, telefono, membresia, vigencia, horasTrabajadas FROM Login NATURAL JOIN Miembro;";
|
207
|
121
|
|
208
|
|
-
|
209
|
122
|
if($result = $conn->query($sql)){
|
210
|
123
|
?>
|
211
|
124
|
<table id="membersTable" style="width:100%">
|
212
|
125
|
<thead>
|
213
|
126
|
<th></th>
|
214
|
|
- <th>Username</th>
|
|
127
|
+ <th>Correo</th>
|
215
|
128
|
<th>Nombre</th>
|
216
|
129
|
<th>Organizacion</th>
|
217
|
130
|
<th>Puesto</th>
|
|
@@ -220,17 +133,17 @@
|
220
|
133
|
<th>Pueblo</th>
|
221
|
134
|
<th>Codigo Posta</th>
|
222
|
135
|
<th>Telefono</th>
|
223
|
|
- <th>Correo</th>
|
224
|
136
|
<th>Membresia</th>
|
225
|
137
|
<th>Vigencia</th>
|
|
138
|
+ <th>Horas Trabajadas</th>
|
226
|
139
|
</thead>
|
227
|
140
|
<tbody>
|
228
|
141
|
<?php
|
229
|
142
|
while($row = $result->fetch_assoc()){
|
230
|
|
- echo "<tr id=\"".$row["userid"]."\"><td><button onClick=\"openModal(".$row["userid"].")\">Editar</button></td><td>".$row["username"]."</td><td>".$row["nombre"]."</td><td>".$row["organizacion"].
|
231
|
|
- "</td><td>".$row["puesto"]."</td><td>". $row["urbanizacion"]."</td><td>".$row["calle"].
|
232
|
|
- "</td><td>".$row["pueblo"]."</td><td>".$row["cpostal"]."</td><td>".$row["telefono"]."</td><td>"
|
233
|
|
- .$row["correo"]."</td><td>".$row["membresia"]."</td><td>".$row["vigencia"]."</tr>";
|
|
143
|
+ echo "<tr id=\"".$row["userid"]."\"><td><button onClick=\"openModal(".$row["userid"].")\">Editar</button></td><td>"
|
|
144
|
+ .$row["correo"]."</td><td>".$row["nombre"]."</td><td>".$row["organizacion"]."</td><td>".$row["puesto"]."</td><td>"
|
|
145
|
+ .$row["urbanizacion"]."</td><td>".$row["calle"]."</td><td>".$row["pueblo"]."</td><td>".$row["cpostal"]."</td><td>"
|
|
146
|
+ .$row["telefono"]."</td><td>".$row["membresia"]."</td><td>".$row["vigencia"]."</td><td>".$row["horasTrabajadas"]."</td></tr>";
|
234
|
147
|
}
|
235
|
148
|
?>
|
236
|
149
|
</tbody>
|
|
@@ -253,16 +166,14 @@
|
253
|
166
|
</div>
|
254
|
167
|
</div>
|
255
|
168
|
|
256
|
|
- <!-- The Modal -->
|
257
|
|
- <div id="myModal" class="modal">
|
|
169
|
+ <div id="editModal" class="modal">
|
258
|
170
|
|
259
|
|
- <!-- Modal content -->
|
260
|
171
|
<div class="modal-content">
|
261
|
172
|
<span class="close">×</span>
|
262
|
173
|
<form method="post" action="" id="editform">
|
263
|
174
|
<input type="hidden" id="rowID">
|
264
|
|
- <label>Username:</label><br>
|
265
|
|
- <input type="text" id="username"><br><br>
|
|
175
|
+ <label>Correo:</label><br>
|
|
176
|
+ <input type="text" id="correo"><br><br>
|
266
|
177
|
<label>Nombre:</label><br>
|
267
|
178
|
<input type="text" id="nombre"><br><br>
|
268
|
179
|
<label>Organizacion</label><br>
|
|
@@ -279,14 +190,21 @@
|
279
|
190
|
<input type="text" id="cpostal"><br><br>
|
280
|
191
|
<label>Telefono:</label><br>
|
281
|
192
|
<input type="text" id="telefono"><br><br>
|
282
|
|
- <label>Correo:</label><br>
|
283
|
|
- <input type="text" id="correo"><br><br>
|
|
193
|
+ <label>Membresia:</label><br>
|
|
194
|
+ <select id="membresia">
|
|
195
|
+ <option value="Persona">Persona</option>
|
|
196
|
+ <option value="Comunidad">Comunidad</option>
|
|
197
|
+ <option value="Donante">Donante</option>
|
|
198
|
+ <option value="Productor">Productor</option>
|
|
199
|
+ </select><br><br>
|
|
200
|
+ <label>Vigencia:</label><br>
|
|
201
|
+ <input type="date" id="vigencia"><br><br>
|
|
202
|
+ <label>Horas Trabajadas:</label><br>
|
|
203
|
+ <input type="text" id="horasTrabajadas"><br><br>
|
284
|
204
|
<input type="submit" class="editor" value="Editar Usiario">
|
285
|
205
|
</form>
|
286
|
206
|
</div>
|
287
|
207
|
|
288
|
|
-</div>
|
|
208
|
+ </div>
|
289
|
209
|
</body>
|
290
|
|
-
|
291
|
|
-
|
292
|
210
|
</html>
|