demarches-normaliennes/app/assets/javascripts/old_design/dossiers.js

44 lines
1.1 KiB
JavaScript
Raw Normal View History

2017-03-30 17:00:35 +02:00
$(document).on('turbolinks:load', the_terms);
function the_terms() {
2017-04-04 16:15:33 +02:00
var the_terms = $("#dossier_autorisation_donnees");
2017-04-04 16:15:33 +02:00
if (the_terms.size() == 0)
return;
2017-04-04 16:15:33 +02:00
check_value(the_terms);
2017-04-04 16:15:33 +02:00
the_terms.click(function () {
check_value(the_terms);
});
2017-04-04 16:15:33 +02:00
function check_value(the_terms) {
if (the_terms.is(":checked")) {
$("#etape_suivante").removeAttr("disabled");
} else {
$("#etape_suivante").attr("disabled", "disabled");
}
2017-04-04 16:15:33 +02:00
}
}
function error_form_siret(invalid_siret) {
2017-04-04 16:15:33 +02:00
setTimeout(function () {
$("input[type='submit']").val('Erreur SIRET');
}, 10);
2017-04-04 16:15:33 +02:00
$("input[type='submit']").removeClass('btn-success').addClass('btn-danger');
$("#dossier-siret").addClass('input-error').val(invalid_siret).on('input', reset_form_siret);
}
function reset_form_siret() {
2017-04-04 16:15:33 +02:00
$("input[type='submit']").removeClass('btn-danger').addClass('btn-success').val('Valider');
$("#dossier-siret").removeClass('input-error');
}
function toggle_etape_1() {
$('.row.etape.etape_1 .etapes-menu #logos').toggle(100);
$('.row.etape.etape_1 .etapes-informations #description_procedure').toggle(100);
}