<!DOCTYPE html>
<html lang="en">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <!-- Meta, title, CSS, favicons, etc. -->
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
	<link rel="icon" href="assets/images/favicon.ico" type="image/ico" />

    <title>Panel de administración</title>

    <!-- Bootstrap -->
    <link href="vendors/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
    <!-- Font Awesome -->
    <link href="vendors/font-awesome/css/font-awesome.min.css" rel="stylesheet">
    <!-- NProgress -->
    <link href="vendors/nprogress/nprogress.css" rel="stylesheet">
	
    <!-- Custom Theme Style -->
    <link href="assets/css/custom.css" rel="stylesheet">

    <!-- jQuery -->
    <script src="vendors/jquery/dist/jquery.min.js"></script>

  </head>


        <!-- Basic top navigation -->
        <div class="top_nav">
          <div class="nav_menu">
            <nav>
              <ul class="nav navbar-nav navbar-right">
                {% if user.Name %}
                <li class=""><a href="index.php?logout=1"><i class="fa fa-sign-out"></i> Cerrar sesión</a></li>
                <li class=""><a href="admin.php"><i class="fa fa-database"></i> Administración</a></li>
                <li class=""><a href="#"> Bienvenido, {{user.Name}}</a></li>
                {% else %}
                  <li class=""><a href="login.php"><i class="fa fa-sign-out"></i> Iniciar sesión</a></li>
                {% endif %}
                
              </ul>
            </nav>
          </div>
        </div>
        <!-- /Basic top navigation -->


  <body class="nav-md">
    <div class="container body">

 <!-- Table -->
          <div class="row">
            <div class="col-md-12 col-sm-12 col-xs-12">
              <div class="x_panel">
                <div class="x_title">
                  <h2>CheckServer. Página de estado <small>Estado rápido de los servidores</small> </h2>
                  <div class="clearfix"></div>
                </div>
                <div class="x_content">
                  <table id="datatable" class="table table-striped table-bordered">
                      <thead>
                        <tr>
                          <th>Servidor </th>
                          <th>Servicios</th>
                          <th>Uptime </th>
                          <th>Encendido </th>
                          <th>Ultimo fallo </th>

                        </tr>
                      </thead>

                      <tbody>
                      {% for server in servers %}
                        <tr 
                        {% if server.Enabled == 1 %} {% if server.Online == 1 %} class="bgcolor-ok" {% endif %}{% elseif server.Enabled == 0 %} class="bgcolor-secondary"{% endif %}>

                        <td data-toggle="tooltip" data-placement="top" {#title="{{server.Description}}"#} >{{server.Name}} {% if server.Online == 0 and server.Enabled == 1 %}<br/><i>Offline</i>{%endif%}{% if server.Enabled == 0 %}<br/><i>Deshabilitado</i>{%endif%}</td>

                          <td {% if server.SInactive > 0 %} class="bgcolor-warn" {% endif %}>
                            Monitorizando: {{server.SEnabled}} 
                            {% if server.SEnabled > 0 %}<br>Funcionando: {{server.SActive}} {% endif %}
                            {% if server.SInactive > 0 %}<br>Parados: {{server.SInactive}} {% endif %}
                            {% if server.SDisabled > 0 %}<br>Monitorización en pausa: {{server.SDisabled}} {% endif %}
                          </td>
                          <td>{% if server.BadCreds == 0 %}  {{server.Uptime}} {% endif %}</td>
                          {% if server.Enabled == 1 %}
                          <td{% if server.Ping > -1 %} class="bgcolor-ok">On {% else %} class="bgcolor-warn">Off{% endif %}</td>
                          {% else %}
                          <td></td>
                          {% endif %}

                          <td></td> {#TODO: Know last error #}
                        </tr>
                        {% endfor %}
                    </tbody>
                  </table>
                </div>
              </div>
            </div>
            
          </div>




        <!-- /page content -->

{% include 'a_footer.twig' %}