forked from kailIII/StockAPP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdepartamentos.php
198 lines (196 loc) · 8.2 KB
/
departamentos.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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
<?php session_start();
include ('sistema/configuracion.php');
$usuario->LoginCuentaConsulta();
$usuario->VerificacionCuenta();
$usuario->ZonaAdministrador();
?>
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="utf-8">
<title><?php echo TITULO ?></title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<link rel="shortcut icon" href="<?php echo ESTATICO ?>img/favicon.ico">
<link rel="stylesheet" type="text/css" href="<?php echo ESTATICO ?>css/dataTables.bootstrap.css">
<?php include(MODULO.'Tema.CSS.php');?>
</head>
<body>
<?php
// Menu inicio
if($usuarioApp['id_perfil']==2){
include (MODULO.'menu_vendedor.php');
}elseif($usuarioApp['id_perfil']==1){
include (MODULO.'menu_admin.php');
}else{
echo'<meta http-equiv="refresh" content="0;url='.URLBASE.'cerrar-sesion"/>';
}
//Menu Fin
?>
<div id="wrap">
<div class="container">
<div class="page-header" id="banner">
<div class="row">
<div class="col-lg-8 col-md-7 col-sm-6">
<h1>Administrar Departamentos</h1>
</div>
</div>
</div>
<?php
$ProductosClase->CrearDepartamentos();
$ProductosClase->EliminarDepartamento();
$ProductosClase->EditarDepartamento();
?>
<div class="row">
<div class=" col-md-6">
<table class="table table-bordered table table-hover" id="departamentos">
<thead>
<tr class="well">
<td><strong><center>ID</center></strong></td>
<td><strong>Descripcion</strong></td>
<td><strong><center>Estado</center></strong></td>
<td><strong><center>Editar</center></strong></td>
</tr>
</thead>
<tbody>
<?php foreach($DepartamentoStockArray as $DepartamentoStockRow): ?>
<tr>
<td><center><?php echo $DepartamentoStockRow['id']; ?></center></td>
<td><?php echo $DepartamentoStockRow['nombre']; ?></td>
<td>
<center>
<?php
if($DepartamentoStockRow['habilitada'] == 1){
echo'<span class="label label-success">Activa</span>';
}else{
echo'<span class="label label-danger">No Activa</span>';
}
?>
</center>
</td>
<td>
<!-- Modal Eliminar-->
<button type="button" class="btn btn-primary btn-xs" data-toggle="modal" data-target="#EliminarDepartamento<?php echo $DepartamentoStockRow['id']; ?>"><i class="fa fa-trash-o"></i></button>
<div class="modal fade" id="EliminarDepartamento<?php echo $DepartamentoStockRow['id']; ?>" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModalLabel">Eliminar <?php echo $DepartamentoStockRow['nombre']; ?> del sistema</h4>
</div>
<div class="modal-body">
<form class="form-horizontal" method="post" action="">
<input type="hidden" name="IdDepartamento" value="<?php echo $DepartamentoStockRow['id']; ?>">
<input type="hidden" name="nombre" value="<?php echo $DepartamentoStockRow['nombre']; ?>">
<div class="form-group">
<div class="col-sm-12">
<div class="input-group">
¿Está seguro que desea eliminar el departamento?
</div>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="button" class="btn btn-default" data-dismiss="modal">Cerrar</button>
<button type="submit" name="EliminarDepartamento" class="btn btn-primary">Si, Eliminar</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<!-- Modal Eliminar Final -->
<!-- Modal Editar -->
<button type="button" class="btn btn-primary btn-xs" data-toggle="modal" data-target="#EditarDepartamento<?php echo $DepartamentoStockRow['id']; ?>"><i class="fa fa-pencil-square-o"></i></button>
<div class="modal fade" id="EditarDepartamento<?php echo $DepartamentoStockRow['id']; ?>" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModalLabel">Editar el departamento de <?php echo $DepartamentoStockRow['nombre']; ?></h4>
</div>
<div class="modal-body">
<form method="post" action="" class="form-horizontal">
<input type="hidden" name="IdDepartamento" value="<?php echo $DepartamentoStockRow['id']; ?>">
<div class="form-group">
<label>Descripción</label>
<input type="text" class="form-control" value="<?php echo $DepartamentoStockRow['nombre']; ?>" name="nombre" required="" autocomplete="off"/>
</div>
<div class="form-group">
<label>Estado</label>
<select name="estado" class="form-control">
<option value="1" <?php if($DepartamentoStockRow['habilitada']=='1'){ echo 'selected'; }else{} ?>>ACTIVO</option>
<option value="0" <?php if($DepartamentoStockRow['habilitada']=='0'){ echo 'selected'; }else{} ?>>NO ACTIVO</option>
</select>
</div>
<div class="form-group">
<button type="submit" name="EditarDepartamento" class="btn btn-primary">Editar Departamento</button>
<a href="#" class="btn btn-default">Cancelar</a>
</div>
</form>
</div>
</div>
</div>
</div>
<!-- Modal Editar Final -->
</td>
</tr>
<?php endforeach?>
</tbody>
</table>
</div>
<div class=" col-md-6">
<table class="table table-bordered">
<tbody>
<tr class="well">
<td><center><strong>Crear Nuevo Departamento</strong></center></td>
</tr>
<tr>
<td>
<form method="post" action="" class="form-horizontal">
<div class="form-group">
<label>Código</label>
<?php
$CodigoSql = $db->SQL("SELECT MAX(id)+1 AS MaxId FROM `departamento`");
$Codigo = $CodigoSql->fetch_array();
?>
<input type="text" class="form-control" name="id" value="<?php echo $Codigo['MaxId']; ?>" autocomplete="off" readonly />
</div>
<div class="form-group">
<label>Descripción</label>
<input type="text" class="form-control" name="nombre" required="" autocomplete="off"/>
</div>
<div class="form-group">
<label>Estado</label>
<select name="estado" class="form-control">
<option value="1" selected="">ACTIVO</option>
<option value="0">NO ACTIVO</option>
</select>
</div>
<div class="form-group">
<button type="submit" name="CrearDepartamento" class="btn btn-primary">Crear Departamentos</button>
<a href="#" class="btn btn-default">Cancelar</a>
</div>
</form>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<?php include (MODULO.'footer.php'); ?>
<!-- Cargado archivos javascript al final para que la pagina cargue mas rapido -->
<?php include(MODULO.'Tema.JS.php');?>
<script type="text/javascript" language="javascript" src="<?php echo ESTATICO ?>js/jquery.dataTables.min.js"></script>
<script type="text/javascript" language="javascript" src="<?php echo ESTATICO ?>js/dataTables.bootstrap.js"></script>
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
$('#departamentos').dataTable();
} );
</script>
<!-- Cargado archivos javascript al final para que la pagina cargue mas rapido Fin -->
</body>
</html>