Responsividad de tablas

This commit is contained in:
2025-05-13 08:06:54 -06:00
parent 3a9b7fa520
commit 01929847c0
7 changed files with 208 additions and 168 deletions

View File

@@ -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; ?>