terrarium-web/templates/datas.html.twig

100 lines
4.5 KiB
Twig

{% extends 'base.html.twig' %}
{% block title %}{{ parent() }} - Moniteur{% endblock %}
{% block body %}
<div class="container-fluid">
<div class="row pt-3">
<div class="col-6">
<section class="mb-5">
<div class="h3">Température</div>
<div class="row">
<div class="col-12">
<table class="table">
<thead class="thead-dark">
<tr>
<th width="30%">📅 Date</th>
<th>Valeur</th>
</tr>
</thead>
<tbody>
{% for item in temperatures %}
{% if item.value >= 27 %}
{% set class = 'table-info' %}
{% elseif item.value <= 22 %}
{% set class = 'table-warning' %}
{% else %}
{% set class = '' %}
{% endif %}
<tr class="{{ class }}">
<td>
{% set lightTime = item.date.format('Gi') %}
{% if lightTime >= lightOnAt and lightTime <= lightOffAt %}
🌕
{% else %}
🌑
{% endif %}
{{ item.date.format('d/m H:i') }}
</td>
<td>{{ item.value|number_format(2, ',', '') }}°</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</section>
</div>
<div class="col-6">
<section>
<div class="h3">Hygrométrie</div>
<div class="row">
<div class="col-12">
<table class="table">
<thead class="thead-dark">
<tr>
<th width="50%">📅 Date</th>
<th>Valeur</th>
</tr>
</thead>
<tbody>
{% for item in hygrometries %}
{% if item.value >= 50 %}
{% set class = 'table-danger' %}
{% elseif item.value >= 40 %}
{% set class = 'table-warning' %}
{% else %}
{% set class = '' %}
{% endif %}
<tr class="{{ class }}">
<td>
{% set lightTime = item.date.format('Gi') %}
{% if lightTime >= lightOnAt and lightTime <= lightOffAt %}
🌕
{% else %}
🌑
{% endif %}
{{ item.date.format('d/m H:i') }}
</td>
<td>{{ item.value|number_format(2, ',', '') }}%</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</section>
</div>
</div>
</div>
{% endblock %}