{% load wagtailadmin_tags %}
{% if error_message %}
{% icon name="warning" %} {{ error_message }}
{% endif %} {% if campaign.is_sent %} {% block campaign_status %}

Status: {{ campaign.status }}

{% if report %} {% if report.send_time %}

Send time: {{ report.send_time }} ({{ report.send_time|timesince }} ago).

{% endif %}

Emails sent: {{ report.emails_sent }} ({{ report.bounces }} bounces)

Opens: {{ report.opens }}

Clicks: {{ report.clicks }}

{% endif %} {% endblock %} {% elif campaign.is_scheduled %}
{% icon name="help" %}

Further changes to the page won't affect the scheduled campaign. To make changes to the campaign, unschedule it first, then make your changes and schedule it again.

{% if report %}

Status: {{ campaign.status }}

Send time: {{ report.send_time }} (in {{ report.send_time|timeuntil }}).

{% endif %} {% if has_action_permission.unschedule_campaign %}
{% fragment as unschedule_dialog_subtitle %} The campaign is scheduled to send at {{ report.send_time }} (in {{ report.send_time|timeuntil }}). This action will unschedule the sending. {% endfragment %} {% dialog icon_name="mail" id="wn-unschedule-dialog" title="Unschedule campaign" subtitle=unschedule_dialog_subtitle %}
{% icon name="warning" %}

If you proceed, any unsaved changes in the current window will be lost.

{% csrf_token %}
{% enddialog %}
{% endif %} {% else %}

{% if has_action_permission.save_campaign %} {% endif %} {% if has_action_permission.send_test_email %} {% endif %} {% if has_action_permission.send_campaign %} {% endif %} {% if has_action_permission.schedule_campaign %} {% endif %}
{% fragment as save_dialog_subtitle %} This action will save a new draft page revision and save the newsletter campaign to {{ backend_name }} with your changes. {% endfragment %} {% dialog icon_name="mail" id="wn-save-dialog" title="Save campaign" dialog_root_selector="[data-edit-form]" subtitle=save_dialog_subtitle %} {% enddialog %} {% fragment as test_dialog_subtitle %} This action will save a new draft page revision and send a test email with your changes. {% endfragment %} {% dialog icon_name="mail" id="wn-test-dialog" title="Send test email" dialog_root_selector="[data-edit-form]" subtitle=test_dialog_subtitle %}
{% include "wagtailadmin/shared/field.html" with field=test_form.email %}
{% enddialog %} {% dialog icon_name="mail" id="wn-recipients-required" title="Send campaign" dialog_root_selector="[data-edit-form]" %}
{% icon name="warning" %}

You must first select recipients for the newsletter.

{% enddialog %} {% fragment as send_dialog_subtitle %} This action will save a new draft page revision and send the campaign using {{ backend_name }} with your changes. {% endfragment %} {% dialog icon_name="mail" id="wn-send-dialog" title="Send campaign" dialog_root_selector="[data-edit-form]" subtitle=send_dialog_subtitle %}
{% icon name="warning" %}

{% enddialog %} {% fragment as schedule_dialog_subtitle %} This action will save a new draft page revision and schedule the campaign using {{ backend_name }} with your changes. {% endfragment %} {% dialog icon_name="mail" id="wn-schedule-dialog" title="Schedule campaign" dialog_root_selector="[data-edit-form]" subtitle=schedule_dialog_subtitle %}
{% icon name="warning" %}

{% include "wagtailadmin/shared/field.html" with field=schedule_form.schedule_time %}
{% enddialog %}

{% endif %} {% if campaign %}

{% icon name="link-external" classname="w-w-4 w-h-4" %} Open campaign in {{ backend_name }}

{% endif %}