Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <div id="mrese-form">
- <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="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">Łą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-form13"><textarea id="test"></textarea></div>
- <input type="hidden" id="price_ta" name="price_ta" value="-" readonly />
- <input type="hidden" id="price_pa" name="price_pa" value="-" readonly />
- <input type="hidden" id="price_tc" name="price_tc" value="-" readonly />
- <input type="hidden" id="price_pc" name="price_pc" value="-" readonly />
- <input type="hidden" id="dpchc" name="dpchc" value="<?php echo $countc; ?>" readonly />
- <script src="//code.jquery.com/jquery-1.10.2.js"></script>
- <script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
- <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() {
- var count_ad = "";
- var price_ad = "";
- var price_adu ="";
- var price_ad_="";
- var price_a_type="";
- var $price_ch=0;
- var count_ch = 0;
- var $price_ch_="";
- var price_c_type="";
- //var e = jQuery.Event('input');
- jQuery('#counta').on('change', function(){
- Licz();
- });
- jQuery('#types_a').change( function(){
- Licz();
- });
- jQuery('#countc').on('change', 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(){
- //jQuery('#counta').trigger('input');
- Licz();
- });
- }
- //jQuery('#counta').trigger(e);
- Licz();
- });
- //jQuery('#counta').trigger('change');
- var Licz = function () {
- var arraya = [];
- var arrayc = [];
- var arrayc1=[];
- var arrayc2=[];
- var cpc = "";
- var cpt = "";
- var 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);
- }
- var cc = "";
- var array3 = [];
- var array4 =[];
- for(varCount0=1;varCount0<=count_ch;varCount0++){
- array4[varCount0]=0;
- //jQuery('#other').empty().prepend(array4 +'$');
- }
- for(varCount3=1;varCount3<=count_ch;varCount3++){
- array3[varCount3] = arrayc1[varCount3]; //jQuery('#types_c'+varCount3).val();
- if(array4[varCount3]<array3[varCount3]){
- array4[varCount3]=array4[varCount3]+(array3[varCount3]-array4[varCount3]);
- $price_ch=0;
- //$price_ch += parseInt(array4[varCount3]);
- }
- if(array4[varCount3]>array3[varCount3]){
- array4[varCount3]=array4[varCount3]-(array4[varCount3]-array3[varCount3]);
- $price_ch=0;
- //$price_ch += parseInt(array4[varCount3]);
- }
- }
- 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]);
- //jQuery('#other').empty().prepend($price_ch +'$');
- }
- count_ad = jQuery('#counta').val();
- 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();
- var test = "Count_A: "+count_ad+" price_a_type: "+price_a_type+" price_ad: "+price_ad+" price_adu "+price_adu+ "price_ch "+$price_ch;
- jQuery('#suma_p').empty().val(price_adu);
- jQuery('#test').empty().val(test);
- }
- });
- </script>
- </div> <div id="mrese-form23"><input class="btn btn-primary" type="submit" value="Zapisz zmiany" name="postsave"></div>
- <br></p></form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement