templates/weather/index.html.twig line 1

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