{% extends 'creme_core/bricks/base/paginated-table.html' %} {% load i18n creme_bricks reports_tags creme_widgets %} {% load jsondata has_perm_to jsonify url from creme_core_tags %} {% block brick_extra_class %}{{block.super}} reports-graphs-brick{% endblock %} {% block brick_header_title %} {% translate 'Graphs' context 'reports-graphs' as empty_label %} {% brick_header_title title=_('{count} Graph') plural=_('{count} Graphs') empty=empty_label icon='graph' %} {% endblock %} {% block brick_header_actions %} {% has_perm_to change object.report as has_perm %} {% brick_header_action id='add' url='reports__create_graph'|url:object.id label=_('Create a new graph') enabled=has_perm %} {% endblock %} {% block brick_table_columns %} {% brick_table_column title=_('X axis (field)') %} {% brick_table_column title=_('X axis (grouping)') %} {% brick_table_column title=_('Y axis (type)') %} {% brick_table_column title=_('Y axis (field)') %} {% brick_table_column title=_('Actions') status='action' colspan=2 %} {% endblock %} {% block brick_table_rows %} {% has_perm_to admin 'reports' as admin_perm %} {% for row in rows %} {% with hand=row.graph.hand graph=row.graph %} {{hand.verbose_abscissa}} {{hand.verbose_name}}{% if graph.abscissa_parameter %} ({{graph.abscissa_parameter}}){% endif %}{# TODO: hand.verbose parameter ? #} {% with ordinate=hand.ordinate %} {{ordinate.verbose_name}} {{ordinate.cell|default:'—'}} {% endwith %} {% has_perm_to change graph as graph_edit_perm %} {% brick_table_action id='edit' url='reports__edit_graph'|url:graph.id enabled=graph_edit_perm %} {% has_perm_to delete graph as graph_delete_perm %} {% brick_table_action id='delete' url='creme_core__delete_entity'|url:graph.id label=_('Delete this graph') enabled=graph_delete_perm %}
{% widget_icon name='expand' size='brick-table-action' class='graph-accordion-icon' %}
{{graph.name}}
{% widget_icon name='expand' size='brick-table-action' class='graph-accordion-icon' %}
{% if row.data %}
{% translate 'Graph' context 'reports-graphs' %} : 
{% translate 'Sorting' %} : 
{% endif %}
{% if volatile_column %}
{% translate 'Volatile column' %} :  {{volatile_column}}
{% endif %} {% with bricks_count=row.instance_brick_count %}{% blocktranslate count count=bricks_count asvar popup_label %}{{count}} configured block{% plural %}{{count}} configured blocks{% endblocktranslate %} {% if bricks_count %}
{% brick_table_action id='view' url='reports__instance_bricks_info'|url:graph.id label=popup_label display='text' %}
{% endif %} {% endwith %}
{% brick_table_action id='add' url='reports__create_instance_brick'|url:graph.id label=_('Create a block for this graph') display='text' enabled=admin_perm %}
{% if row.data %}
{% jsondata row.data class="sketch-chart-data" %} {% if row.props %}{% jsondata row.props class="sketch-chart-props" %}{% endif %} {% elif row.error %}
{{row.error}}
{% else %}
{% translate 'No values or graph is not applicable here' %}
{% endif %} {% endwith %} {% endfor %} {% endblock %} {% block brick_table_empty %} {% translate 'No graphs registered for the moment' %} {% endblock %} {% block brick_script %} {% endblock %}