749 lines
24 KiB
PHP
749 lines
24 KiB
PHP
<?php
|
|
require_once __DIR__ . '/../../config/database.php';
|
|
|
|
$conn = getConnection();
|
|
|
|
// Consultar configuración del sistema
|
|
$sql = "SELECT TOP 1 * FROM configuracion_sistema";
|
|
$stmt = sqlsrv_query($conn, $sql);
|
|
$config = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC);
|
|
|
|
// Variables con valores por defecto - Branding moderno
|
|
$nombre = $config['nombre_plataforma'] ?? 'Sistema de Gestión de Importaciones';
|
|
$siglas = $config['siglas'] ?? 'AduanaSoft';
|
|
$logo = $config['logo_url'] ?? 'assets/img/logo_aduanasoft.png';
|
|
$color1 = explode(',', $config['colores_primarios'] ?? '#0f172a,#334155')[0];
|
|
$color2 = explode(',', $config['colores_primarios'] ?? '#0f172a,#334155')[1];
|
|
?>
|
|
|
|
<!DOCTYPE html>
|
|
<html lang="es">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title><?= htmlspecialchars($siglas) ?> | Registro</title>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<meta name="description" content="Registro de importadores y agencias aduanales en la plataforma integral de gestión">
|
|
<!-- Bootstrap 5 -->
|
|
<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>
|
|
<!-- Google reCAPTCHA v2 -->
|
|
<script src="https://www.google.com/recaptcha/api.js" async defer></script>
|
|
<!-- Google Fonts -->
|
|
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap" rel="stylesheet">
|
|
<style>
|
|
:root {
|
|
--primary: <?= $color1 ?>;
|
|
--secondary: <?= $color2 ?>;
|
|
--accent: #10b981;
|
|
--surface: #ffffff;
|
|
--background: #f8fafc;
|
|
--text: #1e293b;
|
|
--text-muted: #64748b;
|
|
--border: #e2e8f0;
|
|
}
|
|
|
|
* {
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
body {
|
|
background: linear-gradient(135deg, var(--background) 0%, #e2e8f0 100%);
|
|
font-family: 'Poppins', sans-serif;
|
|
color: var(--text);
|
|
line-height: 1.6;
|
|
margin: 0;
|
|
min-height: 100vh;
|
|
}
|
|
|
|
.navbar {
|
|
background: rgba(255, 255, 255, 0.95);
|
|
backdrop-filter: blur(20px);
|
|
border-bottom: 1px solid var(--border);
|
|
padding: 1rem 0;
|
|
}
|
|
|
|
.navbar-brand {
|
|
font-weight: 600;
|
|
font-size: 1.25rem;
|
|
color: var(--primary) !important;
|
|
}
|
|
|
|
.nav-link {
|
|
color: var(--text-muted) !important;
|
|
font-weight: 500;
|
|
padding: 0.5rem 1rem !important;
|
|
border-radius: 8px;
|
|
transition: all 0.2s ease;
|
|
}
|
|
|
|
.nav-link:hover, .nav-link.active {
|
|
color: var(--primary) !important;
|
|
background-color: #f1f5f9;
|
|
}
|
|
|
|
.registration-container {
|
|
max-width: 1000px;
|
|
margin: 2rem auto;
|
|
padding: 0 1rem;
|
|
}
|
|
|
|
.card-form {
|
|
background: var(--surface);
|
|
border-radius: 20px;
|
|
box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08);
|
|
padding: 3rem;
|
|
border: 1px solid var(--border);
|
|
position: relative;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.card-form::before {
|
|
content: '';
|
|
position: absolute;
|
|
top: 0;
|
|
left: 0;
|
|
right: 0;
|
|
height: 4px;
|
|
background: linear-gradient(90deg, var(--accent), var(--primary));
|
|
}
|
|
|
|
.page-header {
|
|
text-align: center;
|
|
margin-bottom: 3rem;
|
|
}
|
|
|
|
.page-title {
|
|
font-size: 2.5rem;
|
|
font-weight: 700;
|
|
color: var(--text);
|
|
margin-bottom: 0.5rem;
|
|
}
|
|
|
|
.page-subtitle {
|
|
color: var(--text-muted);
|
|
font-size: 1.1rem;
|
|
}
|
|
|
|
.form-toggle {
|
|
display: flex;
|
|
justify-content: center;
|
|
margin-bottom: 3rem;
|
|
background: var(--background);
|
|
border-radius: 12px;
|
|
padding: 0.5rem;
|
|
gap: 0.5rem;
|
|
}
|
|
|
|
.toggle-btn {
|
|
flex: 1;
|
|
max-width: 200px;
|
|
padding: 1rem 1.5rem;
|
|
border: none;
|
|
border-radius: 8px;
|
|
font-weight: 600;
|
|
transition: all 0.3s ease;
|
|
background: transparent;
|
|
color: var(--text-muted);
|
|
cursor: pointer;
|
|
}
|
|
|
|
.toggle-btn.active {
|
|
background: var(--surface);
|
|
color: var(--primary);
|
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
|
}
|
|
|
|
.form-container {
|
|
display: none;
|
|
animation: fadeIn 0.3s ease-in-out;
|
|
}
|
|
|
|
.form-container.active {
|
|
display: block;
|
|
}
|
|
|
|
@keyframes fadeIn {
|
|
from { opacity: 0; transform: translateY(20px); }
|
|
to { opacity: 1; transform: translateY(0); }
|
|
}
|
|
|
|
.form-section-title {
|
|
font-size: 1.5rem;
|
|
font-weight: 600;
|
|
color: var(--text);
|
|
margin-bottom: 2rem;
|
|
text-align: center;
|
|
position: relative;
|
|
}
|
|
|
|
.form-section-title::after {
|
|
content: '';
|
|
position: absolute;
|
|
bottom: -8px;
|
|
left: 50%;
|
|
transform: translateX(-50%);
|
|
width: 50px;
|
|
height: 3px;
|
|
background: var(--accent);
|
|
border-radius: 2px;
|
|
}
|
|
|
|
.form-label {
|
|
font-weight: 500;
|
|
color: var(--text);
|
|
margin-bottom: 0.5rem;
|
|
}
|
|
|
|
.form-control, .form-select {
|
|
border: 2px solid var(--border);
|
|
border-radius: 12px;
|
|
padding: 0.75rem 1rem;
|
|
font-size: 0.95rem;
|
|
transition: all 0.2s ease;
|
|
background: var(--surface);
|
|
}
|
|
|
|
.form-control:focus, .form-select:focus {
|
|
border-color: var(--accent);
|
|
box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
|
|
background: var(--surface);
|
|
}
|
|
|
|
.section-divider {
|
|
border: none;
|
|
height: 2px;
|
|
background: linear-gradient(90deg, transparent, var(--border), transparent);
|
|
margin: 2.5rem 0;
|
|
}
|
|
|
|
.section-subtitle {
|
|
font-weight: 600;
|
|
color: var(--text);
|
|
font-size: 1.1rem;
|
|
margin-bottom: 1.5rem;
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 0.5rem;
|
|
}
|
|
|
|
.recaptcha {
|
|
margin: 2rem 0;
|
|
text-align: center;
|
|
}
|
|
|
|
.btn-modern {
|
|
padding: 12px 28px;
|
|
border-radius: 12px;
|
|
font-weight: 600;
|
|
text-decoration: none;
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: 8px;
|
|
transition: all 0.3s ease;
|
|
border: none;
|
|
cursor: pointer;
|
|
}
|
|
|
|
.btn-primary-modern {
|
|
background: linear-gradient(135deg, var(--accent), #059669);
|
|
color: white;
|
|
box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
|
|
}
|
|
|
|
.btn-primary-modern:hover {
|
|
transform: translateY(-2px);
|
|
box-shadow: 0 8px 25px rgba(16, 185, 129, 0.4);
|
|
color: white;
|
|
}
|
|
|
|
.info-alert {
|
|
background: linear-gradient(135deg, #fef3c7, #fde68a);
|
|
border: 1px solid #f59e0b;
|
|
border-radius: 12px;
|
|
padding: 1.5rem;
|
|
margin-top: 2rem;
|
|
color: #92400e;
|
|
}
|
|
|
|
.info-alert .alert-icon {
|
|
color: #f59e0b;
|
|
margin-right: 0.5rem;
|
|
}
|
|
|
|
footer {
|
|
background: var(--text);
|
|
color: #94a3b8;
|
|
padding: 2rem 0;
|
|
text-align: center;
|
|
margin-top: 3rem;
|
|
}
|
|
|
|
.footer-text {
|
|
font-size: 0.9rem;
|
|
line-height: 1.5;
|
|
}
|
|
|
|
@media (max-width: 768px) {
|
|
.card-form {
|
|
margin: 1rem;
|
|
padding: 2rem 1.5rem;
|
|
}
|
|
|
|
.page-title {
|
|
font-size: 2rem;
|
|
}
|
|
|
|
.form-toggle {
|
|
flex-direction: column;
|
|
gap: 0.5rem;
|
|
}
|
|
|
|
.toggle-btn {
|
|
max-width: none;
|
|
}
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
|
|
<!-- NAVBAR -->
|
|
<nav class="navbar navbar-expand-lg">
|
|
<div class="container">
|
|
<a class="navbar-brand" href="/IMPORTADORES/">
|
|
<i class="fas fa-shipping-fast me-2"></i><?= htmlspecialchars($siglas) ?>
|
|
</a>
|
|
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav">
|
|
<span class="navbar-toggler-icon"></span>
|
|
</button>
|
|
<div class="collapse navbar-collapse justify-content-end" id="navbarNav">
|
|
<ul class="navbar-nav">
|
|
<li class="nav-item">
|
|
<a class="nav-link" href="/IMPORTADORES/">Inicio</a>
|
|
</li>
|
|
<li class="nav-item">
|
|
<a class="nav-link active" aria-current="page" href="/IMPORTADORES/registro">Registro</a>
|
|
</li>
|
|
<li class="nav-item">
|
|
<a class="nav-link" href="/IMPORTADORES/login">Iniciar Sesión</a>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</nav>
|
|
|
|
<!-- CONTENEDOR PRINCIPAL -->
|
|
<div class="registration-container">
|
|
<div class="page-header">
|
|
<h1 class="page-title">Únete a Nuestra Plataforma</h1>
|
|
<p class="page-subtitle">Registra tu empresa o agencia aduanal para comenzar a gestionar importaciones</p>
|
|
</div>
|
|
|
|
<div class="card-form">
|
|
<!-- SELECTOR DE TIPO DE REGISTRO -->
|
|
<div class="form-toggle">
|
|
<button type="button" class="toggle-btn active" id="btnImportador" onclick="mostrarFormulario('importador')">
|
|
<i class="fas fa-building me-2"></i>Importador
|
|
</button>
|
|
<button type="button" class="toggle-btn" id="btnAgencia" onclick="mostrarFormulario('agencia')">
|
|
<i class="fas fa-handshake me-2"></i>Agencia Aduanal
|
|
</button>
|
|
</div>
|
|
|
|
<!-- FORMULARIO DE IMPORTADOR -->
|
|
<div id="formImportadorContainer" class="form-container active">
|
|
<h3 class="form-section-title">Registro de Importador</h3>
|
|
<form action="/IMPORTADORES/registro/enviarSoliImportador" method="POST" enctype="multipart/form-data" id="formRegistro">
|
|
<div class="row g-4">
|
|
<div class="col-md-6">
|
|
<label for="company_name" class="form-label">
|
|
<i class="fas fa-building text-muted me-2"></i>Nombre de la empresa *
|
|
</label>
|
|
<input type="text" class="form-control" name="company_name" id="company_name" placeholder="Ingresa el nombre de tu empresa" required>
|
|
</div>
|
|
|
|
<div class="col-md-6">
|
|
<label for="rfc" class="form-label">
|
|
<i class="fas fa-id-card text-muted me-2"></i>RFC *
|
|
</label>
|
|
<input type="text" class="form-control" name="rfc" maxlength="13" id="rfc" placeholder="RFC de la empresa" required>
|
|
</div>
|
|
|
|
<div class="col-md-6">
|
|
<label for="email" class="form-label">
|
|
<i class="fas fa-envelope text-muted me-2"></i>Correo electrónico *
|
|
</label>
|
|
<input type="email" class="form-control" name="email" id="email" placeholder="correo@empresa.com" required>
|
|
</div>
|
|
|
|
<div class="col-md-6">
|
|
<label for="phone" class="form-label">
|
|
<i class="fas fa-phone text-muted me-2"></i>Teléfono *
|
|
</label>
|
|
<input type="text" class="form-control" name="phone" id="phone" placeholder="123 4567890" required>
|
|
</div>
|
|
|
|
<div class="col-12">
|
|
<label for="opinion_file_importador" class="form-label">
|
|
<i class="fas fa-file-pdf text-muted me-2"></i>Padrón de Importadores o Encargo Conferido (PDF) *
|
|
</label>
|
|
<input type="file" class="form-control" name="opinion_file" id="opinion_file_importador" accept=".pdf" required>
|
|
<div class="form-text">Sube tu documento oficial que acredite tu actividad como importador.</div>
|
|
</div>
|
|
|
|
<div class="col-12 recaptcha">
|
|
<div class="g-recaptcha" id="recaptcha-importador" data-sitekey="6LfkMB8rAAAAAH-BEC1cMYij1HEhw4sTaEOl-UCA"></div>
|
|
</div>
|
|
|
|
<div class="col-12 text-center">
|
|
<button type="submit" class="btn-modern btn-primary-modern">
|
|
<i class="fas fa-paper-plane me-2"></i>
|
|
Enviar Solicitud
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
|
|
<!-- FORMULARIO DE AGENCIA ADUANAL -->
|
|
<div id="formAgenciaContainer" class="form-container">
|
|
<h3 class="form-section-title">Registro de Agencia Aduanal</h3>
|
|
<form action="/IMPORTADORES/registro/enviarSoliAgencia" method="POST" enctype="multipart/form-data" id="formRegistroAgencia">
|
|
<div class="row g-4">
|
|
<!-- Información de la Agencia -->
|
|
<div class="col-12">
|
|
<div class="section-subtitle">
|
|
<i class="fas fa-handshake text-primary"></i>
|
|
Información de la Agencia
|
|
</div>
|
|
</div>
|
|
|
|
<div class="col-md-6">
|
|
<label for="nombre_agencia" class="form-label">
|
|
<i class="fas fa-building text-muted me-2"></i>Nombre de la agencia *
|
|
</label>
|
|
<input type="text" class="form-control" name="nombre_agencia" id="nombre_agencia" placeholder="Nombre de la agencia aduanal" required>
|
|
</div>
|
|
|
|
<div class="col-md-6">
|
|
<label for="rfc_agencia" class="form-label">
|
|
<i class="fas fa-id-card text-muted me-2"></i>RFC *
|
|
</label>
|
|
<input type="text" class="form-control" name="rfc_agencia" maxlength="13" id="rfc_agencia" placeholder="RFC de la agencia" required>
|
|
</div>
|
|
|
|
<div class="col-md-6">
|
|
<label for="correo" class="form-label">
|
|
<i class="fas fa-envelope text-muted me-2"></i>Correo electrónico *
|
|
</label>
|
|
<input type="email" class="form-control" name="correo" id="correo" placeholder="contacto@agencia.com" required>
|
|
</div>
|
|
|
|
<div class="col-md-6">
|
|
<label for="telefono" class="form-label">
|
|
<i class="fas fa-phone text-muted me-2"></i>Teléfono *
|
|
</label>
|
|
<input type="text" class="form-control" name="telefono" maxlength="11" id="telefono" placeholder="123 4567890" required>
|
|
</div>
|
|
|
|
<div class="col-12">
|
|
<label for="direccion" class="form-label">
|
|
<i class="fas fa-map-marker-alt text-muted me-2"></i>Dirección completa *
|
|
</label>
|
|
<input type="text" class="form-control" name="direccion" id="direccion"
|
|
placeholder="Calle, num.externo, num.interno, colonia, municipio, código postal, estado" required>
|
|
</div>
|
|
|
|
<div class="col-12">
|
|
<label for="opinion_file_agencia" class="form-label">
|
|
<i class="fas fa-file-pdf text-muted me-2"></i>Padrón de Importadores o Encargo Conferido (PDF) *
|
|
</label>
|
|
<input type="file" class="form-control" name="opinion_file" id="opinion_file_agencia" accept=".pdf" required>
|
|
</div>
|
|
|
|
<hr class="section-divider">
|
|
|
|
<!-- Información del Administrador -->
|
|
<div class="col-12">
|
|
<div class="section-subtitle">
|
|
<i class="fas fa-user-tie text-primary"></i>
|
|
Administrador de la Agencia
|
|
</div>
|
|
</div>
|
|
|
|
<div class="col-md-6">
|
|
<label for="nombre_admin" class="form-label">
|
|
<i class="fas fa-user text-muted me-2"></i>Nombre completo *
|
|
</label>
|
|
<input type="text" class="form-control" name="nombre_admin" id="nombre_admin" placeholder="Nombre del administrador" required>
|
|
</div>
|
|
|
|
<div class="col-md-6">
|
|
<label for="correo_admin" class="form-label">
|
|
<i class="fas fa-envelope text-muted me-2"></i>Correo del administrador *
|
|
</label>
|
|
<input type="email" class="form-control" name="correo_admin" id="correo_admin" placeholder="admin@agencia.com" required>
|
|
</div>
|
|
|
|
<div class="col-12 recaptcha">
|
|
<div class="g-recaptcha" id="recaptcha-agencia" data-sitekey="6LfkMB8rAAAAAH-BEC1cMYij1HEhw4sTaEOl-UCA"></div>
|
|
</div>
|
|
|
|
<div class="col-12 text-center">
|
|
<button type="submit" class="btn-modern btn-primary-modern">
|
|
<i class="fas fa-paper-plane me-2"></i>
|
|
Enviar Solicitud
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- INFORMACIÓN ADICIONAL -->
|
|
<div class="info-alert">
|
|
<div class="d-flex align-items-start">
|
|
<i class="fas fa-info-circle alert-icon"></i>
|
|
<div>
|
|
<strong>Proceso de Aprobación</strong><br>
|
|
Una vez enviada tu solicitud, será revisada manualmente por nuestro equipo.
|
|
Recibirás una notificación por correo electrónico cuando tu registro sea aprobado,
|
|
junto con las instrucciones para activar tu cuenta e iniciar sesión en la plataforma.
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- FOOTER -->
|
|
<footer>
|
|
<div class="container text-center">
|
|
<div class="footer-text">
|
|
© <?= date('Y') ?> <?= htmlspecialchars($siglas) ?> - <?= htmlspecialchars($nombre) ?><br>
|
|
Optimizando el comercio internacional
|
|
</div>
|
|
</div>
|
|
</footer>
|
|
|
|
<!-- SCRIPTS -->
|
|
<script>
|
|
let formularioActual = 'importador';
|
|
|
|
function mostrarFormulario(tipo) {
|
|
const formImportador = document.getElementById('formImportadorContainer');
|
|
const formAgencia = document.getElementById('formAgenciaContainer');
|
|
const btnImportador = document.getElementById('btnImportador');
|
|
const btnAgencia = document.getElementById('btnAgencia');
|
|
|
|
// Resetear clases
|
|
formImportador.classList.remove('active');
|
|
formAgencia.classList.remove('active');
|
|
btnImportador.classList.remove('active');
|
|
btnAgencia.classList.remove('active');
|
|
|
|
if (tipo === 'importador') {
|
|
formImportador.classList.add('active');
|
|
btnImportador.classList.add('active');
|
|
formularioActual = 'importador';
|
|
} else {
|
|
formAgencia.classList.add('active');
|
|
btnAgencia.classList.add('active');
|
|
formularioActual = 'agencia';
|
|
}
|
|
|
|
// Resetear reCAPTCHA
|
|
if (typeof grecaptcha !== 'undefined') {
|
|
try{
|
|
grecaptcha.reset(0);
|
|
grecaptcha.reset(1);
|
|
} catch (e) {
|
|
console.log('Error resetting reCAPTCHA:', e);
|
|
}
|
|
}
|
|
}
|
|
|
|
function getActiveRecaptchaResponse() {
|
|
if (typeof grecaptcha !== 'undefined') {
|
|
try {
|
|
if (formularioActual === 'importador') {
|
|
return grecaptcha.getResponse(0) || grecaptcha.getResponse();
|
|
} else {
|
|
return grecaptcha.getResponse(1) || grecaptcha.getResponse();
|
|
}
|
|
} catch (e) {
|
|
console.log('Error getting reCAPTCHA response:', e);
|
|
return '';
|
|
}
|
|
}
|
|
return '';
|
|
}
|
|
|
|
// Validación para formulario de importador
|
|
document.getElementById('formRegistro').addEventListener('submit', function(e) {
|
|
e.preventDefault();
|
|
|
|
const nombre = document.getElementById('company_name').value.trim();
|
|
const rfc = document.getElementById('rfc').value.trim().toUpperCase();
|
|
const email = document.getElementById('email').value.trim();
|
|
const phone = document.getElementById('phone').value.trim();
|
|
const archivo = document.getElementById('opinion_file_importador').files[0];
|
|
const recaptcha = getActiveRecaptchaResponse();
|
|
|
|
// Expresiones regulares
|
|
const emailRegex = /^[a-zA-Z0-9._+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
|
|
const rfcRegex = /^[A-ZÑ&]{3,4}\d{6}[A-Z0-9]{3}$/;
|
|
const phoneRegex = /^\d{3}\s\d{7}$/;
|
|
|
|
// Validaciones
|
|
if (!nombre) {
|
|
Swal.fire({
|
|
icon: 'warning',
|
|
title: 'Campo requerido',
|
|
text: 'El nombre de la empresa es obligatorio.',
|
|
confirmButtonColor: '#10b981'
|
|
});
|
|
document.getElementById('company_name').focus();
|
|
return;
|
|
}
|
|
|
|
if (!email || !emailRegex.test(email)) {
|
|
Swal.fire({
|
|
icon: 'error',
|
|
title: 'Correo inválido',
|
|
text: 'Ingresa una dirección de correo válida.',
|
|
confirmButtonColor: '#10b981'
|
|
});
|
|
document.getElementById('email').focus();
|
|
return;
|
|
}
|
|
|
|
if (!rfc || !rfcRegex.test(rfc)) {
|
|
Swal.fire({
|
|
icon: 'error',
|
|
title: 'RFC inválido',
|
|
text: 'El RFC debe tener el formato correcto (ej. ABC123456XYZ).',
|
|
confirmButtonColor: '#10b981'
|
|
});
|
|
document.getElementById('rfc').focus();
|
|
return;
|
|
}
|
|
|
|
if (!phone || !phoneRegex.test(phone)) {
|
|
Swal.fire({
|
|
icon: 'error',
|
|
title: 'Teléfono inválido',
|
|
text: 'Formato: 3 dígitos (LADA), espacio, y 7 dígitos. Ejemplo: 123 4567890',
|
|
confirmButtonColor: '#10b981'
|
|
});
|
|
document.getElementById('phone').focus();
|
|
return;
|
|
}
|
|
|
|
if (!archivo || archivo.type !== 'application/pdf') {
|
|
Swal.fire({
|
|
icon: 'error',
|
|
title: 'Archivo requerido',
|
|
text: 'Sube el padrón de importadores en formato PDF.',
|
|
confirmButtonColor: '#10b981'
|
|
});
|
|
return;
|
|
}
|
|
|
|
if (!recaptcha || recaptcha.length === 0) {
|
|
Swal.fire({
|
|
icon: 'warning',
|
|
title: 'Verificación requerida',
|
|
text: 'Por favor completa la verificación reCAPTCHA.',
|
|
confirmButtonColor: '#10b981'
|
|
});
|
|
return;
|
|
}
|
|
|
|
this.submit();
|
|
});
|
|
|
|
// Validación para formulario de agencia
|
|
document.getElementById('formRegistroAgencia').addEventListener('submit', function(e) {
|
|
e.preventDefault();
|
|
|
|
const nombre = document.getElementById('nombre_agencia').value.trim();
|
|
const rfc_agencia = document.getElementById('rfc_agencia').value.trim().toUpperCase();
|
|
const correo = document.getElementById('correo').value.trim();
|
|
const telefono = document.getElementById('telefono').value.trim();
|
|
const direccion = document.getElementById('direccion').value.trim();
|
|
const archivo = document.getElementById('opinion_file_agencia').files[0];
|
|
const nombre_admin = document.getElementById('nombre_admin').value.trim();
|
|
const correo_admin = document.getElementById('correo_admin').value.trim();
|
|
const recaptcha = getActiveRecaptchaResponse();
|
|
|
|
const correoRegex = /^[a-zA-Z0-9._+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
|
|
const rfcRegex = /^[A-ZÑ&]{3,4}\d{6}[A-Z0-9]{3}$/;
|
|
const telefonoRegex = /^\d{3}\s\d{7}$/;
|
|
|
|
// Validaciones básicas
|
|
if (!nombre || !correo || !rfc_agencia || !telefono || !direccion || !nombre_admin || !correo_admin) {
|
|
Swal.fire({
|
|
icon: 'warning',
|
|
title: 'Campos incompletos',
|
|
text: 'Todos los campos son obligatorios.',
|
|
confirmButtonColor: '#10b981'
|
|
});
|
|
return;
|
|
}
|
|
|
|
if (!correoRegex.test(correo) || !correoRegex.test(correo_admin)) {
|
|
Swal.fire({
|
|
icon: 'error',
|
|
title: 'Correos inválidos',
|
|
text: 'Verifica que los correos tengan formato válido.',
|
|
confirmButtonColor: '#10b981'
|
|
});
|
|
return;
|
|
}
|
|
|
|
if (!rfcRegex.test(rfc_agencia)) {
|
|
Swal.fire({
|
|
icon: 'error',
|
|
title: 'RFC inválido',
|
|
text: 'El RFC debe tener el formato correcto.',
|
|
confirmButtonColor: '#10b981'
|
|
});
|
|
return;
|
|
}
|
|
|
|
if (!telefonoRegex.test(telefono)) {
|
|
Swal.fire({
|
|
icon: 'error',
|
|
title: 'Teléfono inválido',
|
|
text: 'Formato: 3 dígitos (LADA), espacio, y 7 dígitos.',
|
|
confirmButtonColor: '#10b981'
|
|
});
|
|
return;
|
|
}
|
|
|
|
if (!archivo || archivo.type !== 'application/pdf') {
|
|
Swal.fire({
|
|
icon: 'error',
|
|
title: 'Archivo requerido',
|
|
text: 'Sube el documento en formato PDF.',
|
|
confirmButtonColor: '#10b981'
|
|
});
|
|
return;
|
|
}
|
|
|
|
if (!recaptcha || recaptcha.length === 0) {
|
|
Swal.fire({
|
|
icon: 'warning',
|
|
title: 'Verificación requerida',
|
|
text: 'Por favor completa la verificación reCAPTCHA.',
|
|
confirmButtonColor: '#10b981'
|
|
});
|
|
return;
|
|
}
|
|
|
|
this.submit();
|
|
});
|
|
</script>
|
|
|
|
</body>
|
|
</html>
|