1(function( $ ) { 2 jQuery(function () { 3 /** 4 * Setting all data attribute id's 5 * @type {number} 6 */ 7 var count_food = 0; 8 var count_foodlist = 0; 9 10 $(".category-list-animate").each(function () { 11 $(this).attr("data-food-id", count_food); 12 13 $(this).find('.minus').each(function () { 14 $(this).attr("data-food-id", count_food); 15 }); 16 $(this).find('.plus').each(function () { 17 $(this).attr("data-food-id", count_food); 18 }); 19 20 count_food++; 21 }); 22 23 $(".category-list").each(function () { 24 $(this).attr("data-foodlist-id", count_foodlist); 25 count_foodlist++; 26 }); 27 28 /** 29 * slideeffect 30 */ 31 $('.category-list-animate').on('click', function () { 32 var food_id = $(this).data("food-id"); 33 var foodlist = $(".category-list[data-foodlist-id='" + food_id + "']"); 34 if (!foodlist.hasClass('food-list-active')) { 35 foodlist.slideDown(); 36 $("img[data-food-id='" + food_id + "']").filter(".minus").css('display', 'block'); 37 $("img[data-food-id='" + food_id + "']").filter(".plus").css('display', 'none'); 38 foodlist.addClass('food-list-active'); 39 } else { 40 foodlist.slideUp(); 41 $("img[data-food-id='" + food_id + "']").filter(".minus").css('display', 'none'); 42 $("img[data-food-id='" + food_id + "']").filter(".plus").css('display', 'block'); 43 foodlist.removeClass('food-list-active'); 44 } 45 }); 46 47 /** 48 * Calc when select is changed 49 */ 50 $(".wpcf7 input[type='number']").on("change", function () { 51 if ($(this).attr('name') != "menu-payment") { 52 var parent = $(this).closest(".row"); 53 var total = parent.find(".total"); 54 var select_text = $(this).val(); 55 var price = total.data('price').replace('.', ''); 56 var total_price = parseFloat(select_text * price / 100).toFixed(2).toString().replace('.', ','); 57 58 // Feld Bier ein Stern, alle anderen zwei Sterne 59 var inputName = $(this).attr('name'); 60 var itemStar = (inputName === 'number-beer') ? " *" : " **"; 61 total.text(total_price + "â¬" + itemStar); 62 63 var global_total = 0; 64 var total_19 = 0; 65 var total_7 = 0; 66 67 $(".category-list .price .total").each(function () { 68 var priceText = $(this).text(); 69 priceText = priceText.split('â¬'); 70 var price = parseFloat(priceText[0].replace(',', '.')); 71 72 if (!isNaN(price)) { 73 global_total += price; 74 75 // Prüfen ob 19% oder 7% anhand des Inputs 76 var inputName = $(this).closest('.row').find("input[type='number']").attr('name'); 77 78 if (inputName === 'number-beer') { 79 total_19 += price; 80 } else { 81 total_7 += price; 82 } 83 } 84 }); 85 86 // Berechnen, ob 19 oder 7 befüllt sind für Sternchentexte 87 var has19 = parseFloat(total_19) > 0; 88 var has7 = parseFloat(total_7) > 0; 89 90 var starText = ""; 91 if (has19 && has7) { 92 starText = " * **"; 93 } else if (has19) { 94 starText = " *"; 95 } else if (has7) { 96 starText = " **"; 97 } 98 99 // Gesamtpreis anzeigen 100 global_total = global_total.toFixed(2).toString().replace('.', ','); 101 $(".all-days-total .total").text(global_total + "â¬" + starText); 102 $("input[name='your-mail-total']").val(global_total + "â¬" + starText); 103 104 // MwSt berechnen 105 var mwst19 = (total_19 * 19 / 119).toFixed(2).toString().replace('.', ','); 106 var mwst7 = (total_7 * 7 / 107).toFixed(2).toString().replace('.', ','); 107 108 // Ausgabe 109 $(".mwst-19").text(mwst19 + "â¬"); 110 $(".mwst-7").text(mwst7 + "â¬"); 111 112 // Container ein-/ausblenden je nach Wert 113 if (parseFloat(mwst19.replace(',', '.')) === 0) { 114 $(".mwst-19-container").hide(); 115 } else { 116 $(".mwst-19-container").show(); 117 } 118 119 if (parseFloat(mwst7.replace(',', '.')) === 0) { 120 $(".mwst-7-container").hide(); 121 } else { 122 $(".mwst-7-container").show(); 123 } 124 125 if ((parseFloat(mwst19.replace(',', '.')) === 0) && (parseFloat(mwst7.replace(',', '.')) === 0) ) { 126 $(".mwst-star").hide(); 127 } else { 128 $(".mwst-star").css('display', 'flex'); 129 } 130 131 // Texte für Mail vorbereiten 132 var mwst19Text = ""; 133 var mwst7Text = ""; 134 135 if (parseFloat(mwst19.replace(',', '.')) > 0) { 136 mwst19Text = "* enthaltene MwSt. (19%): " + mwst19 + "â¬"; 137 } 138 139 if (parseFloat(mwst7.replace(',', '.')) > 0) { 140 mwst7Text = "** enthaltene MwSt. (7%): " + mwst7 + "â¬"; 141 } 142 143 // In CF7 Felder schreiben 144 $("input[name='mwst-19-total']").val(mwst19Text); 145 $("input[name='mwst-7-total']").val(mwst7Text); 146 } 147 }); 148 149 $(".foodcategory-max-content input[type='submit']").on("click", function () { 150 var offset = $(this).offset(); 151 $('html, body').animate({ 152 scrollTop: offset.top - 120 153 }, "slow"); 154 }); 155 156 /** 157 * Set the min value of the date input field "pickdate" to tomorrow 158 * @type {HTMLElement} 159 * 160 * get the date input field "pickdate". 161 * Read the min attribute. 162 * If min is less than tomorrow, set the min to tomorrow. 163 * 164 */ 165 var pickdate = document.getElementById('pickdate'); 166 167 if (pickdate != null) { 168 var today = new Date(), 169 tomorrow = new Date(today); 170 tomorrow.setDate(tomorrow.getDate() + 1); 171 var dd = tomorrow.getDate(), 172 mm = tomorrow.getMonth() + 1, 173 yyyy = tomorrow.getFullYear(); 174 175 if (dd < 10) { 176 dd = '0' + dd; 177 } 178 179 if (mm < 10) { 180 mm = '0' + mm; 181 } 182 183 tomorrow = yyyy + '-' + mm + '-' + dd; 184 185 if (pickdate.min < tomorrow) { 186 pickdate.min = tomorrow; 187 } 188 } 189 });
190})(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.