This commit is contained in:
2025-06-04 10:33:01 -06:00
parent 04ae185504
commit 3a01c24bf5
51 changed files with 1197 additions and 2765 deletions

View File

@@ -12,33 +12,10 @@
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<style>
body { font-family: 'Segoe UI', sans-serif; background-color: #f4f6f9; }
.sidebar {
width: 220px;
height: 100vh;
background-color: #343a40;
position: fixed;
top: 0;
left: 0;
padding-top: 56px;
z-index: 1040;
}
.sidebar .nav-link {
font-weight: bold;
color: white;
transition: all 0.3s ease;
}
.sidebar .nav-link:hover, .sidebar .nav-link.active {
background-color: #495057;
color: #fff;
}
.content {
margin-top: 56px;
padding: 40px 20px;
position: relative;
z-index: 1;
background-color: #f4f6f9;
transition: margin-left 0.3s ease;
}
.sidebar { width: 220px; height: 100vh; background-color: #343a40; position: fixed; top: 0; left: 0; padding-top: 56px; z-index: 1040; }
.sidebar .nav-link { font-weight: bold; color: white; transition: all 0.3s ease; }
.sidebar .nav-link:hover, .sidebar .nav-link.active { background-color: #495057; color: #fff; }
.content { margin-top: 56px; padding: 40px 20px; position: relative; z-index: 1; background-color: #f4f6f9; transition: margin-left 0.3s ease; }
@media (min-width: 768px) { .content { margin-left: 250px; } }
@media (max-width: 767.98px) {
.content { margin-left: 0; }
@@ -222,8 +199,8 @@
<!-- Activo -->
<div class="form-check mt-4">
<input id="status" name="status" type="checkbox" class="form-check-input" checked>
<label for="status" class="form-check-label">Activo</label>
<input id="status" name="status" type="checkbox" class="hide form-check-input" checked>
<label for="status" class="hide form-check-label">Activo</label>
</div>
<!-- Botones finales -->
@@ -370,5 +347,6 @@
proveedorEl.innerHTML = '<option value="">No fue posible cargar proveedores</option>';
});
</script>
</body>
</html>

View File

@@ -1,4 +1,4 @@
<?php include __DIR__ . '/../partials/sidebar_importador.php'; ?>
<?php include __DIR__ . '/../partials/sidebar_importador.php'; ?>
<!DOCTYPE html>
<html lang="es">

View File

@@ -12,75 +12,28 @@
<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; }
.sidebar {
width: 220px;
height: 100vh;
background-color: #343a40;
position: fixed;
top: 0;
left: 0;
padding-top: 56px; /* Alineado con la altura de la navbar */
z-index: 1040; /* Asegura que esté por encima del contenido */
}
.sidebar .nav-link {
font-weight: bold;
color: white;
transition: all 0.3s ease;
.sidebar { width: 220px; height: 100vh; background-color: #343a40; position: fixed; top: 0; left: 0; padding-top: 56px; z-index: 1040;
}
.sidebar .nav-link { font-weight: bold; color: white; transition: all 0.3s ease; }
.sidebar .nav-link:hover,
.sidebar .nav-link.active {
background-color: #495057;
color: #fff;
}
.content {
margin-top: 56px; /* Ajusta debajo de navbar */
padding: 40px 20px;
position: relative;
z-index: 1;
background-color: #f4f6f9; /* Asegura fondo uniforme */
transition: margin-left 0.3s ease;
}
.navbar {
position: fixed;
top: 0;
width: 100%;
z-index: 1050;
.sidebar .nav-link.active { background-color: #495057; color: #fff; }
.content { margin-top: 56px; padding: 40px 20px; position: relative; z-index: 1; background-color: #f4f6f9; transition: margin-left 0.3s ease;
}
.navbar { position: fixed; top: 0; width: 100%; z-index: 1050; }
/* A partir de dispositivos medianos (>=768px), deja espacio lateral */
@media (min-width: 768px) {
.content {
margin-left: 250px; /* Ancho del sidebar */
}
}
@media (min-width: 768px) { .content { margin-left: 250px; /* Ancho del sidebar */ } }
/* En móviles, sin margen lateral */
@media (max-width: 767.98px) {
.content {
margin-left: 0;
}
.sidebar .nav-link {
font-weight: normal;
color: #343a40;
background-color: transparent;
}
.content { margin-left: 0; }
.sidebar .nav-link { font-weight: normal; color: #343a40; background-color: transparent; }
.sidebar .nav-link:hover,
.sidebar .nav-link.active {
background-color: #e9ecef;
color: #212529;
}
}
.card {
border-radius: 12px;
}
.status-select:disabled {
background-color: #e9ecef;
color: #6c757d;
.sidebar .nav-link.active { background-color: #e9ecef; color: #212529; }
}
.card { border-radius: 12px; }
.status-select:disabled { background-color: #e9ecef; color: #6c757d;}
</style>
</head>
<body>
@@ -88,76 +41,82 @@
<div class="content">
<h4>📄 Solicitudes de Importación</h4>
<a href="/IMPORTADORES/solicitud_importacion/crear" class="btn btn-success mb-3"> Nueva Solicitud</a>
<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>
<!-- Nueva columna Status -->
<th>Status</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['nombre_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>
<!-- Celda de Status -->
<td>
<select
class="form-select status-select"
data-id="<?= $f['id_solicitud'] ?>"
>
<option value="1" <?= $f['status']==1 ? 'selected' : '' ?>>1 En proceso</option>
<option value="2" <?= $f['status']==2 ? 'selected' : '' ?>>2 Solicitar importación</option>
<option value="3" <?= $f['status']==3 ? 'selected' : '' ?>>3 Con agencia aduana</option>
<option value="4" <?= $f['status']==4 ? 'selected' : '' ?>>4 En proceso de pago</option>
<option value="5" <?= $f['status']==5 ? 'selected' : '' ?>>5 Pedimento generado</option>
</select>
</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="card p-3 shadow-sm">
<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>
<!-- Nueva columna Status -->
<th>Status</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['nombre_pais_proveedor']) ?></td>
<td><?= htmlspecialchars($f['tipo_moneda']) ?></td>
<td><?= number_format($f['valor_factura'],2) ?></td>
<!-- Celda de Vinculación -->
<td>
<?php
switch($f['vinculacion']) {
case 1: echo 'Existe, no afecta'; break;
case 2: echo 'Existe y afecta'; break;
default: echo 'No existe';
}
?>
</td>
<!-- Celda de Transportista -->
<td><?= htmlspecialchars($f['transportista']) ?></td>
<!-- Celda de Vista PDF -->
<td>
<a href="/IMPORTADORES/solicitud_importacion/pdf?id=<?= $f['id_solicitud'] ?>"
class="btn btn-sm btn-outline-secondary" target="_blank">
📄 PDF
</a>
</td>
<!-- Celda de Status -->
<td>
<select
class="form-select status-select"
data-id="<?= $f['id_solicitud'] ?>"
>
<option value="1" <?= $f['status']==1 ? 'selected' : '' ?>>1 En proceso</option>
<option value="2" <?= $f['status']==2 ? 'selected' : '' ?>>2 Solicitar importación</option>
<option value="3" <?= $f['status']==3 ? 'selected' : '' ?>>3 Con agencia aduana</option>
<option value="4" <?= $f['status']==4 ? 'selected' : '' ?>>4 En proceso de pago</option>
<option value="5" <?= $f['status']==5 ? 'selected' : '' ?>>5 Pedimento generado</option>
</select>
</td>
<!-- Celda de Acciones -->
<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>
</div>
@@ -181,7 +140,7 @@
$(document).ready(function () {
// Inicializa DataTable
const table = $('#tabla-solicitudes').DataTable({
language: { url: '//cdn.datatables.net/plug-ins/1.13.4/i18n/es-ES.json' }
language: { url: 'https://cdn.datatables.net/plug-ins/1.13.4/i18n/es-ES.json' }
});
// Función para bloquear o desbloquear acciones según status
@@ -194,27 +153,27 @@
// Al cambiar el select de status
$('#tabla-solicitudes').on('change', '.status-select', function () {
const $sel = $(this);
const id = $sel.data('id');
const status = $sel.val();
const $row = $sel.closest('tr');
// Bloquear botones localmente
updateRowStatus($row, status);
const $sel = $(this);
const id = $sel.data('id');
const status = $sel.val();
const $row = $sel.closest('tr');
// Bloquear botones localmente
updateRowStatus($row, status);
// Llamada AJAX
$.post(
'/IMPORTADORES/solicitud_importacion/update_status',
{ id: id, status: status },
function(res) {
if (!res.success) {
Swal.fire('Error','No se pudo actualizar status','error');
}
},
'json'
).fail(() => {
Swal.fire('Error','No se pudo conectar al servidor','error');
});
});
// Llamada AJAX
$.post(
'/IMPORTADORES/solicitud_importacion/update_status',
{ id: id, status: status },
function(res) {
if (!res.success) {
Swal.fire('Error','No se pudo actualizar status','error');
}
},
'json'
).fail(() => {
Swal.fire('Error','No se pudo conectar al servidor','error');
});
});
// Al cargar, aplica bloqueo si ya está en “Solicitar importación”
$('#tabla-solicitudes tbody tr').each(function () {
@@ -232,5 +191,6 @@
<?php endif; ?>
});
</script>
</body>
</html>
</html>