Patentes - Agentes Aduanales

This commit is contained in:
2025-06-13 12:03:40 -06:00
parent b0b9672f11
commit c576ab5b3b
24 changed files with 2581 additions and 929 deletions

View File

@@ -31,146 +31,133 @@
</head>
<body>
<div class="content">
<div class="content">
<h4 class="mb-4"> Información General</h4>
<div class="card shadow-sm p-4 mb-4 bg-white">
<form>
<div class="row mb-3">
<label class="col-md-2 col-form-label">Clave:</label>
<div class="col-md-3">
<input type="text" class="form-control" value="<?= htmlspecialchars($datos['clave'] ?? '') ?>" disabled>
</div>
<div class="card shadow-sm p-4 mb-4 bg-white">
<form>
<div class="row mb-3">
<label class="col-md-2 col-form-label">Clave:</label>
<div class="col-md-3">
<input type="text" class="form-control" value="<?= htmlspecialchars($datos['clave'] ?? '') ?>" disabled>
</div>
<div class="col-md-3"></div>
<div class="col-md-3"></div>
<label class="col-md-2 col-form-label">Tipo de identificador:</label>
<div class="col-md-2">
<select name="tipo_identificador" class="form-control" disabled>
<option value="">-- Selecciona una opción --</option>
<option value="1" <?= ($datos['tipo_identificador'] ?? '') == '1' ? 'selected' : '' ?>>1 - RFC</option>
<option value="2" <?= ($datos['tipo_identificador'] ?? '') == '2' ? 'selected' : '' ?>>2 - CURP</option>
<option value="3" <?= ($datos['tipo_identificador'] ?? '') == '3' ? 'selected' : '' ?>>3 - SIN TAX ID</option>
</select>
</div>
</div>
<label class="col-md-2 col-form-label">Tipo de identificador:</label>
<div class="col-md-2">
<select name="tipo_identificador" class="form-control" disabled>
<option value="">-- Selecciona una opción --</option>
<option value="1" <?= ($datos['tipo_identificador'] ?? '') == '1' ? 'selected' : '' ?>>1 - RFC</option>
<option value="2" <?= ($datos['tipo_identificador'] ?? '') == '2' ? 'selected' : '' ?>>2 - CURP</option>
<option value="3" <?= ($datos['tipo_identificador'] ?? '') == '3' ? 'selected' : '' ?>>3 - SIN TAX ID</option>
</select>
</div>
</div>
<div class="row mb-3">
<label class="col-md-2 col-form-label">Nombre:</label>
<div class="col-md-10">
<input type="text" class="form-control" value="<?= htmlspecialchars($datos['nombre'] ?? '') ?>" disabled>
</div>
</div>
<div class="row mb-3">
<label class="col-md-2 col-form-label">Nombre:</label>
<div class="col-md-10">
<input type="text" class="form-control" value="<?= htmlspecialchars($datos['nombre'] ?? '') ?>" disabled>
</div>
</div>
<div class="row mb-3">
<label class="col-md-2 col-form-label">RFC:</label>
<div class="col-md-3">
<input type="text" class="form-control" value="<?= htmlspecialchars($datos['rfc'] ?? '') ?>" disabled>
</div>
<div class="col-md-1"></div>
<label class="col-md-1 col-form-label">CURP:</label>
<div class="col-md-5">
<input type="text" class="form-control" value="<?= htmlspecialchars($datos['curp'] ?? '') ?>" disabled>
</div>
</div>
<div class="row mb-3">
<label class="col-md-2 col-form-label">Calle:</label>
<div class="col-md-10">
<input type="text" class="form-control" value="<?= htmlspecialchars($datos['calle'] ?? '') ?>" disabled>
</div>
</div>
<div class="row mb-3">
<label class="col-md-2 col-form-label">RFC:</label>
<div class="col-md-3">
<input type="text" class="form-control" value="<?= htmlspecialchars($datos['rfc'] ?? '') ?>" disabled>
</div>
<div class="row mb-3">
<label class="col-md-2 col-form-label">Núm. Exterior:</label>
<div class="col-md-2">
<input type="text" class="form-control" value="<?= htmlspecialchars($datos['num_exterior'] ?? '') ?>" disabled>
</div>
<div class="col-md-4"></div>
<label class="col-md-2 col-form-label">Núm. Interior:</label>
<div class="col-md-2">
<input type="text" class="form-control" value="<?= htmlspecialchars($datos['num_interior'] ?? '') ?>" disabled>
</div>
</div>
<div class="col-md-1"></div>
<div class="row mb-3">
<label class="col-md-2 col-form-label">Ciudad / Localidad:</label>
<div class="col-md-3">
<input type="text" class="form-control" value="<?= htmlspecialchars($datos['ciudad'] ?? '') ?>" disabled>
</div>
<div class="col-md-1"></div>
<label class="col-md-1 col-form-label">Colonia:</label>
<div class="col-md-5">
<input type="text" class="form-control" value="<?= htmlspecialchars($datos['colonia'] ?? '') ?>" disabled>
</div>
</div>
<label class="col-md-1 col-form-label">CURP:</label>
<div class="col-md-5">
<input type="text" class="form-control" value="<?= htmlspecialchars($datos['curp'] ?? '') ?>" disabled>
</div>
</div>
<div class="row mb-3">
<label class="col-md-2 col-form-label">País:</label>
<div class="col-md-3">
<input type="text" class="form-control" value="<?= htmlspecialchars($datos['pais'] ?? '') ?>" disabled>
</div>
<div class="col-md-3"></div>
<label class="col-md-2 col-form-label">Código Postal:</label>
<div class="col-md-2">
<input type="text" class="form-control" value="<?= htmlspecialchars($datos['codigo_postal'] ?? '') ?>" disabled>
</div>
</div>
<div class="row mb-3">
<label class="col-md-2 col-form-label">Calle:</label>
<div class="col-md-10">
<input type="text" class="form-control" value="<?= htmlspecialchars($datos['calle'] ?? '') ?>" disabled>
</div>
</div>
<div class="row mb-3">
<label class="col-md-2 col-form-label">Municipio:</label>
<div class="col-md-4">
<input type="text" class="form-control" value="<?= htmlspecialchars($datos['municipio'] ?? '') ?>" disabled>
</div>
<div class="col-md-1"></div>
<label class="col-md-1 col-form-label">Estado:</label>
<div class="col-md-4">
<input type="text" class="form-control" value="<?= htmlspecialchars($datos['estado'] ?? '') ?>" disabled>
</div>
</div>
<div class="row mb-3">
<label class="col-md-2 col-form-label">Núm. Exterior:</label>
<div class="col-md-2">
<input type="text" class="form-control" value="<?= htmlspecialchars($datos['num_exterior'] ?? '') ?>" disabled>
</div>
<div class="row mb-3">
<label class="col-md-2 col-form-label">Teléfono:</label>
<div class="col-md-5">
<input type="text" class="form-control" value="<?= htmlspecialchars($datos['telefono'] ?? '') ?>" disabled>
</div>
<div class="col-md-1"></div>
<label class="col-md-1 col-form-label">Fax:</label>
<div class="col-md-3">
<input type="text" class="form-control" value="<?= htmlspecialchars($datos['fax'] ?? '') ?>" disabled>
</div>
</div>
<div class="col-md-4"></div>
<div class="row mb-3">
<label class="col-md-2 col-form-label">Correo:</label>
<div class="col-md-10">
<input type="email" class="form-control" value="<?= htmlspecialchars($datos['correo'] ?? '') ?>" disabled>
</div>
</div>
<label class="col-md-2 col-form-label">Núm. Interior:</label>
<div class="col-md-2">
<input type="text" class="form-control" value="<?= htmlspecialchars($datos['num_interior'] ?? '') ?>" disabled>
</div>
</div>
<div class="row mb-3">
<label class="col-md-2 col-form-label">Ciudad / Localidad:</label>
<div class="col-md-3">
<input type="text" class="form-control" value="<?= htmlspecialchars($datos['ciudad'] ?? '') ?>" disabled>
</div>
<div class="col-md-1"></div>
<label class="col-md-1 col-form-label">Colonia:</label>
<div class="col-md-5">
<input type="text" class="form-control" value="<?= htmlspecialchars($datos['colonia'] ?? '') ?>" disabled>
</div>
</div>
<div class="row mb-3">
<label class="col-md-2 col-form-label">País:</label>
<div class="col-md-3">
<input type="text" class="form-control" value="<?= htmlspecialchars($datos['pais'] ?? '') ?>" disabled>
</div>
<div class="col-md-3"></div>
<label class="col-md-2 col-form-label">Código Postal:</label>
<div class="col-md-2">
<input type="text" class="form-control" value="<?= htmlspecialchars($datos['codigo_postal'] ?? '') ?>" disabled>
</div>
</div>
<div class="row mb-3">
<label class="col-md-2 col-form-label">Municipio:</label>
<div class="col-md-4">
<input type="text" class="form-control" value="<?= htmlspecialchars($datos['municipio'] ?? '') ?>" disabled>
</div>
<div class="col-md-1"></div>
<label class="col-md-1 col-form-label">Estado:</label>
<div class="col-md-4">
<input type="text" class="form-control" value="<?= htmlspecialchars($datos['estado'] ?? '') ?>" disabled>
</div>
</div>
<div class="row mb-3">
<label class="col-md-2 col-form-label">Teléfono:</label>
<div class="col-md-5">
<input type="text" class="form-control" value="<?= htmlspecialchars($datos['telefono'] ?? '') ?>" disabled>
</div>
<div class="col-md-1"></div>
<label class="col-md-1 col-form-label">Fax:</label>
<div class="col-md-3">
<input type="text" class="form-control" value="<?= htmlspecialchars($datos['fax'] ?? '') ?>" disabled>
</div>
</div>
<div class="row mb-3">
<label class="col-md-2 col-form-label">Correo:</label>
<div class="col-md-10">
<input type="email" class="form-control" value="<?= htmlspecialchars($datos['correo'] ?? '') ?>" disabled>
</div>
</div>
<div class="row mb-3">
<label class="col-md-2 col-form-label">Observaciones:</label>
<div class="col-md-10">
<textarea class="form-control" rows="3" disabled><?= htmlspecialchars($datos['observaciones'] ?? '') ?></textarea>
</div>
</div>
<div style="display: flex; justify-content: right;">
<a href="/IMPORTADORES/configuracion/editar" class="btn btn-success mb-3">✏️ Editar Información</a>
</div>
</form>
<div class="row mb-3">
<label class="col-md-2 col-form-label">Observaciones:</label>
<div class="col-md-10">
<textarea class="form-control" rows="3" disabled><?= htmlspecialchars($datos['observaciones'] ?? '') ?></textarea>
</div>
</div>
<div style="display: flex; justify-content: right;">
<a href="/IMPORTADORES/configuracion/editar" class="btn btn-success mb-3">✏️ Editar Información</a>
</div>
</div>
</form>
</div>
</div>
</body>
</html>

View File

@@ -32,193 +32,171 @@
</head>
<body>
<div class="content">
<div class="content">
<h4 class="mb-4">✏️ Editar Información</h4>
<div class="card shadow-sm p-4 mb-4 bg-white">
<form id="form-edicion" method="POST" action="/IMPORTADORES/configuracion/guardar">
<div class="row mb-3">
<label class="col-md-2 col-form-label">Clave:</label>
<div class="col-md-3">
<input type="text" name="clave" maxlength="8"
class="form-control" value="<?= htmlspecialchars($datos['clave'] ?? '') ?>" disabled>
</div>
<div class="col-md-3"></div>
<label class="col-md-2 col-form-label">Tipo de identificador:</label>
<div class="col-md-2">
<select name="tipo_identificador" class="form-control" required>
<option value="">-- Selecciona una opción --</option>
<option value="1" <?= ($datos['tipo_identificador'] ?? '') == '1' ? 'selected' : '' ?>>1 - RFC</option>
<option value="2" <?= ($datos['tipo_identificador'] ?? '') == '2' ? 'selected' : '' ?>>2 - CURP</option>
<option value="3" <?= ($datos['tipo_identificador'] ?? '') == '3' ? 'selected' : '' ?>>3 - SIN TAX ID</option>
</select>
</div>
</div>
<div class="row mb-3">
<label class="col-md-2 col-form-label">Nombre:</label>
<div class="col-md-10">
<input type="text" class="form-control" value="<?= htmlspecialchars($datos['nombre'] ?? '') ?>" disabled>
</div>
</div>
<div class="row mb-3">
<label class="col-md-2 col-form-label">RFC:</label>
<div class="col-md-3">
<input type="text" class="form-control" value="<?= htmlspecialchars($datos['rfc'] ?? '') ?>" disabled>
</div>
<div class="col-md-1"></div>
<label class="col-md-1 col-form-label">CURP:</label>
<div class="col-md-5">
<input type="text" name="curp" maxlength="18"
class="form-control" value="<?= htmlspecialchars($datos['curp'] ?? '') ?>">
</div>
</div>
<div class="row mb-3">
<label class="col-md-2 col-form-label">Calle:</label>
<div class="col-md-10">
<input type="text" name="calle" class="form-control" value="<?= htmlspecialchars($datos['calle'] ?? '') ?>">
</div>
</div>
<div class="row mb-3">
<label class="col-md-2 col-form-label">Núm. Exterior:</label>
<div class="col-md-2">
<input type="text" name="num_exterior" class="form-control" value="<?= htmlspecialchars($datos['num_exterior'] ?? '') ?>">
</div>
<div class="col-md-4"></div>
<label class="col-md-2 col-form-label">Núm. Interior:</label>
<div class="col-md-2">
<input type="text" name="num_interior" class="form-control" value="<?= htmlspecialchars($datos['num_interior'] ?? '') ?>">
</div>
</div>
<div class="row mb-3">
<label class="col-md-2 col-form-label">Ciudad / Localidad:</label>
<div class="col-md-3">
<input type="text" name="ciudad" class="form-control" value="<?= htmlspecialchars($datos['ciudad'] ?? '') ?>">
</div>
<div class="col-md-1"></div>
<label class="col-md-1 col-form-label">Colonia:</label>
<div class="col-md-5">
<input type="text" name="colonia" class="form-control" value="<?= htmlspecialchars($datos['colonia'] ?? '') ?>">
</div>
</div>
<div class="row mb-3">
<label class="col-md-2 col-form-label">País:</label>
<div class="col-md-3">
<input type="text" name="pais" class="form-control" value="<?= htmlspecialchars($datos['pais'] ?? '') ?>">
</div>
<div class="col-md-3"></div>
<label class="col-md-2 col-form-label">Código Postal:</label>
<div class="col-md-2">
<input type="number" name="codigo_postal" class="form-control" value="<?= htmlspecialchars($datos['codigo_postal'] ?? '') ?>">
</div>
</div>
<div class="row mb-3">
<label class="col-md-2 col-form-label">Municipio:</label>
<div class="col-md-4">
<input type="text" name="municipio" class="form-control" value="<?= htmlspecialchars($datos['municipio'] ?? '') ?>">
</div>
<div class="col-md-1"></div>
<label class="col-md-1 col-form-label">Estado:</label>
<div class="col-md-4">
<input type="text" name="estado" class="form-control" value="<?= htmlspecialchars($datos['estado'] ?? '') ?>">
</div>
</div>
<div class="row mb-3">
<label class="col-md-2 col-form-label">Teléfono:</label>
<div class="col-md-5">
<input type="text" name="telefono" maxlength="11"
class="form-control" value="<?= htmlspecialchars($datos['telefono'] ?? '') ?>">
</div>
<div class="col-md-1"></div>
<label class="col-md-1 col-form-label">Fax:</label>
<div class="col-md-3">
<input type="text" name="fax" maxlength="12"
class="form-control" value="<?= htmlspecialchars($datos['fax'] ?? '') ?>">
</div>
</div>
<div class="row mb-3">
<label class="col-md-2 col-form-label">Correo:</label>
<div class="col-md-10">
<input type="email" class="form-control" value="<?= htmlspecialchars($datos['correo'] ?? '') ?>" disabled>
</div>
</div>
<div class="row mb-3">
<label class="col-md-2 col-form-label">Observaciones:</label>
<div class="col-md-10">
<?php $valor_obs = htmlspecialchars($datos['observaciones'] ?? ''); ?>
<textarea name="observaciones" class="form-control" rows="3"><?= $valor_obs ?></textarea>
</div>
</div>
<div style="display: flex; justify-content: right;">
<a href="/IMPORTADORES/configuracion/index" class="btn btn-secondary ms-2" style="margin-right: 10px;">Cancelar</a>
<button type="submit" class="btn btn-primary">💾 Guardar Cambios</button>
</div>
</form>
<div class="card shadow-sm p-4 mb-4 bg-white">
<form id="form-edicion" method="POST" action="/IMPORTADORES/configuracion/guardar">
<div class="row mb-3">
<label class="col-md-2 col-form-label">Clave:</label>
<div class="col-md-3">
<input type="text" name="clave" maxlength="8" class="form-control" value="<?= htmlspecialchars($datos['clave'] ?? '') ?>" disabled>
</div>
<div class="col-md-3"></div>
<label class="col-md-2 col-form-label">Tipo de identificador:</label>
<div class="col-md-2">
<select name="tipo_identificador" class="form-control" required>
<option value="">-- Selecciona una opción --</option>
<option value="1" <?= ($datos['tipo_identificador'] ?? '') == '1' ? 'selected' : '' ?>>1 - RFC</option>
<option value="2" <?= ($datos['tipo_identificador'] ?? '') == '2' ? 'selected' : '' ?>>2 - CURP</option>
<option value="3" <?= ($datos['tipo_identificador'] ?? '') == '3' ? 'selected' : '' ?>>3 - SIN TAX ID</option>
</select>
</div>
</div>
<div class="row mb-3">
<label class="col-md-2 col-form-label">Nombre:</label>
<div class="col-md-10">
<input type="text" class="form-control" value="<?= htmlspecialchars($datos['nombre'] ?? '') ?>" disabled>
</div>
</div>
<div class="row mb-3">
<label class="col-md-2 col-form-label">RFC:</label>
<div class="col-md-3">
<input type="text" class="form-control" value="<?= htmlspecialchars($datos['rfc'] ?? '') ?>" disabled>
</div>
<div class="col-md-1"></div>
<label class="col-md-1 col-form-label">CURP:</label>
<div class="col-md-5">
<input type="text" name="curp" maxlength="18" class="form-control" value="<?= htmlspecialchars($datos['curp'] ?? '') ?>">
</div>
</div>
<div class="row mb-3">
<label class="col-md-2 col-form-label">Calle:</label>
<div class="col-md-10">
<input type="text" name="calle" class="form-control" value="<?= htmlspecialchars($datos['calle'] ?? '') ?>">
</div>
</div>
<div class="row mb-3">
<label class="col-md-2 col-form-label">Núm. Exterior:</label>
<div class="col-md-2">
<input type="text" name="num_exterior" class="form-control" value="<?= htmlspecialchars($datos['num_exterior'] ?? '') ?>">
</div>
<div class="col-md-4"></div>
<label class="col-md-2 col-form-label">Núm. Interior:</label>
<div class="col-md-2">
<input type="text" name="num_interior" class="form-control" value="<?= htmlspecialchars($datos['num_interior'] ?? '') ?>">
</div>
</div>
<div class="row mb-3">
<label class="col-md-2 col-form-label">Ciudad / Localidad:</label>
<div class="col-md-3">
<input type="text" name="ciudad" class="form-control" value="<?= htmlspecialchars($datos['ciudad'] ?? '') ?>">
</div>
<div class="col-md-1"></div>
<label class="col-md-1 col-form-label">Colonia:</label>
<div class="col-md-5">
<input type="text" name="colonia" class="form-control" value="<?= htmlspecialchars($datos['colonia'] ?? '') ?>">
</div>
</div>
<div class="row mb-3">
<label class="col-md-2 col-form-label">País:</label>
<div class="col-md-3">
<input type="text" name="pais" class="form-control" value="<?= htmlspecialchars($datos['pais'] ?? '') ?>">
</div>
<div class="col-md-3"></div>
<label class="col-md-2 col-form-label">Código Postal:</label>
<div class="col-md-2">
<input type="number" name="codigo_postal" class="form-control" value="<?= htmlspecialchars($datos['codigo_postal'] ?? '') ?>">
</div>
</div>
<div class="row mb-3">
<label class="col-md-2 col-form-label">Municipio:</label>
<div class="col-md-4">
<input type="text" name="municipio" class="form-control" value="<?= htmlspecialchars($datos['municipio'] ?? '') ?>">
</div>
<div class="col-md-1"></div>
<label class="col-md-1 col-form-label">Estado:</label>
<div class="col-md-4">
<input type="text" name="estado" class="form-control" value="<?= htmlspecialchars($datos['estado'] ?? '') ?>">
</div>
</div>
<div class="row mb-3">
<label class="col-md-2 col-form-label">Teléfono:</label>
<div class="col-md-5">
<input type="text" name="telefono" maxlength="11" class="form-control" value="<?= htmlspecialchars($datos['telefono'] ?? '') ?>">
</div>
<div class="col-md-1"></div>
<label class="col-md-1 col-form-label">Fax:</label>
<div class="col-md-3">
<input type="text" name="fax" maxlength="12" class="form-control" value="<?= htmlspecialchars($datos['fax'] ?? '') ?>">
</div>
</div>
<div class="row mb-3">
<label class="col-md-2 col-form-label">Correo:</label>
<div class="col-md-10">
<input type="email" class="form-control" value="<?= htmlspecialchars($datos['correo'] ?? '') ?>" disabled>
</div>
</div>
<div class="row mb-3">
<label class="col-md-2 col-form-label">Observaciones:</label>
<div class="col-md-10">
<?php $valor_obs = htmlspecialchars($datos['observaciones'] ?? ''); ?>
<textarea name="observaciones" class="form-control" rows="3"><?= $valor_obs ?></textarea>
</div>
</div>
<div style="display: flex; justify-content: right;">
<a href="/IMPORTADORES/configuracion/index" class="btn btn-secondary ms-2" style="margin-right: 10px;">Cancelar</a>
<button type="submit" class="btn btn-primary">💾 Guardar Cambios</button>
</div>
</form>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<script>
document.getElementById('form-edicion').addEventListener('submit', function (event) {
event.preventDefault(); // Evita que el formulario se envíe
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<script>
document.getElementById('form-edicion').addEventListener('submit', function (event) {
event.preventDefault(); // Evita que el formulario se envíe
const curp = document.querySelector('[name="curp"]').value.trim();
const telefono = document.querySelector('input[name="telefono"]').value.trim();
const fax = document.querySelector('[name="fax"]').value.trim();
const curp = document.querySelector('[name="curp"]').value.trim();
const telefono = document.querySelector('input[name="telefono"]').value.trim();
const fax = document.querySelector('[name="fax"]').value.trim();
let errores = [];
let errores = [];
// Validación CURP
if (!/^[A-Z]{4}[0-9]{6}[HM](AS|BC|BS|CC|CL|CM|CS|CH|DF|DG|GT|GR|HG|JC|MC|MN|MS|NT|NL|OC|PL|QT|QR|SP|SL|SR|TC|TS|TL|VZ|YN|ZS)[A-Z]{3}[A-Z0-9]{2}$/.test(curp)) {
errores.push('La CURP no tiene el formato correcto.');
}
// Validación CURP
if (!/^[A-Z]{4}[0-9]{6}[HM](AS|BC|BS|CC|CL|CM|CS|CH|DF|DG|GT|GR|HG|JC|MC|MN|MS|NT|NL|OC|PL|QT|QR|SP|SL|SR|TC|TS|TL|VZ|YN|ZS)[A-Z]{3}[A-Z0-9]{2}$/.test(curp)) {
errores.push('La CURP no tiene el formato correcto.');
}
// Validación Teléfono - Ajustada para permitir diferentes formatos
if (telefono !== '' && !/^\d{10,11}$/.test(telefono.replace(/\s/g, ''))) {
errores.push('El número de teléfono debe tener 10 u 11 dígitos.');
}
// Validación Teléfono - Ajustada para permitir diferentes formatos
if (telefono !== '' && !/^\d{10,11}$/.test(telefono.replace(/\s/g, ''))) {
errores.push('El número de teléfono debe tener 10 u 11 dígitos.');
}
// Validación Fax
if (fax !== '' && !/^\d{3}\s?\d{3}\s?\d{4}$/.test(fax)) {
errores.push('El número de fax debe tener el formato: 123 456 7890 o 1234567890.');
}
// Validación Fax
if (fax !== '' && !/^\d{3}\s?\d{3}\s?\d{4}$/.test(fax)) {
errores.push('El número de fax debe tener el formato: 123 456 7890 o 1234567890.');
}
// Si hay errores, mostrar alerta y no enviar
if (errores.length > 0) {
Swal.fire({
icon: 'error',
title: 'Errores en el formulario',
html: errores.map(e => `<p>${e}</p>`).join('')
});
return; // Evita que el formulario se envíe
}
// Si hay errores, mostrar alerta y no enviar
if (errores.length > 0) {
Swal.fire({icon: 'error', title: 'Errores en el formulario', html: errores.map(e => `<p>${e}</p>`).join('') });
return; // Evita que el formulario se envíe
}
// Si no hay errores, enviar el formulario
this.submit(); // Esto sí lo envía manualmente
});
</script>
// Si no hay errores, enviar el formulario
this.submit(); // Esto sí lo envía manualmente
});
</script>
</body>
</html>

View File

@@ -64,7 +64,7 @@
<div class="col-md-4">
<div class="card shadow-sm p-3">
<h5 class="text-info">Solicitud de Importación</h5>
<h5 class="text-info">Solicitudes de Importación</h5>
<p>Inicia nuevas solicitudes de pedimentos.</p>
<a href="/IMPORTADORES/solicitud_importacion/crear"
class="btn btn-info btn-sm mt-2 <?= str_contains($_SERVER['REQUEST_URI'], '/solicitud_importacion/crear') ? 'active' : '' ?>">

View File

@@ -43,6 +43,15 @@ if (!isset($_SESSION['usuario_id']) || $_SESSION['tipo_usuario'] !== 'agente_adu
<div class="d-none d-md-block bg-dark text-white position-fixed h-100 pt-5" style="width: 250px;">
<nav class="nav flex-column">
<?php
// Detecta si estamos en alguna parte de locaciones
$esVistaLocaciones = str_contains($_SERVER['REQUEST_URI'], '/locaciones');
// Detecta si estamos en alguna parte de agentes
$esVistaAgentes = str_contains($_SERVER['REQUEST_URI'], '/agentes');
// Detecta si estamos en alguna parte de agente aduanal
$esVistaPatente = str_contains($_SERVER['REQUEST_URI'], '/patente');
?>
<!-- INICIO -->
<a href="/IMPORTADORES/agentes/dashboard"
class="nav-link px-3 py-2 <?= $_SERVER['REQUEST_URI'] === '/IMPORTADORES/agentes/dashboard' ? 'active' : '' ?>">
@@ -68,30 +77,72 @@ if (!isset($_SESSION['usuario_id']) || $_SESSION['tipo_usuario'] !== 'agente_adu
</a>
<!-- LOCACIONES -->
<a class="nav-link px-3 py-2 d-flex justify-content-between align-items-center
<?= str_contains($_SERVER['REQUEST_URI'], '/agentes') ? 'active' : '' ?>"
data-bs-toggle="collapse" href="#submenuLocaciones" role="button" aria-expanded="false">
🗺️ Locaciones
<span class="badge bg-secondary">2</span>
</a>
<div class="collapse <?= str_contains($_SERVER['REQUEST_URI'], '/agentes') ? 'show' : '' ?>" id="submenuLocaciones">
<nav class="nav flex-column ms-3">
<a href="/IMPORTADORES/agentes/lista"
class="nav-link px-3 py-1 <?= $_SERVER['REQUEST_URI'] === '/IMPORTADORES/agentes/lista' ? 'active' : '' ?>">
• Ver Locaciones
</a>
<a href="/IMPORTADORES/agentes/alta"
class="nav-link px-3 py-1 <?= str_contains($_SERVER['REQUEST_URI'], '/agentes/alta') ? 'active' : '' ?>">
• Agregar Locaciones
</a>
</nav>
</div>
<?php if ($esVistaLocaciones): ?>
<?php $enDashboardLocaciones = $_SERVER['REQUEST_URI'] === '/IMPORTADORES/locaciones/lista'; ?>
<a class="nav-link px-3 py-2 d-flex justify-content-between align-items-center <?= $esVistaLocaciones ? 'active' : '' ?>"
href="<?= $enDashboardLocaciones ? '#submenuLocaciones' : '/IMPORTADORES/locaciones/lista' ?>"
<?= $enDashboardLocaciones ? 'data-bs-toggle="collapse"' : '' ?>
role="button" aria-expanded="true" aria-controls="submenuLocaciones"
onclick="<?= $enDashboardLocaciones ? '' : 'event.preventDefault(); window.location.href = \'/IMPORTADORES/locaciones/lista\';' ?>">
🗺️ Locaciones
<span class="badge bg-secondary">2</span>
</a>
<div class="collapse show" id="submenuLocaciones">
<nav class="nav flex-column ms-3">
<a href="/IMPORTADORES/locaciones/lista"
class="nav-link px-3 py-1 <?= $_SERVER['REQUEST_URI'] === '/IMPORTADORES/locaciones/lista' ? 'active' : '' ?>">
• Ver Locaciones
</a>
<a href="/IMPORTADORES/locaciones/alta"
class="nav-link px-3 py-1 <?= str_contains($_SERVER['REQUEST_URI'], '/locaciones/alta') ? 'active' : '' ?>">
• Agregar Locaciones
</a>
</nav>
</div>
<?php elseif ($esVistaAgentes || $esVistaPatente): ?>
<a href="/IMPORTADORES/locaciones/lista"
class="nav-link px-3 py-2 d-flex justify-content-between align-items-center">
🗺️ Locaciones
<span class="badge bg-secondary">2</span>
</a>
<?php endif; ?>
<!-- Patentes -->
<?php if ($esVistaPatente): ?>
<?php $enDashboardPatente = $_SERVER['REQUEST_URI'] === '/IMPORTADORES/patente/dashboard'; ?>
<a class="nav-link px-3 py-2 d-flex justify-content-between align-items-center <?= $esVistaPatente ? 'active' : '' ?>"
href="<?= $enDashboardPatente ? '#submenuAgentesAduanales' : 'IMPORTADORES/patente/dashboard' ?>"
<?= $enDashboardPatente ? 'data-bs-toggle="collapse"' : '' ?>
role="button" aria-expanded="true" aria-controls="submenuAgentesAduanales"
onclick="<?= $enDashboardPatente ? '' : 'event.preventDefault(); window.location.href = \'/IMPORTADORES/patente/dashboard\';' ?>">
📑 Patentes
<span class="badge bg-secondary">2</span>
</a>
<div class="collapse show" id="submenuAgentesAduanales">
<nav class="nav flex-column ms-3">
<a href="/IMPORTADORES/patente/lista"
class="nav-link px-3 py-1 <?= $_SERVER['REQUEST_URI'] === '/IMPORTADORES/patente/lista' ? 'active' : '' ?>">
• Ver Patentes
</a>
<a href="/IMPORTADORES/patente/alta"
class="nav-link px-3 py-1 <?= str_contains($_SERVER['REQUEST_URI'], '/IMPORTADORES/patente/alta') ? 'active' : '' ?>">
• Nueva Patente
</a>
</nav>
</div>
<?php elseif ($esVistaAgentes || $esVistaLocaciones): ?>
<a href="/IMPORTADORES/patente/dashboard"
class="nav-link px-3 py-2 d-flex justify-content-between align-items-center">
📑 Patentes
<span class="badge bg-secondary">2</span>
</a>
<?php endif; ?>
</nav>
</div>
<!-- OFFCANVAS PARA MÓVILES -->
<div class="offcanvas offcanvas-start d-md-none" tabindex="-1" id="sidebarMenu" style="top: 75px;">
<div class="offcanvas offcanvas-start d-md-none" tabindex="-1" id="sidebarMenu" style="top: 56px;">
<div class="offcanvas-header">
<h5 class="offcanvas-title">Menú</h5>
<button type="button" class="btn-close" data-bs-dismiss="offcanvas"></button>
@@ -123,24 +174,66 @@ if (!isset($_SESSION['usuario_id']) || $_SESSION['tipo_usuario'] !== 'agente_adu
</a>
<!-- LOCACIONES -->
<a class="nav-link px-3 py-2 d-flex justify-content-between align-items-center
<?= str_contains($_SERVER['REQUEST_URI'], '/agentes') ? 'active' : '' ?>"
data-bs-toggle="collapse" href="#submenuLocaciones" role="button" aria-expanded="false">
🗺️ Locaciones
<span class="badge bg-secondary">2</span>
</a>
<div class="collapse <?= str_contains($_SERVER['REQUEST_URI'], '/agentes') ? 'show' : '' ?>" id="submenuLocaciones">
<nav class="nav flex-column ms-3">
<a href="/IMPORTADORES/agentes/lista"
class="nav-link px-3 py-1 <?= $_SERVER['REQUEST_URI'] === '/IMPORTADORES/agentes/lista' ? 'active' : '' ?>">
• Ver Locaciones
</a>
<a href="/IMPORTADORES/agentes/alta"
class="nav-link px-3 py-1 <?= str_contains($_SERVER['REQUEST_URI'], '/agentes/alta') ? 'active' : '' ?>">
• Agregar Locaciones
</a>
</nav>
</div>
<?php if ($esVistaLocaciones): ?>
<?php $enDashboardLocaciones = $_SERVER['REQUEST_URI'] === '/IMPORTADORES/locaciones/lista'; ?>
<a class="nav-link px-3 py-2 d-flex justify-content-between align-items-center <?= $esVistaLocaciones ? 'active' : '' ?>"
href="<?= $enDashboardLocaciones ? '#submenuLocaciones' : '/IMPORTADORES/locaciones/lista' ?>"
<?= $enDashboardLocaciones ? 'data-bs-toggle="collapse"' : '' ?>
role="button" aria-expanded="true" aria-controls="submenuLocaciones"
onclick="<?= $enDashboardLocaciones ? '' : 'event.preventDefault(); window.location.href = \'/IMPORTADORES/locaciones/lista\';' ?>">
🗺️ Locaciones
<span class="badge bg-secondary">2</span>
</a>
<div class="collapse show" id="submenuLocaciones">
<nav class="nav flex-column ms-3">
<a href="/IMPORTADORES/locaciones/lista"
class="nav-link px-3 py-1 <?= $_SERVER['REQUEST_URI'] === '/IMPORTADORES/locaciones/lista' ? 'active' : '' ?>">
• Ver Locaciones
</a>
<a href="/IMPORTADORES/locaciones/alta"
class="nav-link px-3 py-1 <?= str_contains($_SERVER['REQUEST_URI'], '/locaciones/alta') ? 'active' : '' ?>">
• Agregar Locaciones
</a>
</nav>
</div>
<?php elseif ($esVistaAgentes || $esVistaPatente): ?>
<a href="/IMPORTADORES/locaciones/lista"
class="nav-link px-3 py-2 d-flex justify-content-between align-items-center">
🗺️ Locaciones
<span class="badge bg-secondary">2</span>
</a>
<?php endif; ?>
<!-- Patentes -->
<?php if ($esVistaPatente): ?>
<?php $enDashboardPatente = $_SERVER['REQUEST_URI'] === '/IMPORTADORES/patente/dashboard'; ?>
<a class="nav-link px-3 py-2 d-flex justify-content-between align-items-center <?= $esVistaPatente ? 'active' : '' ?>"
href="<?= $enDashboardPatente ? '#submenuAgentesAduanales' : 'IMPORTADORES/patente/dashboard' ?>"
<?= $enDashboardPatente ? 'data-bs-toggle="collapse"' : '' ?>
role="button" aria-expanded="true" aria-controls="submenuAgentesAduanales"
onclick="<?= $enDashboardPatente ? '' : 'event.preventDefault(); window.location.href = \'/IMPORTADORES/patente/dashboard\';' ?>">
📑 Patentes
<span class="badge bg-secondary">2</span>
</a>
<div class="collapse show" id="submenuAgentesAduanales">
<nav class="nav flex-column ms-3">
<a href="/IMPORTADORES/patente/lista"
class="nav-link px-3 py-1 <?= $_SERVER['REQUEST_URI'] === '/IMPORTADORES/patente/lista' ? 'active' : '' ?>">
• Ver Patentes
</a>
<a href="/IMPORTADORES/patente/alta"
class="nav-link px-3 py-1 <?= str_contains($_SERVER['REQUEST_URI'], '/IMPORTADORES/patente/alta') ? 'active' : '' ?>">
• Nueva Patentes
</a>
</nav>
</div>
<?php elseif ($esVistaAgentes || $esVistaLocaciones): ?>
<a href="/IMPORTADORES/patente/dashboard"
class="nav-link px-3 py-2 d-flex justify-content-between align-items-center">
📑 Patentes
<span class="badge bg-secondary">2</span>
</a>
<?php endif; ?>
</div>
</div>

View File

@@ -48,6 +48,8 @@ if (!isset($_SESSION['usuario_id']) || $_SESSION['tipo_usuario'] !== 'importador
$esVistaSeguridad = str_contains($_SERVER['REQUEST_URI'], '/seguridad');
// Detecta si estamos en alguna parte de preferencias
$esVistaPreferencias = str_contains($_SERVER['REQUEST_URI'], '/preferencias');
// Detecta si estamos en alguna parte de automatizaciones
$esVistaAutomatizaciones = str_contains($_SERVER['REQUEST_URI'], '/automatizaciones');
?>
<!-- INFORMACIÓN GENERAL -->
@@ -57,10 +59,18 @@ if (!isset($_SESSION['usuario_id']) || $_SESSION['tipo_usuario'] !== 'importador
</a>
<!-- AUTOMATIZACIONES -->
<a href="/IMPORTADORES/configuracion/automatizaciones"
class="nav-link px-3 py-2 <?= str_contains($_SERVER['REQUEST_URI'], '/configuracion/automatizaciones') ? 'active' : '' ?>">
⚙️ Automatizaciones
</a>
<?php if ($esVistaAutomatizaciones): ?>
<?php $enDashboardAutomatizaciones = $_SERVER['REQUEST_URI'] === '/IMPORTADORES/automatizaciones/index'; ?>
<a href="/IMPORTADORES/automatizaciones/index"
class="nav-link px-3 py-2 <?= str_contains($_SERVER['REQUEST_URI'], '/automatizaciones/index') ? 'active' : '' ?>">
⚙️ Automatizaciones
</a>
<?php elseif ($esConfiguracion || $esVistaSeguridad || $esVistaPreferencias || $esVistaBitacoras): ?>
<a href="/IMPORTADORES/automatizaciones/index"
class="nav-link px-3 py-2 <?= str_contains($_SERVER['REQUEST_URI'], '/automatizaciones/index') ? 'active' : '' ?>">
⚙️ Automatizaciones
</a>
<?php endif; ?>
<!-- PREFERENCIAS -->
<?php if ($esVistaPreferencias): ?>
@@ -69,7 +79,7 @@ if (!isset($_SESSION['usuario_id']) || $_SESSION['tipo_usuario'] !== 'importador
href="<?= $enDashboardPreferencias ? '#submenuPreferencias' : '/IMPORTADORES/preferencias/index' ?>"
<?= $enDashboardPreferencias ? 'data-bd-toggle="collapse"' : '' ?>
role="button" aria-expanded="true" aria-controls="submenuPreferencias"
onclick="<? $enDashboardPreferenecias ? '' : 'event.preventDefault(); window.location.href = \'/IMPORTADORES/preferencias/index\';' ?>">
onclick="<? $enDashboardPreferencias ? '' : 'event.preventDefault(); window.location.href = \'/IMPORTADORES/preferencias/index\';' ?>">
✅ Preferencias
<span class="badge bg-secondary">1</span>
</a>
@@ -81,7 +91,7 @@ if (!isset($_SESSION['usuario_id']) || $_SESSION['tipo_usuario'] !== 'importador
</a>
</nav>
</div>
<?php elseif ($esConfiguracion || $esVistaBitacoras || $esVistaSeguridad): ?>
<?php elseif ($esConfiguracion || $esVistaAutomatizaciones || $esVistaSeguridad || $esVistaBitacoras): ?>
<a href="/IMPORTADORES/preferencias/index"
class="nav-link px-3 py-2 d-flex justify-content-between align-items-center">
✅ Preferencias
@@ -108,7 +118,7 @@ if (!isset($_SESSION['usuario_id']) || $_SESSION['tipo_usuario'] !== 'importador
</a>
</nav>
</div>
<?php elseif ($esConfiguracion || $esVistaBitacoras || $esVistaPreferencias): ?>
<?php elseif ($esConfiguracion || $esVistaAutomatizaciones || $esVistaPreferencias || $esVistaBitacoras): ?>
<a href="/IMPORTADORES/seguridad/index"
class="nav-link px-3 py-2 d-flex justify-content-between align-items-center">
👮 Seguridad
@@ -136,7 +146,7 @@ if (!isset($_SESSION['usuario_id']) || $_SESSION['tipo_usuario'] !== 'importador
</a>
</nav>
</div>
<?php elseif ($esConfiguracion || $esVistaSeguridad || $esVistaPreferencias): ?>
<?php elseif ($esConfiguracion || $esVistaAutomatizaciones || $esVistaSeguridad || $esVistaPreferencias): ?>
<!-- Si estamos en configuración, pero no en bitácoras -->
<a href="/IMPORTADORES/bitacoras/index"
class="nav-link px-3 py-2 d-flex justify-content-between align-items-center">
@@ -150,19 +160,31 @@ if (!isset($_SESSION['usuario_id']) || $_SESSION['tipo_usuario'] !== 'importador
<!-- OFFCANVAS PARA MÓVILES -->
<div class="offcanvas offcanvas-start d-md-none" tabindex="-1" id="sidebarMenu" style="top: 56px;">
<div class="offcanvas-header">
<h5 class="offcanvas-title">Menú</h5>
<button type="button" class="btn-close" data-bs-dismiss="offcanvas"></button>
</div>
<div class="offcanvas-body">
<!-- INFORMACIÓN GENERAL -->
<a href="/IMPORTADORES/configuracion/index"
class="nav-link px-3 py-2 <?= str_contains($_SERVER['REQUEST_URI'], '/configuracion/dashboard_configuracion') ? 'active' : '' ?>">
class="nav-link px-3 py-2 <?= str_contains($_SERVER['REQUEST_URI'], '/configuracion/index') ? 'active' : '' ?>">
Información General
</a>
<!-- AUTOMATIZACIONES -->
<a href="/IMPORTADORES/configuracion/automatizaciones"
class="nav-link px-3 py-2 <?= str_contains($_SERVER['REQUEST_URI'], '/configuracion/automatizaciones') ? 'active' : '' ?>">
⚙️ Automatizaciones
</a>
<?php if ($esVistaAutomatizaciones): ?>
<?php $enDashboardAutomatizaciones = $_SERVER['REQUEST_URI'] === '/IMPORTADORES/automatizaciones/index'; ?>
<a href="/IMPORTADORES/automatizaciones/index"
class="nav-link px-3 py-2 <?= str_contains($_SERVER['REQUEST_URI'], '/automatizaciones/index') ? 'active' : '' ?>">
⚙️ Automatizaciones
</a>
<?php elseif ($esConfiguracion || $esVistaSeguridad || $esVistaPreferencias || $esVistaBitacoras): ?>
<a href="/IMPORTADORES/automatizaciones/index"
class="nav-link px-3 py-2 <?= str_contains($_SERVER['REQUEST_URI'], '/automatizaciones/index') ? 'active' : '' ?>">
⚙️ Automatizaciones
</a>
<?php endif; ?>
<!-- PREFERENCIAS -->
<?php if ($esVistaPreferencias): ?>
@@ -171,7 +193,7 @@ if (!isset($_SESSION['usuario_id']) || $_SESSION['tipo_usuario'] !== 'importador
href="<?= $enDashboardPreferencias ? '#submenuPreferencias' : '/IMPORTADORES/preferencias/index' ?>"
<?= $enDashboardPreferencias ? 'data-bd-toggle="collapse"' : '' ?>
role="button" aria-expanded="true" aria-controls="submenuPreferencias"
onclick="<? $enDashboardPreferenecias ? '' : 'event.preventDefault(); window.location.href = \'/IMPORTADORES/preferencias/index\';' ?>">
onclick="<? $enDashboardPreferencias ? '' : 'event.preventDefault(); window.location.href = \'/IMPORTADORES/preferencias/index\';' ?>">
✅ Preferencias
<span class="badge bg-secondary">1</span>
</a>
@@ -183,7 +205,7 @@ if (!isset($_SESSION['usuario_id']) || $_SESSION['tipo_usuario'] !== 'importador
</a>
</nav>
</div>
<?php elseif ($esConfiguracion || $esVistaBitacoras || $esVistaSeguridad): ?>
<?php elseif ($esConfiguracion || $esVistaAutomatizaciones || $esVistaSeguridad || $esVistaBitacoras): ?>
<a href="/IMPORTADORES/preferencias/index"
class="nav-link px-3 py-2 d-flex justify-content-between align-items-center">
✅ Preferencias
@@ -210,7 +232,7 @@ if (!isset($_SESSION['usuario_id']) || $_SESSION['tipo_usuario'] !== 'importador
</a>
</nav>
</div>
<?php elseif ($esConfiguracion || $esVistaBitacoras || $esVistaPreferencias): ?>
<?php elseif ($esConfiguracion || $esVistaAutomatizaciones || $esVistaPreferencias || $esVistaBitacoras): ?>
<a href="/IMPORTADORES/seguridad/index"
class="nav-link px-3 py-2 d-flex justify-content-between align-items-center">
👮 Seguridad
@@ -238,7 +260,7 @@ if (!isset($_SESSION['usuario_id']) || $_SESSION['tipo_usuario'] !== 'importador
</a>
</nav>
</div>
<?php elseif ($esConfiguracion || $esVistaSeguridad || $esVistaPreferencias): ?>
<?php elseif ($esConfiguracion || $esVistaAutomatizaciones || $esVistaPreferencias || $esVistaSeguridad): ?>
<!-- Si estamos en configuración, pero no en bitácoras -->
<a href="/IMPORTADORES/bitacoras/index"
class="nav-link px-3 py-2 d-flex justify-content-between align-items-center">

View File

@@ -0,0 +1,436 @@
<?php include __DIR__ . '/../partials/sidebar_agente.php'; ?>
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8">
<title>Dashboard | Importador</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
<!-- SweetAlert2 -->
<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; }
.navbar { position: fixed; top: 0; width: 100%; z-index: 1050; }
.btn-indigo { background-color: #6610f2; color: white;}
.btn-indigo:hover { background-color: #520dc2; color: white;}
.text-indigo { color: orangeRed;}
.btn-orange { background-color: orangeRed; color: white;}
.btn-orange:hover { background-color: #ff3600; color: white;}
.text-orange { color: orangeRed;}
/* A partir de dispositivos medianos (>=768px), deja espacio lateral */
@media (min-width: 768px) {
.content { margin-left: 250px; /* Ancho del sidebar */ }
.nav-tabs .nav-link { padding: 10px 15px; font-size: 14px; min-width: 120px; }
}
/* 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; }
/* Estilos mejorados para las pestañas */
.nav-tabs { border-bottom: 1px solid #dee2e6; margin-bottom: 0; }
.nav-tabs .nav-item { margin-bottom: -1px; }
.nav-tabs .nav-link { border: 1px solid transparent; border-radius: 0.375rem 0.375rem 0 0; padding: 12px 20px; color: #495057; background-color: #f8f9fa;
font-weight: 500; white-space: nowrap; min-width: 150px; text-align: center; transition: all 0.3s ease; }
.nav-tabs .nav-link:hover { border-color: #e9ecef #e9ecef #dee2e6; background-color: #e9ecef; color: #212529; }
.nav-tabs .nav-link.active { color: #495057; background-color: #fff; border-color: #dee2e6 #dee2e6 #fff; border-bottom: 2px solid #fff; }
/* Asegurar que las pestañas sean completamente visibles */
.nav-tabs .nav-item:first-child .nav-link { margin-left: 0; }
.nav-tabs .nav-item:last-child .nav-link { margin-right: 0; }
.tab-content { padding: 5px; }
</style>
</head>
<body>
<div class="content">
<h4>CONFIGURACIÓN ADUANA / PATENTE</h4>
<div class="card p-4 shadow-sm bg-white">
<!-- Se agrega enctype para subir archivos -->
<form action="/IMPORTADORES/patente/guardar" method="POST" id="formAltaPatente">
<!-- Pestañas de navegación -->
<ul class="nav nav-tabs" id="myTab" role="tablist">
<li class="nav-item" role="presentation">
<button class="nav-link active" id="general-tab" data-bs-toggle="tab" data-bs-target="#general"
type="button" role="tab" aria-controls="general" aria-selected="true">
General
</button>
</li>
<li class="nav-item" role="presentation">
<button class="nav-link" id="validacion-tab" data-bs-toggle="tab" data-bs-target="#validacion"
type="button" role="tab" aria-controls="validacion" aria-selected="false">
Números de Validación y Folios
</button>
</li>
</ul>
<!-- Contenido de las pestañas -->
<div class="tab-content" id="myTabContent">
<!-- Pestaña General -->
<div class="tab-pane fade show active" id="general" role="tabpanel" aria-labelledby="general-tab">
<p style="font-weight: bold;">Datos de la Patente / Aduana</p>
<div class="row mb-3">
<label for="aduana" class="col-md-2 col-form-label">Aduana</label>
<div class="col-md-3">
<input name="aduana" id="aduana" type="text" maxlength="3" class="form-control" required>
</div>
<label for="aduana" class="col-md-2 col-form-label">[ Sin Sección ]</label>
</div>
<div class="row mb-3">
<label for="patente" class="col-md-2 col-form-label">Patente</label>
<div class="col-md-3">
<input name="patente" id="patente" type="text" maxlength="4" class="form-control" required>
</div>
</div>
<div class="row mb-3">
<label for="agente_aduanal" class="col-md-2 col-form-label">Agente Aduanal</label>
<div class="col-md-10">
<input name="agente_aduanal" id="agente_aduanal" type="text" class="form-control" required>
</div>
</div>
<div class="row mb-3">
<label for="rfc" class="col-md-2 col-form-label">RFC</label>
<div class="col-md-6">
<input name="rfc" id="rfc" type="text" maxlength="13" class="form-control" required>
</div>
</div>
<div class="row mb-3">
<label for="curp" class="col-md-2 col-form-label">CURP</label>
<div class="col-md-6">
<input name="curp" id="curp" type="text" maxlength="18" class="form-control" required>
</div>
</div>
<div class="row mb-3">
<label for="razon_social" class="col-md-2 col-form-label">Razón Social</label>
<div class="col-md-10">
<input name="razon_social" id="razon_social" type="text" class="form-control" required>
</div>
</div><hr><br>
<div class="col mb-3">
<P>Capturar para el llenado de la Manifestación de Valor</P>
<p style="font-weight: bold;">Datos del Agente Aduanal:</p>
<div class="row mb-3">
<label for="mf_nombre" class="col-md-2 col-form-label">Nombre(s)</label>
<div class="col-md-9">
<input name="mf_nombre" id="mf_nombre" type="text" class="form-control">
</div>
</div>
<div class="row mb-3">
<label for="mf_paterno" class="col-md-2 col-form-label">Apellido Paterno</label>
<div class="col-md-9">
<input name="mf_paterno" id="mf_paterno" type="text" class="form-control">
</div>
</div>
<div class="row mb-3">
<label for="mf_materno" class="col-md-2 col-form-label">Apellido Materno</label>
<div class="col-md-9">
<input name="mf_materno" id="mf_materno" type="text" class="form-control">
</div>
</div>
</div>
</div>
<!-- Pestaña Números de Validación y Folios -->
<div class="tab-pane fade" id="validacion" role="tabpanel" aria-labelledby="validacion-tab">
<p style="font-weight: bold;">Números de Validación y Folios</p>
<!-- Pedimentos -->
<p>Números de Validación para Pedimentos</p>
<div class="row mb-3">
<div class="col-md-1"></div>
<label for="vp_inicio" class="col-md-1 col-form-label">Inicio:</label>
<div class="col-md-1">
<input name="vp_inicio" id="vp_inicio" type="text" maxlength="3" class="form-control" placeholder="000">
</div>
<div class="col-md-1"></div>
<label for="vp_final" class="col-md-1 col-form-label">Final:</label>
<div class="col-md-1">
<input name="vp_final" id="vp_final" type="text" maxlength="3" class="form-control" placeholder="000">
</div>
<div class="col-md-1"></div>
<label for="vp_siguiente" class="col-md-1 col-form-label">Siguiente:</label>
<div class="col-md-1">
<input name="vp_siguiente" id="vp_siguiente" type="text" maxlength="3" class="form-control" placeholder="000">
</div>
</div><hr>
<!-- Pago Electrónico -->
<p>Números de Validación para Pago Electrónico</p>
<div class="row mb-3">
<div class="col-md-1"></div>
<label for="vpe_inicio" class="col-md-1 col-form-label">Inicio:</label>
<div class="col-md-1">
<input name="vpe_inicio" id="vpe_inicio" type="text" maxlength="3" class="form-control" placeholder="000">
</div>
<div class="col-md-1"></div>
<label for="vpe_final" class="col-md-1 col-form-label">Final:</label>
<div class="col-md-1">
<input name="vpe_final" id="vpe_final" type="text" maxlength="3" class="form-control" placeholder="000">
</div>
<div class="col-md-1"></div>
<label for="vpe_siguiente" class="col-md-1 col-form-label">Siguiente:</label>
<div class="col-md-1">
<input name="vpe_siguiente" id="vpe_siguiente" type="text" maxlength="3" class="form-control" placeholder="000">
</div>
</div><hr>
<!-- Avisos Traslado / Plantas-Bodegas -->
<p>Números de Validación para Avisos Traslado / Plantas-Bodegas</p>
<div class="row mb-3">
<div class="col-md-1"></div>
<label for="vat_pb_inicio" class="col-md-1 col-form-label">Inicio:</label>
<div class="col-md-1">
<input name="vat_pb_inicio" id="vat_pb_inicio" type="text" maxlength="3" class="form-control" placeholder="000">
</div>
<div class="col-md-1"></div>
<label for="vat_pb_final" class="col-md-1 col-form-label">Final:</label>
<div class="col-md-1">
<input name="vat_pb_final" id="vat_pb_final" type="text" maxlength="3" class="form-control" placeholder="000">
</div>
<div class="col-md-1"></div>
<label for="vat_pb_siguiente" class="col-md-1 col-form-label">Siguiente:</label>
<div class="col-md-1">
<input name="vat_pb_siguiente" id="vat_pb_siguiente" type="text" maxlength="3" class="form-control" placeholder="000">
</div>
</div><hr>
<!-- Validación y Folio de Cartas Cupo -->
<p>Números de Validación para Cartas Cupo</p>
<div class="row mb-3">
<div class="col-md-1"></div>
<label for="vcc_inicio" class="col-md-1 col-form-label">Inicio:</label>
<div class="col-md-1">
<input name="vcc_inicio" id="vcc_inicio" type="text" maxlength="3" class="form-control" placeholder="000">
</div>
<div class="col-md-1"></div>
<label for="vcc_final" class="col-md-1 col-form-label">Final:</label>
<div class="col-md-1">
<input name="vcc_final" id="vcc_final" type="text" maxlength="3" class="form-control" placeholder="000">
</div>
<div class="col-md-1"></div>
<label for="vcc_siguiente" class="col-md-1 col-form-label">Siguiente:</label>
<div class="col-md-1">
<input name="vcc_siguiente" id="vcc_siguiente" type="text" maxlength="3" class="form-control" placeholder="000">
</div>
</div><hr>
<!-- Avisos Electrónicos -->
<p>Números de Validación para Avisos Electrónicos</p>
<div class="row mb-3">
<div class="col-md-1"></div>
<label for="vae_inicio" class="col-md-1 col-form-label">Inicio:</label>
<div class="col-md-1">
<input name="vae_inicio" id="vae_inicio" type="text" maxlength="3" class="form-control" placeholder="000" value="000">
</div>
<div class="col-md-1"></div>
<label for="vae_final" class="col-md-1 col-form-label">Final:</label>
<div class="col-md-1">
<input name="vae_final" id="vae_final" type="text" maxlength="3" class="form-control" placeholder="000">
</div>
<div class="col-md-1"></div>
<label for="vae_siguiente" class="col-md-1 col-form-label">Siguiente:</label>
<div class="col-md-1">
<input name="vae_siguiente" id="vae_siguiente" type="text" maxlength="3" class="form-control" placeholder="000">
</div>
</div>
</div>
</div>
<div style="display: flex; justify-content: right;">
<button type="submit" class="btn btn-success">Guardar</button>
<a href="/IMPORTADORES/patente/lista" class="btn btn-secondary ms-2">Cancelar</a>
</div>
</form>
</div>
</div>
<script>
document.getElementById('formAltaPatente').addEventListener('submit', function(e) {
e.preventDefault(); // Prevenir envío por defecto
// Obtener todos los campos correctamente
const aduana = document.getElementById('aduana').value;
const patente = document.getElementById('patente').value;
const agente_aduanal = document.getElementById('agente_aduanal').value.trim();
const rfc = document.getElementById('rfc').value.trim();
const curp = document.getElementById('curp').value.trim();
const razon_social = document.getElementById('razon_social').value.trim();
// Expresiones regulares
const rfcRegex = /^[A-ZÑ&]{3,4}\d{6}[A-Z0-9]{3}$/;
const curpRegex = /^[A-Z]{4}[0-9]{6}[HM](AS|BC|BS|CC|CL|CM|CS|CH|DF|DG|GT|GR|HG|JC|MC|MN|MS|NT|NL|OC|PL|QT|QR|SP|SL|SR|TC|TS|TL|VZ|YN|ZS)[A-Z]{3}[A-Z0-9]{2}$/;
const soloNumerosRegex = /^[0-9]+$/;
if (!aduana) {
Swal.fire({ icon: 'error', title: 'Campo requerido', text: 'La aduana es obligatoria.', confirmButtonColor: '#dc3545' });
document.getElementById('aduana').focus();
return;
}
if (!soloNumerosRegex.test(aduana)) {
Swal.fire({ icon: 'error', title: 'Aduana inválida', text: 'La aduana solo puede contener números.', confirmButtonColor: '#dc3545' });
document.getElementById('aduana').focus();
return;
}
if (!patente) {
Swal.fire({ icon: 'error', title: 'Campo requerido', text: 'La patente es obligatoria.', confirmButtonColor: '#dc3545' });
document.getElementById('patente').focus();
return;
}
if (!soloNumerosRegex.test(patente)) {
Swal.fire({ icon: 'error', title: 'Patente inválida', text: 'La patente solo puede contener números.', confirmButtonColor: '#dc3545' });
document.getElementById('patente').focus();
return;
}
if (!agente_aduanal) {
Swal.fire({ icon: 'error', title: 'Campo requerido', text: 'El agente aduanal es obligatorio.', confirmButtonColor: '#dc3545' });
document.getElementById('agente_aduanal').focus();
return;
}
if (!rfc) {
Swal.fire({ icon: 'error', title: 'Campo requerido', text: 'El RFC es obligatorio.', confirmButtonColor: '#dc3545' });
document.getElementById('rfc').focus();
return;
}
if (!rfcRegex.test(rfc)) {
Swal.fire({ icon: 'error', title: 'RFC inválido', text: 'El RFC debe tener 12 o 13 caracteres con el formato correcto (ej. ABC123456XYZ).', confirmButtonColor: '#dc3545' });
document.getElementById('rfc').focus();
return;
}
if (!curp) {
Swal.fire({ icon: 'error', title: 'Campo requerido', text: 'El CURP es obligatorio.', confirmButtonColor: '#dc3545' });
document.getElementById('curp').focus();
return;
}
if (curp && !curpRegex.test(curp)) {
Swal.fire({ icon: 'error', title: 'CURP inválido', text: 'El CURP debe tener 18 caracteres con el formato correcto.', confirmButtonColor: '#dc3545'
});
document.getElementById('curp').focus();
return;
}
if (!razon_social) {
Swal.fire({ icon: 'error', title: 'Campo requerido', text: 'La razón social es obligatoria.', confirmButtonColor: '#dc3545' });
document.getElementById('razon_social').focus();
return;
}
const vp_inicio = document.getElementById('vp_inicio').value;
const vp_final = document.getElementById('vp_final').value;
const vp_siguiente = document.getElementById('vp_siguiente').value;
const vpe_inicio = document.getElementById('vpe_inicio').value;
const vpe_final = document.getElementById('vpe_final').value;
const vpe_siguiente = document.getElementById('vpe_siguiente').value;
const vat_pb_inicio = document.getElementById('vat_pb_inicio').value;
const vat_pb_final = document.getElementById('vat_pb_final').value;
const vat_pb_siguiente = document.getElementById('vat_pb_siguiente').value;
const vcc_inicio = document.getElementById('vcc_inicio').value;
const vcc_final = document.getElementById('vcc_final').value;
const vcc_siguiente = document.getElementById('vcc_siguiente').value;
const vae_inicio = document.getElementById('vae_inicio').value;
const vae_final = document.getElementById('vae_final').value;
const vae_siguiente = document.getElementById('vae_siguiente').value;
// Validaciones Números de Validación y Folios
if (vp_inicio !== '' && !soloNumerosRegex.test(vp_inicio)) {
Swal.fire({ icon: 'error', title: 'Campo inválido', text: 'Inicio solo puede contener números.', confirmButtonColor: '#dc3545' });
document.getElementById('vp_inicio').focus();
return;
}
if (vp_final !== '' && !soloNumerosRegex.test(vp_final)) {
Swal.fire({ icon: 'error', title: 'Campo inválido', text: 'Final solo puede contener números.', confirmButtonColor: '#dc3545' });
document.getElementById('vp_final').focus();
return;
}
if (vp_siguiente !== '' && !soloNumerosRegex.test(vp_siguiente)) {
Swal.fire({ icon: 'error', title: 'Campo inválido', text: 'Siguiente solo puede contener números.', confirmButtonColor: '#dc3545' });
document.getElementById('vp_siguiente').focus();
return;
}
if (vpe_inicio !== '' && !soloNumerosRegex.test(vpe_inicio)) {
Swal.fire({ icon: 'error', title: 'Campo inválido', text: 'Inicio solo puede contener números.', confirmButtonColor: '#dc3545' });
document.getElementById('vpe_inicio').focus();
return;
}
if (vpe_final !== '' && !soloNumerosRegex.test(vpe_final)) {
Swal.fire({ icon: 'error', title: 'Campo inválido', text: 'Final solo puede contener números.', confirmButtonColor: '#dc3545' });
document.getElementById('vpe_final').focus();
return;
}
if (vpe_siguiente !== '' && !soloNumerosRegex.test(vpe_siguiente)) {
Swal.fire({ icon: 'error', title: 'Campo inválido', text: 'Siguiente solo puede contener números.', confirmButtonColor: '#dc3545' });
document.getElementById('vpe_siguiente').focus();
return;
}
if (vat_pb_inicio !== '' && !soloNumerosRegex.test(vat_pb_inicio)) {
Swal.fire({ icon: 'error', title: 'Campo inválido', text: 'Inicio solo puede contener números.', confirmButtonColor: '#dc3545' });
document.getElementById('vat_pb_inicio').focus();
return;
}
if (vat_pb_final !== '' && !soloNumerosRegex.test(vat_pb_final)) {
Swal.fire({ icon: 'error', title: 'Campo inválido', text: 'Final solo puede contener números.', confirmButtonColor: '#dc3545' });
document.getElementById('vat_pb_final').focus();
return;
}
if (vat_pb_siguiente !== '' && !soloNumerosRegex.test(vat_pb_siguiente)) {
Swal.fire({ icon: 'error', title: 'Campo inválido', text: 'Siguiente solo puede contener números.', confirmButtonColor: '#dc3545' });
document.getElementById('vat_pb_siguiente').focus();
return;
}
if (vcc_inicio !== '' && !soloNumerosRegex.test(vcc_inicio)) {
Swal.fire({ icon: 'error', title: 'Campo inválido', text: 'Inicio solo puede contener números.', confirmButtonColor: '#dc3545' });
document.getElementById('vcc_inicio').focus();
return;
}
if (vcc_final !== '' && !soloNumerosRegex.test(vcc_final)) {
Swal.fire({ icon: 'error', title: 'Campo inválido', text: 'Final solo puede contener números.', confirmButtonColor: '#dc3545' });
document.getElementById('vcc_final').focus();
return;
}
if (vcc_siguiente !== '' && !soloNumerosRegex.test(vcc_siguiente)) {
Swal.fire({ icon: 'error', title: 'Campo inválido', text: 'Siguiente solo puede contener números.', confirmButtonColor: '#dc3545' });
document.getElementById('vcc_siguiente').focus();
return;
}
if (vae_inicio !== '' && !soloNumerosRegex.test(vae_inicio)) {
Swal.fire({ icon: 'error', title: 'Campo inválido', text: 'Inicio solo puede contener números.', confirmButtonColor: '#dc3545' });
document.getElementById('vae_inicio').focus();
return;
}
if (vae_final !== '' && !soloNumerosRegex.test(vae_final)) {
Swal.fire({ icon: 'error', title: 'Campo inválido', text: 'Final solo puede contener números.', confirmButtonColor: '#dc3545' });
document.getElementById('vae_final').focus();
return;
}
if (vae_siguiente !== '' && !soloNumerosRegex.test(vae_siguiente)) {
Swal.fire({ icon: 'error', title: 'Campo inválido', text: 'Siguiente solo puede contener números.', confirmButtonColor: '#dc3545' });
document.getElementById('vae_siguiente').focus();
return;
}
// ✅ SI TODAS LAS VALIDACIONES PASAN, ENVIAR EL FORMULARIO
// Mostrar indicador de carga
Swal.fire({
title: 'Guardando...', text: 'Por favor espere', allowOutsideClick: false, showConfirmButton: false,
willOpen: () => { Swal.showLoading(); }
});
// SI TODAS LAS VALIDACIONES PASAN, ENVIAR EL FORMULARIO
this.submit();
});
</script>
</body>
</html>

View File

@@ -0,0 +1,69 @@
<?php include __DIR__ . '/../partials/sidebar_agente.php'; ?>
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8">
<title>Dashboard | Importador</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></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; }
.navbar { position: fixed; top: 0; width: 100%; z-index: 1050; }
.btn-indigo { background-color: #6610f2; color: white;}
.btn-indigo:hover { background-color: #520dc2; color: white;}
.text-indigo { color: orangeRed;}
.btn-orange { background-color: orangeRed; color: white;}
.btn-orange:hover { background-color: #ff3600; color: white;}
.text-orange { color: orangeRed;}
/* A partir de dispositivos medianos (>=768px), deja espacio lateral */
@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; }
.sidebar .nav-link:hover,
.sidebar .nav-link.active { background-color: #e9ecef; color: #212529; }
}
.card { border-radius: 12px; }
</style>
</head>
<body>
<div class="content">
<h4 class="mb-4">📦 Panel del Importador</h4>
<div class="row g-4">
<div class="col-md-4">
<div class="card shadow-sm p-3">
<h5 class="text-primary">Ver patentes</h5>
<p>Revisa y gestiona las patentes.</p>
<a href="/IMPORTADORES/patente/lista"
class="btn btn-primary btn-sm mt-2 <?= $_SERVER['REQUEST_URI'] === '/IMPORTADORES/transportes/lista' ? 'active' : '' ?>">
Ver transportes
</a>
</div>
</div>
<div class="col-md-4">
<div class="card shadow-sm p-3">
<h5 class="text-success">Nueva patente</h5>
<p>Agrega nuevas patentes:</p>
<a href="/IMPORTADORES/patente/alta"
class="btn btn-success btn-sm mt-2 <?= $_SERVER['REQUEST_URI'] === '/IMPORTADORES/transportistas/lista' ? 'active' : '' ?>">
Ver transportistas
</a>
</div>
</div>
</div>
</div>
</body>
</html>

459
views/patente/editar.php Normal file
View File

@@ -0,0 +1,459 @@
<?php include __DIR__ . '/../partials/sidebar_agente.php'; ?>
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8">
<title>Dashboard | Importador</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
<!-- SweetAlert2 -->
<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; }
.navbar { position: fixed; top: 0; width: 100%; z-index: 1050; }
.btn-indigo { background-color: #6610f2; color: white;}
.btn-indigo:hover { background-color: #520dc2; color: white;}
.text-indigo { color: orangeRed;}
.btn-orange { background-color: orangeRed; color: white;}
.btn-orange:hover { background-color: #ff3600; color: white;}
.text-orange { color: orangeRed;}
/* A partir de dispositivos medianos (>=768px), deja espacio lateral */
@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; }
.sidebar .nav-link:hover,
.sidebar .nav-link.active { background-color: #e9ecef; color: #212529; }
}
.card { border-radius: 12px; }
/* Estilos mejorados para las pestañas */
.nav-tabs { border-bottom: 1px solid #dee2e6; margin-bottom: 0; }
.nav-tabs .nav-item { margin-bottom: -1px; }
.nav-tabs .nav-link { border: 1px solid transparent; border-radius: 0.375rem 0.375rem 0 0; padding: 12px 20px; color: #495057; background-color: #f8f9fa;
font-weight: 500; white-space: nowrap; min-width: 150px; text-align: center; transition: all 0.3s ease; }
.nav-tabs .nav-link:hover { border-color: #e9ecef #e9ecef #dee2e6; background-color: #e9ecef; color: #212529; }
.nav-tabs .nav-link.active { color: #495057; background-color: #fff; border-color: #dee2e6 #dee2e6 #fff; border-bottom: 2px solid #fff; }
/* Asegurar que las pestañas sean completamente visibles */
.nav-tabs .nav-item:first-child .nav-link { margin-left: 0; }
.nav-tabs .nav-item:last-child .nav-link { margin-right: 0; }
.tab-content { padding: 5px; }
</style>
</head>
<body>
<div class="content">
<h4>CONFIGURACIÓN ADUANA / PATENTE</h4>
<div class="card p-4 shadow-sm bg-white">
<!-- Se agrega enctype para subir archivos -->
<form action="/IMPORTADORES/patente/actualizar" method="POST" id="formEdicionPatente">
<!-- Campo oculto para el ID -->
<input type="hidden" name="id_agente" value="<?= htmlspecialchars($agente['id_agente'] ?? '') ?>">
<!-- Pestañas de navegación -->
<ul class="nav nav-tabs" id="myTab" role="tablist">
<li class="nav-item" role="presentation">
<button class="nav-link active" id="general-tab" data-bs-toggle="tab" data-bs-target="#general"
type="button" role="tab" aria-controls="general" aria-selected="true">
General
</button>
</li>
<li class="nav-item" role="presentation">
<button class="nav-link" id="validacion-tab" data-bs-toggle="tab" data-bs-target="#validacion"
type="button" role="tab" aria-controls="validacion" aria-selected="false">
Números de Validación y Folios
</button>
</li>
</ul>
<!-- Contenido de las pestañas -->
<div class="tab-content" id="myTabContent">
<!-- Pestaña General -->
<div class="tab-pane fade show active" id="general" role="tabpanel" aria-labelledby="general-tab">
<p style="font-weight: bold;">Datos de la Patente / Aduana</p>
<div class="row mb-3">
<label for="aduana" class="col-md-2 col-form-label">Aduana</label>
<div class="col-md-3">
<input name="aduana" id="aduana" type="text" maxlength="3" class="form-control"
value="<?= htmlspecialchars($agente['aduana'] ?? '') ?>" required>
</div>
<label for="aduana" class="col-md-2 col-form-label">[Sin Sección]</label>
</div>
<div class="row mb-3">
<label for="patente" class="col-md-2 col-form-label">Patente</label>
<div class="col-md-3">
<input name="patente" id="patente" type="text" maxlength="4" class="form-control"
value="<?= htmlspecialchars($agente['patente'] ?? '') ?>" required>
</div>
</div>
<div class="row mb-3">
<label for="agente_aduanal" class="col-md-2 col-form-label">Agente Aduanal</label>
<div class="col-md-10">
<input name="agente_aduanal" id="agente_aduanal" type="text" class="form-control"
value="<?= htmlspecialchars($agente['agente_aduanal'] ?? '') ?>" required>
</div>
</div>
<div class="row mb-3">
<label for="rfc" class="col-md-2 col-form-label">RFC</label>
<div class="col-md-6">
<input name="rfc" id="rfc" type="text" maxlength="13" class="form-control"
value="<?= htmlspecialchars($agente['rfc'] ?? '') ?>" required>
</div>
</div>
<div class="row mb-3">
<label for="curp" class="col-md-2 col-form-label">CURP</label>
<div class="col-md-6">
<input name="curp" id="curp" type="text" maxlength="18" class="form-control"
value="<?= htmlspecialchars($agente['curp'] ?? '') ?>" required>
</div>
</div>
<div class="row mb-3">
<label for="razon_social" class="col-md-2 col-form-label">Razón Social</label>
<div class="col-md-10">
<input name="razon_social" id="razon_social" type="text" class="form-control"
value="<?= htmlspecialchars($agente['razon_social'] ?? '') ?>" required>
</div>
</div><hr><br>
<div class="col mb-3">
<P>Capturar para el llenado de la Manifestación de Valor</P>
<p>Datos del Agente Aduanal:</p>
<div class="row mb-3">
<label for="mf_nombre" class="col-md-2 col-form-label">Nombre(s)</label>
<div class="col-md-9">
<input name="mf_nombre" id="mf_nombre" type="text" class="form-control"
value="<?= htmlspecialchars($agente['mf_nombre'] ?? '') ?>">
</div>
</div>
<div class="row mb-3">
<label for="mf_paterno" class="col-md-2 col-form-label">Apellido Paterno</label>
<div class="col-md-9">
<input name="mf_paterno" id="mf_paterno" type="text" class="form-control"
value="<?= htmlspecialchars($agente['mf_paterno'] ?? '') ?>">
</div>
</div>
<div class="row mb-3">
<label for="mf_materno" class="col-md-2 col-form-label">Apellido Materno</label>
<div class="col-md-9">
<input name="mf_materno" id="mf_materno" type="text" class="form-control"
value="<?= htmlspecialchars($agente['mf_materno'] ?? '') ?>">
</div>
</div>
</div>
</div>
<!-- Pestaña Números de Validación y Folios -->
<div class="tab-pane fade" id="validacion" role="tabpanel" aria-labelledby="validacion-tab">
<p style="font-weight: bold;">Números de Validación y Folios</p>
<!-- Pedimentos -->
<p>Números de Validación para Pedimentos</p>
<div class="row mb-3">
<div class="col-md-1"></div>
<label for="vp_inicio" class="col-md-1 col-form-label">Inicio:</label>
<div class="col-md-1">
<input name="vp_inicio" id="vp_inicio" type="text" maxlength="3" class="form-control"
value="<?= htmlspecialchars(sprintf('%03d', $agente['vp_inicio'] ?? '0')) ?>">
</div>
<div class="col-md-1"></div>
<label for="vp_final" class="col-md-1 col-form-label">Final:</label>
<div class="col-md-1">
<input name="vp_final" id="vp_final" type="text" maxlength="3" class="form-control"
value="<?= htmlspecialchars(sprintf('%03d', $agente['vp_final'] ?? '0')) ?>">
</div>
<div class="col-md-1"></div>
<label for="vp_siguiente" class="col-md-1 col-form-label">Siguiente:</label>
<div class="col-md-1">
<input name="vp_siguiente" id="vp_siguiente" type="text" maxlength="3" class="form-control"
value="<?= htmlspecialchars(sprintf('%03d', $agente['vp_siguiente'] ?? '0')) ?>">
</div>
</div><hr>
<!-- Pago Electrónico -->
<p>Números de Validación para Pago Electrónico</p>
<div class="row mb-3">
<div class="col-md-1"></div>
<label for="vpe_inicio" class="col-md-1 col-form-label">Inicio:</label>
<div class="col-md-1">
<input name="vpe_inicio" id="vpe_inicio" type="text" maxlength="3" class="form-control"
value="<?= htmlspecialchars(sprintf('%03d', $agente['vpe_inicio'] ?? '0')) ?>">
</div>
<div class="col-md-1"></div>
<label for="vpe_final" class="col-md-1 col-form-label">Final:</label>
<div class="col-md-1">
<input name="vpe_final" id="vpe_final" type="text" maxlength="3" class="form-control"
value="<?= htmlspecialchars(sprintf('%03d', $agente['vpe_final'] ?? '0')) ?>">
</div>
<div class="col-md-1"></div>
<label for="vpe_siguiente" class="col-md-1 col-form-label">Siguiente:</label>
<div class="col-md-1">
<input name="vpe_siguiente" id="vpe_siguiente" type="text" maxlength="3" class="form-control"
value="<?= htmlspecialchars(sprintf('%03d', $agente['vpe_siguiente'] ?? '0')) ?>">
</div>
</div><hr>
<!-- Avisos Traslado / Plantas-Bodegas -->
<p>Números de Validación para Avisos Traslado / Plantas-Bodegas</p>
<div class="row mb-3">
<div class="col-md-1"></div>
<label for="vat_pb_inicio" class="col-md-1 col-form-label">Inicio:</label>
<div class="col-md-1">
<input name="vat_pb_inicio" id="vat_pb_inicio" type="text" maxlength="3" class="form-control"
value="<?= htmlspecialchars(sprintf('%03d', $agente['vat_pb_inicio'] ?? '0')) ?>">
</div>
<div class="col-md-1"></div>
<label for="vat_pb_final" class="col-md-1 col-form-label">Final:</label>
<div class="col-md-1">
<input name="vat_pb_final" id="vat_pb_final" type="text" maxlength="3" class="form-control"
value="<?= htmlspecialchars(sprintf('%03d', $agente['vat_pb_final'] ?? '0')) ?>">
</div>
<div class="col-md-1"></div>
<label for="vat_pb_siguiente" class="col-md-1 col-form-label">Siguiente:</label>
<div class="col-md-1">
<input name="vat_pb_siguiente" id="vat_pb_siguiente" type="text" maxlength="3" class="form-control"
value="<?= htmlspecialchars(sprintf('%03d', $agente['vat_pb_siguiente'] ?? '0')) ?>">
</div>
</div><hr>
<!-- Validación y Folio de Cartas Cupo -->
<p>Números de Validación para Cartas Cupo</p>
<div class="row mb-3">
<div class="col-md-1"></div>
<label for="vcc_inicio" class="col-md-1 col-form-label">Inicio:</label>
<div class="col-md-1">
<input name="vcc_inicio" id="vcc_inicio" type="text" maxlength="3" class="form-control"
value="<?= htmlspecialchars(sprintf('%03d', $agente['vcc_inicio'] ?? '0')) ?>">
</div>
<div class="col-md-1"></div>
<label for="vcc_final" class="col-md-1 col-form-label">Final:</label>
<div class="col-md-1">
<input name="vcc_final" id="vcc_final" type="text" maxlength="3" class="form-control"
value="<?= htmlspecialchars(sprintf('%03d', $agente['vcc_final'] ?? '0')) ?>">
</div>
<div class="col-md-1"></div>
<label for="vcc_siguiente" class="col-md-1 col-form-label">Siguiente:</label>
<div class="col-md-1">
<input name="vcc_siguiente" id="vcc_siguiente" type="text" maxlength="3" class="form-control"
value="<?= htmlspecialchars(sprintf('%03d', $agente['vcc_siguiente'] ?? '0')) ?>">
</div>
</div><hr>
<!-- Avisos Electrónicos -->
<p>Números de Validación para Avisos Electrónicos</p>
<div class="row mb-3">
<div class="col-md-1"></div>
<label for="vae_inicio" class="col-md-1 col-form-label">Inicio:</label>
<div class="col-md-1">
<input name="vae_inicio" id="vae_inicio" type="text" maxlength="3" class="form-control"
value="<?= htmlspecialchars(sprintf('%03d', $agente['vae_inicio'] ?? '0')) ?>">
</div>
<div class="col-md-1"></div>
<label for="vae_final" class="col-md-1 col-form-label">Final:</label>
<div class="col-md-1">
<input name="vae_final" id="vae_final" type="text" maxlength="3" class="form-control"
value="<?= htmlspecialchars(sprintf('%03d', $agente['vae_final'] ?? '0')) ?>">
</div>
<div class="col-md-1"></div>
<label for="vae_siguiente" class="col-md-1 col-form-label">Siguiente:</label>
<div class="col-md-1">
<input name="vae_siguiente" id="vae_siguiente" type="text" maxlength="3" class="form-control"
value="<?= htmlspecialchars(sprintf('%03d', $agente['vae_siguiente'] ?? '0')) ?>">
</div>
</div>
</div>
</div>
<div style="display: flex; justify-content: right;">
<button type="submit" class="btn btn-success">Guardar</button>
<a href="/IMPORTADORES/patente/lista" class="btn btn-secondary ms-2">Cancelar</a>
</div>
</form>
</div>
</div>
<script>
document.getElementById('formEdicionPatente').addEventListener('submit', function(e) {
e.preventDefault(); // Prevenir envío por defecto
// Obtener todos los campos correctamente
const aduana = document.getElementById('aduana').value;
const patente = document.getElementById('patente').value;
const agente_aduanal = document.getElementById('agente_aduanal').value.trim();
const rfc = document.getElementById('rfc').value.trim();
const curp = document.getElementById('curp').value.trim();
const razon_social = document.getElementById('razon_social').value.trim();
// Expresiones regulares
const rfcRegex = /^[A-ZÑ&]{3,4}\d{6}[A-Z0-9]{3}$/;
const curpRegex = /^[A-Z]{4}[0-9]{6}[HM](AS|BC|BS|CC|CL|CM|CS|CH|DF|DG|GT|GR|HG|JC|MC|MN|MS|NT|NL|OC|PL|QT|QR|SP|SL|SR|TC|TS|TL|VZ|YN|ZS)[A-Z]{3}[A-Z0-9]{2}$/;
const soloNumerosRegex = /^[0-9]+$/;
if (!aduana) {
Swal.fire({ icon: 'error', title: 'Campo requerido', text: 'La aduana es obligatoria.', confirmButtonColor: '#dc3545' });
document.getElementById('aduana').focus();
return;
}
if (!soloNumerosRegex.test(aduana)) {
Swal.fire({ icon: 'error', title: 'Aduana inválida', text: 'La aduana solo puede contener números.', confirmButtonColor: '#dc3545' });
document.getElementById('aduana').focus();
return;
}
if (!patente) {
Swal.fire({ icon: 'error', title: 'Campo requerido', text: 'La patente es obligatoria.', confirmButtonColor: '#dc3545' });
document.getElementById('patente').focus();
return;
}
if (!soloNumerosRegex.test(patente)) {
Swal.fire({ icon: 'error', title: 'Patente inválida', text: 'La patente solo puede contener números.', confirmButtonColor: '#dc3545' });
document.getElementById('patente').focus();
return;
}
if (!agente_aduanal) {
Swal.fire({ icon: 'error', title: 'Campo requerido', text: 'El agente aduanal es obligatorio.', confirmButtonColor: '#dc3545' });
document.getElementById('agente_aduanal').focus();
return;
}
if (!rfc) {
Swal.fire({ icon: 'error', title: 'Campo requerido', text: 'El RFC es obligatorio.', confirmButtonColor: '#dc3545' });
document.getElementById('rfc').focus();
return;
}
if (!rfcRegex.test(rfc)) {
Swal.fire({ icon: 'error', title: 'RFC inválido', text: 'El RFC debe tener 12 o 13 caracteres con el formato correcto (ej. ABC123456XYZ).', confirmButtonColor: '#dc3545' });
document.getElementById('rfc').focus();
return;
}
if (!curp) {
Swal.fire({ icon: 'error', title: 'Campo requerido', text: 'El CURP es obligatorio.', confirmButtonColor: '#dc3545' });
document.getElementById('curp').focus();
return;
}
if (curp && !curpRegex.test(curp)) {
Swal.fire({ icon: 'error', title: 'CURP inválido', text: 'El CURP debe tener 18 caracteres con el formato correcto.', confirmButtonColor: '#dc3545'
});
document.getElementById('curp').focus();
return;
}
if (!razon_social) {
Swal.fire({ icon: 'error', title: 'Campo requerido', text: 'La razón social es obligatoria.', confirmButtonColor: '#dc3545' });
document.getElementById('razon_social').focus();
return;
}
const vp_inicio = document.getElementById('vp_inicio').value;
const vp_final = document.getElementById('vp_final').value;
const vp_siguiente = document.getElementById('vp_siguiente').value;
const vpe_inicio = document.getElementById('vpe_inicio').value;
const vpe_final = document.getElementById('vpe_final').value;
const vpe_siguiente = document.getElementById('vpe_siguiente').value;
const vat_pb_inicio = document.getElementById('vat_pb_inicio').value;
const vat_pb_final = document.getElementById('vat_pb_final').value;
const vat_pb_siguiente = document.getElementById('vat_pb_siguiente').value;
const vcc_inicio = document.getElementById('vcc_inicio').value;
const vcc_final = document.getElementById('vcc_final').value;
const vcc_siguiente = document.getElementById('vcc_siguiente').value;
const vae_inicio = document.getElementById('vae_inicio').value;
const vae_final = document.getElementById('vae_final').value;
const vae_siguiente = document.getElementById('vae_siguiente').value;
// Validaciones Números de Validación y Folios
if (!soloNumerosRegex.test(vp_inicio)) {
Swal.fire({ icon: 'error', title: 'Campo inválido', text: 'Inicio solo puede contener números.', confirmButtonColor: '#dc3545' });
document.getElementById('vp_inicio').focus();
return;
}
if (!soloNumerosRegex.test(vp_final)) {
Swal.fire({ icon: 'error', title: 'Campo inválido', text: 'Final solo puede contener números.', confirmButtonColor: '#dc3545' });
document.getElementById('vp_final').focus();
return;
}
if (!soloNumerosRegex.test(vp_siguiente)) {
Swal.fire({ icon: 'error', title: 'Campo inválido', text: 'Siguiente solo puede contener números.', confirmButtonColor: '#dc3545' });
document.getElementById('vp_siguiente').focus();
return;
}
if (!soloNumerosRegex.test(vpe_inicio)) {
Swal.fire({ icon: 'error', title: 'Campo inválido', text: 'Inicio solo puede contener números.', confirmButtonColor: '#dc3545' });
document.getElementById('vpe_inicio').focus();
return;
}
if (!soloNumerosRegex.test(vpe_final)) {
Swal.fire({ icon: 'error', title: 'Campo inválido', text: 'Final solo puede contener números.', confirmButtonColor: '#dc3545' });
document.getElementById('vpe_final').focus();
return;
}
if (!soloNumerosRegex.test(vpe_siguiente)) {
Swal.fire({ icon: 'error', title: 'Campo inválido', text: 'Siguiente solo puede contener números.', confirmButtonColor: '#dc3545' });
document.getElementById('vpe_siguiente').focus();
return;
}
if (!soloNumerosRegex.test(vat_pb_inicio)) {
Swal.fire({ icon: 'error', title: 'Campo inválido', text: 'Inicio solo puede contener números.', confirmButtonColor: '#dc3545' });
document.getElementById('vat_pb_inicio').focus();
return;
}
if (!soloNumerosRegex.test(vat_pb_final)) {
Swal.fire({ icon: 'error', title: 'Campo inválido', text: 'Final solo puede contener números.', confirmButtonColor: '#dc3545' });
document.getElementById('vat_pb_final').focus();
return;
}
if (!soloNumerosRegex.test(vat_pb_siguiente)) {
Swal.fire({ icon: 'error', title: 'Campo inválido', text: 'Siguiente solo puede contener números.', confirmButtonColor: '#dc3545' });
document.getElementById('vat_pb_siguiente').focus();
return;
}
if (!soloNumerosRegex.test(vcc_inicio)) {
Swal.fire({ icon: 'error', title: 'Campo inválido', text: 'Inicio solo puede contener números.', confirmButtonColor: '#dc3545' });
document.getElementById('vcc_inicio').focus();
return;
}
if (!soloNumerosRegex.test(vcc_final)) {
Swal.fire({ icon: 'error', title: 'Campo inválido', text: 'Final solo puede contener números.', confirmButtonColor: '#dc3545' });
document.getElementById('vcc_final').focus();
return;
}
if (!soloNumerosRegex.test(vcc_siguiente)) {
Swal.fire({ icon: 'error', title: 'Campo inválido', text: 'Siguiente solo puede contener números.', confirmButtonColor: '#dc3545' });
document.getElementById('vcc_siguiente').focus();
return;
}
if (!soloNumerosRegex.test(vae_inicio)) {
Swal.fire({ icon: 'error', title: 'Campo inválido', text: 'Inicio solo puede contener números.', confirmButtonColor: '#dc3545' });
document.getElementById('vae_inicio').focus();
return;
}
if (!soloNumerosRegex.test(vae_final)) {
Swal.fire({ icon: 'error', title: 'Campo inválido', text: 'Final solo puede contener números.', confirmButtonColor: '#dc3545' });
document.getElementById('vae_final').focus();
return;
}
if (!soloNumerosRegex.test(vae_siguiente)) {
Swal.fire({ icon: 'error', title: 'Campo inválido', text: 'Siguiente solo puede contener números.', confirmButtonColor: '#dc3545' });
document.getElementById('vae_siguiente').focus();
return;
}
// ✅ SI TODAS LAS VALIDACIONES PASAN, ENVIAR EL FORMULARIO
// Mostrar indicador de carga
Swal.fire({
title: 'Guardando...', text: 'Por favor espere', allowOutsideClick: false, showConfirmButton: false,
willOpen: () => { Swal.showLoading(); }
});
// SI TODAS LAS VALIDACIONES PASAN, ENVIAR EL FORMULARIO
this.submit();
});
</script>
</body>
</html>

120
views/patente/lista.php Normal file
View File

@@ -0,0 +1,120 @@
<?php include __DIR__ . '/../partials/sidebar_agente.php'; ?>
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8">
<title>Dashboard | Importador</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
<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>
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; }
.navbar { position: fixed; top: 0; width: 100%; z-index: 1050; }
.btn-indigo { background-color: #6610f2; color: white;}
.btn-indigo:hover { background-color: #520dc2; color: white;}
.text-indigo { color: orangeRed;}
.btn-orange { background-color: orangeRed; color: white;}
.btn-orange:hover { background-color: #ff3600; color: white;}
.text-orange { color: orangeRed;}
/* A partir de dispositivos medianos (>=768px), deja espacio lateral */
@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; }
.sidebar .nav-link:hover,
.sidebar .nav-link.active { background-color: #e9ecef; color: #212529; }
}
.card { border-radius: 12px; }
</style>
</head>
<body>
<div class="content">
<h4>📑 Registro de Patentes Aduanales</h4>
<a href="/IMPORTADORES/patente/alta" class="btn btn-success mb-3"> Nueva Patente</a>
<div class="card p-3 shadow-sm">
<div class="table-responsive">
<table class="table table-striped" id="tabla-patentes">
<thead class="table-dark">
<tr>
<th>#</th>
<th>Aduana</th>
<th>Patente</th>
<th>Agente Aduanal</th>
<th>RFC</th>
<th>CURP</th>
<th>Razón Social</th>
<th>Acciones</th>
</tr>
</thead>
<tbody>
<?php foreach($agentes_aduanales as $aa): ?>
<tr>
<td><?= $aa['id_agente'] ?></td>
<td><?= htmlspecialchars($aa['aduana']) ?></td>
<td><?= htmlspecialchars($aa['patente']) ?></td>
<td><?= htmlspecialchars($aa['agente_aduanal']) ?></td>
<td><?= htmlspecialchars($aa['rfc']) ?></td>
<td><?= htmlspecialchars($aa['curp']) ?></td>
<td><?= htmlspecialchars($aa['razon_social']) ?></td>
<td>
<a href="/IMPORTADORES/patente/editar?id=<?= $aa['id_agente'] ?>" class="btn btn-sm btn-primary">✏️</a>
<button class="btn btn-sm btn-danger" onclick="confirmDeleteChofer(<?= $aa['id_agente'] ?>)">🗑️</button>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>
</div>
<script>
function confirmDeleteChofer(id) {
Swal.fire({
title: '¿Eliminar agente aduanal?',
text: 'Esto sólo lo marcara como inactivo.',
icon: 'warning',
showCancelButton: true,
confirmButtonText: 'Sí, eliminar',
cancelButtonText: 'Cancelar',
confirmButtonColor: '#d33'
}).then(r => {
if (r.isConfirmed) {
window.location = `/IMPORTADORES/patente/eliminar?id=${id}`;
}
});
}
$(document).ready(function () {
$('#tabla-patentes').DataTable({
language: {
url: 'https://cdn.datatables.net/plug-ins/1.13.4/i18n/es-ES.json'
}
});
});
<?php if(isset($_GET['deleted'])): ?>
Swal.fire('¡Hecho!','Agente eliminado.','success');
<?php endif; ?>
<?php if(isset($_GET['created'])): ?>
Swal.fire('¡Listo!','Agente creado.','success');
<?php endif; ?>
<?php if(isset($_GET['updated'])): ?>
Swal.fire('¡Listo!','Agente actualizado.','success');
<?php endif; ?>
</script>
</body>
</html>

View File

@@ -11,6 +11,8 @@ $dos_factores_estado = obtenerEstadoDosFactores();
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/sweetalert/2.1.2/sweetalert.min.js"></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; }
@@ -29,6 +31,17 @@ $dos_factores_estado = obtenerEstadoDosFactores();
.sidebar .nav-link.active { background-color: #e9ecef; color: #212529; }
}
.card { border-radius: 12px; }
.btn i { font-family: "Font Awesome 6 Free", sans-serif; margin-right: 0.5rem; }
.btn { font-family: 'Segoe UI', sans-serif; }
.modal-header.bg-primary { background: linear-gradient(135deg, #003366, #0055A5) !important; color: white; }
.modal-header.bg-success { background: linear-gradient(135deg, #28a745, #20c997) !important; color: white; }
.codigo-input { text-align: center; font-size: 1.5rem; letter-spacing: 0.5rem; font-weight: bold; }
.intentos-restantes { color: #dc3545; font-weight: bold; }
.password-strength { height: 4px; border-radius: 2px; margin-top: 5px; transition: all 0.3s ease; }
.strength-weak { background-color: #dc3545; }
.strength-medium { background-color: #ffc107; }
.strength-strong { background-color: #28a745; }
.btn-loading { pointer-events: none; opacity: 0.6; }
</style>
</head>
<body>
@@ -38,10 +51,10 @@ $dos_factores_estado = obtenerEstadoDosFactores();
<div class="row g-3">
<!-- Autenticacin de dos factores -->
<div class="col-md-7">
<div class="col-md-6">
<div class="card shadow-sm p-3">
<h4 class="mb-4 text-dark">Autenticación de dos factores</h4>
<p>Al activar esta funcionalidad, blindas el acceso a tu cuenta, recibiras un código de acceso a tu correo electrónico para confirmar identidad</p>
<p>Al activar esta funcionalidad, blindas el acceso a tu cuenta, recibiras un código de acceso a tu correo electrónico para confirmar identidad.</p>
<form method="post" action="/IMPORTADORES/seguridad/autenticacionDosFactores">
<div class="form-check form-switch mb-3">
<input type="checkbox" name="dos_factores" id="dos_factores" class="form-check-input"
@@ -50,57 +63,73 @@ $dos_factores_estado = obtenerEstadoDosFactores();
<?php echo ($dos_factores_estado == 1) ? "Activo" : "Inactivo"; ?>
</label>
</div>
<button type="submit" class="btn btn-primary">Guardar configuración</button>
<button type="submit" class="btn btn-primary"><i class="fas fa-floppy-disk"></i>Guardar configuración</button>
</form>
</div>
</div>
<div class="col-md-6 hide"></div>
<!-- Correo adicional (extra) -->
<div class="col-md-7">
<div class="col-md-6">
<div class="card shadow-sm p-3">
<h4 class="mb-4 text-dark">Recibe Notificaciones</h4>
<h4 class="mb-4 text-dark">Recibe notificaciones</h4>
<p>Agrega un correo adicional para recibir notificaciones.</p>
<?php if (!empty($correos['correo_extra'])): ?>
<p><?= htmlspecialchars($correos['correo_extra']) ?></p>
<form method="POST" action="/IMPORTADORES/seguridad/modificarCorreoExtra">
<div class="mb-3">
<input type="email" name="email-extra" class="form-control" value="<?= htmlspecialchars($correos['correo_extra']) ?>" required>
</div>
<div class="mb-3">
<button type="submit" class="btn btn-success">Actualizar</button>
</div>
</form>
<p><code><?= htmlspecialchars($correos['correo_extra']) ?></code></p>
<!-- Formulario para eliminar -->
<form method="POST" action="/IMPORTADORES/seguridad/eliminarCorreoExtra" id="form-eliminar-extra" class="mt-2 hide"></form>
<form method="POST" action="/IMPORTADORES/seguridad/modificarCorreoExtra">
<div class="mb-3">
<input type="email" name="email-extra" class="form-control" value="" placeholder="Actualizar correo adicional" required>
</div>
<div class="d-flex gap-2">
<button type="submit" class="btn btn-success">
<i class="fas fa-edit"></i>Actualizar
</button>
<button type="button" class="btn btn-danger" onclick="confirmarEliminacion('extra')">
<i class="fas fa-trash"></i> Eliminar correo
</button>
</div>
</form>
<?php else: ?>
<form method="POST" action="/IMPORTADORES/seguridad/correoExtra">
<div class="mb-3">
<input type="email" name="email-extra" class="form-control" placeholder="Correo adicional" required>
</div>
<button type="submit" class="btn btn-primary">Registrar</button>
</form>
<form method="POST" action="/IMPORTADORES/seguridad/correoExtra">
<div class="mb-3">
<input type="email" name="email-extra" class="form-control" placeholder="Correo adicional" required>
</div>
<button type="submit" class="btn btn-primary"><i class="fas fa-envelope"></i>Registrar</button>
</form>
<?php endif; ?>
</div>
</div>
<!-- Correo de Respaldo -->
<div class="col-md-7">
<div class="col-md-6">
<div class="card shadow-sm p-3">
<h4 class="mb-4 text-dark">Correo de Respaldo</h4>
<h4 class="mb-4 text-dark">Correo de respaldo</h4>
<p>Agrega un correo de respaldo para reuperación de tu cuenta.</p>
<?php if (!empty($correos['correo_respaldo'])): ?>
<p><?= htmlspecialchars($correos['correo_respaldo']) ?></p>
<form method="POST" action="/IMPORTADORES/seguridad/modificarCorreoRspaldo">
<div class="mb-3">
<input type="email" name="email-respaldo" class="form-control" value="<?= htmlspecialchars($correos['correo_respaldo']) ?>" required>
</div>
<button type="submit" class="btn btn-success">Actualizar</button>
</form>
<p><code><?= htmlspecialchars($correos['correo_respaldo']) ?></code></p>
<!-- Formulario para eliminar -->
<form method="POST" action="/IMPORTADORES/seguridad/eliminarCorreoRespaldo" id="form-eliminar-respaldo" class="mt-2 hide"></form>
<form method="POST" action="/IMPORTADORES/seguridad/modificarCorreoRspaldo">
<div class="mb-3">
<input type="email" name="email-respaldo" class="form-control" value="" placeholder="Actualizar correo de respaldo" required>
</div>
<button type="submit" class="btn btn-success">
<i class="fas fa-edit"></i>Actualizar
</button>
<button type="button" class="btn btn-danger" onclick="confirmarEliminacion('respaldo')">
<i class="fas fa-trash"></i> Eliminar correo
</button>
</form>
<?php else: ?>
<form method="POST" action="/IMPORTADORES/seguridad/correoRespaldo">
<div class="mb-3">
<input type="email" name="email-respaldo" class="form-control" placeholder="Correo de respaldo" required>
</div>
<button type="submit" class="btn btn-primary">Registrar</button>
</form>
<form method="POST" action="/IMPORTADORES/seguridad/correoRespaldo">
<div class="mb-3">
<input type="email" name="email-respaldo" class="form-control" placeholder="Correo de respaldo" required>
</div>
<button type="submit" class="btn btn-primary"><i class="fas fa-envelope"></i>Registrar</button>
</form>
<?php endif; ?>
</div>
</div>
@@ -115,6 +144,61 @@ $dos_factores_estado = obtenerEstadoDosFactores();
chk.addEventListener('change', () => {
label.textContent = chk.checked ? 'Activo' : 'Inactivo';
});
// Función para confirmar eliminación con SweetAlert
function confirmarEliminacion(tipo) {
const mensajes = {
'extra': {
titulo: '¿Eliminar correo adicional?',
texto: 'No podrás recibir notificaciones en este correo.',
confirmado: 'Correo adicional eliminado',
form: 'form-eliminar-extra'
},
'respaldo': {
titulo: '¿Eliminar correo de respaldo?',
texto: 'No podrás recuperar tu cuenta con este correo.',
confirmado: 'Correo de respaldo eliminado',
form: 'form-eliminar-respaldo'
}
};
const config = mensajes[tipo];
swal({
title: config.titulo,
text: config.texto,
icon: "warning",
buttons: {
cancel: {
text: "Cancelar",
visible: true,
className: "btn-secondary"
},
confirm: {
text: "Sí, eliminar",
className: "btn-danger"
}
},
dangerMode: true,
})
.then((eliminar) => {
if (eliminar) {
// Mostrar mensaje de éxito y enviar formulario
swal({
title: "¡Eliminado!",
text: config.confirmado,
icon: "success",
timer: 1500,
buttons: false
});
// Enviar el formulario después de un pequeño delay
setTimeout(() => {
document.getElementById(config.form).submit();
}, 1500);
}
});
}
</script>
</body>

View File

@@ -34,25 +34,29 @@
<h4 class="mb-4">👮 Seguridad</h4>
<div class="row g-3">
<div class="col-md-7">
<div class="col-md-6">
<div class="card shadow-sm p-3">
<h4 class="mb-4 text-dark">Autenticación de dos factores</h4>
<p>Al activar esta funcionalidad, blindas el acceso a tu cuenta, recibiras un código de acceso a tu correo electrónico para confirmar identidad.</p>
<form>
<div class="form-check form-switch">
<input type="checkbox" class="form-check-input" role="switch"
id="dos_factores" name="dos_factores" disabled
<?php if(!empty($correos['dos_factores'])) echo "checked"; ?>>
<label class="form-check-label" for="dos_factores">
<?php echo !empty($correos['dos_factores']) ? "Activo" : "Inactivo"; ?>
<?php echo !empty($correos['dos_factores']) ? "Activo" : "Inactivo"; ?>
</label>
</div>
</form>
</div>
</div>
<div class="col-md-7">
<div class="col-md-6 hide"></div>
<div class="col-md-6">
<div class="card shadow-sm p-3">
<h4 class="mb-4 text-dark">Recibe notificaciones</h4>
<p>Agrega un correo adicional para recibir notificaciones.</p>
<form>
<div class="mb-3">
<label class="form-label">Correo electrónico adicional</label>
@@ -62,9 +66,10 @@
</div>
</div>
<div class="col-md-7">
<div class="col-md-6">
<div class="card shadow-sm p-3">
<h4 class="mb-4 text-dark">Correo de respaldo</h4>
<p>Agrega un correo de respaldo para reuperación de tu cuenta.</p>
<form>
<div class="mb-3">
<label class="form-label">Correo electrónico de respaldo</label>

View File

@@ -184,7 +184,7 @@
return;
}
if (!soloNumerosRegex.test(caat)) {
Swal.fire({ icon: 'error', title: 'Código CAAT inválido', text: 'El código caat solo puede contener números', confirmButtonColor: '#dc3545' });
Swal.fire({ icon: 'error', title: 'Código CAAT inválido', text: 'El código caat solo puede contener números.', confirmButtonColor: '#dc3545' });
document.getElementById('caat').focus();
return;
}

View File

@@ -101,7 +101,7 @@
function confirmDelete(id) {
Swal.fire({
title: '¿Eliminar transportista?',
text: 'Esto sólo lo eliminara completamente y no se podrá volver a usar.',
text: 'Esto sólo lo marcara como inactivo',
icon: 'warning',
showCancelButton: true,
confirmButtonText: 'Sí, eliminar',