<!DOCTYPE html>
<html>
  <head>
    <title>Students</title>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <link
      rel="stylesheet"
      href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css"
      integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65"
      crossorigin="anonymous"
    />
    <style>
      th,
      td {
        text-align: center;
      }
    </style>
  </head>
  <body>
    <div class="container">
      <div class="row justify-content-center">
        <div class="col-md-8 col-lg-6">
          <h1 class="text-center mb-4">Students</h1>
          <div class="col text-center justify-content-center">
            <a class="btn btn-primary text-center mb-2" href="/logout"
              >Logout</a
            >
            <a class="btn btn-primary text-center mb-2" href="/filter"
            >Back to Filter</a
          >
          </div>

          <table class="table table-bordered">
            <thead>
              <tr>
                <th scope="col">Registration_Number</th>
                <th scope="col">Name</th>
                <th scope="col">Course</th>
                <th scope="col">Semester</th>
                <th scope="col">Branch</th>
                <th scope="col">Section</th>
                <th scope="col">Session</th>
                <th scope="col">Year</th>
                <th scope="col">Mobile_Number</th>
                <th scope="col">Verification Status</th>
              </tr>
            </thead>
            <tbody>
              <% if (typeof students !== 'undefined' && students.length > 0) {
              %> <% students.forEach(function(student) { %>
              <tr>
                <td><%= student.Registration_Number %></td>
                <td><%= student.Name %></td>
                <td><%= student.Course %></td>
                <td><%= student.Semester %></td>
                <td><%= student.Branch %></td>
                <td><%= student.Section %></td>
                <td><%= student.Session %></td>
                <td><%= student.Year %></td>
                <td><%= student.Mobile_Number %></td>
                <td>
  <% if (typeof student.Accounts_Verified !== 'undefined') { %>
    <% if (student.Accounts_Verified === 0) { %>
      UNVERIFIED
    <% } else if (student.Accounts_Verified === 1) { %>
      VERIFIED
    <% } %>
  <% } else if (typeof student.Library_Verified !== 'undefined') { %>
    <% if (student.Library_Verified === 0) { %>
      UNVERIFIED
    <% } else if (student.Library_Verified === 1) { %>
      VERIFIED
    <% } %>
  <% } else if (typeof student['Training_And_Placement Verified'] !== 'undefined') { %>
    <% if (student['Training_And_Placement Verified'] === 0) { %>
      UNVERIFIED
    <% } else if (student['Training_And_Placement Verified'] === 1) { %>
      VERIFIED
    <% } %>
  <% } else if (typeof student.Alumni_Cell_Verified !== 'undefined') { %>
    <% if (student.Alumni_Cell_Verified === 0) { %>
      UNVERIFIED
    <% } else if (student.Alumni_Cell_Verified === 1) { %>
      VERIFIED
    <% } %>
  <% } else if (typeof student.Project_Verified !== 'undefined') { %>
    <% if (student.Project_Verified === 0) { %>
      UNVERIFIED
    <% } else if (student.Project_Verified === 1) { %>
      VERIFIED
    <% } %>
  <% } else if (typeof student.Internship_Verified !== 'undefined') { %>
    <% if (student.Internship_Verified === 0) { %>
      UNVERIFIED
    <% } else if (student.Internship_Verified === 1) { %>
      VERIFIED
    <% } %>
  <% } else if (typeof student.HOD_Verified !== 'undefined') { %>
    <% if (student.HOD_Verified === 0) { %>
      UNVERIFIED
    <% } else if (student.HOD_Verified === 1) { %>
      VERIFIED
    <% } %>
  <% } %>
</td>

<td>
  <% if (typeof student.Accounts_Verified !== 'undefined') { %>
    <% if (student.Accounts_Verified === 0) { %>
      <form action="/students/<%= student.Registration_Number %>/verify" method="POST">
        <button type="submit" class="btn btn-success btn-sm">Verify</button>
      </form>
    <% } else if (student.Accounts_Verified === 1) { %>
      <form action="/students/<%= student.Registration_Number %>/unverify" method="POST">
        <button type="submit" class="btn btn-danger btn-sm">Unverify</button>
      </form>
    <% } %>
  <% } else if (typeof student.Library_Verified !== 'undefined') { %>
    <% if (student.Library_Verified === 0) { %>
      <form action="/students/<%= student.Registration_Number %>/verify" method="POST">
        <button type="submit" class="btn btn-success btn-sm">Verify</button>
      </form>
    <% } else if (student.Library_Verified === 1) { %>
      <form action="/students/<%= student.Registration_Number %>/unverify" method="POST">
        <button type="submit" class="btn btn-danger btn-sm">Unverify</button>
      </form>
    <% } %>
  <% } else if (typeof student['Training_And_Placement Verified'] !== 'undefined') { %>
    <% if (student['Training_And_Placement Verified'] === 0) { %>
      <form action="/students/<%= student.Registration_Number %>/verify" method="POST">
        <button type="submit" class="btn btn-success btn-sm">Verify</button>
      </form>
    <% } else if (student['Training_And_Placement Verified'] === 1) { %>
      <form action="/students/<%= student.Registration_Number %>/unverify" method="POST">
        <button type="submit" class="btn btn-danger btn-sm">Unverify</button>
      </form>
    <% } %>
  <% } else if (typeof student.Alumni_Cell_Verified !== 'undefined') { %>
    <% if (student.Alumni_Cell_Verified === 0) { %>
      <form action="/students/<%= student.Registration_Number %>/verify" method="POST">
        <button type="submit" class="btn btn-success btn-sm">Verify</button>
      </form>
    <% } else if (student.Alumni_Cell_Verified === 1) { %>
      <form action="/students/<%= student.Registration_Number %>/unverify" method="POST">
        <button type="submit" class="btn btn-danger btn-sm">Unverify</button>
      </form>
    <% } %>
  <% } else if (typeof student.Project_Verified !== 'undefined') { %>
    <% if (student.Project_Verified === 0) { %>
      <form action="/students/<%= student.Registration_Number %>/verify" method="POST">
        <button type="submit" class="btn btn-success btn-sm">Verify</button>
      </form>
    <% } else if (student.Project_Verified === 1) { %>
      <form action="/students/<%= student.Registration_Number %>/unverify" method="POST">
        <button type="submit" class="btn btn-danger btn-sm">Unverify</button>
      </form>
    <% } %>
  <% } else if (typeof student.Internship_Verified !== 'undefined') { %>
    <% if (student.Internship_Verified === 0) { %>
      <form action="/students/<%= student.Registration_Number %>/verify" method="POST">
        <button type="submit" class="btn btn-success btn-sm">Verify</button>
      </form>
    <% } else if (student.Internship_Verified === 1) { %>
      <form action="/students/<%= student.Registration_Number %>/unverify" method="POST">
        <button type="submit" class="btn btn-danger btn-sm">Unverify</button>
      </form>
    <% } %>
  <% } else if (typeof student.HOD_Verified !== 'undefined') { %>
    <% if (student.HOD_Verified === 0) { %>
      <form action="/students/<%= student.Registration_Number %>/verify" method="POST">
        <button type="submit" class="btn btn-success btn-sm">Verify</button>
      </form>
    <% } else if (student.HOD_Verified === 1) { %>
      <form action="/students/<%= student.Registration_Number %>/unverify" method="POST">
        <button type="submit" class="btn btn-danger btn-sm">Unverify</button>
      </form>
    <% } %>
  <% } %>
</td>

              </tr>
              <% }); %> <% } else { %>
              <tr>
                <td colspan="7">No students found.</td>
              </tr>
              <% } %>
            </tbody>
          </table>
        </div>
      </div>
    </div>

    <script
      src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.min.js"
      integrity="sha384-cuYeSxntonz0PPNlHhBs68uyIAVpIIOZZ5JqeqvYYIcEL727kskC66kF92t6Xl2V"
      crossorigin="anonymous"
    ></script>
  </body>
</html>
