{% extends "base.html" %}

{% load static %}

{% load crispy_forms_tags %}

{% block head %}

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


{% endblock head %}

{% block content %}

<div class="breadcrumbs">
    <div class="breadcrumbs-inner">
        <div class="row m-0">
            <div class="col-sm-12">
                <div class="page-header float-left">
                    <div class="page-title">
                        <h1>SUBDIRECCIÓN DE INGENIERÍA BIOMÉDICA</h1>
                    </div>
                </div>
            </div>
            
            <div class="col-sm-8">
                <div class="page-header float-right">
                    
                </div>
            </div>
        </div>
    </div>
</div>

 

        <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">DATOS OBTENIDOS DE SENSORES</strong>
                                
                            </div>
                            <div class="card-body">
                                
                                        <form method="POST" action="{% url 'sensoresfijosdia' %}" class="mt-2" autocomplete="off">
                                            {% csrf_token %}
                                            <div class="input-group mb-3">
                                                <div class="input-group-prepend">
                                                    <button type="submit" class="btn btn-success">Consultar</button>
                                                </div>
                                                <div class="input-group-prepend">
                                                  <label class="input-group-text" for="inputGroupSelect01">Sensor</label>
                                                </div>
                                                <div class="input-group-prepend">
                                                <select class="custom-select" name="sensor" >
                                                  <option selected>Sensor....</option>
                                                  {% for sensor in sensores %}
                                                    <option value="{{ sensor.idsensor }}">{{ sensor.nombre }}</option>
                                                  {% endfor %}
                                                </select>
                                                </div>
                                                <div class="input-group-prepend">
                                                    <label class="input-group-text" for="inputGroupSelect01">INICIO</label>
                                                  </div>
                                                <div class="input-group-prepend">
                                                    <input name="fecha_ini" type="date" placeholder="" class="form-control" value="" required>
                                                </div>
                                                
                                                <div class="input-group-prepend">
                                                    <label class="input-group-text" for="inputGroupSelect01">FIN</label>
                                                  </div>
                                                <div class="input-group-prepend">
                                                    <input name="fecha_fin" type="date" placeholder="" class="form-control" value="" required>
                                                </div>
                                                
                                            </div>
                                        </form>
                                    
                                
                                <table id="example" class="table table-striped table-bordered">
                                    <thead>
                                        <tr>
                                            <th>id</th>
                                            <th>SENSOR</th>
                                            <th>TEMPERATURA</th>
                                            <th>HUMEDAD</th>
                                            <th>FECHA</th>
                                            <th>HORA</th>
                                                                                        
                                        </tr>
                                    </thead>
                                    
                                    <tbody>
                                        {% for dato in datos %}
                                        <tr>
                                            <td>{{ dato.id }}</td>
                                            <td>{{ dato.idsensor }}</td>
                                            <td>{{ dato.temp }}</td>
                                            <td>{{ dato.hume }}</td>
                                            <td>{{ dato.fecha }}</td>
                                            <td>{{ dato.hora }}</td>
                                            
                                        </tr>
                                        {% endfor %}
                                        
                                    </tbody>
                                </table>
                            </div>
                        </div>

                        
                    </div>



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



{% endblock content %}

{% block javascript %} 

<script type="text/javascript">
    $(document).ready(function() {
      $('#bootstrap-data-table-export').DataTable();
  } );
</script>

{% endblock javascript %}



