{% extends "django_pymissive/base_preview.html" %} {% load static i18n %} {% block preview_stylesheet %} {% endblock %} {% block preview_content %}
{% include "django_pymissive/includes/postal_recipient_preview_nav.html" %}
{% trans "Sender" %}
{% if sender.name %}
{{ sender.name }}
{% endif %} {% for line in sender_address.text_3lines %}
{{ line|join:" " }}
{% empty %}
{% trans "Not filled in" %}
{% endfor %}
{% if delivery_mode_display or priority_display or acknowledgement_display %}
{% if delivery_mode_display %} {{ delivery_mode_display }}{% trans "Delivery Mode" %} {% endif %} {% if priority_display %} {{ priority_display }}{% trans "Priority" %} {% endif %} {% if acknowledgement_display %} {{ acknowledgement_display }}{% trans "Acknowledgement Level" %} {% endif %}
{% endif %}
{% if campaign %} {% trans "Download PDF" %} {% elif postal_letter_recipient_pk %} {% trans "Download PDF" %} {% else %} {% trans "Download PDF" %} {% endif %}
{% if missive.is_persisted %} {% comment %} Saved missive: every PDF physical attachment in priority order (first_document at priority 0, then user attachments). Non-PDF skipped. {% endcomment %} {% for doc in missive.attachments_physical %} {% include "django_pymissive/includes/postal_pdf_attachment_preview.html" %} {% endfor %} {% else %} {# Campaign preview: render the letter as a PDF (via download_pdf, which runs body_to_pdf and the full first_document_processors chain incl. watermark) instead of inline HTML, so the preview matches what the recipient receives. Fall back to inline HTML when no campaign is bound (e.g. ad-hoc unsaved missive preview). Other PDF attachments follow underneath, also via PDF.js. #} {% if campaign %}
{% trans "Letter (first page)" %}
{% trans "Loading…" %}
{% else %} {% include "django_pymissive/includes/postal_a4_letter_page.html" %} {% endif %} {% for doc in missive.attachments_physical %} {% if not doc.is_first_document %} {% include "django_pymissive/includes/postal_pdf_attachment_preview.html" %} {% endif %} {% endfor %} {% endif %}
{% endblock %} {% block preview_scripts %} {% trans "PDF.js unavailable." as pdfjs_msg_unavailable %} {% trans "Open attachment" as pdfjs_msg_open %} {% trans "Could not render document" as pdfjs_msg_error %} {% endblock %}