<div class="column-whole">
  {% if template._template.archived %}
    <p class="hint">
      This template was deleted {{ template._template.updated_at|format_datetime_relative }}.
    </p>
  {% else %}
    <div class="bottom-gutter-2-3">
      <div class="grid-row">
        {% if current_user.has_permissions(permissions=['send_texts', 'send_emails', 'send_letters']) %}
        <div class="{{ 'column-half' if template.template_type == 'letter' else 'column-third' }}">
          <a href="{{ url_for(".send_messages", service_id=current_service.id, template_id=template.id) }}" class="pill-separate-item">
            Upload recipients
          </a>
        </div>
        <div class="{{ 'column-half' if template.template_type == 'letter' else 'column-third' }}">
          <a href="{{ url_for(".send_test", service_id=current_service.id, template_id=template.id) }}" class="pill-separate-item">
            {{ 'Generate preview' if template.template_type == 'letter' else 'Send yourself a test' }}
          </a>
        </div>
        {% endif %}
        {% if
          current_user.has_permissions(permissions=['manage_templates'], admin_override=True) and
          template.template_type != 'letter'
        %}
        <div class="column-one-third">
          <a href="{{ url_for(".edit_service_template", service_id=current_service.id, template_id=template.id) }}" class="pill-separate-item">
            Edit template
          </a>
        </div>
        {% endif %}
      </div>
    </div>
  {% endif %}
</div>
<div class="column-whole template-container">
  {% if current_user.has_permissions(permissions=['manage_templates'], admin_override=True) and template.template_type == 'letter' %}
    <a href="{{ url_for(".edit_service_template", service_id=current_service.id, template_id=template.id) }}" class="edit-template-link-letter-body">Edit</a>
    <a href="{{ url_for(".service_set_letter_contact_block", service_id=current_service.id, from_template=template.id) }}" class="edit-template-link-letter-contact">Edit</a>
    <a href="#" class="edit-template-link-letter-address">Edit</a>
  {% endif %}
  {{ template|string }}
</div>
