# Conflicts: # public/startseite/startseite.html # scripts/routes/other/route-index.js
175 lines
6.7 KiB
HTML
175 lines
6.7 KiB
HTML
<!DOCTYPE html>
|
||
<html lang="de">
|
||
<head>
|
||
<meta charset="UTF-8">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
<title>Modellauto - Startseite</title>
|
||
<link rel="stylesheet" href="./Styles/styles-main.css">
|
||
<link href="https://unpkg.com/boxicons@2.1.4/css/boxicons.min.css" rel="stylesheet">
|
||
<script src="/header_footer"></script>
|
||
</head>
|
||
<body>
|
||
<div class="wrapper">
|
||
<!-- Header -->
|
||
<div id="header-placeholder"></div>
|
||
|
||
<main>
|
||
<!-- Infobereich -->
|
||
<section style="padding: 40px 20px; text-align: center; background: #fff;">
|
||
<h2>Willkommen beim Modellauto-Shop</h2>
|
||
<p>Bei uns finden Sie hochwertige Modellautos – ob Oldtimer, Sportwagen, Lkw's oder Motorräder.
|
||
Perfekt für Sammler, Bastler und Fans.
|
||
</p>
|
||
</section>
|
||
|
||
<!-- Hauptinhalt -->
|
||
<h1>Unsere Neusten Produkte: </h1>
|
||
<section class="card-grid" id="latest-products">
|
||
<!-- Dynamische Produkte (5 aktuelle Produkte) -->
|
||
</section>
|
||
|
||
<!-- JavaScript zum Abrufen und Anzeigen der neuesten Produkte -->
|
||
<script>
|
||
// API-Aufruf
|
||
fetch('/api/products/new')
|
||
// Antwort als JSON parsen
|
||
.then(res => res.json())
|
||
.then(products => {
|
||
const container = document.getElementById('latest-products');
|
||
container.innerHTML = ''; // sicherheitshalber leeren
|
||
|
||
// Für jedes Produkt eine Karte erzeugen
|
||
products.forEach(product => {
|
||
const card = document.createElement('div');
|
||
card.classList.add('card');
|
||
// HTML-Inhalt der Karte mit Produktdaten füllen
|
||
card.innerHTML = `
|
||
<img src="${product.image_url}" alt="${product.name}">
|
||
<h3>${product.name}</h3>
|
||
<p>Preis: ${product.price}€</p>
|
||
<p>${product.description}</p>
|
||
<button class="add-to-cart" data-id="${product.id}">Zum Warenkorb hinzufügen</button>
|
||
`;
|
||
// Karte in Container einfügen
|
||
container.appendChild(card);
|
||
});
|
||
})
|
||
.catch(err => {
|
||
console.error('Fehler beim Laden der neuesten Produkte:', err);
|
||
|
||
const container = document.getElementById('latest-products');
|
||
container.innerHTML =
|
||
`<div class="error-message">
|
||
<h3>Fehler beim Laden der Produkte</h3>
|
||
<p>Es gab ein Problem beim Abrufen der Produktdaten.<br>Wir arbeiten bereits daran – bitte versuchen Sie es später erneut.</p>
|
||
</div>`;
|
||
});
|
||
</script>
|
||
|
||
|
||
<!-- Info-Sektion -->
|
||
<section class="info-cards-section">
|
||
<div class="info-card">
|
||
<i class='bx bx-package'></i>
|
||
<h3>Versandkostenfrei ab 50€</h3>
|
||
<p>Schneller & sicherer Versand mit Sendungsverfolgung.</p>
|
||
</div>
|
||
<div class="info-card">
|
||
<i class='bx bx-credit-card'></i>
|
||
<h3>Flexible Zahlungsmethoden</h3>
|
||
<p>PayPal, Kreditkarte, Klarna, Vorkasse – Sie haben die Wahl.</p>
|
||
</div>
|
||
<div class="info-card">
|
||
<i class='bx bx-undo'></i>
|
||
<h3>14 Tage Rückgaberecht</h3>
|
||
<p>Unzufrieden? Kein Problem – Rückgabe einfach & unkompliziert.</p>
|
||
</div>
|
||
<div class="info-card">
|
||
<i class='bx bx-star'></i>
|
||
<h3>Top-Bewertungen</h3>
|
||
<p>Unsere Kunden lieben uns – überzeugen Sie sich selbst!</p>
|
||
</div>
|
||
</section>
|
||
</main>
|
||
|
||
<!-- Fußzeiele -->
|
||
<div id="footer"></div>
|
||
|
||
</div>
|
||
<!-- Wrapper für die gesamte Seite -->
|
||
<div class="wrapper">
|
||
<!-- Header -->
|
||
<header>
|
||
<h1>Autohändler Webshop</h1>
|
||
<div class="header-right">
|
||
<a href="/login" class="login-btn">Login</a>
|
||
<a href="/warenkorb" class="cart">
|
||
<i class='bx bx-cart'></i>
|
||
<span class="cart-count">0</span>
|
||
</a>
|
||
</div>
|
||
</header>
|
||
|
||
<!-- Navigationsleiste -->
|
||
<nav class="menu">
|
||
<ul class="menu-list">
|
||
<li class="menu-item">
|
||
<a href="#">Startseite</a>
|
||
</li>
|
||
<li class="menu-item">
|
||
<a href="#">Neuwagen</a>
|
||
</li>
|
||
<li class="menu-item">
|
||
<a href="#">Gebrauchtwagen</a>
|
||
</li>
|
||
<li class="menu-item">
|
||
<a href="#">Angebote</a>
|
||
</li>
|
||
<li class="menu-item">
|
||
<a href="#">Kontakt</a>
|
||
</li>
|
||
</ul>
|
||
</nav>
|
||
|
||
<!-- Hauptinhalt -->
|
||
<main>
|
||
<div class="search-bar">
|
||
<input type="text" placeholder="Marke oder Modell eingeben">
|
||
<select>
|
||
<option>Fahrzeugtyp</option>
|
||
<option>SUV</option>
|
||
<option>Limousine</option>
|
||
<option>Kombi</option>
|
||
</select>
|
||
<select>
|
||
<option>Preisspanne</option>
|
||
<option>Bis 10.000€</option>
|
||
<option>Bis 20.000€</option>
|
||
<option>Bis 50.000€</option>
|
||
</select>
|
||
<button>Suchen</button>
|
||
</div>
|
||
|
||
<section class="card-grid">
|
||
<div class="card">
|
||
<img src="https://via.placeholder.com/150" alt="Auto">
|
||
<h3>BMW 3er Limousine</h3>
|
||
<p>Preis: 35.000€</p>
|
||
<p>Baujahr: 2020 | Kilometerstand: 20.000 km</p>
|
||
<button class="add-to-cart">Zum Warenkorb hinzufügen</button>
|
||
</div>
|
||
<div class="card">
|
||
<img src="https://via.placeholder.com/150" alt="Auto">
|
||
<h3>Audi Q5</h3>
|
||
<p>Preis: 50.000€</p>
|
||
<p>Baujahr: 2022 | Kilometerstand: 10.000 km</p>
|
||
<button class="add-to-cart">Zum Warenkorb hinzufügen</button>
|
||
</div>
|
||
</section>
|
||
</main>
|
||
</div>
|
||
<!-- Scripts -->
|
||
<script src="startseite.js"></script>
|
||
</body>
|
||
</html>
|