{% extends 'emails/base_email_template.html' %}
{% load i18n %}

{% block title %}{% if is_high_priority %}URGENT{% else %}New{% endif %} Complaint - {{ complaint.reference_number }}{% endblock %}
{% block preheader %}{% if is_high_priority %}URGENT{% else %}New{% endif %} complaint requires your attention{% endblock %}

{% block content %}
<p style="margin: 0 0 15px;">
    {% trans "Dear" %} <strong>{{ admin_name|default:"Admin" }}</strong>,
</p>

<p style="margin: 0 0 20px;">
    {% trans "A new complaint has been submitted and requires your attention." %}
</p>

<p style="margin: 0 0 5px;"><strong>{% trans "Reference:" %}</strong> {{ complaint.reference_number }}</p>
<p style="margin: 0 0 5px;"><strong>{% trans "Title:" %}</strong> {{ complaint.title }}</p>
<p style="margin: 0 0 5px;"><strong>{% trans "Priority:" %}</strong> {{ priority_display }}</p>
<p style="margin: 0 0 5px;"><strong>{% trans "Severity:" %}</strong> {{ severity_display }}</p>
<p style="margin: 0 0 5px;"><strong>{% trans "Status:" %}</strong> {{ status_display }}</p>
<p style="margin: 0 0 5px;"><strong>{% trans "Patient Name:" %}</strong> {{ patient_name|default:"N/A" }}</p>
<p style="margin: 0 0 5px;"><strong>{% trans "MRN:" %}</strong> {{ patient_mrn|default:"N/A" }}</p>
<p style="margin: 0 0 5px;"><strong>{% trans "Phone:" %}</strong> {{ contact_phone|default:"N/A" }}</p>
<p style="margin: 0 0 5px;"><strong>{% trans "Email:" %}</strong> {{ contact_email|default:"N/A" }}</p>
<p style="margin: 0 0 5px;"><strong>{% trans "Hospital:" %}</strong> {{ hospital_name|default:"N/A" }}</p>
<p style="margin: 0 0 5px;"><strong>{% trans "Department:" %}</strong> {{ department_name|default:"N/A" }}</p>
<p style="margin: 0 0 5px;"><strong>{% trans "Source:" %}</strong> {{ source_name|default:"N/A" }}</p>

{% if description %}
<p style="margin: 15px 0 5px;"><strong>{% trans "Description:" %}</strong></p>
<p style="margin: 0 0 20px;">{{ description|truncatechars:500 }}</p>
{% endif %}

<p style="margin: 0 0 25px;">
    <strong>{% trans "Action Required:" %}</strong> {% trans "Please review and activate this complaint at your earliest convenience." %}
</p>

{% if complaint_url %}
<table role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%">
    <tr>
        <td align="center">
            <a href="{{ complaint_url }}"
               style="display: inline-block; padding: 12px 32px; font-size: 16px; font-weight: 600; color: #ffffff; text-decoration: none; border-radius: 6px; background-color: #005696;">
                {% trans "View Complaint" %}
            </a>
        </td>
    </tr>
</table>
{% endif %}

<p style="margin: 25px 0 0; font-size: 12px; color: #999999;">
    {% if is_working_hours %}Working Hours - All Admins (Email Only){% else %}After Hours - On-Call (Email + SMS){% endif %}<br>
    {{ notification_time }}<br>
    This is an automated notification from the PX 360 system.
</p>
{% endblock %}
