{% block body %}
    {% for contributor in averageContributorGradesByContributors %}
        <tr id="questionnaire_contributor_{{ idAO }}_{{ contributor.CONTRIB }}" class="questionnaire_contributor_{{ idAO }}detail">
            <td 
                class="toggleSlide auto_width fixed-side fixed-bottom noBorderTop borderRight borderBottom" 
                style="min-width:150px;"
                onclick="showContributorQuestionnaire(this)"
                data-id = "{{ idAO }}"
                data-contrib = "{{ contributor.CONTRIB }}"
            >
                {{ contributor.NOM ~ ' (' ~ contributor.CONTRIB ~ ')' }}
            </td>
            {% for frs in contributor.suppliers %}
                <td class="auto_width fixed-side align-right borderRight borderBottom" style="min-width:150px;">
                    {{ frs.AVERAGE_GRADE | prix ~ '/10' }}
                </td>
            {% endfor %}
        </tr>                                    
    {% endfor %}
    <script type="text/javascript" src="{{ baseUrl('ext/tableHeadFixer/js/tableHeadFixer.js')~'?cache='~getSession('cache')  }}"></script>
    <script>
        function showContributorQuestionnaire(object)
        {
            let id = $(object).attr("data-id");
            let contrib = $(object).attr("data-contrib");
            if ($(".questionnaire_contributor_" + id + '_' + contrib + 'detail').length) {
                $(".questionnaire_contributor_" + id + '_' + contrib + 'detail').remove();
            } else {
                $.ajax({
                    url : '{{ path('Consultation.ChoixFournisseur.ajaxDetailContributorsAnswers', {idAO: idAO}) }}',
                    type : 'POST',
                    dataType : 'html',
                    data: {'contributor' : contrib}, 
                    success : function(html){
                        $("#questionnaire_contributor_" + id + '_' + contrib).after(html);
                        $(object).attr("data-etat", 'open');
                    }
                }); 
            }
        }
    </script>                    
{% endblock %}