<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <link
      href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css"
      rel="stylesheet"
      integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC"
      crossorigin="anonymous"
    />
    <title>Document</title>
  </head>

      <body>
        <div class="container pt-4">
          <div class="p-4 m-4">
            <div class="col-lg-8 border rounded mx-auto">
              <h3>
                <div class="alert alert-danger" role="alert">
                  <b>Pending Request's</b>
                </div>
              </h3>

              <div>
                <table class="table">

                  <thead>
                    <tr>
                      <th>#</th>
                      <th>Hospital Name</th>
                      <th>Equipment Name</th>
                      <th>Equipment Quantity</th>
                      <th>Status</th>
                    </tr>
                  </thead>

                  <tbody>
                    <!-- for loop displaying the content of table and then enclose alll these-->
                    <%if(orders.length==0){%>
                        <h1>No Pending Orders</h1>
                    <%}else{%>
                        <%orders.forEach(function(order){%>
                            <tr>
                                <td>1.</td>
                                <td><%=order.requestingHospitalName%></td>
                                <td><%=order.equipmentName%></td>
                                <td><%=order.equipmentQuantity%></td>
                                <td>
                                <form action="/deleteOrder" method="post">
                                  <div class="form-check">
                                      <label class="form-check-label">
                                      <input type="checkbox" class="form-check-input" name="checkbox" value="<%=order.requestingHospitalName%>"  onChange="this.form.submit()">
                                      Display value
                                      </label>
                                  </div>
                                </form>
                                </td>
                              </tr>
                        <%})%>
                    <%}%>
                    <!-- end of for loop -->
                  </tbody>
                </table>
              </div>
            </div>
          </div>
        </div>

    <script
      src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js"
      integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM"
      crossorigin="anonymous"
    ></script>
  </body>
</html>