Exemple #1
0
def wrap(ID):
    items = system.get_main_list()

    if (request.method == 'POST'):

        if (system.get_order(int(ID)) == None):
            system.new_order(int(ID))

        wrap = Wrap()

        for ingredient in items:
            if ("bun" not in ingredient):
                if (int(request.form[ingredient]) != 0):
                    wrap.add_ingredient(ingredient,
                                        int(request.form[ingredient]))

        if (wrap.is_valid_main() == False):
            errors = wrap.get_errors()
            return render_template('wrap.html',
                                   items=items,
                                   errors=errors,
                                   ID=ID,
                                   form=request.form)

        else:
            system.add_to_order(wrap, int(ID))
            return render_template('item_confirm.html',
                                   item="Custom Wrap",
                                   ID=ID)

    return render_template('wrap.html', items=items, ID=ID)
Exemple #2
0
def drinks(ID):
    drinklist = system.get_drinklist()

    if request.method == 'POST':

        if (system.get_order(int(ID)) == None):
            system.new_order(int(ID))

        for drink in drinklist:
            for i in range(int(request.form[drink])):
                system.add_to_order(Drink(drink), int(ID))

        return render_template('item_confirm.html', item="Drinks", ID=ID)

    return render_template('drinks.html', drinklist=drinklist, ID=ID)
Exemple #3
0
def sides(ID):
    sidelist = system.get_sidelist()

    if request.method == "POST":

        if (system.get_order(int(ID)) == None):
            system.new_order(int(ID))

        for side in sidelist:
            for i in range(int(request.form[side])):
                system.add_to_order(Side(side), int(ID))

        return render_template('item_confirm.html', item="Sides", ID=ID)

    return render_template('sides.html', sidelist=sidelist, ID=ID)
Exemple #4
0
def burger(ID):

    items = system.get_main_list()

    if (request.method == 'POST'):

        if (system.get_order(int(ID)) == None):
            system.new_order(int(ID))

        if (request.form['burger_tier'] == 'single'):
            burger = SingleBurger()
        elif (request.form['burger_tier'] == 'double'):
            burger = DoubleBurger()
        elif (request.form['burger_tier'] == 'triple'):
            burger = TripleBurger()

        for ingredient in items:
            if (int(request.form[ingredient]) != 0):
                burger.add_ingredient(ingredient,
                                      int(request.form[ingredient]))

        if (burger.is_valid_main() == False):
            errors = burger.get_errors()
            return render_template('burger.html',
                                   items=items,
                                   errors=errors,
                                   ID=ID,
                                   form=request.form)

        else:
            system.add_to_order(burger, int(ID))
            return render_template('item_confirm.html',
                                   item="Custom Burger",
                                   ID=ID)

    return render_template('burger.html', items=items, ID=ID)
Exemple #5
0
def selection(ID, main):

    if (request.method == 'POST'):

        if (request.form["type"] == "Custom Burger"):
            return redirect(url_for("burger", ID=ID, main=main))

        elif (request.form["type"] == "Custom Wrap"):
            return redirect(url_for("wrap", ID=ID, main=main))

        elif (request.form["type"] == "Python2 Burger"):
            burger = DoubleBurger()

            burger.add_ingredient("Beef patty", 2)
            burger.add_ingredient("Cheddar cheese", 2)
            burger.add_ingredient("BBQ sauce", 2)
            burger.add_ingredient("Muffin bun", 3)

            if (system.get_order(int(ID)) == None):
                system.new_order(int(ID))

            system.add_to_order(burger, int(ID))

            return render_template('item_confirm.html',
                                   item="Python2 Burger",
                                   ID=ID)

        elif (request.form["type"] == "Python3 Burger"):
            burger = TripleBurger()

            burger.add_ingredient("Beef patty", 3)
            burger.add_ingredient("Cheddar cheese", 3)
            burger.add_ingredient("BBQ sauce", 3)
            burger.add_ingredient("Sesame bun", 4)

            if (system.get_order(int(ID)) == None):
                system.new_order(int(ID))

            system.add_to_order(burger, int(ID))

            return render_template("item_confirm.html",
                                   item="Python3 Burger",
                                   ID=ID)

        elif (request.form["type"] == "George's Burger"):
            burger = DoubleBurger()

            burger.add_ingredient("Beef patty", 1)
            burger.add_ingredient("Chicken patty", 1)
            burger.add_ingredient("Swiss cheese", 2)
            burger.add_ingredient("Sesame bun", 3)
            burger.add_ingredient("Onions", 3)
            burger.add_ingredient("Tomato sauce", 2)
            burger.add_ingredient("Lettuce", 2)

            if (system.get_order(int(ID)) == None):
                system.new_order(int(ID))

            system.add_to_order(burger, int(ID))

            return render_template("item_confirm.html",
                                   item="George's Burger",
                                   ID=ID)

        elif (request.form["type"] == "Beef Wrap"):
            wrap = Wrap()

            wrap.add_ingredient("Beef patty", 1)
            wrap.add_ingredient("Lettuce", 3)
            wrap.add_ingredient("Onions", 3)
            wrap.add_ingredient("Tomatoes", 3)
            wrap.add_ingredient("BBQ sauce", 1)

            if (system.get_order(int(ID)) == None):
                system.new_order(int(ID))

            system.add_to_order(wrap, int(ID))

            return render_template("item_confirm.html",
                                   item="Beef Wrap",
                                   ID=ID)

        elif (request.form["type"] == "Chicken Wrap"):
            wrap = Wrap()

            wrap.add_ingredient("Chicken patty", 1)
            wrap.add_ingredient("Lettuce", 3)
            wrap.add_ingredient("Onions", 3)
            wrap.add_ingredient("Tomatoes", 3)
            wrap.add_ingredient("BBQ sauce", 1)

            if (system.get_order(int(ID)) == None):
                system.new_order(int(ID))

            system.add_to_order(wrap, int(ID))

            return render_template("item_confirm.html",
                                   item="Chicken Wrap",
                                   ID=ID)

        elif (request.form["type"] == "Vegetarian Wrap"):
            wrap = Wrap()

            wrap.add_ingredient("Vegetarian patty", 1)
            wrap.add_ingredient("Lettuce", 3)
            wrap.add_ingredient("Onions", 3)
            wrap.add_ingredient("Tomatoes", 3)
            wrap.add_ingredient("BBQ sauce", 1)

            if (system.get_order(int(ID)) == None):
                system.new_order(int(ID))

            system.add_to_order(wrap, int(ID))

        return render_template("item_confirm.html",
                               item="Vegetarian Wrap",
                               ID=ID)

    return render_template('selection.html', ID=ID, main=main)