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

      <div class="place-data">
      <div class="adresse">
        <h3>Adresse</h3>
        <div>
        {% if mdr.properties.adresse_complement %}{{mdr.properties.adresse_complement}}<br>{% endif %}
        {{mdr.properties.adresse}}<br>
        {{mdr.properties.code_postal}} {{mdr.properties.ville}}
        </div>
        {% localize off %}
        <a class="action-goto" data-lat="{{mdr.geometry.coordinates.1}}" data-lng="{{mdr.geometry.coordinates.0}}" href="/m-y-rendre/?to={{cell.id}}">M’y rendre</a>
        {% endlocalize %}
      </div> <!-- adresse -->
      {% if mdr.properties.telephone %}
      <div class="phone">
        <h3>Téléphone</h3>
        <div>{{mdr.properties.telephone}}</div>
        <a class="action-call" href="tel:{{mdr.properties.telephone}}">Appeler</a>
      </div> <!-- phone -->
      {% endif %}
      <div class="horaires">
        <h3>Horaires</h3>
        {{mdr.properties|as_opening_hours_badge}}
        <table class="horaires">
          <tr><th>lundi</th><td>{{mdr.properties.lundi_am}}</td><td>{{mdr.properties.lundi_pm}}</td></tr>
          <tr><th>mardi</th><td>{{mdr.properties.mardi_am}}</td><td>{{mdr.properties.mardi_pm}}</td></tr>
          <tr><th>mercredi</th><td>{{mdr.properties.mercredi_am}}</td><td>{{mdr.properties.mercredi_pm}}</td></tr>
          <tr><th>jeudi</th><td>{{mdr.properties.jeudi_am}}</td><td>{{mdr.properties.jeudi_pm}}</td></tr>
          <tr><th>vendredi</th><td>{{mdr.properties.vendredi_am}}</td><td>{{mdr.properties.vendredi_pm}}</td></tr>
        </table>
      </div> <!-- adresse -->
      </div> <!-- place-data -->

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

      {% placeholder "galerie" %}

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