diff --git a/project/templates/lilcity/index.html b/project/templates/lilcity/index.html index 2f8c70e9..6ec65f05 100644 --- a/project/templates/lilcity/index.html +++ b/project/templates/lilcity/index.html @@ -440,7 +440,7 @@
{% for school_schedule in school_schedules %}
Итого, за месяц:
-
1800р.
+
1800р.
@@ -471,7 +471,7 @@
{% comment %}В ссылке, в параметре запроса weekdays, нужно указать выбранные дни недели{% endcomment %} - ПЕРЕЙТИ К ОПЛАТЕ + ПЕРЕЙТИ К ОПЛАТЕ
diff --git a/web/src/js/modules/popup.js b/web/src/js/modules/popup.js index ba2e04d1..583b8863 100644 --- a/web/src/js/modules/popup.js +++ b/web/src/js/modules/popup.js @@ -47,4 +47,38 @@ $(document).ready(function () { popup.removeClass('open'); }, 300); } + + var selectedWeekdays = {}; + $(document).on('change', '[data-day]', function(){ + var weekday = $(this).data('day'); + var price = $(this).data('price'); + var discount = $(this).data('discount'); + if($(this).is(':checked')) { + console.log('checked'); + selectedWeekdays[weekday] = {price:price, discount:discount}; + } else { + console.log('not checked'); + delete selectedWeekdays[weekday]; + } + + var weekdays = [], price = 0, discount = 0; + for(var i in selectedWeekdays) { + price += parseInt(selectedWeekdays[i].price); + discount += parseInt(selectedWeekdays[i].discount); + weekdays.push(i); + } + + var text = ''; + if(weekdays.length >= 7) { + text = ''+price+' '+(price-discount)+'р.'; + } else { + text = price+'p.'; + } + $('.order_price_text').html(text); + + var link = $('.but_btn_popup').data('link'); + + link = link+'?'+decodeURIComponent($.param({weekdays: weekdays})); + $('.but_btn_popup').attr('href', link); + }); }); \ No newline at end of file