{% load combo gnm l10n assets %}
{% with parking=json.features.0 is_place_page=page|is_place_page place_page=cell|place_page %}
  {% get_tile_picture_size page as size %}
  <div class="tile parking {% if is_place_page %}is-place{% endif %}" data-place-type="parking" data-tile-cache="30">
  {% if is_place_page %}
  {% placeholder "infos-pratiques" name="Infos pratiques" render=False %}
  <div class="tile-picture" style="background-image: url({% asset_url place_page.picture "picture:banner:parking" size=size crop="center" %})"></div>
  {% else %}
  <div class="tile-picture" style="background-image: url({% asset_url place_page.picture "picture:parkingtr" size=size crop="center" %})"></div>
  {% endif %}
      <div class="tile-head">
        <div class="tile-title">
          <h2>{{parking.properties.nom}}</h2>
		  {% with parking.properties.gestionnaire|slugify as gestionnaire_name %}
            {% with "logo:"|add:gestionnaire_name as asset_name %}
              <span class="producer" style="background-image: url({% asset_url asset_name %})">{{parking.properties.gestionnaire}}</span>
            {% endwith %}
          {% endwith %}
        </div>
      </div>
      {% include "combo/dashboard_cell_icons.html" %}
      {% if is_place_page %}
      <div class="tile-content">
      <div class="place-info">
        {% include "combo/json/includes/share.html" with place=parking url=cell|place_page_url %}
        {% placeholder "infos-pratiques" %}
        {% if parking.properties.capacitevoiture != '' %}<br /><b>{{parking.properties.capacitevoiture}}</b> place{{parking.properties.capacitevoiture|pluralize}} voiture{% endif %}
        {% if parking.properties.capacitepmr != '' %}<br /><b>{{parking.properties.capacitepmr}}</b> place{{parking.properties.capacitepmr|pluralize}} PMR{% endif %}
        {% if parking.properties.capacitevelo != '0' %}<br /><b>{{parking.properties.capacitevelo}}</b> place{{parking.properties.capacitevelo|pluralize}} vélo{% endif %}
        {% if parking.properties.capacitemoto != '' %}<br /><b>{{parking.properties.capacitemoto}}</b> place{{parking.properties.capacitemoto|pluralize}} moto{% endif %}
        {% if parking.properties.capaciteautopartage != '' %}<br /><b>{{parking.properties.capaciteautopartage}}</b> place{{parking.properties.capaciteautopartage|pluralize}} autopartage{% endif %}
        <br />
      </div>
      <div class="place-data">
      <div class="adresse">
        <h5>Adresse</h5>
        {% localize off %}
        <a class="action-goto" data-lat="{{parking.geometry.coordinates.1}}" data-lng="{{parking.geometry.coordinates.0}}" href="/m-y-rendre/?to={{cell.id}}">M’y rendre</a>
        {% endlocalize %}
      </div> <!-- adresse -->
      </div> <!-- place-data -->
      {% gnm_place_map parking.geometry.coordinates.1 parking.geometry.coordinates.0 %}
      </div> <!-- tile-content -->
      {% else %}
      <div class="tile-content">
        <br /><p class="available car-park"> <b>{% if parking.properties.capacitevoiture != '' %}{{parking.properties.capacitevoiture}}</b> place{{parking.properties.capacitevoiture|pluralize}} voiture{% endif %}{% if parking.properties.etat != '' and parking.properties.etat != 'DONNEES INDISPONIBLES' %}, <b><span class="badge {% if 'libre' in parking.properties.etat %}open{% elif 'complet' in parking.properties.etat %}closed{% endif %}">{{parking.properties.etat|lower|cut:"parking "}}</span></b>{% endif %}</p>
        {% if parking.properties.capacitepmr != '' %}<p class="available pmr-park"> <b>{{parking.properties.capacitepmr}}</b> place{{parking.properties.capacitepmr|pluralize}} PMR</p>{% endif %}
        {% if parking.properties.capacitevelo != '0' %}<p class="available bike-park"> <b>{{parking.properties.capacitevelo}}</b> place{{parking.properties.capacitevelo|pluralize}} vélo</p>{% endif %}
        {% if parking.properties.capacitemoto != '' %}<p class="available motorcycle-park"> <b>{{parking.properties.capacitemoto}}</b> place{{parking.properties.capacitemoto|pluralize}} moto</p>{% endif %}
        {% if parking.properties.capaciteautopartage != '' %}<p class="available autopartage"> <b>{{parking.properties.capaciteautopartage}}</b> place{{parking.properties.capaciteautopartage|pluralize}} autopartage</p>{% endif %}
      </div>
      <div class="tile-actions">
        {% localize off %}
        <a class="action-goto" data-lat="{{parking.geometry.coordinates.1}}" data-lng="{{parking.geometry.coordinates.0}}" href="/m-y-rendre/?to={{cell.id}}">M’y rendre</a>
        {% endlocalize %}
      </div>
      {% endif %}
    </div>
{% endwith %}
