예제 #1
0
def new():
    return render_template(pages["ingredients"]["details"],
                           title=strings.INGREDIENTS_NEW,
                           is_logged=current_user.is_authenticated,
                           is_admin=is_admin(),
                           commons=MessagePacket.generate(CommonName.getall()),
                           measures=MessagePacket.generate(Measure.getall()))
예제 #2
0
파일: delivery.py 프로젝트: Velite/365detox
def delivery_edit(delivery_id):
	if delivery_id is None or delivery_id < 1:
		abort(404)
	else:
		return render_template("delivery_details.html", title = "{0}: {1}".format(strings.DELIVERIES_EDIT, delivery_id),
		                       is_logged = is_logged(), is_admin = is_admin(),
		                       delivery = MessagePacket.generate(Delivery.getdetails(delivery_id)),
		                       products = MessagePacket.generate(Product.getallshort()),
		                       contragents = MessagePacket.generate(Contragent.getallshort()))
예제 #3
0
def edit(ingredient_id):
    if not ingredient_id or ingredient_id < 1:
        abort(404)
    else:
        ingredient = Ingredient.getdetails(ingredient_id)
        return render_template(
            pages["ingredients"]["details"],
            title="{0}: {1}".format(strings.INGREDIENTS_EDIT,
                                    ingredient.get("Name")),
            is_logged=is_logged(),
            is_admin=is_admin(),
            ingredient=MessagePacket.generate(ingredient),
            commons=MessagePacket.generate(CommonName.getall()),
            measures=MessagePacket.generate(Measure.getall()))
예제 #4
0
파일: supplier.py 프로젝트: Velite/365detox
def add():
    if not is_admin():
        abort(401)
    return make_response(
        jsonify(result=Contragent.add_supplier(
            MessagePacket.encode(request.data)) > 0,
                redirect=url_for("suppliers.index")), 201)
예제 #5
0
파일: supplier.py 프로젝트: Velite/365detox
def index():
    return render_template(pages["suppliers"]["template"],
                           title=pages["suppliers"]["title"],
                           is_logged=is_logged(),
                           is_admin=is_admin(),
                           suppliers=MessagePacket.generate(
                               Contragent.get_all_suppliers()))
예제 #6
0
def add():
    if not is_admin():
        abort(401)
    return make_response(
        jsonify(
            result=Ingredient.add_item(MessagePacket.encode(request.data)) > 0,
            redirect=url_for("ingredients.index")), 201)
예제 #7
0
def index():
    return render_template(pages["ingredients"]["template"],
                           title=pages["ingredients"]["title"],
                           is_logged=current_user.is_authenticated,
                           is_admin=is_admin(),
                           ingredients=MessagePacket.generate(
                               Ingredient.getall()))
예제 #8
0
파일: user.py 프로젝트: Velite/365detox
def index():
    if not is_admin():
        abort(405)
    return render_template(pages["users"]["template"],
                           title=pages["users"]["title"],
                           is_logged=is_logged(),
                           is_admin=is_admin(),
                           users=MessagePacket.generate(User.getall()))
예제 #9
0
파일: delivery.py 프로젝트: Velite/365detox
def update(delivery_id):
	if not is_admin():
		abort(401)
	if not delivery_id or delivery_id < 1:
		abort(404)
	if Delivery.edit_item(MessagePacket.encode(request.data)) < 1:
		abort(404)
	return make_response(jsonify(result = True, redirect = url_for("deliveries.index")), 200)
예제 #10
0
파일: supplier.py 프로젝트: Velite/365detox
def update(supplier_id):
    if not is_admin():
        abort(401)
    if not supplier_id or supplier_id < 1:
        abort(404)
    if Contragent.edit_item(MessagePacket.encode(request.data)) < 1:
        abort(404)
    return make_response(
        jsonify(result=True, redirect=url_for("suppliers.index")), 200)
예제 #11
0
def update(ingredient_id):
    if not is_admin():
        abort(401)
    if not ingredient_id or ingredient_id < 1:
        abort(404)
    if Ingredient.edit_item(MessagePacket.encode(request.data)) < 1:
        abort(404)
    return make_response(
        jsonify(result=True, redirect=url_for("ingredients.index")), 200)
예제 #12
0
파일: supplier.py 프로젝트: Velite/365detox
def supplier_edit(supplier_id):
    if not supplier_id or supplier_id < 1:
        abort(404)
    else:
        supplier = Contragent.getdetails(supplier_id)
        return render_template("supplier_details.html",
                               title="{0}: {1}".format(strings.SUPPLIERS_EDIT,
                                                       supplier.get("Name")),
                               is_logged=is_logged(),
                               is_admin=is_admin(),
                               supplier=MessagePacket.generate(supplier))
예제 #13
0
def contragent_edit(contragent_id):
    if not contragent_id or contragent_id < 1:
        abort(404)
    else:
        contragent = Contragent.getdetails(contragent_id)
        return render_template("contragent_details.html",
                               title="{0}: {1}".format(strings.EDIT_CONTRAGENT,
                                                       contragent.get("Name")),
                               is_logged=is_logged(),
                               is_admin=is_admin(),
                               contragent=MessagePacket.generate(contragent))
예제 #14
0
파일: delivery.py 프로젝트: Velite/365detox
def new():
	return render_template("delivery_details.html", title = strings.DELIVERIES_NEW, is_logged = is_logged(),
	                       is_admin = is_admin(), products = MessagePacket.generate(Product.getallshort()),
	                       contragents = MessagePacket.generate(Contragent.getallshort()))
예제 #15
0
파일: delivery.py 프로젝트: Velite/365detox
def index():
	return render_template(pages["deliveries"]["template"], title = pages["deliveries"]["title"],
	                       is_logged = is_logged(), is_admin = is_admin(),
	                       deliveries = MessagePacket.generate(Delivery.getall()))