diff --git a/app/controllers/solicitud_importacion.php b/app/controllers/solicitud_importacion.php index 9ceec94..6056769 100644 --- a/app/controllers/solicitud_importacion.php +++ b/app/controllers/solicitud_importacion.php @@ -796,4 +796,313 @@ function update_status() { } echo json_encode(['success'=>true]); exit; +} + +function pdf() { + // Verificar que se recibió el ID + if (!isset($_GET['id'])) { + http_response_code(400); + echo "ID de solicitud requerido"; + return; + } + + $id_solicitud = (int)$_GET['id']; + + try { + // 1. Conexión + $conn = getConnection(); + + // 2. Obtener datos de la solicitud principal + $sql = " + SELECT + s.*, + i.nombre as importador_nombre, + i.rfc as importador_rfc, + i.calle, + i.num_exterior, + i.num_interior, + i.ciudad, + i.colonia, + i.codigo_postal, + i.estado, + i.telefono, + i.correo, + t.nombre as transportista_nombre, + c.nombre as chofer_nombre + FROM solicitud_importacion_factura s + LEFT JOIN informacion_general i ON s.id_importador = i.id_usuario + LEFT JOIN transportistas t ON s.transportista_id = t.id_transportista + LEFT JOIN choferes c ON s.chofer_id = c.id_chofer + WHERE s.id_solicitud = ? + "; + + $params = array($id_solicitud); + $stmt = sqlsrv_query($conn, $sql, $params); + + if ($stmt === false) { + throw new Exception("Error en la consulta: " . print_r(sqlsrv_errors(), true)); + } + + $solicitud = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC); + sqlsrv_free_stmt($stmt); + + if (!$solicitud) { + http_response_code(404); + echo "Solicitud no encontrada"; + return; + } + + // 3. Obtener partidas de la solicitud + $sql = " + SELECT + p.*, + u.descripcion as unidad_descripcion + FROM solicitud_importacion_partidas p + LEFT JOIN unidades_medida_apendice7 u ON p.unidad_comercial_id = u.id + WHERE p.id_solicitud = ? + ORDER BY p.id_partida + "; + + $params = array($id_solicitud); + $stmt = sqlsrv_query($conn, $sql, $params); + + if ($stmt === false) { + throw new Exception("Error en la consulta de partidas: " . print_r(sqlsrv_errors(), true)); + } + + $partidas = array(); + while ($row = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC)) { + $partidas[] = $row; + } + sqlsrv_free_stmt($stmt); + + // 4. Configuración del sistema + global $config; + $nombre_sistema = $config['nombre_plataforma'] ?? 'Sistema Integral para Importadores de Hidrocarburos'; + $siglas = $config['siglas'] ?? 'SIIH'; + $logo_url = $config['logo_url'] ?? 'assets/img/logo_siih.png'; + + // 5. Generar HTML del PDF + $html = generarHTMLPDF($solicitud, $partidas, $nombre_sistema, $siglas, $logo_url); + + // 6. Configurar headers para PDF + header('Content-Type: application/pdf'); + header('Content-Disposition: inline; filename="solicitud_importacion_' . $id_solicitud . '.pdf"'); + + // 7. Generar PDF usando DomPDF + // Opción 1: DomPDF v0.8.x (compatible con PHP 5.x) + if (file_exists('lib/dompdf/dompdf-0.8.6/dompdf_config.inc.php')) { + require_once 'lib/dompdf/dompdf-0.8.6/dompdf_config.inc.php'; + + $dompdf = new DOMPDF(); + $dompdf->load_html($html); + $dompdf->set_paper('A4', 'portrait'); + $dompdf->render(); + + // Headers + header('Content-Type: application/pdf'); + header('Content-Disposition: inline; filename="solicitud_importacion_' . $id_solicitud . '.pdf"'); + + echo $dompdf->output(); + + // Opción 2: DomPDF v1.x/2.x (PHP 7+) + } elseif (file_exists('vendor/autoload.php') && PHP_VERSION_ID >= 70000) { + require_once 'vendor/autoload.php'; + + $options = new \Dompdf\Options(); + $options->set('defaultFont', 'Arial'); + $options->set('isRemoteEnabled', true); + + $dompdf = new \Dompdf\Dompdf($options); + $dompdf->loadHtml($html); + $dompdf->setPaper('A4', 'portrait'); + $dompdf->render(); + + header('Content-Type: application/pdf'); + header('Content-Disposition: inline; filename="solicitud_importacion_' . $id_solicitud . '.pdf"'); + + echo $dompdf->output(); + + // Opción 3: Alternativa usando mPDF (compatible con PHP 5.6+) + } elseif (file_exists('lib/mpdf/mpdf.php')) { + require_once 'lib/mpdf/mpdf.php'; + + $mpdf = new mPDF(); + $mpdf->WriteHTML($html); + $mpdf->Output('solicitud_importacion_' . $id_solicitud . '.pdf', 'I'); + + // Opción 4: TCPDF (muy compatible) + } elseif (file_exists('lib/tcpdf/tcpdf.php')) { + require_once 'lib/tcpdf/tcpdf.php'; + + $pdf = new TCPDF(); + $pdf->AddPage(); + $pdf->writeHTML($html, true, false, true, false, ''); + $pdf->Output('solicitud_importacion_' . $id_solicitud . '.pdf', 'I'); + + } else { + throw new Exception("No hay librerías PDF disponibles. Instala DomPDF, mPDF o TCPDF."); + } + + } catch (Exception $e) { + error_log("Error generando PDF: " . $e->getMessage()); + http_response_code(500); + echo "Error interno del servidor: " . $e->getMessage(); + } +} + +function generarHTMLPDF($solicitud, $partidas, $nombre_sistema, $siglas, $logo_url) { + // Formatear fecha + $fecha_expedicion = date('d/m/Y'); + $fecha_factura = $solicitud['fecha_factura']->format('d/m/Y'); + $fecha_vencimiento = (clone $solicitud['fecha_factura'])->modify('+30 days')->format('d/m/Y'); + + + // Construir dirección del importador + $direccion_completa = trim( + ($solicitud['calle'] ?? '') . ' ' . + ($solicitud['num_exterior'] ?? '') . ' ' . + ($solicitud['num_interior'] ? 'Int. ' . $solicitud['num_interior'] : '') . ', ' . + ($solicitud['colonia'] ?? '') . ', ' . + ($solicitud['ciudad'] ?? '') . ', ' . + ($solicitud['estado'] ?? '') . ' ' . + ($solicitud['codigo_postal'] ?? '') + ); + + // Calcular totales + $subtotal = 0; + foreach ($partidas as $partida) { + $subtotal += (float)$partida['valor_factura']; + } + $descuento_pct = 0; // Puedes calcularlo si tienes descuentos + $descuento = $subtotal * ($descuento_pct / 100); + $total = $subtotal - $descuento; + + $html = ' + + + + + Solicitud de Importación + + + + +
+
+ +
' . htmlspecialchars($siglas) . '
+
+ +
+
' . htmlspecialchars($nombre_sistema) . '
+
' . htmlspecialchars($direccion_completa ?: 'Dirección no disponible') . '
+
RFC: ' . htmlspecialchars($solicitud['importador_rfc'] ?? 'No disponible') . '
+
Tel: ' . htmlspecialchars($solicitud['telefono'] ?? 'No disponible') . '
+
Email: ' . htmlspecialchars($solicitud['correo'] ?? 'No disponible') . '
+
+ +
+
Solicitud de Importación
+
No. ' . htmlspecialchars($solicitud['id_solicitud']) . '
+
Régimen simplificado de confianza (RESICO) - 626
+
+
+ + +
+
+
RAZÓN SOCIAL / ' . htmlspecialchars($solicitud['importador_nombre'] ?? 'No disponible') . '
+
DOMICILIO FISCAL: ' . htmlspecialchars($direccion_completa) . '
+
+
RFC: ' . htmlspecialchars($solicitud['importador_rfc'] ?? 'No disponible') . '
+
TELÉFONO: ' . htmlspecialchars($solicitud['telefono'] ?? 'No disponible') . '
+
+
+
RÉGIMEN FISCAL: 601-General de Ley Personas Morales
+
+
+ +
+
FECHA DE EXPEDICIÓN
+
' . $fecha_expedicion . '
+
FECHA DE VENCIMIENTO
+
' . $fecha_vencimiento . '
+
+
+ + + + + + + + + + + + + + '; + + // Agregar partidas + foreach ($partidas as $partida) { + $precio_unitario = (float)($partida['precio_unitario'] ?? 0); + $cantidad = (float)($partida['cantidad_comercial'] ?? 0); + $valor_partida = (float)($partida['valor_factura'] ?? 0); + + $html .= ' + + + + + + + '; + } + + $html .= ' + +
ProductoUnidad de MedidaPrecio UnitarioCantidadDescuentoTotal
' . htmlspecialchars($partida['descripcion']) . '' . htmlspecialchars($partida['unidad_descripcion'] ?? 'Unidad de servicio (E48)') . '$' . number_format($precio_unitario > 0 ? $precio_unitario : $valor_partida, 2) . '' . number_format($cantidad > 0 ? $cantidad : 1, 0) . '' . number_format($descuento_pct, 1) . '%$' . number_format($valor_partida, 2) . '
+ + +
+
+ Total: + $' . number_format($total, 2) . ' +
+
+ + + + + +'; + + return $html; } \ No newline at end of file diff --git a/app/controllers/transportes.php b/app/controllers/transportes.php index d2216b8..13c919f 100644 --- a/app/controllers/transportes.php +++ b/app/controllers/transportes.php @@ -217,13 +217,13 @@ function eliminar() { exit; } - /** Formulario de importación masiva **/ function masivo() { if (!($_SESSION['usuario_id'] ?? false)) { header('Location: /IMPORTADORES/login'); exit; } + include __DIR__ . '/../../views/transportes/importar_masivo.php'; } diff --git a/views/admin/alta_usuarios.php b/views/admin/alta_usuarios.php index 673106a..9502b1a 100644 --- a/views/admin/alta_usuarios.php +++ b/views/admin/alta_usuarios.php @@ -1,3 +1,5 @@ + + @@ -6,137 +8,123 @@ - - - - +
+

Administración de Usuarios

-include __DIR__ . '/../partials/sidebar_sistemas.php'; -?> + +
+
➕ Nuevo Usuario
+
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+ +
+
- -
-

Administración de Usuarios

- - -
-
➕ Nuevo Usuario
-
-
- -
-
- -
-
- -
-
- -
-
-
- -
-
- - -
-
👁️ Usuarios Registrados
-
- - - - - - - - - - - - - - + +
+
👁️ Usuarios Registrados
+
+
#NombreCorreoTipoEstadoAcciones
+ - - - - - - + + + + + + - - - - - - - -
- - - - - Toggle - Reset - #NombreCorreoTipoEstadoAcciones
No hay usuarios registrados aún.
+ + + + + + + + + + + + + + + + Toggle + Reset + + + + + + No hay usuarios registrados aún. + + + + +
-
+ + + - - - - - - + function copiarPassword() { + navigator.clipboard.writeText(nuevaPassword).then(() => { + Swal.fire('Copiado', 'La contraseña fue copiada al portapapeles.', 'success'); + }); + } + function enviarPorCorreo() { + fetch(`/IMPORTADORES/sistemas/enviar_password?email=${encodeURIComponent(emailUsuario)}&pass=${encodeURIComponent(nuevaPassword)}`) + .then(response => response.text()) + .then(data => { + Swal.fire('Enviado', 'La contraseña fue enviada al correo del usuario.', 'success'); + }) + .catch(() => { + Swal.fire('Error', 'No se pudo enviar el correo.', 'error'); + }); + } + + - + \ No newline at end of file diff --git a/views/admin/bitacora_login.php b/views/admin/bitacora_login.php index 27d141b..80eadf4 100644 --- a/views/admin/bitacora_login.php +++ b/views/admin/bitacora_login.php @@ -1,50 +1,50 @@ + + + + Panel de Administración - Usuarios - - + +
+

🕵️ Bitácora de Accesos

- + + + # + ID Usuario + Correo + IP + Fecha + Éxito + Detalle + + + + + + + + + + format('Y-m-d H:i') : htmlspecialchars($r['fecha']) ?> + + + + + + + + + + +
-include __DIR__ . '/../partials/sidebar_sistemas.php'; -?> - -
-

🕵️ Bitácora de Accesos

- - - - - - - - - - - - - - - - - - - - - - - - - - -
#ID UsuarioCorreoIPFechaÉxitoDetalle
format('Y-m-d H:i') : htmlspecialchars($r['fecha']) ?> - - - -
-
+ + \ No newline at end of file diff --git a/views/admin/bitacora_usuarios.php b/views/admin/bitacora_usuarios.php index 867b7da..c873c31 100644 --- a/views/admin/bitacora_usuarios.php +++ b/views/admin/bitacora_usuarios.php @@ -1,42 +1,42 @@ + + + + Panel de Administración - Usuarios - - + + +
+

🛠️ Bitácora de Cambios de Usuario

- - - -
-

🛠️ Bitácora de Cambios de Usuario

- - - - - - - - - - - - - - - - - - - +
#ID UsuarioAcciónDescripciónFecha
format('Y-m-d H:i') : htmlspecialchars($r['fecha']) ?>
+ + + + + + + - - -
#ID UsuarioAcciónDescripciónFecha
-
+ + + + + + + + + format('Y-m-d H:i') : htmlspecialchars($r['fecha']) ?> + + + + +
+ + + \ No newline at end of file diff --git a/views/admin/login_sistemas.php b/views/admin/login_sistemas.php index f1d47cc..7b2927d 100644 --- a/views/admin/login_sistemas.php +++ b/views/admin/login_sistemas.php @@ -6,6 +6,7 @@ +

Acceso Administrativo

@@ -24,4 +25,4 @@
- + \ No newline at end of file diff --git a/views/agentes/bitacora.php b/views/agentes/bitacora.php index 17f1d5f..5ec545c 100644 --- a/views/agentes/bitacora.php +++ b/views/agentes/bitacora.php @@ -1,6 +1,5 @@ - + + @@ -12,68 +11,22 @@ include __DIR__ . '/../partials/sidebar_agente.php'; - diff --git a/views/agentes/importadores_activos.php b/views/agentes/importadores_activos.php index 86776e5..1b43c4c 100644 --- a/views/agentes/importadores_activos.php +++ b/views/agentes/importadores_activos.php @@ -2,6 +2,7 @@ require_once __DIR__ . '/../../app/helpers/crypto.php'; include __DIR__ . '/../partials/sidebar_agente.php'; ?> + Dashboard | Agente Aduanal @@ -9,45 +10,18 @@ include __DIR__ . '/../partials/sidebar_agente.php'; - +

✅ Importadores Activos

@@ -82,14 +56,14 @@ include __DIR__ . '/../partials/sidebar_agente.php';
- + diff --git a/views/agentes/solicitudes_pendientes.php b/views/agentes/solicitudes_pendientes.php index ace8834..dbe9f29 100644 --- a/views/agentes/solicitudes_pendientes.php +++ b/views/agentes/solicitudes_pendientes.php @@ -2,48 +2,21 @@ require_once __DIR__ . '/../../app/helpers/crypto.php'; include __DIR__ . '/../partials/sidebar_agente.php'; ?> + Dashboard | Agente Aduanal - diff --git a/views/bitacoras/bitacora_login.php b/views/bitacoras/bitacora_login.php index 2640859..f6f2f37 100644 --- a/views/bitacoras/bitacora_login.php +++ b/views/bitacoras/bitacora_login.php @@ -1,6 +1,5 @@ - + + @@ -12,68 +11,22 @@ include __DIR__ . '/../partials/sidebar_configuracion.php'; - @@ -93,7 +45,6 @@ include __DIR__ . '/../partials/sidebar_configuracion.php'; - diff --git a/views/choferes/crear.php b/views/choferes/crear.php index bc651bd..cb6cdd5 100644 --- a/views/choferes/crear.php +++ b/views/choferes/crear.php @@ -1,7 +1,8 @@ + + - 🚛 Nuevo Chofer @@ -10,80 +11,30 @@ - - -

+

➕ Nuevo Chofer

-
@@ -140,5 +91,6 @@
+ - + \ No newline at end of file diff --git a/views/choferes/editar.php b/views/choferes/editar.php index e949b90..05fa46e 100644 --- a/views/choferes/editar.php +++ b/views/choferes/editar.php @@ -1,7 +1,8 @@ + + - ✏️ Editar Chofer #<?= (int)$chofer['id_chofer'] ?> @@ -11,77 +12,29 @@ - - -

✏️ Editar Chofer #

-
@@ -175,5 +128,6 @@
+ - + \ No newline at end of file diff --git a/views/choferes/lista.php b/views/choferes/lista.php index c3a3cd6..0b20e28 100644 --- a/views/choferes/lista.php +++ b/views/choferes/lista.php @@ -1,7 +1,8 @@ + + - 🚛 Mis Choferes @@ -12,122 +13,74 @@ - - - -

+

🚛 Mis Choferes

➕ Nuevo Chofer -
- - - - - - - - - - - - - - - +
+
+
#Nombre CompletoLicenciaTeléfonoEmailIngresoTransportistaAcciones
+ - - - - - - - - + + + + + + + + - - -
- format('Y-m-d'); - } else { - echo htmlspecialchars($c['created_at']); - } - ?> - - ✏️ - - #Nombre CompletoLicenciaTeléfonoEmailIngresoTransportistaAcciones
+ + + + + + + + + + + format('Y-m-d'); + } else { + echo htmlspecialchars($c['created_at']); + } + ?> + + + + ✏️ + + + + + + +
@@ -151,7 +104,7 @@ $(document).ready(function () { $('#tabla-choferes').DataTable({ language: { - url: '//cdn.datatables.net/plug-ins/1.13.4/i18n/es-ES.json' + url: 'https://cdn.datatables.net/plug-ins/1.13.4/i18n/es-ES.json' } }); }); @@ -166,5 +119,6 @@ Swal.fire('¡Listo!','Chofer actualizado.','success'); + - + \ No newline at end of file diff --git a/views/configuracion/automatizaciones.php b/views/configuracion/automatizaciones.php index 0ac24f1..6109f5a 100644 --- a/views/configuracion/automatizaciones.php +++ b/views/configuracion/automatizaciones.php @@ -1,6 +1,5 @@ - + + @@ -10,77 +9,30 @@ include __DIR__ . '/../partials/sidebar_configuracion.php';
-

⚙️ Automatizaciones

- +

⚙️ Automatizaciones

+
\ No newline at end of file diff --git a/views/configuracion/dashboard_configuracion.php b/views/configuracion/dashboard_configuracion.php index ded5ab7..ac66121 100644 --- a/views/configuracion/dashboard_configuracion.php +++ b/views/configuracion/dashboard_configuracion.php @@ -1,6 +1,4 @@ - + @@ -11,70 +9,23 @@ include __DIR__ . '/../partials/sidebar_configuracion.php'; diff --git a/views/configuracion/editar.php b/views/configuracion/editar.php index 6215405..054b581 100644 --- a/views/configuracion/editar.php +++ b/views/configuracion/editar.php @@ -1,6 +1,4 @@ - + @@ -11,75 +9,25 @@ include __DIR__ . '/../partials/sidebar_configuracion.php'; diff --git a/views/expediente/index.php b/views/expediente/index.php index 984ae80..94c4a20 100644 --- a/views/expediente/index.php +++ b/views/expediente/index.php @@ -1,3 +1,5 @@ + + @@ -9,33 +11,10 @@ - +

📁 Expedientes Electrónicos

- + @@ -86,6 +65,8 @@ + + - + \ No newline at end of file diff --git a/views/expediente/subir.php b/views/expediente/subir.php index e31357f..fbe5244 100644 --- a/views/expediente/subir.php +++ b/views/expediente/subir.php @@ -1,3 +1,5 @@ + + @@ -13,7 +15,7 @@ - +

📤 Subir Archivos al Expediente

@@ -29,5 +31,6 @@
+ - + \ No newline at end of file diff --git a/views/expediente/ver.php b/views/expediente/ver.php index c3bd0dd..d6c82d5 100644 --- a/views/expediente/ver.php +++ b/views/expediente/ver.php @@ -1,3 +1,5 @@ + + @@ -14,10 +16,9 @@ - +

📂 Archivos del Expediente

-
@@ -71,5 +72,6 @@ ← Volver
+ \ No newline at end of file diff --git a/views/home/inicio.php b/views/home/inicio.php index 6cd59ec..de187cc 100644 --- a/views/home/inicio.php +++ b/views/home/inicio.php @@ -31,64 +31,21 @@ $mensajeMantenimiento = $config['mensaje_mantenimiento'] ?? 'El sistema se encue <?= htmlspecialchars($siglas) ?> | Inicio - - - @@ -176,4 +133,4 @@ $mensajeMantenimiento = $config['mensaje_mantenimiento'] ?? 'El sistema se encue - + \ No newline at end of file diff --git a/views/importadores/dashboard_importador.php b/views/importadores/dashboard_importador.php index fb68616..a28c49b 100644 --- a/views/importadores/dashboard_importador.php +++ b/views/importadores/dashboard_importador.php @@ -1,6 +1,5 @@ - + + @@ -10,73 +9,26 @@ include __DIR__ . '/../partials/sidebar_importador.php'; diff --git a/views/login/cambiar_password.php b/views/login/cambiar_password.php index c1af8d1..78afd23 100644 --- a/views/login/cambiar_password.php +++ b/views/login/cambiar_password.php @@ -19,67 +19,19 @@ if (!isset($_SESSION['recuperacion_autorizada'])) { <?= htmlspecialchars($siglas) ?> | Recuperación de Contraseña - - diff --git a/views/login/confirmacion.php b/views/login/confirmacion.php index aef6364..72955ea 100644 --- a/views/login/confirmacion.php +++ b/views/login/confirmacion.php @@ -14,75 +14,21 @@ $mensajeMantenimiento = $config['mensaje_mantenimiento'] ?? 'El sistema se encue <?= htmlspecialchars($siglas) ?> | Recuperación de Contraseña - - diff --git a/views/login/index.php b/views/login/index.php index 0666b99..e4562fd 100644 --- a/views/login/index.php +++ b/views/login/index.php @@ -21,65 +21,20 @@ $mensajeMantenimiento = $config['mensaje_mantenimiento'] ?? 'El sistema se encue <?= htmlspecialchars($siglas) ?> | Iniciar sesión - - diff --git a/views/login/recuperar.php b/views/login/recuperar.php index b4d896c..6aef8b5 100644 --- a/views/login/recuperar.php +++ b/views/login/recuperar.php @@ -14,67 +14,19 @@ $mensajeMantenimiento = $config['mensaje_mantenimiento'] ?? 'El sistema se encue <?= htmlspecialchars($siglas) ?> | Recuperación de Contraseña - - diff --git a/views/login/verificar_codigo.php b/views/login/verificar_codigo.php index 189e8ea..a61a6d0 100644 --- a/views/login/verificar_codigo.php +++ b/views/login/verificar_codigo.php @@ -23,109 +23,25 @@ if (!isset($_SESSION['email_recuperacion'])) { - diff --git a/views/partials/sidebar_agente.php b/views/partials/sidebar_agente.php index 12b5fd0..3a820a5 100644 --- a/views/partials/sidebar_agente.php +++ b/views/partials/sidebar_agente.php @@ -27,4 +27,4 @@ $nombreAgente = $_SESSION['usuario_nombre']; 📥 Solicitudes de Registro🕓 Bitácora - + \ No newline at end of file diff --git a/views/partials/sidebar_configuracion.php b/views/partials/sidebar_configuracion.php index 0e4becf..f6f83f5 100644 --- a/views/partials/sidebar_configuracion.php +++ b/views/partials/sidebar_configuracion.php @@ -7,31 +7,14 @@ if (!isset($_SESSION['usuario_id']) || $_SESSION['tipo_usuario'] !== 'importador ?> diff --git a/views/partials/sidebar_importador.php b/views/partials/sidebar_importador.php index 7419ad9..58de46c 100644 --- a/views/partials/sidebar_importador.php +++ b/views/partials/sidebar_importador.php @@ -7,31 +7,14 @@ if (!isset($_SESSION['usuario_id']) || $_SESSION['tipo_usuario'] !== 'importador ?> @@ -186,12 +169,9 @@ if (!isset($_SESSION['usuario_id']) || $_SESSION['tipo_usuario'] !== 'importador class="nav-link px-3 py-1 "> • Ver expediente - - - @@ -320,7 +300,6 @@ if (!isset($_SESSION['usuario_id']) || $_SESSION['tipo_usuario'] !== 'importador - • Ver expediente - - - - diff --git a/views/partials/sidebar_sistemas.php b/views/partials/sidebar_sistemas.php index d0fb93a..61fbf70 100644 --- a/views/partials/sidebar_sistemas.php +++ b/views/partials/sidebar_sistemas.php @@ -1,57 +1,17 @@ - -
Pedimento Fecha Factura
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#FacturaFechaPedimentoIncotermPaís ProveedorMonedaValorVinculaciónTransportistaPDFStatusAcciones
- - - - 📄 PDF - - - - - ✏️ - -
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
#FacturaFechaPedimentoIncotermPaís ProveedorMonedaValorVinculaciónTransportistaPDFStatusAcciones
+ + + + 📄 PDF + + + + + ✏️ + +
+
@@ -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 @@ }); + - + \ No newline at end of file diff --git a/views/transportes/crear.php b/views/transportes/crear.php index bced721..9bc0cd2 100644 --- a/views/transportes/crear.php +++ b/views/transportes/crear.php @@ -1,10 +1,10 @@ - + - ➕ Nuevo Transporte + ➕ Nuevo Transporte @@ -12,77 +12,28 @@
-

➕ Nuevo Transporte

@@ -145,5 +96,4 @@ - - + \ No newline at end of file diff --git a/views/transportes/editar.php b/views/transportes/editar.php index 47edf80..12ba27f 100644 --- a/views/transportes/editar.php +++ b/views/transportes/editar.php @@ -1,11 +1,10 @@ + + - - - - ➕ Editar Transporte # <?= $t['id_transporte'] ?> + ➕ Editar Transporte # <?= $t['id_transporte'] ?> @@ -13,82 +12,29 @@ -
-

✏️ Editar Transporte #

@@ -159,5 +105,6 @@ // Si todo OK, se envía }); + - + \ No newline at end of file diff --git a/views/transportes/importar_masivo.php b/views/transportes/importar_masivo.php index cf93f00..8feaf9d 100644 --- a/views/transportes/importar_masivo.php +++ b/views/transportes/importar_masivo.php @@ -1,10 +1,5 @@ - -if (!($_SESSION['usuario_id'] ?? false)) { - header('Location: /IMPORTADORES/login'); - exit; -} -?> @@ -15,79 +10,29 @@ if (!($_SESSION['usuario_id'] ?? false)) { -
-

📂 Importación Masiva de Transportes

- > 0) { + let importados = ; + let errores = ; + + if (importados > 0) { Toast.fire({ icon: 'success', - title: `✅ Importados: ` + title: `✅ Importados: ${importados}` }); } - // Errores: uno por toast - JSON.parse('').forEach(err => { + errores.forEach(err => { Toast.fire({ icon: 'error', title: err diff --git a/views/transportes/lista.php b/views/transportes/lista.php index 99fa192..c066dad 100644 --- a/views/transportes/lista.php +++ b/views/transportes/lista.php @@ -1,9 +1,10 @@ + + - - 🚚 Mis Transportes + 🚚 Mis Transportes @@ -11,117 +12,68 @@ - - - -

+

🚚 Mis Transportes

➕ Nuevo Transporte -
- - - - - - - - - - - - - - - - - - - - - -
#ContenedorIdent. FiscalFotoTransportistaAltaAcciones
- - - - format('Y-m-d') ?> - ✏️ - -
+
+
+ + + + + + + + + + + + + + + + + + + + + +
#ContenedorIdent. FiscalFotoTransportistaAltaAcciones
+ + + + format('Y-m-d') ?> + ✏️ + +
+
@@ -145,7 +97,7 @@ $(document).ready(function () { $('#tabla-transportes').DataTable({ language: { - url: '//cdn.datatables.net/plug-ins/1.13.4/i18n/es-ES.json' + url: 'https://cdn.datatables.net/plug-ins/1.13.4/i18n/es-ES.json' } }); }); @@ -154,5 +106,6 @@ Swal.fire('¡Hecho!','Transporte eliminado.','success'); + - + \ No newline at end of file diff --git a/views/transportistas/alta.php b/views/transportistas/alta.php index ebd206c..422e66b 100644 --- a/views/transportistas/alta.php +++ b/views/transportistas/alta.php @@ -1,74 +1,31 @@ + + + + Dashboard | Alta transportista - - - - -


🚛 Alta de Transportista

diff --git a/views/transportistas/bulk_upload.php b/views/transportistas/bulk_upload.php index 0c9fe35..3410446 100644 --- a/views/transportistas/bulk_upload.php +++ b/views/transportistas/bulk_upload.php @@ -1,5 +1,4 @@ - - + - @@ -21,30 +19,11 @@ unset($_SESSION['import_errors'], $_SESSION['import_success']); - -
-
-

🚛 Carga Masiva de Transportistas

-

1. Descarga la plantilla, complétala con tus datos y luego súbela aquí.

@@ -143,7 +96,4 @@ unset($_SESSION['import_errors'], $_SESSION['import_success']); - - - - + \ No newline at end of file diff --git a/views/transportistas/editar.php b/views/transportistas/editar.php index 5b08491..655256c 100644 --- a/views/transportistas/editar.php +++ b/views/transportistas/editar.php @@ -1,7 +1,5 @@ - + + @@ -11,74 +9,26 @@ session_start(); -

✏️ Editar Transportista #

@@ -193,5 +143,6 @@ session_start(); }); }); + - + \ No newline at end of file diff --git a/views/transportistas/lista.php b/views/transportistas/lista.php index b8ff3aa..8240576 100644 --- a/views/transportistas/lista.php +++ b/views/transportistas/lista.php @@ -12,77 +12,28 @@
-

🚚 Mis Transportistas

➕ Nuevo Transportista
@@ -111,7 +62,7 @@ - + - + \ No newline at end of file