(function($) { $(document).ready(function(){ var showPricesBox = false; var euCountries = ["at","be","bg","hr","cy","cz","dk","ee","fi","fr","de","gr","hu","ie","it","lv","lt","lu","mt","nl","pl","pt","ro","sk","si","es","se"]; var lang = 'en'; var codeVersion = 'v4'; var site = 'traduphone'; var mandatory_fields = ["prenom","nom","societe","email","telephone","code_postal","ville","address","client-country","interpreting-duration","interpreting-date","interpreting-theme","interpreting-participants","phone-connection-initiator","vat_number"]; var pricesSystem = {"groups":{"1":{"languages":["en","fr","de","es","it","pt"],"prices":{"phone":{"first-interval":{"eur":53,"chf":60},"next-interval":{"eur":33,"chf":40}},"video":{"first-interval":{"eur":140,"chf":140},"next-interval":{"eur":120,"chf":120}}}},"2":{"languages":["nl","ca","cs","ru","pl"],"prices":{"phone":{"first-interval":{"eur":68,"chf":75},"next-interval":{"eur":48,"chf":53}},"video":{"first-interval":{"eur":150,"chf":150},"next-interval":{"eur":130,"chf":130}}}},"3":{"languages":["fi","nb","da","sv"],"prices":{"phone":{"first-interval":{"eur":78,"chf":86},"next-interval":{"eur":58,"chf":64}},"video":{"first-interval":{"eur":170,"chf":170},"next-interval":{"eur":150,"chf":150}}}},"4":{"languages":["ar","zh-hans","ko","ja"],"prices":{"phone":{"first-interval":{"eur":83,"chf":92},"next-interval":{"eur":63,"chf":70}},"video":{"first-interval":{"eur":190,"chf":190},"next-interval":{"eur":170,"chf":170}}}}},"intervals":{"phone":15,"video":60},"connection-options":{"a":{"flat-rate":{"eur":10,"chf":11}},"b":{"flat-rate":{"eur":20,"chf":21}}},"phone":{"zones":[{"eur":0,"chf":0},{"eur":6,"chf":6},{"eur":10,"chf":10},{"eur":12,"chf":12},{"eur":40,"chf":40},{"eur":12,"chf":15}]},"vat":{"fr":20,"ch":7.70000000000000017763568394002504646778106689453125},"additional-participants":{"included":2,"amount":{"eur":5,"chf":6}},"call_recording":{"eur":20,"chf":22},"language-to-group":{"en":1,"fr":1,"de":1,"es":1,"it":1,"pt":1,"nl":2,"ca":2,"cs":2,"ru":2,"pl":2,"fi":3,"nb":3,"da":3,"sv":3,"ar":4,"zh-hans":4,"ko":4,"ja":4}}; var zones = {"al":["Europe","Albania","al","355","2"],"de":["Europe","Germany","de","49","1"],"ad":["Europe","Andorra","ad","376","2"],"am":["Europe","Armenia","am","374","2"],"at":["Europe","Austria","at","43","1"],"az":["Europe","Azerbaijan","az","994","2"],"be":["Europe","Belgium","be","32","1"],"by":["Europe","Belarus","by","375","2"],"ba":["Europe","Bosnia and Herzegowina","ba","387","2"],"bg":["Europe","Bulgaria","bg","359","1"],"cy":["Europe","Cyprus","cy","357","1"],"hr":["Europe","Croatia","hr","385","1"],"dk":["Europe","Denmark","dk","45","1"],"es":["Europe","Spain","es","34","1"],"ee":["Europe","Estonia","ee","372","1"],"fi":["Europe","Finland","fi","358","1"],"fr":["Europe","France","fr","33","0"],"ge":["Europe","Georgia","ge","995","2"],"gr":["Europe","Greece","gr","30","1"],"hu":["Europe","Hungary","hu","36","1"],"fo":["Europe","Faroe Islands","fo","298","2"],"ie":["Europe","Ireland","ie","353","1"],"is":["Europe","Iceland","is","354","1"],"it":["Europe","Italy","it","39","1"],"kz":["Europe","Kazakhstan","kz","7","2"],"lv":["Europe","Latvia","lv","371","2"],"li":["Europe","Liechtenstein","li","423","2"],"lt":["Europe","Lithuania","lt","370","2"],"lu":["Europe","Luxembourg","lu","352","1"],"mk":["Europe","Macedonia","mk","389","2"],"mt":["Europe","Malta","mt","356","2"],"md":["Europe","Moldova","md","373","2"],"mc":["Europe","Monaco","mc","377","2"],"me":["Europe","Montenegro","me","382","2"],"no":["Europe","Norway","no","47","1"],"nl":["Europe","Netherlands","nl","31","1"],"pl":["Europe","Poland","pl","48","1"],"pt":["Europe","Portugal","pt","351","1"],"cz":["Europe","Czech Republic","cz","420","1"],"ro":["Europe","Romania","ro","40","1"],"gb":["Europe","United Kingdom","gb","44","1"],"ru":["Europe","Russia","ru","7","2"],"mf":["Europe","Saint Martin","mf","590","2"],"rs":["Europe","Serbia","rs","381","2"],"sk":["Europe","Slovakia","sk","421","1"],"si":["Europe","Slovenia","si","386","1"],"se":["Europe","Sweden","se","46","1"],"ch":["Europe","Switzerland","ch","41","1"],"ua":["Europe","Ukraine","ua","380","2"],"va":["Europe","Vatican City","va","39","1"],"sa":["Middle East","Saudi Arabia","sa","966","3"],"bh":["Middle East","Bahrain","bh","973","3"],"ae":["Middle East","United Arab Emirates","ae","971","3"],"ir":["Middle East","Iran","ir","98","3"],"iq":["Middle East","Iraq","iq","964","3"],"il":["Middle East","Israel","il","972","3"],"jo":["Middle East","Jordan","jo","962","3"],"kw":["Middle East","Kuwait","kw","965","3"],"lb":["Middle East","Lebanon","lb","961","3"],"om":["Middle East","Oman","om","968","3"],"qa":["Middle East","Qatar","qa","974","3"],"sy":["Middle East","Syria","sy","963","3"],"tr":["Middle East","Turkey","tr","90","3"],"ye":["Middle East","Yemen","ye","967","3"],"za":["Africa","Suoth Africa","za","27","3"],"dz":["Africa","Algeria","dz","213","3"],"ao":["Africa","Angola","ao","244","3"],"bj":["Africa","Benin","bj","229","3"],"bw":["Africa","Botswana","bw","267","3"],"bf":["Africa","Burkina Faso","bf","226","3"],"bi":["Africa","Burundi","bi","257","3"],"cm":["Africa","Cameroon","cm","237","3"],"cv":["Africa","Cap Verde","cv","238","3"],"cd":["Africa","Congo (DRC)","cd","243","3"],"ci":["Africa","C\u00f4te d'Ivoire","ci","225","3"],"dj":["Africa","Djibouti","dj","253","4"],"eg":["Africa","Egypt","eg","20","3"],"er":["Africa","Eritrea","er","291","4"],"et":["Africa","Ethiopia","et","251","3"],"ga":["Africa","Gabon","ga","241","3"],"gm":["Africa","Gambia","gm","220","3"],"gh":["Africa","Ghana","gh","233","3"],"gn":["Africa","Guinea","gn","224","3"],"gw":["Africa","Guinea-Bissau","gw","245","3"],"gq":["Africa","Equatorial Guinea","gq","240","3"],"ke":["Africa","Kenya","ke","254","3"],"lr":["Africa","Liberia","lr","231","3"],"ly":["Africa","Libya","ly","218","3"],"mg":["Africa","Madagascar","mg","261","3"],"mw":["Africa","Malawi","mw","265","3"],"ml":["Africa","Mali","ml","223","3"],"ma":["Africa","Morocco","ma","212","3"],"mu":["Africa","Mauritius","mu","230","3"],"mr":["Africa","Mauritania","mr","222","3"],"yt":["Africa","Mayotte","yt","262","4"],"mz":["Africa","Mozambique","mz","258","3"],"na":["Africa","Namibia","na","264","3"],"ne":["Africa","Niger","ne","227","3"],"ng":["Africa","Nigeria","ng","234","3"],"ug":["Africa","Uganda","ug","256","3"],"cf":["Africa","Central African Republic","cf","236","3"],"cg":["Africa","Congo (Republic)","cg","242","3"],"re":["Africa","R\u00e9union","re","262","5"],"rw":["Africa","Rwanda","rw","250","3"],"sh":["Africa","Saint Helena","sh","290","3"],"st":["Africa","S\u00e3o Tom\u00e9 and Pr\u00edncipe","st","239","4"],"sn":["Africa","Senegal","sn","221","3"],"sc":["Africa","Seychelles","sc","248","3"],"sl":["Africa","Sierra Leone","sl","232","3"],"so":["Africa","Somalia","so","252","3"],"sd":["Africa","Sudan","sd","249","3"],"ss":["Africa","South Sudan","ss","211","3"],"sz":["Africa","Swaziland","sz","268","3"],"tz":["Africa","Tanzania","tz","255","3"],"td":["Africa","Chad","td","235","3"],"tg":["Africa","Togo","tg","228","3"],"tn":["Africa","Tunisia","tn","216","3"],"zm":["Africa","Zambia","zm","260","3"],"zw":["Africa","Zimbabwe","zw","263","4"],"ai":["North America","Anguilla","ai","1264","3"],"ag":["North America","Antigua and Barbuda","ag","1268","3"],"aw":["North America","Aruba","aw","297","3"],"bs":["North America","Bahamas","bs","1242","3"],"bb":["North America","Barbados","bb","1246","3"],"bz":["North America","Belize","bz","501","3"],"bm":["North America","Bermuda","bm","1441","3"],"ca":["North America","Canada","ca","1","0"],"cr":["North America","Costa Rica","cr","506","3"],"cu":["North America","Cuba","cu","53","4"],"dm":["North America","Dominica","dm","1767","3"],"us":["North America","United States","us","1","0"],"gd":["North America","Grenada","gd","1473","4"],"gl":["North America","Greenland","gl","299","4"],"gp":["North America","Guadeloupe","gp","590","5"],"gt":["North America","Guatemala","gt","502","3"],"ht":["North America","Haiti","ht","509","3"],"hn":["North America","Honduras","hn","504","4"],"ky":["North America","Cayman Islands","ky","1345","3"],"jm":["North America","Jamaica","jm","1876","4"],"mq":["North America","Martinique","mq","596","5"],"mx":["North America","Mexico","mx","52","3"],"ms":["North America","Montserrat","ms","1664","4"],"ni":["North America","Nicaragua","ni","505","4"],"pa":["North America","Panama","pa","507","3"],"pr":["North America","Puerto Rico","pr","1","3"],"do":["North America","Dominican Republic","do","1","3"],"lc":["North America","Saint Lucia","lc","1758","3"],"sv":["North America","El Salvador","sv","503","3"],"tt":["North America","Trinidad and Tobago","tt","1868","3"],"ar":["South America","Argentina","ar","54","3"],"bo":["South America","Bolivia","bo","591","3"],"br":["South America","Brazil","br","55","3"],"cl":["South America","Chile","cl","56","3"],"co":["South America","Colombia","co","57","3"],"ec":["South America","Ecuador","ec","593","3"],"gy":["South America","Guyana","gy","592","3"],"gf":["South America","French Guiana","gf","594","3"],"py":["South America","Paraguay","py","595","3"],"pe":["South America","Peru","pe","51","3"],"sr":["South America","Suriname","sr","597","3"],"uy":["South America","Uruguay","uy","598","3"],"ve":["South America","Venezuela","ve","58","3"],"af":["Asia","Afghanistan","af","93","4"],"bd":["Asia","Bangladesh","bd","880","4"],"bt":["Asia","Bhutan","bt","975","4"],"mm":["Asia","Myanmar (Burma)","mm","95","4"],"bn":["Asia","Brunei","bn","673","4"],"kh":["Asia","Cambodia","kh","855","4"],"cn":["Asia","China","cn","86","4"],"kr":["Asia","South Korea","kr","82","4"],"hk":["Asia","Hong Kong","hk","852","4"],"in":["Asia","India","in","91","4"],"id":["Asia","Indonesia","id","62","4"],"jp":["Asia","Japan","jp","81","4"],"kg":["Asia","Kyrgyzstan","kg","996","4"],"la":["Asia","Laos","la","856","4"],"mo":["Asia","Macau","mo","853","4"],"my":["Asia","Malaysia","my","60","4"],"mv":["Asia","Maldives","mv","960","4"],"mn":["Asia","Mongolia","mn","976","4"],"np":["Asia","Nepal","np","977","4"],"uz":["Asia","Uzbekistan","uz","998","4"],"pk":["Asia","Pakistan","pk","92","4"],"ph":["Asia","Philippines","ph","63","4"],"sg":["Asia","Singapore","sg","65","4"],"lk":["Asia","Sri Lanka","lk","94","4"],"tj":["Asia","Tajikistan","tj","992","4"],"tw":["Asia","Taiwan","tw","886","4"],"th":["Asia","Thailand","th","66","4"],"tl":["Asia","Timor-Leste","tl","670","4"],"tm":["Asia","Turkemnistan","tm","993","4"],"vn":["Asia","Vietnam","vn","84","4"],"au":["Oceania","Austrialia","au","61","1"],"gu":["Oceania","Guam","gu","1671","4"],"cc":["Oceania","Cocos (Keeling) Islands","cc","61","4"],"ck":["Oceania","Cook Islands","ck","682","4"],"fj":["Oceania","Fiji","fj","679","4"],"mp":["Oceania","Northern Mariana Islands","mp","1670","4"],"mh":["Oceania","Marshall Islands","mh","692","4"],"sb":["Oceania","Solomon Islands","sb","677","4"],"cx":["Oceania","Christmas Island","cx","61","4"],"nf":["Oceania","Norfolk Island","nf","672","4"],"ki":["Oceania","Kiribati","ki","686","4"],"nr":["Oceania","Nauru","nr","674","4"],"un":["Oceania","Niue","un","683","4"],"nc":["Oceania","New Caledonia","nc","687","4"],"nz":["Oceania","New Zealand","nz","64","1"],"pw":["Oceania","Palau","pw","680","4"],"pg":["Oceania","Papua New Guinea","pg","675","4"],"pf":["Oceania","French Polynesia","pf","689","4"],"ws":["Oceania","Samoa","ws","685","4"],"as":["Oceania","American Samoa","as","1684","4"],"tk":["Oceania","Tokelau","tk","690","4"],"to":["Oceania","Tonga","to","676","4"],"tv":["Oceania","Tuvalu","tv","688","4"],"vu":["Oceania","Vanuatu","vu","678","4"],"wf":["Oceania","Wallis and Futuna","wf","681","4"]}; //var countries = null; var prices = {} if (!String.prototype.format) { String.prototype.format = function () { var args = arguments; return this.replace(/{(\d+)}/g, function (match, number) { return typeof args[number] != 'undefined' ? args[number] : match; }); }; } function select_private_or_company() { var value = $('input[name=contact-type]:checked').val(); if (value == 'private') { $('input[name=societe]').val(''); $('#societe-c').hide(); } else if (value == 'company') { $('#societe-c').show(); } } function remove_mark() { for (var i in mandatory_fields) { var f = mandatory_fields[i]; var e = $('#' + f); e.on('keypress change input', function () { $(this).parents('.required').find('.check-errors-msg').remove(); $(this).removeClass('has-error'); }); } } function toggle_contact_country() { var val = $('#client-country 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 = $('#client-country 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_interpreting_options() { if ($('input[name=interpreting-type]:checked').val() == 'phone') { // $("#connection-overall").show(); $("#connection-phone").show(); $("#connection-video").hide(); // $('select.interpreting-duration-phone').show() // $('select.interpreting-duration-video').hide() $('.section-phone-interpreting').show() $('.section-video-interpreting').hide() $('#interpreting-participants-c').show() } else if ($('input[name=interpreting-type]:checked').val() == 'video') { // $("#connection-overall").hide(); $("#connection-phone").hide(); $("#connection-video").show(); // $('select.interpreting-duration-phone').hide() // $('select.interpreting-duration-video').show() $('.section-phone-interpreting').hide() $('.section-video-interpreting').show() $('#interpreting-participants-c').hide() } } function connection_person_phone() { $(".phone-connection-number").intlTelInput({ nationalMode: false, separateDialCode: false, // preferredCountries: [ "us", "gb" ], preferredCountries: ['fr'] }); } // function connection_initiator() { // if ($('input[name=phone-connection-initiator]:checked').val() == 'provider') { // $('#phone-connection-container-provider').show(500); // } else { // $('#phone-connection-container-provider').hide(); // } // } function toggle_customer_code() { if ($('input[name=returning-customer]:checked').val() == 'yes') { $('#customer-code').show(300); } else { $('#customer-code').hide(); } } function toggle_written_transcription_languages() { if ($('input[name=written-transcription]:checked').val() == 1) { $('#written-transcription-languages').show(); } else { $('#written-transcription-languages').hide(); } } //! first click on the price evaluation button function calculatePrice() { showPricesBox = true; updatePrice(); } function updatePrice() { if (showPricesBox) { $('#calculation').show(); getPrices(retrieveFormValuesPrices()) } } function getPrices(formData) { $.ajax({ type: "POST", dataType: "json", url: "/bo/ajax/get-prices.php", cache: false, data: formData, beforeSend: function () { $('#calculation-content').html('') $('#calculation-loader').show() $('#action-button').attr('disabled', true) } }). done(function (data) { $('#calculation-loader').hide() $('#action-button').attr('disabled', false) if (data.error === false) { prices = data.prices printPrices(formData, data.prices) $('#action-button').val('send').html(text['traduphone_button_quotation_request']).show(); $('#conditions').show(); } else { $('#calculation-content').html(text[data.errorDetails]) } }); } //values used for calculation function retrieveFormValuesPrices() { var formValues = { language: $('input[name=language]').val(), clientType: $('input[name=contact-type]:checked').val(), interpretingType: $('input[name=interpreting-type]:checked').val(), // duration: $('select[name=interpreting-duration]').val(), // durationLabel: $('select[name=interpreting-duration] option:selected').html(), clientCountry: $('#client-country option:selected').attr('rel'), // callInitiator: $('input[name=phone-connection-initiator]:checked').val(), callInitiator: 'provider', sourceLang: $('#source-languages').val(), targetLang: $('#target-languages').val(), sourceLangName: $('#source-languages option:selected').text(), targetLangName: $('#target-languages option:selected').text(), noParticipants: $('#interpreting-participants').val(), participants: [], callRecording: $('#call-recording').is(':checked') }; if (formValues.interpretingType == 'phone') { formValues.duration = $('select[name=phone-interpreting-duration]').val() formValues.durationLabel = $('select[name=phone-interpreting-duration] option:selected').html() } else if (formValues.interpretingType == 'video') { formValues.duration = $('select[name=video-interpreting-duration]').val() formValues.durationLabel = $('select[name=video-interpreting-duration] option:selected').html() } var formParticipants = $('#phone-connection-number-c .conn-num'); formParticipants.each(function () { formValues.participants.push({ country: $(this).find('input.phone-connection-number').intlTelInput("getSelectedCountryData"), }); }); return formValues; } // all values used to insert the quotation into the database function retrieveFormValuesQuotation() { var formValues = retrieveFormValuesPrices() formValues.civilite = $('#civilite option:selected').val() formValues.nom = $('input[name=nom]').val() formValues.prenom = $('input[name=prenom]').val() formValues.societe = $('input[name=societe]').val() formValues.address = $('input[name=address]').val() formValues.address1 = $('input[name=address-1]').val() formValues.nom = $('input[name=nom]').val() formValues.codePostal = $('input[name=code_postal]').val() formValues.contactCountryOther = $('input[name=contact-country-other]').val() formValues.ville = $('input[name=ville]').val() formValues.telephone = $('input[name=telephone]').val() formValues.email = $('input[name=email]').val() formValues.vatNumber = $('input[name=vat_number]').val() formValues.message = $('input[name=message]').val() formValues.language = $('input[name=language]').val() formValues.interpretingDate = $('input[name=interpreting-date]').val() formValues.interpretingTheme = $('#interpreting-theme option:selected').val() formValues.interpretingThemeOther = $('input[name=interpreting-theme-other]').val() formValues.gdprConsent = $('input[name=gdpr-consent]').val() if (formValues.interpretingType == 'phone') { // reset and repopulate participants with all the values (person name, phone, email) formValues.participants = [] var formParticipants = $('#phone-connection-number-c .conn-num'); formParticipants.each(function () { formValues.participants.push({ country: $(this).find('input.phone-connection-number').intlTelInput("getSelectedCountryData"), phone: $(this).find("input[name='phone-connection-number[]']").val(), name: $(this).find("input[name='connection-participants[]']").val(), email: $(this).find("input[name='connection-participants-email[]']").val() }); }); } else if (formValues.interpretingType == 'video') { formValues.videoParticipantsEmails = $('textarea[name=video-participants-emails]').val() } formValues.writtenTranscription = $('#written-transcription').is(':checked') if (formValues.writtenTranscription) { formValues.writtenTranscriptionLanguages = [] if ($('#written-transcription-language-1').is(':checked')) { formValues.writtenTranscriptionLanguages.push({ 'langcode': $('#written-transcription-language-1').val(), 'name': $('#written-transcription-language-1-label').html() }) } if ($('#written-transcription-language-2').is(':checked')) { formValues.writtenTranscriptionLanguages.push({ 'langcode': $('#written-transcription-language-2').val(), 'name': $('#written-transcription-language-2-label').html() }) } } // console.log(formValues) return formValues } function printPrices(formData, prices) { var c = $('#calculation-content'); c.html('') // close services price section var priceServices = '' priceServices += '