예제 #1
0
def checkout():
    if not session.get('logged_in') or sudo() == "FALSE":
        abort(401)
    today = dataINT()
    template = env.get_template("manager.html")
    mappa = {"lista": list(guest_leaving(today))}
    mappa["username"] = session["username"]
    mappa["today"] = dataINT_to_datatime(today)
    return template.render(mappa)
예제 #2
0
def checkout():
    if not session.get('logged_in') or sudo() == "FALSE":
        abort(401)
    today = dataINT()
    template = env.get_template("manager.html")
    mappa= {"lista" : list(guest_leaving(today))}
    mappa["username"] = session["username"]
    mappa["today"] = dataINT_to_datatime(today)
    return template.render(mappa)
예제 #3
0
def free_rooms_page():
    """
    free_rooms()
    In this page are shown a list of available rooms in a certain period of time and a form that the receptionist have to fill with the guest's data.
    From this interface the user can choose which room to book and select it. He can also insert the informations about the client, that will be used by the next functions before performing the actual booking process.
    """
    if not session.get('logged_in'):
        abort(401)
    today = dataINT()
    mappa = {"nrooms": n_freerooms(datepick_to_dataINT(request.args["checkin"]), datepick_to_dataINT(request.args["checkout"])), "rooms" : free_rooms(datepick_to_dataINT(request.args["checkin"]), datepick_to_dataINT(request.args["checkout"])), "checkin" : datepick_to_dataINT(request.args["checkin"]), "checkout" : datepick_to_dataINT(request.args["checkout"])}
    template = env.get_template("booking.html")
    return template.render(mappa)
예제 #4
0
def main():
    """
    main()
    This function retrieves only the data shown in the upper div of the mainpage and renders it.
    From here the user can call 3 pages: free_rooms() (to begin the reservation process), reservations() (to search for present reservations), guests() (to search for registered guests).
    """
    if not session.get('logged_in'):
        abort(401)
    today = dataINT()
    mappa = { "today" : dataINT_to_datatime(today), "n_checkin" : n_checkin(today), "n_checkout" : n_checkout(today), "n_occupate" : n_fullrooms(today, today), "n_libere" : n_freerooms(today, today)}
    if n_freerooms(today, today) < 0:
        mappa["msg"]= "Error: the number of today's reservations exceed the total number of rooms. Check the database!"     #Keep this IF...
        mappa["error"] = "TRUE"
    template = env.get_template("main.html")
    return template.render(mappa)
예제 #5
0
def free_rooms_page():
    """
    free_rooms()
    In this page are shown a list of available rooms in a certain period of time and a form that the receptionist have to fill with the guest's data.
    From this interface the user can choose which room to book and select it. He can also insert the informations about the client, that will be used by the next functions before performing the actual booking process.
    """
    if not session.get('logged_in'):
        abort(401)
    today = dataINT()
    cin = datepick_to_dataINT(request.args["checkin"])
    cout = datepick_to_dataINT(request.args["checkout"])
    mappa = {
        "nrooms": n_freerooms(cin, cout),
        "rooms": sorted(free_rooms(cin, cout)),
        "checkin": cin,
        "checkout": cout,
        "ckin": dataINT_to_datatime(cin),
        "ckout": dataINT_to_datatime(cout)
    }
    template = env.get_template("booking.html")
    return template.render(mappa)
예제 #6
0
def main():
    """
    main()
    This function retrieves only the data shown in the upper div of the mainpage and renders it.
    From here the user can call 3 pages: free_rooms() (to begin the reservation process), reservations() (to search for present reservations), guests() (to search for registered guests).
    """
    if not session.get('logged_in'):
        abort(401)
    today = dataINT()
    mappa = {
        "today": dataINT_to_datatime(today),
        "n_checkin": n_checkin(today),
        "n_checkout": n_checkout(today),
        "n_occupate": n_fullrooms(today, today),
        "n_libere": n_freerooms(today, today)
    }
    if n_freerooms(today, today) < 0:
        mappa[
            "msg"] = "Error: the number of today's reservations exceed the total number of rooms. Check the database!"  #Keep this IF...
        mappa["error"] = "TRUE"
    template = env.get_template("main.html")
    return template.render(mappa)