Spaces:
Sleeping
Sleeping
Update templates/menu.html
Browse files- templates/menu.html +92 -3
templates/menu.html
CHANGED
@@ -7,6 +7,59 @@
|
|
7 |
<!-- Bootstrap CSS -->
|
8 |
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
|
9 |
<style>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
body {
|
11 |
font-family: Arial, sans-serif;
|
12 |
background-color: #f8f9fa;
|
@@ -206,7 +259,7 @@
|
|
206 |
</div>
|
207 |
|
208 |
<!-- Avatar and Dropdown -->
|
209 |
-
<div class="avatar-dropdown-container">
|
210 |
<div class="avatar-icon">
|
211 |
<!-- Use the first letter of the user's name for the avatar -->
|
212 |
<span>{{ first_letter }}</span> <!-- Display the first letter of the customer's name -->
|
@@ -217,8 +270,20 @@
|
|
217 |
<a href="{{ url_for('order_history') }}" class="dropdown-item">Order History</a>
|
218 |
<a href="{{ url_for('logout') }}" class="dropdown-item">Logout</a>
|
219 |
</div>
|
|
|
|
|
|
|
|
|
220 |
</div>
|
221 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
222 |
|
223 |
<div class="container mt-4">
|
224 |
<h1 class="text-center">Menu</h1>
|
@@ -507,7 +572,31 @@
|
|
507 |
|
508 |
// Run the function when the page loads
|
509 |
window.onload = roundRewardPoints;
|
510 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
511 |
|
512 |
</script>
|
513 |
|
|
|
7 |
<!-- Bootstrap CSS -->
|
8 |
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
|
9 |
<style>
|
10 |
+
/* avthar */
|
11 |
+
.avatar-dropdown-container {
|
12 |
+
position: relative;
|
13 |
+
display: inline-block;
|
14 |
+
}
|
15 |
+
|
16 |
+
.avatar-icon {
|
17 |
+
width: 50px;
|
18 |
+
height: 50px;
|
19 |
+
border-radius: 50%;
|
20 |
+
overflow: hidden;
|
21 |
+
display: flex;
|
22 |
+
justify-content: center;
|
23 |
+
align-items: center;
|
24 |
+
background-color: #f0f0f0;
|
25 |
+
cursor: pointer; /* Allow clicking to upload */
|
26 |
+
}
|
27 |
+
|
28 |
+
.avatar-img {
|
29 |
+
width: 100%;
|
30 |
+
height: 100%;
|
31 |
+
object-fit: cover;
|
32 |
+
border-radius: 50%;
|
33 |
+
}
|
34 |
+
|
35 |
+
.dropdown-menu {
|
36 |
+
display: none;
|
37 |
+
position: absolute;
|
38 |
+
background: white;
|
39 |
+
box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1);
|
40 |
+
padding: 10px;
|
41 |
+
border-radius: 5px;
|
42 |
+
}
|
43 |
+
|
44 |
+
.avatar-dropdown-container:hover .dropdown-menu {
|
45 |
+
display: block;
|
46 |
+
}
|
47 |
+
|
48 |
+
.dropdown-item {
|
49 |
+
display: block;
|
50 |
+
padding: 5px 10px;
|
51 |
+
text-decoration: none;
|
52 |
+
color: black;
|
53 |
+
}
|
54 |
+
|
55 |
+
.dropdown-item:hover {
|
56 |
+
background-color: #f0f0f0;
|
57 |
+
}
|
58 |
+
|
59 |
+
|
60 |
+
|
61 |
+
|
62 |
+
|
63 |
body {
|
64 |
font-family: Arial, sans-serif;
|
65 |
background-color: #f8f9fa;
|
|
|
259 |
</div>
|
260 |
|
261 |
<!-- Avatar and Dropdown -->
|
262 |
+
<!-- <div class="avatar-dropdown-container">
|
263 |
<div class="avatar-icon">
|
264 |
<!-- Use the first letter of the user's name for the avatar -->
|
265 |
<span>{{ first_letter }}</span> <!-- Display the first letter of the customer's name -->
|
|
|
270 |
<a href="{{ url_for('order_history') }}" class="dropdown-item">Order History</a>
|
271 |
<a href="{{ url_for('logout') }}" class="dropdown-item">Logout</a>
|
272 |
</div>
|
273 |
+
</div> -->
|
274 |
+
<div class="avatar-dropdown-container">
|
275 |
+
<div class="avatar-icon" onclick="document.getElementById('imageUpload').click()">
|
276 |
+
<img id="avatarImage" src="path/to/default-avatar.png" alt="User Avatar" class="avatar-img">
|
277 |
</div>
|
278 |
+
<input type="file" id="imageUpload" accept="image/*" style="display: none" onchange="previewImage(event)">
|
279 |
+
|
280 |
+
<div class="dropdown-menu">
|
281 |
+
<a href="{{ url_for('customer_details') }}" class="dropdown-item">View Profile</a>
|
282 |
+
<a href="{{ url_for('order_history') }}" class="dropdown-item">Order History</a>
|
283 |
+
<a href="{{ url_for('logout') }}" class="dropdown-item">Logout</a>
|
284 |
+
</div>
|
285 |
+
</div>
|
286 |
+
<!-- </div> -->
|
287 |
|
288 |
<div class="container mt-4">
|
289 |
<h1 class="text-center">Menu</h1>
|
|
|
572 |
|
573 |
// Run the function when the page loads
|
574 |
window.onload = roundRewardPoints;
|
575 |
+
|
576 |
+
// avathar script
|
577 |
+
|
578 |
+
// Default avatar image
|
579 |
+
const defaultAvatar = "path/to/default-avatar.png"; // Replace with actual path
|
580 |
+
const avatarImage = document.getElementById("avatarImage");
|
581 |
+
const storedImage = localStorage.getItem("userAvatar");
|
582 |
+
|
583 |
+
// If user has previously uploaded an image, load it
|
584 |
+
if (storedImage) {
|
585 |
+
avatarImage.src = storedImage;
|
586 |
+
}
|
587 |
+
|
588 |
+
// Function to preview and save uploaded image
|
589 |
+
function previewImage(event) {
|
590 |
+
const file = event.target.files[0];
|
591 |
+
if (file) {
|
592 |
+
const reader = new FileReader();
|
593 |
+
reader.onload = function(e) {
|
594 |
+
avatarImage.src = e.target.result; // Set new image
|
595 |
+
localStorage.setItem("userAvatar", e.target.result); // Store in localStorage
|
596 |
+
};
|
597 |
+
reader.readAsDataURL(file);
|
598 |
+
}
|
599 |
+
}
|
600 |
|
601 |
</script>
|
602 |
|