{% extends 'creme_core/bricks/base/paginated-table.html' %} {% load i18n creme_bricks creme_cells creme_ctype creme_perms creme_widgets %} {% load and_op inner_edition_uri url from creme_core_tags %} {% block brick_extra_class %}{{block.super}} opportunities-contacts-brick{% endblock %} {% block brick_header_title %} {% brick_header_title title=_('{count} Contact linked to this opportunity') plural=_('{count} Contacts linked to this opportunity') empty=_('Contacts linked to this opportunity') icon='contact' %} {% endblock %} {% block brick_header_actions %} {% if relation_type.enabled %} {% ctype_for_swappable 'PERSONS_CONTACT_MODEL' as ct_contact %} {% with link_perm=user|has_perm_to_link:object creation_perm=user|has_perm_to_create:ct_contact %} {% brick_header_action id='add' url='opportunities__create_related_contact'|url:object.id label=_('Create a contact') enabled=creation_perm|and_op:link_perm %} {% brick_header_action id='add-relationships' label=_('Link to contacts') icon='link' enabled=link_perm __subject_id=object.id __rtype_id=relation_type.id __ctype_id=objects_ctype.id __multiple=True %} {% endwith %} {% 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 title=_('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 %} {% with unlink_perm=user|has_perm_to_unlink:object delete_relation_url='creme_core__delete_similar_relations'|url %} {% for contact in page.object_list %} {% widget_entity_hyperlink contact user %} {% if user|has_perm_to_view:contact %} {% for cell in cells %} {% cell_render cell=cell instance=contact user=user as cell_content %} {% if cell_content %}{{cell_content}}{% else %}{% endif %} {% endfor %} {% else %} {% for cell in cells %}{{HIDDEN_VALUE}}{% endfor %} {% endif %} {% comment %} {% if cells %}{% inner_edition_uri instance=contact cells=cells callback_url=object.get_absolute_url as edition_uri %} {% brick_table_action id='edit' url=edition_uri label=_('Edit this contact') enabled=user|has_perm_to_change:contact %} {% endcomment %} {% if cells %}{% inner_edition_uri instance=contact cells=cells as edition_uri %} {% brick_table_action id='edit' url=edition_uri comeback=True label=_('Edit this contact') enabled=user|has_perm_to_change:contact %} {% else %} {% brick_table_action id='redirect' url=contact.get_edit_absolute_url label=_('Edit this contact') icon='edit' enabled=user|has_perm_to_change:contact comeback=True %} {% endif %} {% with contact_unlink_perm=user|has_perm_to_unlink:contact %} {% brick_table_action id='delete' url=delete_relation_url __subject_id=object.pk __type=relation_type.id __object_id=contact.id label=_('Unlink this contact') icon='unlink' enabled=unlink_perm|and_op:contact_unlink_perm %} {% endwith %} {% endfor %} {% endwith %} {% endblock %} {% block brick_table_empty %} {% translate 'No linked contact for the moment' %} {% endblock %}