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()))
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()))
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()))
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)
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()))
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)
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()))
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()))
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)
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)
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)
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))
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))
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()))
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()))