<%- include("partials/teheader.ejs") %>
<meta http-equiv="refresh" content="30">
</head>



<body>
  <%- include("partials/tenav.ejs") %>
  <div class="container" style="padding-top:50px">
    <div class="">
      <%if(exams[0]){%>
      <h4 class="mb-5">Ongoing Exams</h4>
      <% for(var i=0;i<=exams.length-1;i++){%>
      <% if(exams[i].status=="started"){ %>
      <div class="card text-center">
        <h5 class="card-header"><%=exams[i].title%></h5>
        <div class="card-body">
          <p class="card-text"><b>Number of questions:</b> <%=exams[i].noquestions%></p>
          <p class="card-text"><b>Total Marks: </b><%=exams[i].marks%></p>
          <p class="card-text"><b>Access Code: </b><%=exams[i].access%></p>
          <a class="btn btn-outline-warning" role="button" href="/te/exam/<%=exams[i]._id%>/students">Students List</a>
          <a class="btn btn-outline-danger" role="button" href="/te/exam/<%=exams[i]._id%>/responses">View Responses</a>
        </div>
      </div>
      <%}%>
    <%}%>
      <%}%>
    <% if(!exams[0]){ %>
      <div class="text-center">
        <img class="mx-auto d-block" style="margin: 0 auto" src="https://testbanktop.com/wp-content/uploads/2018/01/search_error.png" width="300" height="300" alt="">
      </div>
      <div class="col-md-12 text-center">
        <p>You'll find Ongoing Exams here</p>
      </div>
      <%  }%>
    </div>
    <hr>
    <div class="">

      <%if(exams[0]){%>
      <h4 class="mb-5">Exams Ready</h4>
      <% for(var i=0;i<=exams.length-1;i++){%>
      <% if(exams[i].status=="ready"){ %>
      <div class="card text-center">
        <h4 class="card-header"><%=exams[i].title%></h4>
        <div class="card-body text-center">
          <p class="card-text"><b>Number of questions:</b> <%=exams[i].noquestions%></p>
          <p class="card-text"><b>Total Marks: </b><%=exams[i].marks%></p>
          <p class="card-text"><b>Access Code: </b><%=exams[i].access%></p>
          <a class="btn btn-outline-warning" role="button" href="/te/exam/<%=exams[i]._id%>/students">Students List</a>
          <form action="<%=exams[i]._id%>/start?_method=patch" class="btn" method="post">
            <button class="btn btn-outline-success">Start Exam</button>
          </form>
        </div>
      </div>
      <%}%>
    <%}%>
      <%}%>
  </div>
</div>
<script src="/scripts/examready.js"></script>
</body>
<%- include("./partials/footer.ejs") %>










      <!-- OLD CODE -->


      <!-- <div class="container px-5">
    <div class="container px-5">
      <% for(var i=0;i<=exams.length-1;i++){%>
      <% if(exams[i].status=="started"){ %>
        <%console.log("started");%>
        <div class="row my-5 py-3 border">
          <div class="col-md-12">
            <h4 class="">Title: <%=exams[i].title%></h4>
          </div>
          <div class="col-md-12">
            <h6 class="">  Number of questions: <%=exams[i].noquestions%></h6>
          </div>
          <div class="col-md-12">
            Total marks: <%=exams[i].marks%>
          </div>
          <div class="col-md-12 d-flex justify-content-around">
              <a href="/te/exam/<%=exams[i]._id%>/students" class="btn btn-outline-primary">Students List</a>
              <a href="/te/exam/<%=exams[i]._id%>/responses">View Incoming Responses</a>
          </div>
        </div>
      <%}%>
    <%}%>
    </div>
  </div> <%}%>-->




      <!-- <hr>

<%if(exams[0]){%>
  <div class="container px-5">
    <div class="container px-5">
      <% for(var i=0;i<=exams.length-1;i++){%>
        <% if(exams[i].status=="ready"){ %>
          <div class="row my-5 py-3 border">
            <div class="col-md-12">
              <h4 class="">Title: <%=exams[i].title%></h4>
            </div>
            <div class="col-md-12">
              <h6 class="">  Number of questions: <%=exams[i].noquestions%></h6>
            </div>
            <div class="col-md-12">
              Total marks: <%=exams[i].marks%>
            </div>
            <div class="col-md-12 d-flex justify-content-around">
                <a href="/te/exam/<%=exams[i]._id%>/students" class="btn btn-outline-primary">Students List</a>
                <form style="border:0px" action="<%=exams[i]._id%>/start?_method=patch" method="post">
                <button class="btn btn-outline-success">Start</button>
      </form>
    </div>
  </div>
  <%}%>
    <%}%>
  </div>
  </div> -->
