{% extends "base.html" %}

{% block content %}
<article class="chart">
    <header>
        <div class="chart__heading">
            <h1><i class="fas fa-notes-medical"></i>&ensp;Chart for {{chart.patient}}</h1>
            <a class="chart__edit action-button" href="{% url 'chart-update' chart.pk %}" class="action-button">Edit chart</a>
        </div>
        <p>
            <strong>Student</strong>: {{chart.student_id}} {{chart.student_name}}<br>
            <strong>Assignment</strong>: {{chart.assignment}}
        </p>
        <p>
            <a class="open-modal action-button"><i class="fas fa-plus"></i>&ensp;New entry</a>
        </p>
        <div class="modal-menu">
            <div class="modal-menu__content">
                <div class="modal-menu__header">
                    <span><i class="fas fa-plus"></i>&ensp;<strong>New entry</strong></span>
                    <span class="close-modal">&times;</span>
                </div>
                <div class="modal-menu__list">
                    <ul>
                        <li class="modal-menu__item"><i class="fas fa-edit"></i> <a href="{% url 'entry-create' chart.pk %}">Note &rarr;</a></li>
                        <li><i class="fas fa-user"></i> ADL
                            <ul>
                                <li class="modal-menu__item"><i class="fas fa-broom"></i> <a href="{% url 'oral-create' chart.pk %}">Oral care &rarr;</a></li>
                                <li class="modal-menu__item"><i class="fas fa-shower"></i> <a href="{% url 'bathing-create' chart.pk %}">Bathing &rarr;</a></li>
                                <li class="modal-menu__item"><i class="fas fa-bath"></i> <a href="{% url 'toileting-create' chart.pk %}">Toileting &rarr;</a></li>
                                <li class="modal-menu__item"><i class="fas fa-tshirt"></i> <a href="{% url 'dressing-create' chart.pk %}">Dressing &rarr;</a></li>
                                <li class="modal-menu__item"><i class="fas fa-utensils"></i> <a href="{% url 'meal-create' chart.pk %}">Meal &rarr;</a></li>
                                <li class="modal-menu__item"><i class="fas fa-tint"></i> <a href="{% url 'urine-create' chart.pk %}">Urine &rarr;</a></li>
                                <li class="modal-menu__item"><i class="fas fa-poo"></i> <a href="{% url 'bm-create' chart.pk %}">Bowel movement &rarr;</a></li>
                            </ul>
                        </li>
                        <li><i class="fas fa-walking"></i> Activity
                            <ul>
                                <li class="modal-menu__item"><i class="fas fa-sign-language"></i> <a href="{% url 'rom-create' chart.pk %}">Range of motion &rarr;</a></li>
                                <li class="modal-menu__item"><i class="fab fa-accessible-icon"></i> <a href="{% url 'ambulation-create' chart.pk %}">Ambulation &rarr;</a></li>
                            </ul>
                        </li>
                        <li class="modal-menu__item"><i class="fas fa-heartbeat"></i> <a href="{% url 'vitals-create' chart.pk %}">Vitals &rarr;</a></li>
                        <li class="modal-menu__item"><i class="fas fa-lungs"></i> <a href="{% url 'oxygen-create' chart.pk %}">Oxygen level &rarr;</a></li>
                        <li class="modal-menu__item"><i class="fas fa-syringe"></i> <a href="{% url 'fluid-create' chart.pk %}">Fluid intake &rarr;</a></li>
                        <li class="modal-menu__item"><i class="fas fa-frown"></i> <a href="{% url 'emesis-create' chart.pk %}">Emesis &rarr;</a></li>
                        <li class="modal-menu__item"><i class="fas fa-meh"></i> <a href="{% url 'pain-create' chart.pk %}">Pain level &rarr;</a></li>
                        <li class="modal-menu__item"><i class="fas fa-bed"></i> <a href="{% url 'restraint-create' chart.pk %}">Restraints &rarr;</a></li>
                        <li class="modal-menu__item"><i class="far fa-life-ring"></i> <a href="{% url 'safety-create' chart.pk %}">Safety &rarr;</a></li>
                    </ul>
                </div>
            </div>
        </div>
    </header>
    <section>
        {% regroup chart.entry_set.all by time as entry_set %}
        {% for item in entry_set %}
            <div class="entry">
                <strong>{{item.grouper|time:"H:i"}}</strong>
                <ul>
                {% for entry in item.list %}
                <li class="entry__item">
                    {% if entry.oralcare %}
                        {% include "charts/details/oral_care.html" with entry=entry %}
                    {% elif entry.bathing %}
                        {% include "charts/details/bathing.html" with entry=entry %}
                    {% elif entry.toileting %}
                        {% include "charts/details/toileting.html" with entry=entry %}
                    {% elif entry.dressing %}
                        {% include "charts/details/dressing.html" with entry=entry %}
                    {% elif entry.meal %}
                        {% include "charts/details/meal.html" with entry=entry %}
                    {% elif entry.rangeofmotion %}
                        {% include "charts/details/rom.html" with entry=entry %}
                    {% elif entry.ambulation %}
                        {% include "charts/details/ambulation.html" with entry=entry %}
                    {% elif entry.vitals %}
                        {% include "charts/details/vitals.html" with entry=entry %}
                    {% elif entry.fluidintake %}
                        {% include "charts/details/fluid_intake.html" with entry=entry %}
                    {% elif entry.urine %}
                        {% include "charts/details/urine.html" with entry=entry %}
                    {% elif entry.emesis %}
                        {% include "charts/details/emesis.html" with entry=entry %}
                    {% elif entry.bowelmovement %}
                        {% include "charts/details/bowel_movement.html" with entry=entry %}
                    {% elif entry.painlevel %}
                        {% include "charts/details/pain_level.html" with entry=entry %}
                    {% elif entry.oxygenlevel %}
                        {% include "charts/details/oxygen_level.html" with entry=entry %}
                    {% elif entry.restraint %}
                        {% include "charts/details/restraint.html" with entry=entry %}
                    {% elif entry.safety %}
                        {% include "charts/details/safety.html" with entry=entry %}
                    {% else %}
                        {% include "charts/details/entry.html" with entry=entry %}
                    {% endif %}
                </li>
                {% endfor %}
                </ul>
            </div>
        {% endfor %}
    </section>
</article>
{% endblock %}