Files
Autoparts-DB/dashboard/customer-landing.html
consultoria-as 834d7d2d96 Add landing page and redesign catalog with dark theme
Landing page (customer-landing.html):
- Modern dark theme with orange accent (#ff6b35)
- Dynamic stats, categories, products from API
- Integrated search modal with FTS
- VIN decoder section
- Responsive design with mobile support

Catalog redesign (index.html):
- Unified design matching landing page
- Custom modal system (removed Bootstrap dependency)
- Simplified breadcrumb navigation
- Updated card styles with hover effects
- Consistent color scheme and typography

JavaScript updates (dashboard.js):
- Custom modal open/close methods
- Updated element IDs for new HTML
- Paginated response handling
- Search input event binding

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 08:33:15 +00:00

1480 lines
45 KiB
HTML

<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>AutoParts DB - Tienda de Autopartes</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">
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
:root {
--bg-primary: #0a0a0f;
--bg-secondary: #12121a;
--bg-card: #1a1a24;
--bg-hover: #252532;
--accent: #ff6b35;
--accent-hover: #ff8555;
--accent-glow: rgba(255, 107, 53, 0.3);
--text-primary: #ffffff;
--text-secondary: #a0a0b0;
--border: #2a2a3a;
--success: #22c55e;
}
body {
font-family: 'Inter', sans-serif;
background: var(--bg-primary);
color: var(--text-primary);
min-height: 100vh;
}
/* Header */
.header {
background: rgba(18, 18, 26, 0.95);
backdrop-filter: blur(20px);
border-bottom: 1px solid var(--border);
padding: 1rem 3rem;
display: flex;
justify-content: space-between;
align-items: center;
position: fixed;
top: 0;
left: 0;
right: 0;
z-index: 1000;
}
.logo {
display: flex;
align-items: center;
gap: 0.75rem;
text-decoration: none;
}
.logo-icon {
width: 42px;
height: 42px;
background: linear-gradient(135deg, var(--accent) 0%, #ff4500 100%);
border-radius: 10px;
display: flex;
align-items: center;
justify-content: center;
font-size: 1.5rem;
box-shadow: 0 4px 20px var(--accent-glow);
}
.logo-text {
font-family: 'Orbitron', sans-serif;
font-size: 1.4rem;
font-weight: 700;
background: linear-gradient(135deg, #fff 0%, var(--accent) 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
}
.nav-links {
display: flex;
gap: 2.5rem;
}
.nav-links a {
color: var(--text-secondary);
text-decoration: none;
font-weight: 500;
font-size: 0.95rem;
transition: color 0.3s;
position: relative;
}
.nav-links a:hover,
.nav-links a.active {
color: var(--accent);
}
.nav-links a::after {
content: '';
position: absolute;
bottom: -5px;
left: 0;
width: 0;
height: 2px;
background: var(--accent);
transition: width 0.3s;
}
.nav-links a:hover::after,
.nav-links a.active::after {
width: 100%;
}
.header-actions {
display: flex;
align-items: center;
gap: 1.5rem;
}
.search-btn, .cart-btn {
width: 42px;
height: 42px;
background: var(--bg-card);
border: 1px solid var(--border);
border-radius: 10px;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
transition: all 0.3s;
font-size: 1.2rem;
position: relative;
}
.search-btn:hover, .cart-btn:hover {
background: var(--accent);
border-color: var(--accent);
}
.cart-badge {
position: absolute;
top: -5px;
right: -5px;
width: 20px;
height: 20px;
background: var(--accent);
border-radius: 50%;
font-size: 0.7rem;
font-weight: 700;
display: flex;
align-items: center;
justify-content: center;
}
.btn {
padding: 0.7rem 1.5rem;
border-radius: 10px;
border: none;
font-weight: 600;
cursor: pointer;
transition: all 0.3s;
font-size: 0.9rem;
text-decoration: none;
display: inline-flex;
align-items: center;
justify-content: center;
}
.btn-primary {
background: linear-gradient(135deg, var(--accent) 0%, #ff4500 100%);
color: white;
box-shadow: 0 4px 15px var(--accent-glow);
}
.btn-primary:hover {
transform: translateY(-2px);
box-shadow: 0 6px 25px var(--accent-glow);
}
/* Hero Section */
.hero {
min-height: 100vh;
display: flex;
align-items: center;
padding: 8rem 3rem 4rem;
position: relative;
overflow: hidden;
}
.hero-bg {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background:
radial-gradient(ellipse at 20% 50%, rgba(255, 107, 53, 0.15) 0%, transparent 50%),
radial-gradient(ellipse at 80% 20%, rgba(255, 69, 0, 0.1) 0%, transparent 40%);
z-index: 0;
}
.hero-grid {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-image:
linear-gradient(rgba(255, 107, 53, 0.03) 1px, transparent 1px),
linear-gradient(90deg, rgba(255, 107, 53, 0.03) 1px, transparent 1px);
background-size: 50px 50px;
z-index: 0;
}
.hero-content {
max-width: 1400px;
margin: 0 auto;
display: grid;
grid-template-columns: 1fr 1fr;
gap: 4rem;
align-items: center;
width: 100%;
position: relative;
z-index: 1;
}
.hero-text h1 {
font-family: 'Orbitron', sans-serif;
font-size: 3.5rem;
font-weight: 700;
line-height: 1.2;
margin-bottom: 1.5rem;
}
.hero-text h1 span {
color: var(--accent);
text-shadow: 0 0 30px var(--accent-glow);
}
.hero-text p {
font-size: 1.2rem;
color: var(--text-secondary);
line-height: 1.8;
margin-bottom: 2.5rem;
max-width: 500px;
}
.hero-buttons {
display: flex;
gap: 1rem;
}
.btn-large {
padding: 1rem 2rem;
font-size: 1rem;
}
.btn-outline {
background: transparent;
border: 2px solid var(--border);
color: var(--text-primary);
}
.btn-outline:hover {
border-color: var(--accent);
color: var(--accent);
}
.hero-stats {
display: flex;
gap: 3rem;
margin-top: 3rem;
padding-top: 2rem;
border-top: 1px solid var(--border);
}
.hero-stat {
text-align: center;
}
.hero-stat-value {
font-family: 'Orbitron', sans-serif;
font-size: 2rem;
font-weight: 700;
color: var(--accent);
}
.hero-stat-label {
font-size: 0.85rem;
color: var(--text-secondary);
margin-top: 0.25rem;
}
.hero-visual {
position: relative;
display: flex;
justify-content: center;
align-items: center;
}
.hero-image {
width: 500px;
height: 400px;
background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-hover) 100%);
border-radius: 20px;
border: 1px solid var(--border);
display: flex;
align-items: center;
justify-content: center;
font-size: 8rem;
position: relative;
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.hero-image::before {
content: '';
position: absolute;
top: -2px;
left: -2px;
right: -2px;
bottom: -2px;
background: linear-gradient(135deg, var(--accent), transparent, var(--accent));
border-radius: 22px;
z-index: -1;
opacity: 0.5;
}
.floating-card {
position: absolute;
background: var(--bg-card);
border: 1px solid var(--border);
border-radius: 12px;
padding: 1rem 1.5rem;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}
.floating-card-1 {
top: 20px;
right: -20px;
animation: float 3s ease-in-out infinite;
}
.floating-card-2 {
bottom: 40px;
left: -30px;
animation: float 3s ease-in-out infinite 1.5s;
}
@keyframes float {
0%, 100% { transform: translateY(0); }
50% { transform: translateY(-10px); }
}
.floating-card-text {
font-size: 0.85rem;
color: var(--text-secondary);
}
.floating-card-value {
font-family: 'Orbitron', sans-serif;
font-size: 1.5rem;
font-weight: 700;
color: var(--accent);
}
/* Categories Section */
.categories {
padding: 5rem 3rem;
background: var(--bg-secondary);
}
.section-header {
text-align: center;
margin-bottom: 3rem;
}
.section-tag {
display: inline-block;
padding: 0.5rem 1rem;
background: rgba(255, 107, 53, 0.1);
border: 1px solid var(--accent);
border-radius: 20px;
color: var(--accent);
font-size: 0.85rem;
font-weight: 600;
margin-bottom: 1rem;
}
.section-title {
font-family: 'Orbitron', sans-serif;
font-size: 2.5rem;
font-weight: 700;
margin-bottom: 1rem;
}
.section-subtitle {
color: var(--text-secondary);
font-size: 1.1rem;
}
.categories-grid {
max-width: 1400px;
margin: 0 auto;
display: grid;
grid-template-columns: repeat(6, 1fr);
gap: 1.5rem;
}
.category-card {
background: var(--bg-card);
border: 1px solid var(--border);
border-radius: 16px;
padding: 2rem 1rem;
text-align: center;
cursor: pointer;
transition: all 0.3s;
text-decoration: none;
color: inherit;
display: block;
}
.category-card:hover {
transform: translateY(-5px);
border-color: var(--accent);
box-shadow: 0 10px 30px var(--accent-glow);
}
.category-icon {
width: 70px;
height: 70px;
background: var(--bg-hover);
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
font-size: 2rem;
margin: 0 auto 1rem;
transition: all 0.3s;
}
.category-card:hover .category-icon {
background: var(--accent);
transform: scale(1.1);
}
.category-name {
font-weight: 600;
margin-bottom: 0.5rem;
}
.category-count {
font-size: 0.85rem;
color: var(--text-secondary);
}
/* Featured Products */
.featured {
padding: 5rem 3rem;
}
.featured-header {
max-width: 1400px;
margin: 0 auto 3rem;
display: flex;
justify-content: space-between;
align-items: center;
}
.view-all {
color: var(--accent);
text-decoration: none;
font-weight: 600;
display: flex;
align-items: center;
gap: 0.5rem;
transition: gap 0.3s;
}
.view-all:hover {
gap: 1rem;
}
.products-grid {
max-width: 1400px;
margin: 0 auto;
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 1.5rem;
}
.product-card {
background: var(--bg-card);
border: 1px solid var(--border);
border-radius: 16px;
overflow: hidden;
transition: all 0.3s;
}
.product-card:hover {
transform: translateY(-5px);
border-color: var(--accent);
box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
}
.product-image {
height: 200px;
background: var(--bg-hover);
display: flex;
align-items: center;
justify-content: center;
font-size: 4rem;
position: relative;
}
.product-badge {
position: absolute;
top: 1rem;
left: 1rem;
padding: 0.4rem 0.8rem;
background: var(--accent);
border-radius: 6px;
font-size: 0.75rem;
font-weight: 700;
}
.product-badge.premium {
background: linear-gradient(135deg, #f59e0b, #d97706);
}
.product-badge.economy {
background: var(--success);
}
.product-wishlist {
position: absolute;
top: 1rem;
right: 1rem;
width: 36px;
height: 36px;
background: var(--bg-card);
border: 1px solid var(--border);
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
transition: all 0.3s;
}
.product-wishlist:hover {
background: var(--accent);
border-color: var(--accent);
}
.product-info {
padding: 1.5rem;
}
.product-category {
font-size: 0.8rem;
color: var(--accent);
font-weight: 600;
margin-bottom: 0.5rem;
}
.product-name {
font-weight: 600;
font-size: 1.1rem;
margin-bottom: 0.5rem;
line-height: 1.4;
}
.product-oem {
font-size: 0.8rem;
color: var(--text-secondary);
font-family: monospace;
margin-bottom: 0.5rem;
}
.product-compatibility {
font-size: 0.85rem;
color: var(--text-secondary);
margin-bottom: 1rem;
}
.product-footer {
display: flex;
justify-content: space-between;
align-items: center;
}
.product-price {
font-family: 'Orbitron', sans-serif;
font-size: 1.3rem;
font-weight: 700;
color: var(--accent);
}
.product-price .original {
font-size: 0.9rem;
color: var(--text-secondary);
text-decoration: line-through;
margin-left: 0.5rem;
}
.btn-add-cart {
width: 40px;
height: 40px;
background: var(--bg-hover);
border: 1px solid var(--border);
border-radius: 10px;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
transition: all 0.3s;
font-size: 1.2rem;
}
.btn-add-cart:hover {
background: var(--accent);
border-color: var(--accent);
}
/* Brands Section */
.brands {
padding: 5rem 3rem;
background: var(--bg-secondary);
}
.brands-grid {
max-width: 1200px;
margin: 0 auto;
display: flex;
justify-content: center;
align-items: center;
gap: 2rem;
flex-wrap: wrap;
}
.brand-item {
width: 140px;
height: 70px;
background: var(--bg-card);
border: 1px solid var(--border);
border-radius: 10px;
display: flex;
align-items: center;
justify-content: center;
font-size: 0.9rem;
font-weight: 700;
color: var(--text-secondary);
transition: all 0.3s;
cursor: pointer;
text-align: center;
padding: 0.5rem;
}
.brand-item:hover {
border-color: var(--accent);
color: var(--accent);
transform: translateY(-3px);
}
/* VIN Section */
.vin-section {
padding: 5rem 3rem;
position: relative;
overflow: hidden;
}
.vin-bg {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background:
radial-gradient(ellipse at 30% 50%, rgba(255, 107, 53, 0.1) 0%, transparent 50%);
}
.vin-content {
max-width: 800px;
margin: 0 auto;
text-align: center;
position: relative;
z-index: 1;
}
.vin-form {
display: flex;
gap: 1rem;
max-width: 600px;
margin: 2rem auto 0;
}
.vin-input {
flex: 1;
padding: 1rem 1.5rem;
background: var(--bg-card);
border: 1px solid var(--border);
border-radius: 10px;
color: var(--text-primary);
font-size: 1rem;
font-family: monospace;
text-transform: uppercase;
letter-spacing: 2px;
outline: none;
transition: border-color 0.3s;
}
.vin-input:focus {
border-color: var(--accent);
}
.vin-input::placeholder {
color: var(--text-secondary);
text-transform: none;
letter-spacing: normal;
}
/* CTA Section */
.cta {
padding: 5rem 3rem;
background: var(--bg-secondary);
position: relative;
overflow: hidden;
}
.cta-bg {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background:
radial-gradient(ellipse at 50% 50%, rgba(255, 107, 53, 0.15) 0%, transparent 60%);
}
.cta-content {
max-width: 800px;
margin: 0 auto;
text-align: center;
position: relative;
z-index: 1;
}
.cta-title {
font-family: 'Orbitron', sans-serif;
font-size: 2.5rem;
font-weight: 700;
margin-bottom: 1rem;
}
.cta-subtitle {
color: var(--text-secondary);
font-size: 1.1rem;
margin-bottom: 2rem;
}
.cta-form {
display: flex;
gap: 1rem;
max-width: 500px;
margin: 0 auto;
}
.cta-input {
flex: 1;
padding: 1rem 1.5rem;
background: var(--bg-card);
border: 1px solid var(--border);
border-radius: 10px;
color: var(--text-primary);
font-size: 1rem;
outline: none;
transition: border-color 0.3s;
}
.cta-input:focus {
border-color: var(--accent);
}
.cta-input::placeholder {
color: var(--text-secondary);
}
/* Footer */
.footer {
background: var(--bg-primary);
border-top: 1px solid var(--border);
padding: 4rem 3rem 2rem;
}
.footer-content {
max-width: 1400px;
margin: 0 auto;
display: grid;
grid-template-columns: 2fr 1fr 1fr 1fr;
gap: 3rem;
}
.footer-brand p {
color: var(--text-secondary);
margin: 1rem 0;
line-height: 1.8;
}
.social-links {
display: flex;
gap: 1rem;
}
.social-link {
width: 40px;
height: 40px;
background: var(--bg-card);
border: 1px solid var(--border);
border-radius: 10px;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
transition: all 0.3s;
text-decoration: none;
color: var(--text-secondary);
}
.social-link:hover {
background: var(--accent);
border-color: var(--accent);
color: white;
}
.footer-title {
font-weight: 700;
margin-bottom: 1.5rem;
font-size: 1.1rem;
}
.footer-links {
list-style: none;
}
.footer-links li {
margin-bottom: 0.75rem;
}
.footer-links a {
color: var(--text-secondary);
text-decoration: none;
transition: color 0.3s;
}
.footer-links a:hover {
color: var(--accent);
}
.footer-bottom {
max-width: 1400px;
margin: 3rem auto 0;
padding-top: 2rem;
border-top: 1px solid var(--border);
display: flex;
justify-content: space-between;
align-items: center;
color: var(--text-secondary);
font-size: 0.9rem;
}
/* Loading skeleton */
.skeleton {
background: linear-gradient(90deg, var(--bg-hover) 25%, var(--bg-card) 50%, var(--bg-hover) 75%);
background-size: 200% 100%;
animation: shimmer 1.5s infinite;
border-radius: 8px;
}
@keyframes shimmer {
0% { background-position: 200% 0; }
100% { background-position: -200% 0; }
}
/* Search Modal */
.search-modal {
display: none;
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.8);
z-index: 2000;
align-items: flex-start;
justify-content: center;
padding-top: 15vh;
}
.search-modal.active {
display: flex;
}
.search-modal-content {
background: var(--bg-card);
border: 1px solid var(--border);
border-radius: 16px;
width: 100%;
max-width: 600px;
padding: 1.5rem;
}
.search-modal-input {
width: 100%;
padding: 1rem 1.5rem;
background: var(--bg-hover);
border: 1px solid var(--border);
border-radius: 10px;
color: var(--text-primary);
font-size: 1.1rem;
outline: none;
}
.search-modal-input:focus {
border-color: var(--accent);
}
.search-results {
margin-top: 1rem;
max-height: 400px;
overflow-y: auto;
}
.search-result-item {
padding: 1rem;
border-radius: 8px;
cursor: pointer;
transition: background 0.2s;
}
.search-result-item:hover {
background: var(--bg-hover);
}
.search-result-name {
font-weight: 600;
}
.search-result-oem {
font-size: 0.85rem;
color: var(--accent);
font-family: monospace;
}
/* Mobile menu */
.mobile-menu-btn {
display: none;
background: none;
border: none;
font-size: 1.5rem;
cursor: pointer;
color: var(--text-primary);
}
@media (max-width: 1024px) {
.hero-content {
grid-template-columns: 1fr;
text-align: center;
}
.hero-text p {
margin: 0 auto 2.5rem;
}
.hero-buttons {
justify-content: center;
}
.hero-stats {
justify-content: center;
}
.hero-visual {
display: none;
}
.categories-grid {
grid-template-columns: repeat(3, 1fr);
}
.products-grid {
grid-template-columns: repeat(2, 1fr);
}
.footer-content {
grid-template-columns: 1fr 1fr;
}
}
@media (max-width: 768px) {
.header {
padding: 1rem;
}
.nav-links {
display: none;
}
.mobile-menu-btn {
display: block;
}
.hero {
padding: 6rem 1rem 3rem;
}
.hero-text h1 {
font-size: 2.5rem;
}
.categories, .featured, .brands, .vin-section, .cta {
padding: 3rem 1rem;
}
.categories-grid {
grid-template-columns: repeat(2, 1fr);
gap: 1rem;
}
.products-grid {
grid-template-columns: 1fr;
}
.vin-form, .cta-form {
flex-direction: column;
}
.footer-content {
grid-template-columns: 1fr;
}
.footer-bottom {
flex-direction: column;
gap: 1rem;
text-align: center;
}
}
</style>
</head>
<body>
<!-- Header -->
<header class="header">
<a href="customer-landing.html" class="logo">
<div class="logo-icon">⚙️</div>
<div class="logo-text">AUTOPARTS DB</div>
</a>
<nav class="nav-links">
<a href="customer-landing.html" class="active">Inicio</a>
<a href="index.html">Catálogo</a>
<a href="#brands-section">Marcas</a>
<a href="#featured-section">Productos</a>
<a href="#cta-section">Contacto</a>
</nav>
<div class="header-actions">
<button class="search-btn" onclick="openSearchModal()">🔍</button>
<button class="cart-btn">
🛒
<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"></button>
</div>
</header>
<!-- 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">AUTOPARTS DB</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>© 2024 AutoParts DB. Sistema de Catálogo de Autopartes.</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] = 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`)
]);
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();
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;
document.getElementById('stat-models').textContent = '13K+';
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 data = await res.json();
if (data.error) {
resultDiv.innerHTML = `<p style="color: #ef4444;">${data.error}</p>`;
return;
}
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>
${data.engine_info ? `<p><strong>Motor:</strong> ${data.engine_info.displacement_l || ''}L ${data.engine_info.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>