<div id ="blocMdp" style="display:none;" >
    <fieldset class="scheduler-border" id="fieldMotDePasse">
    	{% if passwordForSignActivated %}
    		<legend class="scheduler-border">{{'Mot de passe pour l\'application' | trad }} </legend>
    	{% else %}
            <legend class="scheduler-border">{{'Mot de passe commun pour l\'application et les signatures' | trad }} </legend>
        {% endif %}
            <div class="row">
            
            	
            	<div id='validatorPassword' style="margin-left: 19%;">
            	</div>
            	
            	
                <div class="colonne2">
                    <div class="row">
                        {{ inputAdvance('PASSWORD',{
                            'titre' : 'Nouveau mot de passe'| trad,
                            'name' : 'MDP',
                            'value' : post.MDP
                        }) }}
                    </div>
                </div>
                <div class="colonne2 last">
                    <div class="row">
                        {{ inputAdvance('PASSWORD',{
                            'titre' : 'Confirmation'| trad,
                            'name' : 'MDP_CONFIRM',
                            'value' : post.MDP_CONFIRM
                        }) }}
                    </div>
                </div>
            	<script>
                    affichageValidatorPassword('{{path('Index.validator.isPassword')}}', 'validatorPassword', 'input_MDP');

                	if(!window.timeoutPassword) {
                        window.timeoutPassword = null;
                    }
                    
                	$( "#input_MDP" ).keyup(function() {
                        clearTimeout(window.timeoutPassword);
		                window.timeoutPassword = setTimeout(() => {
                		    affichageValidatorPassword('{{path('Index.validator.isPassword')}}', 'validatorPassword', 'input_MDP');
                        }, 500);
                	});
            	</script>
            </div>
    </fieldset> 
    {% if passwordForSignActivated %}
        <fieldset class="scheduler-border">
            <legend class="scheduler-border">{{'Mot de passe pour les signatures' | trad }}</legend>
            <div class="row">
            
            	<div id='validatorPassword2' style="margin-left: 19%;">
            	</div>
            	
            
                <div class="colonne2">
                    <div class="row">
                        {{ inputAdvance('PASSWORD',{
                            'titre' : 'Nouveau mot de passe'| trad,
                            'name' : 'MDP_SIGNA',
                            'value' : post.MDP_SIGNA
                        }) }}
                    </div>
             
                </div>
                <div class="colonne2 last">
                    <div class="row">
                        {{ inputAdvance('PASSWORD',{
                            'titre' : 'Confirmation'| trad,
                            'name' : 'MDP_SIGNA_CONFIRM',
                            'value' : post.MDP_SIGNA_CONFIRM
                        }) }}	
                    </div>
                </div>
            	<script>
                	affichageValidatorPassword('{{path('Index.validator.isPassword')}}', 'validatorPassword2', 'input_MDP_SIGNA');

                    if(!window.timeoutPassword) {
                        window.timeoutPassword = null;
                    }
                    
                	$( "#input_MDP_SIGNA" ).keyup(function() {
                        clearTimeout(window.timeoutPassword);
		                window.timeoutPassword = setTimeout(() => {
                		    affichageValidatorPassword('{{path('Index.validator.isPassword')}}', 'validatorPassword2', 'input_MDP_SIGNA');
                        }, 500);
                	});
            	</script>

        </fieldset>    
    {% endif %}                        

    <div class="row">
        <button type="button" onClick="sendFormulaire('{{ path('Index.CreationCompte.ajaxPassword') }}');" class ="button principal button_right" >{{'Enregistrer le formulaire d\'inscription' | trad}}</button>
        <button type="button" onClick="backToStep2();" class ="button secondaire button_right" >{{'Etape 2' | trad }}</button>
    </div> 
</div>  

<script>
function backToStep2()
{
	$('#blocMdp').hide();
	$('#blocAbonnement').show();

	$('#subAr3').removeClass('active');
	$('#subAr3 a').addClass('sans_hover');
	$('#subAr2').addClass('active');
	$('#subAr2 a').removeClass('sans_hover');
}
function sendFormulaire(path)
{
    var form = $('#formCreationCompte')[0];

	// Create an FormData object 
    var data = new FormData(form);
    data.append("importuploadImageSignature", $("#importuploadImageSignature").get(0).files[0]);

	$.ajax({
	  	dataType : 'html',
    	url: path,
    	data: data,
    	type: "POST",
    	mimeType: "multipart/form-data",
        processData: false,  // Important!
        contentType: false,
        cache: false,

    	success: function(result){
            $("#modal-content").addClass("modal_small");
    		$("#modal-body").html(result);
            activePopup();
    	}
    });
}
</script>