{% extends 'creme_core/bricks/base/paginated-table.html' %} {% load i18n creme_bricks %} {% load and_op has_perm_to print_field url from creme_core_tags %} {% block brick_extra_class %}{{block.super}} emails-mails-history-brick{% endblock %} {% block brick_header_title %} {% brick_header_title title=_('{count} Email in the history') plural=_('{count} Emails in the history') empty=verbose_name icon='email' %} {% endblock %} {% block brick_header_actions %} {% if not relation_types_all_disabled %} {% has_perm_to create objects_ctype as creation_perm %}{% has_perm_to link object as link_perm %} {% with create_linked_perm=creation_perm|and_op:link_perm %} {% brick_header_action id='add' url='emails__create_email'|url:object.id label=_('Send a new related email') enabled=create_linked_perm %} {% brick_header_action id='add' url='emails__create_email_from_template'|url:object.id label=_('Send an email (with a template)') enabled=create_linked_perm %} {% brick_header_action id='link' url='emails__link_emails'|url:object.id label=_('Link to emails') enabled=link_perm %} {% endwith %} {% endif %} {% endblock %} {% block brick_before_content %} {% if relation_types_all_disabled %}
{% translate 'Beware: the relationship types for emails are disabled. You should re-enable them if they are still useful, or remove this block' %}
{% endif %} {% endblock %} {% block brick_table_columns %} {% brick_table_column_for_field ctype=objects_ctype field='sender' status='primary' %} {% brick_table_column_for_field ctype=objects_ctype field='recipient' %} {% brick_table_column_for_field ctype=objects_ctype field='subject' %} {% brick_table_column_for_field ctype=objects_ctype field='status' %} {% brick_table_column_for_field ctype=objects_ctype field='sending_date' status='nowrap' %} {% brick_table_column title=_('Actions') status='action' colspan=2 %} {% endblock %} {% block brick_table_rows %} {% for mail in page.object_list %} {% has_perm_to view mail as view_perm %} {% if view_perm %} {% print_field object=mail field='sender' %} {% print_field object=mail field='recipient' %} {{mail.subject}} {{mail.get_status_display}} {% print_field object=mail field='sending_date' %} {% brick_table_action id='view' url='emails__view_email_popup'|url:mail.id label=_('Details') %} {% if not mail.sent %}{% url 'emails__resend_emails' as resend_url %} {% if mail.synchronised %} {% brick_table_action id='update' url=resend_url __ids=mail.id label=_('Re-send') icon='refresh' confirm=_('This mail was synchronized. Are you sure you want to send it?') %} {% else %} {% brick_table_action id='update' url=resend_url __ids=mail.id label=_('Re-send') icon='refresh' %} {% endif %} {% endif %} {% else %} {{HIDDEN_VALUE}} {{HIDDEN_VALUE}} {{HIDDEN_VALUE}} {{HIDDEN_VALUE}} {{HIDDEN_VALUE}} {% brick_table_action id='view' label=_('Details') enabled=False %} {% brick_table_action id='update' label=_('Re-send') icon='refresh' enabled=False %} {% endif %} {% endfor %} {% endblock %} {% block brick_table_empty %} {% translate 'No email in the history for the moment' %} {% endblock %}