- Extraído CSS inline de 15 templates POS + 13 templates Dashboard - CSS movido a archivos .css externos en pos/static/css/ y dashboard/ - Generados .min.css vía minify-assets.sh - Nginx auto-serve transparente para .min.css - Tests: 73/73 pasando - Script: scripts/extract-inline-css.py
439 lines
20 KiB
HTML
439 lines
20 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="es">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Nexus Autoparts - Tu conexión directa con las partes que necesitas</title>
|
|
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Orbitron:wght@400;500;600;700&display=swap" rel="stylesheet">
|
|
<link rel="stylesheet" href="/shared.css">
|
|
<link rel="stylesheet" href="customer-landing.css">
|
|
</head>
|
|
<body>
|
|
<!-- Shared Navigation -->
|
|
<div id="shared-nav"></div>
|
|
<script src="/nav.js"></script>
|
|
<script>
|
|
// Inject landing-page-specific header extras (search, cart, dashboard btn)
|
|
(function() {
|
|
var extra = document.getElementById('shared-nav-extra');
|
|
if (!extra) return;
|
|
extra.innerHTML = ''
|
|
+ '<div class="header-actions">'
|
|
+ '<button class="search-btn" onclick="openSearchModal()">\uD83D\uDD0D</button>'
|
|
+ '<button class="cart-btn">\uD83D\uDED2<span class="cart-badge" id="cart-count">0</span></button>'
|
|
+ '<a href="index.html" class="btn btn-primary">Dashboard</a>'
|
|
+ '<button class="mobile-menu-btn">\u2630</button>'
|
|
+ '</div>';
|
|
})();
|
|
</script>
|
|
|
|
<!-- Search Modal -->
|
|
<div class="search-modal" id="searchModal" onclick="closeSearchModal(event)">
|
|
<div class="search-modal-content" onclick="event.stopPropagation()">
|
|
<input type="text" class="search-modal-input" id="searchInput"
|
|
placeholder="Buscar por nombre o número de parte..."
|
|
oninput="performSearch(this.value)">
|
|
<div class="search-results" id="searchResults"></div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Hero Section -->
|
|
<section class="hero">
|
|
<div class="hero-bg"></div>
|
|
<div class="hero-grid"></div>
|
|
<div class="hero-content">
|
|
<div class="hero-text">
|
|
<h1>Encuentra las <span>Mejores Autopartes</span> para tu Vehículo</h1>
|
|
<p>Catálogo completo de piezas originales y aftermarket para todas las marcas. Diagramas técnicos, referencias cruzadas y decodificador de VIN incluidos.</p>
|
|
<div class="hero-buttons">
|
|
<a href="index.html" class="btn btn-primary btn-large">Explorar Catálogo</a>
|
|
<a href="#vin-section" class="btn btn-outline btn-large">Buscar por VIN</a>
|
|
</div>
|
|
<div class="hero-stats">
|
|
<div class="hero-stat">
|
|
<div class="hero-stat-value" id="stat-parts">-</div>
|
|
<div class="hero-stat-label">Partes</div>
|
|
</div>
|
|
<div class="hero-stat">
|
|
<div class="hero-stat-value" id="stat-brands">-</div>
|
|
<div class="hero-stat-label">Marcas</div>
|
|
</div>
|
|
<div class="hero-stat">
|
|
<div class="hero-stat-value" id="stat-categories">-</div>
|
|
<div class="hero-stat-label">Categorías</div>
|
|
</div>
|
|
<div class="hero-stat">
|
|
<div class="hero-stat-value" id="stat-models">-</div>
|
|
<div class="hero-stat-label">Modelos</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="hero-visual">
|
|
<div class="hero-image">🏎️</div>
|
|
<div class="floating-card floating-card-1">
|
|
<div class="floating-card-text">Fabricantes</div>
|
|
<div class="floating-card-value" id="stat-manufacturers">-</div>
|
|
</div>
|
|
<div class="floating-card floating-card-2">
|
|
<div class="floating-card-text">Aftermarket</div>
|
|
<div class="floating-card-value" id="stat-aftermarket">-</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
|
|
<!-- Categories Section -->
|
|
<section class="categories" id="categories-section">
|
|
<div class="section-header">
|
|
<div class="section-tag">Categorías</div>
|
|
<h2 class="section-title">Explora por Categoría</h2>
|
|
<p class="section-subtitle">Encuentra exactamente lo que necesitas para tu vehículo</p>
|
|
</div>
|
|
<div class="categories-grid" id="categories-grid">
|
|
<!-- Loaded dynamically -->
|
|
</div>
|
|
</section>
|
|
|
|
<!-- Featured Products -->
|
|
<section class="featured" id="featured-section">
|
|
<div class="featured-header">
|
|
<div>
|
|
<div class="section-tag">Destacados</div>
|
|
<h2 class="section-title">Partes Disponibles</h2>
|
|
</div>
|
|
<a href="index.html" class="view-all">Ver catálogo completo →</a>
|
|
</div>
|
|
<div class="products-grid" id="products-grid">
|
|
<!-- Loaded dynamically -->
|
|
</div>
|
|
</section>
|
|
|
|
<!-- Brands Section -->
|
|
<section class="brands" id="brands-section">
|
|
<div class="section-header">
|
|
<div class="section-tag">Fabricantes</div>
|
|
<h2 class="section-title">Marcas Aftermarket Disponibles</h2>
|
|
</div>
|
|
<div class="brands-grid" id="brands-grid">
|
|
<!-- Loaded dynamically -->
|
|
</div>
|
|
</section>
|
|
|
|
<!-- VIN Section -->
|
|
<section class="vin-section" id="vin-section">
|
|
<div class="vin-bg"></div>
|
|
<div class="vin-content">
|
|
<div class="section-tag">Decodificador</div>
|
|
<h2 class="section-title">Busca por Número de VIN</h2>
|
|
<p class="section-subtitle">Ingresa el VIN de tu vehículo para encontrar partes compatibles</p>
|
|
<form class="vin-form" onsubmit="decodeVIN(event)">
|
|
<input type="text" class="vin-input" id="vinInput"
|
|
placeholder="Ej: 4T1BF1FK5CU123456" maxlength="17"
|
|
pattern="[A-HJ-NPR-Z0-9]{17}">
|
|
<button type="submit" class="btn btn-primary btn-large">Decodificar</button>
|
|
</form>
|
|
<div id="vin-result" style="margin-top: 2rem;"></div>
|
|
</div>
|
|
</section>
|
|
|
|
<!-- CTA Section -->
|
|
<section class="cta" id="cta-section">
|
|
<div class="cta-bg"></div>
|
|
<div class="cta-content">
|
|
<h2 class="cta-title">¿Necesitas ayuda?</h2>
|
|
<p class="cta-subtitle">Accede al dashboard completo para explorar diagramas técnicos y referencias cruzadas</p>
|
|
<div style="display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap;">
|
|
<a href="index.html" class="btn btn-primary btn-large">Ir al Dashboard</a>
|
|
<a href="#vin-section" class="btn btn-outline btn-large">Buscar por VIN</a>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
|
|
<!-- Footer -->
|
|
<footer class="footer">
|
|
<div class="footer-content">
|
|
<div class="footer-brand">
|
|
<div class="logo">
|
|
<div class="logo-icon">⚙️</div>
|
|
<div class="logo-text">NEXUS AUTOPARTS</div>
|
|
</div>
|
|
<p>Sistema de catálogo de autopartes con navegación jerárquica, diagramas explosionados y decodificador de VIN.</p>
|
|
<div class="social-links">
|
|
<a href="#" class="social-link">f</a>
|
|
<a href="#" class="social-link">in</a>
|
|
<a href="#" class="social-link">ig</a>
|
|
<a href="#" class="social-link">yt</a>
|
|
</div>
|
|
</div>
|
|
<div class="footer-column">
|
|
<h4 class="footer-title">Categorías</h4>
|
|
<ul class="footer-links" id="footer-categories">
|
|
<!-- Loaded dynamically -->
|
|
</ul>
|
|
</div>
|
|
<div class="footer-column">
|
|
<h4 class="footer-title">Herramientas</h4>
|
|
<ul class="footer-links">
|
|
<li><a href="index.html">Dashboard</a></li>
|
|
<li><a href="#vin-section">Decodificador VIN</a></li>
|
|
<li><a href="index.html">Diagramas Técnicos</a></li>
|
|
<li><a href="index.html">Cross-References</a></li>
|
|
</ul>
|
|
</div>
|
|
<div class="footer-column">
|
|
<h4 class="footer-title">Sistema</h4>
|
|
<ul class="footer-links">
|
|
<li><a href="#">API Documentation</a></li>
|
|
<li><a href="#">Base de Datos</a></li>
|
|
<li><a href="#">Importar Datos</a></li>
|
|
<li><a href="#">Soporte</a></li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
<div class="footer-bottom">
|
|
<p>© 2026 Nexus Autoparts. Tu conexión directa con las partes que necesitas.</p>
|
|
<p>Desarrollado con Flask + SQLite</p>
|
|
</div>
|
|
</footer>
|
|
|
|
<script>
|
|
const API_BASE = '';
|
|
|
|
// Category icons mapping
|
|
const categoryIcons = {
|
|
'Engine': '🔧',
|
|
'Brake & Wheel Hub': '🛞',
|
|
'Suspension': '🔩',
|
|
'Electrical & Lighting': '⚡',
|
|
'Transmission-Automatic': '⚙️',
|
|
'Exhaust': '💨',
|
|
'Cooling System': '❄️',
|
|
'Fuel & Air': '⛽',
|
|
'Body & Lamp Assembly': '🚗',
|
|
'Steering': '🎯',
|
|
'Heat & Air Conditioning': '🌡️',
|
|
'Drivetrain': '🔄',
|
|
'default': '🔧'
|
|
};
|
|
|
|
// Load stats
|
|
async function loadStats() {
|
|
try {
|
|
const [partsRes, brandsRes, categoriesRes, manufacturersRes, aftermarketRes, modelsRes] = await Promise.all([
|
|
fetch(`${API_BASE}/api/parts?per_page=1`),
|
|
fetch(`${API_BASE}/api/brands`),
|
|
fetch(`${API_BASE}/api/categories`),
|
|
fetch(`${API_BASE}/api/manufacturers`),
|
|
fetch(`${API_BASE}/api/aftermarket?per_page=1`),
|
|
fetch(`${API_BASE}/api/models`)
|
|
]);
|
|
|
|
const parts = await partsRes.json();
|
|
const brands = await brandsRes.json();
|
|
const categories = await categoriesRes.json();
|
|
const manufacturers = await manufacturersRes.json();
|
|
const aftermarket = await aftermarketRes.json();
|
|
const models = await modelsRes.json();
|
|
|
|
document.getElementById('stat-parts').textContent = (parts.pagination?.total || parts.length || 0) + '+';
|
|
document.getElementById('stat-brands').textContent = brands.length || 0;
|
|
document.getElementById('stat-categories').textContent = categories.length || 0;
|
|
const modelCount = models.length || 0;
|
|
document.getElementById('stat-models').textContent = modelCount >= 1000 ? Math.floor(modelCount / 1000) + 'K+' : modelCount;
|
|
document.getElementById('stat-manufacturers').textContent = manufacturers.length || 0;
|
|
document.getElementById('stat-aftermarket').textContent = (aftermarket.pagination?.total || aftermarket.length || 0) + '+';
|
|
} catch (e) {
|
|
console.error('Error loading stats:', e);
|
|
}
|
|
}
|
|
|
|
// Load categories
|
|
async function loadCategories() {
|
|
const grid = document.getElementById('categories-grid');
|
|
const footerList = document.getElementById('footer-categories');
|
|
|
|
try {
|
|
const res = await fetch(`${API_BASE}/api/categories`);
|
|
const categories = await res.json();
|
|
|
|
// Show first 6 categories in grid
|
|
grid.innerHTML = categories.slice(0, 6).map(cat => `
|
|
<a href="index.html" class="category-card">
|
|
<div class="category-icon">${categoryIcons[cat.name] || categoryIcons.default}</div>
|
|
<div class="category-name">${cat.name_es || cat.name}</div>
|
|
<div class="category-count">${cat.groups_count || 0} grupos</div>
|
|
</a>
|
|
`).join('');
|
|
|
|
// Footer links
|
|
footerList.innerHTML = categories.slice(0, 5).map(cat => `
|
|
<li><a href="index.html">${cat.name_es || cat.name}</a></li>
|
|
`).join('');
|
|
} catch (e) {
|
|
console.error('Error loading categories:', e);
|
|
grid.innerHTML = '<p style="color: var(--text-secondary); grid-column: 1/-1; text-align: center;">Error cargando categorías</p>';
|
|
}
|
|
}
|
|
|
|
// Load products
|
|
async function loadProducts() {
|
|
const grid = document.getElementById('products-grid');
|
|
|
|
try {
|
|
const res = await fetch(`${API_BASE}/api/parts?per_page=8`);
|
|
const data = await res.json();
|
|
const parts = data.data || data;
|
|
|
|
if (!parts.length) {
|
|
grid.innerHTML = '<p style="color: var(--text-secondary); grid-column: 1/-1; text-align: center;">No hay partes disponibles</p>';
|
|
return;
|
|
}
|
|
|
|
grid.innerHTML = parts.slice(0, 4).map(part => `
|
|
<div class="product-card">
|
|
<div class="product-image">
|
|
${categoryIcons[part.category_name] || '🔧'}
|
|
<button class="product-wishlist">♡</button>
|
|
</div>
|
|
<div class="product-info">
|
|
<div class="product-category">${part.category_name || part.group_name || 'General'}</div>
|
|
<div class="product-name">${part.name}</div>
|
|
<div class="product-oem">${part.oem_part_number}</div>
|
|
<div class="product-compatibility">${part.name_es || ''}</div>
|
|
<div class="product-footer">
|
|
<div class="product-price">Ver detalles</div>
|
|
<a href="index.html" class="btn-add-cart">→</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
`).join('');
|
|
} catch (e) {
|
|
console.error('Error loading products:', e);
|
|
grid.innerHTML = '<p style="color: var(--text-secondary); grid-column: 1/-1; text-align: center;">Error cargando productos</p>';
|
|
}
|
|
}
|
|
|
|
// Load manufacturers
|
|
async function loadManufacturers() {
|
|
const grid = document.getElementById('brands-grid');
|
|
|
|
try {
|
|
const res = await fetch(`${API_BASE}/api/manufacturers`);
|
|
const manufacturers = await res.json();
|
|
|
|
grid.innerHTML = manufacturers.slice(0, 12).map(m => `
|
|
<div class="brand-item" title="${m.type} - ${m.quality_tier}">${m.name}</div>
|
|
`).join('');
|
|
} catch (e) {
|
|
console.error('Error loading manufacturers:', e);
|
|
}
|
|
}
|
|
|
|
// Search modal
|
|
function openSearchModal() {
|
|
document.getElementById('searchModal').classList.add('active');
|
|
document.getElementById('searchInput').focus();
|
|
}
|
|
|
|
function closeSearchModal(e) {
|
|
if (e.target.id === 'searchModal') {
|
|
document.getElementById('searchModal').classList.remove('active');
|
|
}
|
|
}
|
|
|
|
let searchTimeout;
|
|
async function performSearch(query) {
|
|
clearTimeout(searchTimeout);
|
|
const results = document.getElementById('searchResults');
|
|
|
|
if (query.length < 2) {
|
|
results.innerHTML = '';
|
|
return;
|
|
}
|
|
|
|
searchTimeout = setTimeout(async () => {
|
|
try {
|
|
const res = await fetch(`${API_BASE}/api/search/parts?q=${encodeURIComponent(query)}&per_page=10`);
|
|
const data = await res.json();
|
|
const parts = data.data || data;
|
|
|
|
if (!parts.length) {
|
|
results.innerHTML = '<p style="padding: 1rem; color: var(--text-secondary);">No se encontraron resultados</p>';
|
|
return;
|
|
}
|
|
|
|
results.innerHTML = parts.map(p => `
|
|
<div class="search-result-item" onclick="window.location.href='index.html'">
|
|
<div class="search-result-name">${p.name}</div>
|
|
<div class="search-result-oem">${p.oem_part_number}</div>
|
|
</div>
|
|
`).join('');
|
|
} catch (e) {
|
|
results.innerHTML = '<p style="padding: 1rem; color: var(--text-secondary);">Error en la búsqueda</p>';
|
|
}
|
|
}, 300);
|
|
}
|
|
|
|
// VIN decoder
|
|
async function decodeVIN(e) {
|
|
e.preventDefault();
|
|
const vin = document.getElementById('vinInput').value.toUpperCase().trim();
|
|
const resultDiv = document.getElementById('vin-result');
|
|
|
|
if (vin.length !== 17) {
|
|
resultDiv.innerHTML = '<p style="color: #ef4444;">El VIN debe tener 17 caracteres</p>';
|
|
return;
|
|
}
|
|
|
|
resultDiv.innerHTML = '<p style="color: var(--text-secondary);">Decodificando...</p>';
|
|
|
|
try {
|
|
const res = await fetch(`${API_BASE}/api/vin/decode/${vin}`);
|
|
const raw = await res.json();
|
|
const data = raw.vehicle || raw;
|
|
|
|
if (data.error) {
|
|
resultDiv.innerHTML = `<p style="color: #ef4444;">${data.error}</p>`;
|
|
return;
|
|
}
|
|
|
|
const engineInfo = data.engine_info || {};
|
|
resultDiv.innerHTML = `
|
|
<div style="background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 1.5rem; text-align: left; max-width: 500px; margin: 0 auto;">
|
|
<h3 style="color: var(--accent); margin-bottom: 1rem;">Vehículo Identificado</h3>
|
|
<p><strong>Marca:</strong> ${data.make || 'N/A'}</p>
|
|
<p><strong>Modelo:</strong> ${data.model || 'N/A'}</p>
|
|
<p><strong>Año:</strong> ${data.year || 'N/A'}</p>
|
|
<p><strong>Tipo:</strong> ${data.body_class || 'N/A'}</p>
|
|
<p><strong>Tracción:</strong> ${data.drive_type || 'N/A'}</p>
|
|
${engineInfo.raw || engineInfo.displacement_l ? `<p><strong>Motor:</strong> ${engineInfo.raw || (engineInfo.displacement_l + 'L ' + (engineInfo.cylinders || '') + ' cil.')}</p>` : ''}
|
|
<a href="index.html" class="btn btn-primary" style="margin-top: 1rem; display: inline-block;">Ver partes compatibles</a>
|
|
</div>
|
|
`;
|
|
} catch (e) {
|
|
resultDiv.innerHTML = '<p style="color: #ef4444;">Error al decodificar el VIN</p>';
|
|
}
|
|
}
|
|
|
|
// Keyboard shortcuts
|
|
document.addEventListener('keydown', (e) => {
|
|
if (e.key === '/' && !e.target.matches('input, textarea')) {
|
|
e.preventDefault();
|
|
openSearchModal();
|
|
}
|
|
if (e.key === 'Escape') {
|
|
document.getElementById('searchModal').classList.remove('active');
|
|
}
|
|
});
|
|
|
|
// Initialize
|
|
document.addEventListener('DOMContentLoaded', () => {
|
|
loadStats();
|
|
loadCategories();
|
|
loadProducts();
|
|
loadManufacturers();
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|