{% extends 'creme_core/bricks/base/paginated-table.html' %} {% load i18n creme_cells creme_widgets creme_bricks %} {% load and_op has_perm_to inner_edition_uri from creme_core_tags %} {% block brick_extra_class %}{{block.super}} opportunities-products-brick{% endblock %} {% block brick_header_title %} {% brick_header_title title=_('{count} Related product') plural=_('{count} Related products') empty=verbose_name icon='product' %} {% endblock %} {% block brick_header_actions %} {% if relation_type.enabled %} {% has_perm_to link object as link_perm %} {% brick_header_action id='add-relationships' label=_('Link to a product') icon='link' enabled=link_perm __subject_id=object.id __rtype_id=relation_type.id __ctype_id=objects_ctype.id __multiple=True %} {% endif %} {% endblock %} {% block brick_before_content %} {% if not relation_type.enabled %}
{% blocktranslate with predicate=relation_type.predicate %}Beware: the relationship type «{{predicate}}» is disabled. You should re-enable it if it's still useful, or remove this block{% endblocktranslate %}
{% endif %} {% endblock %} {% block brick_table_columns %} {% brick_table_column_for_field ctype=objects_ctype field='name' status='primary nowrap' %} {% for cell in cells %} {% brick_table_column_for_cell cell=cell %} {% endfor %} {% brick_table_column title=_('Actions') status='action' colspan=2 %} {% endblock %} {% block brick_table_rows %} {% has_perm_to unlink object as unlink_perm %}{% url 'creme_core__delete_similar_relations' as delete_relation_url %} {% for product in page.object_list %} {% has_perm_to view product as product_view_perm %} {% widget_entity_hyperlink product user %} {% if product_view_perm %} {% for cell in cells %} {% cell_render cell=cell instance=product user=user as cell_content %} {% if cell_content %}{{cell_content}}{% else %}{% endif %} {% endfor %} {% else %} {% for cell in cells %}{{HIDDEN_VALUE}}{% endfor %} {% endif %} {% has_perm_to change product as product_edit_perm %} {# {% if cells %}{% inner_edition_uri instance=product cells=cells callback_url=request.get_full_path as edition_uri %} #} {% if cells %}{% inner_edition_uri instance=product cells=cells callback_url=object.get_absolute_url as edition_uri %} {% brick_table_action id='edit' url=edition_uri label=_('Edit this product') enabled=product_edit_perm %} {% else %} {% brick_table_action id='redirect' url=product.get_edit_absolute_url|add:'?callback_url=${location}' label=_('Edit this product') icon='edit' enabled=product_edit_perm %} {% endif %} {% has_perm_to unlink product as product_unlink_perm %} {% brick_table_action id='delete' url=delete_relation_url __subject_id=object.id __type=relation_type.id __object_id=product.pk label=_('Unlink this product') icon='unlink' enabled=unlink_perm|and_op:product_unlink_perm %} {% endfor %} {% endblock %} {% block brick_table_empty %} {% translate 'No related product for the moment' %} {% endblock %}