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

{% block body %}
<div class="modal-body clearfix display_table">
	<span class="icone-modal interrogation"></span>
    <div class="display_cell">
    	{{ 'Confirmez-vous la suppression du panier ?' | trad }}
  	</div>
</div>
<div class="modal-footer">
    <button type="button" class="button secondaire" data-dismiss="modal" onClick="desactivePopup();desactiveLoader();">{{ 'Annuler' | trad}}</button>
    <button type="button" class="button principal" id="confirmeDelete" onClick="AjaxSuppresionEntity('{{ pathURL }}');desactivePopup();">{{ 'Confirmer' | trad}}</button>
</div>
<script>
function AjaxSuppresionEntity(path)
{
	activeLoader();
	$.ajax({
      	dataType : 'html',
    	url: path,
    	data : {},
    	type: "POST",
    	success: function(result){
    		desactiveLoader();

            var testCurrentUrl = window.location.pathname;  
            
            if (testCurrentUrl.indexOf("RechercheArticles") != '-1'
			|| testCurrentUrl.indexOf("Panier") != '-1') {
                window.location.href = "{{ path('RechercheArticles.RechercheArticles.recherche') }}";
            } else {
                refrechDiv(window.location.pathname, 'identification_client');		
            }

    	},
    	error: function (data){
        	desactiveLoader();
            $("#modal-content").addClass("modal_small");
    		$("#modal-body").html(data.responseText);
            activePopup();
    	}
    });
}
</script>
{% endblock %}