{% extends '@CadolesCore/base.html.twig' %}

{% block pagewrapper %}
{{ form_start(form) }}
    <h1 class="page-header">
    {% if mode=="update" %}
    Modification {{ labelniveau01 }} = {{niveau01.label}}
    {% elseif mode=="submit" %}
    Création {{ labelniveau01 }}
    {% elseif mode=="delete" %}
    Suppression {{ labelniveau01 }} = {{niveau01.label}}
    {% endif %}
    </h1>

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

    <br><br>

    {% 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="panel panel-primary">
        <div class="panel-heading">
            <i class="fa fa-pencil fa-fw"></i> Informations
        </div>

        <div class="panel-body">
            {{ form_row(form.label) }}
            <div class='alert alert-info' style='font-size: 80%;padding: 5px;margin-top: -10px;'>
                Caractères interdits = caractères spéciaux sauf ' @ . - _<br>
            </div>

            {{ form_row(form.siren) }}
            {{ form_row(form.showsubappname) }}
            {% if masteridentity=="LDAP" %}
                {{ form_row(form.ldapfilter) }}
            {% endif %}

            {% if masteridentity=="SSO" %}
                {{ form_row(form.attributes) }}
            {% endif %}            
        </div>
    </div>

    <div class="row">
        <div class="col-md-6">
            <div class="panel panel-primary">
                <div class="panel-heading">
                    <i class="fa fa-pencil fa-fw"></i> Logo
                </div>

                <div class="panel-body">    
                    <div style="width:150px; margin:10px auto;">
                    <img id="niveau01_logo_img" src="/{{ alias }}/{{ niveau01.logo }}" style="width:90px;height:auto;margin:auto;display:block;margin-bottom:5px;">
                    {{ form_widget(form.logo) }}
                    <a class="btn btn-info" style="width:150px" data-toggle="modal" data-target="#mymodal" onClick="ModalLoad('mymodal','Logo','{{ path('cadoles_core_config_niveau01_logo') }}');" title='Ajouter un Logo'>Modifier</a>
                    <a class="btn btn-danger" onClick="delLogo()" title='Détacher' style="width:100%">Détacher le Logo</a>
                    </div>
                </div>
            </div>
        </div>

        <div class="col-md-6">
            <div class="panel panel-primary">
                <div class="panel-heading">
                    <i class="fa fa-pencil fa-fw"></i> Style
                </div>

                <div class="panel-body">    
                    {{ form_row(form.colormain) }}
                    {{ form_row(form.fontcolorhover) }}
                    {{ form_row(form.colorbody) }}
                    {{ form_row(form.fontfacebody) }}
                    {{ form_row(form.fontfacetitle) }}
                </div>
            </div>
        </div>
    </div>

    <div class="panel panel-primary">
        <div class="panel-heading">
            <i class="fa fa-pencil fa-fw"></i> Bannière
        </div>

        <div class="panel-body">
            <div style="width:100%; margin:10px auto;">
            <img id="niveau01_header_img" src="/{{ alias }}/{{ niveau01.header }}" style="width:100%;height:auto;margin:auto;display:block;margin-bottom:5px;">
            {{ form_widget(form.header) }}
            <a class="btn btn-info" style="width:100%" data-toggle="modal" data-target="#mymodal" onClick="ModalLoad('mymodal','Bannière','{{ path('cadoles_core_config_niveau01_header') }}');" title='Ajouter une Bannière'>Modifier</a>
            <a class="btn btn-danger" onClick="delHeader()" title='Détacher' style="width:100%">Détacher la Bannière</a>
            </div>              
        </div>
    </div>
{{ form_end(form) }}
{% endblock %}

{% block localjavascript %}
    function delLogo() {
        $("#niveau01_logo_img").attr("src","");
        $("#niveau01_logo").val(null);
    }
    function delHeader() {
        $("#niveau01_header_img").attr("src","");
        $("#niveau01_header").val(null);
    }
{% endblock %}