Esempio n. 1
0
def deleteReservation(reservationNo):
    sessionChecker = loginRequired()
    if sessionChecker == True:
        reserve = reservations.reservation()
        reserve.deleteReservation(reservationNo)
        description = "{} deleted reservation no.{} ".format(
            session['accountInfo'][1], reservationNo)
        log = logs.log(description)
        log.addLogs()
        return redirect(url_for('renterPendingReservation'))
    else:
        return redirect(url_for("signin"))
Esempio n. 2
0
def declineRentRequest(reservationNo):
    sessionChecker = loginRequired()
    if sessionChecker == True:
        reservation = reservations.reservation()
        reservation.declineReservation(reservationNo)

        description = "Rent request no.{} was declined by the boarding house owner".format(
            reservationNo)
        log = logs.log(description)
        log.addLogs()

        return redirect(url_for('manageTenants'))
    else:
        return redirect(url_for("signin"))
Esempio n. 3
0
def sendRentRequest():
    sessionChecker = loginRequired()
    if sessionChecker == True:
        if request.method == "POST":
            unitID = request.form.get('unitID')
            userID = request.form.get('userID')
            today = datetime.today()
            date = today.strftime("%Y-%m-%d")
            reserve = reservations.reservation(userID, unitID, date)
            reserve.addReservation()
            description = "{} send reservation for unit: {}".format(
                session['accountInfo'][0], unitID)
            log = logs.log(description)
            log.addLogs()
            return redirect(url_for('renterPendingReservation'))
    else:
        return redirect(url_for("signin"))
Esempio n. 4
0
def manageTenants():
    sessionChecker = loginRequired()
    if sessionChecker == True:
        reservationList = reservations.reservation()
        reservationList = reservationList.ownerReservationData(
            session['accountInfo'][0])
        renterList = renters.renter()
        activeRenterList = renterList.tenantsList()
        renterRequestLeaveList = renterList.leaveRequestList()

        return render_template('ownermanagetenants.html',
                               reservationList=reservationList,
                               activeRenterList=activeRenterList,
                               renterRequestLeaveList=renterRequestLeaveList,
                               accountInfo=session['accountInfo'])
    else:
        return redirect(url_for("signin"))
Esempio n. 5
0
def addRentRequest(unitID):
    sessionChecker = loginRequired()
    if sessionChecker == True:
        reserve = reservations.reservation()
        reservationChecker = reserve.checkActiveReservation(
            session['accountInfo'][0])
        info = units.unit()
        info = info.unitsInfo(unitID)
        today = datetime.today()
        date = today.strftime("%B %d, %Y")
        flash("Awesome! You've successfuly sent a request for a reservation.",
              'success')
        return render_template("renterreservation.html",
                               accountInfo=session['accountInfo'],
                               unitID=unitID,
                               unitInfo=info,
                               date=date,
                               reservationChecker=reservationChecker)
    else:
        return redirect(url_for("signin"))
Esempio n. 6
0
def acceptRentRequest(reservationNo, userID, unitID):
    sessionChecker = loginRequired()
    if sessionChecker == True:
        today = datetime.today()
        date = today.strftime("%Y-%m-%d")
        renter = renters.renter(userID, unitID, date)
        reservation = reservations.reservation()
        reservation.acceptReservation(reservationNo)
        renter.addRenter()

        description = "Rent request of {} was approved by the boarding house owner".format(
            session['accountInfo'][0])
        log = logs.log(description)
        log.addLogs()

        description = "{} started renting for unit: {}".format(
            session['accountInfo'][0], unitID)
        log = logs.log(description)
        log.addLogs()
        return redirect(url_for('manageTenants'))
    else:
        return redirect(url_for("signin"))
Esempio n. 7
0
def renterPendingReservation():
    sessionChecker = loginRequired()
    if sessionChecker == True:
        reserve = reservations.reservation()
        reservationChecker = reserve.checkActiveReservation(
            session['accountInfo'][0])
        reservationData = reserve.pendingReservation(session['accountInfo'][0])
        if reservationChecker != None:
            reservationChecker = reservationChecker[4]

        else:
            reservationChecker = "N"
        info = units.unit()
        if reservationData == None or len(reservationData) == 0:
            info = []
            reservationData = []

            today = datetime.today()
            date = today.strftime("%B %d, %Y")
            return render_template("pendingreservation.html",
                                   accountInfo=[],
                                   unitInfo=info,
                                   date=date,
                                   reservationChecker=reservationChecker,
                                   reservationData=reservationData)
        else:
            info = info.unitsInfo(reservationData[2])
            today = datetime.today()
            date = today.strftime("%B %d, %Y")
            return render_template("pendingreservation.html",
                                   accountInfo=session['accountInfo'],
                                   unitInfo=info,
                                   date=date,
                                   reservationChecker=reservationChecker,
                                   reservationData=reservationData)
    else:
        return redirect(url_for("signin"))