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

{% block body %}
<script>

function sendForm(id)
{
	//activeLoader();
    $.ajax({
    	url : '{{ path }}',
        type: 'POST',
	  	dataType : 'JSON',
        data: $("#form_formulaireDA").serialize(),
        success: function (data) {
        	if(data.statut=='O'){
	        	redirectJSWithPost(data.path);
        	}
        	else{
        		desactiveLoader();
        		$('#message_erreur_popup').show().html(data.erreur);
        	}
        }
    });
}
</script>

	<div class="modal-body">
        <div id="message_erreur_popup" class="error displayNone clearfix" ></div>
        <form action="" method="post" name="form_formulaireDA" id="form_formulaireDA" class="padding15" >
            <div id="contentFixe" class="clearfix box-form">
                <div class="clearfix ">
                    <div class="colonne">
                        <div class="informations">
                            <p>
                                <span class="champs_label">{{ 'DA' | trad }}</span>
                                <span class="resultat">{{ numDA }}</span>
                            </p>
                        </div>
                    </div>
                </div>
                <fieldset class="scheduler-border">
                    <legend class="scheduler-border">{{ 'Formulaire' | trad }}</legend>
                    <div class="colonne">
                        <div class="row">
                            {{ inputAdvance('TEXTE', {
                                'titre' : 'Veuillez préciser le code du formulaire à créer' | trad,
                                'name' : 'NO_CDE',
                                'pathValidator' : path('Ajax.validator.isStringSansEspace'),
                                'paramsValidator' : "{'nomChamp' : '"~ 'Code formulaire' | trad ~"', 'sizeMin' : '1', 'sizeMax' : '10'}",
                            }) }}
                        </div>
                    </div>                
                    <div class="colonne">
                        <div class="row">
                            {{ inputAdvance('SWITCH', {
                                'titre' : 'Formulaire personnel ?' | trad,
                                'name' : 'FORMPERSO'
                            }) }}
                        </div>
                    </div>
                </fieldset>
                <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_formulaireDA');">{{ 'Créer' | trad }}</button>
                </div>
        	</div>
        </form>
	</div

{% endblock %}