Spaces:
Sleeping
Sleeping
Update templates/Menu.html
Browse files- templates/Menu.html +144 -41
templates/Menu.html
CHANGED
@@ -11,97 +11,200 @@
|
|
11 |
margin: 0;
|
12 |
padding: 0;
|
13 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
.container {
|
15 |
-
max-width:
|
16 |
margin: 20px auto;
|
17 |
background: white;
|
18 |
padding: 20px;
|
19 |
border-radius: 10px;
|
20 |
-
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.
|
21 |
}
|
|
|
|
|
22 |
.menu-item {
|
23 |
display: flex;
|
24 |
justify-content: space-between;
|
25 |
align-items: center;
|
26 |
padding: 15px;
|
27 |
border-bottom: 1px solid #ddd;
|
28 |
-
|
29 |
-
.menu-item img {
|
30 |
-
width: 120px;
|
31 |
-
height: 120px;
|
32 |
border-radius: 10px;
|
33 |
-
|
|
|
34 |
}
|
35 |
.menu-details {
|
36 |
flex-grow: 1;
|
37 |
-
padding:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
}
|
39 |
.menu-details h3 {
|
40 |
-
margin: 0;
|
41 |
font-size: 18px;
|
42 |
font-weight: bold;
|
43 |
}
|
44 |
-
.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
margin: 5px 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
color: #666;
|
|
|
47 |
}
|
48 |
.add-container {
|
49 |
position: relative;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
}
|
51 |
.add-btn {
|
52 |
background: #28a745;
|
53 |
color: white;
|
54 |
border: none;
|
55 |
-
padding:
|
56 |
cursor: pointer;
|
57 |
border-radius: 5px;
|
58 |
font-weight: bold;
|
59 |
-
|
|
|
|
|
|
|
60 |
}
|
61 |
.customizable {
|
62 |
font-size: 12px;
|
63 |
color: gray;
|
64 |
-
|
65 |
}
|
66 |
</style>
|
67 |
</head>
|
68 |
<body>
|
69 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
<div class="container">
|
71 |
<h2>Food Menu</h2>
|
72 |
<div id="menu"></div>
|
73 |
</div>
|
74 |
|
75 |
-
|
76 |
-
async function
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
102 |
}
|
103 |
|
104 |
-
document.addEventListener("DOMContentLoaded",
|
105 |
</script>
|
|
|
106 |
</body>
|
107 |
</html>
|
|
|
11 |
margin: 0;
|
12 |
padding: 0;
|
13 |
}
|
14 |
+
/* Header */
|
15 |
+
.header {
|
16 |
+
background: white;
|
17 |
+
padding: 15px 20px;
|
18 |
+
display: flex;
|
19 |
+
justify-content: space-between;
|
20 |
+
align-items: center;
|
21 |
+
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
|
22 |
+
}
|
23 |
+
.logo {
|
24 |
+
font-size: 22px;
|
25 |
+
font-weight: bold;
|
26 |
+
color: #28a745;
|
27 |
+
}
|
28 |
+
.nav-links {
|
29 |
+
list-style: none;
|
30 |
+
display: flex;
|
31 |
+
gap: 20px;
|
32 |
+
margin: 0;
|
33 |
+
padding: 0;
|
34 |
+
}
|
35 |
+
.nav-links li {
|
36 |
+
display: inline;
|
37 |
+
}
|
38 |
+
.nav-links a {
|
39 |
+
text-decoration: none;
|
40 |
+
color: #333;
|
41 |
+
font-weight: bold;
|
42 |
+
}
|
43 |
+
.cart-btn {
|
44 |
+
background: #28a745;
|
45 |
+
color: white;
|
46 |
+
border: none;
|
47 |
+
padding: 8px 15px;
|
48 |
+
cursor: pointer;
|
49 |
+
border-radius: 5px;
|
50 |
+
font-weight: bold;
|
51 |
+
}
|
52 |
+
|
53 |
+
/* Main Container */
|
54 |
.container {
|
55 |
+
max-width: 800px;
|
56 |
margin: 20px auto;
|
57 |
background: white;
|
58 |
padding: 20px;
|
59 |
border-radius: 10px;
|
60 |
+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
|
61 |
}
|
62 |
+
|
63 |
+
/* Menu Items */
|
64 |
.menu-item {
|
65 |
display: flex;
|
66 |
justify-content: space-between;
|
67 |
align-items: center;
|
68 |
padding: 15px;
|
69 |
border-bottom: 1px solid #ddd;
|
70 |
+
background: white;
|
|
|
|
|
|
|
71 |
border-radius: 10px;
|
72 |
+
margin-bottom: 15px;
|
73 |
+
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
|
74 |
}
|
75 |
.menu-details {
|
76 |
flex-grow: 1;
|
77 |
+
padding-right: 15px;
|
78 |
+
}
|
79 |
+
.bestseller {
|
80 |
+
color: #ff5733;
|
81 |
+
font-size: 14px;
|
82 |
+
font-weight: bold;
|
83 |
+
display: flex;
|
84 |
+
align-items: center;
|
85 |
+
margin-bottom: 5px;
|
86 |
}
|
87 |
.menu-details h3 {
|
88 |
+
margin: 5px 0;
|
89 |
font-size: 18px;
|
90 |
font-weight: bold;
|
91 |
}
|
92 |
+
.price {
|
93 |
+
font-weight: bold;
|
94 |
+
font-size: 18px;
|
95 |
+
}
|
96 |
+
.rating {
|
97 |
+
display: flex;
|
98 |
+
align-items: center;
|
99 |
+
font-size: 14px;
|
100 |
margin: 5px 0;
|
101 |
+
}
|
102 |
+
.save-btn {
|
103 |
+
background: #f8d7da;
|
104 |
+
border: none;
|
105 |
+
padding: 5px 10px;
|
106 |
+
border-radius: 15px;
|
107 |
+
font-size: 12px;
|
108 |
+
color: #c82333;
|
109 |
+
cursor: pointer;
|
110 |
+
display: inline-flex;
|
111 |
+
align-items: center;
|
112 |
+
margin-top: 5px;
|
113 |
+
}
|
114 |
+
.description {
|
115 |
+
font-size: 14px;
|
116 |
color: #666;
|
117 |
+
margin-top: 5px;
|
118 |
}
|
119 |
.add-container {
|
120 |
position: relative;
|
121 |
+
text-align: center;
|
122 |
+
}
|
123 |
+
.menu-img {
|
124 |
+
width: 120px;
|
125 |
+
height: 120px;
|
126 |
+
border-radius: 10px;
|
127 |
+
object-fit: cover;
|
128 |
+
display: block;
|
129 |
}
|
130 |
.add-btn {
|
131 |
background: #28a745;
|
132 |
color: white;
|
133 |
border: none;
|
134 |
+
padding: 8px 15px;
|
135 |
cursor: pointer;
|
136 |
border-radius: 5px;
|
137 |
font-weight: bold;
|
138 |
+
position: absolute;
|
139 |
+
bottom: 10px;
|
140 |
+
left: 50%;
|
141 |
+
transform: translateX(-50%);
|
142 |
}
|
143 |
.customizable {
|
144 |
font-size: 12px;
|
145 |
color: gray;
|
146 |
+
margin-top: 5px;
|
147 |
}
|
148 |
</style>
|
149 |
</head>
|
150 |
<body>
|
151 |
|
152 |
+
<!-- Header Section -->
|
153 |
+
<header class="header">
|
154 |
+
<div class="logo">FoodiePlace</div>
|
155 |
+
<ul class="nav-links">
|
156 |
+
<li><a href="#">Menu</a></li>
|
157 |
+
<li><a href="#">Orders</a></li>
|
158 |
+
<li><a href="#">Cart</a></li>
|
159 |
+
<li><a href="#">Profile</a></li>
|
160 |
+
</ul>
|
161 |
+
<button class="cart-btn">Cart</button>
|
162 |
+
</header>
|
163 |
+
|
164 |
+
<!-- Main Content -->
|
165 |
<div class="container">
|
166 |
<h2>Food Menu</h2>
|
167 |
<div id="menu"></div>
|
168 |
</div>
|
169 |
|
170 |
+
<script>
|
171 |
+
async function fetchMenu() {
|
172 |
+
try {
|
173 |
+
const response = await fetch('/get_menu'); // Replace with your API endpoint
|
174 |
+
const menuItems = await response.json();
|
175 |
+
const menuContainer = document.getElementById("menu");
|
176 |
+
menuContainer.innerHTML = "";
|
177 |
+
menuItems.forEach(item => {
|
178 |
+
const menuItem = document.createElement("div");
|
179 |
+
menuItem.classList.add("menu-item");
|
180 |
+
menuItem.innerHTML = `
|
181 |
+
<div class="menu-details">
|
182 |
+
<div class="bestseller">
|
183 |
+
<img src="bestseller-icon.png" alt="Best Seller"> Bestseller
|
184 |
+
</div>
|
185 |
+
<h3>${item.Name}</h3>
|
186 |
+
<p class="price">$${item.Price__c}</p>
|
187 |
+
<div class="rating">
|
188 |
+
⭐ 4.2 (206)
|
189 |
+
</div>
|
190 |
+
<button class="save-btn">❤️ Save to Eatlist</button>
|
191 |
+
<p class="description">A flavorful dish with fresh ingredients... more</p>
|
192 |
+
</div>
|
193 |
+
<div class="add-container">
|
194 |
+
<img class="menu-img" src="${item.Image1__c}" alt="${item.Name}">
|
195 |
+
<button class="add-btn">ADD</button>
|
196 |
+
<p class="customizable">Customisable</p>
|
197 |
+
</div>
|
198 |
+
`;
|
199 |
+
menuContainer.appendChild(menuItem);
|
200 |
+
});
|
201 |
+
} catch (error) {
|
202 |
+
console.error("Error fetching menu:", error);
|
203 |
+
}
|
204 |
}
|
205 |
|
206 |
+
document.addEventListener("DOMContentLoaded", fetchMenu);
|
207 |
</script>
|
208 |
+
|
209 |
</body>
|
210 |
</html>
|