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

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

    <p>
        {{ form_widget(form.submit) }}
        {% if access=="config" and mode=="submit" %}
            <a class="btn btn-secondary" href={{ path('app_portal_config_blog') }}>Annuler</a>
        {% else %}
            <a class="btn btn-secondary" href={{ path('app_portal_'~access~'_blog_view',{'id':entity.id}) }}>Annuler</a>
        {% endif %}


        {% if mode=="update" %}
        <a href={{ path('app_portal_config_blog_delete',{'id':entity.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">
        {% if form.roles is defined %}
        <div class="col-md-8">
        {% else %}
        <div class="col-md-12">
        {% endif %}
            <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.name) }}
                </div>
            </div>
        </div>

        {% if form.roles is defined %}
            <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.user) }}
                        {{ form_row(form.roles) }}
                        {{ form_row(form.groups) }}
                    </div>
                </div>
            </div>
        {% endif %}
    </div>

  
{{ form_end(form) }}
{% endblock %}

{% block localjavascript %}
{% endblock %}
