{% load combo gnm l10n assets %}
{% with mairie=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 mairie {% if is_place_page %}is-place{% endif %}" data-place-type="mairie" 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:mairie" size=size crop="center" %})"></div>
  {% else %}
  <div class="tile-picture" style="background-image: url({% asset_url place_page.picture "picture:mairie" size=size crop="center" %})"></div>
  {% endif %}
      <div class="tile-head">
        <div class="tile-title">
          <h2>{{mairie.properties.nom}}</h2>
          {% with producer=mairie.properties.address.addressLocality|as_producer %}
          <span class="producer" style="background-image: url({% asset_url "logo:"|add:producer.slug %})">{{ producer.label }}</span>
          {% 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=mairie url=cell|place_page_url %}
        {% placeholder "infos-pratiques" %}

  {% with commune_data=page.slug|as_commune %}
    {% if commune_data.gnm %}
    <a id="collectivity-services" href="{{ commune_data.url }}">Accéder à tous les services de la commune</a>
    {% endif %}
  {% endwith %}

      </div>

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

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

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

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

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

      {% placeholder "galerie" %}

      </div> <!-- tile-content -->
      {% else %}
      <div class="tile-content">
        {{mairie.properties|as_opening_hours_badge}}
      </div>
      <div class="tile-actions">
        {% localize off %}
        <a class="action-goto" data-lat="{{mairie.geometry.coordinates.1}}" data-lng="{{mairie.geometry.coordinates.0}}" href="/m-y-rendre/?to={{cell.id}}">M’y rendre</a>
        {% endlocalize %}
        {% if mairie.properties.telephone %}
        <a class="action-call" href="tel:{{mairie.properties.telephone}}">Appeler</a>
        {% endif %}
        <a class="action-more-info" href="{{cell|place_page_url}}">d’infos</a>
      </div>
      {% endif %}
    </div>
{% endwith %}
