def create_new_company_user():
    security.has_role([4, 6])
    security.has_csrf_token(request.form["csrf_token"])

    username = request.form["username"]
    password = request.form["password"]
    password_check = request.form["password_check"]
    company_id = request.form["company_id"]

    company = companies.get_company(company_id)

    if company_id == None or company_id == '' or company == None:
        flash("A company must be selected.", "danger")
        return render_template("sale/sale_create_company_user.html",
                               username=username,
                               company_id=company_id,
                               companies=companies.get_all_companies())

    if password != password_check:
        flash("Passwords doesn't match.", "danger")
        return render_template("sale/sale_create_company_user.html",
                               username=username,
                               company_id=company_id,
                               companies=companies.get_all_companies())
    else:
        users.create_user(username, password, 1, company_id)
    return redirect("/create_company_user")
def controller_new_supply_order():
    security.has_role([6])
    return render_template("controller/controller_new_supply_order.html",
                           companies=companies.get_all_companies(),
                           items=item.get_all_items(False))
Esempio n. 3
0
def place_company_order():
    security.has_role([4, 6])
    return render_template("sale/sale_create_order.html",
                           companies=companies.get_all_companies(),
                           items=item.get_all_items(False))
Esempio n. 4
0
def supply_order_form():
    security.has_role([5, 6])
    return render_template("buyer/buyer_supply_order.html",
                           companies=companies.get_all_companies(),
                           items=item.get_all_items(False))
Esempio n. 5
0
def create_company_user():
    security.has_role([4, 6])

    return render_template("sale/sale_create_company_user.html",
                           companies=companies.get_all_companies())