Esempio n. 1
0
class AdmTasksTable(Table):
    #allow_sort = True #Done over javascript
    classes = ['table', 'taskstable', 'admin']
    html_attrs = {'id': 'TaskTable'}

    id = Col('Id')
    active = BoolCol('Active')
    equipment = NameCol('Equipment', th_html_attrs={'class': 'col-md-2'})
    name = TaskTagCol('Task', th_html_attrs={'class': 'col-md-3'})
    priority = Col('Priority')
    facility = Col('Facility',
                   attr_list=['equipment', 'facility'],
                   th_html_attrs={'class': 'col-md-1'})
    cycle = Col('Ccl')
    cycletype = OptCol('CType',
                       th_html_attrs={'class': 'col-md-1'},
                       choices=cycletypes.table_choices())
    logging = OptCol('Logging',
                     th_html_attrs={'class': 'col-md-1'},
                     choices=logtypes.table_choices())
    link = LinkCol('Edit',
                   'tasks.edit',
                   url_kwargs=dict(id='id'),
                   th_html_attrs={'class': 'col-md-1'})
    ddate = DateCol('DueDate', th_html_attrs={'class': 'col-md-1'})
class ServicesTable(Table):
    classes = ['table', 'table-striped']
    states = {1: 'Up', 2: 'Down', 3: 'Unspecified'}
    #id = Col('#')
    address = Col('Address')
    name = Col('Name')
    time_of_last_change_of_state = Col('State changed in')
    previous_state = OptCol('Previous state', choices=states)
    current_state = OptCol('Current state', choices=states)
    remove = ButtonCol('Remove',
                       'remove_service',
                       url_kwargs=dict(id='id'),
                       button_attrs={'class': 'remove-btn'})
Esempio n. 3
0
 class MyTable(Table):
     choice = OptCol('Choice Heading',
                     choices={
                         'a': 'A',
                         'b': 'Bbb',
                         'c': 'Ccccc'
                     })
class HistoryTable(Table):
    classes = ['table', 'table-striped']
    states = {1: 'Up', 2: 'Down', 3: 'Unspecified'}
    address = Col('Address')
    name = Col('Name')
    state = OptCol('State', choices=states)
    state_set_time = Col('State changed in')
Esempio n. 5
0
 class MyTable(Table):
     choice = OptCol('Choice Heading',
                     choices={
                         'a': 'A',
                         'b': 'Bbb',
                         'c': 'Ccccc'
                     },
                     default_value='Ddddddd')
Esempio n. 6
0
class BankAccountTable(Table):
    classes = ['table', 'table-condensed', 'table-striped', 'responsive']
    no_items = 'No account defined.'
    account_number = Col('Account Number')
    account_name = Col('Account Name')
    banks = Bank.query.all()
    bank_options = {b.id: b.short_name for b in banks}
    bank_id = OptCol('Bank', choices=bank_options)
class OrdersTable(Table):
    classes = ["table", "table-hover"]
    thead_classes = ["table-dark"]
    date = Col("Date")
    status = OptCol("Status", choices=dict((choice, choice.value) for choice in Status))
    driver = Col("Driver", attr="sponsorship.driver", allow_sort=False)
    sponsor = Col("Sponsor", attr="sponsorship.sponsor", allow_sort=False)
    view = LinkCol("", "order", url_kwargs=dict(id="id"), allow_sort=False, text_fallback="View")

    def sort_url(self, col_key, reverse=False):
        if reverse:
            direction = "desc"
        else:
            direction = "asc"
        return url_for("orders", sort_by=col_key, sort_reverse=direction)
class UsersTable(Table):
    classes = ['table', 'table-striped']
    #id = Col('#')
    name = Col('Name')
    surname = Col('Surname')
    email = Col('Email')
    user_type = OptCol('Type of user',
                       choices={
                           1: 'Admin',
                           2: 'User',
                           3: 'Other'
                       })
    remove = ButtonCol('Remove',
                       'remove_user',
                       url_kwargs=dict(id='id'),
                       button_attrs={'class': 'remove-btn'})
class ManageUsersTable(Table):
    classes = ["table", "table-hover"]
    thead_classes = ["table-dark"]
    user_type = OptCol("User Type", choices=dict((choice, choice.value) for choice in UserTypes))
    first_name = Col("First Name")
    last_name = Col("Last Name")
    email = Col("Email")
    account = LinkCol("", "account", url_kwargs=dict(id="id"), allow_sort=False, text_fallback="Edit")
    delete = ButtonCol("", "remove_user", text_fallback="Remove", url_kwargs=dict(id="id"), button_attrs={"class": "btn btn-danger btn-sm"}, allow_sort=False)
    allow_sort = True

    def sort_url(self, col_key, reverse=False):
        if reverse:
            direction = "desc"
        else:
            direction = "asc"
        return url_for("manage_users", sort_by=col_key, sort_reverse=direction)
Esempio n. 10
0
class UsersTable(Table):
    classes = ['table', 'table-sm']
    id = Col('id')
    created_on = DateCol('Created', date_format='d.MM.yyyy')
    name = LinkCol('Name',
                   'c.profile',
                   attr='name',
                   url_kwargs={'pcode': 'code'})
    osm_name = Col('OSM Name')
    country = Col('Country')
    privacy = OptCol('Privacy', {
        2: 'Open',
        4: 'Confirmed',
        6: 'Profile',
        8: 'Ask',
        10: 'Closed'
    })
    does_requests = BoolNaCol('Requests?')
    is_active = BoolNaCol('Active?')
Esempio n. 11
0
 class MyTable(Table):
     choice = OptCol('Choice Heading')
Esempio n. 12
0
 class MyTable(Table):
     choice = OptCol(
         'Choice Heading', choices=choices, default_value='Ddddddd')
Esempio n. 13
0
 class MyTable(Table):
     choice = OptCol('Choice Heading', choices=choices, default_key='c')