<!DOCTYPE html>
<html lang=»es»>
<head>
<meta charset=»UTF-8″>
<meta name=»viewport» content=»width=device-width, initial-scale=1.0″>
<title>Portal de Distribuidores Grupo Vadillo</title>
<!– Incluye Tailwind CSS para estilos –>
<script src=»https://cdn.tailwindcss.com»></script>
<!– Configuración de color y fuente personalizada con Tailwind –>
<script>
// Define la paleta de colores corporativa solicitada
tailwind.config = {
theme: {
extend: {
colors: {
‘vadillo-blue’: ‘#1a2b47’, // Azul Marino
‘vadillo-orange’: ‘#ff5a00’, // Naranja
‘vadillo-yellow’: ‘#ffc107’, // Amarillo
‘vadillo-green’: ‘#28a745’, // Verde
‘vadillo-gray’: ‘#f8f9fa’, // Gris Claro (para fondos limpios)
},
fontFamily: {
sans: [‘Inter’, ‘sans-serif’],
},
}
}
}
</script>
<style>
/* Estilos base y transiciones */
body {
font-family: ‘Inter’, sans-serif;
background-color: #f8f9fa;
}
.sidebar {
/* Fija la barra lateral y asegura el 100% de la altura de la ventana */
height: 100vh;
position: sticky;
top: 0;
overflow-y: auto;
}
.main-content {
min-height: 100vh; /* Asegura que el contenido principal ocupe toda la altura */
}
</style>
</head>
<body class=»bg-vadillo-gray»>
<!– Contenedor principal de la aplicación –>
<div id=»app» class=»flex flex-col min-h-screen»>
<!– 1. PÁGINA DE LOGIN (Inicialmente visible) –>
<div id=»login-page» class=»flex items-center justify-center flex-grow bg-vadillo-blue»>
<div class=»bg-white p-8 rounded-xl shadow-2xl w-full max-w-sm m-4″>
<div class=»text-center mb-6″>
<!– Logo Placeholder (GV en el color naranja corporativo) –>
<div class=»w-16 h-16 mx-auto mb-3 bg-vadillo-orange rounded-full flex items-center justify-center text-3xl font-bold text-white shadow-lg border-4 border-vadillo-yellow/50″>GV</div>
<h1 class=»text-3xl font-bold text-vadillo-blue mt-2″>Grupo Vadillo</h1>
<p class=»text-lg text-vadillo-orange»>Portal de Distribuidores</p>
</div>
<div class=»space-y-4″>
<input type=»text» id=»username-input» class=»w-full p-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-vadillo-orange focus:border-vadillo-orange» placeholder=»Usuario (Ej: A1 o Multiseñal)»>
<input type=»password» id=»password-input» class=»w-full p-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-vadillo-orange focus:border-vadillo-orange» placeholder=»Contraseña (Ignorar en demo)»>
<button id=»login-button» class=»w-full bg-vadillo-orange hover:bg-orange-600 text-white font-semibold p-3 rounded-lg transition duration-200 shadow-lg transform hover:scale-[1.01]»>
Iniciar Sesión
</button>
<div id=»login-message» class=»text-center text-sm text-red-500 hidden»></div>
</div>
<div class=»mt-6 text-center text-sm text-gray-500″>
<p>Acceso Restringido. Use ‘A1’ o ‘Multiseñal’ como usuario de prueba.</p>
</div>
</div>
</div>
<!– 2. DASHBOARD (Oculto hasta el login) –>
<div id=»dashboard-page» class=»hidden flex h-screen overflow-hidden»>
<!– Barra de Navegación Lateral (Sidebar: Azul Marino) –>
<aside id=»sidebar» class=»sidebar bg-vadillo-blue text-white w-64 flex-shrink-0 z-20 shadow-xl»>
<div class=»p-6 border-b border-vadillo-orange/50″>
<h2 class=»text-xl font-bold»>Distribuidor: <span id=»distributor-role» class=»text-vadillo-orange»></span></h2>
</div>
<nav class=»p-4 space-y-2″>
<!– Elementos de navegación –>
<a href=»#» class=»nav-item flex items-center p-3 rounded-lg hover:bg-vadillo-orange/30 transition duration-150″ data-section=»inicio»>
<svg class=»w-5 h-5 mr-3″ fill=»none» stroke=»currentColor» viewBox=»0 0 24 24″ xmlns=»http://www.w3.org/2000/svg»><path stroke-linecap=»round» stroke-linejoin=»round» stroke-width=»2″ d=»M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0h6m-6 0h.01″></path></svg>
Inicio
</a>
<a href=»#» class=»nav-item flex items-center p-3 rounded-lg hover:bg-vadillo-orange/30 transition duration-150″ data-section=»precios»>
<svg class=»w-5 h-5 mr-3″ fill=»none» stroke=»currentColor» viewBox=»0 0 24 24″ xmlns=»http://www.w3.org/2000/svg»><path stroke-linecap=»round» stroke-linejoin=»round» stroke-width=»2″ d=»M12 8c-1.657 0-3 .895-3 2s1.343 2 3 2 3 .895 3 2-1.343 2-3 2m0-8V9a1 1 0 100 2v1m0 4v1a1 1 0 100 2v1″></path></svg>
Listas de Precios
</a>
<a href=»#» class=»nav-item flex items-center p-3 rounded-lg hover:bg-vadillo-orange/30 transition duration-150″ data-section=»marketing»>
<svg class=»w-5 h-5 mr-3″ fill=»none» stroke=»currentColor» viewBox=»0 0 24 24″ xmlns=»http://www.w3.org/2000/svg»><path stroke-linecap=»round» stroke-linejoin=»round» stroke-width=»2″ d=»M16 8v8m-4-8v8m-4-8v8m-2 4h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z»></path></svg>
Recursos de Marketing
</a>
<a href=»#» class=»nav-item flex items-center p-3 rounded-lg hover:bg-vadillo-orange/30 transition duration-150″ data-section=»existencias»>
<svg class=»w-5 h-5 mr-3″ fill=»none» stroke=»currentColor» viewBox=»0 0 24 24″ xmlns=»http://www.w3.org/2000/svg»><path stroke-linecap=»round» stroke-linejoin=»round» stroke-width=»2″ d=»M5 8h14M5 8a2 2 0 110-4h14a2 2 0 110 4M5 8v10a2 2 0 002 2h10a2 2 0 002-2V8m-9 4h4″></path></svg>
Existencias
</a>
<button id=»logout-button» class=»w-full flex items-center p-3 rounded-lg bg-red-600 hover:bg-red-700 text-white mt-8 transition duration-150″>
<svg class=»w-5 h-5 mr-3″ fill=»none» stroke=»currentColor» viewBox=»0 0 24 24″ xmlns=»http://www.w3.org/2000/svg»><path stroke-linecap=»round» stroke-linejoin=»round» stroke-width=»2″ d=»M17 16l4-4m0 0l-4-4m4 4H7m6 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3v-4a3 3 0 013-3h4a3 3 0 013 3v1″></path></svg>
Cerrar Sesión
</button>
</nav>
</aside>
<!– Área de Contenido Principal –>
<main id=»main-content» class=»main-content flex-grow p-6 overflow-y-auto»>
<!– Header Superior –>
<header class=»bg-white p-4 rounded-xl shadow-lg mb-6 flex justify-between items-center sticky top-0 z-10″>
<h1 class=»text-2xl font-semibold text-gray-700″>Bienvenido a su Portal, <span id=»user-name» class=»text-vadillo-orange font-bold»>Distribuidor</span></h1>
<span id=»current-time» class=»text-gray-500 text-sm hidden md:block»></span>
</header>
<!– Contenedor Dinámico de Secciones –>
<div id=»content-area» class=»space-y-8″>
<!– SECCIÓN INICIO (Dashboard con KPIs y Personalización) –>
<section id=»inicio» class=»content-section bg-white p-6 rounded-xl shadow-lg active-section»>
<h2 class=»text-xl font-bold text-vadillo-blue border-b pb-2 mb-4″>Dashboard Principal</h2>
<!– Indicadores Clave de Desempeño (KPIs) –>
<div class=»grid grid-cols-1 md:grid-cols-3 gap-6 mb-6″>
<div class=»bg-vadillo-blue text-white p-5 rounded-lg shadow-xl»>
<p class=»text-sm opacity-80″>Ventas del Mes (Proyección)</p>
<p class=»text-3xl font-bold mt-1″>$<span id=»kpi-sales»>150,000</span> MXN</p>
</div>
<div class=»bg-vadillo-orange text-white p-5 rounded-lg shadow-xl»>
<p class=»text-sm opacity-80″>Nivel de Inventario</p>
<p class=»text-3xl font-bold mt-1″><span id=»kpi-inventory»>Alto</span></p>
</div>
<div class=»bg-vadillo-green text-white p-5 rounded-lg shadow-xl»>
<p class=»text-sm opacity-80″>Clasificación / Nivel</p>
<p class=»text-3xl font-bold mt-1″ id=»kpi-role»>A1</p>
</div>
</div>
<!– Notificaciones y Avisos (Personalizado por Rol) –>
<div class=»bg-vadillo-yellow/20 border-l-4 border-vadillo-yellow p-4 rounded-lg mb-6″>
<h3 class=»font-bold text-vadillo-blue»>Aviso Importante</h3>
<p class=»text-gray-700″ id=»notification-message»>El nuevo catálogo de verano ya está disponible en la sección de Recursos de Marketing.</p>
</div>
<!– Sección de Acceso Rápido –>
<h3 class=»text-lg font-semibold text-gray-600 mb-3 border-t pt-4″>Accesos Rápidos</h3>
<div class=»grid grid-cols-2 lg:grid-cols-4 gap-4″>
<button onclick=»changeSection(‘precios’)» class=»p-4 bg-gray-100 hover:bg-gray-200 rounded-lg text-center shadow-md transition duration-150 border-b-2 border-vadillo-orange»>Ver Listas de Precios</button>
<button onclick=»changeSection(‘existencias’)» class=»p-4 bg-gray-100 hover:bg-gray-200 rounded-lg text-center shadow-md transition duration-150 border-b-2 border-vadillo-orange»>Consultar Existencias</button>
<button onclick=»changeSection(‘marketing’)» class=»p-4 bg-gray-100 hover:bg-gray-200 rounded-lg text-center shadow-md transition duration-150 border-b-2 border-vadillo-orange»>Buscar Recursos</button>
</div>
</section>
<!– SECCIÓN LISTAS DE PRECIOS (Listado de PDFs Diferenciado) –>
<section id=»precios» class=»content-section bg-white p-6 rounded-xl shadow-lg hidden»>
<h2 class=»text-xl font-bold text-vadillo-blue border-b pb-2 mb-4″>Listas de Precios (Archivos PDF)</h2>
<div id=»price-content»>
<!– Este contenido será inyectado por JS según el rol con enlaces a PDFs –>
<div class=»bg-vadillo-gray p-4 rounded-lg»>
<p class=»text-gray-600 font-semibold»>Cargando lista de precios…</p>
</div>
</div>
</section>
<!– SECCIÓN RECURSOS DE MARKETING (Buscador por Código) –>
<section id=»marketing» class=»content-section bg-white p-6 rounded-xl shadow-lg hidden»>
<h2 class=»text-xl font-bold text-vadillo-blue border-b pb-2 mb-4″>Recursos de Marketing (Ficha, Videos, Trípticos)</h2>
<!– Buscador –>
<div class=»mb-6 p-4 bg-vadillo-gray rounded-lg shadow-inner»>
<h3 class=»text-lg font-semibold text-vadillo-blue mb-3″>Buscador de Recursos por Código de Producto</h3>
<div class=»flex flex-col sm:flex-row space-y-2 sm:space-y-0 sm:space-x-2″>
<input type=»text» id=»marketing-product-code» class=»flex-grow p-3 border border-gray-300 rounded-lg focus:ring-vadillo-orange focus:border-vadillo-orange» placeholder=»Ingrese Código de Producto (Ej: GV-101)»>
<button id=»search-marketing-button» class=»bg-vadillo-orange hover:bg-orange-600 text-white font-semibold p-3 rounded-lg transition duration-200 shadow-md»>
Buscar
</button>
</div>
</div>
<!– Área de Resultados –>
<div id=»marketing-results» class=»space-y-4″>
<div class=»text-gray-500 text-center p-8 border border-dashed rounded-lg»>
Busque un código (Ej: GV-101 o GV-205) para ver la ficha técnica, videos y trípticos disponibles.
</div>
</div>
<!– Contenido Adicional Solo para ‘A1’ (Ejemplo de personalización) –>
<div id=»marketing-a1-content» class=»p-4 bg-vadillo-green/10 border border-vadillo-green rounded-lg mt-6 hidden»>
<h3 class=»font-bold text-vadillo-green»>Recursos Exclusivos Nivel A1</h3>
<p class=»text-sm text-gray-700″>Guía de Marketing Digital Avanzada y acceso a webinars trimestrales.</p>
</div>
</section>
<!– SECCIÓN EXISTENCIAS (Buscador por Código) –>
<section id=»existencias» class=»content-section bg-white p-6 rounded-xl shadow-lg hidden»>
<h2 class=»text-xl font-bold text-vadillo-blue border-b pb-2 mb-4″>Consulta de Existencias en Almacén</h2>
<!– Buscador –>
<div class=»mb-6 p-4 bg-vadillo-gray rounded-lg shadow-inner»>
<h3 class=»text-lg font-semibold text-vadillo-blue mb-3″>Buscador de Existencias por Código de Producto</h3>
<div class=»flex flex-col sm:flex-row space-y-2 sm:space-y-0 sm:space-x-2″>
<input type=»text» id=»stock-product-code» class=»flex-grow p-3 border border-gray-300 rounded-lg focus:ring-vadillo-orange focus:border-vadillo-orange» placeholder=»Ingrese Código de Producto (Ej: GV-101)»>
<button id=»search-stock-button» class=»bg-vadillo-orange hover:bg-orange-600 text-white font-semibold p-3 rounded-lg transition duration-200 shadow-md»>
Consultar
</button>
</div>
</div>
<!– Área de Resultados –>
<div id=»stock-results» class=»space-y-4″>
<div class=»text-gray-500 text-center p-8 border border-dashed rounded-lg»>
Ingrese un código de producto (Ej: GV-101, GV-205, GV-310) para ver la existencia actual.
</div>
</div>
</section>
</div>
</main>
</div>
</div>
<script>
// — LÓGICA DE LA APLICACIÓN Y AUTENTICACIÓN SIMULADA —
const loginPage = document.getElementById(‘login-page’);
const dashboardPage = document.getElementById(‘dashboard-page’);
const loginButton = document.getElementById(‘login-button’);
const logoutButton = document.getElementById(‘logout-button’);
const usernameInput = document.getElementById(‘username-input’);
const loginMessage = document.getElementById(‘login-message’);
const distributorRoleDisplay = document.getElementById(‘distributor-role’);
const kpiRole = document.getElementById(‘kpi-role’);
const userNameDisplay = document.getElementById(‘user-name’);
const notificationMessage = document.getElementById(‘notification-message’);
const marketingA1Content = document.getElementById(‘marketing-a1-content’);
const priceContentArea = document.getElementById(‘price-content’);
const navItems = document.querySelectorAll(‘.nav-item’);
const contentSections = document.querySelectorAll(‘.content-section’);
let currentRole = null;
// Función para simular el inicio de sesión
loginButton.addEventListener(‘click’, () => {
const username = usernameInput.value.trim().toUpperCase(); // Convertir a mayúsculas para manejo de roles
// const password = document.getElementById(‘password-input’).value.trim(); // Contraseña ignorada en esta simulación
loginMessage.classList.add(‘hidden’); // Ocultar mensajes previos
// Lógica de autenticación simulada con roles
if (username === ‘A1’ || username === ‘MULTISEÑAL’) {
currentRole = username;
document.getElementById(‘password-input’).value = »;
showDashboard(currentRole);
} else {
// Simulación de error
loginMessage.textContent = ‘Usuario o contraseña incorrectos. Intente de nuevo.’;
loginMessage.classList.remove(‘hidden’);
}
});
// Función para cerrar sesión
logoutButton.addEventListener(‘click’, () => {
currentRole = null;
loginPage.classList.remove(‘hidden’);
dashboardPage.classList.add(‘hidden’);
usernameInput.value = »; // Limpiar campo de usuario al cerrar sesión
loginMessage.classList.add(‘hidden’);
});
// Función para mostrar el dashboard y personalizar el contenido
function showDashboard(role) {
loginPage.classList.add(‘hidden’);
dashboardPage.classList.remove(‘hidden’);
// 1. Actualizar roles visibles en el Dashboard
distributorRoleDisplay.textContent = role;
kpiRole.textContent = role;
userNameDisplay.textContent = ‘Distribuidor ‘ + role;
// 2. Personalizar contenido específico por rol
customizeContent(role);
// 3. Mostrar la sección de inicio por defecto
changeSection(‘inicio’);
}
// Función para personalizar listas de precios y notificaciones
function customizeContent(role) {
let priceHtml = »;
const isA1 = role === ‘A1’;
// Lista de PDFs general (visibles para todos)
const generalPdfs = [
{ name: ‘Catálogo General de Productos (Oct 2025)’, link: ‘#’ },
{ name: ‘Tarifas Estándar Vigentes’, link: ‘#’ },
];
// Lista de PDFs exclusivos para A1
const a1ExclusivePdfs = [
{ name: ‘Lista de Precios Mayoristas A1 Exclusiva’, link: ‘#’ },
{ name: ‘Condiciones de Crédito Preferencial A1’, link: ‘#’ },
];
priceHtml += ‘<div class=»space-y-4″>’;
// Mostrar PDFs generales
priceHtml += ‘<h3 class=»text-lg font-semibold text-gray-700 mb-2″>Documentos Generales</h3>’;
generalPdfs.forEach(pdf => {
priceHtml += `<div class=»flex items-center justify-between p-3 border-b hover:bg-vadillo-gray rounded-lg transition duration-150″>
<p class=»font-semibold text-vadillo-blue»>${pdf.name}</p>
<a href=»${pdf.link}» target=»_blank» class=»text-vadillo-orange hover:text-orange-600 font-semibold flex items-center»>
<svg class=»w-5 h-5 mr-1″ fill=»none» stroke=»currentColor» viewBox=»0 0 24 24″ xmlns=»http://www.w3.org/2000/svg»><path stroke-linecap=»round» stroke-linejoin=»round» stroke-width=»2″ d=»M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4″></path></svg>
Ver/Descargar PDF
</a>
</div>`;
});
// Mostrar PDFs exclusivos si es A1 (Diferenciación de contenido)
if (isA1) {
priceHtml += ‘<h3 class=»text-lg font-semibold text-vadillo-green mt-6 mb-2 border-t pt-4″>Documentos Exclusivos Nivel A1</h3>’;
a1ExclusivePdfs.forEach(pdf => {
priceHtml += `<div class=»flex items-center justify-between p-3 bg-vadillo-green/10 border-b border-vadillo-green rounded-lg transition duration-150″>
<p class=»font-bold text-vadillo-green»>${pdf.name}</p>
<a href=»${pdf.link}» target=»_blank» class=»text-vadillo-green hover:text-green-700 font-semibold flex items-center»>
<svg class=»w-5 h-5 mr-1″ fill=»none» stroke=»currentColor» viewBox=»0 0 24 24″ xmlns=»http://www.w3.org/2000/svg»><path stroke-linecap=»round» stroke-linejoin=»round» stroke-width=»2″ d=»M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4″></path></svg>
Ver/Descargar PDF
</a>
</div>`;
});
marketingA1Content.classList.remove(‘hidden’);
notificationMessage.textContent = ‘¡Bienvenido! Su nivel A1 le otorga acceso prioritario a todas las novedades y descuentos máximos.’;
} else {
// Si es Multiseñal o cualquier otro (no A1)
marketingA1Content.classList.add(‘hidden’);
notificationMessage.textContent = ‘Recuerde revisar periódicamente las existencias para planificar sus pedidos. ¡Tenemos nuevas guías de venta!’;
}
priceHtml += ‘</div>’;
priceContentArea.innerHTML = priceHtml;
}
// — LÓGICA DE BUSCADORES (Simulación de Datos) —
// Data simulada para Recursos de Marketing
const marketingData = {
‘GV-101’: {
name: ‘Señal V-16 Conectada’,
ficha: { name: ‘Ficha Técnica V-16 (PDF)’, link: ‘#’ },
videos: [
{ name: ‘Video 1: Funcionamiento y Conectividad’, link: ‘#’ },
{ name: ‘Video 2: Instalación Rápida’, link: ‘#’ },
],
tripticos: [{ name: ‘Tríptico Promocional V-16’, link: ‘#’ }],
},
‘GV-205’: {
name: ‘Baliza LED Autónoma’,
ficha: { name: ‘Ficha Técnica Baliza LED (PDF)’, link: ‘#’ },
videos: [{ name: ‘Video: Usos y Durabilidad’, link: ‘#’ }],
tripticos: [{ name: ‘Folleto Multiseñal Baliza’, link: ‘#’ }],
},
};
// Función de búsqueda para Recursos de Marketing
function searchMarketingResources() {
const code = document.getElementById(‘marketing-product-code’).value.trim().toUpperCase();
const resultsArea = document.getElementById(‘marketing-results’);
resultsArea.innerHTML = »; // Limpiar resultados previos
const data = marketingData[code];
if (!code) {
resultsArea.innerHTML = `<div class=»p-4 bg-vadillo-yellow/20 text-vadillo-blue rounded-lg font-semibold»>Por favor, ingrese un código de producto válido.</div>`;
return;
}
if (data) {
let html = `<h3 class=»text-xl font-bold text-vadillo-orange mb-4″>Recursos Disponibles para: ${data.name} (${code})</h3>`;
// Ficha Técnica
if (data.ficha) {
html += `<div class=»bg-vadillo-gray p-4 rounded-lg mb-4 shadow-sm border border-gray-200″>
<h4 class=»font-bold text-vadillo-blue»>Ficha Técnica</h4>
<div class=»flex items-center justify-between mt-2″>
<p class=»text-sm»>${data.ficha.name}</p>
<a href=»${data.ficha.link}» target=»_blank» class=»text-vadillo-green hover:text-green-700 font-semibold flex items-center»>
<svg class=»w-4 h-4 mr-1″ fill=»none» stroke=»currentColor» viewBox=»0 0 24 24″ xmlns=»http://www.w3.org/2000/svg»><path stroke-linecap=»round» stroke-linejoin=»round» stroke-width=»2″ d=»M12 10v6m0 0l-3-3m3 3l3-3m2 8H4a2 2 0 01-2-2V6a2 2 0 012-2h7l2 2h4a2 2 0 012 2v8a2 2 0 01-2 2z»></path></svg>
Descargar
</a>
</div>
</div>`;
}
// Videos
if (data.videos.length > 0) {
html += `<div class=»bg-vadillo-gray p-4 rounded-lg mb-4 shadow-sm border border-gray-200″>
<h4 class=»font-bold text-vadillo-blue»>Videos de Producto</h4>
<ul class=»mt-2 space-y-2″>
${data.videos.map(v => `<li class=»flex items-center»><svg class=»w-4 h-4 mr-2 text-vadillo-orange» fill=»currentColor» viewBox=»0 0 20 20″ xmlns=»http://www.w3.org/2000/svg»><path d=»M2 6a2 2 0 012-2h12a2 2 0 012 2v8a2 2 0 01-2 2H4a2 2 0 01-2-2V6zM10 12a1 1 0 00-1 1v1h2v-1a1 1 0 00-1-1z»></path></svg><a href=»${v.link}» target=»_blank» class=»text-vadillo-orange hover:underline»>${v.name}</a></li>`).join(»)}
</ul>
</div>`;
}
// Trípticos
if (data.tripticos.length > 0) {
html += `<div class=»bg-vadillo-gray p-4 rounded-lg shadow-sm border border-gray-200″>
<h4 class=»font-bold text-vadillo-blue»>Trípticos/Dosier</h4>
<ul class=»mt-2 space-y-2″>
${data.tripticos.map(t => `<li class=»flex items-center»><svg class=»w-4 h-4 mr-2 text-vadillo-blue» fill=»currentColor» viewBox=»0 0 20 20″ xmlns=»http://www.w3.org/2000/svg»><path fill-rule=»evenodd» d=»M4 4a2 2 0 012-2h8a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V4zm2 2a1 1 0 011-1h6a1 1 0 110 2H7a1 1 0 01-1-1zm1 3a1 1 0 100 2h6a1 1 0 100-2H7zm0 3a1 1 0 100 2h6a1 1 0 100-2H7z» clip-rule=»evenodd»></path></svg><a href=»${t.link}» target=»_blank» class=»text-vadillo-orange hover:underline»>${t.name}</a></li>`).join(»)}
</ul>
</div>`;
}
resultsArea.innerHTML = html;
} else {
resultsArea.innerHTML = `<div class=»p-4 bg-red-100 text-red-700 rounded-lg»>No se encontraron recursos para el código de producto «${code}». Pruebe con GV-101 o GV-205.</div>`;
}
}
// Data simulada para Existencias
const stockData = {
‘GV-101’: { existence: 4520, status: ‘Alto’ },
‘GV-205’: { existence: 870, status: ‘Medio’ },
‘GV-310’: { existence: 120, status: ‘Bajo’ },
‘GV-400’: { existence: 0, status: ‘Agotado’ },
};
// Función de búsqueda para Existencias
function searchStock() {
const code = document.getElementById(‘stock-product-code’).value.trim().toUpperCase();
const resultsArea = document.getElementById(‘stock-results’);
resultsArea.innerHTML = »; // Limpiar resultados previos
const data = stockData[code];
if (!code) {
resultsArea.innerHTML = `<div class=»p-4 bg-vadillo-yellow/20 text-vadillo-blue rounded-lg font-semibold»>Por favor, ingrese un código de producto válido.</div>`;
return;
}
if (data) {
let statusColor = ‘text-vadillo-green’;
let borderColor = ‘border-vadillo-green’;
if (data.status === ‘Medio’) { statusColor = ‘text-vadillo-yellow’; borderColor = ‘border-vadillo-yellow’; }
if (data.status === ‘Bajo’ || data.status === ‘Agotado’) { statusColor = ‘text-red-600’; borderColor = ‘border-red-600’; }
let html = `
<div class=»p-6 bg-white border-l-4 ${borderColor} rounded-xl shadow-xl»>
<h3 class=»text-xl font-bold text-vadillo-blue mb-4″>Existencia para Producto: ${code}</h3>
<div class=»flex flex-col sm:flex-row items-start sm:items-center justify-between»>
<div class=»mb-4 sm:mb-0″>
<p class=»text-sm text-gray-500″>Unidades Disponibles en Almacén:</p>
<p class=»text-5xl font-extrabold ${statusColor}»>${data.existence.toLocaleString(‘es-ES’)}</p>
</div>
<div class=»text-left sm:text-right p-3 bg-gray-100 rounded-lg»>
<p class=»text-sm text-gray-500 font-semibold»>Nivel de Stock:</p>
<p class=»text-2xl font-bold ${statusColor}»>${data.status}</p>
</div>
</div>
<p class=»text-xs text-gray-400 mt-4 border-t pt-2″>La información de existencias es en tiempo real y está sujeta a pedidos pendientes.</p>
</div>
`;
resultsArea.innerHTML = html;
} else {
resultsArea.innerHTML = `<div class=»p-4 bg-red-100 text-red-700 rounded-lg»>No se encontró información de existencia para el código de producto «${code}». Pruebe con GV-101, GV-205 o GV-310.</div>`;
}
}
// Función para cambiar de sección en el Dashboard
function changeSection(sectionId) {
// Ocultar todas las secciones
contentSections.forEach(section => {
section.classList.add(‘hidden’);
section.classList.remove(‘active-section’);
});
// Mostrar la sección solicitada
const activeSection = document.getElementById(sectionId);
if (activeSection) {
activeSection.classList.remove(‘hidden’);
activeSection.classList.add(‘active-section’);
}
// Marcar el elemento de navegación como activo
navItems.forEach(item => {
item.classList.remove(‘bg-vadillo-orange/50’);
if (item.getAttribute(‘data-section’) === sectionId) {
item.classList.add(‘bg-vadillo-orange/50’);
}
});
}
// Inicializar el reloj en el header y listeners de búsqueda
document.addEventListener(‘DOMContentLoaded’, () => {
// Agregar listeners de navegación
navItems.forEach(item => {
item.addEventListener(‘click’, (e) => {
e.preventDefault();
changeSection(e.currentTarget.getAttribute(‘data-section’));
});
});
// Agregar listeners de búsqueda
document.getElementById(‘search-marketing-button’)?.addEventListener(‘click’, searchMarketingResources);
document.getElementById(‘search-stock-button’)?.addEventListener(‘click’, searchStock);
updateTime();
// Mostrar la página de login al inicio
loginPage.classList.remove(‘hidden’);
dashboardPage.classList.add(‘hidden’);
});
// Reloj en el header