{% load combo gnm l10n assets %}
{% with commerce=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 {{cell.key}} {% if is_place_page %}is-place{% endif %}" data-place-type="{{cell.key}}" data-tile-cache="300">
  {% if is_place_page %}
  {% placeholder "infos-pratiques" name="Infos pratiques" render=False %}
  {% placeholder "galerie" name="Galerie photos" render=False %}
  <div class="tile-picture" style="background-image: url({% asset_url place_page.picture "picture:banner:"|add:cell.key size=size crop="center" %})"></div>
  {% else %}
  <div class="tile-picture" style="background-image: url({% asset_url place_page.picture "picture:"|add:cell.key size=size crop="center" %})"></div>
  {% endif %}
      <div class="tile-head">
        <div class="tile-title">
          <h2>{{commerce.properties.nom}}<br><span class="subtitle">{{commerce.properties.categorie}}</span></h2>
          <span class="producer" style="background-image: url({% asset_url "logo:toodego" %})">Grand Lyon</span>
        </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=commerce url=cell|place_page_url %}
        {% placeholder "infos-pratiques" %}
      </div>

      <div class="place-data">
      {% include "combo/json/includes/adresse.html" with place=commerce %}

      {% if commerce.properties.telephone %}
      <div class="phone">
        <h3>Téléphone</h3>
        <div>{{commerce.properties.telephone}}</div>
        <a class="action-call" href="tel:{{commerce.properties.telephone}}">Appeler</a>
      </div>
      {% endif %}

      {% include "combo/json/includes/horaires.html" with place=commerce %}

      </div> <!-- place-data -->

      {% gnm_place_map commerce.geometry.coordinates.1 commerce.geometry.coordinates.0 %}

      {% placeholder "galerie" %}

      </div> <!-- tile-content -->
      {% else %}
      <div class="tile-content">
        {% if commerce.properties.openinghoursspecification or commerce.properties.openinghours %}
        {{commerce.properties|as_opening_hours_badge}}
        {% endif %}
        <p>{% for service in commerce.properties.services_proposes %}
        <span class="commerce-service-{{service}}">
        {% if service == "livraison-a-domicile" %}Livraison domicile
        {% elif service == "point-de-retrait" %}Livraison en point de retrait
        {% elif service == "clic-and-collect" %}Cliquez et retirer sur le lieu du commerce (Clic and Collect)
        {% elif service == "call-and-collect" %} Appelez et retirer sur le lieu du commerce (Call and Collect)
        {% endif %}
        </span>
        {% if not forloop.last %}<br>{% endif %}
        {%endfor %}</p>
      </div>
      <div class="tile-actions">
        {% localize off %}
        <a class="action-goto" data-lat="{{commerce.geometry.coordinates.1}}" data-lng="{{commerce.geometry.coordinates.0}}" href="/m-y-rendre/?to={{cell.id}}">M’y rendre</a>
        {% endlocalize %}
        {% if commerce.properties.telephone %}
        <a class="action-call" href="tel:{{commerce.properties.telephone}}">Appeler</a>
        {% endif %}
        <a class="action-more-info" href="{{cell|place_page_url}}">d’infos</a>
      </div>
      {% endif %}
    </div>
{% endwith %}
