{% extends 'creme_core/bricks/base/paginated-table.html' %} {% load i18n creme_bricks %} {% load has_perm_to url from creme_core_tags %} {% block brick_extra_class %}{{block.super}} emails-sendings-brick{% endblock %} {% block brick_header_title %} {% brick_header_title title=_('{count} Sent bundle') plural=_('{count} Sent bundles') empty=verbose_name icon='email' %} {% endblock %} {% block brick_header_actions %} {% if config_available %}{% has_perm_to change object as edit_perm %} {% brick_header_action id='add' url='emails__create_sending'|url:object.id label=_('New sending') enabled=edit_perm %} {% endif %} {% endblock %} {% block brick_before_content %} {% if not config_available %}
{% has_perm_to admin 'emails' as admin_perm %} {% translate 'No configuration for SMTP is available; so creation & edition of sending are forbidden.' %}
{% if admin_perm %} {% blocktranslate with url='creme_config__app_portal'|url:'emails' %}You can create a configuration here.{% endblocktranslate %} {% else %} {% translate 'Contact your administrator to create a configuration.' %} {% endif %}
{% endif %} {% endblock %} {% block brick_table_columns %} {% brick_table_column_for_field ctype=objects_ctype field='sending_date' status='primary' %} {% brick_table_column title=_('SMTP & sender') %} {% brick_table_column title=_('Type') %} {% brick_table_column title=_('State') %} {% brick_table_column title=_('Number of email(s)') %} {% brick_table_column title=_('Actions') status='action' colspan=3 %} {% endblock %} {% block brick_table_rows %} {% has_perm_to change object as edit_perm %}{% url 'creme_core__delete_related_to_entity' objects_ctype.id as delete_sending_url %} {% for sending in page.object_list %} {{sending.sending_date}} {% if sending.config_item is None %} {% translate 'No server' %} {% else %} {{sending.config_item}}/ {{sending.sender}} {% endif %} {{sending.get_type_display}} {{sending.get_state_display}} {{sending.mails_set.count}}{% with unsent_count=sending.unsent_mails.count %}{% if unsent_count %} / {% blocktranslate count count=unsent_count %}{{count}} not sent{% plural %}{{count}} not sent{% endblocktranslate %}{% endif %}{% endwith %} {% if config_available and sending.state != 1 %}{# 1 is DONE #} {% brick_table_action id='edit' url=sending.get_edit_absolute_url enabled=edit_perm %} {% endif %} {% brick_table_action id='redirect' url=sending.get_absolute_url icon='view' label=_('Details') %} {% brick_table_action id='delete' url=delete_sending_url __id=sending.pk label=_('Delete this sending') enabled=edit_perm %} {% endfor %} {% endblock %} {% block brick_table_empty %} {% translate 'No sending for the moment' %} {% endblock %}