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

{% block body %}
    <script>
        function sendForm(id)
        {
            activeLoader();
            $.ajax({
                url : '{{ path }}',
                type: 'POST',
                data: $("#form_commentaire").serialize(),
                success: function (data) {
                    reloadGestionDemandeAchat('{{ path('DemandeAchat.GestionDemandeAchat.index') }}');
                }
            });
        }
    </script>
	<div class="modal-body">
        <form method="post" name="form_commentaire" id="form_commentaire" class="bg_form padding_form border_form">
            <div class="row">
                {{ inputAdvance('TEXTAREA', {
                    'titre' : Libelle,
                    'name'  : 'commentaire',
                    'value'  : commentaire.COMMENTAIRE,
                    'pathValidator' : path('Ajax.validator.isStringAvecEspace'),
                    'paramsValidator' : "{'sizeMin' : '0', 'sizeMax' : '3000'}",
                    'obligatoire' : false,
                    option : editable == false  
                        ? 'disabled'
                        : ''
                }) }}
                <input type="hidden" name="NM_COMMEN" value="{{ commentaire.NM_COMMEN }}" />
            </div>
            {% if editable %}
                <div class="modal-footer">
                    <button type="button" class="button secondaire" data-dismiss="modal" onclick="desactivePopup();">{{ 'Annuler' | trad }}</button>
                    <button type="button" class="button principal"  onclick="sendForm('form_commentaire');">{{ 'Enregistrer' | trad }}</button>
                </div>
            {% else %}
                <div class="modal-footer">
                    <button type="button" class="button secondaire" data-dismiss="modal" onclick="desactivePopup();">{{ 'Fermer' | trad }}</button>
                </div>
            {% endif %}
            
        </form>
	</div
{% endblock %}