nagasurendra commited on
Commit
ac6acf6
·
verified ·
1 Parent(s): 09f7832

Update menu.py

Browse files
Files changed (1) hide show
  1. menu.py +26 -0
menu.py CHANGED
@@ -246,6 +246,32 @@ def search():
246
  most_common_instructions=most_common_instructions
247
  )
248
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
249
  @menu_blueprint.route('/api/addons', methods=['GET'])
250
  def get_addons():
251
  item_name = request.args.get('item_name')
 
246
  most_common_instructions=most_common_instructions
247
  )
248
 
249
+ @menu_blueprint.route("/search", methods=["GET"])
250
+ def search():
251
+ selected_category = request.args.get("category", "All")
252
+ user_email = session.get('user_email')
253
+
254
+ # Handle user authentication
255
+ if not user_email:
256
+ return redirect(url_for("login"))
257
+ user_name = session.get('user_name')
258
+ first_letter = user_name[0].upper() if user_name else "A"
259
+
260
+ # Fetch menu data
261
+ ordered_menu, referral_code, reward_points, cart_item_count, most_common_addons, most_common_instructions = fetch_menu_data(selected_category, user_email)
262
+ if ordered_menu is None:
263
+ return redirect(url_for('login'))
264
+
265
+ return render_template(
266
+ "search.html",
267
+ ordered_menu=ordered_menu,
268
+ user_name=user_name,
269
+ first_letter=first_letter,
270
+ cart_item_count=cart_item_count,
271
+ most_common_addons=[addon.strip() for addon in most_common_addons],
272
+ most_common_instructions=most_common_instructions
273
+ )
274
+
275
  @menu_blueprint.route('/api/addons', methods=['GET'])
276
  def get_addons():
277
  item_name = request.args.get('item_name')