{% macro mapping_table(caption='', field_headings=[], field_headings_visible=True, caption_visible=True, equal_length=False, border_visible=False) -%} {% for field_heading in field_headings %} {% endfor %} {{ caller() }}
{{ caption }}
{% if field_headings_visible %} {{ field_heading }} {% else %} {{ field_heading }} {% endif %}
{%- endmacro %} {% macro list_table(items, caption='', empty_message='', field_headings=[], field_headings_visible=True, caption_visible=True, equal_length=False, border_visible=False) -%} {% set parent_caller = caller %} {% call mapping_table(caption, field_headings, field_headings_visible, caption_visible, equal_length, border_visible) %} {% for item in items %} {% call row(item.id) %} {{ parent_caller(item, loop.index + 1) }} {% endcall %} {% endfor %} {% if not items %} {% call row() %} {{ empty_message }} {% endcall %} {% endif %} {%- endcall %} {%- endmacro %} {% macro row(id=None) -%} {{ caller() }} {%- endmacro %} {% macro row_group(id=None) %} {{ caller() }} {%- endmacro %} {% macro settings_row(if_has_permission='') -%} {% set parent_caller = caller %} {% if if_has_permission in current_service.permissions %} {% call row() %} {{ parent_caller() }} {% endcall %} {% endif %} {%- endmacro %} {% macro field(align='left', status='', border=True, colspan=None, wrap=False) -%} {% set field_alignment = 'table-field-right-aligned' if align == 'right' else 'table-field-center-aligned' if align == 'center' else 'table-field-left-aligned' %} {% set border = '' if border else 'table-field-noborder' %} {% set wrap = 'table-field-wrap-text' if wrap else '' %}
{{ caller() }}
{%- endmacro %} {% macro row_heading() -%} {{ caller() }} {%- endmacro %} {% macro index_field(text=None, rowspan=None) -%} {{ text if text != None else caller() }} {%- endmacro %} {% macro text_field(text, status='', truncate=false, wrap=False) -%} {% call field(status=status, wrap=wrap) %} {% if text is iterable and text is not string %} {% else %} {% if truncate %}
{{text}}
{% else %} {{ text }} {% endif %} {% endif %} {% endcall %} {%- endmacro %} {% macro optional_text_field(text, default='Not set', truncate=false, wrap=False) -%} {{ text_field( text or default, status='' if text else 'default', truncate=truncate, wrap=wrap ) }} {%- endmacro %} {% macro link_field(text, link) -%} {% call field() %} {{ text }} {% endcall %} {%- endmacro %} {% macro edit_field(text, link, permissions=[], suffix=None) -%} {% call field(align='right') %} {% if not permissions or current_user.has_permissions(*permissions) %} {{ text }} {%- if suffix %} {{ suffix }}{% endif -%} {% endif %} {% endcall %} {%- endmacro %} {% macro boolean_field(value) -%} {{ text_field('On' if value else 'Off') }} {%- endmacro %} {% macro right_aligned_field_heading(text) %} {{ text }} {%- endmacro %} {% macro hidden_field_heading(text) %} {{ text }} {%- endmacro %} {% macro notification_status_field(notification) %} {% set displayed_on_single_line = notification.status in ['created', 'pending', 'sending', 'delivered', 'accepted', 'received'] %} {% if not notification %} {% call field(align='right') %}{% endcall %} {% else %} {% set status = notification.status|format_notification_status_as_field_status(notification.notification_type) %} {% call field( status=status, align='right' ) %} {% if displayed_on_single_line %}{% endif %} {% if notification.status|format_notification_status_as_url(notification.notification_type) %} {% endif %} {{ notification.status|format_notification_status(notification.template.template_type) }} {% if notification.status|format_notification_status_as_url(notification.notification_type) %} {% endif %}

{{ notification.status|format_notification_status_as_time( notification.created_at|format_datetime_table, (notification.sent_at or notification.created_at)|format_datetime_table ) }}

{% if displayed_on_single_line %}
{% endif %} {% endcall %} {% endif %} {% endmacro %} {% macro notification_carrier_field(notification) %} {% if not notification %} {% call field(align='right') %}{% endcall %} {% else %} {% call field( align='right' ) %}

{{ notification.carrier}}

{% if displayed_on_single_line %}{% endif %} {% endcall %} {% endif %} {% endmacro %} {% macro notification_carrier_message_field(notification) %} {% if not notification %} {% call field(align='right') %}{% endcall %} {% else %} {% call field( status=status, align='right' ) %}

{{notification.provider_response}}

{% if displayed_on_single_line %}{% endif %} {% endcall %} {% endif %} {% endmacro %} {% macro spark_bar_field( count, max_count, id=None ) %} {% call field(align='right') %} {{ '{:,.0f}'.format(count) }} {% endcall %} {% endmacro %}