{% extends 'bulma.html.twig' %}

{% block title %}Administration > Événement > Éditer{% endblock %}

{% block content %}

    {{ form_errors(form) }}
    {{ form_start(form) }}

    {{ form_row(form.name) }}
    <div class="box">
        <div class="columns">
            <div class="column">{{ form_row(form.startOn) }}</div>
            <div class="column">{{ form_row(form.endOn) }}</div>
        </div>
        <div class="columns">
            <div class="column">
                <div class="field">
                    {{ form_widget(form.private) }}
                    {{ form_label(form.private) }}
                    {{ form_help(form.private) }}
                </div>
            </div>
            <div class="column">
                <div class="field">
                    {{ form_widget(form.hiddenPlanning) }}
                    {{ form_label(form.hiddenPlanning) }}
                    {{ form_help(form.hiddenPlanning) }}
                </div>
            </div>
            <div class="column">
                <div class="field">
                    {{ form_widget(form.everyoneCanAskForGame) }}
                    {{ form_label(form.everyoneCanAskForGame) }}
                    {{ form_help(form.everyoneCanAskForGame) }}
                </div>
            </div>
        </div>
    </div>
    {{ form_row(form.slug) }}
    {{ form_row(form.description)}}

    {# gestion de l'illustration #}
    <div class="box">
    <div class="field">
        <div class="columns">
            <div class="column">
                {{ form_label(form.picture) }}
                <div class="file has-name is-fullwidth" id="file-js"  {{ stimulus_controller('bulma-filenames') }}>
                <label class="file-label" >
                    {{ form_widget(form.picture) }}
                    <span class="file-cta">
                    <span class="file-icon">
                        <twig:ux:icon name="bi:cloud-upload" />
                    </span>
                    <span class="file-label"> Choisissez un fichier… </span>
                    </span>
                    <span class="file-name"> aucun fichier </span>
                </label>
                </div>
                {{ form_help(form.picture) }}
                {% if event.picture %}
                <div class="field mt-2">
                <p><a href="#" data-id="{{ path('app_admin_event_del_pic', {id: event.id}) }}" class="button is-danger" {{ stimulus_controller('admin_confirm') }}><twig:ux:icon name="bi:trash-fill" class="small-icon-in-text"/> Supprimer l'image chargée.</a></p>
                </div>
                {% endif %}
                

            </div>
            <div class="column">
                {% if event.picture %}
                <img src="/images/events/{{ event.picture }}" class="image is-3by1"/>
                {% endif %}
            </div>
        </div>
    </div>
    </div>

                {{ form_widget(form) }}






    <div class="control">
        <button class="button is-primary" type="submit">Envoyer</button>
        <a href="{{ path('app_admin_event') }}" class="button">Annuler</a>
    </div>

    {{ form_end(form) }}

{% endblock %}
