demarches-normaliennes/app/assets/javascripts/dossiers.js
2017-04-20 10:35:53 +02:00

59 lines
1.6 KiB
JavaScript

$(document).on('turbolinks:load', the_terms);
$(document).on('turbolinks:load', pannel_switch);
function pannel_switch() {
$('#switch-notifications').click(function () {
$('#procedure-list').addClass('hidden');
$('#notifications-list').removeClass('hidden');
$(this).addClass('active');
$('#switch-procedures').removeClass('active');
})
$('#switch-procedures').click(function () {
$('#notifications-list').addClass('hidden');
$('#procedure-list').removeClass('hidden');
$(this).addClass('active');
$('#switch-notifications').removeClass('active');
})
}
function the_terms() {
var the_terms = $("#dossier_autorisation_donnees");
if (the_terms.size() == 0)
return;
check_value(the_terms);
the_terms.click(function () {
check_value(the_terms);
});
function check_value(the_terms) {
if (the_terms.is(":checked")) {
$("#etape_suivante").removeAttr("disabled");
} else {
$("#etape_suivante").attr("disabled", "disabled");
}
}
}
function error_form_siret(invalid_siret) {
setTimeout(function () {
$("input[type='submit']").val('Erreur SIRET');
}, 10);
$("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() {
$("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);
}