<%- include('../partials/dash-head.ejs') %>

<% if (warning && warning.length) { %>
    <div class="myAlert-bottom alert alert-warning d-flex flex-row justify-content-between align-items-center">
        <div class="d-flex flex-row justify-content-between align-items-center">
            <svg class="bi flex-shrink-0 me-2 mr-3" width="24" height="24" role="img" aria-label="Warning:"><use xlink:href="#exclamation-triangle-fill"/></svg>
            <%= warning %> 
        </div>
      <a href="#" class="close mb-1" data-dismiss="alert" aria-label="close">&times;</a>
    </div>
<% } %>
    
    <!-- Navigation-->
    <nav class="navbar navbar-expand-lg navbar-dark bg-dark fixed-top side-nav" id="mainNav">

        <img src="/images/toplogo.png" class="logo">

        <div class="collapse navbar-collapse" id="navbarResponsive">

            <ul class="navbar-nav navbar-sidenav bg-dark" id="exampleAccordion">

                <li class="nav-item mt-4" data-toggle="tooltip" data-placement="right" title="Charts">
                    <a class="nav-link" href="/">
                        <i class="fa fa-fw fa-home"></i>
                        <span class="nav-link-text">Home</span>
                    </a>
                </li>
                <li class="nav-item" data-toggle="tooltip" data-placement="right" title="Dashboard">
                    <a class="nav-link" href="index.html">
                        <i class="fa fa-fw fa-dashboard"></i>
                        <span class="nav-link-text">Dashboard</span>
                    </a>
                </li>
            </ul>            
            <ul class="navbar-nav sidenav-toggler bg-dark">
                <li class="nav-item text-center" style="color: aliceblue;">
                    Dr.&nbsp;<%= doctor.fname %>&nbsp;<%= doctor.lname %>
                    <a class="nav-link">                        
                    </a>
                </li>
            </ul>
            <ul class="navbar-nav ml-auto">
                <li class="nav-item">
                    <a class="nav-link" data-toggle="modal" data-target="#exampleModal">
                      <i class="fa fa-fw fa-sign-out"></i><span>Logout</span></a>
                  </li>
            </ul>
        </div>
    </nav>
    <div class="content-wrapper">
        <div class="container-fluid">
            <!-- Breadcrumbs-->
            <ol class="breadcrumb">
                <li class="breadcrumb-item">
                    <a href="#">Dashboard</a>
                </li>
                <li class="breadcrumb-item active">Doctors</li>
            </ol>
            <!-- Icon Cards-->
            <div class="row">
                <div class="col-xl-3 col-sm-6 mb-3">
                    <div class="card text-white bg-primary o-hidden h-70">
                        <div class="card-body">
                            <div class="card-body-icon">
                                <i class="fa fa-fw fa-comments fa-3x"></i>
                            </div>
                            <div class="mr-5">
                                <h4>26 New Messages!</h4>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="col-xl-3 col-sm-6 mb-3">
                    <div class="card text-white bg-warning o-hidden h-70">
                        <div class="card-body">
                            <div class="card-body-icon">
                                <i class="fa fa-fw fa-wheelchair fa-3x"></i>
                            </div>
                            <div class="mr-5">
                                <h4>11 New Patients!</h4>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="col-xl-3 col-sm-6 mb-3">
                    <div class="card text-white bg-success o-hidden h-70">
                        <div class="card-body">
                            <div class="card-body-icon">
                                <i class="fa fa-fw fa-repeat fa-3x"></i>
                            </div>
                            <div class="mr-5">
                                <h4><%- appData.length %> Pending Checkups!</h4>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="col-xl-3 col-sm-6 mb-3">
                    <div class="card text-white bg-danger o-hidden h-70">
                        <div class="card-body">
                            <div class="card-body-icon">
                                <i class="fa fa-fw fa-check-circle fa-3x"></i>
                            </div>
                            <div class="mr-5">
                                <h4>13 Completed!</h4>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

        <div class="dat-tab card mb-3 dash-table">
            <div class="card-header">
                <i class="fa fa-table"></i> Data Table Example
            </div>
            <div class="card-body">
                <div class="table-responsive">
                    <table class="table table-bordered" id="dataTable" width="100%" cellspacing="0">
                        <thead>
                            <tr>
                                <th>Name</th>
                                <th>Gender</th>
                                <th>Details</th>
                                <th>Date</th>
                                <th>Action</th>
                            </tr>
                        </thead>
                        
                        <tbody>
                            <% for (let i of appData) {%> 
                            <tr>
                                <td><%- i.fname + ' ' + i.lname %></td>
                                <td><%- i.gender %></td>
                                <td><%- i.details %></td>
                                <% const temp = String(i.Date).substring(0,15) %>
                                <td><%- temp %></td>
                                <td><button class="btn btn-primary">
                                    <a href="./prescribe/<%= i.id %> "> Prescribe </a>
                                </button></td>
                            </tr>
                            <% } %>
                        </tbody>
                        
                    </table>
                </div>
            </div>
            <!-- <div class="card-footer small text-muted">Updated yesterday at 11:59 PM</div> -->
        </div>
    </div>
    <!-- /.container-fluid-->
    <!-- /.content-wrapper-->
    <!-- <footer class="sticky-footer">
            <div class="container">
                <div class="text-center">
                    <small>All Rights Reserved &copy; 2021 | QURO CARE</small>
                </div>
            </div>
        </footer> -->
      <!-- Logout Modal-->
      <div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel"
        aria-hidden="true">
        <div class="modal-dialog" role="document">
          <div class="modal-content">
            <div class="modal-header">
              <h5 class="modal-title" id="exampleModalLabel">Ready to Leave?</h5>
              <button class="close" type="button" data-dismiss="modal" aria-label="Close">
                <span aria-hidden="true">Ã—</span>
              </button>
            </div>
            <div class="modal-body">
              Select "Logout" below if you are ready to end your current session.
            </div>
            <div class="modal-footer">
              <button class="btn btn-secondary" type="button" data-dismiss="modal">
                Cancel
              </button>
              <form action="/doctor/logout" method="POST"><button class="btn btn-primary">Logout</button></form>
            </div>
          </div>
        </div>
      </div>
    </div>

    <%- include('../partials/dash-foot.ejs') %>