templates/debug/hobit.html.twig line 1

Open in your IDE?
  1. {% extends 'base.html.twig' %}
  2. {% block body %}
  3.     <div class="page">
  4.         <div class="container">
  5.             <div class="row animated fadeIn delay-0-2s">
  6.                 <div class="col-12 mb-3 mb-lg-5">
  7.                     <div class="">
  8.                         <h2>Magic hobit</h2>
  9.                     </div>
  10.                     <div class="">
  11.                         {% if debugAndFlush %}
  12.                             <p>Debug and flush : Yes</p>
  13.                         {% else %}
  14.                             <p>Debug and flush : No</p>
  15.                         {% endif %}
  16.                     </div>
  17.                     <hr></hr>
  18.                 </div>
  19.             </div>
  20.         </div>
  21.         {% if tabHobit %}
  22.             {% if debugAndFlush %}
  23.                 <div class="container">
  24.                     <div class="row">
  25.                         {% set i = 3 %}
  26.                         {% set number = 1 %}
  27.                         {% for hobit in tabHobit %}
  28.                             <div class="col-12 col-lg-4 mb-3 mb-lg-5">
  29.                                 <div class="card animated fadeIn delay-0-{{ i }}s" style="width: 100%;">
  30.                                     <div class="card-img-top animated fadeIn delay-0-8s" style='text-align:center;'><iframe
  31.                                             width='100%'
  32.                                             height='300'
  33.                                             frameborder='0' style='border:0'
  34.                                             src='https://www.google.com/maps/embed/v1/place?key=AIzaSyAmbx9RsGi01srCnH_-2TVdH26TpjwvFDs
  35.                                 &q={{ hobit['data'].latitude }},{{ hobit['data'].longitude }}' 
  36.                                             allowfullscreen>
  37.                                           </iframe>
  38.                                     </div>
  39.                                     <div class="card-body">
  40.                                         <h5 class="card-title">Hobit {{ number }}</h5>
  41.                                         <p class="card-text">Date start : {{ hobit['startDateTime']|date("d/m/Y H:i") }}</p>
  42.                                         <p class="card-text">Date end : {{ hobit['endDateTime']|date("d/m/Y H:i") }}</p>
  43.                                         <p class="card-text">Latitude : {{ hobit['data'].latitude }}</p>
  44.                                         <p class="card-text">Longitude : {{ hobit['data'].longitude }}</p>
  45.                                         <p class="card-text">Number : {{ hobit['number'] }}</p>
  46.                                     </div>
  47.                                 </div>
  48.                             </div>
  49.                             {% set i = i + 1 %}
  50.                             {% set number = number + 1 %}
  51.                         {% endfor %} 
  52.                     </div>
  53.                 </div>
  54.             {% else %}
  55.                 <div class="container">
  56.                     <div class="row">
  57.                         {% set number = 1 %}
  58.                         {% for hobit in tabHobit %}
  59.                             <div class="col-12 col-lg-6">
  60.                                 <div class="accordion" id="accordionExample">
  61.                                     <div class="accordion-item">
  62.                                         <div class="title">
  63.                                             {% if hobit['activityType'] == "still" %}
  64.                                                 <i class="fas fa-chair"></i>
  65.                                             {% elseif hobit['activityType'] == "on_foot" %}
  66.                                                 <i class="fas fa-walking"></i>
  67.                                             {% elseif hobit['activityType'] == "on_bicycle" %}
  68.                                                 <i class="fas fa-bicycle"></i>
  69.                                             {% elseif hobit['activityType'] == "in_vehicle" %}
  70.                                                 <i class="fas fa-car"></i>
  71.                                             {% endif %}
  72.                                             {{ hobit['activityType'] }}
  73.                                         </div>
  74.                                         {% if hobit["data"] is defined and hobit["data"].latitude and hobit["data"].longitude %}
  75.                                             <div>
  76.                                                 <iframe
  77.                                                     width='100%'
  78.                                                     height='300'
  79.                                                     frameborder='0' style='border:0'
  80.                                                     src='https://www.google.com/maps/embed/v1/place?key=AIzaSyAmbx9RsGi01srCnH_-2TVdH26TpjwvFDs
  81.                                                         &q={{ hobit["data"].latitude }},{{ hobit["data"].longitude }}' 
  82.                                                     allowfullscreen>
  83.                                                 </iframe>
  84.                                             </div>
  85.                                         {% else %}
  86.                                             <div data-positions='{{ hobit['positions']|json_encode()|raw }}' id="map-multi-{{ number }}" class="animated fadeIn delay-0-8s map-multi" style="width: 100%; height: 300px;"></div>
  87.                                         {% endif %}
  88.                                         <div>
  89.                                             <button class="accordion-button button black mt-3 mb-3" type="button" data-bs-toggle="collapse" data-bs-target="#tab-{{ number }}-main" aria-expanded="true" aria-controls="collapseOne">Open</button>
  90.                                         </div>
  91.                                         <div id="tab-{{ number }}-main" class="accordion-collapse collapse" aria-labelledby="tab-{{ number }}-main-label" data-bs-parent="#accordionExample">
  92.                                           <div class="accordion-body">
  93.                                             <div class="line"><strong>Start date time : </strong><code>{{ hobit['startDateTime']|date("d/m/Y H:i", "Europe/Paris") }}</code></div>
  94.                                             <div class="line"><strong>Start date time server : </strong><code>{{ hobit['startDateTimeServer']|date("d/m/Y H:i", "Europe/Paris") }}</code></div>
  95.                                             <div class="line"><strong>End date time hobbit : </strong><code>{{ hobit['endDateTime']|date("d/m/Y H:i", "Europe/Paris") }}</code></div> 
  96.                                 
  97.                                             <div class="line"><strong>Type activity : </strong><code>{{ dump(hobit['activityType']) }}</code></div>
  98.                                             {% if hobit['id'] is defined %}
  99.                                                 <div class="line"><strong>Id : </strong><code>{{ dump(hobit['id']) }}</code></div>
  100.                                             {% endif %}
  101.                                             <div class="line"><strong>Data : </strong><code>{{ dump(hobit) }}</code></div>
  102.                                           </div>
  103.                                         </div>
  104.                                     </div>
  105.                                     {% set number = number + 1 %}
  106.                             
  107.                                 </div>
  108.                             </div>
  109.                         {% endfor %}
  110.                     </div>
  111.                 </div>
  112.             {% endif %}
  113.         {% else %}
  114.             <div class="text-center animated fadeIn delay-0-4s" style="font-size: 30px;">No data...</div>
  115.         {% endif %}
  116.     </div>
  117. {% endblock %}
  118. {% block javascripts %}
  119.     {{ parent() }}
  120.     <script>
  121.         $(window).on('load', function() {
  122.         
  123.             $(".map-multi").each(function( index ) {
  124.                 console.log(JSON.parse($(this).attr("data-positions")));
  125.                 initMap($(this).attr("id"));
  126.             });
  127.             function initMap(idMap) {
  128.                 var positions = JSON.parse($("#" + idMap).attr("data-positions"));
  129.                 //var myLatlng = new google.maps.LatLng(-25.363882,131.044922);
  130.                 var mapOptions = {
  131.                   zoom: 16,
  132.                   center: new google.maps.LatLng(positions[0]['dataGps']['latitude'],positions[0]['dataGps']['longitude'])
  133.                 }
  134.                 var map = new google.maps.Map(document.getElementById(idMap), mapOptions);
  135.                 var markers = [];
  136.                 positions.forEach(function(element) {
  137.                     markers.push(new google.maps.Marker({
  138.                         position: new google.maps.LatLng(element['dataGps']['latitude'], element['dataGps']['longitude']),
  139.                         //title: element[2] + " - " + element[0] + " - " + element[1]
  140.                     }));
  141.                 });
  142.                 // To add the marker to the map, call setMap();
  143.                 //markers[0].setMap(map);
  144.                 //marker2.setMap(map);
  145.                 markers.forEach(function(element) {
  146.                     element.setMap(map);
  147.                 });
  148.             }
  149.         });
  150.     </script>
  151. {% endblock %}