{% load combo gnm l10n assets %}
{% with autopartage=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 autopartage {% if is_place_page %}is-place{% endif %}" data-place-type="autopartage" data-tile-cache="600">
  {% 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:autopartage" size=size crop="center" %})"></div>
  {% else %}
  <div class="tile-picture" style="background-image: url({% asset_url place_page.picture "picture:autopartage" size=size crop="center" %})"></div>
  {% endif %}
      <div class="tile-head">
        <div class="tile-title">
          <h2>Station {{autopartage.properties.typeautopartage}} {{autopartage.properties.adresse|cut:'LPA'}} </h2>
          {% with autopartage.properties.typeautopartage|slugify as autopartage_type %}
            {% with "logo:"|add:autopartage_type as asset_name %}
              <span class="producer" style="background-image: url({% asset_url asset_name %}">{{ autopartage.properties.typeautopartage }}</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=autopartage url=cell|place_page_url %}
            {% placeholder "infos-pratiques" %}
          </div>
          <div class="place-data">
            <div class="adresse">
            {% localize off %}
            <a class="action-goto" data-lat="{{autopartage.geometry.coordinates.1}}" data-lng="{{autopartage.geometry.coordinates.0}}" href="/m-y-rendre/?to={{cell.id}}">M’y rendre</a>
            {% endlocalize %}
          </div> <!-- adresse -->
          </div> <!-- place-data -->
          {% gnm_place_map autopartage.geometry.coordinates.1 autopartage.geometry.coordinates.0 %}
          </div> <!-- tile-content -->
      {% else %}
          <div class="tile-content">
            {{autopartage.properties.commune}}
            <p>
            {% if autopartage.properties.nbemplacements != '' %}<b>{{autopartage.properties.nbemplacements}} emplacement{{autopartage.properties.nbemplacements|pluralize}}</b>{% endif %}
            {% if autopartage.properties.localisation != '' %}<br />{{autopartage.properties.localisation|lower}}{% endif %}
            {% if autopartage.properties.typeautopartage != '' %}<br />Type {{autopartage.properties.typeautopartage}}{% endif %}
            </p>
          </div>
          <div class="tile-actions">
            {% localize off %}
            <a class="action-goto" data-lat="{{autopartage.geometry.coordinates.1}}" data-lng="{{autopartage.geometry.coordinates.0}}" href="/m-y-rendre/?to={{cell.id}}">M’y rendre</a>
            {% endlocalize %}
            {# <a class="action-more-info" href="{{cell|place_page_url}}">d’infos</a> #}
          </div>
      {% endif %}
    </div>
{% endwith %}
