Exemplo n.º 1
0
class BankAccountActivityTable(BootstrapTable):
    """A table for displaying bank account activities """
    bank_account = Column("Bankkonto", width=1)
    name = Column("Name", width=2)
    valid_on = DateColumn("Gültig am", width=1)
    imported_at = DateColumn("Importiert am", hide_if=lambda: True)
    reference = Column("Verwendungszweck")
    iban = Column("IBAN", hide_if=lambda: True)
    amount = Column("Betrag", width=1, formatter="table.euroFormatter")
    actions = MultiBtnColumn("Aktionen", width=1)

    def __init__(self, *a, **kw):
        table_args = kw.pop('table_args', {})
        table_args.setdefault('data-detail-view', "true")
        table_args.setdefault('data-row-style', "table.financeRowFormatter")
        table_args.setdefault('data-detail-formatter',
                              "table.bankAccountActivitiesDetailFormatter")
        kw['table_args'] = table_args

        super().__init__(*a, **kw)

    class Meta:
        table_args = {
            'data-sort-order': 'desc',
            'data-sort-name': 'valid_on',
        }
Exemplo n.º 2
0
class HostTable(BootstrapTable):
    """A table for displaying hosts
    """
    name = Column("Name")
    switch = Column("Switch")
    port = Column("SwitchPort")
    actions = MultiBtnColumn("Aktionen", hide_if=no_hosts_change, width=3)
    interfaces_table_link = Column("", hide_if=lambda: True)
    interface_create_link = Column("", hide_if=lambda: True)
    id = Column("", hide_if=lambda: True)

    def __init__(self, *a, user_id=None, **kw):
        table_args = kw.pop('table_args', {})
        table_args.setdefault('data-load-subtables', "true")
        table_args.setdefault('data-detail-view', "true")
        table_args.setdefault('data-detail-formatter', "table.hostDetailFormatter")
        table_args.setdefault('data-response-handler', "table.userHostResponseHandler")
        kw['table_args'] = table_args

        super().__init__(*a, **kw)
        self.user_id = user_id

    @property
    def toolbar(self):
        if self.user_id is None:
            return
        if no_hosts_change():
            return

        href = url_for("host.host_create", user_id=self.user_id)
        return button_toolbar("Host", href)
Exemplo n.º 3
0
class MembershipTable(BootstrapTable):
    """A table for displaying memberships

    In the toolbar, a “new membership” button is inserted if the
    :py:obj:`current_user` has the ``add_membership`` property.
    """
    group_name = Column("Gruppe")
    begins_at = DateColumn("Beginn")
    ends_at = DateColumn("Ende")
    actions = MultiBtnColumn("Aktionen", hide_if=no_membership_change)

    def __init__(self, *a, user_id=None, **kw):
        super().__init__(*a, **kw)
        self.user_id = user_id

    @property
    def toolbar(self):
        if self.user_id is None:
            return
        if no_membership_change():
            return

        href = url_for(".add_membership", user_id=self.user_id)
        return button_toolbar("Mitgliedschaft", href)

    class Meta:
        table_args = {
            'data-row-attributes': 'table.membershipRowAttributes',
            'data-row-style': 'table.membershipRowFormatter',
            'class': 'membership-table'
        }
Exemplo n.º 4
0
class UnconfirmedTransactionsTable(BootstrapTable):
    """A table for displaying unconfirmed transactions """
    description = LinkColumn("Beschreibung")
    user = LinkColumn("Nutzer")
    room = Column("Wohnort")
    date = DateColumn("Datum")
    amount = Column("Wert")
    author = LinkColumn("Ersteller")
    actions = MultiBtnColumn("Aktionen")
Exemplo n.º 5
0
class PreMemberTable(BootstrapTable):
    prm_id = Column("ID")
    name = TextWithBooleanColumn("Name")
    login = Column("Login")
    email = TextWithBooleanColumn("E-Mail Adresse")
    move_in_date = DateColumn("Einzug am")
    actions = MultiBtnColumn("Aktionen", hide_if=no_membership_change, width=1)

    class Meta:
        table_args = {
            'data-row-style': 'table.membershipRequestRowFormatter',
        }
Exemplo n.º 6
0
class BuildingLevelRoomTable(BootstrapTable):
    class Meta:
        table_args = {
            'data-sort-name': 'room',
            'data-query-params': 'perhaps_all_users_query_params',
        }

    room = LinkColumn("Raum")
    inhabitants = MultiBtnColumn('Bewohner')

    @property
    def toolbar(self):
        return toggle_button_toolbar("Display all users",
                                     id="rooms-toggle-all-users",
                                     icon="fa-user")
Exemplo n.º 7
0
class MembershipFeeTable(BootstrapTable):
    """A table for displaying the current membership fees"""
    name = Column("Name")
    regular_fee = Column("Regulär")
    payment_deadline = Column("Frist")
    payment_deadline_final = Column("Endgültige Frist")
    begins_on = DateColumn("Beginn")
    ends_on = DateColumn("Ende")
    actions = MultiBtnColumn("Aktionen")

    @property
    def toolbar(self):
        """An “add fee” button"""
        href = url_for(".membership_fee_create")
        return button_toolbar(gettext("Beitrag erstellen"), href)
Exemplo n.º 8
0
class InterfaceTable(BootstrapTable):
    """A table for displaying interfaces
    """
    name = Column("Name")
    mac = Column("MAC")
    ips = Column("IPs")
    actions = MultiBtnColumn("Aktionen", hide_if=no_hosts_change)

    def __init__(self, *a, host_id=None, **kw):
        table_args = kw.pop('table_args', {})
        table_args.setdefault('data-hide-pagination-info', "true")
        table_args.setdefault('data-search', "false")
        kw['table_args'] = table_args

        super().__init__(*a, **kw)
        self.host_id = host_id
Exemplo n.º 9
0
class SiteTable(BootstrapTable):
    site = LinkColumn("Site")
    buildings = MultiBtnColumn("Buildings")
Exemplo n.º 10
0
class RoomOvercrowdedTable(BootstrapTable):
    room = LinkColumn("Raum")
    inhabitants = MultiBtnColumn("Bewohner")

    class Meta:
        table_args = {'data-sort-name': 'room'}