{% extends '@ajax-layout/layout.twig' %}

{% block body %}
<div class="modal-body clearfix display_table">
	<input type="hidden" name="id_assoc" id="id_assoc" value="{{id_assoc}}" />
	<span class="icone-modal interrogation"></span>
    <div class="display_cell">
    	{{'Êtes-vous sûr de vouloir supprimer l\'association en question' | trad }} ? , {{'ce choix sera ireversible.' | trad}} 
  	</div>

</div>
<div class="modal-footer">


    <a type="button" class="button secondaire" data-dismiss="modal" onClick="desactivePopup()">{{ 'Fermer'|trad }}</a>



    <a class="button principal" onClick="supprimerAssociation('{{id_assoc}}', '{{table}}', '{{val_obj}}', '{{code_societe}}',)">{{ 'Confirmer'|trad }}</a>


</div>

<script>
    function supprimerAssociation(id_association, table, val_obj, code_societe)
    {
        $.ajax({
            url : "{{ path('Evaluation.Association.ajaxSupprimerTableAssociation')}}",
            type: 'POST',
            dataType : 'HTML',
            data: {'choix' : 'O', 'id' : id_association, 'table':  table, 'val_obj' : val_obj, 'code_societe' : code_societe},
            success: function (data) 
            {
                var json_obj = $.parseJSON(data);

				if('supprimer' in json_obj)
				{
                 	refrechDiv('{{ path('Evaluation.BibliothequeDeQuestions.gestionBibliotheque', {'idCamp' : 'ALL', 'mode' :'question'} ) }}', 'tableRefresh');
					desactivePopup();
				}
            }
        });
    }

</script>

{% endblock %}