{% extends "qommon/forms/widgets/map.html" %}
{% load qommon l10n static %}

{% block widget-title %}
{% endblock %}

{% block widget-content %}
  {% if form %}
    <input type="hidden" name="{{widget.name}}$latlng">
    <div id="map-{{widget.name}}" class="qommon-map nearby-forms--map"
      data-readonly="true"
      {% for key, value in widget.map_attributes.items %}{{key}}="{{value}}" {% endfor %}
      {% localize off %}
        data-init-lat="{{ global_context.form_var_carte_lat }}"
        data-init-lng="{{ global_context.form_var_carte_lon }}"
      {% endlocalize %}
    ></div>
    {% block list-header %}
      <h3>Si votre signalement figure dans la liste ci-dessous, cliquez sur le
        bouton +1. Dans le cas contraire, poursuivez votre demande.
      </h3>
    {% endblock %}
    <ul class="nearby-forms">
      {% with distance=global_context.form_option_distance|default:100|add:50 %}
        {% block demands %}
          {% with demands=form.objects.pending|distance_filter:distance %}
            {% include "qommon/forms/widgets/includes/nearby-demands.html" %}
          {% endwith %}
        {% endblock %}
      {% endwith %}
    </ul>
    <script src="{% static 'xstatic/jquery-ui.js' %}"></script>
    <script src="{% static 'js/plus1.js' %}"></script>
  {% else %} {# no form, this is the admin preview #}
    <div class="infonotice">
      {% block preview-impossible %}
        Signalements à proximité, prévisualisation impossible.
      {% endblock %}
    </div>
  {% endif %}

{% endblock %}

