113 lines
4.9 KiB
HTML
113 lines
4.9 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="id">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Project 07 - Shopping Cart</title>
|
|
<script src="https://cdn.tailwindcss.com"></script>
|
|
</head>
|
|
<body class="bg-gray-100 p-4">
|
|
<div class="max-w-6xl mx-auto">
|
|
|
|
<h1 class="text-3xl font-bold text-center mb-6">
|
|
Product Catalog
|
|
</h1>
|
|
|
|
<input
|
|
type="search"
|
|
id="searchBox"
|
|
oninput="filterProducts()"
|
|
placeholder="Search product..."
|
|
class="w-full p-3 mb-6 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500"
|
|
>
|
|
|
|
<div id="product-list" class="grid grid-cols-1 lg:grid-cols-3 gap-4"></div>
|
|
|
|
</div>
|
|
|
|
<div class="max-w-6xl mx-auto flex flex-col lg:flex-row gap-6">
|
|
|
|
<!-- Product Catalog Grid -->
|
|
<div class="w-full lg:w-2/3 grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-4">
|
|
|
|
<!-- Product 1 -->
|
|
<div class="bg-white p-4 rounded shadow">
|
|
<img src="images/controller.jpeg" alt="Controller" class="w-full h-40 object-cover mb-4">
|
|
<h3 class="font-bold text-lg">Controller</h3>
|
|
<p class="text-gray-600">Rp 750.000</p>
|
|
<button data-name="Controller" data-price="750000" class="add-to-cart-btn mt-2 bg-blue-500 text-white px-4 py-2 rounded w-full hover:bg-blue-600">Add to Cart</button>
|
|
</div>
|
|
|
|
<!-- Product 2 -->
|
|
<div class="bg-white p-4 rounded shadow">
|
|
<img src="images/headset.png" alt="Headset" class="w-full h-40 object-cover mb-4">
|
|
<h3 class="font-bold text-lg">Headset</h3>
|
|
<p class="text-gray-600">Rp 1.200.000</p>
|
|
<button data-name="Headset" data-price="1200000" class="add-to-cart-btn mt-2 bg-blue-500 text-white px-4 py-2 rounded w-full hover:bg-blue-600">Add to Cart</button>
|
|
</div>
|
|
|
|
<!-- Product 3 -->
|
|
<div class="bg-white p-4 rounded shadow">
|
|
<img src="images/keyboard.jpg" alt="Keyboard" class="w-full h-40 object-cover mb-4">
|
|
<h3 class="font-bold text-lg">Keyboard</h3>
|
|
<p class="text-gray-600">Rp 1.800.000</p>
|
|
<button data-name="Keyboard" data-price="1800000" class="add-to-cart-btn mt-2 bg-blue-500 text-white px-4 py-2 rounded w-full hover:bg-blue-600">Add to Cart</button>
|
|
</div>
|
|
|
|
<!-- Product 4 -->
|
|
<div class="bg-white p-4 rounded shadow">
|
|
<img src="images/laptop.jpg" alt="Laptop" class="w-full h-40 object-cover mb-4">
|
|
<h3 class="font-bold text-lg">Laptop</h3>
|
|
<p class="text-gray-600">Rp 14.985.000</p>
|
|
<button data-name="Laptop" data-price="14985000" class="add-to-cart-btn mt-2 bg-blue-500 text-white px-4 py-2 rounded w-full hover:bg-blue-600">Add to Cart</button>
|
|
</div>
|
|
|
|
<!-- Product 5 -->
|
|
<div class="bg-white p-4 rounded shadow">
|
|
<img src="images/monitor.jpeg" alt="Monitor" class="w-full h-40 object-cover mb-4">
|
|
<h3 class="font-bold text-lg">Monitor</h3>
|
|
<p class="text-gray-600">Rp 3.000.000</p>
|
|
<button data-name="Monitor" data-price="3000000" class="add-to-cart-btn mt-2 bg-blue-500 text-white px-4 py-2 rounded w-full hover:bg-blue-600">Add to Cart</button>
|
|
</div>
|
|
|
|
<!-- Product 6 -->
|
|
<div class="bg-white p-4 rounded shadow">
|
|
<img src="images/mouse_logitech.jpg" alt="Mouse Logitech" class="w-full h-40 object-cover mb-4">
|
|
<h3 class="font-bold text-lg">Mouse Logitech</h3>
|
|
<p class="text-gray-600">Rp 600.000</p>
|
|
<button data-name="Mouse Logitech" data-price="600000" class="add-to-cart-btn mt-2 bg-blue-500 text-white px-4 py-2 rounded w-full hover:bg-blue-600">Add to Cart</button>
|
|
</div>
|
|
<!-- product 7 -->
|
|
<div class="bg-white p-4 rounded shadow">
|
|
<img src="images/speaker.jpeg" alt="speaker" class="w-full h-40 object-cover mb-4">
|
|
<h3 class="font-bold text-lg">speaker</h3>
|
|
<p class="text-gray-600">Rp 800.000</p>
|
|
<button data-name="speaker" data-price="800000" class="add-to-cart-btn mt-2 bg-blue-500 text-white px-4 py-2 rounded w-full hover:bg-blue-600">Add to Cart</button>
|
|
</div>
|
|
|
|
<div class="bg-white p-4 rounded shadow">
|
|
<img src="images/webcam.jpeg" alt="webcam" class="w-full h-40 object-cover mb-4">
|
|
<h3 class="font-bold text-lg">webcam</h3>
|
|
<p class="text-gray-600">Rp 1.200.000</p>
|
|
<button data-name="webcam" data-price="1200000" class="add-to-cart-btn mt-2 bg-blue-500 text-white px-4 py-2 rounded w-full hover:bg-blue-600">Add to Cart</button>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
<div class="w-full lg:w-1/3 bg-white p-6 rounded shadow h-fit">
|
|
<h2 class="text-2xl font-bold mb-4">Keranjang Belanja</h2>
|
|
|
|
<p id="empty-cart-msg" class="text-gray-500 italic mb-4">Keranjang masih kosong</p>
|
|
<ul id="cart-items" class="mb-4 space-y-2"></ul>
|
|
|
|
<div class="border-t pt-4 font-bold text-xl">
|
|
Total: Rp <span id="cart-total">0</span>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<script src="javascriptngelu.js"></script>
|
|
</body>
|
|
</html> |