Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <form method="post">
- <p>
- <div id="mrese-form1">*Imię rezerwującego: <input class="input_res" type="text" name="fname" id="fname" size="60" placeholder="Podaj imię osoby składającej rezerwację" value="<?php echo $surnamer; ?>" required></input>
- </div>
- <div id="mrese-form2">*Nazwisko rezerwującego: <input class="input_res" type="text" name="lname" id="lname" size="60" placeholder="Podaj nazwisko osoby składającej rezerwację" value="<?php echo $namer; ?>" required></input>
- </div>
- <div id="mrese-form3">*Telefon: <input class="input_res" type="tel" name="tel" size="60" placeholder="Podaj numer telefonu osoby składającej rezerwację" value="<?php echo $phone; ?>" required></input>
- </div>
- <div id="mrese-form4">Email: <input class="input_res" type="email" name="email" size="60" placeholder="Podaj adres email osoby składającej rezerwację" value="<?php echo $email; ?>">></input>
- </div>
- <div id="data">*Data przyjazdu:</div>
- <div id="mrese-form5"><input class="input_res" type="text" name="date" id="date" placeholder="<?php echo $data=date($date_a); ?>" value="<?php echo $data=date($date_a); ?>" required></input><input type="button" id="btn"><span class="icon-calendar" id="span_cal"></span></input>
- </div>
- <div id="data1">*Data wyjazdu:</div>
- <div id="mrese-form6"><input class="input_res" type="text" name="date1" id="date1" placeholder="<?php echo $data=date($date_d); ?>" value="<?php echo $data=date($date_d); ?>" required></input><input type="button" id="btn1"><span class="icon-calendar" id="span_cal1"></span></input>
- </div>
- <div id="mrese-form7">*Liczba dorosłych: <input class="input_res_nr" type="number" name="counta" id="counta" size="60" placeholder="0" value="<?php echo $counta; ?>" required></input>
- </div>
- <div id="mrese-form8">*Cena za pobyt dorosłych: <select name="types_a" id="types_a" required> <?php echo get_options_a($selected, $owner_id,$pricea,$priceat); ?> </select> zł/osobodoba</div>
- <div id="mrese-form9">*Liczba dzieci: <input class="input_res_nr" type="number" id="countc" name="countc" size="60" placeholder="0" value="<?php echo $countc; ?>"></input>
- </div>
- <div id="mrese-form10"><button id="add" class="btn btn-info">Dodaj dziecko</button><br><br></div>
- <!--wiek-->
- <div id="mrese-form11">
- <?php echo '*Wiek dziecka 1: <input class="input_age" type="text" name="age_c1" value="'.$wiek[1].'"/>lat Cena za pobyt dziecka 1: <select id= "types_c1" name = "types_c1">'. get_options_c($selected,$owner_id,$ceny_c[1],$ceny_ct[1]).'</select> zł/osobodoba';
- for($i = 2; $i<$countc+1;$i++){
- echo ' <div class="chi"> *Wiek dziecka '.$i.': <input class="input_age" type="text" name="age_c'.$i.'" value="'.$wiek[$i].'"/>lat Cena za pobyt dziecka '.$i.': <select id= "types_c'.$i.'" name = "types_c'.$i.'">'.get_options_c($selected,$owner_id,$ceny_c[$i],$ceny_ct[$i]).'</select> zł/osobodoba <button class="delete">-</button></div>';
- }
- ?>
- </div><br>
- <div id="mrese-form12">*Liczba zwierząt domowych: <input class="input_res_nr" type="number" id="countp" name="countp" size="60" placeholder="0" value="<?php echo $countp; ?>" readonly></input>
- </div>
- <div id="mrese-form13"><button id="add2" class="btn btn-info">Dodaj zwierzę</button><br><br></div>
- <!--typ zwierzęcia domowego 1...n-->
- <div id="mrese-form14">
- <?php
- echo '*Typ zwierzęcia 1: <input class="input_pets" type="text" name="type_p1" value="'.$typ[1].'"/> Cena za pobyt zwierzęcia 1: <select id = "types_p1" name = "types_p1">'.get_options_p($selected,$owner_id,$ceny_p[1],$ceny_pt[1]).'</select> zł/doba<br>';
- for($i = 2; $i<$countp+1;$i++){
- echo ' <div class="pe"> *Typ zwierzęcia '.$i.': <input class="input_pets" type="text" name="type_p'.$i.'" value="'.$typ[$i].'"/> Cena za pobyt zwierzęcia '.$i.': <select id = "types_p'.$i.'" name = "types_p'.$i.'">'.get_options_p($selected,$owner_id,$ceny_p[$i],$ceny_pt[$i]).'</select> zł/doba <button class="delete2">-</button></div>';
- }
- echo '<br>';
- ?>
- </div>
- <!--cena za pobyt zwierzęcia domowego 1...n-->
- <div id="mrese-form15">Cena za pokój: <select class="input_res" name="types_r" id="types_r"> <?php echo get_options_r($selected, $owner_id, $pricer,$pricert); ?> </select> zł/doba</div>
- <div id="mrese-form16">Łącznie za dobę: <input class="input_res_nr" type="number" name="suma_d" id="suma_d" size="60" placeholder="0" value="<?php echo $priceacc; ?>" readonly></input> zł</div>
- <div id="mrese-form17">Rabat: <input class="input_res_nr" type="number" name="rabat" id="rabat" size="60" placeholder="0" value="<?php echo $rabatc; ?>"></input>
- </div>
- <div id="mrese-form24"> <select name="types_rb" id="types_rb" required> <?php echo get_options_rb($selected, $rabatjj); ?> </select></div>
- <div id="mrese-form18">Łącznie za pobyt: <input class="input_res_nr" type="number" name="suma_p" id="suma_p" size="60" placeholder="0" value="<?php echo $priceto; ?>" readonly></input> zł</div>
- <div id="mrese-form19">Przedpłata: <input class="input_res_nr" type="number" name="dp" id="dp" size="60" placeholder="0" value="<?php echo $dpay; ?>" readonly></input> zł</div>
- <div id="mrese-form21">*Numer pokoju: <input class="input_res_nr" type="number" name="roomnr" size="60" placeholder="0" value="<?php echo $rnr; ?>" required></input>
- </div>
- <div id="dode">Dodatkowe informacje: </div>
- <div id="mrese-form22"> <textarea class="texta_res" type="text" name="other" id="other" cols="60" rows="5" placeholder="Podaj dodatkowe informacje" value=""><?php echo $oth; ?></textarea></div>
- <input type="hidden" id="price_ta" name="price_ta" value="-" readonly />
- <input type="hidden" id="price_tc" name="price_tc" value="-" readonly />
- <input type="hidden" id="price_tp" name="price_tp" value="-" readonly />
- <input type="hidden" id="price_tr" name="price_tr" value="-" readonly />
- <input type="hidden" id="price_pa" name="price_pa" value="-" readonly />
- <input type="hidden" id="price_pc" name="price_pc" value="-" readonly />
- <input type="hidden" id="price_pp" name="price_pp" value="-" readonly />
- <input type="hidden" id="price_pr" name="price_pr" value="-" readonly />
- <input type="hidden" id="dpval" name="dpval" value="<?php echo $dpval; ?>" readonly />
- <input type="hidden" id="dptype" name="dptype" value="<?php echo $dptype; ?>" readonly/>
- <input type="hidden" id="dpchc" name="dpchc" value="<?php echo $countc; ?>" readonly />
- <input type="hidden" id="dppec" name="dppec" value="<?php echo $countp; ?>" readonly/>
- <script>
- jQuery(document).ready(function() {
- jQuery("#add").click(function (e) {
- e.preventDefault();
- var count ='';
- var No = jQuery('#countc').val();
- var No2 = jQuery('#dpchc').val();
- if (No2 > No){count = parseInt(No2); }
- else{
- count = parseInt(No)+1;
- }
- var pp = '<?php echo get_options_c($selected,$owner_id,$wb,$wb); ?>';
- jQuery("#mrese-form11").append('<div class="chi" > *Wiek dziecka '+count+': <input class="input_age" type="text" name="age_c1" value=" "/>lat Cena za pobyt dziecka '+count+': <select id= "types_c'+count+'" name = "types_c'+count+'">'+pp+'</select> zł/osobodoba <button class="delete">-</button><br><br></div>');
- count++;
- var ca = parseInt(count)-1;
- jQuery('#dpchc').val(count);
- jQuery('#countc').val(ca);
- });
- jQuery("body").on("click", ".delete", function (e) {
- e.preventDefault();
- jQuery(this).parent("div").remove();
- var No3 = jQuery('#dpchc').val();
- var No4 = parseInt(No3)-1;
- var No4a = parseInt(No3)-2;
- jQuery('#dpchc').val(No4);
- jQuery('#countc').val(No4a);
- });
- });
- </script>
- <script>
- jQuery(document).ready(function() {
- jQuery("#add2").click(function (e) {
- e.preventDefault();
- var count ='';
- var No = jQuery('#countp').val();
- var No2 = jQuery('#dppec').val();
- if (No2 > No){count = parseInt(No2); }
- else{
- count = parseInt(No)+1;
- }
- var pp = '<?php echo get_options_p($selected,$owner_id,$wb,$wb); ?>';
- jQuery("#mrese-form14").append('<div class="pe"> *Typ zwierzęcia '+count+': <input class="input_pets" type="text" name="type_p'+count+'" value=" "/> Cena za pobyt zwierzęcia '+count+': <select id = "types_p'+count+'" name = "types_p'+count+'">'+pp+'</select> zł/doba <button class="delete2">-</button><br><br></div>');
- count++;
- var cp = parseInt(count)-1;
- jQuery('#dppec').val(count);
- jQuery('#countp').val(cp);
- });
- jQuery("body").on("click", ".delete2", function (e) {
- e.preventDefault();
- jQuery(this).parent("div").remove();
- var No5 = jQuery('#dppec').val();
- var No6 = parseInt(No5)-1;
- var No6a = parseInt(No5)-2;
- jQuery('#dppec').val(No6);
- jQuery('#countp').val(No6a);
- });
- });
- </script>
- <script>
- jQuery(document).ready(function() {
- jQuery('#date').datepicker();
- jQuery('#date1').datepicker();
- jQuery( '#btn' ).button({ icons: { primary: "" },
- text: false
- });
- jQuery( '#btn1' ).button({ icons: { primary: "" },
- text: false
- });
- jQuery('#btn').click(function (e)
- {
- jQuery('#date').datepicker("show");
- });
- jQuery('#btn1').click(function (e)
- {
- jQuery('#date1').datepicker("show");
- });
- var $array = [];
- var $array2 = [];
- var test="";
- var rabat ="";
- var rabatj ="";
- var rabatp = "";
- var datear ="";
- var datedep="";
- var datear_="";
- var datedep_="";
- var $price_ch=0;
- var $price_p=0;
- var price_d="";
- var count_ad = "";
- var price_ad = "";
- var count_ch = 0;
- var count_pe = "";
- var price_adu ="";
- var price_ad_="";
- var $price_p_="";
- var $price_ch_="";
- var price_a_type="";
- var price_c_type="";
- var price_p_type="";
- var ptotal = "";
- var dp ="";
- var dp_type ="";
- var dpval ="";
- var pcent="";
- var ptotalr="";
- var room="";
- var days="";
- jQuery('#date').on('change', function(){
- var selected = jQuery(this).val();
- Licz();
- });
- jQuery('#date1').on('change', function(){
- var selected1 = jQuery(this).val();
- Licz();
- });
- jQuery('#dpval').on('input', function(){
- Licz();
- });
- jQuery('#dptype').on('input', function(){
- Licz();
- });
- jQuery('#types_r').change( function(){
- Licz();
- });
- jQuery('#counta').on('input', function(){
- Licz();
- });
- jQuery('#types_a').change( function(){
- Licz();
- });
- jQuery('#countc').on('input', function(){
- var count_c = "";
- var c="";
- count_c = jQuery('#countc').val();
- for(varCountc=1;varCountc<=count_c;varCountc++){
- c = varCountc;
- jQuery('#types_c'+c).change( function(){
- Licz();
- });
- }
- Licz();
- });
- jQuery('#countp').on('input', function(){
- var count_p = "";
- var p ="";
- count_p = jQuery('#countp').val();
- for(varCountp=1;varCountp<=count_p;varCountp++){
- p = varCountp;
- jQuery('#types_p'+p).change( function(){
- Licz();
- });
- }
- Licz();
- });
- jQuery('#rabat').on('input', function(){
- jQuery('#types_rb').change( function(){
- Licz();
- });
- Licz();
- });
- jQuery('#types_rb').change( function(){
- Licz();
- });
- var Licz = function () {
- var day1 = "";
- var month1 ="";
- var year1 = "";
- var day2 = "";
- var month2 ="";
- var year2="";
- datear_ = jQuery('#date').val();
- datedep_ = jQuery('#date1').val();
- var room =jQuery('#types_r').val();
- if(datear_>datedep_){
- alert("Data przyjazdu nie może być późniejsza niż data wyjazdu a data wyjazdu nie może być wcześniejsza niż data przyjazdu!");
- }
- datedep = jQuery('#date1').datepicker('getDate');
- days = Math.round((datedep-datear)/(1000*60*60*24));
- rabat = jQuery('#rabat').val();
- rabatj = jQuery('#types_rb').val();
- dpval = jQuery('#dpval').val();
- dp_type = jQuery('#dptype').val();
- var pr = '%';
- var zł = 'zł';
- var db = "doba";
- if(room!=0 && datear && datedep){
- var arrayr=[];
- arrayr = room.split(":");
- room = arrayr[1];
- jQuery('#price_pr').val(arrayr[1]);
- jQuery('#price_tr').val(arrayr[0]);
- price_d=room;
- if(rabatj == zł){
- ptotal = (room*days)-rabat;
- jQuery('#fname').val(rabatj);
- }
- if(rabatj == pr){
- ptotal = (room*days);
- pcent = (rabat * ptotal)/100;
- ptotalr = ptotal - pcent;
- jQuery('#fname').val(rabatj);
- }
- if(dp_type == "%"){
- dp = ptotal - ((dpval * ptotal)/100);
- }
- if(dp_type == "doba"){
- dp = room * dpval;
- }
- }
- if(room==0){
- count_ad = jQuery('#counta').val();
- var arraya = [];
- var arrayc = [];
- var arrayc1=[];
- var arrayc2=[];
- var arrayp =[];
- var arrayp1 =[];
- var arrayp2 =[];
- var arrayp3 =[];
- var ppc = "";
- var ppt = "";
- var cpc = "";
- var cpt = "";
- var o = '-';
- price_ad_ = jQuery('#types_a').val();
- arraya = price_ad_.split(":");
- price_a_type = arraya[0];
- jQuery('#price_ta').val(price_a_type);
- price_ad = arraya[1];
- jQuery('#price_pa').val(price_ad);
- price_adu = price_ad * count_ad;
- count_ch = jQuery('#countc').val();
- count_pe = jQuery('#countp').val();
- if(count_ch==0){ $price_ch=0; jQuery('#price_tc').val(o); jQuery('#price_pc').val(o);}
- if(count_pe==0) { $price_p=0; jQuery('#price_tp').val(o); jQuery('#price_pp').val(o);}
- for(count=1;count<=count_ch;count++){
- var tmp = jQuery('#types_c'+count).val();
- arrayc = tmp.split(":");
- arrayc1[count] = arrayc[1];
- cpc += '|'+arrayc[1];
- cpt += '|'+arrayc[0];
- }
- if(count_ch==0){ jQuery('#price_tc').val(o); jQuery('#price_pc').val(o);}
- if(count_ch!=0){
- jQuery('#price_tc').val(cpt);
- jQuery('#price_pc').val(cpc);
- }
- for(counttp=1;counttp<=count_pe;counttp++){
- var tpm = jQuery('#types_p'+counttp).val();
- arrayp = tpm.split(":");
- arrayp1[counttp] = arrayp[1];
- ppc += '|'+arrayp[1];
- ppt += '|'+arrayp[0];
- }
- if(count_pe==0) {jQuery('#price_tp').val(o); jQuery('#price_pp').val(o);}
- if(count_pe!=0) {
- jQuery('#price_tp').val(ppt);
- jQuery('#price_pp').val(ppc);
- }
- var cc = "";
- var array3 = [];
- var array4 =[];
- for(varCount0=1;varCount0<=count_ch;varCount0++){
- array4[varCount0]=0;
- }
- for(varCount3=1;varCount3<=count_ch;varCount3++){
- array3[varCount3] = arrayc1[varCount3];
- if(array4[varCount3]<array3[varCount3]){
- array4[varCount3]=array4[varCount3]+(array3[varCount3]-array4[varCount3]);
- $price_ch=0;
- }
- if(array4[varCount3]>array3[varCount3]){
- array4[varCount3]=array4[varCount3]-(array4[varCount3]-array3[varCount3]);
- $price_ch=0;
- }
- }
- var l = 0;
- for (varCt=1; varCt<=count_ch; varCt++){
- if(array4[varCt]==0)
- l++;
- }
- if (l==count_ch) {$price_ch=0; }
- for(varCountt=1;varCountt<=count_ch;varCountt++){
- $price_ch += parseInt(array4[varCountt]);
- }
- array3=[];
- var array5 = [];
- var array6 =[];
- for(varCount00=1;varCount00<=count_pe;varCount00++){
- array6[varCount00]=0;
- }
- for(varCount4=1;varCount4<=count_pe;varCount4++){
- var count2 = varCount4;
- array5[varCount4] = arrayp1[varCount4]; //jQuery('#types_p'+varCount4).val();
- if(array6[varCount4]<array5[varCount4]){
- array6[varCount4]=array6[varCount4]+(array5[varCount4]-array6[varCount4]);
- $price_p=0;
- }
- if(array6[varCount4]>array5[varCount4]){
- array6[varCount4]=array6[varCount4]-(array6[varCount4]-array5[varCount4]);
- $price_p=0;
- }
- }
- var ll = 0;
- for (varCtt=1; varCtt<=count_pe; varCtt++){
- if(array6[varCtt]==0)
- ll++;
- }
- if (ll==count_pe) {$price_p=0; }
- for(varCountp=1;varCountp<=count_pe;varCountp++){
- $price_p += parseInt(array6[varCountp]);
- }
- price_d = (price_adu + $price_ch + $price_p);
- if(rabatj == zł){
- ptotalr = (price_d *days)-rabat;
- }
- if(rabatj == pr){
- ptotal = (price_d*days);
- pcent = (rabat * ptotal)/100;
- ptotalr = ptotal - pcent;
- }
- if(dp_type == "%"){
- dp = ptotal - ((dpval * ptotal)/100);
- }
- if(dp_type == "doba"){
- dp = price_d * dpval;
- }
- }
- jQuery('#suma_d').empty().val(price_d);
- jQuery('#suma_p').empty().val(ptotalr);
- jQuery('#dp').empty().val(dp);
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement