def order(): city_name = insert_db.get_g_res_city() res_data = insert_db.retrieve_restaurant_data(city_name) user_name=insert_db.get_g_user_name() orders=insert_db.retrieve_order_user(user_name); favourites=insert_db.retrieve_favourites(user_name); if request.method == 'POST': for i,d in res_data.iteritems(): temp = str(i) if temp in request.form: insert_db.set_g_res_name(str(d[0])) insert_db.set_g_res_id(str(d[3])) # print i insert_db.set_g_user_name(user_name) return redirect(url_for('menu')) for i,d in orders.iteritems(): temp = "cancel"+str(d[0]) if temp in request.form: insert_db.remove_order(d[0]) break if "logout" in request.form: return redirect(url_for('login')) return render_template('order.html',restaurant=res_data,username=user_name,orders=orders,favourites=favourites)
def menu(): res_name = insert_db.get_g_res_name() res_id = insert_db.get_g_res_id() menu_data = insert_db.set_menu(res_id) user_name = insert_db.get_g_user_name() if request.method == 'POST': if "place_order" in request.form: order_list = [] for i, d in menu_data.iteritems(): temp = [] check_string = "check" + str(i) quan_string = "quan" + str(i) if request.form.get(check_string): temp.append(d[0]) temp.append(int(request.form[quan_string])) order_list.append(temp) # print request.form[quan_string] order_id = insert_db.insert_order_list(order_list) insert_db.set_g_order_id(order_id) return redirect(url_for('bill')) if "logout" in request.form: return redirect(url_for('login')) return render_template('menu.html', menu_data=menu_data, username=user_name)
def order(): city_name = insert_db.get_g_res_city() category = insert_db.get_g_res_cat() flag = 0 res_data = insert_db.retrieve_restaurant_data(city_name,category) user_name=insert_db.get_g_user_name() orders=insert_db.retrieve_order_user(user_name); favourites=insert_db.retrieve_favourites(user_name); print "f**k" if request.method == 'POST': print "reeeeeee" print res_data if "search" in request.form: city_name = request.form["dd1"] category = request.form["dd2"] insert_db.set_g_res_city(city_name) insert_db.set_g_res_cat(category) res_data = insert_db.retrieve_restaurant_data(city_name,category) print "sdssfsfs" print res_data flag = 1 print "ssssssss" if "logout" in request.form: return redirect(url_for('login')) for i,d in res_data.iteritems(): temp = str(i) print "for" + temp if temp in request.form: insert_db.set_g_res_name(str(d[0])) insert_db.set_g_res_id(int(d[2])) # print i insert_db.set_g_user_name(user_name) return redirect(url_for('menu')) print "fukkkkkkk" for i,d in orders.iteritems(): temp = "cancel"+str(d[0]) if temp in request.form: insert_db.remove_order(d[0]) orders=insert_db.retrieve_order_user(user_name); break return render_template('order.html',restaurant=res_data,username=user_name,orders=orders,favourites=favourites)