{% extends 'creme_core/bricks/base/paginated-table.html' %} {% load i18n creme_bricks creme_widgets %} {% load print_field url from creme_core_tags %} {% block brick_extra_class %}{{block.super}} brick-selectable emails-emails_to_sync-brick{% endblock %} {% block brick_header_title %} {% brick_header_title title=_('{count} Email to synchronise') plural=_('{count} Emails to synchronise') empty=_('Emails to synchronise') icon='email' %} {% endblock %} {% block brick_header_actions %} {% brick_header_action id='emailsync-delete-multi' url='emails__delete_email_to_sync'|url type='delete' label=_('Delete selected emails') icon='cancel' %} {% brick_header_action id='emailsync-accept-multi' url='emails__accept_email_to_sync'|url type='add' label=_('Accept selected emails') icon='ok' %} {% endblock %} {% block brick_table_columns %} {% if user.is_staff %} {% brick_table_column_for_field ctype=objects_ctype field='user' %} {% endif %} {% brick_table_column_for_field ctype=objects_ctype field='subject' %} {% brick_table_column_for_field ctype=objects_ctype field='date' %} {% brick_table_column title=_('Sender') %} {% brick_table_column title=_('Recipients') %} {% brick_table_column_for_field ctype=objects_ctype field='body' %} {% brick_table_column_for_field ctype=objects_ctype field='body_html' %} {% brick_table_column_for_field ctype=objects_ctype field='attachments' %} {% brick_table_column title=_('Actions') status='action' colspan=2 %} {% endblock %} {% block brick_table_rows %} {% url 'emails__accept_email_to_sync' as accept_url %}{% url 'emails__delete_email_to_sync' as delete_url %} {% translate 'Only the recipient marked as main is used to fill the field «Recipient» of the final email. All recipients are linked to the email anyway.' as mark_help_text %} {% for email_to_sync in page.object_list %} {% if user.is_staff %} {% print_field object=email_to_sync field='user' %} {% endif %} {{email_to_sync.subject}} {% print_field object=email_to_sync field='date' %}
{% with sender=email_to_sync.senders.0 %} {% if sender.person %} {{sender.email}}{% widget_entity_hyperlink sender.person user %} {% else %} {{sender.email}} {% endif %} {% brick_table_action id='edit' url=sender.get_edit_absolute_url %} {% endwith %}
{% if email_to_sync.body %} {% widget_icon name='view' label=_('View the body') size='brick-table' class='brick-action-icon brick-table-action-icon' %} {% translate 'Details' %}
{{email_to_sync.body|linebreaksbr}}
{% else %} {% endif %} {% if email_to_sync.body_html %} {% widget_icon name='view' label=_('View the HTML body') size='brick-table' class='brick-action-icon brick-table-action-icon' %} {% translate 'Details' %}
{{email_to_sync.body_html}}
{% else %} {% endif %} {% with attachments=email_to_sync.attachments.all %} {% if attachments %} {% else %} {% endif %} {% endwith %} {# {% brick_table_action id='delete' url=delete_url __ids=email_to_sync.id label=_('Delete this email') %} #} {% brick_table_action id='emailsync-delete' url=delete_url __ids=email_to_sync.id icon='delete' label=_('Delete this email') %} {% if email_to_sync.can_be_accepted %} {# {% brick_table_action id='delete' url=accept_url __ids=email_to_sync.id label=_('Accept') display='text' help_text=_('Convert into a true entity email') %} #} {% brick_table_action id='emailsync-accept' url=accept_url __ids=email_to_sync.id label=_('Accept') display='text' help_text=_('Convert into a true entity email') %} {% else %} {# {% brick_table_action id='delete' label=_('Accept') display='text' help_text=_('Cannot accept because there are errors') enabled=False %} #} {% brick_table_action id='emailsync-accept' label=_('Accept') display='text' help_text=_('Cannot accept because there are errors') enabled=False %} {% endif %} {% endfor %} {% endblock %} {% block brick_table_empty %} {% translate 'No email to synchronise for the moment' %} {% endblock %}