Skip to content

Tables

hypha.apply.projects.tables

BaseInvoiceTable

Bases: Table

invoice_number class-attribute instance-attribute

invoice_number = LinkColumn('funds:projects:invoice-detail', verbose_name=gettext_lazy('Invoice Number'), args=[A('project__submission__pk'), A('pk')], attrs={'td': {'class': 'js-title'}, 'a': {'class': "truncate inline-block w-[calc(100%-2rem)] after:content-[''] after:block"}})

status class-attribute instance-attribute

status = Column(attrs={'td': {'data-actions': render_invoice_actions, 'class': 'js-actions'}})

requested_at class-attribute instance-attribute

requested_at = DateColumn(verbose_name=gettext_lazy('Submitted'))

invoice_date class-attribute instance-attribute

invoice_date = DateColumn(verbose_name=gettext_lazy('Invoice date'))

InvoiceDashboardTable

Bases: BaseInvoiceTable

project class-attribute instance-attribute

project = Column(verbose_name=gettext_lazy('Project Name'))

invoice_number class-attribute instance-attribute

invoice_number = LinkColumn('funds:projects:invoice-detail', verbose_name=gettext_lazy('Invoice Number'), args=[A('project__submission__pk'), A('pk')], attrs={'td': {'class': 'js-title'}, 'a': {'class': "truncate inline-block w-[calc(100%-2rem)] after:content-[''] after:block"}})

status class-attribute instance-attribute

status = Column(attrs={'td': {'data-actions': render_invoice_actions, 'class': 'js-actions'}})

requested_at class-attribute instance-attribute

requested_at = DateColumn(verbose_name=gettext_lazy('Submitted'))

invoice_date class-attribute instance-attribute

invoice_date = DateColumn(verbose_name=gettext_lazy('Invoice date'))

Meta

fields class-attribute instance-attribute
fields = ['requested_at', 'invoice_number', 'status', 'project']
model class-attribute instance-attribute
model = Invoice
order_by class-attribute instance-attribute
order_by = ['-requested_at']
template_name class-attribute instance-attribute
template_name = 'application_projects/tables/table.html'
attrs class-attribute instance-attribute
attrs = {'class': 'invoices-table'}

render_project

render_project(record)
Source code in hypha/apply/projects/tables.py
def render_project(self, record):
    return get_project_title(record.project)

FinanceInvoiceTable

Bases: BaseInvoiceTable

vendor_name class-attribute instance-attribute

vendor_name = Column(verbose_name=gettext_lazy('Vendor Name'), empty_values=())

selected class-attribute instance-attribute

selected = LabeledCheckboxColumn(accessor=A('pk'), attrs={'input': {'class': 'js-batch-select'}, 'th__input': {'class': 'js-batch-select-all'}})

invoice_number class-attribute instance-attribute

invoice_number = LinkColumn('funds:projects:invoice-detail', verbose_name=gettext_lazy('Invoice Number'), args=[A('project__submission__pk'), A('pk')], attrs={'td': {'class': 'js-title'}, 'a': {'class': "truncate inline-block w-[calc(100%-2rem)] after:content-[''] after:block"}})

status class-attribute instance-attribute

status = Column(attrs={'td': {'data-actions': render_invoice_actions, 'class': 'js-actions'}})

requested_at class-attribute instance-attribute

requested_at = DateColumn(verbose_name=gettext_lazy('Submitted'))

invoice_date class-attribute instance-attribute

invoice_date = DateColumn(verbose_name=gettext_lazy('Invoice date'))

Meta

fields class-attribute instance-attribute
fields = ['selected', 'invoice_date', 'requested_at', 'vendor_name', 'invoice_number', 'invoice_amount', 'status']
model class-attribute instance-attribute
model = Invoice
orderable class-attribute instance-attribute
orderable = True
sequence class-attribute instance-attribute
sequence = fields
order_by class-attribute instance-attribute
order_by = ['-requested_at', 'invoice_date']
template_name class-attribute instance-attribute
template_name = 'application_projects/tables/table.html'
attrs class-attribute instance-attribute
attrs = {'class': 'invoices-table'}
row_attrs class-attribute instance-attribute
row_attrs = {'data-record-id': lambda record: id}

render_vendor_name

render_vendor_name(record)
Source code in hypha/apply/projects/tables.py
def render_vendor_name(self, record):
    return record.project.user

AdminInvoiceListTable

Bases: BaseInvoiceTable

project class-attribute instance-attribute

project = Column(verbose_name=gettext_lazy('Project Name'))

selected class-attribute instance-attribute

selected = LabeledCheckboxColumn(accessor=A('pk'), attrs={'th': {'class': 'w-8'}, 'input': {'class': 'js-batch-select'}, 'th__input': {'class': 'js-batch-select-all'}})

invoice_number class-attribute instance-attribute

invoice_number = LinkColumn('funds:projects:invoice-detail', verbose_name=gettext_lazy('Invoice Number'), args=[A('project__submission__pk'), A('pk')], attrs={'td': {'class': 'js-title'}, 'a': {'class': "truncate inline-block w-[calc(100%-2rem)] after:content-[''] after:block"}})

status class-attribute instance-attribute

status = Column(attrs={'td': {'data-actions': render_invoice_actions, 'class': 'js-actions'}})

requested_at class-attribute instance-attribute

requested_at = DateColumn(verbose_name=gettext_lazy('Submitted'))

invoice_date class-attribute instance-attribute

invoice_date = DateColumn(verbose_name=gettext_lazy('Invoice date'))

Meta

fields class-attribute instance-attribute
fields = ['selected', 'invoice_number', 'invoice_date', 'requested_at', 'status', 'project']
model class-attribute instance-attribute
model = Invoice
orderable class-attribute instance-attribute
orderable = True
sequence class-attribute instance-attribute
sequence = fields
order_by class-attribute instance-attribute
order_by = ['-requested_at']
template_name class-attribute instance-attribute
template_name = 'application_projects/tables/table.html'
attrs class-attribute instance-attribute
attrs = {'class': 'invoices-table'}
row_attrs class-attribute instance-attribute
row_attrs = {'data-record-id': lambda record: id}

render_project

render_project(record)
Source code in hypha/apply/projects/tables.py
def render_project(self, record):
    return get_project_title(record.project)

BaseProjectsTable

Bases: Table

title class-attribute instance-attribute

title = LinkColumn('funds:submissions:project', args=[A('application_id')])

status class-attribute instance-attribute

status = Column(verbose_name=gettext_lazy('Status'), accessor='get_status_display', order_by=('status',))

fund class-attribute instance-attribute

fund = Column(verbose_name=gettext_lazy('Fund'), accessor='submission__page')

reporting class-attribute instance-attribute

reporting = Column(verbose_name=gettext_lazy('Reporting'), accessor='pk')

last_payment_request class-attribute instance-attribute

last_payment_request = DateColumn()

order_reporting

order_reporting(qs, is_descending)
Source code in hypha/apply/projects/tables.py
def order_reporting(self, qs, is_descending):
    direction = "-" if is_descending else ""

    qs = qs.order_by(f"{direction}outstanding_reports")

    return qs, True

render_title

render_title(record)
Source code in hypha/apply/projects/tables.py
def render_title(self, record):
    return get_project_title(record)

render_reporting

render_reporting(record)
Source code in hypha/apply/projects/tables.py
def render_reporting(self, record):
    if not hasattr(record, "report_config"):
        return "-"

    if record.report_config.is_up_to_date():
        return "Up to date"

    if record.report_config.has_very_late_reports():
        display = f"<span class='text-red-500 inline-block align-text-bottom me-1'>{heroicon_outline(name='exclamation-triangle', size=20)}</span>"
    else:
        display = ""

    display += f"{record.report_config.outstanding_reports()} outstanding"
    return mark_safe(display)

ProjectsDashboardTable

Bases: BaseProjectsTable

title class-attribute instance-attribute

title = LinkColumn('funds:submissions:project', args=[A('application_id')])

status class-attribute instance-attribute

status = Column(verbose_name=gettext_lazy('Status'), accessor='get_status_display', order_by=('status',))

fund class-attribute instance-attribute

fund = Column(verbose_name=gettext_lazy('Fund'), accessor='submission__page')

reporting class-attribute instance-attribute

reporting = Column(verbose_name=gettext_lazy('Reporting'), accessor='pk')

last_payment_request class-attribute instance-attribute

last_payment_request = DateColumn()

Meta

fields class-attribute instance-attribute
fields = ['title', 'status', 'fund', 'reporting', 'last_payment_request', 'created_at']
model class-attribute instance-attribute
model = Project
template_name class-attribute instance-attribute
template_name = 'application_projects/tables/table.html'
orderable class-attribute instance-attribute
orderable = False
attrs class-attribute instance-attribute
attrs = {'class': 'projects-table'}

order_reporting

order_reporting(qs, is_descending)
Source code in hypha/apply/projects/tables.py
def order_reporting(self, qs, is_descending):
    direction = "-" if is_descending else ""

    qs = qs.order_by(f"{direction}outstanding_reports")

    return qs, True

render_title

render_title(record)
Source code in hypha/apply/projects/tables.py
def render_title(self, record):
    return get_project_title(record)

render_reporting

render_reporting(record)
Source code in hypha/apply/projects/tables.py
def render_reporting(self, record):
    if not hasattr(record, "report_config"):
        return "-"

    if record.report_config.is_up_to_date():
        return "Up to date"

    if record.report_config.has_very_late_reports():
        display = f"<span class='text-red-500 inline-block align-text-bottom me-1'>{heroicon_outline(name='exclamation-triangle', size=20)}</span>"
    else:
        display = ""

    display += f"{record.report_config.outstanding_reports()} outstanding"
    return mark_safe(display)

ProjectsAssigneeDashboardTable

Bases: BaseProjectsTable

title class-attribute instance-attribute

title = LinkColumn('funds:submissions:project', args=[A('application_id')])

status class-attribute instance-attribute

status = Column(verbose_name=gettext_lazy('Status'), accessor='get_status_display', order_by=('status',))

fund class-attribute instance-attribute

fund = Column(verbose_name=gettext_lazy('Fund'), accessor='submission__page')

reporting class-attribute instance-attribute

reporting = Column(verbose_name=gettext_lazy('Reporting'), accessor='pk')

last_payment_request class-attribute instance-attribute

last_payment_request = DateColumn()

Meta

fields class-attribute instance-attribute
fields = ['title', 'fund', 'lead', 'reporting', 'last_payment_request', 'created_at']
model class-attribute instance-attribute
model = Project
orderable class-attribute instance-attribute
orderable = False
exclude class-attribute instance-attribute
exclude = ['status']
attrs class-attribute instance-attribute
attrs = {'class': 'projects-table'}

order_reporting

order_reporting(qs, is_descending)
Source code in hypha/apply/projects/tables.py
def order_reporting(self, qs, is_descending):
    direction = "-" if is_descending else ""

    qs = qs.order_by(f"{direction}outstanding_reports")

    return qs, True

render_title

render_title(record)
Source code in hypha/apply/projects/tables.py
def render_title(self, record):
    return get_project_title(record)

render_reporting

render_reporting(record)
Source code in hypha/apply/projects/tables.py
def render_reporting(self, record):
    if not hasattr(record, "report_config"):
        return "-"

    if record.report_config.is_up_to_date():
        return "Up to date"

    if record.report_config.has_very_late_reports():
        display = f"<span class='text-red-500 inline-block align-text-bottom me-1'>{heroicon_outline(name='exclamation-triangle', size=20)}</span>"
    else:
        display = ""

    display += f"{record.report_config.outstanding_reports()} outstanding"
    return mark_safe(display)

PAFForReviewDashboardTable

Bases: Table

date_requested class-attribute instance-attribute

date_requested = DateColumn(verbose_name=gettext_lazy('Date requested'), accessor='created_at', orderable=True)

title class-attribute instance-attribute

title = LinkColumn('funds:submissions:project', args=[A('application_id')], orderable=False)

status class-attribute instance-attribute

status = Column(verbose_name=gettext_lazy('Status'), accessor='pk', orderable=False)

fund class-attribute instance-attribute

fund = Column(verbose_name=gettext_lazy('Fund'), accessor='project__submission__page', orderable=False)

assignee class-attribute instance-attribute

assignee = Column(verbose_name=gettext_lazy('Assignee'), accessor='user', orderable=False)

Meta

fields class-attribute instance-attribute
fields = ['date_requested', 'title', 'fund', 'status', 'assignee']
model class-attribute instance-attribute
model = PAFApprovals
template_name class-attribute instance-attribute
template_name = 'funds/tables/table.html'
attrs class-attribute instance-attribute
attrs = {'class': 'paf-review-table'}

order_date_requested

order_date_requested(qs, is_descending)
Source code in hypha/apply/projects/tables.py
def order_date_requested(self, qs, is_descending):
    direction = "-" if is_descending else ""

    qs = qs.order_by(f"{direction}created_at")

    return qs, True

render_status

render_status(record)
Source code in hypha/apply/projects/tables.py
def render_status(self, record):
    if record.user:
        return _("Waiting for approval")
    else:
        return _("Waiting for assignee")

render_title

render_title(record)
Source code in hypha/apply/projects/tables.py
def render_title(self, record):
    return get_project_title(record.project)

ProjectsListTable

Bases: BaseProjectsTable

title class-attribute instance-attribute

title = LinkColumn('funds:submissions:project', args=[A('application_id')])

status class-attribute instance-attribute

status = Column(verbose_name=gettext_lazy('Status'), accessor='get_status_display', order_by=('status',))

fund class-attribute instance-attribute

fund = Column(verbose_name=gettext_lazy('Fund'), accessor='submission__page')

reporting class-attribute instance-attribute

reporting = Column(verbose_name=gettext_lazy('Reporting'), accessor='pk')

last_payment_request class-attribute instance-attribute

last_payment_request = DateColumn()

Meta

fields class-attribute instance-attribute
fields = ['title', 'status', 'lead', 'fund', 'reporting', 'last_payment_request', 'created_at']
model class-attribute instance-attribute
model = Project
orderable class-attribute instance-attribute
orderable = True
order_by class-attribute instance-attribute
order_by = ('-created_at',)
template_name class-attribute instance-attribute
template_name = 'application_projects/tables/table.html'
attrs class-attribute instance-attribute
attrs = {'class': 'projects-table'}

order_reporting

order_reporting(qs, is_descending)
Source code in hypha/apply/projects/tables.py
def order_reporting(self, qs, is_descending):
    direction = "-" if is_descending else ""

    qs = qs.order_by(f"{direction}outstanding_reports")

    return qs, True

render_title

render_title(record)
Source code in hypha/apply/projects/tables.py
def render_title(self, record):
    return get_project_title(record)

render_reporting

render_reporting(record)
Source code in hypha/apply/projects/tables.py
def render_reporting(self, record):
    if not hasattr(record, "report_config"):
        return "-"

    if record.report_config.is_up_to_date():
        return "Up to date"

    if record.report_config.has_very_late_reports():
        display = f"<span class='text-red-500 inline-block align-text-bottom me-1'>{heroicon_outline(name='exclamation-triangle', size=20)}</span>"
    else:
        display = ""

    display += f"{record.report_config.outstanding_reports()} outstanding"
    return mark_safe(display)

render_invoice_actions

render_invoice_actions(table, record)
Source code in hypha/apply/projects/tables.py
def render_invoice_actions(table, record):
    user = table.context["user"]
    actions = get_invoice_possible_transition_for_user(user, invoice=record)
    return json.dumps([str(slugify(action)) for action, _ in actions])