{% extends "student/student_layout.html" %}
{% block student_content %}
<h3>Exams Given</h3>
<br>
<table class="table table-bordered">
    <thead>
        <tr>
            <th scope="col" style="width: 35%">Exam</th>
            <th scope="col" style="width: 29%">Subject</th>
            <th scope="col" style="width: 15%">Date Attempted</th>
            <th scope="col">Marks</th>
            <th scope="col">Responses</th>
        </tr>
    </thead>
    <tbody>
        {% for row in exams_given %}
        <tr>
            {% for ex in exams %}
            {% if ex[0] == row[0] %}
            <td>{{ex[1]}}</td>
            {% endif %}
            {% for sub in subjects %}
            {% if ex[0] == row[0] and sub[0] == ex[9] %}
            <td>{{sub[1]}}</td>
            {% else %}
            {% endif %}
            {% endfor %}
            {% endfor %}
            <td>{{row[4]}}</td>
            {% if row[5] == 1 %} 
                <td>{{row[2]|int}} / 
                    {% for ex in exams %}
                        {% if ex[0] == row[0] %}
                            {{ex[5]|int}}
                        {% endif %}
                    {% endfor %}
                </td>
            {% else %}
                <td>--</td>
            {% endif %}
            <td>
                <center>
                    <a href="{{ url_for('get_responses',e_code=row[0]) }}" type="button"
                        class="btn btn-outline-primary">
                        <svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" fill="currentColor"
                            class="bi bi-file-earmark-check" viewBox="0 0 16 16">
                            <path
                                d="M10.854 7.854a.5.5 0 0 0-.708-.708L7.5 9.793 6.354 8.646a.5.5 0 1 0-.708.708l1.5 1.5a.5.5 0 0 0 .708 0l3-3z" />
                            <path
                                d="M14 14V4.5L9.5 0H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2zM9.5 3A1.5 1.5 0 0 0 11 4.5h2V14a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1h5.5v2z" />
                        </svg>
                    </a>
                </center>
            </td>
        </tr>
        {% endfor %}
    </tbody>
</table>
{% endblock %}