{% extends 'creme_core/bricks/base/paginated-table.html' %} {% load i18n creme_widgets creme_bricks %} {% load and_op format_amount has_perm_to url from creme_core_tags %} {% block brick_extra_class %}{{block.super}} opportunities-opportunities-brick{% endblock %} {% block brick_header_title %} {% if is_organisation %} {% brick_header_title title=_('{count} Opportunity which targets the organisation') plural=_('{count} Opportunities which target the organisation') empty=_('Opportunities') icon='opportunity' %} {% elif is_contact %} {% brick_header_title title=_('{count} Opportunity which targets the contact') plural=_('{count} Opportunities which target the contact') empty=_('Opportunities') icon='opportunity' %} {% else %} {% brick_header_title title=_('{count} Opportunity which targets the entity') plural=_('{count} Opportunities which target the entity') empty=_('Opportunities') icon='opportunity' %} {% endif %} {% endblock %} {% block brick_header_actions %} {% has_perm_to link object as link_perm %}{% has_perm_to create objects_ctype as creation_perm %} {% brick_header_action id='add' url='opportunities__create_related_opportunity_popup'|url:object.id label=_('Create an opportunity') enabled=creation_perm|and_op:link_perm %} {% endblock %} {% block brick_table_columns %} {% brick_table_column_for_field ctype=objects_ctype field='name' title=_('Name') status='primary' %} {% brick_table_column title=_('Sales phase') %} {% if 'estimated_sales' not in hidden_fields %} {% brick_table_column_for_field ctype=objects_ctype field='estimated_sales' data_type='money' %} {% endif %} {% if 'made_sales' not in hidden_fields %} {% brick_table_column_for_field ctype=objects_ctype field='made_sales' data_type='money' %} {% endif %} {% brick_table_column title=_('Action') status='action' %} {% endblock %} {% block brick_table_rows %} {% has_perm_to unlink object as unlink_perm %}{% url 'creme_core__delete_entities' as delete_multi_url %} {% for opportunity in page.object_list %} {% has_perm_to view opportunity as opp_view_perm %}{% has_perm_to unlink opportunity as opp_unlink_perm %} {% widget_entity_hyperlink opportunity user %} {% if opp_view_perm %} {{opportunity.sales_phase}} {% if 'estimated_sales' not in hidden_fields %} {# TODO: factorise with opportunity-hat-card.html #} {% if opportunity.estimated_sales is None %} — {% else %} {{opportunity.estimated_sales|format_amount:opportunity.currency}} {% endif %} {% endif %} {% if 'made_sales' not in hidden_fields %} {% if opportunity.made_sales is None %} — {% else %} {{opportunity.made_sales|format_amount:opportunity.currency}} {% endif %} {% endif %} {% else %} {{HIDDEN_VALUE}} {{HIDDEN_VALUE}} {{HIDDEN_VALUE}} {% endif %} {% brick_table_action id='delete' url=delete_multi_url __ids=opportunity.id enabled=unlink_perm|and_op:opp_unlink_perm %} {% endfor %} {% endblock %} {% block brick_table_empty %} {% translate 'No opportunity for the moment' %} {% endblock %}