{% include 'a_header.twig' %}


          <!-- top tiles -->
          <div class="row tile_count">
            <div class="col-md-2 col-sm-4 col-xs-6 tile_stats_count">
              <span class="count_top"><i class="fa fa-user"></i> Servidores</span>
              <div class="count">{{numrows.all}}</div>
              <span class="count_bottom"><i class="green">{{numrows.enabled}} </i> Monitorizando</span>
            </div>
            <div class="col-md-2 col-sm-4 col-xs-6 tile_stats_count">
              <span class="count_top"><i class="fa fa-clock-o"></i> Servidores encendidos</span>
              <div class="count">{{numrows.on}}</div>
              <span class="count_bottom"><i class="green"><i class="fa fa-sort-asc"></i>{{numrows.off}} </i> Apagados</span>
            </div>
            <div class="col-md-2 col-sm-4 col-xs-6 tile_stats_count">
              <span class="count_top"><i class="fa fa-user"></i> Sensores</span>
              <div class="count">{{numrows.allsensors}}</div>
              <span class="count_bottom"><i class="green">{{numrows.activesensors}} </i> Activos</span>
            </div>
          </div>
          <!-- /top tiles -->

          <!-- Table -->
          <div class="row">
            <div class="col-md-12 col-sm-12 col-xs-12">
              <div class="x_panel">
                <div class="x_title">
                  <h2>Servidores <small>Estado rápido de los servidores</small> {% if user.PE_editserv == 1 or user.PE_admin == 1 %} <a class="btn btn-success" href="?page=newserver">Añadir servidor</a> {% endif %}</h2>
                  <div class="clearfix"></div>
                </div>
                <div class="x_content">
                  <p class="text-muted font-13 m-b-30">
                    Tabla de servidores</code>
                  </p>
                  <table id="datatable" class="table table-striped table-bordered">
                      <thead>
                        <tr>
                          <th>Servidor </th>
                          <th>Grupo(s) </th>
                          <th>Sistema Operativo </th>
                          <th>RAM libre </th>
                          <th class="column-title" style="display: table-cell;">Espacio libre (%) </th>
                          <th>Servicios</th>
                          <th>Uptime </th>
                          <th>Ping </th>
                          <th><span class="nobr">Action</span>
                          </th>
                          <th class="bulk-actions" colspan="7" style="display: none;">
                            <a class="antoo" style="color:#fff; font-weight:500;">Bulk Actions ( <span class="action-cnt">1 Records Selected</span> ) <i class="fa fa-chevron-down"></i></a>
                          </th>
                        </tr>
                      </thead>

                      <tbody>
                      {% for server in servers %}
                        <tr {% if server.BadCreds == 1 and server.Enabled == 1 %}class="bgcolor-badinfo" data-toggle="tooltip" data-placement="top" title="Credenciales no válidas o faltantes."
                        {% elseif server.BadCreds == 2 and server.Enabled == 1 %}
                        class="bgcolor-badinfo" data-toggle="tooltip" data-placement="top" title="El servidor tiene problemas con WMI (Error 0x80041045)"
                        {%else%}
                        {% if server.Enabled == 1 %} {%if server.Online == 1 %}class="bgcolor-ok" {%endif%}{% elseif server.Enabled == 0 %}class="bgcolor-secondary"{%endif%}
                        
                        {%endif%}
                        >
                          <td data-toggle="tooltip" data-placement="top" title="{{server.Description}}">{{server.Name}} ({{server.IP}}) {% if server.Online == 0 and server.Enabled == 1 %}<br/><i>Offline</i>{%endif%}{% if server.Enabled == 0 %}<br/><i>Deshabilitado</i>{%endif%}</td>
                          <td>
                          {% for ingrp in server.InGroups %}
                            {{ingrp.Name}}
                            {% if not loop.last %},{%endif%}
                          {% endfor %}
                          
                          </td>
                          <td>{% if server.Version != "" %} {{server.Version}} {%else%}{{server.SO}}{%endif%} </td>
                          <td class=" ">
                            {{server.Freeram}}
                          </td>
                          <td{% if server.AlertHDD > 0 %} class="bg-danger" {% endif %}>
                            {{server.HDDFastStats | raw}}
                          </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>{{server.Uptime}}</td>
                          {% if server.Enabled == 1 %}
                          <td{% if server.Ping > -1 %} class="bgcolor-ok"{%else%} class="bgcolor-warn"{%endif%}>{{server.Ping}}ms</td>
                          {% else %}
                          <td></td>
                          {% endif %}
                          <td class="last"><a class="btn btn-success" href="admin.php?page=servers&id_serv={{server.ID_SERV}}">Ver</a>
                          </td>
                        </tr>
                        {% endfor %}
                    </tbody>
                  </table>
                </div>
              </div>
            </div>
            
          </div>

        <!-- /page content -->


{% include 'a_footer.twig' %}