{% extends "base.html" %}

{% load static %}

{% load crispy_forms_tags %}

{% block head %}

<!--  <meta http-equiv="refresh" content="5"> -->


{% endblock head %}

{% block content %}

        <div class="content"  >
            <div class="animated fadeIn">
                <div class="row">

                    <div class="col-md-12">
                        <div class="card">
                            <div class="card-header">
                                <strong class="card-title">SUBDIRECCIÓN DE INGENIERÍA BIOMÉDICA</strong>
                                
                            </div>
                            <div class="card-body">
                                
                                <table id="example1" class="table table-striped table-bordered">
                                    <thead>
                                        <tr>
                                            <th>id</th>
                                            <th>id SENSOR</th>
                                            <th>UBICACION</th>
                                            <th>TEMP_MIN</th>
                                            <th>TEMP_MAX</th>
                                            <th>HUMEDAD_MIN</th>
                                            <th>HUMEDAD_MAX</th>
                                            <th>ACTIVO</th>
                                            <th>VER HUMEDAD</th>
                                            <th>OPCIONES</th>
                                                                                        
                                        </tr>
                                    </thead>
                                    
                                    <tbody>
                                        {% for dato in datos %}
                                        <tr>
                                            <td>{{ dato.id }}</td>
                                            <td>{{ dato.idsensor }}</td>
                                            <td>{{ dato.nombre }}</td>
                                            <td>{{ dato.temp_min }}</td>
                                            <td>{{ dato.temp_max }}</td>
                                            <td>{{ dato.hume_min }}</td>
                                            <td>{{ dato.hume_max }}</td>
                                            <td>{{ dato.activo }}</td>
                                            <td>{{ dato.ver_humedad }}</td>
                                            <td>
                                                {% if user.is_superuser %}
                                                <a href="{% url 'actualizasensorf' dato.id %}" class="btn btn-success btn-rounded btn-lg" >Actualizar Datos</a>
                                                {% endif %}
                                            </td>
                                            
                                        </tr>
                                        {% endfor %}
                                        
                                    </tbody>
                                </table>

                            </div>
                        </div>
                        <div class="card">
                            <div class="card-header">
                                <strong class="card-title">CONFIGURACIÓN TELEGRAM</strong>
                                
                            </div>

                            <div class="card-body">
                                <table id="example2" class="table table-striped table-bordered">
                                    <thead>
                                        <tr>
                                            <th>id</th>
                                            <th>idBot</th>
                                            <th>idGrupo</th>
                                            <th>OPCIONES</th>
                                        </tr>
                                    </thead>
                                    
                                    <tbody>
                                        {% for tele in teleg %}
                                        <tr>
                                            <td>{{ tele.id }}</td>
                                            <td>{{ tele.idBot }}</td>
                                            <td>{{ tele.idGrupo }}</td>
                                            <td>
                                                {% if user.is_superuser %}
                                                <a href="{% url 'actualizatelegram' tele.id %}" class="btn btn-success btn-rounded btn-lg" >Actualizar Datos</a>
                                                {% endif %}
                                            </td>
                                        </tr>
                                        {% endfor %}
                                    </tbody>
                                </table>
                            </div>

                        </div>
                    </div>

                </div>
            </div><!-- .animated -->
        </div><!-- .content -->


{% endblock content %}

{% block javascript %} 

<script type="text/javascript">
    $(document).ready(function() {
        $('#example1').DataTable({
            "pageLength": 50,
            "order": [[1, "asc" ]],
    });
} );
</script>
<script type="text/javascript">
    $(document).ready(function() {
        $('#example2').DataTable({
            "pageLength": 50,
            "order": [[1, "asc" ]],
    });
} );
</script>

{% endblock javascript %}



