{% extends 'creme_core/bricks/base/table.html' %} {% load i18n creme_bricks creme_widgets %} {% load has_perm_to is_none url from creme_core_tags %} {% block brick_extra_class %}{{block.super}} brick-reorderable reports-fields-brick{% endblock %} {% block brick_script %} {% endblock %} {% block brick_header_title %} {% brick_header_title title=_('Columns of the report') icon='graph' %} {% endblock %} {% block brick_header_actions %} {% has_perm_to change object as has_perm %} {% brick_header_action id='edit' url='reports__edit_fields'|url:object.id label=_('Edit the columns') enabled=has_perm %} {% endblock %} {% block brick_table_columns %} {% if columns %} {% brick_table_column title='' %} {% brick_table_column title=_('Column') status='primary' %} {% brick_table_column title=_('Displayed in the report') %} {% brick_table_column title=_('Type') %} {% brick_table_column title=_('Action') status='action' %} {% if expand %} {% brick_table_column title=_('Expand?') status='action nowrap' %} {% endif %} {% else %} {% translate 'No column set for the moment' %} {% endif %} {% endblock %} {% block brick_table_body %} {% if columns %} {% has_perm_to change object as has_perm %}{% has_perm_to link object as link_perm %} {% widget_icon name='reorder' size='brick-table-action' class='icon brick-reorderable-handle-icon' as reorder_icon %} {% for column in columns %} {% with sub_report=column.sub_report %} {{reorder_icon.render}} {{column}} {% if sub_report %} {% translate 'Columns of' %} {{sub_report}} ({{sub_report.columns|join:', '}}) {% else %} {% translate 'Value' %} {% endif %} {{column.hand.verbose_name}} {% if not column.hand.get_linkable_ctypes|is_none %} {% if sub_report %}{% has_perm_to unlink sub_report as unlink_sub_report_perm %} {% brick_table_action id='update' url='reports__unlink_report'|url __field_id=column.id label=_('Unlink the report') display='text' enabled=unlink_sub_report_perm %} {% else %} {% brick_table_action id='link' url='reports__link_report'|url:column.id label=_('Link a report') enabled=link_perm %} {% endif %} {% endif %} {% if expand %} {% if sub_report %} {% endif %} {% endif %} {% endwith %} {% endfor %} {% endif %} {% endblock %}