{% extends 'layout.twig' %}

{% block body %}
	<div class="contenu clearfix"  id="fournisseurs">
    	<h1>
        	{{ 'Paramétrage portail utilisateur' | trad }}
        </h1>
    
        {{ ariane() }}
        
        <div class="tab-content clearfix" style="margin-top:15px;">        	
        	{{ arianeSub() }}
        
        	<div class="padding15">

                <form method="post" name="form_oxaproc" id="form_oxaproc" class="bs-row py-base form-default gutter-x-base">

                    <div class="bs-col-full text-right mb-base">
                        <button type="button" onClick="ajaxPopupV2('{{ path('Parametrage.ParametrageConsultation.pjclause') }}', 'form_oxaproc', '');" class="principal" style="float: right;">{{ 'Enregistrer' | trad }}</button>
                    </div>

                    <nav class="bg-default bg_form follow-scroll box-form align-self-start" id="navBarParam" style="width: 250px;">
                        <span style="font-weight: bold; color: #337ab7;">{{'Langues' | trad ~ colon() }}</span>
                        <ul class="nav">
                        {% for langue in post|keys  %}
                            <li class="nav-item"><a class="nav-link {{loop.first ? 'actif' : ''}}" href="javascript:void(0);" id="nav-{{langue}}" onClick="showParam('{{langue}}');">{{ listeLangue[langue] | capitalize | trad }}</a></li>
                        {% endfor %}
                        </ul>
                    </nav>

                    <div class="bs-col clearfix" id="divParam">
                    {% for langue, content in post %}
                        <div class="divParam clearfix bg_form padding15 mb-base" id={{langue}} {{loop.first ? '' : 'style="display: none"'}}>
                            <div class="clearfix single">
                                <table class="table table-hover tableV2" id="sortable-table-{{langue}}">
                                    <thead class="thead-dark">
                                        <th scope="col">{{"Ordre" | trad}}</th>
                                        <th scope="col">{{"Titre" | trad}}</th>
                                        <th scope="col">{{"RFI" | trad}}</th>
                                        <th scope="col">{{"RFP" | trad}}</th>
                                        <th scope="col">{{"RFQ" | trad}}</th>
                                        <th scope="col">
                                            <a class="ajouter_blanc_v2  white-tooltip" id="addNewDocs" onClick="ajaxPopup('{{path("Parametrage.ParametrageConsultation.popupAjoutDocumentConsult", {"typeDoc": "P"} ) }} ', '{{ "Ajouter un document de la consultation par défaut" | trad }}')" style="float: right;">
                                                <span class="infos_tooltip left fw-normal">
                                                    {{ 'Ajouter un document de la consultation par défaut' | trad }}
                                                </span>
                                            </a>
                                        </th>
                                    </thead>
                                    <tbody>
                                        {% for key, subContent in content %}
                                        <tr id="docReponse_{{langue}}_{{key}}" style="cursor: grab">
                                            <td width="5%">
                                            <span class="order-input-span">
                                                {{ loop.index }}
                                            </span>
                                                <input type="hidden" name="order-{{langue}}-{{ key }}" class="order-input" value="{{ subContent.NUM_ORDRE }}" />
                                            </td>
                                            <td width="">
                                                {{ inputAdvance('TEXT', {
                                                    'name' : 'TITRE_DOC-'~langue~'-'~key,
                                                    'value' : subContent.TITRE_DOC
                                                }) }}
                                            </td>
                                            <td width="13%">
                                                {{ inputAdvance('SWITCH', {
                                                    'name' : 'POUR_RFI-'~langue~'-'~key,
                                                    'value' : subContent.POUR_RFI
                                                }) }}
                                            </td>
                                            <td width="13%">
                                                {{ inputAdvance('SWITCH', {
                                                    'name' : 'POUR_RFP-'~langue~'-'~key,
                                                    'value' : subContent.POUR_RFP
                                                }) }}
                                            </td>
                                            <td width="13%">
                                                {{ inputAdvance('SWITCH', {
                                                    'name' : 'POUR_RFQ-'~langue~'-'~key,
                                                    'value' : subContent.POUR_RFQ
                                                }) }}
                                            </td>
                                            <td width="100px">
                                                {{ hover_action('docReponse_'~langue~'_'~subContent.NUM_ORDRE, 'Supprimer_v2' , "popupConfirmation(\'"~path('Ajax.Erreur.popupConfirmationSuppresion')~"\', \'\', \'"~path('Parametrage.ParametrageConsultation.ajaxDeleteLigneDoc', {'typeDoc': 'P','codLng': langue, 'numOrdreInit': key})~"\', \'"~('Etes-vous sûr de vouloir supprimer' | trad |e('js')|raw)~" "~subContent.TITRE_DOC~"?\', \'"~langue~"\')", 'float: right;margin-right:5px;') }}
                                            </td>
                                        </tr>
                                    {% endfor %}
                                    </tbody>
                                </table>
                            </div>
                        </div>
                        <script>
                            $("#sortable-table-{{langue}} tbody").sortable({
                                axis: "y",
                                containment: "parent",
                                cursor: "move",
                                opacity: 0.8,
                                placeholder: "ui-state-highlight",
                                update: function(event, ui) {
                                        $("#sortable-table-{{langue}} tbody tr").each(function(index) {
                                            $(this).find(".order-input-span").html(index + 1);
                                            $(this).find(".order-input").val(index + 1);
                                        });
                                    }
                            }).disableSelection();
                        </script>                        
                    {% endfor %}
                    </div>
                </form>
            </div>
        </div>
    </div>
    {% include '@ParamOxaproc/common.twig' %}
{% endblock %}