(function($) { $(document).ready(function(){ var text = {} text['other-language'] = 'Select another language'; text['date-format'] = 'dd/mm/yy'; text['payment_required_field'] = 'Required field'; text['quotation_checks_captcha'] = 'Captcha test not performed'; text['payment_form_processing_errors'] = 'There were errors processing the form. Please correct them and submit it again. Thank you!'; text['phoneint_choose_one_option'] = 'You must choose an option'; var lang = 'en'; var codeVersion = 'v2'; var site = 'phoneint'; var destination = ''; var mandatory_fields = ["prenom","nom","societe","email","telephone","code_postal","ville","adresse","voiceover_length","pays","voiceover-length"]; //var config = {}; //config. = {}; //config..dropbox = ''; //function select_private_or_company() { // // select private or company // if($('#client_type_c').length) { // var value = $('input[name=contact_type]:checked').val(); // if(value=='private') { // $('input[name=societe]').val(''); // $('#company_c').hide(); // } // else if (value=='company') { // $('#company_c').show(); // } // } //} function remove_mark() { for (var i in mandatory_fields) { var f = mandatory_fields[i]; var e = $('#'+f); e.on('keypress change', function(){ $(this).parents('.required').find('.check_errors_msg').remove(); $(this).removeClass('has-error'); }); } } function toggle_contact_country() { var val = $('#pays option:selected').val(); if(val == 'other') { $("#contact-country-other").show(); } else { $("#contact-country-other").hide(); // change country code only if the phone is not yet filled in var cc = $('#pays option:selected').attr('rel'); if(cc != '' && $("#telephone").val() == '') { $("#telephone").intlTelInput("setCountry", cc); } } } function toggle_theme() { var val = $('#interpreting-theme option:selected').val(); if(val == 'other') { $("#interpreting-theme-other").show(); } else { $("#interpreting-theme-other").hide(); } } function toggle_phone_number() { } function connection_person_phone() { $(".phone-connection-number").intlTelInput({ nationalMode : false, separateDialCode: false, // preferredCountries: [ "us", "gb" ], preferredCountries: ['fr'] }); }(function($) { 'use strict'; // BEGIN LANGUAGES var sc; sc = $('#source-languages').SumoSelect({ csvDispCount: 4 }); var lc; lc = $('#target-languages').SumoSelect({ csvDispCount: 4 }); $("#target-languages").on('change', function() { var val = $('#target-languages').val(); var state = false; if (typeof val === 'string') { if (val == 'other') { state = true; } } // array - for multiple values droplist else { var s = $.inArray('other', val); if(s != -1) { state = true; } } if(state === true) { $("#target-languages-other").show(); $('#target-languages')[0].sumo.hideOpts(); } else { $("#target-languages-other").hide(); } }); // END LANGUAGES })(jQuery); // http://www.jqueryscript.net/form/jQuery-International-Telephone-Input-With-Flags-Dial-Codes.html $("#telephone").intlTelInput({ nationalMode : false, separateDialCode: false, preferredCountries: ['fr'] }); connection_person_phone(); toggle_contact_country(); $('select[name=pays]').click(function(){ toggle_contact_country(); }); toggle_theme(); $('select[name=interpreting-theme]').click(function(){ toggle_theme(); }); $('input[name=phone-connection-initiator]').click(function(){ if($(this).val() == 'provider') { $('#phone-connection-container-provider').show(500); } else { $('#phone-connection-container-provider').hide(); } }); $('input[name=phone-connection-type]').click(function(){ $('#connection-numbers-c').show(400); }); $('input[name=additional-services-translation]').click(function(){ if($(this).is(':checked')) { $('#version-to-translate-c').show(); } else { $('#version-to-translate-c').hide(); } }); remove_mark(); $('#add-connection-person').click(function(){ var c = $('#conn-num').html(); $('#conn-num-supp').append(c); connection_person_phone(); }); $('input[name="phone-connection-type-r[]"]').click(function(){ $(this).parents('.conn-num').find('input[name="phone-connection-type[]"]').val($(this).val()); }); $('#interpreting-date-dtp').datetimepicker({ // locale: 'fr', locale: $('input[name=interpreting-date]').attr('data-locale'), // inline: true, sideBySide: true }); // Form validation $("#quotation-form").submit(function(){ $('.check_errors_msg').remove(); var checkErrors = false; if ($.inArray('prenom', mandatory_fields) > -1 && $('#prenom').val() == '') { $('#first_name_c').append('' + text['payment_required_field'] + ''); $('#prenom').addClass('has-error'); checkErrors = true; } if ($.inArray('nom', mandatory_fields) > -1 && $('#nom').val() == '') { $('#last_name_c').append('' + text['payment_required_field'] + ''); $('#nom').addClass('has-error'); checkErrors = true; } if ($('input[name=contact_type]:checked').val() == 'company' && $('#societe').val() == '') { $('#company_c').append('' + text['payment_required_field'] + ''); $('#societe').addClass('has-error'); checkErrors = true; } if ($('#email').val() == '') { $('#email_c').append('' + text['payment_required_field'] + ''); $('#email').addClass('has-error'); checkErrors = true; } if ($('#telephone').val() == '') { $('#phone_c').append('' + text['payment_required_field'] + ''); $('#telephone').addClass('has-error'); checkErrors = true; } if ($('#ville').val() == '') { $('#city_c').append('' + text['payment_required_field'] + ''); $('#ville').addClass('has-error'); checkErrors = true; } if ($('#pays').val() == '') { $('#country_c').append('' + text['payment_required_field'] + ''); $('#pays').addClass('has-error'); checkErrors = true; } if ($.inArray('code_postal', mandatory_fields) > -1 && $('#code_postal').val() == '') { $('#postal_code_c').append('' + text['payment_required_field'] + ''); $('#code_postal').addClass('has-error'); checkErrors = true; } if ($.inArray('adresse', mandatory_fields) > -1 && $('#adresse').val() == '') { $('#address_c').append('' + text['payment_required_field'] + ''); $('#adresse').addClass('has-error'); checkErrors = true; } if(!$('input[name=phone-connection-initiator]').is(':checked')) { $('#connection-options-c').prepend('' + text['phoneint_choose_one_option'] + ''); checkErrors = true; } if($('input[name=phone-connection-initiator]:checked').val() == 'provider' && !$('input[name=phone-price-list-accept]').is(':checked')) { $('#phone-connection-number-conditions-c').append('' + text['payment_required_field'] + ''); checkErrors = true; } if($('#g-recaptcha-response').val() == '') { $('#recaptcha_c').append('' + text['quotation_checks_captcha'] + ''); checkErrors = true; } if(checkErrors) { var msg = ''; $('#submit_c').before(msg); $('#check_result_errors').slideDown({duration:400}); return false; } }); }); })(jQuery)