<!DOCTYPE html>
<html>
  <head>
    <!-- Standard Meta -->
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">

    <!-- Site Properties -->
    <title>Admin | Cluster Lovelace</title>
    <link rel="stylesheet" type="text/css" href="/semantic-ui/semantic.min.css">
    <link rel="stylesheet" type="text/css" href="/css/font.css">

    <script src="/js/jquery-3.1.1.min.js"></script>
    <script src="/semantic-ui/semantic.min.js"></script>

    <% include ../navbar.ejs %>
    <div class="ui main text center aligned container">
      <% if(message.length > 0){ %>
        <div class="ui warning message">
          <i class="close icon"></i>
          <div class="header">Aviso</div>
          <ul class="list">
            <% for (msg in message) { %>
              <li><%= message[msg] %></li>
            <% } %>
          </ul>
        </div>
      <% } %>
      <h1 class="ui header">Panel de Administración</h1>
    </div>
    <div class="ui main text right aligned container">
      <div class="ui icon buttons">
        <a class="ui red compact icon button" data-content="Generar PDF" href="/docs/account-request.pdf" download><i class="file pdf outline icon"></i></a>
        <a class="ui compact icon button" data-content="Usuarios" href="/admin/users/"><i class="block layout icon"></i></a>
      </div>
      <div class="ui icon buttons">
        <a class="ui compact icon button" data-content="Todos los Usuarios" href="/admin/users/"><i class="users icon"></i></a>
        <a class="ui compact icon button" data-content="Usuarios Activos" href="/admin/users/active/"><i class="checkmark icon"></i></a>
        <a class="ui compact icon button" data-content="Usuarios Inactivos" href="/admin/users/inactive/"><i class="remove icon"></i></a>
        <a class="ui compact icon button" data-content="Usuarios Pendientes" href="/admin/users/pending/"><i class="warning icon"></i></a>
        <a class="ui compact icon button" data-content="Agregar Usuario" href="/signup"><i class="add user icon"></i></a>
        <%# <a class="ui compact icon button" data-content="Importar desde SO" href="/admin/users/linux"><i class="linux icon"></i></a>%>
      </div>
    </div>
    <div class="ui main text container">
      <table class="ui tablet stackable small very compact table">
        <thead>
          <tr>
            <th>Fecha</th>
            <th>ID</th>
            <th class="right aligned">Comentario</th>
          </tr>
        </thead>
        <tbody>
          <% for (var userbd in users) { %>
          <tr>
            <td>
              <div class="description">
                <%= ("0" + users[userbd].createdAt.getDate()).slice(-2) + "/"  + ("0" + (users[userbd].createdAt.getMonth() + 1)).slice(-2) + "/" + users[userbd].createdAt.getFullYear() %>
                <%= ("0" + users[userbd].createdAt.getHours()).slice(-2) + ":"  + ("0" + (users[userbd].createdAt.getMinutes() + 1)).slice(-2) %>
              </div>
            </td>
            <td><%= users[userbd].user_id %><br />
            <%= users[userbd].name + ' ' + users[userbd].last_name %><br />
            <div class="description">
              <i><b><%= users[userbd].email %></b></i>
            </div>
            </td>
            <td class="right aligned">
              <div class="description">
                <i><%= users[userbd].text %></i>
              </div>
            </td>
          </tr>
          <% } %>
        </tbody>
      </table>
    </div>
    <% include ../footer %>
  </body>
</html>
