%PDF- %PDF-
Direktori : /var/www/html/buggydubrovnik.com/buggy-booking/ |
Current File : /var/www/html/buggydubrovnik.com/buggy-booking/form.php |
<?php $servername = "localhost"; $username="buggydubrovnik_app_production"; $password="appr-17"; //$username="root"; //$password=""; $db="buggydubrovnik_app_production"; // Create connection $conn = mysqli_connect($servername, $username, $password, $db); mysqli_query($conn,"set names 'utf8'"); $cijena=550; function formatMoney($number, $cents = 1) { // cents: 0=never, 1=if needed, 2=always if (is_numeric($number)) { // a number if (!$number) { // zero $money = ($cents == 2 ? '0.00' : '0'); // output zero } else { // value if (floor($number) == $number) { // whole number $money = number_format($number, ($cents == 2 ? 2 : 0)); // format } else { // cents $money = number_format(round($number, 2), ($cents == 0 ? 0 : 2)); // format } // integer or decimal } // value $money = str_replace(",","[]", $money); $money = str_replace(".",",", $money); $money = str_replace("[]",".", $money); return $money; } // numeric } // formatMoney ?> <style> #seatsInfo { margin: 5px; } #datum { max-width: 250px; } .drzave{width: 400px;} iframe{border: 1px solid #d2d2d2;width:100%; height:200px; overflow:scroll;} .section.group { width: 90%; margin: 0 auto; max-width: 500px; } input, select, option, textarea { color:#333333; padding: 0.2em; } .section.group input { max-width: 400px; } textarea { width: 400px; height: 150px; } .crveno{ color:red; } p.crveno{ margin:0; } @media only screen and (max-width: 800px){ iframe{-webkit-overflow-scrolling:touch} .section.group {width: 100%} textarea {width: 100%;} .drzave{width: 100%;} } </style> <link href="/buggy-booking/pikaday.css" rel="stylesheet" type="text/css" /> <script src="/buggy-booking/gen_validatorv4.js" type="text/javascript"></script> <script src="/buggy-booking/moment.js"></script> <script src="/buggy-booking/pikaday.js"></script> <script src="/buggy-booking/pikaday.jquery.js"></script> <script type="text/javascript"> var month=<?=date("m")?>, day=<?=date("d")?>; var selectedMonth, $vrijeme, $checkmark, $promoID, $seatsInfo, $separate; Number.prototype.padLeft = function (len,chr) { var self = Math.abs(this)+''; return (this<0 && '-' || '')+ (String(Math.pow( 10, (len || 2)-self.length)) .slice(1).replace(/0/g,chr||'0') + self); } jQuery(document).ready(function ($) { $separate=$("#separate"); $vrijeme=$("#vrijeme"); console.log($vrijeme[0]); $checkmark=$("#checkmark"); $seatsInfo=$("#seatsInfo"); var max=new Date(<?=date("Y")+1?>, 9, 31); var currentPromoRequest; $("input[name=promo]").on("keyup", function () { if(currentPromoRequest!=null) currentPromoRequest.abort(); else $checkmark.fadeIn(); $checkmark.attr("src", "/buggy-booking/loading.gif"); currentPromoRequest=$.ajax("/buggy-booking/checkPromo.php?promo="+$(this).val()).done(function (data) { var json=JSON.parse(data); if(json.check) { $checkmark.attr("src", "/buggy-booking/checked.png") alert("The code was valid. You'll be getting an additional "+json.amount+"% discount in the next step.") } else { $checkmark.attr("src", "/buggy-booking/error.png") } }) }) $('#datum').pikaday({ firstDay: 1, format:"DD.MM.YYYY", minDate: new Date(), maxDate:max, disableDayFn: function(theDate) { return true; console.log("yo",theDate>new Date(<?=date("Y")?>, 9, 31) ) if (theDate>new Date(<?=date("Y")?>, 10, 17) && theDate<new Date(<?=date("Y")+1?>, 2, 1)) return true; else return false; }, onSelect: function () { $vrijeme.fadeOut(); var datum=$(this)[0].getDate(); var YMD=datum.getFullYear()+"-"+(datum.getMonth()+1).padLeft(2)+"-"+datum.getDate().padLeft(2); $.ajax("/buggy-booking/getTimes.php?date="+YMD).done(function (data) { $vrijeme.html(data).fadeIn().trigger("change"); $("input[name=date]").val(YMD) }) // $(this)[0].getDate() } }); $vrijeme.on("change", function () { var vehicles=parseInt($(this).find("option:selected").attr("data-free")); var rest=parseInt($(this).find("option:selected").attr("data-rest")); if(vehicles<0) vehicles=0; $seatsInfo.html("There are a total of "+((vehicles*3)+rest)+" seats ("+vehicles+" vehicles) available for this date and time."); }) }) </script> <div class="section group"> <div id="naslov1"> <h1 style="margin-bottom:25px; text-transform:uppercase">GROUP TOUR BOOKING | Buggy Safari Dubrovnik</h1> </div> </div> <div class="section group" style="margin-bottom:25px; margin-top:5px; background-color:#003; height:2px;"></div> <form style="font-weight:normal; text-align:left" id="reservationForm" name="rezizlet" method="post" action="/booking-preview/" > <div class="section group" style="margin-bottom:25px;"> </div> <div class="section group" style="margin-bottom:25px;"> <div class="col span_1_of_4"> <B>PRICE PER PERSON:</B></div><div class="col span_3_of_4"><b><b style="color:#F72A5D; font-size:1.2em;"> <?php echo formatMoney($cijena,2).' HRK </b>' ?> </div> <p class="crveno">*This is not a self driving tour.</p> </div> <div class="section group" style="margin-bottom:5px; margin-top:15px; background-color:#003; height:2px;"></div> <div class="section group" style="margin-bottom:0px;"> <strong>PERSONAL DATA</strong> </div> <div class="section group" style="margin-bottom:10px; margin-top:5px; background-color:#003; height:2px;"></div> <div class="section group" style="margin-bottom:5px;"> <div class="col span_1_of_4">Title: </div> <div class="col span_3_of_4"> <select id="title" name="title"> <option value="Mr">Mr</option> <option value="Ms">Ms</option> <option value="Mrs">Mrs</option> <option value="Miss">Miss</option> </select> </div></div> <div class="section group" style="margin-bottom:5px;"> <div class="col span_1_of_4"> First name: </div> <div class="col span_3_of_4"> <input name="CustomerFirstname" type="text" /></div></div> <div class="section group" style="margin-bottom:5px;"><div class="col span_1_of_4"> Last name: </div><div class="col span_3_of_4"><input name="CustomerSurname" type="text" /></div></div> <div class="section group" style="margin-bottom:5px;"><div class="col span_1_of_4"> Address: </div><div class="col span_3_of_4"><input name="CustomerAddress" type="text" /></div></div> <div class="section group" style="margin-bottom:5px;"><div class="col span_1_of_4"> City: </div><div class="col span_3_of_4"> <input name="CustomerCity" type="text" /></div></div> <div class="section group" style="margin-bottom:5px;"><div class="col span_1_of_4"> ZIP Code:</div><div class="col span_3_of_4"> <input name="CustomerZIP" type="text" /></div></div> <div class="section group" style="margin-bottom:5px;"><div class="col span_1_of_4">Country: </div><div class="col span_3_of_4"><select class="drzave" name="CustomerCountry" > <option selected value="">Please choose your country</option> <?php $countries=$conn->query("SELECT * FROM drzava WHERE aktivan=1 ORDER BY naziv ASC"); while($c=$countries->fetch_assoc()) { ?> <option value="<?=$c["id_drzava"]?>"> <?=$c["naziv"]?> </option> <?php } ?> </select></div></div> <div class="section group" style="margin-bottom:5px;"><div class="col span_1_of_4">Country calling code: </div><div class="col span_3_of_4"><input name="CustomerCode" type="text" style="width:75px;" /></div></div> <div class="section group" style="margin-bottom:5px;"><div class="col span_1_of_4">Telephone: </div><div class="col span_3_of_4"><input name="CustomerPhone" type="text" /></div></div> <div class="section group" style="margin-bottom:25px;"><div class="col span_1_of_4"> E-mail: </div><div class="col span_3_of_4"><input name="CustomerEmail" type="text" /></div></div> <div class="section group" style="margin-bottom:5px; margin-top:15px; background-color:#003; height:2px;"></div> <div class="section group" style="margin-bottom:0px;"> <strong>EXCURSION DATA</strong> </div> <div class="section group" style="margin-bottom:25px;"><div class="col span_1_of_4"> Date and time: </div> <div class="col span_3_of_4"> <input class="date-input" autocomplete="off" type="text" id="datum" /> <select name="vrijeme" id="vrijeme" style="display: none"> </select></div> <p id="seatsInfo"> Please choose a date and time to see the number of available places. <br> </p> <p> For group bookings of 10 persons or more please <a style="text-decoration: underline" href="http://www.buggydubrovnik.com/contact-us/">contact us directly.</a> </p> </div> <div class="section group" style="margin-bottom:10px; margin-top:5px; background-color:#003; height:2px;"></div> <div class="section group" style="margin-bottom:5px;"><div class="col span_1_of_4">Adults: </div><div class="col span_3_of_4"> <input name="odrasli" type="number" value="2" min="0" /></div></div> <div class="section group" style="margin-bottom:5px;"><div class="col span_1_of_4"> Children 6-12:</div><div class="col span_3_of_4"> <input name="djeca" type="number" value="0" min="0" /></div></div> <div class="section group" style="display: none; margin-bottom:5px;"><div class="col span_1_of_4"> Children 0-6:</div><div class="col span_3_of_4"> <input name="djeca0" type="number" value="0" min="0" /></div></div> <div class="" style=" margin-bottom:5px;"><div class="col span_1_of_4"> <p></p> <!-- <input id="separate" name="separate" type="checkbox" value="1" /> I wish to reserve a separate vehicle for each person*</div><div class="col span_3_of_4">--> <!-- <p>*If you choose to reserve a separate vehicle for each person, the base price is 400 HRK (before discounts).</p> </div></div>--> <!-- vidjeti s marinom za kodove za ovaj tu dio. Napraviti animaciju da kada netko upise kod, da mu javi da je ok i da je dobio dogovoreni popust. Popuste hardcodirati, ali u PHP. Ovdje imamo i hidden polje u koje treba upisati vrijednost pridruzenu pojedinom kodu npr 1,2,3,4 itd--> <div class="section group" style="margin-bottom:5px;"> <div class="col span_1_of_4"> Promo code (additional discount): </div> <div class="col span_3_of_4"> <input name="promo" type="text" /> <img id="checkmark" src="/buggy-booking/loading.gif" style="width: 1em; vertical-align: middle; margin-left: 5px; display: none" /> </div> </div> <input name="promo_id" type="hidden" value="0" /> <div class="section group" style="margin-bottom:25px;"><div class="col span_1_of_4">Comment:</div><div class="col span_3_of_4"> <textarea name="komentar" ></textarea> </div></div> <input type="hidden" name="date" /> <div class="section group" style="margin-bottom:25px;" ><div class="col span_1_of_4"></div><div class="col span_3_of_4"> <br /> <iframe id="iframeterms" src="http://buggydubrovnik.com/buggy-booking/terms.html"></iframe><br /><br /><input value="1" id="checkb" type="checkbox" style="width:1.5em; height:1.5em;" name="terms" /> I agree to let Buggy d.o.o process my personal data in order to manage my personal account, in accordance with Buggy d.o.o <a style="color:black; font-size:1.1em" href="javascript:void(0);" NAME="Terms and conditions" title="Terms and conditions " onClick=window.open("http://buggydubrovnik.com/buggy-booking/terms.html","Ratting","width=550,height=500,0,status=0,scrollbars=1");><u>Privacy Notice and Terms and Conditions</u> </a><br /><br /> This is booking form only! If you want to book and pay online click NEXT.<br /> If you want to contact us please do it through our contact form - <a style="color:red; font-size:16px;" href="../contact/">HERE</a> </div> </div> <div class="section group" style="margin-bottom:25px;" ><div class="col span_1_of_4"></div><div class="col span_3_of_4"> <input style="cursor:pointer;" type="button" border="0" id="subbtn" class="fusion-button button-3d button-round button-xlarge button-orange button-1" value="NEXT " /></div> </div> </form> <script> var canSubmitNow=true; function checkSeats(){ console.log($vrijeme[0]) console.log($vrijeme.val()) if($vrijeme.val()===null) { console.log("nevalja?"); alert("Please chose a tour date and time.") return; } else console.log("nije null idem dalje?") var factor=$separate.is(":checked")?1:3; var free=parseInt($vrijeme.find("option:selected").attr("data-free"))*factor+parseInt($vrijeme.find("option:selected").attr("data-rest")) var total=parseInt(jQuery("input[name=odrasli]").val())+parseInt(jQuery("input[name=djeca]").val()) if(total>free) { alert('The number of people you have entered exceeds the number of available seats for this tour. Please try another time or date.') } else if(canSubmitNow) { jQuery("#reservationForm").trigger("submit"); } } jQuery(document).ready(function () { jQuery("#subbtn").on("click", checkSeats) }) </script> <script type="text/javascript"> var frmvalidator = new Validator("rezizlet"); frmvalidator.addValidation("CustomerFirstname","req","Please enter your First Name"); frmvalidator.addValidation("CustomerSurname","req","Please enter your Surname"); frmvalidator.addValidation("CustomerAddress","req","Please enter your Address"); frmvalidator.addValidation("CustomerAddress","req","Please enter your Address"); frmvalidator.addValidation("CustomerCity","req","Please enter your City"); frmvalidator.addValidation("CustomerZIP","req","Please enter your ZIP"); frmvalidator.addValidation("CustomerCountry","req","Please enter your Country"); frmvalidator.addValidation("CustomerCode","req","Please enter your country calling code"); frmvalidator.addValidation("CustomerEmail","req","Please enter your Email"); frmvalidator.addValidation("CustomerEmail","email"); frmvalidator.addValidation("odrasli","req","Please enter number of adults"); frmvalidator.addValidation("odrasli","numeric","Adults must be numeric value"); frmvalidator.addValidation("djeca","numeric","Children must be numeric value"); frmvalidator.addValidation("datum", "req", "Please choose a date"); frmvalidator.addValidation("vrijeme", "req", "Please choose a time") // frmvalidator.addValidation("lokacija","dontselect=0_--Choose location--","Please select pick-up location"); frmvalidator.addValidation("terms","shouldselchk=y","Sorry: you have to agree with terms and conditions!"); </script>