<!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" /> -->
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <link
      href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css"
      rel="stylesheet"
      integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC"
      crossorigin="anonymous"
    />
    <link rel="stylesheet" href="./css/viewmyus.css" />
  </head>
  <body>
    <nav class="navbar navbar-expand-lg navbar-dark bg-dark">
      <div class="container-fluid">
        <a class="navbar-brand" href="/"><strong>US HOME</strong></a>
        <button
          class="navbar-toggler"
          type="button"
          data-bs-toggle="collapse"
          data-bs-target="#navbarNav"
          aria-controls="navbarNav"
          aria-expanded="false"
          aria-label="Toggle navigation"
        >
          <span class="navbar-toggler-icon"></span>
        </button>
        <div class="collapse navbar-collapse" id="navbarNav">
          <ul class="navbar-nav">
            <li class="nav-item">
              <a class="nav-link active" aria-current="page" href="/user"
                >Back</a
              >
            </li>
          </ul>
        </div>
        <form class="d-flex" method="GET" action="/logout">
          <input class="form-control me-2" type="hidden" />
          <button class="btn btn-danger" type="submit">LOG OUT</button>
        </form>
      </div>
    </nav>
    <div class="my_container_top">
      <!-- <div>
        <form action="">
          <input type="text" placeholder="search by name" />
          <button class="btn btn-outline-primary">SEARCH</button>
        </form>
      </div> -->
    </div>
    <div
      class="container"
      style="
        background-color: rgb(245, 245, 248);
        color: floralwhite;
        text-align: center;
        height: auto;
        margin-top: 1%;
        padding-top: 2%;
        padding-bottom: 4%;
      "
    >
      <div id="table_top">
        <h1 style="margin-bottom: 2%; color: rgb(8, 8, 8)">
          Lista de Laudos de US de <%= username %>:
        </h1>
        <a href="/user" type="button" class="btn btn-warning btn-lg"
          >CANCELAR</a
        >
      </div>
      <table class="table">
        <thead class="table-dark">
          <tr>
            <td width="103">Imagem_1</td>
            <td width="103">Imagem_2</td>
            <td width="117">Data US</td>
            <td width="71">BIRADS</td>
            <td width="71">Tamanho</td>
            <td width="71">Vasos</td>
            <td width="51">IR</td>
            <td width="71">Histologia</td>
            <td width="51">Grau</td>
            <td width="51">RE</td>
            <td width="51">RP</td>
            <td width="51">HER2</td>
            <td>Patologia</td>
            <td>Deletar</td>
          </tr>
        </thead>
        <tbody>
          <% for(var i=0; i < result.length; i++) { %>
          <tr>
            <td width="103">
              <img src="<%= result[i].img_path0 %>" alt="" height="97" />
            </td>
            <td width="103">
              <img src="<%= result[i].img_path1 %>" alt="" height="97" />
            </td>
            <td width="117">
              <%= moment(result[i].us_date).format( 'MMM-DD-YYYY') %>
            </td>
            <td width="71"><%= result[i].birads %></td>
            <td width="71"><%= result[i].size %></td>
            <td width="71"><%= result[i].vessels %></td>
            <td width="51"><%= result[i].ir %></td>
            <td><%= result[i].histology %></td>
            <td width="51"><%= result[i].grade %></td>
            <td width="51"><%= result[i].er %></td>
            <td width="51"><%= result[i].pr %></td>
            <td width="51"><%= result[i].her2 %></td>
            <td>
              <form method="POST" action="/confirmid">
                <div>
                  <input
                    type="hidden"
                    id="username"
                    name="username"
                    value="<%= result[i]._id %>"
                  />
                </div>
                <div>
                  <input
                    type="hidden"
                    id="search_type"
                    name="search_type"
                    value="pathology"
                  />
                </div>
                <div>
                  <input
                    type="hidden"
                    id="_id"
                    name="_id"
                    value="<%= result[i]._id %>"
                  />
                </div>
                <button type="submit" class="btn btn-danger">INSERIR</button>
              </form>
            </td>
            <td>
              <form method="POST" action="/deldata">
                <div>
                  <input
                    type="hidden"
                    id="username"
                    name="username"
                    value="<%= result[i]._id %>"
                  />
                </div>
                <div>
                  <input
                    type="hidden"
                    id="search_type"
                    name="search_type"
                    value="pathology"
                  />
                </div>
                <div>
                  <input
                    type="hidden"
                    id="_id"
                    name="_id"
                    value="<%= result[i]._id %>"
                  />
                </div>
                <button type="submit" class="btn btn-danger">DELETAR</button>
              </form>
            </td>
          </tr>
          <% } %>
        </tbody>
      </table>
      <a href="/user" type="button" class="btn btn-warning btn-lg">CANCELAR</a>
    </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>
