templates/weather/index.html.twig line 1

  1. {% extends 'base.html.twig' %}
  2. {% block title %}
  3.     Weather
  4.     {% if CompanyDetailsService is not null %}
  5.         : {{ CompanyDetailsService.getCompanyDetails.weatherLocation }}
  6.     {% endif %}
  7. {% endblock %}
  8. {% block body %}
  9.     <h1 style="color: red">
  10.         Weather{% if CompanyDetailsService is not null %}: {{ CompanyDetailsService.getCompanyDetails.weatherLocation }}
  11.         {% endif %}
  12.     </h1>
  13.     {% include 'weather/parts/update_and_delete_buttons.html.twig' %}
  14.     <table class="table table-responsive small">
  15.         <thead>
  16.         <tr>
  17.             <th>Location</th>
  18.             <th>Date</th>
  19.             <th>Time</th>
  20.             <th>Rain</th>
  21.             <th></th>
  22.             <th>Temperature</th>
  23.         </tr>
  24.         </thead>
  25.         <tbody>
  26.         {% for weather in weather %}
  27.             {% if weather.date|date('Y-m-d') == today|date('Y-m-d') %}
  28.                 <tr style="background-color: whitesmoke">
  29.             {% else %}
  30.                 <tr>
  31.             {% endif %}
  32.             <td>{{ weather.location }}</td>
  33.             <td data-sort="{{ weather.date|date('Y-m-d H') }} . {{ weather.time }}">
  34.                 <a target="_blank"
  35.                    href="{{ path('weather_edit', {id: weather.id}) }}"> {{ weather.date ? weather.date|date('d-M-Y') : '' }}</a>
  36.             </td>
  37.             <td data-sort="{{ weather.time }}" style="text-align: right">{{ weather.time }}:00h</td>
  38.             <td style="text-align: left">
  39.                 {% if weather.rain is not empty %}
  40.                     <i class="fas fa-cloud-rain"
  41.                        style="color: blue"> </i>  {{ weather.rain |number_format(2, '.', ',') }}mm/hr
  42.                 {% else %}
  43.                     <i class="fa fa-sun-o" style="color: orange"></i>
  44.                 {% endif %}
  45.             </td>
  46.             <td></td>
  47.             <td style="text-align: right">
  48.                 {{ weather.weather|number_format(0, '.', ',') }} °C
  49.             </td>
  50.             </tr>
  51.         {% endfor %}
  52.         </tbody>
  53.     </table>
  54.     <a class="btn btn-success btn-sm" href="{{ path('weather_new') }}">New</a>
  55. {% endblock %}
  56. {% block datatable %}
  57.     <script>
  58.         $(document).ready(function () {
  59.             $('.table').DataTable({
  60.                 'pageLength': 100,
  61.                 "order": [[1, 'asc']],
  62.                 "paging": false,
  63.                 "searching": false,
  64.                 "bInfo": false
  65.             });
  66.         });
  67.     </script>
  68. {% endblock datatable %}