def add(): form = ServiceGroupForm() facade = Facade(form=form) if form.validate_on_submit(): result = g.proxies.ServiceGroups.create(**data) facade.successful = True return facade
def edit(room_id): room = g.proxies.Rooms.from_id(room_id) if not room: aborT(404) printerConfigurations = g.proxies.PrinterConfigurations.list() roomClasses = g.proxies.RoomClasses.list() printerConfigurations.insert(0, ("none", "Default")) roomClasses.insert(0, ("none", "Default")) form = RoomForm(**room['Room']) facade = Facade(form=form, room=room) form.printer_configuration_id.choices = printerConfigurations form.room_class_id.choices = roomClasses if form.validate_on_submit(): if form.printer_configuration_id.data == 'none': form.printer_configuration_id.data = '' if form.room_class_id.data == 'none': form.room_class_id.data = '' room = g.proxies.Rooms.update(room_id, **form.data) print room facade['room_id'] = room['Room']['id'] facade.successful = True return facade
def unlink_pms_group(group_id): form = GroupPmsRemoveForm() facade = Facade(form=form) if form.validate_on_submit(): print g.proxies.Groups.delete_pms_group(group_id, form.pms_group.data) facade.successful = True return facade
def edit(room_id): room = g.proxies.Rooms.from_id(room_id) if not room: aborT(404) printerConfigurations = g.proxies.PrinterConfigurations.list() roomClasses = g.proxies.RoomClasses.list() printerConfigurations.insert(0, ("none", "Default")) roomClasses.insert(0, ("none", "Default")) form = RoomForm(**room['Room']) facade = Facade(form=form, room=room) form.printer_configuration_id.choices = printerConfigurations form.room_class_id.choices = roomClasses if form.validate_on_submit(): if form.printer_configuration_id.data == 'none': form.printer_configuration_id.data = '' if form.room_class_id.data == 'none': form.room_class_id.data = '' room = g.proxies.Rooms.update(room_id, **form.data) print room facade['room_id'] = room['Room']['id'] facade.successful = True return facade
def add(): form = ServiceGroupForm() facade = Facade(form=form) if form.validate_on_submit(): result = g.proxies.ServiceGroups.create(**data) facade.successful = True return facade
def unlink_pms_group(group_id): form = GroupPmsRemoveForm() facade = Facade(form=form) if form.validate_on_submit(): print g.proxies.Groups.delete_pms_group(group_id, form.pms_group.data) facade.successful = True return facade
def add(): form = GroupForm() facade = Facade(form=form) if form.validate_on_submit(): group = g.proxies.Groups.create(**form.data) facade['group_id'] = group['Group']['id'] facade.successful = True return facade
def add(): form = NavigatorAddForm() facade = Facade(form=form) if form.validate_on_submit(): navigator = g.proxies.Navigators.create(**form.data) facade['navigator_id'] = navigator['Navigator']['id'] facade.successful = True return facade
def edit(group_id): form = GroupForm() facade = Facade(form=form) if form.validate_on_submit(): group = g.proxies.Groups.update_group(group_id, **form.data) facade['group_id'] = group['Group']['group_id'] facade.successful = True return facade
def edit(group_id): form = GroupForm() facade = Facade(form=form) if form.validate_on_submit(): group = g.proxies.Groups.update_group(group_id, **form.data) facade['group_id'] = group['Group']['group_id'] facade.successful = True return facade
def add(): form = PrinterConfigurationForm() facade = Facade(form=form) if form.validate_on_submit(): printerConfiguration = g.proxies.PrinterConfigurations.create(**form.data) facade['printer_configuration_id'] = printerConfiguration['PrinterConfiguration']['id'] facade.successful=True return facade
def add(): form = GroupForm() facade = Facade(form=form) if form.validate_on_submit(): group = g.proxies.Groups.create(**form.data) facade['group_id'] = group['Group']['id'] facade.successful = True return facade
def add(): form = TechnicianAddForm() facade = Facade(form=form) if form.validate_on_submit(): flash('Technician account created.', 'success') result = g.proxies.Technicians.create(**form.data) facade.successful = True return facade
def add(): form = TechnicianAddForm() facade = Facade(form=form) if form.validate_on_submit(): flash('Technician account created.', 'success') result = g.proxies.Technicians.create(**form.data) facade.successful = True return facade
def add(): form = PrinterConfigurationForm() facade = Facade(form=form) if form.validate_on_submit(): printerConfiguration = g.proxies.PrinterConfigurations.create( **form.data) facade['printer_configuration_id'] = printerConfiguration[ 'PrinterConfiguration']['id'] facade.successful = True return facade
def link_pms_group(group_id): group = g.proxies.Groups.from_id(group_id) if not group: abort(404) form = GroupPmsForm() facade = Facade(form=form, group=group) if form.validate_on_submit(): print g.proxies.Groups.add_pms_group(group_id, form.pms_group.data) facade.successful = True return facade
def controls(navigator_id): form = NavigatorControlsForm() facade = Facade(form=form) if form.validate_on_submit(): results = g.proxies.Navigators.handle_controls(form.data) if not results is False: facade.successful = True facade['results'] = results return facade
def edit(navigator_id): navigator = g.proxies.Navigators.from_id(navigator_id) if not navigator: abort(404) form = NavigatorEditForm(**navigator['Navigator']) facade = Facade(form=form, navigator=navigator) if form.validate_on_submit(): updated = g.proxies.Navigators.update(navigator_id, **form.data) facade.successful = True return facade
def link_pms_group(group_id): group = g.proxies.Groups.from_id(group_id) if not group: abort(404) form = GroupPmsForm() facade = Facade(form=form, group=group) if form.validate_on_submit(): print g.proxies.Groups.add_pms_group(group_id, form.pms_group.data) facade.successful = True return facade
def add_purchase(stay_id): stay = g.proxies.Stays.from_id(stay_id, with_room=True) if not stay: abort(404) form = StayAddPurchaseForm(stay_id=stay_id) form.service_option_id.choices = g.proxies.ServiceOptions.list() facade = Facade(form=form, stay=stay) if form.validate_on_submit(): g.proxies.Stays.add_purchase(stay_id, form.data) facade.successful = True return facade
def edit(printer_configuration_id): printerConfiguration = g.proxies.PrinterConfigurations.view(printer_configuration_id) if not printerConfiguration: abort(404) form = PrinterConfigurationForm(**printerConfiguration['PrinterConfiguration']) facade = Facade(form=form, printerConfiguration=printerConfiguration) if form.validate_on_submit(): printerConfiguration = g.proxies.PrinterConfigurations.update(printer_configuration_id, **form.data) facade.successful = True return facade
def edit(technician_id): technician = g.proxies.Technicians.from_id(technician_id) if not technician: abort(404) form = TechnicianForm(**technician['Technician']) facade = Facade(form=form, technician=technician) if form.validate_on_submit(): flash('Technician account updated.', 'success') result = g.proxies.Technicians.update(technician_id, **form.data) facade.successful = True return facade
def edit(technician_id): technician = g.proxies.Technicians.from_id(technician_id) if not technician: abort(404) form = TechnicianForm(**technician['Technician']) facade = Facade(form=form, technician=technician) if form.validate_on_submit(): flash('Technician account updated.', 'success') result = g.proxies.Technicians.update(technician_id, **form.data) facade.successful = True return facade
def add_purchase(stay_id): stay = g.proxies.Stays.from_id(stay_id, with_room=True) if not stay: abort(404) form = StayAddPurchaseForm(stay_id=stay_id) form.service_option_id.choices = g.proxies.ServiceOptions.list() facade = Facade(form=form, stay=stay) if form.validate_on_submit(): g.proxies.Stays.add_purchase(stay_id, form.data) facade.successful = True return facade
def edit(service_group_id): serviceGroup = g.proxies.ServiceGroups.from_id(service_group_id) if not serviceGroup: abort(404) form = ServiceGroupForm(**serviceGroup['ServiceGroup']) facade = Facade(form=form, serviceGroup=serviceGroup) if form.validate_on_submit(): result = g.proxies.ServiceGroups.update(service_group_id, **form.data) facade.successful = True return facade
def edit(service_group_id): serviceGroup = g.proxies.ServiceGroups.from_id(service_group_id) if not serviceGroup: abort(404) form = ServiceGroupForm(**serviceGroup['ServiceGroup']) facade = Facade(form=form, serviceGroup=serviceGroup) if form.validate_on_submit(): result = g.proxies.ServiceGroups.update(service_group_id, **form.data) facade.successful = True return facade
def add(): form = ServiceCouponForm() facade = Facade(form=form) groups = g.proxies.ServiceGroups.list() form.service_group_id.choices = groups if form.validate_on_submit(): serviceCoupon = g.proxies.ServiceCoupons.create(**form.data) facade["service_coupon_id"] = serviceCoupon["ServiceCoupon"]["id"] facade.successful = True return facade
def room_move(navigator_id): form = NavigatorRoomForm(navigator_id = navigator_id) facade = Facade(form=form) if form.validate_on_submit(): rooms = g.proxies.Rooms.index(room_number=form.room_number.data) if len(rooms) == 0: flash("The specified room does not exists.", 'error') return facade room = g.proxies.Rooms.update(rooms[0]['Room']['id'], navigator_id=form.navigator_id.data) print room facade.successful = True return facade
def edit(printer_configuration_id): printerConfiguration = g.proxies.PrinterConfigurations.view( printer_configuration_id) if not printerConfiguration: abort(404) form = PrinterConfigurationForm( **printerConfiguration['PrinterConfiguration']) facade = Facade(form=form, printerConfiguration=printerConfiguration) if form.validate_on_submit(): printerConfiguration = g.proxies.PrinterConfigurations.update( printer_configuration_id, **form.data) facade.successful = True return facade
def add(): form = ServiceOptionForm() facade = Facade(form=form) serviceGroups = g.proxies.ServiceGroups.index() groups = g.proxies.ServiceGroups.list() form.service_group_id.choices = groups if form.validate_on_submit(): serviceOption = g.proxies.ServiceOptions.create(**form.data) facade['service_option_id'] = serviceOption['ServiceOption']['id'] facade.successful = True return facade
def create(): form = RoomClassForm() printerConfigurations = g.proxies.PrinterConfigurations.list() printerConfigurations.insert(0, ("none", "Default")) form.printer_configuration_id.choices = printerConfigurations facade = Facade(form=form) if form.validate_on_submit(): if form.printer_configuration_id.data == 'none': form.printer_configuration_id.data = '' roomClass = g.proxies.RoomClasses.create(**form.data) facade.successful = True return facade
def create(): form = RoomClassForm() printerConfigurations = g.proxies.PrinterConfigurations.list() printerConfigurations.insert(0, ("none", "Default")) form.printer_configuration_id.choices = printerConfigurations facade = Facade(form=form) if form.validate_on_submit(): if form.printer_configuration_id.data == "none": form.printer_configuration_id.data = "" roomClass = g.proxies.RoomClasses.create(**form.data) facade.successful = True return facade
def add(): form = ServiceOptionForm() facade = Facade(form=form) serviceGroups = g.proxies.ServiceGroups.index() groups = g.proxies.ServiceGroups.list() form.service_group_id.choices = groups if form.validate_on_submit(): serviceOption = g.proxies.ServiceOptions.create(**form.data) facade['service_option_id'] = serviceOption['ServiceOption']['id'] facade.successful = True return facade
def edit(service_option_id): serviceOption = g.proxies.ServiceOptions.from_id(service_option_id) if not serviceOption: abort(404) form = ServiceOptionForm(**serviceOption['ServiceOption']) facade = Facade(form = form, serviceOption=serviceOption) groups = g.proxies.ServiceGroups.list() form.service_group_id.choices = groups if form.validate_on_submit(): serviceOption = g.proxies.ServiceOptions.update(service_option_id, **form.data) facade['service_option_id'] = service_option_id facade.successful = True return facade
def edit(service_option_id): serviceOption = g.proxies.ServiceOptions.from_id(service_option_id) if not serviceOption: abort(404) form = ServiceOptionForm(**serviceOption['ServiceOption']) facade = Facade(form=form, serviceOption=serviceOption) groups = g.proxies.ServiceGroups.list() form.service_group_id.choices = groups if form.validate_on_submit(): serviceOption = g.proxies.ServiceOptions.update( service_option_id, **form.data) facade['service_option_id'] = service_option_id facade.successful = True return facade
def edit(service_coupon_id): serviceCoupon = g.proxies.ServiceCoupons.from_id(service_coupon_id) if not serviceCoupon: abort(404) serviceCoupon["ServiceCoupon"]["starts"] = date_parser(serviceCoupon["ServiceCoupon"]["starts"]) serviceCoupon["ServiceCoupon"]["expires"] = date_parser(serviceCoupon["ServiceCoupon"]["expires"]) form = ServiceCouponForm(**serviceCoupon["ServiceCoupon"]) facade = Facade(form=form, serviceCoupon=serviceCoupon) groups = g.proxies.ServiceGroups.list() form.service_group_id.choices = groups if form.validate_on_submit(): serviceCoupon = g.proxies.ServiceCoupons.update(service_coupon_id, **form.data) facade["service_coupon_id"] = serviceCoupon["ServiceCoupon"]["id"] facade.successful = True return facade
def add(): groups = g.proxies.Groups.list() form = MailForm() form.recipients.choices = [('rooms', 'Rooms'), ('floors', 'Floors'), ('groups', 'Groups')] form.groups.choices = groups form.sender.choices = mail_sender_choices() facade = Facade(form=form) #TODO Move this to async as it will be slow. if form.validate_on_submit(): # TODO Create the list of StaysMessage needed to link stays and messages data = form.data data['sender'] = mail_process_sender(data['sender'], form.sender.choices) mail = g.proxies.Mails.create(**data) facade.successful = True facade['mail_id'] = mail['StayMessage']['id'] return facade
def update(room_class_id): roomClass = g.proxies.RoomClasses.from_id(room_class_id) if not roomClass: abort(404) form = RoomClassForm(**roomClass["RoomClass"]) facade = Facade(form=form, roomClass=roomClass) printerConfigurations = g.proxies.PrinterConfigurations.list() printerConfigurations.insert(0, ("none", "Default")) form.printer_configuration_id.choices = printerConfigurations if form.validate_on_submit(): if form.printer_configuration_id.data == "none": form.printer_configuration_id.data = "" print form.data roomClass = g.proxies.RoomClasses.update(room_class_id, **form.data) facade.successful = True return facade
def update(room_class_id): roomClass = g.proxies.RoomClasses.from_id(room_class_id) if not roomClass: abort(404) form = RoomClassForm(**roomClass['RoomClass']) facade = Facade(form=form, roomClass=roomClass) printerConfigurations = g.proxies.PrinterConfigurations.list() printerConfigurations.insert(0, ("none", "Default")) form.printer_configuration_id.choices = printerConfigurations if form.validate_on_submit(): if form.printer_configuration_id.data == 'none': form.printer_configuration_id.data = '' print form.data roomClass = g.proxies.RoomClasses.update(room_class_id, **form.data) facade.successful = True return facade
def by_room_number(): form = RoomSearchForm() room_number = form.room_number.data facade = Facade(form=form, room_number=room_number) if form.validate_on_submit(): options = dict(room_number=room_number, active=form.active.data, with_guests=True) stays = g.proxies.Stays.index(**options) if not stays: facade.empty_results = True flash('No stays were found for room %s' % room_number, 'error') return facade for stay in stays: stay['Room'] = {'room_number': form.room_number.data} facade['stays'] = stays facade.successful = True return facade
def add(): printerConfigurations = g.proxies.PrinterConfigurations.list() roomClasses = g.proxies.RoomClasses.list() printerConfigurations.insert(0, ("none", "Default")) roomClasses.insert(0, ("none", "Default")) form = RoomForm() facade = Facade(form=form) form.printer_configuration_id.choices = printerConfigurations form.room_class_id.choices = roomClasses if form.validate_on_submit(): if form.printer_configuration_id.data == 'none': form.printer_configuration_id.data = '' if form.room_class_id.data == 'none': form.room_class_id.data = '' room = g.proxies.Rooms.create(**form.data) print form.data print room facade['room_id'] = room['Room']['id'] facade.successful = True return facade
def add(): printerConfigurations = g.proxies.PrinterConfigurations.list() roomClasses = g.proxies.RoomClasses.list() printerConfigurations.insert(0, ("none", "Default")) roomClasses.insert(0, ("none", "Default")) form = RoomForm() facade = Facade(form=form) form.printer_configuration_id.choices = printerConfigurations form.room_class_id.choices = roomClasses if form.validate_on_submit(): if form.printer_configuration_id.data == 'none': form.printer_configuration_id.data = '' if form.room_class_id.data == 'none': form.room_class_id.data = '' room = g.proxies.Rooms.create(**form.data) print form.data print room facade['room_id'] = room['Room']['id'] facade.successful = True return facade
def by_room_number(): form = RoomSearchForm() room_number = form.room_number.data facade = Facade(form=form, room_number=room_number) if form.validate_on_submit(): options = dict( room_number=room_number, active=form.active.data, with_guests=True ) stays = g.proxies.Stays.index(**options) if not stays: facade.empty_results = True flash('No stays were found for room %s' % room_number, 'error') return facade for stay in stays: stay['Room'] = {'room_number' : form.room_number.data} facade['stays'] = stays facade.successful = True return facade