예제 #1
0
def create_categories(id):
    project_information = projects.get_project(id)
    getid = projects.get_userid(id)
    userid1 = getid[0]
    userid2 = users.user_id()
    if not userid1 == userid2:
        return render_template(
            "error.html",
            message=
            "Ei oikeutta muokata osa-alueita. Vain tapahtuman järjestäjällä on oikeus muokata kategorioita."
        )
    else:
        return render_template("createcategories.html",
                               project_information=project_information)
예제 #2
0
def edit_subprojects(id):
    project_information = projects.get_project(id)
    subproject_list = subprojects.list_subprojects(id)
    getid = projects.get_userid(id)
    userid1 = getid[0]
    userid2 = users.user_id()
    if not userid1 == userid2:
        return render_template(
            "error.html",
            message=
            "Ei oikeutta muokata osa-alueita. Vain tapahtuman järjestäjällä on oikeus muokata osa-alueita."
        )
    else:
        return render_template("editsubprojects.html",
                               project_information=project_information,
                               subproject_list=subproject_list)
예제 #3
0
def subprojectpayments(subproject_id):
    project_id = request.form["project_id"]
    subproject_name = request.form["subproject_name"]
    subproject_total = request.form["subproject_total"]
    if session["csrf_token"] != request.form["csrf_token"]:
        abort(403)
    payments_in_subproject = subprojects.payments_in_subproject(subproject_id)
    getid = projects.get_userid(project_id)
    userid1 = getid[0]
    userid2 = users.user_id()
    if userid1 != userid2:
        return render_template(
            "error.html",
            message=
            "Vain tapahtuman järjestäjä voi tarkastella budjetin osa-alueisiin liitettyjä maksuja."
        )
    else:
        return render_template("subprojectpayments.html",
                               payments_in_subproject=payments_in_subproject,
                               subproject_name=subproject_name,
                               project_id=project_id,
                               subproject_total=subproject_total)
예제 #4
0
def payments_after_date():
    project_id = request.args["project_id"]
    date = request.args["enddate"]
    if session["csrf_token"] != request.args["csrf_token"]:
        abort(403)
    getid = projects.get_userid(project_id)
    userid1 = getid[0]
    userid2 = users.user_id()
    if userid1 != userid2:
        return render_template(
            "error.html",
            message="Vain tapahtuman järjestäjä voi listata maksut.")
    if date == '':
        return render_template(
            "error.html",
            message="Syötä päivämäärä, jota varhaisemmat maksut listataan.")
    paymentsafterdate = payments.paymentsafterdate(project_id, date)
    headlines = ('Saaja', 'Summa', 'Viesti', 'Osa-alue', 'Käyttäjä', 'Pvm')
    if paymentsafterdate == []:
        headlines = []
    return render_template("paymentsafterdate.html",
                           paymentsafterdate=paymentsafterdate,
                           project_id=project_id,
                           headlines=headlines)
예제 #5
0
def categorypayments(category_id):
    project_id = request.form["project_id"]
    category_name = request.form["category_name"]
    payments_in_category = categories.payments_in_category(category_id)
    category_total = categories.category_total(category_id)
    if session["csrf_token"] != request.form["csrf_token"]:
        abort(403)
    if category_total is None:
        category_total = 0
    getid = projects.get_userid(project_id)
    userid1 = getid[0]
    userid2 = users.user_id()
    if not userid1 == userid2:
        return render_template(
            "error.html",
            message=
            "Vain tapahtuman järjestäjä voi tarkastella kategoriaan liitettyjä maksuja."
        )
    else:
        return render_template("categorypayments.html",
                               category_name=category_name,
                               project_id=project_id,
                               payments_in_category=payments_in_category,
                               category_total=category_total)