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

{% block body %}
	
	<div class="modal-body clearfix display_table" style="width:100%;">
	
		<div id="message_info" class="zoneError" style="margin-bottom:15px;"></div>
	
		<form  method="post" name="formPopupTransfereConsult" id="formPopupTransfereConsult">
    		<div class="single row">
                {{ inputAdvance('SELECT',{
                    'titre'                         : 'Destinataire' | trad,
                    'name'                          : 'DESTINATAIRE',
                    'listeValue'                    : listeAcheteur,
                    'obligatoire'                   : true
                }) }}
    		</div>
		</form>
	</div>
    <div class="modal-footer">
    	<a onClick='desactivePopup();' class="button secondaire">{{ 'Annuler' | trad }}</a>
    	<a onClick="sendForm('{{ path('Consultation.GestionConsultation.ajaxTransfere', {idAO:idAO}) }}');" class="button principal">{{ 'Transmettre' | trad }}</a>
    </div>
    	
	<script>
		$('#modal-title').html('{{ 'Transmettre la consultation N°' | trad }}{{ idAO }}');
		
		function sendForm(path)
		{
        	$.ajax({
    		  	dataType : 'html',
        		url: path,
        		data: $('#formPopupTransfereConsult').serialize(),
        		type: "POST",
        		success: function(result){
        		
        			if (document.getElementById('filtre_Consultation')) {
        				form = 'filtre_Consultation';
        				div = 'divRefresh';
        				refrechDiv(window.location.pathname, div, form);
        				desactivePopup();
        			}
        			else
        			{
						window.location.reload();
        			}
        		}
        	});
		}
	</script>
{% endblock %}