{% extends "agenda_culturel/page.html" %}
{% load static %}


{% block title %}{% block og_title %}Ajouter un lieu à {{ object.title }}{% endblock %}{% endblock %}

{% load cat_extra %}

{% block entete_header %}

<script src="{% static 'choicejs/choices.min.js' %}"></script>

    {% css_categories %}
<script src="{% url 'jsi18n' %}"></script>
<script src="/static/admin/js/vendor/jquery/jquery.js"></script>
<script src="/static/admin/js/jquery.init.js"></script>
<script src="/static/admin/js/admin/DateTimeShortcuts.js"></script>
<script src="{% static 'recurrence/js/recurrence.js' %}"></script>
<script src="/static/admin/js/admin/RelatedObjectLookups.js"></script>


<script>window.CKEDITOR_BASEPATH = '/static/ckeditor/ckeditor/';</script>
<link href="{% static 'css/django_better_admin_arrayfield.min.css' %}" type="text/css" media="all" rel="stylesheet">
<script src="{% static 'js/django_better_admin_arrayfield.min.js' %}"></script>
<script src="{% static 'js/adjust_datetimes.js' %}"></script>

{% endblock %}

{% block fluid %}{% endblock %}

{% block content %}

{% load static_content_extra %}

<article>
    <header>
        <h1>Ajouter un lieu à {{ object.title }} ({{ object.start_day }})</h1>
    </header>

    <p>Si le lieu est disponible dans la liste déroulante, sélectionne-le. S'il n'est pas disponible, utilise
        l'entrée <em>créer un lieu manquant</em> puis <em>valide</em>, tu trouveras sur la page suivante le formulaire
        de saisie de ce nouveau lieu.</p>
    <form method="post">{% csrf_token %}
        {{ form.media }}
        {{ form.as_p }}
        <div class="grid buttons">
            <a href="{% if request.META.HTTP_REFERER %}{{ request.META.HTTP_REFERER }}{% else %}{{ object.get_absolute_url }}{% endif %}" role="button" class="secondary">Annuler</a>
            <input type="submit" value="Valider">
        </div>
    </form>
    <h2>Description du lieu&nbsp;:</h2>
    {% include "agenda_culturel/single-event/event-single-inc.html" with event=object noedit=1 %}
</article>
<script>
    const element = document.querySelector('#id_place');
    const choices = new Choices(element, {searchResultLimit: 10});

    document.querySelector(".choices__inner").classList.add("contrast");
    document.querySelector(".choices__inner").classList.add("outline");
    document.querySelector(".choices__inner").setAttribute("role", "button");

</script>

{% endblock %}