def edit_reservation(id):
    reservation = reservation_repository.select(id)
    guests = guest_repository.select_all()
    rooms = room_repository.select_all()
    today = datetime.date.today()
    stay_length = reservation_repository.stay_length(id)
    return render_template('reservations/edit.html', reservation=reservation, guests=guests, rooms=rooms, today=today, stay_length=stay_length)
Example #2
0
def capacity_out(id):
    res = reservation_repository.select(id)
    room = room_repository.select(res.room.id)
    room.capacity_change_out()
    sql = "UPDATE rooms SET remaining_capacity = %s WHERE id = %s"
    values = [room.remaining_capacity, room.id]
    run_sql(sql, values)
Example #3
0
def stays(id):
    # take in reservation id
    # convert id to full reservation details
    res = reservation_repository.select(id)
    # take the reservation's guest id and use to generate full guest details
    guest = guest_repository.select(res.guest.id)
    # use full guest instance with class method to increase stay increase_stay_count
    guest.increase_stay_count()
    # update sql with the guest instance stay count and id as a filter
    sql = "UPDATE guests SET stays = %s WHERE id = %s"
    values = [guest.stays, guest.id]
    run_sql(sql, values)
def check_in(id):
    reservation = reservation_repository.select(id)
    guest = guest_repository.select(reservation.guest.id)
    rooms = room_repository.select_available()
    stay_length = reservation_repository.stay_length(id)
    return render_template('reservations/checkin.html', reservation=reservation, guest= guest, rooms=rooms, stay_length=stay_length)
def delete_reservation(id):
    reservation = reservation_repository.select(id)
    guest = guest_repository.select(reservation.guest.id)
    return render_template('reservations/delete.html', reservation=reservation, guest= guest)