lokesh341 commited on
Commit
be1601b
·
verified ·
1 Parent(s): 934ceb8

Update templates/menu_page.html

Browse files
Files changed (1) hide show
  1. templates/menu_page.html +68 -86
templates/menu_page.html CHANGED
@@ -7,44 +7,17 @@
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;
13
- margin: 0;
14
- padding: 0;
15
- }
16
- .container {
17
- max-width: 900px;
18
- }
19
- .menu-card {
20
- max-width: 350px;
21
- border-radius: 15px;
22
- overflow: hidden;
23
- background-color: #fff;
24
- margin: auto;
25
- }
26
- .menu-image {
27
- height: 200px;
28
- width: 100%;
29
- object-fit: cover;
30
- border-radius: 15px 15px 0 0;
31
- }
32
- .card-title {
33
- font-size: 1.2rem;
34
- font-weight: bold;
35
- }
36
- .card-text {
37
- font-size: 1rem;
38
- color: #6c757d;
39
- }
40
- .btn-primary {
41
- font-size: 0.9rem;
42
- border-radius: 20px;
43
- width: 100px;
44
- }
45
- .filter-container {
46
- margin-bottom: 15px;
47
- }
48
  .view-cart-container {
49
  position: fixed;
50
  bottom: 20px;
@@ -71,88 +44,74 @@
71
  </style>
72
  </head>
73
  <body>
74
- <div class="d-flex justify-content-between align-items-center p-3" style="background-color: #007bff; color: white;">
75
- <div>
76
- <h6>Referral Code: <span id="referral-code">{{ referral_code }}</span></h6>
77
- </div>
78
- <div>
79
- <button onclick="window.location.href='{{ url_for('order_history') }}'" class="btn btn-light" style="color: #007bff; font-weight: bold;">
80
- Order History
81
- </button>
82
- </div>
83
- <div>
84
- <button onclick="window.location.href='{{ url_for('logout') }}'" class="btn btn-light" style="color: #007bff; font-weight: bold;">
85
- Logout
86
- </button>
87
- </div>
88
- <div>
89
- <h6>Reward Points: <span id="reward-points">{{ reward_points }}</span></h6>
90
- </div>
91
- </div>
92
-
93
- <div class="container mt-4">
94
- <h1 class="text-center">Menu</h1>
95
 
 
 
96
  <!-- Buttons to select vegetarian or non-vegetarian menu -->
97
- <div class="text-center mb-4">
98
- <button class="btn btn-success" onclick="showMenu('veg')">Vegetarian Menu</button>
99
- <button class="btn btn-danger" onclick="showMenu('nonVeg')">Non-Vegetarian Menu</button>
100
  </div>
 
 
 
101
 
102
- <!-- Menu Items -->
103
- <div id="menu-items" class="row">
104
- <!-- Dynamically populated menu items will appear here -->
105
- </div>
106
  </div>
107
 
108
  <!-- View Cart Button -->
109
  <div class="view-cart-container">
110
- <a href="/cart" class="view-cart-button">
111
  View Cart
112
  </a>
113
  </div>
114
 
115
  <script>
116
- // Sample data for the menus
117
  const menuItems = {
118
  veg: [
119
  { name: 'Samosa', price: 9, ingredients: 'Potatoes, Peas, Flour, Spices', description: 'Crispy fried pastry filled with spiced potatoes and peas.', imageUrl: 'https://via.placeholder.com/100' },
120
  { name: 'Onion Pakoda', price: 10, ingredients: 'Onions, Gram Flour, Spices', description: 'Deep-fried onion fritters seasoned with herbs and spices.', imageUrl: 'https://via.placeholder.com/100' },
121
- { name: 'Vegetable Biryani', price: 15, ingredients: 'Rice, Mixed Vegetables, Spices', description: 'Aromatic rice cooked with seasonal vegetables and spices.', imageUrl: 'https://via.placeholder.com/100' }
 
 
 
122
  ],
 
123
  nonVeg: [
124
- { name: 'Chicken Biryani', price: 14, ingredients: 'Chicken, Rice, Spices', description: 'Aromatic rice cooked with tender chicken and spices.', imageUrl: 'https://via.placeholder.com/100' },
 
125
  { name: 'Butter Chicken', price: 15, ingredients: 'Chicken, Tomato, Butter, Cream', description: 'Tender chicken cooked in a rich, creamy tomato sauce.', imageUrl: 'https://via.placeholder.com/100' },
126
- { name: 'Mutton Biryani', price: 16, ingredients: 'Mutton, Rice, Spices', description: 'Flavorful rice dish made with succulent mutton and aromatic spices.', imageUrl: 'https://via.placeholder.com/100' }
 
127
  ]
128
  };
129
 
130
  const cart = [];
131
 
132
- // Function to display menu based on user's choice (veg or non-veg)
133
  function showMenu(type) {
134
  const menuContainer = document.getElementById('menu-items');
135
  menuContainer.innerHTML = ''; // Clear previous menu items
136
 
137
  menuItems[type].forEach(item => {
138
  const div = document.createElement('div');
139
- div.classList.add('col-md-4', 'mb-4');
140
- div.innerHTML = `
141
- <div class="card menu-card">
142
- <img src="${item.imageUrl}" class="card-img-top menu-image" alt="${item.name}">
143
- <div class="card-body">
144
- <h5 class="card-title">${item.name}</h5>
145
- <p class="card-text">${item.description}</p>
146
- <p class="card-text">Price: $${item.price}</p>
147
- <button class="btn btn-primary" onclick="addToCart('${item.name}')">Add to Cart</button>
148
- </div>
149
- </div>
150
- `;
151
  menuContainer.appendChild(div);
152
  });
153
  }
154
 
155
- // Function to add items to the cart
156
  function addToCart(itemName) {
157
  const quantity = prompt(`How many ${itemName} would you like to add?`, 1);
158
  if (quantity && !isNaN(quantity) && quantity > 0) {
@@ -164,7 +123,30 @@
164
  alert("Please enter a valid quantity.");
165
  }
166
  }
167
- </script>
168
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
169
  </body>
170
  </html>
 
7
  <!-- Bootstrap CSS -->
8
  <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
9
  <style>
10
+ body { font-family: Arial, sans-serif; background-color: #f8f8f8; margin: 0; padding: 0; }
11
+ .menu-container { max-width: 1200px; margin: 0 auto; padding: 20px; background-color: #fff; border-radius: 8px; margin-top: 20px; }
12
+ h1 { text-align: center; font-size: 2.5rem; color: #333; }
13
+ .menu-item { margin-bottom: 20px; padding: 10px; border: 1px solid #ddd; border-radius: 5px; }
14
+ .menu-item img { width: 100px; height: 100px; border-radius: 8px; margin-right: 10px; }
15
+ .details { display: flex; align-items: center; }
16
+ .text { margin-left: 10px; }
17
+ .menu-option { margin: 20px; font-size: 1.5rem; text-align: center; }
18
+ .menu-option button { font-size: 1.2rem; padding: 10px 20px; margin: 10px; cursor: pointer; }
19
+ .cart-container { margin-top: 30px; padding: 10px; border: 1px solid #ddd; border-radius: 5px; background-color: #eaf3e1; }
20
+ .cart-item { display: flex; justify-content: space-between; margin-bottom: 10px; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  .view-cart-container {
22
  position: fixed;
23
  bottom: 20px;
 
44
  </style>
45
  </head>
46
  <body>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
47
 
48
+ <div class="menu-container">
49
+ <h1>Welcome to the Menu</h1>
50
  <!-- Buttons to select vegetarian or non-vegetarian menu -->
51
+ <div class="menu-option">
52
+ <button onclick="showMenu('veg')">Vegetarian Menu</button>
53
+ <button onclick="showMenu('nonVeg')">Non-Vegetarian Menu</button>
54
  </div>
55
+ <div id="menu-items"></div>
56
+ <button onclick="viewCart()">View Cart</button>
57
+ </div>
58
 
59
+ <div class="cart-container" id="cart-container" style="display:none;">
60
+ <h2>Your Cart</h2>
61
+ <div id="cart-items"></div>
62
+ <button onclick="placeOrder()">Place Final Order</button>
63
  </div>
64
 
65
  <!-- View Cart Button -->
66
  <div class="view-cart-container">
67
+ <a href="javascript:void(0);" class="view-cart-button" onclick="viewCart()">
68
  View Cart
69
  </a>
70
  </div>
71
 
72
  <script>
 
73
  const menuItems = {
74
  veg: [
75
  { name: 'Samosa', price: 9, ingredients: 'Potatoes, Peas, Flour, Spices', description: 'Crispy fried pastry filled with spiced potatoes and peas.', imageUrl: 'https://via.placeholder.com/100' },
76
  { name: 'Onion Pakoda', price: 10, ingredients: 'Onions, Gram Flour, Spices', description: 'Deep-fried onion fritters seasoned with herbs and spices.', imageUrl: 'https://via.placeholder.com/100' },
77
+ { name: 'Chilli Gobi', price: 12, ingredients: 'Cauliflower, Chili Sauce, Spices', description: 'Cauliflower florets tossed in a spicy chili sauce.', imageUrl: 'https://via.placeholder.com/100' },
78
+ { name: 'Paneer Butter Masala', price: 13, ingredients: 'Paneer, Tomato, Butter, Spices', description: 'Soft paneer cubes in a creamy, flavorful gravy.', imageUrl: 'https://via.placeholder.com/100' },
79
+ { name: 'Aloo Gobi', price: 10, ingredients: 'Potatoes, Cauliflower, Spices', description: 'A traditional Indian curry with potatoes and cauliflower.', imageUrl: 'https://via.placeholder.com/100' },
80
+ { name: 'Vegetable Biryani', price: 15, ingredients: 'Basmati Rice, Mixed Vegetables, Spices', description: 'Aromatic rice cooked with seasonal vegetables and spices.', imageUrl: 'https://via.placeholder.com/100' }
81
  ],
82
+
83
  nonVeg: [
84
+ { name: 'Chicken Biryani', price: 14, ingredients: 'Chicken, Basmati Rice, Spices', description: 'Aromatic basmati rice cooked with tender chicken and spices.', imageUrl: 'https://via.placeholder.com/100' },
85
+ { name: 'Mutton Biryani', price: 16, ingredients: 'Mutton, Basmati Rice, Spices', description: 'Flavorful rice dish made with succulent mutton and aromatic spices.', imageUrl: 'https://via.placeholder.com/100' },
86
  { name: 'Butter Chicken', price: 15, ingredients: 'Chicken, Tomato, Butter, Cream', description: 'Tender chicken cooked in a rich, creamy tomato sauce.', imageUrl: 'https://via.placeholder.com/100' },
87
+ { name: 'Chicken Tikka', price: 12, ingredients: 'Chicken, Yogurt, Spices', description: 'Grilled chicken marinated in yogurt and spices.', imageUrl: 'https://via.placeholder.com/100' },
88
+ { name: 'Prawn Masala', price: 20, ingredients: 'Prawns, Spices, Tomatoes', description: 'Juicy prawns cooked in a flavorful, spicy masala.', imageUrl: 'https://via.placeholder.com/100' }
89
  ]
90
  };
91
 
92
  const cart = [];
93
 
 
94
  function showMenu(type) {
95
  const menuContainer = document.getElementById('menu-items');
96
  menuContainer.innerHTML = ''; // Clear previous menu items
97
 
98
  menuItems[type].forEach(item => {
99
  const div = document.createElement('div');
100
+ div.classList.add('menu-item');
101
+ div.innerHTML = `<div class="details">
102
+ <img src="${item.imageUrl}" alt="${item.name}">
103
+ <div class="text">
104
+ <h3>${item.name}</h3>
105
+ <p>${item.description}</p>
106
+ <p><strong>Ingredients:</strong> ${item.ingredients}</p>
107
+ <p><strong>Price:</strong> $${item.price}</p>
108
+ <button onclick="addToCart('${item.name}')">Add to Cart</button>
109
+ </div>
110
+ </div>`;
 
111
  menuContainer.appendChild(div);
112
  });
113
  }
114
 
 
115
  function addToCart(itemName) {
116
  const quantity = prompt(`How many ${itemName} would you like to add?`, 1);
117
  if (quantity && !isNaN(quantity) && quantity > 0) {
 
123
  alert("Please enter a valid quantity.");
124
  }
125
  }
 
126
 
127
+ function viewCart() {
128
+ const cartContainer = document.getElementById('cart-container');
129
+ const cartItemsContainer = document.getElementById('cart-items');
130
+ cartItemsContainer.innerHTML = '';
131
+ cart.forEach(cartItem => {
132
+ const div = document.createElement('div');
133
+ div.classList.add('cart-item');
134
+ div.innerHTML = `<span>${cartItem.name} (x${cartItem.quantity}) - $${cartItem.price * cartItem.quantity}</span>`;
135
+ cartItemsContainer.appendChild(div);
136
+ });
137
+ cartContainer.style.display = 'block';
138
+ }
139
+
140
+ function placeOrder() {
141
+ if (cart.length > 0) {
142
+ alert("Your order has been placed successfully!");
143
+ cart.length = 0; // Clear the cart after placing the order
144
+ viewCart(); // Optionally, update cart view
145
+ } else {
146
+ alert("Your cart is empty. Please add items before placing the order.");
147
+ }
148
+ }
149
+
150
+ </script>
151
  </body>
152
  </html>