remotes/origin/feature/LIL-711
gzbender 7 years ago
parent 30b476746a
commit 1e4e451115
  1. 25
      apps/course/templates/course/course.html
  2. 25
      apps/course/templates/course/course_only_lessons.html
  3. 3
      apps/notification/tasks.py
  4. 43
      apps/notification/templates/notification/email/gift_certificate.html
  5. 4
      apps/payment/models.py
  6. 14
      apps/payment/templates/payment/gift_certificate_get.html
  7. 14
      apps/payment/templates/payment/gift_certificate_item.html
  8. 1
      apps/payment/templates/payment/gift_certificates.html
  9. 20
      apps/payment/views.py
  10. 3
      apps/school/templates/summer/promo.html
  11. 5
      apps/user/templates/user/profile.html
  12. 27
      project/templates/blocks/popup_enter_gift_code.html
  13. 8
      project/templates/blocks/popup_gift_certificate.html
  14. 9
      project/templates/blocks/promo.html
  15. 2
      project/views.py
  16. 15
      web/src/js/modules/popup.js
  17. 14
      web/src/sass/_common.sass

@ -29,17 +29,22 @@
<a class="go__btn btn btn_light-gray" href="{% url 'course_edit' course.id %}">Редактировать</a>
{% endif %}
{% if course.author != request.user and not paid and course.price %}
<a href="#"
class="go__btn btn{% if pending %} btn_gray{% endif %} btn_md"
{% if user.is_authenticated %}
{% if not pending %}
data-course-buy
data-popup=".js-popup-course-buy"
{% endif %}
{% else %}
data-popup=".js-popup-auth"
<div>
<a href="#"
class="go__btn btn{% if pending %} btn_gray{% endif %} btn_md"
{% if user.is_authenticated %}
{% if not pending %}
data-course-buy
data-popup=".js-popup-course-buy"
{% endif %}
{% else %}
data-popup=".js-popup-auth"
{% endif %}
>{% if pending %}ОЖИДАЕТСЯ ПОДТВЕРЖДЕНИЕ ОПЛАТЫ{% else %}КУПИТЬ КУРС{% endif %}</a>
{% if not paid %}
<a class="main__btn btn btn_stroke-black" href="{% url 'gift-certificates' %}">Подарить другу</a>
{% endif %}
>{% if pending %}ОЖИДАЕТСЯ ПОДТВЕРЖДЕНИЕ ОПЛАТЫ{% else %}КУПИТЬ КУРС{% endif %}</a>
</div>
{% endif %}
</div>
<div

@ -29,17 +29,22 @@
<a class="go__btn btn" href="{% url 'course_edit' course.id %}">Редактировать</a>
{% endif %}
{% if not paid and course.price and not has_full_access %}
<a
class="go__btn btn{% if pending %} btn_gray{% endif %} btn_md"
{% if user.is_authenticated %}
{% if not pending %}
href="{% url 'course-checkout' course.id %}"
{% endif %}
{% else %}
data-popup=".js-popup-auth"
href="#"
<div>
<a
class="go__btn btn{% if pending %} btn_gray{% endif %} btn_md"
{% if user.is_authenticated %}
{% if not pending %}
href="{% url 'course-checkout' course.id %}"
{% endif %}
{% else %}
data-popup=".js-popup-auth"
href="#"
{% endif %}
>{% if pending %}ОЖИДАЕТСЯ ПОДТВЕРЖДЕНИЕ ОПЛАТЫ{% else %}КУПИТЬ КУРС{% endif %}</a>
{% if not paid %}
<a class="main__btn btn btn_stroke-black" href="{% url 'gift-certificates' %}">Подарить другу</a>
{% endif %}
>{% if pending %}ОЖИДАЕТСЯ ПОДТВЕРЖДЕНИЕ ОПЛАТЫ{% else %}КУПИТЬ КУРС{% endif %}</a>
</div>
{% endif %}
</div>
<div

@ -8,7 +8,7 @@ from django.db.models import Max
from apps.notification.models import UserNotification
from apps.notification.utils import send_email
from apps.payment.models import SchoolPayment, CoursePayment, Payment
from apps.payment.models import SchoolPayment, CoursePayment, Payment, UserGiftCertificate
from project.celery import app
from project.utils.db import format_sql, execute_sql
from project.sengrid import get_sendgrid_client
@ -105,5 +105,6 @@ def sendgrid_update_recipients():
@app.task
def send_gift_certificate(user_gift_certificate):
user_gift_certificate = UserGiftCertificate.objects.get(id=user_gift_certificate)
send_email('Подарочный сертификат от Lil School', user_gift_certificate.user.email, 'notification/email/gift_certificate.html',
user_gift_certificate=user_gift_certificate, gift_certificate=user_gift_certificate.gift_certificate)

@ -1,7 +1,8 @@
{% extends "notification/email/_base.html" %}
{% load settings %}
{% block content %}
<p style="text-align: center;font-size: 32px;font-weight: bold;line-height: 1.09375;">Поздравляем с успешной
<p style="text-align: center;font-size: 2em;font-weight: bold;line-height: 1.09375;">Поздравляем с успешной
покупкой!</p>
<div style="margin-bottom:30px;text-align: center;">
<p>Вы получаете <strong>{{ gift_certificate.price }}</strong> лиликов на счет! <strong>1 LIL = 1 руб.</strong><br>
@ -41,10 +42,11 @@
</div>
<div style="margin-bottom:10px;text-align: center;">Чтобы воспользоваться сертификатом, перейдите по ссылке</div>
<div style="margin-bottom: 30px;text-align: center;">
<a href="{% url 'index' %}?gift-certificate={{ user_gift_certificate.code }}" style="
<a href="https://{% setting 'MAIN_HOST' %}{% url 'index' %}?gift-certificate={{ user_gift_certificate.code }}" style="
color: #FF9393;
font-weight: bold;
">{% url 'gift-certificate-get' gift_certificate.code %}</a>
">
{% setting 'MAIN_HOST' %}{% url 'index' %}?gift-certificate={{ user_gift_certificate.code }}</a>
</div>
<div style="margin-bottom:10px;text-align: center;">
Или воспользуйтесь сертификатом, введя уникальный код на в разделе
@ -54,14 +56,14 @@
</div>
<div style="
text-align: center;
font-size: 24px;
font-size: 1.4em;
font-weight: bold;
margin-bottom: 10px;
">Ваш код
</div>
<div style="
text-align: center;
font-size: 22px;
font-size: 1.4em;
font-weight: bold;
margin-bottom: 30px;
">
@ -79,4 +81,35 @@
">
Вы так же можете отправить это письмо, ссылку или код вашему другу, чтобы подарить ему этот сертификат.
</div>
<div style="
margin-bottom: 10px;
text-align: center;
font-size: 1.4em;
font-weight: bold;
">
Присоединяйтесь к нам!
</div>
<div style="
margin-bottom: 10px;
text-align: center;">
<a href="{{ config.SERVICE_TWITTER_URL }}">
<svg xmlns="http://www.w3.org/2000/svg" width="30" height="30" viewBox="0 0 30 30" style="
fill: #00b7ec;
width: 30px;
height: 30px;
">
<path d="M15.969,3.058c-0.586,0.26-1.217,0.436-1.878,0.515c0.675-0.405,1.194-1.045,1.438-1.809c-0.632,0.375-1.332,0.647-2.076,0.793c-0.596-0.636-1.446-1.033-2.387-1.033c-1.806,0-3.27,1.464-3.27,3.27 c0,0.256,0.029,0.506,0.085,0.745C5.163,5.404,2.753,4.102,1.14,2.124C0.859,2.607,0.698,3.168,0.698,3.767 c0,1.134,0.577,2.135,1.455,2.722C1.616,6.472,1.112,6.325,0.671,6.08c0,0.014,0,0.027,0,0.041c0,1.584,1.127,2.906,2.623,3.206 C3.02,9.402,2.731,9.442,2.433,9.442c-0.211,0-0.416-0.021-0.615-0.059c0.416,1.299,1.624,2.245,3.055,2.271 c-1.119,0.877-2.529,1.4-4.061,1.4c-0.264,0-0.524-0.015-0.78-0.046c1.447,0.928,3.166,1.469,5.013,1.469 c6.015,0,9.304-4.983,9.304-9.304c0-0.142-0.003-0.283-0.009-0.423C14.976,4.29,15.531,3.714,15.969,3.058z"></path>
</svg>
</a>
<a href="{{ config.SERVICE_FB_URL }}">
<svg xmlns="http://www.w3.org/2000/svg" width="30" height="30" viewBox="0 0 30 30" style="
fill: #425497;
width: 30px;
height: 30px;
">
<path d="M15.117 0H.883C.395 0 0 .395 0 .883v14.234c0 .488.395.883.883.883h7.663V9.804H6.46V7.39h2.086V5.607c0-2.066 1.262-3.19 3.106-3.19.883 0 1.642.064 1.863.094v2.16h-1.28c-1 0-1.195.48-1.195 1.18v1.54h2.39l-.31 2.42h-2.08V16h4.077c.488 0 .883-.395.883-.883V.883C16 .395 15.605 0 15.117 0z"></path>
</svg>
</a>
</div>
{% endblock content %}

@ -247,12 +247,12 @@ class Payment(PolymorphicModel):
else:
author_balance.amount = self.amount
author_balance.save()
if isinstance(self, UserGiftCertificate) and self.is_paid():
if isinstance(self, GiftCertificatePayment) and self.is_paid():
ugs, created = UserGiftCertificate.objects.get_or_create(user=self.user, gift_certificate=self.gift_certificate,
payment=self)
if created:
from apps.notification.tasks import send_gift_certificate
send_gift_certificate.delay(ugs)
send_gift_certificate(ugs.id)
# Если юзер реферал и нет платежа, где применялась скидка
if hasattr(self.user, 'referral') and not self.user.referral.payment and self.is_paid():
# Платеж - как сигнал, что скидка применилась

@ -0,0 +1,14 @@
{% extends "templates/lilcity/index.html" %} {% load static %} {% block content %}
<div class="section">
<div class="section__center center center_xs">
<div class="done">
<div class="done__title title">Бонусы зачислены на ваш счет!</div>
<div>Вы можете оплатить с их помощью курс или онлайн-школу</div>
<div class="done__foot">
<a class="done__btn btn btn_md btn_stroke" href="{% url 'school:school' %}">Записаться в школу</a>
<a class="done__btn btn btn_md btn_stroke" href="{% url 'courses' %}">Купить курсы</a>
</div>
</div>
</div>
</div>
{% endblock content %}

@ -10,9 +10,19 @@
</div>
{% if user_gift_certificate %}
{% if user_gift_certificate.bonuses_sent %}
<div>Получено</div>
<div class="gift-certificates__status">
<svg class="icon">
<use xlink:href="{% static 'img/sprite.svg' %}#icon-add-plus"></use>
</svg>
Получено
</div>
{% else %}
<div>Ожидает получения</div>
<div class="gift-certificates__status">
<svg class="icon">
<use xlink:href="{% static 'img/sprite.svg' %}#icon-time"></use>
</svg>
Ожидает получения
</div>
{% endif %}
{% else %}
<a class="gift-certificates__buy-btn btn"

@ -21,6 +21,7 @@
<div class="text text_courses">Если вам не совсем удобно заниматься с нами каждый день в нашей онлайн-школе, специально для вас мы
делаем отдельные уроки в записи, которые вы можете проходить, когда вам будет удобно.<br><br>
Учите и развивайте креативное мышление когда и где угодно
<img src="/static/img/curve-1.svg" class="text__curve text__curve_one">
</div>
<div class="title title_center">Сертификаты</div>
<div class="gift-certificates">

@ -12,7 +12,7 @@ import calendar
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.http import HttpResponse
from django.http import HttpResponse, Http404
from django.shortcuts import redirect, get_object_or_404
from django.views.generic import View, TemplateView, DetailView
from django.views.decorators.csrf import csrf_exempt
@ -365,17 +365,25 @@ class GiftCertificateBuySuccessView(TemplateView):
template_name = 'payment/gift_certificate_payment_success.html'
def get(self, request, payment_id=None, *args, **kwargs):
# print(GiftCertificatePayment.objects.get(id=payment_id))
gift_certificate_payment = get_object_or_404(GiftCertificatePayment, pk=payment_id)
try:
GiftCertificatePayment.objects.get(id=payment_id)
except:
raise Http404()
return self.render_to_response(context={'gift_certificate': True})
@method_decorator(login_required, name='dispatch')
class GiftCertificateGetView(TemplateView):
template_name = 'payment/gift_certificate_get.html'
def get(self, request, slug, *args, **kwargs):
ugs = get_object_or_404(UserGiftCertificate, pk=short_url.decode_url(slug))
return self.render_to_response(context={'gift_certificate': ugs.gift_certificate, 'user_gift_certificate': ugs})
if UserBonus.objects.filter(payment=ugs.payment).exists():
raise Http404()
bonuses = UserBonus.objects.create(user=request.user, amount=ugs.gift_certificate.price,
payment=ugs.payment)
ugs.bonuses_sent = bonuses
ugs.save()
context = self.get_context_data(**kwargs)
return self.render_to_response(context)
def post(self, request, slug, *args, **kwargs):
pass

@ -20,6 +20,9 @@
{% if is_purchased %}ваша подписка истекает {{ subscription_ends_humanize }}<br/>перейти к оплате{% endif %}
</a>
{% if not is_purchased and not is_purchased_future %}
<a class="main__btn btn btn_stroke-black" href="{% url 'gift-certificates' %}">Подарить другу</a>
{% endif %}
</div>
<div class="main__school school school_main">
<div class="school__col">

@ -3,6 +3,7 @@
<div class="section__center center">
<div class="profile">
<a class="profile__btn profile__btn_edit btn" href="{% url 'user-edit-profile' %}">Редактировать</a>
<a data-popup=".js-popup-enter-gift-code" href="#" class="profile__btn btn btn_stroke-black">Ввести код</a>
<div class="profile__ava ava">
{% thumbnail user.photo "120x120" crop="center" as im %}
<img class="ava__pic" src="{{ im.url }}" width="{{ im.width }}" height="{{ im.height }}" />
@ -91,10 +92,10 @@
<a class="btn" href="{% url 'school:school' %}">Перейти в онлайн-школу</a>
</div>
{% endif %}
{% if gift_certificates.exists %}
{% if user_gift_certificates.exists %}
{% for ugs in user_gift_certificates %}
{% cycle 'theme_pink2' 'theme_cyan' 'theme_violet2' as theme_color silent %}
{% include "payment/gift_certificate_item.html" gift_certificate=ugs.gift_certificate user_gift_certificate=ugs %}
{% include "payment/gift_certificate_item.html" with gift_certificate=ugs.gift_certificate user_gift_certificate=ugs %}
{% endfor %}
{% endif %}
{% if paid.exists %}

@ -0,0 +1,27 @@
{% load static %}
<div class="popup js-popup-enter-gift-code">
<div class="popup__wrap popup__wrap_sm js-popup-wrap">
<button class="popup__close js-popup-close">
<svg class="icon icon-close">
<use xlink:href={% static "img/sprite.svg" %}#icon-close></use>
</svg>
</button>
<div class="popup__body">
<div class="enter-gift-code" style="padding:20px 20px 25px;">
<div class="subtitle">Введите код из подарочного сертификата</div>
<form>
{% csrf_token %}
<div class="field">
<div class="field__label">КОД</div>
<div class="field__wrap"><input class="field__input enter-gift-code__code" type="text"
placeholder="" tabindex="1"></div>
<div class="enter-gift-code__error field__error"></div>
</div>
<div style="text-align: center;">
<button type="submit" class="enter-gift-code__btn btn btn_light" tabindex="3">Подтвердить</button>
</div>
</form>
</div>
</div>
</div>
</div>

@ -6,10 +6,12 @@
<use xlink:href={% static "img/sprite.svg" %}#icon-close></use>
</svg>
</button>
<div class="popup__body">
<div class="popup__body" style="padding: 20px;">
{% if user_gift_certificate.user.id != request.user.id %}
<div class="subtitle">{{ user_gift_certificate.user.get_full_name }}
подарил{% if user_gift_certificate.user.gender = 'f' %}а{% endif %} вам Сертификат!</div>
<div class="gift-certificates__item">
подарил{% if user_gift_certificate.user.gender == 'f' %}а{% endif %} вам Сертификат!</div>
{% endif %}
<div class="gift-certificates__item" style="margin: 0;">
<div class="gift-certificates__preview theme_pink2"></div>
<div class="gift-certificates__details">
<span class="gift-certificates__title theme theme_pink2">подарочный сертификат</span>

@ -26,6 +26,10 @@
{% endif %}
class="main__btn btn"
>{% if not school_schedule.weekday in school_schedules_purchased %}Получить доступ{% else %}Смотреть урок{% endif %}</a>
{% if not is_purchased and not is_purchased_future %}
<a class="main__btn btn btn_stroke-black" href="{% url 'gift-certificates' %}">Подарить другу</a>
{% endif %}
</div>
{% elif user.is_authenticated and online_coming_soon and school_schedule and school_schedule.start_at_humanize %}
<div class="">
@ -45,6 +49,10 @@
{% endif %}
class="main__btn btn"
>{% if not school_schedule.weekday in school_schedules_purchased %}Получить доступ{% else %}Смотреть урок{% endif %}</a>
{% if not is_purchased and not is_purchased_future %}
<a class="main__btn btn btn_stroke-black" href="{% url 'gift-certificates' %}">Подарить другу</a>
{% endif %}
</div>
{% else %}
<div class="main__subtitle">
@ -59,6 +67,7 @@
>
купить доступ от {{ min_school_price }} руб./месяц
</a>
<a class="main__btn btn btn_stroke-black" href="{% url 'gift-certificates' %}">Подарить другу</a>
{% else %}
<a class="main__btn btn btn_white" href="{% url 'school:school' %}">Подробнее</a>
{% endif %}

@ -81,7 +81,7 @@ class IndexView(TemplateView):
if user_gift_certificate:
try:
user_gift_certificate = short_url.decode_url(user_gift_certificate)
user_gift_certificate = UserGiftCertificate.objects,get(pk=user_gift_certificate)
user_gift_certificate = UserGiftCertificate.objects.get(pk=user_gift_certificate, bonuses_sent__isnull=True)
except:
user_gift_certificate = None

@ -137,6 +137,21 @@ $(document).ready(function () {
}
popup.data('next-url', nextUrl);
}
if( data === '.js-popup-enter-gift-code') {
const $giftCode = popup.find('.enter-gift-code__code');
const $giftError = popup.find('.enter-gift-code__error');
$giftCode.val('');
$giftError.text('');
popup.find('.enter-gift-code__btn').one('click', () => {
const code = $giftCode.val();
if(! code){
$giftError.text('Укажите код');
return;
}
// TODO
});
}
});
$('.js-popup-close').on('click', function(e){

@ -209,6 +209,10 @@ button
&_pink
background: #ff9393
color: white
&_stroke-black
background: none
border: 1px solid $cl
color: $cl
&_md
padding: 18px 24px 17px
+m
@ -4453,6 +4457,16 @@ a
color: $cl
&__title
text-transform: uppercase
&__status
font-family: 'ProximaNova-Bold', serif
font-size: 12px
letter-spacing: 2px
text-transform: uppercase
& .icon
width: 16px
display: inline-block
height: 16px
margin-bottom: -4px
&__buy-btn
width: 100%
&__preview.theme_pink2

Loading…
Cancel
Save