def update_status(request): booking_room_id = request.POST.get('id') st = request.POST.get('status') res = Res() data = Business.updated_status(booking_room_id, st) res.set_message_detail('success') return res.done()
def edit_room(request): date = request.POST.get('date') start_time = request.POST.get('start_time') end_time = request.POST.get('end_time') booking_room_id = request.POST.get('id') res = Res() data = Business.edit_end_time(booking_room_id, date, start_time, end_time) if data == 0: res.set_message_code(0) res.set_message_detail('fail') # res.set_status_code(status.HTTP_404_NOT_FOUND) else: res.set_message_detail('success') # res.set_status_code(status.HTTP_404_NOT_FOUND) return res.done()
def get_max_room_size(request): res = Res() data = Business.get_max_size() res.set_data(data) return res.done()
def get_room_size(request): room_id = request.POST.get('room_id') # size = request.POST.get('size') res = Res() data = Business.get_room_size_by_room_id(room_id) print(len(data)) if len(data) == 0: res.set_data(data) res.set_message_code(0) res.set_status_code(status.HTTP_404_NOT_FOUND) else: res.set_data(data[0]) return res.done()
def check_exist_room(request): room_id = request.POST.get('room_id') res = Res() if not Business.check_room(room_id): res.set_message_code(0) res.set_message_detail('fail') res.set_data(Business.find_list_room()) else: res.set_message_detail('success') return res.done()
def find_duration_time(request): room_id = request.POST.get('room_id') res = Res() data = Business.find_booked_duration_time(room_id) res.set_data(data) return res.done()
def find_all_room(request): res = Res() data = Business.find_list_room() res.set_data(data) return res.done()