Responsividad de tablas
This commit is contained in:
@@ -10,6 +10,9 @@
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
|
||||
<link href="https://cdn.datatables.net/1.13.4/css/jquery.dataTables.min.css" rel="stylesheet">
|
||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
||||
<script src="https://code.jquery.com/jquery-3.7.0.min.js"></script>
|
||||
<script src="https://cdn.datatables.net/1.13.4/js/jquery.dataTables.min.js"></script>
|
||||
|
||||
|
||||
<style>
|
||||
table.dataTable thead th { background: #343a40; color: #fff; }
|
||||
@@ -86,45 +89,47 @@
|
||||
<div class="content">
|
||||
<h4>🚛 Mis Choferes</h4>
|
||||
<a href="/IMPORTADORES/choferes/crear" class="btn btn-success mb-3">➕ Nuevo Chofer</a>
|
||||
<table class="table table-striped" id="tabla-choferes">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th>Nombre Completo</th>
|
||||
<th>Licencia</th>
|
||||
<th>Teléfono</th>
|
||||
<th>Email</th>
|
||||
<th>Ingreso</th>
|
||||
<th>Transportista</th>
|
||||
<th>Acciones</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach($choferes as $c): ?>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped" id="tabla-choferes">
|
||||
<thead>
|
||||
<tr>
|
||||
<td><?= $c['id_chofer'] ?></td>
|
||||
<td><?= htmlspecialchars($c['nombre_completo']) ?></td>
|
||||
<td><?= htmlspecialchars($c['numero_licencia']) ?></td>
|
||||
<td><?= htmlspecialchars($c['telefono']) ?></td>
|
||||
<td><?= htmlspecialchars($c['email']) ?></td>
|
||||
<td>
|
||||
<?php
|
||||
if ($c['created_at'] instanceof DateTime) {
|
||||
echo $c['created_at']->format('Y-m-d');
|
||||
} else {
|
||||
echo htmlspecialchars($c['created_at']);
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<td><?= htmlspecialchars($c['transportista']) ?></td>
|
||||
<td>
|
||||
<a href="/IMPORTADORES/choferes/editar?id=<?= $c['id_chofer'] ?>" class="btn btn-sm btn-primary">✏️</a>
|
||||
<button class="btn btn-sm btn-danger" onclick="confirmDeleteChofer(<?= $c['id_chofer'] ?>)">🗑️</button>
|
||||
</td>
|
||||
<th>#</th>
|
||||
<th>Nombre Completo</th>
|
||||
<th>Licencia</th>
|
||||
<th>Teléfono</th>
|
||||
<th>Email</th>
|
||||
<th>Ingreso</th>
|
||||
<th>Transportista</th>
|
||||
<th>Acciones</th>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach($choferes as $c): ?>
|
||||
<tr>
|
||||
<td><?= $c['id_chofer'] ?></td>
|
||||
<td><?= htmlspecialchars($c['nombre_completo']) ?></td>
|
||||
<td><?= htmlspecialchars($c['numero_licencia']) ?></td>
|
||||
<td><?= htmlspecialchars($c['telefono']) ?></td>
|
||||
<td><?= htmlspecialchars($c['email']) ?></td>
|
||||
<td>
|
||||
<?php
|
||||
if ($c['created_at'] instanceof DateTime) {
|
||||
echo $c['created_at']->format('Y-m-d');
|
||||
} else {
|
||||
echo htmlspecialchars($c['created_at']);
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<td><?= htmlspecialchars($c['transportista']) ?></td>
|
||||
<td>
|
||||
<a href="/IMPORTADORES/choferes/editar?id=<?= $c['id_chofer'] ?>" class="btn btn-sm btn-primary">✏️</a>
|
||||
<button class="btn btn-sm btn-danger" onclick="confirmDeleteChofer(<?= $c['id_chofer'] ?>)">🗑️</button>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
@@ -143,6 +148,15 @@
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
$('#tabla-choferes').DataTable({
|
||||
language: {
|
||||
url: '//cdn.datatables.net/plug-ins/1.13.4/i18n/es-ES.json'
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
<?php if(isset($_GET['deleted'])): ?>
|
||||
Swal.fire('¡Hecho!','Chofer eliminado.','success');
|
||||
<?php endif; ?>
|
||||
|
||||
@@ -7,8 +7,7 @@ header("X-Frame-Options: DENY");
|
||||
header("X-Content-Type-Options: nosniff");
|
||||
header("X-XSS-Protection: 1; mode=block");
|
||||
header("Referrer-Policy: no-referrer");
|
||||
header("Content-Security-Policy: default-src 'self'; style-src 'self' 'unsafe-inline' https://cdn.jsdelivr.net https://cdnjs.cloudflare.com; script-src 'self' https://cdn.jsdelivr.net https://cdnjs.cloudflare.com; img-src 'self' data:;");
|
||||
|
||||
header("Content-Security-Policy: default-src 'self'; style-src 'self' 'unsafe-inline' https://cdn.jsdelivr.net https://cdnjs.cloudflare.com https://fonts.googleapis.com; script-src 'self' https://cdn.jsdelivr.net https://cdnjs.cloudflare.com; img-src 'self' data:; font-src 'self' https://fonts.gstatic.com https://cdnjs.cloudflare.com;");
|
||||
$sql = "SELECT TOP 1 * FROM configuracion_sistema";
|
||||
$stmt = sqlsrv_prepare($conn, $sql);
|
||||
if (!$stmt || !sqlsrv_execute($stmt)) {
|
||||
|
||||
@@ -116,11 +116,11 @@ $mensajeMantenimiento = $config['mensaje_mantenimiento'] ?? 'El sistema se encue
|
||||
<form action="/IMPORTADORES/login/validar" method="POST">
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Correo electrónico</label>
|
||||
<input type="email" name="email" class="form-control" required>
|
||||
<input type="email" name="email" class="form-control" required autocomplete="username" value="">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Contraseña</label>
|
||||
<input type="password" name="password" class="form-control" required>
|
||||
<input type="password" name="password" class="form-control" required autocomplete="current-password" value="">
|
||||
</div>
|
||||
<div class="d-grid">
|
||||
<button type="submit" class="btn btn-primary">Iniciar sesión</button>
|
||||
|
||||
@@ -8,6 +8,9 @@
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
|
||||
<link href="https://cdn.datatables.net/1.13.4/css/jquery.dataTables.min.css" rel="stylesheet">
|
||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
||||
<script src="https://code.jquery.com/jquery-3.7.0.min.js"></script>
|
||||
<script src="https://cdn.datatables.net/1.13.4/js/jquery.dataTables.min.js"></script>
|
||||
|
||||
<style>
|
||||
table.dataTable thead th { background: #343a40; color: #fff; }
|
||||
body { font-family: 'Segoe UI', sans-serif; background-color: #f4f6f9; }
|
||||
@@ -79,60 +82,62 @@
|
||||
<div class="content">
|
||||
<h4>📄 Solicitudes de Importación</h4>
|
||||
<a href="/IMPORTADORES/solicitud_importacion/crear" class="btn btn-success mb-3">➕ Nueva Solicitud</a>
|
||||
<table class="table table-striped" id="tabla-solicitudes">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th>Factura</th>
|
||||
<th>Fecha</th>
|
||||
<th>Pedimento</th>
|
||||
<th>Incoterm</th>
|
||||
<th>País Proveedor</th>
|
||||
<th>Moneda</th>
|
||||
<th>Valor</th>
|
||||
<th>Vinculación</th>
|
||||
<th>Transportista</th>
|
||||
<th>PDF</th>
|
||||
<th>Acciones</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach($facturas as $f): ?>
|
||||
<tr>
|
||||
<td><?= $f['id_solicitud'] ?></td>
|
||||
<td><?= htmlspecialchars($f['numero_factura']) ?></td>
|
||||
<td><?= htmlspecialchars($f['fecha_factura']) ?></td>
|
||||
<td><?= htmlspecialchars($f['numero_pedimento']) ?></td>
|
||||
<td><?= htmlspecialchars($f['incoterm']) ?></td>
|
||||
<td><?= htmlspecialchars($f['pais_proveedor']) ?></td>
|
||||
<td><?= htmlspecialchars($f['tipo_moneda']) ?></td>
|
||||
<td><?= number_format($f['valor_factura'],2) ?></td>
|
||||
<td>
|
||||
<?php
|
||||
switch($f['vinculacion']) {
|
||||
case 1: echo 'Existe, no afecta'; break;
|
||||
case 2: echo 'Existe y afecta'; break;
|
||||
default: echo 'No existe';
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<td><?= htmlspecialchars($f['transportista']) ?></td>
|
||||
<td>
|
||||
<a href="/IMPORTADORES/solicitud_importacion/pdf?id=<?= $f['id_solicitud'] ?>"
|
||||
class="btn btn-sm btn-outline-secondary" target="_blank">
|
||||
📄 PDF
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
<a href="/IMPORTADORES/solicitud_importacion/editar?id=<?= $f['id_solicitud'] ?>"
|
||||
class="btn btn-sm btn-primary">✏️</a>
|
||||
<button class="btn btn-sm btn-danger"
|
||||
onclick="confirmDelete(<?= $f['id_solicitud'] ?>)">🗑️</button>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped" id="tabla-solicitudes">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th>Factura</th>
|
||||
<th>Fecha</th>
|
||||
<th>Pedimento</th>
|
||||
<th>Incoterm</th>
|
||||
<th>País Proveedor</th>
|
||||
<th>Moneda</th>
|
||||
<th>Valor</th>
|
||||
<th>Vinculación</th>
|
||||
<th>Transportista</th>
|
||||
<th>PDF</th>
|
||||
<th>Acciones</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach($facturas as $f): ?>
|
||||
<tr>
|
||||
<td><?= $f['id_solicitud'] ?></td>
|
||||
<td><?= htmlspecialchars($f['numero_factura']) ?></td>
|
||||
<td><?= htmlspecialchars($f['fecha_factura']) ?></td>
|
||||
<td><?= htmlspecialchars($f['numero_pedimento']) ?></td>
|
||||
<td><?= htmlspecialchars($f['incoterm']) ?></td>
|
||||
<td><?= htmlspecialchars($f['pais_proveedor']) ?></td>
|
||||
<td><?= htmlspecialchars($f['tipo_moneda']) ?></td>
|
||||
<td><?= number_format($f['valor_factura'],2) ?></td>
|
||||
<td>
|
||||
<?php
|
||||
switch($f['vinculacion']) {
|
||||
case 1: echo 'Existe, no afecta'; break;
|
||||
case 2: echo 'Existe y afecta'; break;
|
||||
default: echo 'No existe';
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<td><?= htmlspecialchars($f['transportista']) ?></td>
|
||||
<td>
|
||||
<a href="/IMPORTADORES/solicitud_importacion/pdf?id=<?= $f['id_solicitud'] ?>"
|
||||
class="btn btn-sm btn-outline-secondary" target="_blank">
|
||||
📄 PDF
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
<a href="/IMPORTADORES/solicitud_importacion/editar?id=<?= $f['id_solicitud'] ?>"
|
||||
class="btn btn-sm btn-primary">✏️</a>
|
||||
<button class="btn btn-sm btn-danger"
|
||||
onclick="confirmDelete(<?= $f['id_solicitud'] ?>)">🗑️</button>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
@@ -151,6 +156,15 @@
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
$('#tabla-solicitudes').DataTable({
|
||||
language: {
|
||||
url: '//cdn.datatables.net/plug-ins/1.13.4/i18n/es-ES.json'
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
<?php if(isset($_GET['deleted'])): ?>
|
||||
Swal.fire('¡Hecho!','Solicitud eliminada.','success');
|
||||
<?php endif; ?>
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
|
||||
<link href="https://cdn.datatables.net/1.13.4/css/jquery.dataTables.min.css" rel="stylesheet">
|
||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
||||
<script src="https://code.jquery.com/jquery-3.7.0.min.js"></script>
|
||||
<script src="https://cdn.datatables.net/1.13.4/js/jquery.dataTables.min.js"></script>
|
||||
|
||||
<style>
|
||||
table.dataTable thead th { background:#343a40; color:#fff; }
|
||||
@@ -86,39 +88,41 @@
|
||||
<div class="content">
|
||||
<h4>🚚 Mis Transportes</h4>
|
||||
<a href="/IMPORTADORES/transportes/crear" class="btn btn-success mb-3">➕ Nuevo Transporte</a>
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>#</th><th>Vehículo</th><th>Ident. Fiscal</th>
|
||||
<th>Foto</th><th>Transportista</th>
|
||||
<th>Alta</th><th>Acciones</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach($transportes as $t): ?>
|
||||
<tr>
|
||||
<td><?= $t['id_transporte'] ?></td>
|
||||
<td><?= htmlspecialchars($t['vehiculo']) ?></td>
|
||||
<td><?= htmlspecialchars($t['identificador_fiscal']) ?></td>
|
||||
<td>
|
||||
<?php if($t['foto_url']): ?>
|
||||
<img src="<?= $t['foto_url'] ?>" width="50">
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td><?= htmlspecialchars($t['transportista']) ?></td>
|
||||
<td><?= $t['creado_en']->format('Y-m-d') ?></td>
|
||||
<td>
|
||||
<a href="/IMPORTADORES/transportes/editar?id=<?= $t['id_transporte'] ?>"
|
||||
class="btn btn-sm btn-primary">✏️</a>
|
||||
<button class="btn btn-sm btn-danger"
|
||||
onclick="confirmDelete(<?= $t['id_transporte'] ?>)">
|
||||
🗑️
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped" id="tabla-transportes">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>#</th><th>Vehículo</th><th>Ident. Fiscal</th>
|
||||
<th>Foto</th><th>Transportista</th>
|
||||
<th>Alta</th><th>Acciones</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach($transportes as $t): ?>
|
||||
<tr>
|
||||
<td><?= $t['id_transporte'] ?></td>
|
||||
<td><?= htmlspecialchars($t['vehiculo']) ?></td>
|
||||
<td><?= htmlspecialchars($t['identificador_fiscal']) ?></td>
|
||||
<td>
|
||||
<?php if($t['foto_url']): ?>
|
||||
<img src="<?= $t['foto_url'] ?>" width="50">
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td><?= htmlspecialchars($t['transportista']) ?></td>
|
||||
<td><?= $t['creado_en']->format('Y-m-d') ?></td>
|
||||
<td>
|
||||
<a href="/IMPORTADORES/transportes/editar?id=<?= $t['id_transporte'] ?>"
|
||||
class="btn btn-sm btn-primary">✏️</a>
|
||||
<button class="btn btn-sm btn-danger"
|
||||
onclick="confirmDelete(<?= $t['id_transporte'] ?>)">
|
||||
🗑️
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
@@ -137,6 +141,15 @@
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
$('#tabla-transportes').DataTable({
|
||||
language: {
|
||||
url: '//cdn.datatables.net/plug-ins/1.13.4/i18n/es-ES.json'
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
<?php if(isset($_GET['deleted'])): ?>
|
||||
Swal.fire('¡Hecho!','Transporte eliminado.','success');
|
||||
<?php endif; ?>
|
||||
|
||||
@@ -2,10 +2,11 @@
|
||||
|
||||
<?php
|
||||
// Al principio de la vista, inicia sesión para leer los errores
|
||||
session_start();
|
||||
if (session_status() === PHP_SESSION_NONE) {
|
||||
session_start();
|
||||
}
|
||||
$errors = $_SESSION['import_errors'] ?? [];
|
||||
$success = $_SESSION['import_success'] ?? false;
|
||||
// Limpiar para que no se repitan
|
||||
unset($_SESSION['import_errors'], $_SESSION['import_success']);
|
||||
?>
|
||||
|
||||
|
||||
@@ -92,19 +92,21 @@
|
||||
<br>
|
||||
<h4 class="mb-4">🚚 Mis Transportistas</h4>
|
||||
<div class="card p-3 shadow-sm">
|
||||
<table id="transportistas-table" class="display nowrap" style="width:100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th>Clave</th>
|
||||
<th>Nombre</th>
|
||||
<th>RFC</th>
|
||||
<th>Ciudad</th>
|
||||
<th>Fecha Alta</th>
|
||||
<th>Acciones</th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
<div class="table-responsive">
|
||||
<table id="transportistas-table" class="display nowrap" style="width:100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th>Clave</th>
|
||||
<th>Nombre</th>
|
||||
<th>RFC</th>
|
||||
<th>Ciudad</th>
|
||||
<th>Fecha Alta</th>
|
||||
<th>Acciones</th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -153,34 +155,31 @@
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
function confirmDelete(id) {
|
||||
Swal.fire({
|
||||
title: '¿Eliminar transportista?',
|
||||
text: 'Esto sólo lo desactivará; no se podrá volver a usar.',
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonText: 'Sí, eliminar',
|
||||
cancelButtonText: 'Cancelar',
|
||||
confirmButtonColor: '#d33'
|
||||
}).then(result => {
|
||||
if (result.isConfirmed) {
|
||||
window.location = `/IMPORTADORES/transportistas/eliminar?id=${id}`;
|
||||
Swal.fire({
|
||||
title: '¿Eliminar transportista?',
|
||||
text: 'Esto sólo lo desactivará; no se podrá volver a usar.',
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonText: 'Sí, eliminar',
|
||||
cancelButtonText: 'Cancelar',
|
||||
confirmButtonColor: '#d33'
|
||||
}).then(result => {
|
||||
if (result.isConfirmed) {
|
||||
window.location = `/IMPORTADORES/transportistas/eliminar?id=${id}`;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Mostrar alert de “borrado” al volver de la acción
|
||||
<?php if (isset($_GET['deleted']) && $_GET['deleted']==='ok'): ?>
|
||||
Swal.fire({
|
||||
icon: 'success',
|
||||
title: 'Transportista eliminado',
|
||||
text: 'Ya no aparecerá en tu lista.',
|
||||
confirmButtonColor: '#198754'
|
||||
});
|
||||
<?php endif; ?>
|
||||
|
||||
// Mostrar alert de “borrado” al volver de la acción
|
||||
<?php if (isset($_GET['deleted']) && $_GET['deleted']==='ok'): ?>
|
||||
Swal.fire({
|
||||
icon: 'success',
|
||||
title: 'Transportista eliminado',
|
||||
text: 'Ya no aparecerá en tu lista.',
|
||||
confirmButtonColor: '#198754'
|
||||
});
|
||||
<?php endif; ?>
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user