
{% extends "base.html" %}
{% block nav-brand %}<a class="navbar-brand" href="/prof">Coursebook</a>{% endblock %}
{% block nav-home %}<li ><a href="/prof">Home</a></li>{% endblock %}
          
{% block nav-subjects %}<li ><a href="/prof/subjects">My Subjects</a></li>{% endblock %}
{% block nav-available-subjects %}{% endblock %}
{% block nav-profile %}<li><a href="/prof"><span class="glyphicon glyphicon-user"></span> {{context}}</a></li>{%endblock%}
{% block body%}
<div class="container" style="margin-top:50px;">
    <div >
        <h2><span>{{subject.sub_code}}</span> - <span>{{subject.sub_name}}</span></h2>
        
            <table style="width:100%;border: solid grey 1px;box-shadow: 2px 2px;" class="table table-hover">
                <thead>  
                    <tr>  
                        <th style="text-align: center;">Enrollment Number</th>  
                        <th style="text-align: center;">First Name</th>  
                        <th style="text-align: center;">Last Name</th>
                        <th style="text-align: center;">Status</th>  
                        <th style="text-align: center;">Action</th>
                    </tr>  
                </thead>
                <tbody>  
            {% for sub_stud in sub_studs %}  
                <tr>  
                    <td style="text-align: center;">{{ sub_stud.student.pid }}</td>
                    <td style="text-align: center;">{{ sub_stud.student.fname }}</td>
                    <td style="text-align: center;">{{ sub_stud.student.lname }}</td>

                    {% if sub_stud.is_accepted %}
                        <td style="text-align: center;"><button class="btn btn-default">Accepted</button></td>
                    {% else %}
                        <td style="text-align: center;"><button class="btn btn-default">Pending...</button></td>
                    {% endif %}

                    <td style="text-align: center;">
                        {% if sub_stud.is_accepted %}
                            <button class="btn btn-basic">Accept</button>
                            <a href="/prof/student/reject/{{subject.sub_code}}/{{ sub_stud.student.pid }}"><button class="btn btn-danger">Remove</button></a>
                        {% else %}
                            <a href="/prof/student/accept/{{subject.sub_code}}/{{ sub_stud.student.pid }}"><button class="btn btn-success">Accept</button></a>
                            <a href="/prof/student/reject/{{subject.sub_code}}/{{ sub_stud.student.pid }}"><button class="btn btn-danger">Reject</button></a>
                        {% endif %}
                        
                    </td>
                </tr>  
            {% endfor %}  
                </tbody>  
                
            </table>
        
    </div>
    
</div>
{% endblock %}
