templates/weather/index.html.twig line 1
{% extends 'base.html.twig' %}{% block title %}Weather{% if CompanyDetailsService is not null %}: {{ CompanyDetailsService.getCompanyDetails.weatherLocation }}{% endif %}{% endblock %}{% block body %}<h1 style="color: red">Weather{% if CompanyDetailsService is not null %}: {{ CompanyDetailsService.getCompanyDetails.weatherLocation }}{% endif %}</h1>{% include 'weather/parts/update_and_delete_buttons.html.twig' %}{% set grouped = {} %}{% for w in weather %}{% if w.date > today %}{% set dayKey = w.date|date('Y-m-d') %}{% if grouped[dayKey] is not defined %}{% set grouped = grouped|merge({ (dayKey): [w] }) %}{% else %}{% set grouped = grouped|merge({ (dayKey): grouped[dayKey]|merge([w]) }) %}{% endif %}{% endif %}{% endfor %}{% for date, dayWeather in grouped %}{% if selectedDate is empty or selectedDate == date %}<h3>{{ date|date("l, d M Y") }}</h3><table class="table table-responsive small"><thead><tr><th>Time</th><th>Sun/<br>Rain</th><th>Rainfall</th><th>Temp</th></tr></thead><tbody>{% for weather in dayWeather %}<tr><td data-sort="{{ weather.time }}" style="text-align: right">{{ weather.time }}:00h</td><td style="text-align: center">{% if weather.rain is not empty %}<i class="fas fa-cloud-rain" style="color: blue"></i>{% else %}<i class="fa fa-sun-o" style="color: orange"></i>{% endif %}</td><td style="text-align: left">{% if weather.rain is not empty %}{{ weather.rain |number_format(2, '.', ',') }}mm/hr{% endif %}</td><td style="text-align: right">{{ weather.weather|number_format(0, '.', ',') }} °C</td></tr>{% endfor %}</tbody></table>{% endif %}{% else %}<br><br><br><br><br><br><br><p>No future weather data available.</p>{% endfor %}{% endblock %}{% block datatable %}<script>$(document).ready(function () {$('.table').DataTable({'pageLength': 100,"order": [[0, 'asc']],"paging": false,"searching": false,"bInfo": false});});</script>{% endblock %}