/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ $(document).ready(function() { boulange_signup() ; boulange_add_boulangerie() ; }); function boulange_scroll(id) { if($("#"+id).size()) $('html,body').animate({ scrollTop: $("#"+id).offset().top}, 1000); } function boulange_add_boulangerie() { $('#bloc-add-etablissement .panel-heading').click(function() { var panel_body = $(this).parent().find('.panel-body') ; if(panel_body.css('display') == 'none') panel_body.fadeIn() ; else panel_body.hide() ; }) ; $('#addetablissementform-id_etablissement,#signupform-id_etablissement').change(function() { if($(this).find('option:selected').hasClass('lock')) { $('#bloc-code-acces').fadeIn() ; } else { $('#bloc-code-acces').hide() ; } }) ; if($('#addetablissementform-id_etablissement option:selected,#signupform-id_etablissement option:selected').hasClass('lock')) { $('#bloc-code-acces').show() ; } else { $('#bloc-code-acces').hide() ; } if($('#bloc-add-etablissement').size()) { if($('#bloc-add-etablissement .has-error').size()) { $('#bloc-add-etablissement .panel-body').show() ; } } } function boulange_signup() { if($('#form-signup').size()) { boulange_signup_champs_boulanger() ; $('#option-client, #option-boulanger').change(function() { boulange_signup_champs_boulanger() ; }) ; } } function boulange_signup_champs_boulanger() { if($('#option-boulanger').prop('checked')) { $('#champs-boulanger').fadeIn() ; $('#champs-client').hide() ; } else { $('#champs-boulanger').hide() ; $('#champs-client').fadeIn() ; } }