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

{% block pagewrapper %}
{{ form_start(form) }}
    <h1 class="page-title">
    {% if mode=="update" %}
    Modification Annonces = {{alert.title}}
    {% elseif mode=="submit" %}
    Création Annonces
    {% endif %}
    </h1>

    <p>
        {{ form_widget(form.submit) }}
        <a class="btn btn-secondary" href={{ path('app_portal_config_alert') }}>Annuler</a>

        {% if mode=="update" %}
        <a href={{ path('app_portal_config_alert_delete',{'id':alert.id}) }}
            class="btn btn-danger float-end"
            data-method="delete" data-csrf="_token:{{ 'csrf' }}"
            data-confirm="Êtes-vous sûr de vouloir supprimer cette annonce ?">
            Supprimer
        </a>
        {% endif %}
    </p>

    {% if app.session.flashbag.has('error') %}
        <div class='alert alert-danger' style='margin: 5px 0px'>
            <strong>Erreur</strong><br>
            {% for flashMessage in app.session.flashbag.get('error') %}
                {{ flashMessage }}<br>
            {% endfor %}
        </div>
    {% endif %}

    {% if app.session.flashbag.has('notice') %}
        <div class='alert alert-info' style='margin: 5px 0px'>
            <strong>Information</strong><br>
            {% for flashMessage in app.session.flashbag.get('notice') %}
                {{ flashMessage }}<br>
            {% endfor %}
        </div>
    {% endif %}


    <div class="form-group row clearfix">      
        <div class="col-md-8">
            <div class="card">
                <div class="card-header"><i class="fa fa-pencil-alt fa-fw"></i>Informations</div>
                <div class="card-body">               
                    {{ form_row(form.title) }}
                    {{ form_row(form.fghideable) }}
                    {{ form_row(form.publishedat) }}
                    {{ form_row(form.unpublishedat) }}        
                </div>
            </div>
        </div>

        <div class="col-md-4">
            <div class="card">
                <div class="card-header"><i class="fa fa-pencil-alt fa-fw"></i>Détails</div>
                <div class="card-body">            
                    {{ form_row(form.alertcategory) }}
                    {{ form_row(form.roles) }}
                    {{ form_row(form.niveau01s) }}
                    {{ form_row(form.groups) }}
                    {{ form_row(form.items) }}                    
                </div>
            </div>
        </div>

        <div class="col-md-12">
            <div class="card">
                <div class="card-header"><i class="fa fa-pencil-alt fa-fw"></i>Editeur</div>
                <div class="card-body">
                    {{ form_widget(form.content) }}                    
                </div>
            </div>
        </div>
    </div>
{{ form_end(form) }}
{% endblock %}

{% block localjavascript %}
{% endblock %}
