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

{% block body %}
<script>

function sendForm()
{
	activeLoader();
    $.ajax({
    	url : '{{ path('Consultation.Consultation.popupBlocNote', {idAO:idAO}) }}',
        type: 'POST',
        data: $("#form_bloc_notes").serialize(),
        success: function (data) {
        	desactiveLoader();
        	desactivePopup();
            refrechDiv(window.location.pathname, 'Consultation', 'filtre_Consultation');
        },
        error: function(data) {
        	$('#zoneError').html(data);
        	desactiveLoader();
        }
    });
}
</script>
    
	<div class="modal-body">
        <form method="post" name="form_bloc_notes" id="form_bloc_notes">
        	
            <div class="single">
                {{ inputAdvance('TEXTAREA',{
                    'name' : 'contmemo',
                    'value' : post.CONTMEMO,
                    'pathValidator'     : path('Ajax.validator.isStringAvecEspace'),
                    'paramsValidator'   : "{'sizeMin' : '0', 'sizeMax' : '3000'}",
                }) }}
            </div>
            <span id="zoneError" class="zoneError" ></span>
          	<div class="modal-footer">
          		{% if canEdit %}
                	<button type="button" class="button secondaire" data-dismiss="modal" onclick="desactivePopup ();">{{ 'Annuler' | trad }}</button>
                	<button type="button" class="button principal"  onclick="sendForm();">{{ 'Enregistrer' | trad }}</button>
            	{% else %}
            		<button type="button" class="button secondaire" data-dismiss="modal" onclick="desactivePopup ();">{{ 'Fermer' | trad }}</button>
            	{% endif %}
        	</div>
        </form>
	</div>

{% endblock %}