<commit_before>{% extends 'base.html.twig' %}

{% block title %}{{ activity.name }}{% endblock %}

{% block breadcrumbs %}
<nav class="breadcrumb">
    <a class="breadcrumb-item" href="/">Home</a>
    <a class="breadcrumb-item" href="{{ path('activity_index') }}">Activities</a>
    <span class="breadcrumb-item active">{{ activity.name }}</span>
</nav>
{% endblock %}

{% block body %}
    <h2>{{ activity.name }}</h2>

    <div class="col-sm-8">
        <div class="card">
            <h4 class="card-header">Summary</h4>
            <div class="card-block">
                <ul>
                    <li><strong>Start</strong> {{ activity.activityStart|date('d M Y H:i')}}</li>
                    <li><strong>End</strong> {{ activity.activityEnd|date('d M Y H:i')}}</li>
                    <li><strong>Places</strong> {{ activity.people}} / {{ activity.getSpaces }}</li>
                </ul>
            </div>
        </div>

        <div class="card">
            <h4 class="card-header">Description</h4>
            <div class="card-block">
                {{ activity.description|markdown }}
            </div>
        </div>

        <div class="card">
            <h4 class="card-header">Weather</h4>
            <div class="card-block" style="height: 170px; overflow-y: scroll;">
                <table class="table">
                    {% for dataPoint in activity.weatherDataPoints %}
                        <tr>
                            <td class="h2">{{ dataPoint.time|date('H:i', dataPoint.timeZone) }}</td>
                            <td>
                                <i class="wi wi-forecast-io-{{dataPoint.icon}} h2"></i>
                                {% if dataPoint.precipitationIntensity > 0 %}
                                    <sub>{{ dataPoint.precipitationIntensity }} mm/h</sub>
                                {% endif %}
                            </td>
                            <td>
                                <i class="wi wi-thermometer h2"></i>
                                <span class="h2">{{ dataPoint.temperature|number_format(1) }}</span>
                                <sup>°C</sup>
                            </td>
                            <td>
                                <i class="wi wi-wind from-{{dataPoint.windBearing}}-deg h2" title="{{dataPoint.windBearing}}°"></i>
                                <span class="h2">{{ dataPoint.windSpeed|number_format(1) }}</span>
                                <sup>km/h</sup>
                            </td>
                        </tr>
                    {% endfor %}
                </table>

            </div>
        </div>
    </div>

    <div class="col-sm-4">
        <div class="card">
            <h4 class="card-header">Map</h4>
            <div id="map" style="width: 100%; height: 300px;"></div>
        </div>
    </div>

{% endblock %}

{% block stylesheets %}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/weather-icons/2.0.9/css/weather-icons.min.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/weather-icons/2.0.9/css/weather-icons-wind.min.css" />
{% endblock %}


{% block javascripts %}
    <script src="https://maps.googleapis.com/maps/api/js?key={{ google_maps_key }}&callback=initMap" async defer></script>
    <script>
      var map;
      function initMap() {
        map = new google.maps.Map(document.getElementById('map'));

        var startPos = {lat: {{activity.startLocation.latitude}}, lng: {{ activity.startLocation.longitude}}};
        var endPos = {lat: {{activity.endLocation.latitude}}, lng: {{ activity.endLocation.longitude}}};

        var start = new google.maps.Marker({
          position: startPos,
          map: map,
          title: 'Start'
        });

        var end = new google.maps.Marker({
          position: endPos,
          map: map,
          title: 'End'
        });

        var bounds = new google.maps.LatLngBounds();
        bounds.extend(startPos)
        bounds.extend(endPos);
        map.fitBounds(bounds);

        google.maps.event.addListenerOnce(map, 'bounds_changed', function(event) {
          if (map.getZoom() > 15) {
            map.setZoom(15);
          }
        });

      }
    </script>
{% endblock %}<commit_msg>Added places count Hide map when no start loaction set<commit_after>{% extends 'base.html.twig' %}

{% block title %}{{ activity.name }}{% endblock %}

{% block breadcrumbs %}
<nav class="breadcrumb">
    <a class="breadcrumb-item" href="/">Home</a>
    <a class="breadcrumb-item" href="{{ path('activity_index') }}">Activities</a>
    <span class="breadcrumb-item active">{{ activity.name }}</span>
</nav>
{% endblock %}

{% block body %}
    <h2>{{ activity.name }}</h2>

    <div class="col-sm-8">
        <div class="card">
            <h4 class="card-header">Summary</h4>
            <div class="card-block">
                <ul>
                    <li><strong>Start</strong> {{ activity.activityStart|date('d M Y H:i')}}</li>
                    <li><strong>End</strong> {{ activity.activityEnd|date('d M Y H:i')}}</li>
                </ul>
            </div>
        </div>

        <div class="card">
            <h4 class="card-header">Description</h4>
            <div class="card-block">
                {{ activity.description|markdown }}
            </div>
        </div>

        <div class="card">
            <h4 class="card-header">Weather</h4>
            <div class="card-block" style="height: 170px; overflow-y: scroll;">
                <table class="table">
                    {% for dataPoint in activity.weatherDataPoints %}
                        <tr>
                            <td class="h2">{{ dataPoint.time|date('H:i', dataPoint.timeZone) }}</td>
                            <td>
                                <i class="wi wi-forecast-io-{{dataPoint.icon}} h2"></i>
                                {% if dataPoint.precipitationIntensity > 0 %}
                                    <sub>{{ dataPoint.precipitationIntensity }} mm/h</sub>
                                {% endif %}
                            </td>
                            <td>
                                <i class="wi wi-thermometer h2"></i>
                                <span class="h2">{{ dataPoint.temperature|number_format(1) }}</span>
                                <sup>°C</sup>
                            </td>
                            <td>
                                <i class="wi wi-wind from-{{dataPoint.windBearing}}-deg h2" title="{{dataPoint.windBearing}}°"></i>
                                <span class="h2">{{ dataPoint.windSpeed|number_format(1) }}</span>
                                <sup>km/h</sup>
                            </td>
                        </tr>
                    {% endfor %}
                </table>

            </div>
        </div>
    </div>

    <div class="col-sm-4">

        <div class="card">
            <h4 class="card-header">Actions</h4>
            <div class="card-block">
                <strong>Places</strong> {{ activity.people}} / {{ activity.getSpaces }}

                {% if ((activity.people / activity.spaces) * 100 ) == 100 %}
                    <progress class="progress progress-danger" value="{{ activity.people }}" max="{{ activity.spaces }}"></progress>
                {% elseif ((activity.people / activity.spaces) * 100 ) > 80 %}
                    <progress class="progress progress-warning" value="{{ activity.people }}" max="{{ activity.spaces }}"></progress>
                {% else %}
                    <progress class="progress" value="{{ activity.people }}" max="{{ activity.spaces }}"></progress>
                {% endif %}

                <a href="#" class="btn btn-sm btn-primary">Sign Up</a>
            </div>
        </div>

        {% if activity.startLocation %}
        <div class="card">
            <h4 class="card-header">Map</h4>
            <div id="map" style="width: 100%; height: 300px;"></div>
        </div>
        {% endif %}
    </div>

{% endblock %}

{% block stylesheets %}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/weather-icons/2.0.9/css/weather-icons.min.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/weather-icons/2.0.9/css/weather-icons-wind.min.css" />
{% endblock %}


{% block javascripts %}
    <script src="https://maps.googleapis.com/maps/api/js?key={{ google_maps_key }}&callback=initMap" async defer></script>

    {% if activity.startLocation %}
        <script>
          var map;
          function initMap() {
            map = new google.maps.Map(document.getElementById('map'));

            var startPos = {lat: {{activity.startLocation.latitude}}, lng: {{ activity.startLocation.longitude}}};
            var endPos = {lat: {{activity.endLocation.latitude}}, lng: {{ activity.endLocation.longitude}}};

            var start = new google.maps.Marker({
              position: startPos,
              map: map,
              title: 'Start'
            });

            var end = new google.maps.Marker({
              position: endPos,
              map: map,
              title: 'End'
            });

            var bounds = new google.maps.LatLngBounds();
            bounds.extend(startPos)
            bounds.extend(endPos);
            map.fitBounds(bounds);

            google.maps.event.addListenerOnce(map, 'bounds_changed', function(event) {
              if (map.getZoom() > 15) {
                map.setZoom(15);
              }
            });

          }
        </script>
    {% endif %}
{% endblock %}
{'fraction_non_alphanumeric': 0.16590341382181514, 'fraction_numerical': 0.009679433805162365, 'mean_word_length': 1.5671920919048892, 'pattern_counts': {'":': 0, '<': 187, '<?xml version=': 0, '>': 192, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3095657', 'n_tokens_mistral': 2927, 'n_tokens_neox': 2676, 'n_words': 501}