страница с ценами

remotes/origin/feature/packages-page-1-08-19
gzbender 7 years ago
parent a7c6a80adf
commit 2dcf4866f2
  1. 28
      apps/payment/models.py
  2. 2
      project/templates/blocks/banner.html
  3. 25
      web/src/js/modules/common.js

@ -129,10 +129,10 @@ class Payment(PolymorphicModel):
@classmethod
def adjust_date_bounds(cls, date_start=None, date_end=None, is_camp=False):
school_start = date(now().year, 9, 1)
school_end = date(now().year, 5, 31)
camp_start = date(now().year, 6, 1)
camp_end = date(now().year, 8, 31)
school_start = date((date_start or date_end).year, 9, 1)
school_end = date((date_end or date_start).year, 5, 31)
camp_start = date((date_start or date_end).year, 6, 1)
camp_end = date((date_end or date_start).year, 8, 31)
if date_start:
if is_camp:
@ -153,6 +153,17 @@ class Payment(PolymorphicModel):
else:
return date_start or date_end
@classmethod
def date_add(cls, date_start, days=0, months=0, is_camp=False):
date_end = arrow.get(date_start + timedelta(days=days), settings.TIME_ZONE).shift(
months=months).date() - timedelta(1)
if months == 1:
if is_camp or (date_start.month == 2 and date_start.day >= 28) or (
date_start.day == 31 and date_end.day <= 30) \
or (date_start.month == 1 and date_start.day >= 29 and date_end.day == 28):
date_end = date_start.replace(day=1, month=date_start.month + 1) - timedelta(1)
return date_end
@classmethod
def get_date_range(cls, date_start=None, days=0, months=0, is_camp=False):
date_start = date_start or now().date()
@ -161,12 +172,9 @@ class Payment(PolymorphicModel):
date_start = cls.adjust_date_bounds(date_start=date_start, is_camp=is_camp)
if is_camp and date_start.month == 6 and date_start.day > 16:
date_start = date_start.replace(month=7, day=1)
date_end = arrow.get(date_start + timedelta(days=days), settings.TIME_ZONE).shift(months=months).date() - timedelta(1)
if months == 1:
if is_camp or (date_start.month == 2 and date_start.day >= 28) or (date_start.day == 31 and date_end.day <= 30) \
or (date_start.month == 1 and date_start.day >= 29 and date_end.day == 28):
date_end = date_start.replace(day=1, month=date_start.month + 1) - timedelta(1)
date_end = cls.adjust_date_bounds(date_end=date_end, is_camp=is_camp)
date_end = cls.date_add(date_start, days, months, is_camp)
if is_camp:
date_end = cls.adjust_date_bounds(date_end, is_camp=is_camp)
return [date_start, date_end]
@classmethod

@ -1,5 +1,5 @@
<div class="banner"
data-banner="{{banner.id}}" style="display: none;
data-banner="{{banner.id}}" style="
background: {{ banner.color|default:'white' }};
{% if banner.color2 %}
background: -moz-linear-gradient(-45deg, {{ banner.color }} 0%, {{ banner.color2 }} 100%);

@ -1,13 +1,10 @@
import $ from 'jquery';
import {showNotification} from "./notification"
import Inputmask from "inputmask";
import SmoothScroll from 'smooth-scroll/dist/js/smooth-scroll';
import baguetteBox from 'baguettebox.js'
import createHistory from 'history/createBrowserHistory'
import Cookies from 'js-cookie'
import moment from 'moment'
window.$ = window.jQuery = jQuery = $;
window.$ = window.jQuery = $;
window.Inputmask = Inputmask;
window.baguetteBox = baguetteBox;
@ -23,26 +20,6 @@ $(document).ready(function () {
}
});
//===========BANNERS===============
const $banner = $('[data-banner]');
const bannerId = $banner.data('banner') + '';
const futureDate = $banner.data('future-date') + '';
if(Cookies.get('hide_banner') !== bannerId){
$banner.show();
}
$banner.on('click', '.banner__hide', function(e){
e.preventDefault();
$banner.slideUp();
Cookies.set('hide_banner', bannerId);
});
if(futureDate){
}
$banner.find('.banner__countdown')
//===========REVIEWS===============
if(window.LIL_STORE.isIndexPage){
const $reviews = $('.reviews');

Loading…
Cancel
Save