var huurcheck = 0; var afhaalcheck = 0; var paypalkosten = 0; var creditcardkosten = 0; //var afterpay_riverty_kosten = 0; var afterpay_klarna_kosten = 0; var afhalengeklikt = 0; $(document).ready(function() { (function(factory) { if ( typeof define === "function" && define.amd ) { define( [ "../widgets/datepicker" ], factory ); } else { factory( jQuery.datepicker ); } } (function(datepicker) { datepicker.regional.nl = { closeText: "Sluiten", prevText: "←", nextText: "→", currentText: "Vandaag", monthNames: [ "januari", "februari", "maart", "april", "mei", "juni", "juli", "augustus", "september", "oktober", "november", "december" ], monthNamesShort: [ "jan", "feb", "mrt", "apr", "mei", "jun", "jul", "aug", "sep", "okt", "nov", "dec" ], dayNames: [ "zondag", "maandag", "dinsdag", "woensdag", "donderdag", "vrijdag", "zaterdag" ], dayNamesShort: [ "zon", "maa", "din", "woe", "don", "vri", "zat" ], dayNamesMin: [ "zo", "ma", "di", "wo", "do", "vr", "za" ], weekHeader: "Wk", dateFormat: "dd-mm-yy", firstDay: 1, isRTL: false, showMonthAfterYear: false, yearSuffix: "" }; datepicker.setDefaults( datepicker.regional.nl ); return datepicker.regional.nl; } )); function validateEmail($email) { //var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/; // (+ was hier niet toegestaan) var emailReg = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/; return emailReg.test( $email ); } $("#afhaaldate").datepicker({ numberOfMonths: 2, beforeShowDay: function(d) { var unavailableDates = [ "5-4-2021", "24-5-2021", "25-12-2021", "26-12-2021", "16-12-2023", "25-12-2023", "26-12-2023", "27-12-2023", "28-12-2023", "29-12-2023", "30-12-2023", "31-12-2023", "1-1-2024", ]; var day = d.getDay(); dmy = d.getDate() + "-" + (d.getMonth() + 1) + "-" + d.getFullYear(); if ($.inArray(dmy, unavailableDates) == -1) { if (day != 0) { return [true, ""]; } else { return [false, "", "Niet beschikbaar"]; } } else { return [false, "", "Niet beschikbaar"]; } }, minDate: 1, onSelect: function(date) { $("#hiddenafhaaldate").val(date); var tmpafhaaldate = new Date(date); var tmpafhaaldatenr = tmpafhaaldate.getDay(); if (tmpafhaaldatenr == 6) { var afhaaltimediv = ''; } else { var afhaaltimediv = ''; } $("#afhaaltimediv").html(afhaaltimediv); }, dateFormat : "yy-mm-dd" }); $("#postcode,#huisnummer").blur(function() { var postc = $('#postcode').val(); postc = postc.toUpperCase(); var huisnr = $('#huisnummer').val(); if (!postc || !huisnr) { // } else { $.ajax({ url: 'https://www.ballonnenservice.nl/functions/postcodecheck.php', type: 'GET', dataType: 'json', data: 'postc=' + postc + '&huisnr=' + huisnr, success: function(result) { if (result.postcode == postc) { $('#city').val(result.city); $('#address').val(result.street); } else { // bestaat niet } }, }); return false; } }); $("#afleverplaats").blur(function() { var afleverplaats = $("#afleverplaats").val(); $("#afleverplaatsval").val(afleverplaats); }); $("#ppostcode,#phuisnummer").blur(function() { var postc = $('#ppostcode').val(); postc = postc.toUpperCase(); var huisnr = $('#phuisnummer').val(); if (!postc || !huisnr) { // } else { $.ajax({ url: 'https://www.ballonnenservice.nl/functions/postcodecheck.php', type: 'GET', dataType: 'json', data: 'postc=' + postc + '&huisnr=' + huisnr, success: function(result) { if (result.postcode == postc) { $('#pcity').val(result.city); $('#paddress').val(result.street); } else { // bestaat niet } }, }); return false; } }); // ' of " niet mogelijk PARTICULIER $('#pname, #pphone, #ppostcode, #phuisnummer, #paddress, #postcode, #huisnummer, #phone, #aflevernaam, #aflevertelefoon, #afleverpostcode, #afleverhuisnummer, #afleveradres, textarea').keypress(function (e) { var regex = new RegExp("^[a-zA-Z0-9- \/.@'_\b]+$"); var str = String.fromCharCode(!e.charCode ? e.which : e.charCode); if (regex.test(str)) { return true; } e.preventDefault(); return false; }); $("#ideal").click(function() { //$("#betaalwijzesknoppen").slideDown("fast"); //$("#afterpaydiv").slideUp("fast"); //$("#idealdiv").slideDown("fast"); $("#gekozenbetaalmethode").val("ideal"); stap3naar4(); }); $("#contant").click(function() { $("#gekozenbetaalmethode").val("contant"); stap3naar4(); }); //$("#ap_riverty_volgende").click(function() { // $("#gekozenbetaalmethode").val("ap_riverty"); // stap3naar4(); //}); $("#ap_klarna_volgende").click(function() { $("#gekozenbetaalmethode").val("ap_klarna"); stap3naar4(); }); $("#ap_klarna").click(function() { $("#transactiekosten").val(0); var tmphiddentotaal = parseFloat($("#hiddentotaal").val()); var tmpkosten = parseFloat(afterpay_klarna_kosten); var nieuweprijs = tmphiddentotaal + tmpkosten; var nieuweprijs = nieuweprijs.toFixed(2); $("#hiddentotaal").val(nieuweprijs); $("#totaalprijs").html("Totaal: €"+nieuweprijs+""); $("#idealdiv").slideUp("fast"); $("#afterpay_klarna_div").slideDown("fast"); $("#gekozenbetaalmethode").val("ap_klarna"); $("#betaalwijzesknoppen").slideUp("fast"); //$("#afterpaydiv").slideUp("fast"); //$("#idealdiv").slideDown("fast"); //stap3naar4(); }); $("#or").click(function() { $("#gekozenbetaalmethode").val("or"); stap3naar4(); }); $("#cc").click(function() { $("#gekozenbetaalmethode").val("cc"); $("#transactiekosten").val(0); var tmphiddentotaal = parseFloat($("#hiddentotaal").val()); var tmpkosten = parseFloat(creditcardkosten); var nieuweprijs = tmphiddentotaal + tmpkosten; var nieuweprijs = nieuweprijs.toFixed(2); $("#hiddentotaal").val(nieuweprijs); $("#totaalprijs").html("Totaal: €"+nieuweprijs+""); stap3naar4(); }); //$("#ap_riverty").click(function() { // $("#gekozenbetaalmethode").val("ap_riverty"); // $("#transactiekosten").val(0); // // var tmphiddentotaal = parseFloat($("#hiddentotaal").val()); // var tmpkosten = parseFloat(afterpay_riverty_kosten); // // var nieuweprijs = tmphiddentotaal + tmpkosten; // var nieuweprijs = nieuweprijs.toFixed(2); // // $("#hiddentotaal").val(nieuweprijs); // // $("#totaalprijs").html("Totaal: €"+nieuweprijs+""); // // $("#idealdiv").slideUp("fast"); // $("#afterpay_riverty_div").slideDown("fast"); //}); $("#pp").click(function() { $("#gekozenbetaalmethode").val("pp"); $("#transactiekosten").val(0); var tmphiddentotaal = parseFloat($("#hiddentotaal").val()); var tmpkosten = parseFloat(paypalkosten); var nieuweprijs = tmphiddentotaal + tmpkosten; var nieuweprijs = nieuweprijs.toFixed(2); $("#hiddentotaal").val(nieuweprijs); $("#totaalprijs").html("Totaal: €"+nieuweprijs+""); stap3naar4(); }); $("#bitcoin").click(function() { $("#gekozenbetaalmethode").val("bitcoin"); stap3naar4(); }); /* $("#afleverpostcode,#afleverhuisnummer").blur(function() { var postc = $('#afleverpostcode').val(); postc = postc.toUpperCase(); var huisnr = $('#afleverhuisnummer').val(); if (!postc || !huisnr) { // } else { $.ajax({ url: 'https://www.ballonnenservice.nl/functions/postcodecheck.php', type: 'GET', dataType: 'json', data: 'postc=' + postc + '&huisnr=' + huisnr, success: function(result) { if (result.postcode == postc) { $('#afleveradres').val(result.street); } else { // bestaat niet } }, }); return false; } }); */ var soortklant = ""; var foutgevondenstap1 = true; var foutgevondenstap2 = true; function stap1naar2() { $("#stap3").slideUp("slow"); $("#stap1").slideUp("slow"); $("#stap4").slideUp("slow"); $("#stap2").slideDown("slow"); } function stap2naar1() { $("#stap3").slideUp("slow"); $("#stap2").slideUp("slow"); $("#stap4").slideUp("slow"); $("#stap1").slideDown("slow"); } function stap2naar3() { $("#stap1").slideUp("slow"); $("#stap2").slideUp("slow"); $("#stap4").slideUp("slow"); $("#stap3").slideDown("slow"); var stap23totaal = $("#hiddentotaal").val(); // paypalkosten = stap23totaal * 0.03; // creditcardkosten = stap23totaal * 0.03; //afterpay_riverty_kosten = 0; afterpay_klarna_kosten = 0; paypalkosten = paypalkosten.toFixed(2); creditcardkosten = creditcardkosten.toFixed(2); //$("#pp").val("PayPal (+ € "+paypalkosten+")"); //$("#cc").val("Creditcard (+ € "+creditcardkosten+")"); //$("#ap_riverty").val("Riverty/Afterpay (+ € "+afterpay_riverty_kosten+")"); if (afhalengeklikt == 1) { var afhaaldatum = $("#hiddenafhaaldate").val(); var afhaaltijd = $("#afhaaltime").val(); $("#datumtijdtxt").html(""+afhaaltijd+" op "+afhaaldatum); } } function stap3naar2() { $("#stap1").slideUp("slow"); $("#stap2").slideDown("slow"); $("#stap4").slideUp("slow"); $("#stap3").slideUp("slow"); } function stap3naar4() { // alle velden weer wit kleuren (voor als er eerder een fout was) $("input[type='text']").css("background-color", "#FFFFFF"); foutgevondenstap3 = false; if (soortklant == "particulier" && $("#gekozenbetaalmethode").val() == "ap_klarna") { if (!$.trim($("#ap_klarna_voorletters").val()).length) { foutgevondenstap3 = true; $("#ap_klarna_voorletters").css("background-color", "#ffddd0"); } if (!$.trim($("#ap_klarna_achternaam").val()).length) { foutgevondenstap3 = true; $("#ap_klarna_achternaam").css("background-color", "#ffddd0"); } let dateValue = $.trim($("#ap_klarna_geboortedatum").val()); let datePattern = /^\d{2}-\d{2}-\d{4}$/; if (!dateValue.length || dateValue.length != 10 || !dateValue.match(datePattern)) { foutgevondenstap3 = true; $("#ap_klarna_geboortedatum").css("background-color", "#ffddd0"); } } if (foutgevondenstap3) { return; } if (soortklant == "bedrijf") { $("#stap4bedrijfsnaam").html($("#company").val()); $("#stap4contactpersoon").html($("#name").val()); $("#stap4adres").html(""+$("#address").val()+" "+$("#huisnummer").val()+""); $("#stap4postcodeplaats").html(""+$("#postcode").val()+" "+$("#city").val()+""); $("#stap4telefoon").html($("#phone").val()); $("#stap4email").html($("#email").val()); $("#stap4bedrijfsnaam").show(); $("#stap4contactpersoon").show(); $("#stap4adres").show(); $("#stap4postcodeplaats").show(); $("#stap4telefoon").show(); $("#stap4email").show(); } if (soortklant == "particulier") { $("#stap4contactpersoon").html($("#pname").val()); $("#stap4adres").html(""+$("#paddress").val()+" "+$("#phuisnummer").val()+""); $("#stap4postcodeplaats").html(""+$("#ppostcode").val()+" "+$("#pcity").val()+""); $("#stap4telefoon").html($("#pphone").val()); $("#stap4email").html($("#pemail").val()); $("#stap4contactpersoon").show(); $("#stap4adres").show(); $("#stap4postcodeplaats").show(); $("#stap4telefoon").show(); $("#stap4email").show(); } $("#stap4afleverbedrijfsnaam").html($("#afleverbedrijfsnaam").val()); $("#stap4aflevercontactpersoon").html($("#aflevernaam").val()); $("#stap4afleveradres").html(""+$("#afleveradres").val()+" "+$("#afleverhuisnummer").val()+""); $("#stap4afleverpostcodeplaats").html(""+$("#afleverpostcode").val()+" "+$("#afleverplaats").val()+""); $("#stap4aflevertelefoon").html($("#aflevertelefoon").val()); $("#stap4afleverbedrijfsnaam").show(); $("#stap4aflevercontactpersoon").show(); $("#stap4afleveradres").show(); $("#stap4afleverpostcodeplaats").show(); $("#stap4aflevertelefoon").show(); $("#stap1").slideUp("slow"); $("#stap2").slideUp("slow"); $("#stap3").slideUp("slow"); $("#stap4").slideDown("slow"); } function stap4naar3() { $("#stap1").slideUp("slow"); $("#stap2").slideUp("slow"); $("#stap4").slideUp("slow"); $("#stap3").slideDown("slow"); $("#stap4bedrijfsnaam").hide(); $("#stap4contactpersoon").hide(); $("#stap4adres").hide(); $("#stap4postcodeplaats").hide(); $("#stap4telefoon").hide(); $("#stap4email").hide(); $("#stap4afleverbedrijfsnaam").hide(); $("#stap4aflevercontactpersoon").hide(); $("#stap4afleveradres").hide(); $("#stap4afleverpostcodeplaats").hide(); $("#stap4aflevertelefoon").hide(); } $("#bedrijfbutton").click(function() { soortklant = "bedrijf"; $("#particuliergekozen").slideUp("slow"); $("#bedrijfgekozen").slideDown("slow"); $("#stap1naar2").slideDown("slow"); $("#soortklant").val(soortklant); //$("#ap_riverty").hide(); $("#ap_klarna").hide(); $("#or").show(); }); $("#particulierbutton").click(function() { soortklant = "particulier"; $("#bedrijfgekozen").slideUp("slow"); $("#particuliergekozen").slideDown("slow"); $("#stap1naar2").slideDown("slow"); $("#soortklant").val(soortklant); //$("#ap_riverty").show(); $("#ap_klarna").show(); $("#or").hide(); }); // als er op de knop volgende stap wordt gedrukt $("#stap1naar2").click(function() { // alle velden weer wit kleuren (voor als er eerder een fout was) $("input[type='text']").css("background-color", "#FFFFFF"); foutgevondenstap1 = false; // als er gekozen is voor bedrijf if (soortklant == "bedrijf") { if (!$.trim($("#company").val()).length) { foutgevondenstap1 = true; $("#company").css("background-color", "#ffddd0"); } // hier controles voor andere velden if (!$.trim($("#name").val()).length) { foutgevondenstap1 = true; $("#name").css("background-color", "#ffddd0"); } if (!$.trim($("#address").val()).length) { foutgevondenstap1 = true; $("#address").css("background-color", "#ffddd0"); } if (!$.trim($("#huisnummer").val()).length) { foutgevondenstap1 = true; $("#huisnummer").css("background-color", "#ffddd0"); } if (!$.trim($("#postcode").val()).length) { foutgevondenstap1 = true; $("#postcode").css("background-color", "#ffddd0"); } if (!$.trim($("#city").val()).length) { foutgevondenstap1 = true; $("#city").css("background-color", "#ffddd0"); } if (!$.trim($("#phone").val()).length) { foutgevondenstap1 = true; $("#phone").css("background-color", "#ffddd0"); } if (!validateEmail($("#email").val()) || (!$.trim($("#email").val()).length)) { foutgevondenstap1 = true; $("#email").css("background-color", "#ffddd0"); } if ($("#email").val() != $("#bevestigemail").val()) { foutgevondenstap1 = true; $("#email").css("background-color", "#ffddd0"); $("#bevestigemail").css("background-color", "#ffddd0"); } if ($.trim($("#factuuremail").val()).length) { if (!validateEmail($("#factuuremail").val())) { foutgevondenstap1 = true; $("#factuuremail").css("background-color", "#ffddd0"); } } // hier een functie voor als er dus geen fout gevonden is if (foutgevondenstap1 == false) { stap1naar2(); } } // als er gekozen is voor particulier if (soortklant == "particulier") { if (!$.trim($("#paddress").val()).length) { foutgevondenstap1 = true; $("#paddress").css("background-color", "#ffddd0"); } if (!$.trim($("#ppostcode").val()).length) { foutgevondenstap1 = true; $("#ppostcode").css("background-color", "#ffddd0"); } if (!$.trim($("#phuisnummer").val()).length) { foutgevondenstap1 = true; $("#phuisnummer").css("background-color", "#ffddd0"); } if (!$.trim($("#pcity").val()).length) { foutgevondenstap1 = true; $("#pcity").css("background-color", "#ffddd0"); } if (!$.trim($("#pname").val()).length) { foutgevondenstap1 = true; $("#pname").css("background-color", "#ffddd0"); } if (!$.trim($("#pphone").val()).length) { foutgevondenstap1 = true; $("#pphone").css("background-color", "#ffddd0"); } if (!validateEmail($("#pemail").val()) || (!$.trim($("#pemail").val()).length)) { foutgevondenstap1 = true; $("#pemail").css("background-color", "#ffddd0"); } if ($("#pemail").val() != $("#pbevestigemail").val()) { foutgevondenstap1 = true; $("#pemail").css("background-color", "#ffddd0"); $("#pbevestigemail").css("background-color", "#ffddd0"); } // hier een functie voor als er dus geen fout gevonden is if (foutgevondenstap1 == false) { stap1naar2(); } } }); $("#stap2naar3").click(function() { // alle velden weer wit kleuren (voor als er eerder een fout was) $("input[type='text']").css("background-color", "#FFFFFF"); foutgevondenstap2 = false; if ($("#hiddenafhalen").val() == 0) { // als er gekozen is voor bedrijf if (soortklant == "bedrijf") { if (!$.trim($("#aflevernaam").val()).length) { foutgevondenstap1 = true; $("#aflevernaam").css("background-color", "#ffddd0"); } // hier controles voor andere velden if (!$.trim($("#afleveradres").val()).length) { foutgevondenstap2 = true; $("#afleveradres").css("background-color", "#ffddd0"); } if (!$.trim($("#afleverpostcode").val()).length) { foutgevondenstap2 = true; $("#afleverpostcode").css("background-color", "#ffddd0"); } if (!$.trim($("#afleverhuisnummer").val()).length) { foutgevondenstap2 = true; $("#afleverhuisnummer").css("background-color", "#ffddd0"); } if (!$.trim($("#afleverplaats").val()).length) { foutgevondenstap2 = true; $("#afleverplaats").css("background-color", "#ffddd0"); } if (!$.trim($("#aflevertelefoon").val()).length) { foutgevondenstap2 = true; $("#aflevertelefoon").css("background-color", "#ffddd0"); } } // als er gekozen is voor particulier if (soortklant == "particulier") { if (!$.trim($("#aflevernaam").val()).length) { foutgevondenstap2 = true; $("#aflevernaam").css("background-color", "#ffddd0"); } // hier controles voor andere velden if (!$.trim($("#afleveradres").val()).length) { foutgevondenstap2 = true; $("#afleveradres").css("background-color", "#ffddd0"); } if (!$.trim($("#afleverpostcode").val()).length) { foutgevondenstap2 = true; $("#afleverpostcode").css("background-color", "#ffddd0"); } if (!$.trim($("#afleverplaats").val()).length) { foutgevondenstap2 = true; $("#afleverplaats").css("background-color", "#ffddd0"); } } } else { //$("#ap_riverty").hide(); $("#ap_klarna").hide(); } if (foutgevondenstap2 == false) { stap2naar3(); } }); // deze functie wordt gebruikt om een veld weer wit te kleuren als er in getypt wordt, zo zie je meteen dat je iets weer goed hebt gedaan $("input[type='text']").keydown(function() { $(this).css("background-color", "#FFFFFF"); }); $("#stap2naar1").click(function() { stap2naar1(); }); $("#stap3naar2").click(function() { stap3naar2(); }); $("#stap3naar4").click(function() { stap3naar4(); }); $("#stap4naar3").click(function() { stap4naar3(); }); /* $("#kopstap1").click(function() { stap2naar1(); }); */ /* $("#kopstap2").click(function() { stap1naar2(); }); */ /* $("#kopstap2").click(function() { stap1naar2(); }); */ /* $("#kopstap3").click(function() { stap2naar3(); }); */ $.datepicker.setDefaults($.datepicker.regional['nl']); $("#afleverdatum").datepicker({minDate: +2, numberOfMonths: 3, dateFormat: "dd-mm-yy"}); $('#offerteform').on('keyup keypress', function(e) { var code = e.keyCode || e.which; if (code == 13) { e.preventDefault(); return false; } }); $("#afhalenbutton").click(function() { $("#rekensomverzendkosten").hide(); $("#rbezorgkostentxt").hide(); $("#bezorgendiv").slideUp("fast"); $("#afhalen").val("true"); stap2naar3(); }); $("#bezorgenbutton").click(function() { $("#bezorgendiv").slideDown("fast"); $("#afhalen").val("false"); }); $("#berekenpostcode").click(function() { //$("#rekensom").slideUp("fast"); //$("#rekensomverzendkosten").html("€6,05"); //$("#rekensom").slideDown("fast"); $("#datepicker").slideDown("fast"); }); /* $(".verzendkostenkiezen").click(function() { $("#rekensom").slideUp("fast"); $(".verzendkostenkiezen").css("background-color", "#eaeaea"); $(".verzendkostenkiezen").css("color", "#000000"); $(this).css("background-color", "#3171cd"); $(this).css("color", "#FFFFFF"); var verzendprijs = $(this).data("verzendprijs"); verzendprijs = parseFloat(verzendprijs); verzendprijsformat = verzendprijs.toFixed(2); $("#rekensomverzendkosten").html("€"+verzendprijsformat); $("#hiddenverzendkosten").val(verzendprijsformat); var subtotaal = $("#rekensomsubtotaal").html(); subtotaal = subtotaal.replace("€", ""); subtotaal = subtotaal.replace("€", ""); subtotaal = parseFloat(subtotaal); var newsubtotaal = subtotaal + verzendprijs; newsubtotaal = newsubtotaal.toFixed(2); $("#hiddentotaal").val(newsubtotaal); var btw = (newsubtotaal/100)*21; btw = btw.toFixed(2); $("#rekensombtw").html("€"+btw); $("#rekensomtotaal").html("€"+newsubtotaal); $("#rekensom").slideDown("fast"); }); */ $("#anderbezorgadresja").click(function() { $("#anderbezorgadresdiv").slideUp('fast'); }); $("#anderbezorgadresnee").click(function() { $("#anderbezorgadresdiv").slideDown('fast'); }); function cartToAfhalen() { afhalengeklikt = 1; var verzendprijs = 0.00; verzendprijs = parseFloat(verzendprijs); verzendprijsformat = verzendprijs.toFixed(2); $("#afleverinfotxt").html("Gekozen voor afhalen in Aalsmeer:"); var afhaaltijd = $("#afhaaltime").val(); var afhaaldatum = $("#hiddenafhaaldate").val(); $("#datumtijdtxt").html(""+afhaaltijd+" op "+afhaaldatum); $("#rekensomverzendkosten").html("€"+verzendprijsformat); $("#hiddenverzendkosten").val(verzendprijsformat); var subtotaal = $("#rekensomsubtotaal").html(); subtotaal = subtotaal.replace("€", ""); subtotaal = subtotaal.replace("€", ""); subtotaal = parseFloat(subtotaal); var newsubtotaal = subtotaal + verzendprijs; newsubtotaal = newsubtotaal * 1.21; newsubtotaal = newsubtotaal.toFixed(2); $("#hiddentotaal").val(newsubtotaal); var btw = (newsubtotaal/100)*21; btw = btw.toFixed(2); $("#rekensombtw").html("€"+btw); $("#rekensomtotaal").html("€"+newsubtotaal); $("#totaalprijs").html("totaal: €"+newsubtotaal); $("#totaalprijs").data("totaalprijs", ""+newsubtotaal+""); $("#rekensomverzendkosten").hide(); $("#rbezorgkostentxt").hide(); $("#rekensomverzendkosten").html(""); //$("#volgendestap").show("fast"); $("#afhalendivstap2").show(); $("#bezorgendivstap2").hide(); $("#afleverplaats").prop('disabled', false); $("#hiddenafhalen").val("1"); $("#stap2koptxt").html("Afhaal informatie"); $("#contant").show(); $(this).hide("fast"); cartVolgendeStap(); } $(".to-afhalen").click(cartToAfhalen); $("#verzendenbtn").click(function() { var verzendprijs = 6.95; verzendprijs = parseFloat(verzendprijs); verzendprijsformat = verzendprijs.toFixed(2); $("#opmerkingenchauffeurdiv").hide(); $("#afleverdatumtijdkolom").hide(); $("#rekensomverzendkosten").html("€"+verzendprijsformat); $("#hiddenverzendkosten").val(verzendprijsformat); $("#verzendenmetpostnl").val("1"); var subtotaal = $("#rekensomsubtotaal").html(); subtotaal = subtotaal.replace("€", ""); subtotaal = subtotaal.replace("€", ""); subtotaal = parseFloat(subtotaal); var newsubtotaal = subtotaal + verzendprijs; newsubtotaal = newsubtotaal * 1.21; newsubtotaal = newsubtotaal.toFixed(2); $("#hiddentotaal").val(newsubtotaal); var btw = (newsubtotaal/100)*21; btw = btw.toFixed(2); $("#rekensombtw").html("€"+btw); $("#rekensomtotaal").html("€"+newsubtotaal); $("#totaalprijs").html("totaal: €"+newsubtotaal); $("#totaalprijs").data("totaalprijs", ""+newsubtotaal+""); $("#rekensomverzendkosten").show(); $("#rbezorgkostentxt").show(); $("#afhalendivstap2").hide(); $("#bezorgendivstap2").show(); $("#afleverplaats").prop('disabled', false); $("#volgendestap").show("fast"); $("#hiddenafhalen").val("0"); $("#contant").hide(); }); function cartVolgendeStap() { //$("#colorCntr").slideUp("fast"); $(".opties").hide(); $(".verzendkosten").hide(); $(".rekensom").hide(); $("#datepickerbis").hide(); $("#datepickerbis2").hide(); $("#bezorgkostennewhuur2").slideUp("fast"); $("#huurbuttons2").slideUp("fast"); $("#bestellendiv").slideDown("fast"); $("#volgendestap").hide(); //$("#vorigestap").show(); $("#topmenutxt").html("Bestellen"); //$("html, body").animate({scrollTop: 0}, "slow"); } $("#volgendestap").click(cartVolgendeStap); $("#vorigestap").click(function() { $(".opties").show(); $(".verzendkosten").show(); $(".rekensom").show(); $("#datepickerbis").show(); $("#bestellendiv").slideUp("fast"); $("#colorCntr").slideDown("fast"); $("#vorigestap").hide(); $("#volgendestap").show(); $("#topmenutxt").html("Winkelmandje"); $("#datepickerbis2").show(); $("#bezorgkostennewhuur2").slideDown("fast"); $("#huurbuttons2").slideDown("fast"); //$("html, body").animate({scrollTop: 0}, "slow"); }) $("#huurafhaalgekozen").click(function() { $("#normaldatepicker").slideUp("fast"); $("#huurbuttons2").slideDown("fast"); var huurdatumgekozen = $("#ndatepickerval").val(); var huurtijdgekozen = $("#afhaaltijd").val(); $("#stap4afleverdatumtijd").html("Afhalen op: "+huurdatumgekozen+" - "+huurtijdgekozen+""); $("#stap4afleverdatumtijd").show(); }) $("#postcode,#huisnummer").blur(function() { var postc = $('#postcode').val(); postc = postc.toUpperCase(); var huisnummer = $('#huisnummer').val(); var huisnr = huisnummer; if (!postc || !huisnr) { // } else { $.ajax({ url: 'https://www.ballonnenservice.nl/javascripts/postcodecheck.php', type: 'GET', dataType: 'json', data: 'postc=' + postc + '&huisnr=' + huisnr, success: function(result) { if (result.postcode == postc) { $('#plaats').val(result.city); $('#adres').val(result.street); } else { // bestaat niet } }, }); return false; } }); $("#bpostcode,#bhuisnummer").blur(function() { var postc = $('#bpostcode').val(); postc = postc.toUpperCase(); var huisnummer = $('#bhuisnummer').val(); var huisnr = huisnummer; if (!postc || !huisnr) { // } else { $.ajax({ url: 'https://www.ballonnenservice.nl/javascripts/postcodecheck.php', type: 'GET', dataType: 'json', data: 'postc=' + postc + '&huisnr=' + huisnr, success: function(result) { if (result.postcode == postc) { $('#bplaats').val(result.city); $('#badres').val(result.street); } else { // bestaat niet } }, }); return false; } }); $("#plaats").keydown(function() { $("#datepickerbis").slideUp("fast"); $("volgendestap").hide("fast"); $("#rekensomverzendkosten").hide(); $("#rbezorgkostentxt").hide(); var verzendprijs = 0.00; verzendprijs = parseFloat(verzendprijs); verzendprijs = verzendprijs / 1.21; verzendprijsformat = verzendprijs.toFixed(2); verzendprijsformatshow = verzendprijs / 1.21; verzendprijsformatshow = verzendprijsformatshow.toFixed(2); $("#rekensomverzendkosten").html("€"+verzendprijsformatshow); $("#hiddenverzendkosten").val(verzendprijsformat); var subtotaal = $("#rekensomsubtotaal").html(); subtotaal = subtotaal.replace("€", ""); subtotaal = subtotaal.replace("€", ""); var newsubtotaal = subtotaal + verzendprijs; newsubtotaal = newsubtotaal.toFixed(2); $("#hiddentotaal").val(newsubtotaal); var btw = (newsubtotaal/100)*21; btw = btw.toFixed(2); $("#rekensombtw").html("€"+btw); $("#rekensomtotaal").html("€"+newsubtotaal * 1.21); $("#totaalprijs").html("totaal: €"+newsubtotaal); $("#totaalprijs").data("totaalprijs", ""+newsubtotaal+""); }); $("#plaats2").keydown(function() { $("#datepickerbis2").slideUp("fast"); $("volgendestap").hide("fast"); $("#rekensomverzendkosten").hide(); $("#rbezorgkostentxt").hide(); var verzendprijs = 0.00; verzendprijs = parseFloat(verzendprijs); verzendprijs = verzendprijs / 1.21; verzendprijsformat = verzendprijs.toFixed(2); verzendprijsformatshow = verzendprijs / 1.21; verzendprijsformatshow = verzendprijsformatshow.toFixed(2); $("#rekensomverzendkosten").html("€"+verzendprijsformatshow); $("#hiddenverzendkosten").val(verzendprijsformat); var subtotaal = $("#rekensomsubtotaal").html(); subtotaal = subtotaal.replace("€", ""); subtotaal = subtotaal.replace("€", ""); subtotaal = parseFloat(subtotaal); var newsubtotaal = subtotaal + verzendprijs; newsubtotaal = newsubtotaal.toFixed(2); $("#hiddentotaal").val(newsubtotaal); var btw = (newsubtotaal/100)*21; btw = btw.toFixed(2); $("#rekensombtw").html("€"+btw); $("#rekensomtotaal").html("€"+newsubtotaal); $("#totaalprijs").html("totaal: €"+newsubtotaal); $("#totaalprijs").data("totaalprijs", ""+newsubtotaal+""); }); $(".betaalwijze").click(function() { $("#betaalwijzesknoppen").show("fast"); }); $('#email').bind("cut copy paste", function(e) { e.preventDefault(); }); $('#pemail').bind("cut copy paste", function(e) { e.preventDefault(); }); $('#pbevestigemail').bind("cut copy paste", function(e) { e.preventDefault(); }); $('#bevestigemail').bind("cut copy paste", function(e) { e.preventDefault(); }); $("#copy").click(function() { if (soortklant == "particulier") { var contactpersoon = $("#pname").val(); $("#aflevernaam").val(contactpersoon); var telefoon = $("#pphone").val(); $("#aflevertelefoon").val(telefoon); var postcode = $("#ppostcode").val(); $("#afleverpostcode").val(postcode); var huisnummer = $("#phuisnummer").val(); $("#afleverhuisnummer").val(huisnummer); var adres = $("#paddress").val(); $("#afleveradres").val(adres); } if (soortklant == "bedrijf") { var bedrijfsnaam = $("#company").val(); $("#afleverbedrijfsnaam").val(bedrijfsnaam); var contactpersoon = $("#name").val(); $("#aflevernaam").val(contactpersoon); var telefoon = $("#phone").val(); $("#aflevertelefoon").val(telefoon); var postcode = $("#postcode").val(); $("#afleverpostcode").val(postcode); var huisnummer = $("#huisnummer").val(); $("#afleverhuisnummer").val(huisnummer); var adres = $("#address").val(); $("#afleveradres").val(adres); } $("#copy").slideUp("fast"); }); $("#voltooien").click(function() { if ($("#algemenevoorwaarden").is(':checked')) { document.querySelector('#order').submit(); } else { alert('U dient akkoord te gaan met de algemene voorwaarden'); } }); $("#verdermetbestellenoud").click(function() { $("#knoppenwinkelwagen").slideUp("fast"); $("#bezorgkostennew").slideDown("fast"); $(".verzendkosten").slideDown("fast"); $("#huurbuttons").slideDown("fast"); $("#plaats").focus(); }); $("#verdermetbestellennew").click(function() { $("#knoppenwinkelwagen").slideUp("fast"); $("#rekensom").slideUp("fast"); $("#totalCntr").slideUp("fast"); $(".verzendkosten").slideUp("fast"); //$("#bezorgkostennew").slideDown("fast"); //$("#plaats").focus(); $("#extraproductencart").slideDown("fast"); }); $("#doorgaanextra").click(function() { $("#extraproductencart").slideUp("fast"); $("#bezorgkostennew").slideDown("fast"); $("#rekensom").slideDown("fast"); $(".verzendkosten").slideDown("fast"); $("#huurbuttons").slideDown("fast"); $("#totalCntr").slideDown("fast"); $("#plaats").focus(); //$("#bezorgkostennewhuur").slideDown("fast"); }); $("#huurafhalen").click(function() { $("#huurbuttons").slideUp("fast"); //$("#huurbuttons2").slideDown("fast"); afhaalcheck = 1; $("#normaldatepicker").slideDown("fast"); }); $("#huurbezorgen").click(function() { $("#huurbuttons").slideUp("fast"); $("#bezorgkostennewhuur").slideDown("fast"); $("#rekensom").slideDown("fast"); $(".verzendkostenhuur").slideDown("fast"); $("#totalCntr").slideDown("fast"); $("#plaats").focus(); huurcheck = 1; }); $("#volgendestaphuur").click(function() { $("#volgendestaphuur").hide("fast"); $(".verzendkostenhuur").slideUp("fast"); $(".verzendkosten").slideUp("fast"); $("#datepickerbis").slideUp("fast"); $("#huurbuttons2").slideDown("fast"); $("html, body").animate({scrollTop: 0}, 600); }); $("#huurterugbrengen").click(function() { //$("#huurbuttons2").slideUp("fast"); $("#bestellendiv").slideDown("fast"); $("#datepickerbis2").slideUp("fast"); $("#bezorgkostennewhuur2").slideUp("fast"); $("#huurophalen").css("background-color", "#3171cd"); $(this).css("background-color", "#00891A"); $("#rafhaalkostentxt").hide(); $("#rekensomafhaalkosten").hide(); $("#retour").val("Zelf terugbrengen"); $(".opties").hide(); $(".rekensom").hide(); $("#huurbuttons2").slideUp("fast"); var verzendprijs = $("#hiddenverzendkosten").val(); verzendprijs = parseFloat(verzendprijs); verzendprijsformat = verzendprijs.toFixed(2); verzendprijsformatshow = verzendprijs / 1.21; verzendprijsformatshow = verzendprijsformatshow.toFixed(2); $("#rekensomverzendkosten").html("€"+verzendprijsformatshow); $("#hiddenverzendkosten").val(verzendprijsformat); var subtotaal = $("#rekensomsubtotaal").html(); subtotaal = subtotaal.replace("€", ""); subtotaal = subtotaal.replace("€", ""); subtotaal = parseFloat(subtotaal); var newsubtotaal = subtotaal + verzendprijs; newsubtotaal = newsubtotaal * 1.21; newsubtotaal = newsubtotaal.toFixed(2); $("#hiddentotaal").val(newsubtotaal); var btw = (newsubtotaal/100)*21; btw = btw.toFixed(2); $("#rekensombtw").html("€"+btw); $("#rekensomtotaal").html("€"+newsubtotaal); $("#totaalprijs").html("totaal: €"+newsubtotaal); $("#totaalprijs").data("totaalprijs", ""+newsubtotaal+""); if (afhaalcheck == 0) { $("#rekensomverzendkosten").show(); $("#rbezorgkostentxt").show(); } huurcheck = 0; }); $("#huurophalen").click(function() { //$("#huurbuttons2").slideUp("fast"); $("#rekensom").slideDown("fast"); $(".verzendkostenhuur2").slideDown("fast"); $("#totalCntr").slideDown("fast"); $("#plaats2").focus(); $("#datepickerbis2").slideDown("fast"); $("#bezorgkostennewhuur2").slideDown("fast"); $("#huurterugbrengen").css("background-color", "#3171cd"); $(this).css("background-color", "#00891A"); $("#retour").val("Op laten halen"); huurcheck = 0; }); }); $(document).on('click', '.vzk', function() { $(".vzk").css("background-color", "#eaeaea"); $(".vzk").css("color", "#000000"); $(this).css("background-color", "#3171cd"); $(this).css("color", "#FFFFFF"); $("#succeedtijdvakmelding").slideUp("fast"); var afleverdatum = $(this).data("datum"); var afleverdatumnl = $(this).data("datumnl"); var aflevertijd = $(this).data("tijd"); $("#aafleverdatum").val(afleverdatum); $("#aflevertijd").val(aflevertijd); $("#stap4afleverdatumtijd").html("Bezorgen op: "+afleverdatumnl+" - "+aflevertijd+""); $("#stap4afleverdatumtijd").show(); var verzendprijs = $(this).data("verzendprijs"); verzendprijs = parseFloat(verzendprijs); verzendprijsformat = verzendprijs.toFixed(2); verzendprijsformatshow = verzendprijs / 1.21; verzendprijsformatshow = verzendprijsformatshow.toFixed(2); $("#rekensomverzendkosten").html("€" + verzendprijsformat); $("#hiddenverzendkosten").val(verzendprijsformat); var subtotaal = $("#rekensomsubtotaal").html(); subtotaal = subtotaal.replace("€", ""); subtotaal = subtotaal.replace("€", ""); subtotaalfloat = parseFloat(subtotaal); subtotaalbtw = (subtotaalfloat + verzendprijs) * 0.21; subtotaalenverzendprijs = subtotaalfloat + verzendprijs; subtotaalverzendprijsbtwtotaal = subtotaalenverzendprijs + subtotaalbtw; subtotaalverzendprijsbtwtotaal = subtotaalverzendprijsbtwtotaal.toFixed(2); subtotaalbtw = subtotaalbtw.toFixed(2); subtotaal = subtotaal * 1.21; subtotaal = parseFloat(subtotaal); var newsubtotaal = subtotaal + verzendprijs; newsubtotaal = newsubtotaal.toFixed(2); $("#hiddentotaal").val(subtotaalverzendprijsbtwtotaal); // var btw = newsubtotaal * 0.21; // btw = btw.toFixed(2); $("#rekensombtw").html("€"+subtotaalbtw); $("#rekensomtotaal").html("€"+subtotaalverzendprijsbtwtotaal); $("#totaalprijs").html("totaal: €"+subtotaalverzendprijsbtwtotaal); $("#totaalprijs").data("totaalprijs", ""+subtotaalverzendprijsbtwtotaal+""); $("#rekensomverzendkosten").show(); $("#rbezorgkostentxt").show(); var resultaatdistance = $("#resultaatdistance").val(); var huuraantal = $("#huuraantal").val(); var afleverdatum = $("#aafleverdatum").val(); $("#datepickerbis2").load("https://www.ballonnenservice.nl/crons/bezorgkosten.php?distance="+resultaatdistance+"&f=afhalen&limit="+huuraantal+"&afleverdatum="+afleverdatum+""); $("#afhalendivstap2").hide(); $("#bezorgendivstap2").show(); var huuraanwezig = $("#huuraanwezig").val(); if (huurcheck == 1 || huuraanwezig == 1) { $("#volgendestaphuur").show("fast"); } else { $("#volgendestap").show("fast"); } }); $(document).on('click', '.afh', function() { $(".afh").css("background-color", "#eaeaea"); $(".afh").css("color", "#000000"); $(this).css("background-color", "#3171cd"); $(this).css("color", "#FFFFFF"); $("#succeedtijdvakmelding").slideUp("fast"); var afhaaldatum = $(this).data("datum"); var afhaaldatumnl = $(this).data("datumnl"); var afhaaltijd = $(this).data("tijd"); $("#ophaaldatum").val(afhaaldatum); $("#ophaaltijd").val(afhaaltijd); $("#stap4ophaaldatumtijd").html("Ophalen op: "+afhaaldatum+" - "+afhaaltijd+""); $("#stap4ophaaldatumtijd").show(); var ophaalprijs = $(this).data("verzendprijs"); ophaalprijs = parseFloat(ophaalprijs); ophaalprijsformat = ophaalprijs.toFixed(2); $("#rekensomafhaalkosten").html("€"+ophaalprijsformat); $("#hiddenophaalkosten").val(ophaalprijsformat); var subtotaal = $("#rekensomsubtotaal").html(); subtotaal = subtotaal.replace("€", ""); subtotaal = subtotaal.replace("€", ""); subtotaal = parseFloat(subtotaal); var verzendkosten = $("#rekensomverzendkosten").html(); verzendkosten = verzendkosten.replace("€", ""); verzendkosten = verzendkosten.replace("€", ""); verzendkosten = parseFloat(verzendkosten); var newsubtotaal = subtotaal + ophaalprijs + verzendkosten; newsubtotaal = newsubtotaal * 1.21; newsubtotaal = newsubtotaal.toFixed(2); $("#hiddentotaal").val(newsubtotaal); var btw = (newsubtotaal / 100) * 21; btw = btw.toFixed(2); $("#rekensombtw").html("€"+btw); $("#rekensomtotaal").html("€"+newsubtotaal); $("#totaalprijs").html("totaal: €"+newsubtotaal); $("#totaalprijs").data("totaalprijs", ""+newsubtotaal+""); $("#rekensomafhaalkosten").show(); $("#rafhaalkostentxt").show(); $("#afhalendivstap2").hide(); $("#bezorgendivstap2").show(); if (huurcheck == 1) { $("#volgendestaphuur2").show("fast"); } else { $("#volgendestap").show("fast"); } }); $(function() { $("#ndatepicker").datepicker({ minDate : 1, beforeShowDay: function(date) { var day = date.getDay(); return [(day != 0), '']; }, dateFormat: 'dd-mm-yy', onSelect: function(date) { $("#ndatepickerval").val(date); var resultaatdistance = $("#resultaatdistance").val(); var huuraantal = $("#huuraantal").val(); $("#datepickerbis2").load("https://www.ballonnenservice.nl/crons/bezorgkosten.php?distance="+resultaatdistance+"&f=afhalen&limit="+huuraantal+"&afleverdatum="+date+""); } }); }); //$(function() { // $("#ap_riverty").tooltip(); //}); $(function() { $("#ap_klarna").tooltip(); }); //$(function() { // $("#ap_riverty_geboortedatum").datepicker({ // dateFormat: 'yy-mm-dd', // changeMonth: true, // changeYear: true, // yearRange: '1920:2006', // onSelect: function(date) { // $("#ap_riverty_geboortedatum").val(date); // } // }); //}); $(function() { $("#ap_klarna_geboortedatum").datepicker({ dateFormat: 'dd-mm-yy', changeMonth: true, changeYear: true, yearRange: '1920:2006', onSelect: function(date) { $("#ap_klarna_geboortedatum").val(date); } }); });