{% load i18n %}

{% trans "Staff Explanations" %}

{% if explanations %}
{% if can_edit %} {% trans "Request More Explanations" %} {% endif %}
{% for exp in explanations %}
{{ exp.staff.first_name|first }}{{ exp.staff.last_name|first }}

{{ exp.staff }}

{{ exp.staff.employee_id }} {% if exp.staff.department %} {{ exp.staff.department.name }} {% endif %}
{% if exp.is_used %}{% trans "Submitted" %}{% else %}{% trans "Pending" %}{% endif %} {% if exp.is_used %} {{ exp.get_acceptance_status_display }} {% endif %}
{% if exp.escalated_to_manager %}
{% trans "Escalated to Manager" %} ({{ exp.escalated_to_manager.staff.get_full_name }})
{% if exp.acceptance_notes %}

{{ exp.acceptance_notes }}

{% endif %}
{% endif %} {% if exp.is_used and exp.explanation %}

{{ exp.explanation }}

{% if exp.attachment_count > 0 %}
{{ exp.attachment_count }} {% trans "attachment(s)" %}
{% endif %}
{% endif %} {% if can_edit and exp.is_used and not exp.escalated_to_manager %}
{% if exp.acceptance_status == 'pending' %}
{% if exp.staff.report_to %} {% else %} {% trans "No Manager to Escalate" %} {% endif %}
{% else %}
{% trans "Reviewed by:" %} {{ exp.accepted_by.get_full_name }} {% trans "on" %} {{ exp.accepted_at|date:"Y-m-d H:i" }}
{% endif %}
{% endif %} {% if can_edit and not exp.is_used %}
{% endif %}
{% endfor %}
{% else %}

{% trans "No explanation requests sent yet" %}

{% if can_edit %} {% trans "Request Explanation" %} {% endif %}
{% endif %}