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

{% block title %}{% trans "SLA Reminder - Observation" %}{% endblock %}
{% block preheader %}{% trans "An observation is approaching its SLA deadline. Please take action." %}{% endblock %}

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

{% if is_unassigned %}
<p style="margin: 0 0 20px;">
    {% trans "This is a reminder about an unassigned observation that requires attention. The observation has not yet been assigned to any team member. Please assign it as soon as possible." %}
</p>
{% else %}
<p style="margin: 0 0 20px;">
    {% trans "This is an automated reminder that an observation assigned to you is approaching its SLA deadline. Please review and take appropriate action." %}
</p>
{% endif %}

<p style="margin: 0 0 5px;"><strong>{% trans "Tracking Code:" %}</strong> {{ observation.tracking_code }}</p>
{% if observation.title %}
<p style="margin: 0 0 5px;"><strong>{% trans "Title:" %}</strong> {{ observation.title }}</p>
{% endif %}
<p style="margin: 0 0 5px;"><strong>{% trans "Category:" %}</strong> {% if observation.category %}{{ observation.category.name_en }}{% else %}N/A{% endif %}</p>
<p style="margin: 0 0 5px;"><strong>{% trans "Severity:" %}</strong> {{ observation.get_severity_display }}</p>
<p style="margin: 0 0 5px;"><strong>{% trans "Status:" %}</strong> {{ observation.get_status_display }}</p>
{% if observation.location_text %}
<p style="margin: 0 0 5px;"><strong>{% trans "Location:" %}</strong> {{ observation.location_text }}</p>
{% endif %}
<p style="margin: 0 0 5px;"><strong>{% trans "Due Date:" %}</strong> {{ due_date|date:"F d, Y H:i" }}</p>
<p style="margin: 0 0 20px;"><strong>{% trans "Time Remaining:" %}</strong> {{ hours_remaining }} {% trans "hours" %}</p>

{% if is_unassigned %}
<p style="margin: 0 0 5px;">- {% trans "Assign this observation to an appropriate team member" %}</p>
<p style="margin: 0 0 5px;">- {% trans "Ensure the assigned person is aware of the approaching deadline" %}</p>
<p style="margin: 0 0 25px;">- {% trans "Monitor progress to ensure timely resolution" %}</p>
{% else %}
<p style="margin: 0 0 25px;">
    {% trans "Please review this observation and take appropriate action before the SLA deadline to avoid breach." %}
</p>
{% endif %}

{% if observation_url %}
<table role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%">
    <tr>
        <td align="center">
            <a href="{{ observation_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 Observation" %}
            </a>
        </td>
    </tr>
</table>
{% endif %}

<p style="margin: 25px 0 5px; font-size: 13px; color: #666666; direction: rtl; text-align: right;">
    تذكير بموعد الاستحقاق - {{ observation.tracking_code }}
</p>
<p style="margin: 0; font-size: 12px; color: #999999; direction: rtl; text-align: right; line-height: 1.8;">
    {% if is_unassigned %}
    هام: هذه ملاحظة غير معينة تحتاج إلى اهتمامكم. يرجى تعيينها في أقرب وقت ممكن.<br>
    {% endif %}
    تاريخ الاستحقاق: {{ due_date|date:"Y F d H:i" }} - الوقت المتبقي: {{ hours_remaining }} ساعة
</p>
{% endblock %}
