Exemplo n.º 1
0
def view(stay_id):
    stay = g.proxies.Stays.from_id(stay_id,
                                   with_guest=True,
                                   with_room=True,
                                   with_passport_account=True)

    if not stay:
        return None

    printerConfigurationId = stay['Room'].get('printer_configuration_id', None)
    if printerConfigurationId:
        printerConfiguration = g.proxies.PrinterConfigurations.from_id(
            printerConfigurationId)
        stay['PrinterConfiguration'] = printerConfiguration
    else:
        stay['PrinterConfiguration'] = None

    navigator = g.proxies.Navigators.from_id(stay['Room']['navigator_id'])

    group = g.proxies.Groups.from_id(
        stay['Stay']['group_id']) if stay['Stay']['group_id'] else None

    navigator_id = navigator['Navigator']['id'] if navigator else None

    navigatorControlsForm = NavigatorControlsForm(id=navigator_id)
    return Facade(navigator=navigator,
                  group=group,
                  navigator_id=navigator_id,
                  navigatorControlsForm=navigatorControlsForm,
                  stay=stay)
def add():
    form = ServiceGroupForm()
    facade = Facade(form=form)
    if form.validate_on_submit():
        result = g.proxies.ServiceGroups.create(**data)
        facade.successful = True
    return facade
Exemplo n.º 3
0
def index(page):
    limit = app.config.get('PAGINATOR_PER_PAGE', 25)
    count = g.proxies.Mails.count()
    mails = g.proxies.Mails.index(page=page, limit=limit)
    paginator = Paginator(page, limit, count)
    facade = Facade(mails=mails,paginator=paginator)
    return facade
Exemplo n.º 4
0
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
Exemplo n.º 5
0
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
Exemplo n.º 6
0
def view(room_class_id):
    roomClass = g.proxies.RoomClasses.from_id(room_class_id)
    if not roomClass:
        abort(404)

    printerConfigurations = dict(g.proxies.PrinterConfigurations.list())
    facade = Facade(roomClass=roomClass, printerConfigurations=printerConfigurations)
    return facade
def index(page):
    limit = app.config.get('PAGINATOR_PER_PAGE', 25)
    serviceGroups = g.proxies.ServiceGroups.index(page=page, limit=limit)
    count = g.proxies.ServiceGroups.count()

    paginator = Paginator(page, limit, count)
    facade = Facade(serviceGroups=serviceGroups, paginator=paginator)
    return facade
Exemplo n.º 8
0
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
Exemplo n.º 9
0
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
Exemplo n.º 10
0
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
Exemplo n.º 11
0
def view(service_purchase_id):
    servicePurchase = g.proxies.ServicePurchases.from_id(service_purchase_id,
                                                         with_stay=True)
    if not servicePurchase:
        abort(404)

    facade = Facade(servicePurchase=servicePurchase)
    return facade
Exemplo n.º 12
0
def index(page):
    limit = app.config.get('PAGINATOR_PER_PAGE', 25)
    printJobs = g.proxies.StayPrintjobs.index(page=page, limit=limit)
    count = g.proxies.StayPrintjobs.count()

    paginator = Paginator(page, limit, count)
    facade = Facade(stayPrintJobs=printJobs, paginator=paginator)
    return facade
Exemplo n.º 13
0
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
Exemplo n.º 14
0
def view(navigator_id):
    '''
    View a specific navigator
    '''

    navigator = g.proxies.Navigators.from_id(navigator_id, with_room=True)
    if not navigator:
        abort(404)
    form = NavigatorRoomForm(navigator_id = navigator['Navigator']['id'])
    return Facade(navigator=navigator, room_move_form = form)
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
Exemplo n.º 16
0
def purchases(stay_id):
    stay = g.proxies.Stays.from_id(stay_id,
                                   with_room=True,
                                   with_passport_account=True)
    if not stay:
        abort(404)
    purchases = g.proxies.Stays.purchases(stay_id)
    serviceGroups = dict(g.proxies.ServiceGroups.list())

    return Facade(stay=stay, purchases=purchases, serviceGroups=serviceGroups)
Exemplo n.º 17
0
def view(service_option_id):
    serviceOption = g.proxies.ServiceOptions.from_id(service_option_id)
    if not serviceOption:
        abort(404)

    serviceGroup = g.proxies.ServiceGroups.from_id(
        serviceOption['ServiceOption']['service_group_id'])

    facade = Facade(serviceOption=serviceOption, serviceGroup=serviceGroup)
    return facade
Exemplo n.º 18
0
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
Exemplo n.º 19
0
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
Exemplo n.º 20
0
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
Exemplo n.º 21
0
def index(page):
    '''
    Paginates all the navigators
    '''

    limit = app.config.get('PAGINATOR_PER_PAGE', 25)
    count = g.proxies.Navigators.count()
    navigators = g.proxies.Navigators.index(page=page, limit=limit)
    paginator = Paginator(page, limit, count)
    facade = Facade(navigators=navigators, paginator=paginator)
    return facade
Exemplo n.º 22
0
def index(page):
    limit = app.config.get('PAGINATOR_PER_PAGE', 25)
    stays = g.proxies.Stays.index(active=True,
                                  page=page,
                                  with_rooms=True,
                                  with_guests=True,
                                  limit=limit)
    count = g.proxies.Stays.count(active=True)
    paginator = Paginator(page, limit, count)

    return Facade(stays=stays, paginator=paginator)
Exemplo n.º 23
0
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
Exemplo n.º 24
0
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
Exemplo n.º 25
0
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
Exemplo n.º 26
0
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
Exemplo n.º 27
0
def index(page):
    limit = app.config.get('PAGINATOR_PER_PAGE', 25)
    servicePurchases = g.proxies.ServicePurchases.index(
        page=page, limit=limit, with_service_options=True)

    serviceGroups = dict(g.proxies.ServiceGroups.list())

    count = g.proxies.ServicePurchases.count()

    paginator = Paginator(page, limit, count)

    facade = Facade(servicePurchases=servicePurchases,
                    paginator=paginator,
                    serviceGroups=serviceGroups)
    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
Exemplo n.º 29
0
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
Exemplo n.º 30
0
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