<!DOCTYPE html>
<head>
  {% load static %}
  <title>Pariksha | My Quizzes</title>
  <link rel="shortcut icon" href="{% static 'img/favicon.svg' %}" />
  <link href="https://fonts.googleapis.com/css2?family=Source+Sans+Pro:ital,wght@0,300;0,400;0,700;1,400&display=swap" rel="stylesheet">
  <link rel="stylesheet" type="text/css" href="{% static 'assets/DataTables/datatables.min.css' %}"/>
  <script type="text/javascript" src="{% static 'assets/DataTables/datatables.min.js' %}"></script>
  <style>
    * {
        font-family: 'Source Sans Pro', sans-serif;
    }
    .table_wrapper {
      margin: 40px;
      animation: appear 1s 1;
      position: relative;
    }
    .action_btn {
      color: white;
      background-color: #1779BA;
      cursor: pointer;
      padding-left: 15px;
      padding-right: 15px;
      padding-top: 10px;
      padding-bottom: 10px;
      border-radius: 6px;
    }
            
      @keyframes appear {
        0% {
          opacity: 0;
          top: 50px;
        }
        100% {
          opacity: 1;
          top:0px;
        }
      }
      
      .emptiness {
            display: flex;
            height: 100vh;
            justify-content: center;
            flex-direction: column;
            align-items: center;
        }
        .emptiness > img {
          height: 200px;
        }
        .heading {
          width: 400px;
          margin: 50px auto;
          font-weight: bold;
        }
    </style>
</head>
<body>
  {%if submissions%}
  <h1 class="heading">My Quizzes</h1>
  <section class="table_wrapper">
  <table cellspacing="0" id="myTable">
      <thead><th>Code</th><th>Quiz Name</th><th>Organized By</th><th>Date</th><th>Time</th><th>Duration</th><th>Marks Obtained</th><th>Actions</th></thead>
      <tbody>
      
        {% for sub in submissions %}
          <tr>
            <td>{{sub.quizId.quizCode}}</td><td>{{sub.quizId.quizInfo}}</td><td>{{sub.quizId.quizInstructor}}</td><td>{{sub.quizId.date}}</td><td>{{sub.quizId.startTime}}</td><td>{{sub.quizId.length}} minutes</td><td>{{sub.marks}}</td><td><a href="/view_submission/?q={{sub.quizId}}"><button class="action_btn" type="button">View Details</button></a></td>
          </tr>
        {%endfor%}
      </tbody>
  </table>
  </section>
  {%else%}
      <div class="emptiness">
        <img src="{% static 'img/students.svg' %}" height="100px">
        <h3>You have not attempted any quiz.</h3>
    </div>
  {%endif%}
  <script>
    function test() {
      alert(1);
    }
    
    $(document).ready( function () {
            $('#myTable').DataTable({
                /* Disable initial sort */
                "aaSorting": []
            });
        } );
  </script>
</body>
</html>
