示例#1
0
def check_order(id):
    if request.method == 'POST':
        system.get_order_by_id(request.form['bt']).status = 'collected'

    if system.id_exists(id):
        order = system.get_order_by_id(id)
    else:
        order = None

    return render_template('order_status.html', display=display, order=order)
示例#2
0
def order(order_id):
    order = system.get_order_by_id(order_id)

    if order not in system.completed_orders and order not in system.orders:
        abort(404)

    return render_template('order.html', order=order)
示例#3
0
def cancel_order(order_id):
    order = system.get_order_by_id(order_id)

    if not order:
        abort(404)

    system.cancel_order(order_id)

    return redirect(url_for('orders'))
示例#4
0
def create_order(items_dict):
    mains = SessionManager.fetch_items()
    id = system.create_new_order()
    order = system.get_order_by_id(id)
    burgers = [w for w in mains if type(w).__name__ == 'burger']
    wraps = [w for w in mains if not type(w).__name__ == 'burger']
    order.set_burgers(burgers)
    order.set_wraps(wraps)
    order.set_sides(items_dict['sides_list'])
    order.set_drinks(items_dict['drinks_list'])
    GourmetBurgerSystem.checkout(order)
    return id
示例#5
0
def order_list():
    if request.method == 'POST':
        system.get_order_by_id(request.form['bt']).status = 'ready'

        return render_template('order_list.html',
                               display=display,
                               order_list=system.orders)

    else:

        return render_template('order_list.html',
                               display=display,
                               order_list=system.orders)