{% extends 'base.html' %}
{% load static %}

    {% block styles %}
        <link rel="stylesheet" type="text/css" href="{% static 'assignments/style.css' %}">   
    {% endblock %}

{% block title %}Assignments{% endblock %}
{% block content %}
    <h1>Assignments Per Course</h1>
        <div>
            <h2>List of Courses:</h3>
            {% if assignment_list %}
                <ul>
                {% for course in course_list %}
                    <li><span>{{course.course_code}}</span> | {{course.course_title}} - {{course.section}}</li>
                    {% for assignment in assignment_list %}
                        {% if assignment.course.course_code == course.course_code %}
                        <ul>
                            <li><a href="{% url 'assignments:details' assignment.id %}">{{assignment.name}}</a></li>
                        </ul>
                        {% endif %}
                    {% endfor %}
                    <br>
                {% endfor %}
                </ul>
            {% else %}
                <p>There are no assignments under any course.</p>
            {% endif %}
            <a href="{% url 'assignments:addAssignment' %}">
                <button>New Assignment</button>
            </a>
        </div>
{% endblock  %}