Max Theme

This commit is contained in:
Maximilian Giller 2024-10-10 17:14:50 +02:00
parent b4f24abae0
commit 0d54983850

View file

@ -1,61 +1,63 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<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">
<title>{{ wishlist.config.title }}</title> <title>{{ wishlist.config.title }}</title>
<style> <style>
/* Same base styles from the previous version */
body { body {
font-family: Arial, sans-serif; background-color: #1a1a1a;
background-color: #f4f4f4; color: #aaa;
font-family: "Fira Code", "Fira Mono", "Roboto Mono", "Lucida Console", "Courier New", monospace;
font-size: 16px;
line-height: 1.5;
margin: 0; margin: 0;
padding: 20px; padding: 0;
} }
h1, h3 { h1, h3 {
text-align: center; text-align: center;
color: #333; color: #fff;
} }
ul { ul {
list-style: none; list-style: none;
padding: 0; padding: 0;
margin: 20px auto;
max-width: 800px;
} }
li { li {
background-color: #fff; background-color: #2c2c2c;
margin: 10px 0; margin: 10px 0;
padding: 15px; padding: 20px;
border-radius: 8px; border-radius: 8px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); display: flex;
position: relative; justify-content: space-between;
align-items: center;
} }
h2 { h2 {
margin: 0 0 10px; margin: 0;
color: #2c3e50; color: #fff;
} }
p { p {
color: #7f8c8d; color: #888;
font-size: 14px; font-size: 14px;
} }
a { a {
color: #3498db; color: #3498db;
text-decoration: none; text-decoration: none;
transition: background-color 0.2s;
} }
a:hover { a:hover {
text-decoration: underline; background-color: #444;
} padding: 2px 5px;
border-radius: 3px;
img {
margin-top: 10px;
border-radius: 5px;
max-width: 150px;
display: block;
} }
.price { .price {
@ -63,115 +65,132 @@
color: #27ae60; color: #27ae60;
} }
hr { img {
border: none; max-width: 100px;
border-top: 1px solid #eee; border-radius: 8px;
margin: 20px 0;
} }
.reserve-button { .reserve-button {
background-color: #3498db; background-color: #444;
color: white; color: white;
border: none; border: none;
padding: 10px; padding: 8px 15px;
cursor: pointer; cursor: pointer;
border-radius: 5px; border-radius: 5px;
transition: background-color 0.3s;
} }
.reserve-button:hover { .reserve-button:hover {
background-color: #2980b9; background-color: #666;
} }
hr {
border: 0;
border-top: 1px solid #333;
}
/* Collapsed reserved items */
.reserved-item { .reserved-item {
background-color: #f9e79f; background-color: #444;
}
form {
margin-top: 10px;
} }
input[type="text"] { input[type="text"] {
padding: 8px; padding: 8px;
border: 1px solid #ccc; background-color: #333;
border: 1px solid #555;
color: #ccc;
border-radius: 4px; border-radius: 4px;
} }
@media (min-width: 768px) { form {
li { display: flex;
display: flex; flex-direction: column;
align-items: center; gap: 10px;
justify-content: space-between;
}
img {
max-width: 100px;
margin-left: 20px;
}
} }
/* Collapsible section */
.collapsible {
background-color: #2c2c2c;
padding: 15px;
text-align: center;
cursor: pointer;
border-radius: 8px;
}
.collapsible:hover {
background-color: #333;
}
#reserved-items {
display: none;
}
</style> </style>
</head> </head>
<body> <body>
<h1>{{ wishlist.config.title }}</h1> <h1>{{ wishlist.config.title }}</h1>
<ul> <ul>
<!-- Loop through unreserved items --> {% for item_id, item in wishlist.items.items() if not item.reserved %}
{% for item_id, item in wishlist.items.items() if not item.is_reserved %}
<li> <li>
<div> <div>
<h2>{{ item.name }}</h2> <h2>{{ item.name }}</h2>
<p>{{ item.description }}</p> <p>{{ item.description }}</p>
<p class="price">Price: €{{ "%.2f"|format(item.price) }}</p> <p class="price">€{{ "%.2f"|format(item.price) }}</p>
<a href="{{ item.shop }}" target="_blank">Shop Link</a> <a href="{{ item.shop }}" target="_blank">Shop Link</a>
<!-- Form for reserving the item --> <!-- Reserve Form -->
<form method="POST" action="/reserve-item"> <form method="POST" action="/reserve-item">
<input type="hidden" name="wishlist_id" value="{{ wishlist.config.id }}"> <input type="hidden" name="wishlist_id" value="{{ wishlist.config.id }}">
<input type="hidden" name="item_id" value="{{ item.id }}"> <input type="hidden" name="item_id" value="{{ item.id }}">
<input type="hidden" name="reserved" value="true"> <input type="hidden" name="reserved" value="true">
<label for="name_{{ item_id }}">Reserve for:</label> <input type="text" name="reserver_name" placeholder="Your name" required>
<input type="text" id="name_{{ item_id }}" name="reserver_name" placeholder="Your name"> <button type="submit" class="reserve-button">Reserve</button>
<button class="reserve-button" type="submit">Reserve</button>
</form> </form>
</div> </div>
<img src="{{ item.image }}" alt="{{ item.name }}"> <img src="{{ item.image }}" alt="{{ item.name }}">
</li> </li>
<hr> <hr>
{% endfor %} {% endfor %}
</ul> </ul>
<!-- Collapsible section for reserved items --> <!-- Collapsible Reserved Items -->
<h3>Reserved Items (click to expand/collapse)</h3> <div class="collapsible" onclick="toggleReservedItems()">Show Reserved Items</div>
<ul id="reserved-items" style="display:none;"> <ul id="reserved-items">
{% for item_id, item in wishlist.items.items() if item.is_reserved %} {% for item_id, item in wishlist.items.items() if item.reserved %}
<li class="reserved-item"> <li class="reserved-item">
<div> <div>
<h2>{{ item.name }} (Reserved)</h2> <h2>{{ item.name }} (Reserved)</h2>
<p>{{ item.description }}</p> <p>{{ item.description }}</p>
<p class="price">Price: €{{ "%.2f"|format(item.price) }}</p> <p class="price">€{{ "%.2f"|format(item.price) }}</p>
<a href="{{ item.shop }}" target="_blank">Shop Link</a> <a href="{{ item.shop }}" target="_blank">Shop Link</a>
<!-- Form for unreserving the item --> <!-- Unreserve Form -->
<form method="POST" action="/reserve-item"> <form method="POST" action="/reserve-item">
<input type="hidden" name="wishlist_id" value="{{ wishlist.config.id }}"> <input type="hidden" name="wishlist_id" value="{{ wishlist.config.id }}">
<input type="hidden" name="item_id" value="{{ item.id }}"> <input type="hidden" name="item_id" value="{{ item.id }}">
<input type="hidden" name="reserved" value="false"> <input type="hidden" name="reserved" value="false">
<label for="name_{{ item_id }}">Reserved by:</label> <input type="text" name="reserver_name" value="{{ item.reserver_name }}" readonly>
<input type="text" id="name_{{ item_id }}" name="reserver_name" value="{{ item.reservation.name }}" readonly> <button type="submit" class="reserve-button">Unreserve</button>
<button class="reserve-button" type="submit">Unreserve</button>
</form> </form>
</div> </div>
<img src="{{ item.image }}" alt="{{ item.name }}"> <img src="{{ item.image }}" alt="{{ item.name }}">
</li> </li>
<hr> <hr>
{% endfor %} {% endfor %}
</ul> </ul>
<script> <script>
// Toggle display of reserved items function toggleReservedItems() {
document.querySelector('h3').addEventListener('click', function() {
const reservedItems = document.getElementById('reserved-items'); const reservedItems = document.getElementById('reserved-items');
reservedItems.style.display = (reservedItems.style.display === 'none') ? 'block' : 'none'; if (reservedItems.style.display === 'none' || reservedItems.style.display === '') {
}); reservedItems.style.display = 'block';
} else {
reservedItems.style.display = 'none';
}
}
</script> </script>
</body> </body>
</html> </html>