def SendFeedback(): inp_no = 'no' inp_Yes = 'Yes' conn, cur = db_connect() eel.left_printer("We are extremely sorry for the inconvenience.") speak("We are extremely sorry for the inconvenience") eel.left_printer("What is your invoice number?") speak("What is your invoice number?") inp_user = "******" eel.right_printer(inp_user) eel.left_printer("How can we improve your instore shopping experience?") speak("How can we improve your instore shopping experience?") inp_user = "******" eel.right_printer(inp_user) query = "SELECT row from customer_care order by row desc" cur.execute(query) rows = cur.fetchall() new_entry = rows[0][0] + 1 query = "INSERT INTO customer_care (cat_id,row,complain) \ VALUES (3," + str(new_entry) + ",'" + inp_user + "')" cur.execute(query) conn.commit() eel.left_printer( "Your feedback is valuable to us, we will try to work on this.") speak("Your feedback is valuable to us, we will try to work on this.")
def productReturns(): inp_no = 'no' inp_Yes = 'Yes' conn, cur = db_connect() eel.left_printer( "Thank you for contacting us about your defective product.") speak("Thank you for contacting us about your defective product") eel.left_printer("We are extremely sorry for the inconvenience.") speak("We are extremely sorry for the inconvenience.") eel.left_printer("What do you want to return?") speak("What do you want to return?") inp_user = "******" eel.right_printer(inp_user) query = "SELECT row from customer_care order by row desc" cur.execute(query) rows = cur.fetchall() new_entry = rows[0][0] + 1 query = "INSERT INTO customer_care (cat_id,row,complain) \ VALUES (1," + str(new_entry) + ",'" + inp_user + "')" cur.execute(query) conn.commit() eel.left_printer( "Our sales team will get back to you as soon as possible ") speak("Our sales team will get back to you as soon as possible ") eel.removevoicedots()
def billingIssues(): inp_no = 'no' inp_Yes = 'Yes' conn, cur = db_connect() eel.left_printer("We are extremely sorry for the inconvenience.") speak("We are extremely sorry for the inconvenience") eel.left_printer("What is your invoice number?") speak("What is your invoice number?") inp_user = "******" eel.right_printer(inp_user) eel.left_printer("What is the issue you faced while billing?") speak("What is the issue you faced while billing?") inp_user = "******" eel.right_printer(inp_user) query = "SELECT row from customer_care order by row desc" cur.execute(query) rows = cur.fetchall() new_entry = rows[0][0] + 1 query = "INSERT INTO customer_care (cat_id,row,complain) \ VALUES (2," + str(new_entry) + ",'" + inp_user + "')" cur.execute(query) conn.commit() eel.left_printer( "Our sales team will get back to you as soon as possible ") speak("Our sales team will get back to you as soon as possible ")
def unknown_item(conn, cur, inp0='Yes'): user_buy = [] while (inp0 == 'Yes'): parent_category_selector(cur) # inp1 = 'Bakery' inp1 = myCommand("Select a category") eel.right_printer(inp1.capitalize()) x = child_category_selector(cur, inp1.capitalize()) if x == 1: # inp2 = 'bread' inp2 = myCommand("Select a subcategory") eel.right_printer(inp2.capitalize()) item = item_selector(cur, inp2.capitalize()) if item == 1: # inp3 = 'i want britannia milk bread' inp3 = myCommand("Item name") eel.right_printer(inp3.capitalize()) inp3 = stopword_remover(inp3) eel.left_printer("How much") quant = 1 #quant = myCommand("Enter quantity") eel.right_printer(quant) if db_searcher(inp3, cur, quant) != -1: user_buy.append(db_searcher(inp3, cur, quant)) speak("Would u like to add anything else ?") eel.left_printer("Would u like to add anything else ?") inp0 = myCommand("Anything else") eel.right_printer(inp0.capitalize()) if inp0 == "Yes": continue else: break #inp0 = inp_no # inp0 = input() else: unknown_item(conn, cur) else: speak("Wrong input for sub category selector") unknown_item(conn, cur) else: speak("Sorry the category you have chosen is not available") eel.left_printer( "Sorry the category you have chosen is not available") unknown_item(conn, cur) invoice_generator(cur, user_buy, conn) speak("Ok, I have added your items into your cart") eel.left_printer("Ok, I have added your items into your cart") return None
def parent_category_selector(cur_pointer): #print(runtype) cur_pointer.execute( "SELECT category_id AS id,category_name AS name FROM category_table WHERE category_id=parent_id" ) rows = cur_pointer.fetchall() cat = [] for row in rows: cat.append(row[1]) text = "Available categories are " + "<li>" + "<li>".join(cat) eel.left_printer(text) speak("U can view the available categories on the screen") return printer(cur_pointer, 1)
def tryblock(): inp_no = 'No' inp_Yes = 'Yes' conn, cur = db_connect() eel.left_printer("Do you know exactly what you want to buy?") speak("Do u know exactly what u want to buy ?") inp0 = myCommand("Do u know exactly what u want to buy ?") eel.right_printer(inp0.capitalize()) if inp0 == inp_Yes: known_item(conn, cur) else: unknown_item(conn, cur)
def child_category_selector(cur_pointer, p_id): query = str( "SELECT category_id, category_name FROM category_table WHERE parent_id IN (SELECT parent_id FROM category_table WHERE category_name ='" + str(p_id) + "') AND parent_id!=category_id") cur_pointer.execute(query) rows = cur_pointer.fetchall() if len(rows) >= 1: sub_cat = [] for row in rows: sub_cat.append(row[1]) text = 'Available subcategories are ' + "<li>" + "<li>".join(sub_cat) eel.left_printer(text) speak("Please check your screen for the Available sub-categories") printer(cur_pointer, 2) return 1 else: return -1
def item_selector(cur_pointer, p_id): query = "SELECT * FROM items WHERE category_id IN (SELECT category_id FROM category_table WHERE category_name ='" + p_id + "')" cur_pointer.execute(query) rows = cur_pointer.fetchall() # print('Item |\t\n id |\t','Item name',"\t|") # print("--------------------------") items = [] if len(rows) >= 1: for row in rows: items.append(row[2]) text = "Avaiailable items under " + p_id + " are " + "<li>" + "<li>".join( items) eel.left_printer(text) speak("Please choose from the items mentioned on the screen") return 1 else: return -1
def known_item(conn, cur, inp0='Yes'): speak("Please check the screen to view all the items") x = item_printer_eel(cur) x = "Available items are : \n" + x eel.left_printer(x) user_buy = [] while (inp0 == 'Yes'): # inp1 = 'i want britannia milk bread' inp1 = myCommand("Item name") eel.right_printer(inp1.capitalize()) inp1 = stopword_remover(inp1) speak("How much ?") eel.left_printer("How much ?") quant = 6 #quant = myCommand("How much") eel.right_printer(quant) if db_searcher(inp1, cur, quant) != -1: user_buy.append(db_searcher(inp1, cur, quant)) speak("Would u like to add anything else ?") eel.left_printer("Would u like to add anything else ?") inp0 = myCommand("Anything else") eel.right_printer(inp0) #inp0 = inp_no # inp0 = input() else: known_item(conn, cur) invoice_generator(cur, user_buy, conn) speak("Ok, I have added your items into your cart") eel.left_printer("Ok, I have added your items into your cart")
def gender_preference(): print("Would you like to switch assistants ?") eel.left_printer("Would you like to switch assistant ?") inp0 = "Yes" # inp0 = myCommand("Voice Change?") eel.right_printer(inp0.capitalize()) global gender if inp0 == "Yes": if gender == "Female": gender = "Male" eel.left_printer("I am now changed based on your preference") speak("I am now changed based on your preference !!", genders=gender) else: gender == "Female" eel.left_printer("I have now changed my voice ") speak("I have now changed my voice ", genders=gender)