def get_rooms(): space_controller = SpaceController() room_controller = RoomController() space_id = request.form['space_id'] rooms_res = room_controller.get_items(space_id=space_id) rooms = [{'id':room['room_id'],'name':room['name'],'size':room['size'],'amenities_list':room['amenities'],'price':room['price']} for room in rooms_res] return json.dumps({'rooms': rooms})
def rooms(): print 'In rooms page' space_controller = SpaceController() room_controller = RoomController() args = request.args space_id = args.get('space', '') space = space_controller.get_item(space_id=space_id) rooms = room_controller.get_items(space_id=space_id) user = UserController().get_item(session['email']) if 'email' in session else None return render_template("rooms.html", space=space, rooms=rooms, user=user)
def book(): print 'In book page' space_controller = SpaceController() room_controller = RoomController() args = request.args space_id = args.get('space', '') room_id = args.get('room', '') space = space_controller.get_item(space_id) room = room_controller.get_item(space_id, room_id) user = UserController().get_item(session['email']) if 'email' in session else None date = datetime.datetime.today().strftime("%Y-%m-%d") print date return render_template("book.html", space=space, room=room, user=user, date=date)
def setup_data(): space_controller = SpaceController() room_controller = RoomController() space = space_controller.create_item(space_id='grind_broadway', name='Grind Broadway', address='1412 Broadway, 22nd Fl', city='New York', state='NY', zip='10018', phone='(646) 558 - 6026') room_controller.create_item(space_id=space['space_id'], room_id='play_tank', name='Play Tank', size=5, amenities_list='WiFi, Whiteboard, Coffee/Tea, Filtered Water, Print/Scan/Copy ($), Phone, TV/Monitor, Wired Internet', price=10) room_controller.create_item(space_id=space['space_id'], room_id='shark_tank', name='Shark Tank', size=18, amenities_list='WiFi, Whiteboard, Wired Internet, Coffee/Tea, Filtered Water, Print/Scan/Copy ($), Phone, TV/Monitor, Video Conference', price=25) room_controller.create_item(space_id=space['space_id'], room_id='work_tank', name='Work Tank', size=5, amenities_list='WiFi, Whiteboard, Coffee/Tea, Filtered Water, Print/Scan/Copy ($), Phone,TV/Monitor, Wired Internet', price=10) ''' space = controller.create_space('Grind Park', '419 Park Avenue South, 2nd Fl', 'New York', 'NY', '10016', '(646) 558 - 3250') controller.create_room(space['space_id'], 'Think Tank', 10, 'WiFi, TV/Monitor, Whiteboard, Coffee/Tea, Filtered Water, Print/Scan/Copy ($), Phone, Wired Internet',15) space = controller.create_space('Grind LaSalle', '2 N. LaSalle Street', 'Chicago', 'IL', '60602', '(312) 488 - 4887') controller.create_room(space['space_id'], 'Do Tank', 8, 'WiFi, TV/Monitor, Whiteboard, Wired Internet, Accessibility, Coffee/Tea, Filtered Water, On-site Restaurant, Print/Scan/Copy', 12) controller.create_room(space['space_id'], 'Play Tank', 4, 'WiFi, TV/Monitor, Whiteboard, Accessibility, Coffee/Tea, Filtered Water, Wired Internet, On-site Restaurant, Print/Scan/Copy', 8) controller.create_room(space['space_id'], 'Think Tank', 8, 'WiFi, TV/Monitor, Whiteboard, Wired Internet, Accessibility, Coffee/Tea, Filtered Water, On-site Restaurant, Print/Scan/Copy', 12) controller.create_room(space['space_id'], 'Work Tank', 4, 'WiFi, Whiteboard, Accessibility, Coffee/Tea, Filtered Water, Wired Internet, On-site Restaurant, Print/Scan/Copy', 8) ''' user = UserController().get_item(session['email']) if 'email' in session else None return redirect('/', user=user)