{% extends "manage.html" %}
{% block pagetitle %} Moderator's Dashboard {% endblock pagetitle %}

{% block script %}
<script language="JavaScript" type="text/javascript" src="{{ URL_ROOT }}/static/yaksh/js/moderator_dashboard.js"></script>
{% endblock %}

{% block content %}

<center><h4>List of quizzes! Click on the given links to have a look at answer papers for a quiz.</h4></center>
<table class="table table-bordered">
    <th>Course</th>
    <th>Quiz</th>
    <th>Taken By</th>
    <th>No. of users Passed</th>
    <th>No. of users Failed</th>
    {% for paper, answer_papers, users_passed, users_failed in users_per_paper %}
        <tr>
            <td>
                {{ paper.quiz.course.name }}
            </td>
            <td>
                <a href="{{URL_ROOT}}/exam/manage/monitor/{{ paper.quiz.id }}/">{{ paper.quiz.description }}</a>
            </td>
            <td>
                {{ answer_papers|length }} user(s)
            </td>
            <td>
                {{ users_passed }}
            </td>
            <td>
                {{ users_failed }}
            </td>
        </tr>
    {% endfor %}
</table>
<hr>
<center>
    <a href="{{URL_ROOT}}/exam/manage/add_course" class="btn btn-default">
      Add New Course
    </a>
    <a href="{{URL_ROOT}}/exam/manage/create_demo_course" class="btn btn-default">
      Create Demo Course
    </a>
    <a data-toggle="collapse" data-target="#help">
      <span class="glyphicon glyphicon-question-sign"></span> What's This
    </a>
    <div id="help" class="collapse">
      <ul>
        <li>A Demo Course and Demo Quiz will be created (Click Courses link on nav bar to view courses).</li>
        <li>Some Demo Questions are also created for you (Click Questions link on nav bar to view questions).</li>
        <li>In Courses you can view Demo Quiz.</li>
        <li>Click on the Demo Quiz and Click on User Mode or God Mode to take the quiz.</li>
        <li>You can also edit the Demo quiz.</li>
      </ul>
    </div>
    {% if msg %}
      <h4>{{ msg }}</h4>
    {% endif %}
</center>
{% if trial_paper %}
  <br/>
  <p><center><strong> You have trial papers </strong><br/></center></p>
  &nbsp;&nbsp;<input type="checkbox" class="selectall"/>&nbsp;&nbsp;Select all
  <br/>
  <div id="trial">
  <table class="table table-bordered">
  <form action="" method="post">
  {% csrf_token %}
   {% for paper in trial_paper %}
  <tr>
  <td> <input type = "checkbox" name="delete_paper" class="check" value = {{paper.id}}></input></td>
  <td> <a href="{{URL_ROOT}}/exam/manage/gradeuser/{{paper.question_paper.quiz.id}}">{{paper.question_paper.quiz.description}}</a></td>
  </tr>
  {% endfor %}
  </table>
  <center><button class="btn" type="submit">Delete Selected</button></center>
  </form>
  </div>
  {% endif %}
{% endblock %}
{% if user %}
  {% block info %}
  <h5>{{user.get_full_name|title}}({{user.profile.roll_number}}) Logged in as {{user.username}}</h5>
  {% endblock %}
{% endif %}
