future payment fixes

remotes/origin/hasaccess
Sanasol 8 years ago
parent edb06ae080
commit 47c51b5d3c
  1. 2
      apps/school/templates/blocks/promo.html
  2. 4
      apps/school/templates/summer/open_lesson.html
  3. 9
      apps/school/templates/summer/promo.html
  4. 19
      apps/school/views.py
  5. 8
      apps/user/templates/user/profile.html
  6. 9
      apps/user/views.py
  7. 19
      project/templates/blocks/promo.html
  8. 16
      project/views.py

@ -2,7 +2,7 @@
<div class="main main_default" style="background-image: url({% static 'img/bg-2.jpg' %});"> <div class="main main_default" style="background-image: url({% static 'img/bg-2.jpg' %});">
<div class="main__center center"> <div class="main__center center">
<div class="main__title"> <div class="main__title">
<span class="main__bold">Lil City School</span> — первая образовательная онлайн-платформа креативного мышления для детей</div> <span class="main__bold">Lil School</span> — первая образовательная онлайн-платформа креативного мышления для детей</div>
<div class="main__actions"> <div class="main__actions">
<a <a
data-popup=".js-popup-subscribe" data-popup=".js-popup-subscribe"

@ -0,0 +1,4 @@
<a
class="timing__btn btn btn_light"
href="{% url 'school:lesson-detail' live_lesson.id %}"
>смотреть урок</a>

@ -9,14 +9,21 @@
</div> </div>
<div class="main__actions"> <div class="main__actions">
<a <a
{% if not is_purchased_future %}
{% if not user.is_authenticated %} {% if not user.is_authenticated %}
data-popup=".js-popup-auth" data-popup=".js-popup-auth"
{% else %} {% else %}
data-popup=".js-popup-buy" data-popup=".js-popup-buy"
{% endif %} {% endif %}
{% endif %}
class="main__btn btn" class="main__btn btn"
href="#" href="#"
>Получить доступ</a> >
{% if not is_purchased and not is_purchased_future %}Получить доступ{% endif %}
{% if is_purchased_future and not is_purchased %}ваша подписка начинается {{school_purchased_future.date_start}}{% endif %}
{% if is_purchased %}ваша подписка истекает {{ subscription_ends_humanize }}<br/>перейти к оплате{% endif %}
</a>
</div> </div>
<div class="main__school school school_main"> <div class="main__school school school_main">
<div class="school__col"> <div class="school__col">

@ -198,11 +198,28 @@ class SummerSchoolView(TemplateView):
date_end__gte=date_now date_end__gte=date_now
) )
school_payment_exists = school_payment.exists() school_payment_exists = school_payment.exists()
school_payment_future = SchoolPayment.objects.filter(
user=self.request.user,
status__in=[
Pingback.PINGBACK_TYPE_REGULAR,
Pingback.PINGBACK_TYPE_GOODWILL,
Pingback.PINGBACK_TYPE_RISK_REVIEWED_ACCEPTED,
],
date_start__gte=date_now,
date_end__gte=date_now
)
school_payment_exists_future = school_payment_future.exists()
school_purchased_future = school_payment_future.last()
school_schedules_purchased = school_payment.annotate( school_schedules_purchased = school_payment.annotate(
joined_weekdays=Func(F('weekdays'), function='unnest',) joined_weekdays=Func(F('weekdays'), function='unnest',)
).values_list('joined_weekdays', flat=True).distinct() ).values_list('joined_weekdays', flat=True).distinct()
else: else:
school_payment_exists = False school_payment_exists = False
school_payment_exists_future = False
school_purchased_future = False
school_schedules_purchased = [] school_schedules_purchased = []
if school_payment_exists and is_previous: if school_payment_exists and is_previous:
live_lessons = LiveLesson.objects.filter( live_lessons = LiveLesson.objects.filter(
@ -221,9 +238,11 @@ class SummerSchoolView(TemplateView):
'is_previous': is_previous, 'is_previous': is_previous,
'course_items': Course.objects.filter(status=Course.PUBLISHED)[:6], 'course_items': Course.objects.filter(status=Course.PUBLISHED)[:6],
'is_purchased': school_payment_exists, 'is_purchased': school_payment_exists,
'is_purchased_future': school_payment_exists_future,
'min_school_price': SchoolSchedule.objects.aggregate(Min('month_price'))['month_price__min'], 'min_school_price': SchoolSchedule.objects.aggregate(Min('month_price'))['month_price__min'],
'school_schedules': SchoolSchedule.objects.all(), 'school_schedules': SchoolSchedule.objects.all(),
'school_schedules_purchased': school_schedules_purchased, 'school_schedules_purchased': school_schedules_purchased,
'school_purchased_future': school_purchased_future,
'subscription_ends': school_payment.filter(add_days=False).first().date_end if school_payment_exists else None, 'subscription_ends': school_payment.filter(add_days=False).first().date_end if school_payment_exists else None,
}) })
return context return context

@ -79,6 +79,13 @@
</div> </div>
<div class="tabs__container"> <div class="tabs__container">
<div class="tabs__item js-tabs-item"> <div class="tabs__item js-tabs-item">
{% if is_purchased_future %}
<div class="center center_xs">
<div class="done">
<div class="done__title title">Ваша подписка начинается {{school_purchased_future.date_start}}</div>
</div>
</div>
{% else %}
{% if is_purchased %} {% if is_purchased %}
{% include "blocks/schedule_purchased.html" %} {% include "blocks/schedule_purchased.html" %}
{% else %} {% else %}
@ -99,6 +106,7 @@
</div> </div>
</div> </div>
{% endif %} {% endif %}
{% endif %}
</div> </div>
<div class="tabs__item js-tabs-item"> <div class="tabs__item js-tabs-item">
<div class="courses courses_scroll"> <div class="courses courses_scroll">

@ -96,6 +96,15 @@ class UserView(DetailView):
).all() ).all()
context['all_school_schedules'] = SchoolSchedule.objects.all() context['all_school_schedules'] = SchoolSchedule.objects.all()
school_payment_future = SchoolPayment.objects.filter(
user=self.request.user,
date_start__gte=now(),
date_end__gte=now()
)
context['is_purchased_future'] = school_payment_future.exists()
context['school_purchased_future'] = school_payment_future.last()
return context return context

@ -15,27 +15,22 @@
Присоединяйтесь в Рисовальный лагерь Присоединяйтесь в Рисовальный лагерь
</div> </div>
<div class="main__actions"> <div class="main__actions">
{% if is_purchased %}
<a <a
{% if not is_purchased_future %}
{% if not user.is_authenticated %} {% if not user.is_authenticated %}
data-popup=".js-popup-auth" data-popup=".js-popup-auth"
{% else %} {% else %}
data-popup=".js-popup-buy" data-popup=".js-popup-buy"
{% endif %} {% endif %}
class="main__btn btn"
href="#"
>ваша подписка истекает {{ subscription_ends_humanize }}<br/>перейти к оплате</a>
{% else %}
<a
{% if not user.is_authenticated %}
data-popup=".js-popup-auth"
{% else %}
data-popup=".js-popup-buy"
{% endif %} {% endif %}
class="main__btn btn" class="main__btn btn"
href="#" href="#"
>Получить доступ</a> >
{% endif %} {% if not is_purchased and not is_purchased_future %}Получить доступ{% endif %}
{% if is_purchased_future and not is_purchased %}ваша подписка начинается {{school_purchased_future.date_start}}{% endif %}
{% if is_purchased %}ваша подписка истекает {{ subscription_ends_humanize }}<br/>перейти к оплате{% endif %}
</a>
<a class="main__btn btn btn_white" href="{% url 'school:summer-school' %}">О лагере</a> <a class="main__btn btn btn_white" href="{% url 'school:summer-school' %}">О лагере</a>
</div> </div>
</div> </div>

@ -44,8 +44,20 @@ class IndexView(TemplateView):
school_payment_exists = school_payment.exists() school_payment_exists = school_payment.exists()
school_schedules_purchased = school_payment.values_list('weekdays', flat=True) school_schedules_purchased = school_payment.values_list('weekdays', flat=True)
school_schedules_purchased = school_schedules_purchased[0] if school_schedules_purchased else [] school_schedules_purchased = school_schedules_purchased[0] if school_schedules_purchased else []
school_payment_future = SchoolPayment.objects.filter(
user=self.request.user,
date_start__gte=date_now,
date_end__gte=date_now
)
school_payment_exists_future = school_payment_future.exists()
school_purchased_future = school_payment_future.last()
else: else:
school_payment_exists = False school_payment_exists = False
school_payment_exists_future = False
school_purchased_future = False
school_schedules_purchased = [] school_schedules_purchased = []
context.update({ context.update({
@ -58,6 +70,10 @@ class IndexView(TemplateView):
'teachers': User.objects.filter(role=User.TEACHER_ROLE, show_in_mainpage=True), 'teachers': User.objects.filter(role=User.TEACHER_ROLE, show_in_mainpage=True),
'subscription_ends': school_payment.filter(add_days=False).first().date_end if school_payment_exists else None, 'subscription_ends': school_payment.filter(add_days=False).first().date_end if school_payment_exists else None,
'subscription_ends_humanize': school_payment.filter(add_days=False).first().date_end_humanize if school_payment_exists else None, 'subscription_ends_humanize': school_payment.filter(add_days=False).first().date_end_humanize if school_payment_exists else None,
'school_purchased_future': school_purchased_future,
'is_purchased_future': school_payment_exists_future,
}) })
return context return context

Loading…
Cancel
Save