{% load combo gnm l10n assets %}
{% with decheterie=json.features.0 is_place_page=page|is_place_page place_page=cell|place_page %}
  <div class="tile decheterie {% if is_place_page %}is-place{% endif %}" data-place-type="decheterie"
          data-keywords="decheterie dechetterie" data-tile-cache="300">
  {% get_tile_picture_size page as size %}
  {% 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:decheterie" size=size crop="center" %})"></div>
  {% else %}
  <div class="tile-picture" style="background-image: url({% asset_url place_page.picture "picture:decheterie" size=size crop="center" %})"></div>
  {% endif %}
      <div class="tile-head">
        <div class="tile-title">
          <h2>Déchèterie {{decheterie.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=decheterie url=cell|place_page_url %}
        {% placeholder "infos-pratiques" %}

        <h3>Déchets acceptés</h3>

        <ul class="allowed-waste">
        {% for waste in decheterie.properties.allowed_waste %}
        <li>{{ waste|get:"schema:category" }}</li>
        {% endfor %}
        </ul>

        <h3>Véhicules autorisés</h3>
        <table class="allowed-vehicles">
        <thead>
         <tr><th>Type de véhicule</th><th>Coût</th><th>Passages par mois</th></tr>
        </thead>
        <tbody>
        {% for vehicle in decheterie.properties.allowed_vehicles %}
        <tr>
                <td>{{ vehicle|get:"schema:category" }}</td>
                <td>{% if vehicle.pricePerDropoff|get:"schema:value" == 0 %}Gratuit
                        {% else %}{{ vehicle.pricePerDropoff|get:"schema:value" }}€{% endif %}</td>
                <td>{% if not vehicle.monthlyAllowedDropoffs %}Illimité{% else %}
                        {{ vehicle.monthlyAllowedDropoffs|get:"schema:maxValue" }} passages{% endif %}</td>
        </tr>
        {% endfor %}
        </tbody>
        </table>
      </div>

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

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

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

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

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

      {% placeholder "galerie" %}

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