-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathroles.php
154 lines (144 loc) · 7.01 KB
/
roles.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
154
<?php session_start(); ?>
<?php
if(!isset($_SESSION['valid'])) {
header('Location: login.php');
}
?>
<?php
include_once("connection.php");
$result = mysqli_query($mysqli, "SELECT * FROM roles ORDER BY name ASC");
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Lista de roles | Gabriel Peña & Manuel Albarran</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto|Varela+Round">
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<link rel="stylesheet" href="style.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
<div class="table-wrapper">
<div class="table-title">
<div class="row">
<div class="col-sm-6">
<h2>Lista de roles</h2>
</div>
<div class="col-sm-6">
<a href="logout.php" class="btn btn-danger">
<i class="material-icons">exit_to_app</i> <span>Salir</span>
</a>
<a href="#addEmployeeModal" data-toggle="modal" class="btn btn-success">
<i class="material-icons"></i> <span>Agregar nuevo rol</span>
</a>
<a href="index.php" class="btn btn-success">
<i class="material-icons">home</i> <span>Inicio</span>
</a>
</div>
</div>
</div>
<table class="table table-striped table-hover">
<thead>
<tr>
<th id="name_header">Nombre</th>
<th id="action_header">Accion</th>
</tr>
</thead>
<tbody>
<?php
while($res = mysqli_fetch_assoc($result)) {
?>
<tr>
<?php echo "<td>".$res['name']."</td>"?>
<td class="<?php echo $classHide ?>">
<a href="edit_role.php?id=<?php echo $res[id]?>" class="edit">
<i class="material-icons" data-toggle="tooltip" title="Editar"></i>
</a>
<a href="delete_role.php?id_role=<?php echo $res[id]?>&name_role=<?php echo $res[name]?>"
class="delete">
<i class="material-icons" data-toggle="tooltip" title="Borrar"></i>
</a>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
</div>
<!-- Agregar - Modal -->
<div id="addEmployeeModal" class="modal fade">
<div class="modal-dialog">
<div class="modal-content">
<form action="add_roles.php" method="post" name="form1">
<div class="modal-header">
<h4 class="modal-title">Agregar nuevo role</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body">
<div class="form-group">
<label>Nombre</label>
<input type="text" class="form-control" name="name" required>
</div>
<div class="wrap-checkbox">
<div class="custom-control custom-checkbox my-1 mr-sm-2">
<input type="checkbox" class="custom-control-input" id="products" name="products"
value="active">
<label class="custom-control-label" for="products">Listar y/o agregar productos</label>
</div>
<div class="custom-control custom-checkbox my-1 mr-sm-2">
<input type="checkbox" class="custom-control-input" id="roles" name="roles"
value="active">
<label class="custom-control-label" for="roles">Listar y/o crear roles</label>
</div>
<div class="custom-control custom-checkbox my-1 mr-sm-2">
<input type="checkbox" class="custom-control-input" id="audit" name="audit"
value="active">
<label class="custom-control-label" for="audit">Auditar</label>
</div>
<div class="custom-control custom-checkbox my-1 mr-sm-2">
<input type="checkbox" class="custom-control-input" id="users" name="users"
value="active">
<label class="custom-control-label" for="users">Listar usuarios</label>
</div>
</div>
</div>
<div class="modal-footer">
<input type="button" class="btn btn-default" data-dismiss="modal" value="Cancelar">
<input type="submit" class="btn btn-success" name="Submit" value="Agregar">
</div>
</form>
</div>
</div>
</div>
<!-- Borrar - Modal -->
<div id="deleteEmployeeModal" class="modal fade">
<div class="modal-dialog">
<div class="modal-content">
<form>
<div class="modal-header">
<h4 class="modal-title">Borrar elemento</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body">
<p>¿Esta seguro que desea borrar este elemento?</p>
<p class="text-warning"><small>Esta accion no puede ser reversada.</small></p>
</div>
<div class="modal-footer">
<input type="button" class="btn btn-default" data-dismiss="modal" value="Cancelar">
<input type="submit" class="btn btn-danger" value="Borrar">
</div>
</form>
</div>
</div>
</div>
</body>
</html>