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. 21
      apps/school/templates/summer/promo.html
  4. 19
      apps/school/views.py
  5. 40
      apps/user/templates/user/profile.html
  6. 9
      apps/user/views.py
  7. 33
      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__center center">
<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">
<a
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 class="main__actions">
<a
{% if not user.is_authenticated %}
data-popup=".js-popup-auth"
{% else %}
data-popup=".js-popup-buy"
{% if not is_purchased_future %}
{% if not user.is_authenticated %}
data-popup=".js-popup-auth"
{% else %}
data-popup=".js-popup-buy"
{% endif %}
{% endif %}
class="main__btn btn"
href="#"
>Получить доступ</a>
class="main__btn btn"
href="#"
>
{% 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 class="main__school school school_main">
<div class="school__col">

@ -198,11 +198,28 @@ class SummerSchoolView(TemplateView):
date_end__gte=date_now
)
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(
joined_weekdays=Func(F('weekdays'), function='unnest',)
).values_list('joined_weekdays', flat=True).distinct()
else:
school_payment_exists = False
school_payment_exists_future = False
school_purchased_future = False
school_schedules_purchased = []
if school_payment_exists and is_previous:
live_lessons = LiveLesson.objects.filter(
@ -221,9 +238,11 @@ class SummerSchoolView(TemplateView):
'is_previous': is_previous,
'course_items': Course.objects.filter(status=Course.PUBLISHED)[:6],
'is_purchased': school_payment_exists,
'is_purchased_future': school_payment_exists_future,
'min_school_price': SchoolSchedule.objects.aggregate(Min('month_price'))['month_price__min'],
'school_schedules': SchoolSchedule.objects.all(),
'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,
})
return context

@ -79,25 +79,33 @@
</div>
<div class="tabs__container">
<div class="tabs__item js-tabs-item">
{% if is_purchased %}
{% include "blocks/schedule_purchased.html" %}
{% 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 %}
<div class="center center_xs">
<div class="done">
<div class="done__title title">Вы не подписаны на школу!</div>
<div class="done__foot">
<a
{% if not user.is_authenticated %}
data-popup=".js-popup-auth"
{% else %}
data-popup=".js-popup-buy"
{% endif %}
href="#"
class="done__btn btn btn_md btn_stroke"
>Купить подписку</a>
{% if is_purchased %}
{% include "blocks/schedule_purchased.html" %}
{% else %}
<div class="center center_xs">
<div class="done">
<div class="done__title title">Вы не подписаны на школу!</div>
<div class="done__foot">
<a
{% if not user.is_authenticated %}
data-popup=".js-popup-auth"
{% else %}
data-popup=".js-popup-buy"
{% endif %}
href="#"
class="done__btn btn btn_md btn_stroke"
>Купить подписку</a>
</div>
</div>
</div>
</div>
{% endif %}
{% endif %}
</div>
<div class="tabs__item js-tabs-item">

@ -96,6 +96,15 @@ class UserView(DetailView):
).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

@ -15,27 +15,22 @@
Присоединяйтесь в Рисовальный лагерь
</div>
<div class="main__actions">
{% if is_purchased %}
<a
{% if not user.is_authenticated %}
data-popup=".js-popup-auth"
{% else %}
data-popup=".js-popup-buy"
{% if not is_purchased_future %}
{% if not user.is_authenticated %}
data-popup=".js-popup-auth"
{% else %}
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 %}
class="main__btn btn"
href="#"
>Получить доступ</a>
{% endif %}
class="main__btn btn"
href="#"
>
{% 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>
</div>
</div>

@ -44,8 +44,20 @@ class IndexView(TemplateView):
school_payment_exists = school_payment.exists()
school_schedules_purchased = school_payment.values_list('weekdays', flat=True)
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:
school_payment_exists = False
school_payment_exists_future = False
school_purchased_future = False
school_schedules_purchased = []
context.update({
@ -58,6 +70,10 @@ class IndexView(TemplateView):
'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_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

Loading…
Cancel
Save