525 lines
20 KiB
PHP
525 lines
20 KiB
PHP
<?php
|
|
include __DIR__ . '/../partials/sidebar_importador.php';
|
|
|
|
// Convertir fechas de formato int a date si están presentes
|
|
$fecha_pedimento_display = '';
|
|
$fecha_inicio_display = '';
|
|
$fecha_final_display = '';
|
|
|
|
if (!empty($previo['FechaPedimento'])) {
|
|
$fecha_str = (string)$previo['FechaPedimento'];
|
|
if (strlen($fecha_str) === 8) {
|
|
$fecha_pedimento_display = substr($fecha_str, 0, 4) . '-' . substr($fecha_str, 4, 2) . '-' . substr($fecha_str, 6, 2);
|
|
}
|
|
}
|
|
|
|
if (!empty($previo['FechaInicio'])) {
|
|
$fecha_str = (string)$previo['FechaInicio'];
|
|
if (strlen($fecha_str) === 8) {
|
|
$fecha_inicio_display = substr($fecha_str, 0, 4) . '-' . substr($fecha_str, 4, 2) . '-' . substr($fecha_str, 6, 2);
|
|
}
|
|
}
|
|
|
|
if (!empty($previo['FechaFinal'])) {
|
|
$fecha_str = (string)$previo['FechaFinal'];
|
|
if (strlen($fecha_str) === 8) {
|
|
$fecha_final_display = substr($fecha_str, 0, 4) . '-' . substr($fecha_str, 4, 2) . '-' . substr($fecha_str, 6, 2);
|
|
}
|
|
}
|
|
?>
|
|
|
|
<!DOCTYPE html>
|
|
<html lang="es">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title>Editar Pedimento</title>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
|
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">
|
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
|
|
<style>
|
|
:root {
|
|
--primary: #2563eb;
|
|
--primary-dark: #1d4ed8;
|
|
--secondary: #64748b;
|
|
--success: #059669;
|
|
--warning: #d97706;
|
|
--danger: #dc2626;
|
|
--info: #0891b2;
|
|
--light: #f8fafc;
|
|
--dark: #0f172a;
|
|
--border-color: #e2e8f0;
|
|
--text-muted: #64748b;
|
|
--bg-body: #f8fafc;
|
|
}
|
|
|
|
* {
|
|
margin: 0;
|
|
padding: 0;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
body {
|
|
font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
|
|
background-color: var(--bg-body);
|
|
color: var(--dark);
|
|
line-height: 1.6;
|
|
}
|
|
|
|
.main-content {
|
|
margin-left: 280px;
|
|
padding: 2rem;
|
|
min-height: 100vh;
|
|
transition: margin-left 0.3s ease;
|
|
}
|
|
|
|
@media (max-width: 768px) {
|
|
.main-content {
|
|
margin-left: 0;
|
|
padding: 1rem;
|
|
}
|
|
}
|
|
|
|
.page-header {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
margin-bottom: 2rem;
|
|
flex-wrap: wrap;
|
|
gap: 1rem;
|
|
}
|
|
|
|
.page-title {
|
|
color: var(--dark);
|
|
font-weight: 600;
|
|
font-size: 1.75rem;
|
|
margin: 0;
|
|
}
|
|
|
|
.btn-modern {
|
|
background: var(--primary);
|
|
color: white;
|
|
border: none;
|
|
padding: 0.625rem 1.25rem;
|
|
border-radius: 6px;
|
|
font-weight: 500;
|
|
font-size: 0.875rem;
|
|
transition: all 0.2s ease;
|
|
text-decoration: none;
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: 0.5rem;
|
|
}
|
|
|
|
.btn-modern:hover {
|
|
background: var(--primary-dark);
|
|
color: white;
|
|
transform: translateY(-1px);
|
|
text-decoration: none;
|
|
}
|
|
|
|
.btn-modern.success {
|
|
background: var(--success);
|
|
}
|
|
|
|
.btn-modern.success:hover {
|
|
background: #047857;
|
|
}
|
|
|
|
.btn-modern.secondary {
|
|
background: var(--secondary);
|
|
}
|
|
|
|
.btn-modern.secondary:hover {
|
|
background: #475569;
|
|
}
|
|
|
|
.form-card {
|
|
background: white;
|
|
border: 1px solid var(--border-color);
|
|
border-radius: 12px;
|
|
padding: 2rem;
|
|
margin-bottom: 1.5rem;
|
|
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
|
}
|
|
|
|
.form-section-title {
|
|
color: var(--dark);
|
|
font-weight: 600;
|
|
font-size: 1.1rem;
|
|
margin-bottom: 1.5rem;
|
|
padding-bottom: 0.75rem;
|
|
border-bottom: 1px solid var(--border-color);
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 0.5rem;
|
|
}
|
|
|
|
.form-section-icon {
|
|
width: 24px;
|
|
height: 24px;
|
|
background: var(--primary);
|
|
color: white;
|
|
border-radius: 4px;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
font-size: 0.75rem;
|
|
}
|
|
|
|
.form-label {
|
|
color: var(--dark);
|
|
font-weight: 500;
|
|
font-size: 0.875rem;
|
|
margin-bottom: 0.5rem;
|
|
}
|
|
|
|
.form-control, .form-select {
|
|
border: 1px solid var(--border-color);
|
|
border-radius: 6px;
|
|
padding: 0.625rem 0.75rem;
|
|
font-size: 0.875rem;
|
|
transition: all 0.2s ease;
|
|
}
|
|
|
|
.form-control:focus, .form-select:focus {
|
|
border-color: var(--primary);
|
|
box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.1);
|
|
}
|
|
|
|
.fade-in {
|
|
animation: fadeIn 0.5s ease-out;
|
|
}
|
|
|
|
@keyframes fadeIn {
|
|
from { opacity: 0; transform: translateY(10px); }
|
|
to { opacity: 1; transform: translateY(0); }
|
|
}
|
|
/* A partir de dispositivos medianos (>=768px), deja espacio lateral */
|
|
@media (min-width: 768px) { .content { margin-left: 250px; } }
|
|
/* 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; }
|
|
.sidebar .nav-link:hover,
|
|
.sidebar .nav-link.active { background-color: #e9ecef; color: #212529; }
|
|
}
|
|
.card { border-radius: 12px; }
|
|
/* Animaciones personalizadas */
|
|
.card-hover { transition: all 0.3s ease; }
|
|
.fade-in-up { animation: fadeInUp 0.8s ease-out; }
|
|
@keyframes fadeInUp {
|
|
from { opacity: 0; transform: translateY(30px); }
|
|
to { opacity: 1; transform: translateY(0); }
|
|
}
|
|
/* Animación para el título */
|
|
.title-glow { text-shadow: 0 0 10px rgba(0, 123, 255, 0.3); }
|
|
/* Efecto para botones */
|
|
.btn-animated { transition: all 0.3s ease; position: relative; overflow: hidden; }
|
|
.btn-animated:hover { transform: translateY(-2px); box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2); }
|
|
.btn-animated::before { content: ''; position: absolute; top: 0; left: -100%; width: 100%; height: 100%;
|
|
background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent); transition: left 0.5s; }
|
|
.btn-animated:hover::before { left: 100%; }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
|
|
<div class="main-content">
|
|
<!-- Page Header -->
|
|
<div class="page-header">
|
|
<h1 class="page-title">Editar Pedimento #<?= htmlspecialchars($previo['IdPrevio']) ?></h1>
|
|
<a href="/IMPORTADORES/catalogo_pedimentos/lista" class="btn-modern secondary">
|
|
<i class="fas fa-arrow-left"></i>
|
|
Regresar a Lista
|
|
</a>
|
|
</div>
|
|
|
|
<!-- Form Container -->
|
|
<form action="/IMPORTADORES/catalogo_pedimentos/actualizar" method="POST" id="formPedimento" class="fade-in">
|
|
<input type="hidden" name="id_previo" value="<?= htmlspecialchars($previo['IdPrevio']) ?>">
|
|
|
|
<div class="row">
|
|
<!-- Información Básica -->
|
|
<div class="col-md-6">
|
|
<div class="card mb-3">
|
|
<div class="card-header">
|
|
<h5 class="mb-0"><i class="fas fa-info-circle"></i> Información Básica</h5>
|
|
</div>
|
|
<div class="card-body">
|
|
<div class="mb-3">
|
|
<label for="pedimento" class="form-label">Número de Pedimento <span class="text-danger">*</span></label>
|
|
<input type="text" class="form-control" id="pedimento" name="pedimento" required
|
|
value="<?= htmlspecialchars($previo['Pedimento'] ?? '') ?>"
|
|
placeholder="Ej: 23 47 3807 8001234">
|
|
</div>
|
|
|
|
<div class="row">
|
|
<div class="col-md-6">
|
|
<div class="mb-3">
|
|
<label for="tipo_operacion" class="form-label">Tipo de Operación</label>
|
|
<select class="form-select" id="tipo_operacion" name="tipo_operacion">
|
|
<option value="">Seleccionar...</option>
|
|
<option value="1" <?= ($previo['TipoOperacion'] == 1) ? 'selected' : '' ?>>Importación Definitiva</option>
|
|
<option value="2" <?= ($previo['TipoOperacion'] == 2) ? 'selected' : '' ?>>Exportación Definitiva</option>
|
|
<option value="3" <?= ($previo['TipoOperacion'] == 3) ? 'selected' : '' ?>>Importación Temporal</option>
|
|
<option value="4" <?= ($previo['TipoOperacion'] == 4) ? 'selected' : '' ?>>Exportación Temporal</option>
|
|
<option value="5" <?= ($previo['TipoOperacion'] == 5) ? 'selected' : '' ?>>Tránsito</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<div class="mb-3">
|
|
<label for="tipo_pedimento" class="form-label">Tipo de Pedimento</label>
|
|
<select class="form-select" id="tipo_pedimento" name="tipo_pedimento">
|
|
<option value="">Seleccionar...</option>
|
|
<option value="1" <?= ($previo['TipoPedimento'] == 1) ? 'selected' : '' ?>>Normal</option>
|
|
<option value="2" <?= ($previo['TipoPedimento'] == 2) ? 'selected' : '' ?>>Consolidado</option>
|
|
<option value="3" <?= ($previo['TipoPedimento'] == 3) ? 'selected' : '' ?>>Rectificación</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- ...existing form fields... -->
|
|
<div class="row">
|
|
<div class="col-md-6">
|
|
<div class="mb-3">
|
|
<label for="clave_ped" class="form-label">Clave de Pedimento</label>
|
|
<input type="text" class="form-control" id="clave_ped" name="clave_ped"
|
|
value="<?= htmlspecialchars($previo['ClavePed'] ?? '') ?>"
|
|
placeholder="Ej: A1" maxlength="10">
|
|
</div>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<div class="mb-3">
|
|
<label for="regimen" class="form-label">Régimen</label>
|
|
<input type="text" class="form-control" id="regimen" name="regimen"
|
|
value="<?= htmlspecialchars($previo['Regimen'] ?? '') ?>"
|
|
placeholder="Ej: IMD" maxlength="10">
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="mb-3">
|
|
<label for="destino" class="form-label">Destino</label>
|
|
<input type="text" class="form-control" id="destino" name="destino"
|
|
value="<?= htmlspecialchars($previo['Destino'] ?? '') ?>"
|
|
placeholder="Código de destino" maxlength="10">
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Información del Cliente -->
|
|
<div class="col-md-6">
|
|
<div class="card mb-3">
|
|
<div class="card-header">
|
|
<h5 class="mb-0"><i class="fas fa-user"></i> Información del Cliente</h5>
|
|
</div>
|
|
<div class="card-body">
|
|
<div class="mb-3">
|
|
<label for="cliente_rfc" class="form-label">RFC del Cliente <span class="text-danger">*</span></label>
|
|
<input type="text" class="form-control" id="cliente_rfc" name="cliente_rfc" required
|
|
value="<?= htmlspecialchars($previo['ClienteRFC'] ?? '') ?>"
|
|
placeholder="Ej: ABC123456789" maxlength="20" style="text-transform: uppercase;">
|
|
</div>
|
|
|
|
<div class="mb-3">
|
|
<label for="cliente_nombre" class="form-label">Nombre/Razón Social del Cliente <span class="text-danger">*</span></label>
|
|
<textarea class="form-control" id="cliente_nombre" name="cliente_nombre" rows="3" required
|
|
placeholder="Nombre completo o razón social" maxlength="500"><?= htmlspecialchars($previo['ClienteNombre'] ?? '') ?></textarea>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Fechas -->
|
|
<div class="card mb-3">
|
|
<div class="card-header">
|
|
<h5 class="mb-0"><i class="fas fa-calendar"></i> Fechas</h5>
|
|
</div>
|
|
<div class="card-body">
|
|
<div class="mb-3">
|
|
<label for="fecha_pedimento" class="form-label">Fecha del Pedimento</label>
|
|
<input type="date" class="form-control" id="fecha_pedimento" name="fecha_pedimento"
|
|
value="<?= $fecha_pedimento_display ?>">
|
|
</div>
|
|
|
|
<div class="row">
|
|
<div class="col-md-6">
|
|
<div class="mb-3">
|
|
<label for="fecha_inicio" class="form-label">Fecha de Inicio</label>
|
|
<input type="date" class="form-control" id="fecha_inicio" name="fecha_inicio"
|
|
value="<?= $fecha_inicio_display ?>">
|
|
</div>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<div class="mb-3">
|
|
<label for="fecha_final" class="form-label">Fecha Final</label>
|
|
<input type="date" class="form-control" id="fecha_final" name="fecha_final"
|
|
value="<?= $fecha_final_display ?>">
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Información Adicional -->
|
|
<div class="row">
|
|
<div class="col-md-12">
|
|
<div class="card mb-3">
|
|
<div class="card-header">
|
|
<h5 class="mb-0"><i class="fas fa-cogs"></i> Información Adicional</h5>
|
|
</div>
|
|
<div class="card-body">
|
|
<div class="row">
|
|
<div class="col-md-6">
|
|
<div class="mb-3">
|
|
<label for="archivo_final_previo" class="form-label">Archivo Final Previo</label>
|
|
<input type="text" class="form-control" id="archivo_final_previo" name="archivo_final_previo"
|
|
value="<?= htmlspecialchars($previo['ArchivoFinalPrevio'] ?? '') ?>"
|
|
placeholder="Nombre del archivo" maxlength="100">
|
|
</div>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<div class="mb-3">
|
|
<label for="acuse_cons" class="form-label">Acuse de Recibo</label>
|
|
<input type="text" class="form-control" id="acuse_cons" name="acuse_cons"
|
|
value="<?= htmlspecialchars($previo['AcuseCons'] ?? '') ?>"
|
|
placeholder="Número de acuse" maxlength="20">
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row">
|
|
<div class="col-md-6">
|
|
<div class="mb-3">
|
|
<label for="tipo" class="form-label">Tipo</label>
|
|
<input type="text" class="form-control" id="tipo" name="tipo"
|
|
value="<?= htmlspecialchars(trim($previo['Tipo'] ?? '')) ?>"
|
|
placeholder="Tipo de pedimento" maxlength="10">
|
|
</div>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<div class="mb-3">
|
|
<label for="status" class="form-label">Estado</label>
|
|
<select class="form-select" id="status" name="status">
|
|
<option value="1" <?= ($previo['Status'] == 1) ? 'selected' : '' ?>>Activo</option>
|
|
<option value="0" <?= ($previo['Status'] == 0) ? 'selected' : '' ?>>Inactivo</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Información de Auditoría -->
|
|
<div class="row">
|
|
<div class="col-md-12">
|
|
<div class="card mb-3 bg-light">
|
|
<div class="card-header">
|
|
<h5 class="mb-0"><i class="fas fa-info"></i> Información de Registro</h5>
|
|
</div>
|
|
<div class="card-body">
|
|
<div class="row">
|
|
<div class="col-md-6">
|
|
<p class="mb-1"><strong>ID del Registro:</strong> <?= htmlspecialchars($previo['IdPrevio']) ?></p>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<p class="mb-1"><strong>Fecha de Registro:</strong>
|
|
<?php
|
|
if ($previo['Timestamp'] instanceof DateTime) {
|
|
echo $previo['Timestamp']->format('d/m/Y H:i:s');
|
|
} else {
|
|
echo 'No disponible';
|
|
}
|
|
?>
|
|
</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Botones -->
|
|
<div class="row">
|
|
<div class="col-md-12">
|
|
<div class="d-flex justify-content-end gap-2">
|
|
<a href="/IMPORTADORES/catalogo_pedimentos/lista" class="btn btn-secondary btn-animated">
|
|
<i class="fas fa-times"></i> Cancelar
|
|
</a>
|
|
<button type="submit" class="btn btn-primary btn-animated">
|
|
<i class="fas fa-save"></i> Actualizar Pedimento
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
|
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
|
|
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
|
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
|
|
|
<script>
|
|
$(document).ready(function() {
|
|
// Validación del formulario
|
|
$('#formPedimento').on('submit', function(e) {
|
|
var pedimento = $('#pedimento').val().trim();
|
|
var clienteRfc = $('#cliente_rfc').val().trim();
|
|
var clienteNombre = $('#cliente_nombre').val().trim();
|
|
|
|
if (!pedimento || !clienteRfc || !clienteNombre) {
|
|
e.preventDefault();
|
|
Swal.fire({
|
|
icon: 'warning',
|
|
title: 'Campos obligatorios',
|
|
text: 'Por favor complete todos los campos obligatorios (*)',
|
|
confirmButtonColor: '#ffc107'
|
|
});
|
|
return false;
|
|
}
|
|
|
|
// Validación básica de RFC
|
|
if (clienteRfc.length < 12) {
|
|
e.preventDefault();
|
|
Swal.fire({
|
|
icon: 'error',
|
|
title: 'RFC inválido',
|
|
text: 'El RFC debe tener al menos 12 caracteres',
|
|
confirmButtonColor: '#dc3545'
|
|
});
|
|
$('#cliente_rfc').focus();
|
|
return false;
|
|
}
|
|
});
|
|
|
|
// Convertir RFC a mayúsculas automáticamente
|
|
$('#cliente_rfc').on('input', function() {
|
|
this.value = this.value.toUpperCase();
|
|
});
|
|
|
|
// Validación de fechas
|
|
$('#fecha_inicio, #fecha_final').on('change', function() {
|
|
var fechaInicio = $('#fecha_inicio').val();
|
|
var fechaFinal = $('#fecha_final').val();
|
|
|
|
if (fechaInicio && fechaFinal && fechaInicio > fechaFinal) {
|
|
Swal.fire({
|
|
icon: 'warning',
|
|
title: 'Fechas incorrectas',
|
|
text: 'La fecha de inicio no puede ser mayor que la fecha final',
|
|
confirmButtonColor: '#ffc107'
|
|
});
|
|
$(this).val('');
|
|
}
|
|
});
|
|
});
|
|
</script>
|
|
|
|
</body>
|
|
</html>
|