{% extends 'webapp/base.html' %}
{% load i18n %}
{% block page_content %}
    <div class="row">
        <div class="well well-sm">
            <a class="btn btn-warning"
               href="{% url 'report_revert' obj_id=detail.object.object_id version_id=detail.object.pk %}">Revert
                to this version</a>
            <a class="btn btn-default"
               href="{% url 'report_edit' pk=detail.object.object_id %}"><i
                    class="icon-edit"></i> Edit current version</a>
            <a class="btn btn-default" href="{% url 'reports' %}">Report list</a>
        </div>
        <table class="table table-striped table-bordered">
            <caption>Report history</caption>
            <tbody>
            <tr>
                <th>Site</th>
                <td>{{ detail.site.name }}, {{ detail.site.location_path }}
                    ({{ detail.site.hcid }})
                </td>
            </tr>
            <tr>
                <th>Reported by</th>
                <td>{{ detail.reporter.name }}</td>
            </tr>
            <tr>
                <th>Report period</th>
                <td>{{ detail.period }}</td>
            </tr>
            <tr>
                <th>Program</th>
                <td>{{ detail.program.code }}</td>
            </tr>
            <tr>
                <th>Group</th>
                <td>{{ detail.group.description }}</td>
            </tr>
            <tr>
                <th>Admissions</th>
                <td>{{ detail.object.field_dict.new_marasmic_patients }}</td>
            </tr>
            <tr>
                <th>Transfers (IN)</th>
                <td>{{ detail.object.field_dict.patients_transferred_in }}</td>
            </tr>
            <tr>
                <th>Cures</th>
                <td>{{ detail.object.field_dict.patients_cured }}</td>
            </tr>
            <tr>
                <th>Deaths</th>
                <td>{{ detail.object.field_dict.patient_deaths }}</td>
            </tr>
            <tr>
                <th>Defaults</th>
                <td>{{ detail.object.field_dict.unconfirmed_patient_defaults }}</td>
            </tr>
            <tr>
                <th>No response</th>
                <td>{{ detail.object.field_dict.unresponsive_patients }}</td>
            </tr>
            <tr>
                <th>Transfers (OUT)</th>
                <td>{{ detail.object.field_dict.patients_transferred_out }}</td>
            </tr>
            <tr>
                <th>Updated at</th>
                <td>{{ detail.object.revision.date_created }}</td>
            </tr>
            <tr>
                <th>Comment</th>
                <td>{{ detail.object.revision.comment }}</td>
            </tr>
            <tr>
                <th>Updated by</th>
                <td>{{ detail.object.revision.user }}</td>
            </tr>
            </tbody>
        </table>
        <ul class="pager">
            {% if detail.prev %}
                <li class="previous"><a
                        href="{% url 'report_history' obj_id=detail.object.object_id version_id=detail.prev %}">&larr;
                    Previous</a></li>
            {% else %}
                <li class="previous disabled"><a href="">&larr; Previous</a>
                </li>
            {% endif %}
            {% if detail.next %}
                <li class="next"><a
                        href="{% url 'report_history' obj_id=detail.object.object_id version_id=detail.next %}">Next &rarr;</a>
                </li>
            {% else %}
                <li class="next disabled"><a href="">Next &rarr;</a></li>
            {% endif %}
        </ul>
    </div>
{% endblock %}
