{% extends 'layout.twig' %}

{% block body %}

    <div class="contenu clearfix" id="maSession">
    
        {% include '@Utilisateur/Common/Component/SubNavbar.twig' 
            with {
                hasBackup: hasBackup,
                current_route: 'droit',
            } only
        %}
		
		<h2>{{ 'Changez vos paramètres OXA.PROC pour la session en cours' | trad }}</h2>

    <form>
        <h4>{{ 'Vos droits pour la session en cours' |trad }}</h4>
        <div id="listeDroit" class="clearfix" style="width:50%;margin:auto;">
            {% if listeUser | lengthTable > 1%}
            <table class="table table-hover tableV2">
                <tr>
                    <td></td>
                    <td width='25%'></td>
                    {% for user in listeUser %}
                        <td width='100px'  style="text-align: center;">{{ user }}</td>
                    {% endfor %}
                </tr>
            </table>
            {% endif %}
            {% for droit in allDroit %}
                {% if droit.PUB | boolSql == false or loop.index == 1 %}
                    {% if loop.index != 1 %}
                        </table>
                    {% endif %}
                    <h4 style="color:var(--main-color-client1);">{{ droit.LIB_DR |replace({'*': ''}) | trad }}</h4>
                    <table class="table table-hover tableV2">

                {% else %}
                    <tr>
                        <td>{{ droit.LIB_DR }}</td>
                        <td width='25%'>{% if Session_NumClient == 0 %}{{ droit.COD_DR }}{% endif %}</td>
                        {% set i=0 %}
                        {% for user in listeUser %}
                            <td width='100px' style="text-align: center;">
                                {% if droit['valeur'~i] %}
                                    <img src="{{ baseUrl('IconeV2/Misc/check_16x16.png') }}">
                                {% else %}
                                    <img src="{{ baseUrl('IconeV2/Gestion/error.svg') }}">
                                {% endif %}
                            </td>
                            {% set i= i+1 %}
                        {% endfor %}
                    </tr>
                {% endif %}
            {% endfor %}
            </table>
        </div>
    </form>

    </div>
    <script>
        function updateValue(champs) {
            activeLoader();
            $.ajax({
                dataType : 'html',
                url: '{{ path('Utilisateur.MaSession.updateValue') }}',
                data : { 'champs' : champs ,'value' : $('#input_'+champs).val()},
                type: "POST",
                success: function(result){
                    desactiveLoader();
                    $("#modal-content").addClass("modal_small");
                    $("#modal-body").html(result);
                    activePopup();
                }
            });
        }
    </script>

{% endblock %}