mirror of
https://github.com/Alvin-Zilverstand/Schoolkantine.git
synced 2026-03-06 21:36:27 +01:00
gg
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
/* Winkelmandje sectie */
|
/* Winkelmandje sectie */
|
||||||
.cart {
|
.cart {
|
||||||
width: 20%;
|
width: 15%;
|
||||||
background-color: #fff; /* Change background color to white */
|
background-color: #fff; /* Change background color to white */
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
@@ -1,20 +1,17 @@
|
|||||||
|
|
||||||
|
|
||||||
// Array to hold items added to the shopping cart
|
// Array to hold items added to the shopping cart
|
||||||
const cart = [];
|
const cart = [];
|
||||||
|
let cartCount = 0; // Initialize cart count
|
||||||
|
|
||||||
|
// Function to add an item to the shopping cart
|
||||||
|
|
||||||
// Functie om een item aan het winkelwagentje toe te voegen
|
|
||||||
function addToCart(item) {
|
function addToCart(item) {
|
||||||
cart.unshift(item); // Add item to the beginning of the cart array
|
cart.unshift(item); // Add item to the beginning of the cart array
|
||||||
updateCart();
|
updateCart();
|
||||||
|
cartCount++; // Increment cart count
|
||||||
|
updateCartCountDisplay(); // Update the cart count display
|
||||||
closeModal();
|
closeModal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Function to update the shopping cart display
|
||||||
|
|
||||||
// Functie om het winkelwagentje bij te werken
|
|
||||||
function updateCart() {
|
function updateCart() {
|
||||||
const cartItemsContainer = document.getElementById("cart-items");
|
const cartItemsContainer = document.getElementById("cart-items");
|
||||||
cartItemsContainer.innerHTML = '';
|
cartItemsContainer.innerHTML = '';
|
||||||
@@ -41,19 +38,32 @@ function updateCart() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Function to remove an item from the shopping cart
|
||||||
// Functie om een item uit het winkelwagentje te verwijderen
|
|
||||||
function removeFromCart(index) {
|
function removeFromCart(index) {
|
||||||
cart.splice(index, 1);
|
cart.splice(index, 1);
|
||||||
updateCart();
|
updateCart();
|
||||||
|
cartCount--; // Decrement cart count
|
||||||
|
updateCartCountDisplay(); // Update the cart count display
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initial call to updateCart to ensure the button is hidden on page load
|
// Function to update the cart count display
|
||||||
updateCart();
|
function updateCartCountDisplay() {
|
||||||
|
const cartCountElement = document.getElementById("cart-count"); // Get the element to display the count
|
||||||
|
if (cartCountElement) { // Check if the element exists
|
||||||
|
cartCountElement.textContent = cartCount; // Update the text content with the cart count
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Functie om het modaal venster te sluiten
|
|
||||||
|
// Initial calls
|
||||||
|
updateCart();
|
||||||
|
updateCartCountDisplay(); // Initialize the cart count on page load
|
||||||
|
|
||||||
|
|
||||||
|
// Function to close the modal window
|
||||||
function closeModal() {
|
function closeModal() {
|
||||||
document.getElementById('modal').style.display = 'none';
|
document.getElementById('modal').style.display = 'none';
|
||||||
|
<<<<<<< HEAD:website/cart.js
|
||||||
}
|
}
|
||||||
|
|
||||||
let cartCount = 0;
|
let cartCount = 0;
|
||||||
@@ -62,3 +72,6 @@ function addToCart() {
|
|||||||
cartCount++;
|
cartCount++;
|
||||||
document.querySelector('.cart-count').textContent = cartCount;
|
document.querySelector('.cart-count').textContent = cartCount;
|
||||||
}
|
}
|
||||||
|
=======
|
||||||
|
}
|
||||||
|
>>>>>>> 1f418f9c8547c52f6394b681eb5ce02ee196b69a:website/Cart/cart.js
|
||||||
0
website/Html categorieën/Deals.html
Normal file
0
website/Html categorieën/Deals.html
Normal file
0
website/Html categorieën/Deserts.html
Normal file
0
website/Html categorieën/Deserts.html
Normal file
0
website/Html categorieën/Koude dranken.html
Normal file
0
website/Html categorieën/Koude dranken.html
Normal file
0
website/Html categorieën/Salades.html
Normal file
0
website/Html categorieën/Salades.html
Normal file
0
website/Html categorieën/Snacks.html
Normal file
0
website/Html categorieën/Snacks.html
Normal file
0
website/Html categorieën/Soepen.html
Normal file
0
website/Html categorieën/Soepen.html
Normal file
0
website/Html categorieën/Warme dranken.html
Normal file
0
website/Html categorieën/Warme dranken.html
Normal file
@@ -5,7 +5,8 @@
|
|||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>Het hoofdmenu van de Mees</title>
|
<title>Het hoofdmenu van de Mees</title>
|
||||||
<link rel="stylesheet" href="style.css">
|
<link rel="stylesheet" href="style.css">
|
||||||
<link rel="stylesheet" href="cart.css">
|
<link rel="stylesheet" href="Cart/cart.css">
|
||||||
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
|
||||||
<link rel="icon" href="media/favicon.ico" type="image/x-icon">
|
<link rel="icon" href="media/favicon.ico" type="image/x-icon">
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
@@ -23,6 +24,7 @@
|
|||||||
<div class="menu-item" onclick="showCategory('Deals')">Deals</div>
|
<div class="menu-item" onclick="showCategory('Deals')">Deals</div>
|
||||||
<div class="menu-item" onclick="showCategory('Soepen')">Soepen</div>
|
<div class="menu-item" onclick="showCategory('Soepen')">Soepen</div>
|
||||||
<div class="menu-item" onclick="showCategory('Salades')">Salades</div>
|
<div class="menu-item" onclick="showCategory('Salades')">Salades</div>
|
||||||
|
<div class="menu-item" onclick="showCategory('Sausjes')">Sausjes</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Productweergave -->
|
<!-- Productweergave -->
|
||||||
@@ -52,23 +54,19 @@
|
|||||||
<button id="order-button">Bestellen</button>
|
<button id="order-button">Bestellen</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- Winkelwagen icoon -->
|
||||||
|
<div class="cart-icon">
|
||||||
|
<i class="fas fa-shopping-cart"></i>
|
||||||
|
<span id="cart-count" class="cart-count">0</span> <!-- Aantal producten -->
|
||||||
|
</div>
|
||||||
|
|
||||||
<footer>
|
<footer>
|
||||||
<p>© 2025 Vista </p>
|
<p>© 2025 Vista </p>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<script src="script.js"></script>
|
<script src="script.js"></script>
|
||||||
<script src="cart.js"></script>
|
<script src="Cart/cart.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
|
|
||||||
<!-- Winkelwagen icoon -->
|
|
||||||
<div class="cart-icon">
|
|
||||||
<i class="fas fa-shopping-cart"></i>
|
|
||||||
<span class="cart-count">0</span> <!-- Aantal producten -->
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ function showCategory(category) {
|
|||||||
|
|
||||||
let items = [];
|
let items = [];
|
||||||
|
|
||||||
|
|
||||||
// Afhankelijk van de gekozen categorie, voeg je de juiste producten toe
|
// Afhankelijk van de gekozen categorie, voeg je de juiste producten toe
|
||||||
if (category === 'Broodjes') {
|
if (category === 'Broodjes') {
|
||||||
items = [
|
items = [
|
||||||
@@ -71,8 +72,12 @@ function showCategory(category) {
|
|||||||
{ title: "Krokante Kip Salade", imageSrc: "media/krokante-kip.jpg", price: 3.00 },
|
{ title: "Krokante Kip Salade", imageSrc: "media/krokante-kip.jpg", price: 3.00 },
|
||||||
{ title: "Aardappel Salade", imageSrc: "media/aardappel.jpg", price: 2.50 },
|
{ title: "Aardappel Salade", imageSrc: "media/aardappel.jpg", price: 2.50 },
|
||||||
];
|
];
|
||||||
|
} else if (category === 'Sausjes') {
|
||||||
|
items = [
|
||||||
|
{ title: "Ketchup", imageSrc: "https://www.ahealthylife.nl/wp-content/uploads/2021/06/Ketchup_voedingswaarde.jpg", price: 0.25 },
|
||||||
|
{ title: "Mayonaise", imageSrc: "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTC4FVmHO_hK3mw43z0fuHv1OFUr-hhsfGe1A&s", price: 0.25 }
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Voeg de items toe aan de weergave
|
// Voeg de items toe aan de weergave
|
||||||
items.forEach(item => {
|
items.forEach(item => {
|
||||||
const productBox = document.createElement('div');
|
const productBox = document.createElement('div');
|
||||||
@@ -126,7 +131,8 @@ function getDescription(title) {
|
|||||||
return "Soep van de dag! (Allergieën? Meld het bij ons!)";
|
return "Soep van de dag! (Allergieën? Meld het bij ons!)";
|
||||||
} else if (title === "Salades") {
|
} else if (title === "Salades") {
|
||||||
return "Een heerlijke salade met verse groenten en een dressing naar keuze.";
|
return "Een heerlijke salade met verse groenten en een dressing naar keuze.";
|
||||||
|
} else if (title === "Sausjes") {
|
||||||
|
return "Kies de saus naar je keuze!";
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>De Welkompagina van de Mees</title>
|
<title>De welkompagina van de Mees</title>
|
||||||
<link rel="stylesheet" href="welcome.css">
|
<link rel="stylesheet" href="welcome.css">
|
||||||
<link rel="icon" href="media/favicon.ico" type="image/x-icon">
|
<link rel="icon" href="media/favicon.ico" type="image/x-icon">
|
||||||
</head>
|
</head>
|
||||||
@@ -12,11 +12,11 @@
|
|||||||
|
|
||||||
<div class="welcome">
|
<div class="welcome">
|
||||||
<div class="circle-wrapper">
|
<div class="circle-wrapper">
|
||||||
<h1>Assesment 2</h1>
|
<h1>Mees</h1>
|
||||||
<p>Van Johnny Kindermann</p>
|
<p>Naar menu</p>
|
||||||
</div>
|
</div>
|
||||||
<a href="index.html">
|
<a href="index.html">
|
||||||
<button>Bestellen</button>
|
<button>Menu</button>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user