diff --git a/apps/payment/migrations/0033_userbonus_notified_at.py b/apps/payment/migrations/0033_userbonus_notified_at.py new file mode 100644 index 00000000..9804bcb0 --- /dev/null +++ b/apps/payment/migrations/0033_userbonus_notified_at.py @@ -0,0 +1,18 @@ +# Generated by Django 2.0.7 on 2019-03-27 20:54 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('payment', '0032_auto_20190207_1233'), + ] + + operations = [ + migrations.AddField( + model_name='userbonus', + name='notified_at', + field=models.DateTimeField(blank=True, null=True), + ), + ] diff --git a/apps/payment/migrations/0034_auto_20190327_2055.py b/apps/payment/migrations/0034_auto_20190327_2055.py new file mode 100644 index 00000000..00ec22f5 --- /dev/null +++ b/apps/payment/migrations/0034_auto_20190327_2055.py @@ -0,0 +1,22 @@ +# Generated by Django 2.0.7 on 2019-03-27 20:55 + +from django.utils import timezone +from django.db import migrations + + +def fill_bonuses_notified_at(apps, schema_editor): + UserBonus = apps.get_model('payment', 'UserBonus') + for ub in UserBonus.objects.filter(notified_at__isnull=True): + ub.notified_at = timezone.now() + ub.save() + + +class Migration(migrations.Migration): + + dependencies = [ + ('payment', '0033_userbonus_notified_at'), + ] + + operations = [ + migrations.RunPython(fill_bonuses_notified_at), + ] diff --git a/apps/payment/models.py b/apps/payment/models.py index 4e157d4a..b8d45a46 100644 --- a/apps/payment/models.py +++ b/apps/payment/models.py @@ -306,6 +306,7 @@ class UserBonus(models.Model): created_at = models.DateTimeField(auto_now_add=True) is_service = models.BooleanField(default=False) action_name = models.CharField(max_length=10, blank=True, default='') + notified_at = models.DateTimeField(blank=True, null=True) class Meta: ordering = ('created_at',) diff --git a/apps/user/models.py b/apps/user/models.py index 87d43490..97dc1990 100644 --- a/apps/user/models.py +++ b/apps/user/models.py @@ -138,6 +138,14 @@ class User(AbstractUser): Q(payment__isnull=False, payment__status__in=Payment.PW_PAID_STATUSES) | Q(is_service=True), ).aggregate(models.Sum('amount')).get('amount__sum') or 0) + @property + def has_new_bonuses(self): + from apps.payment.models import Payment + last_bonus = self.bonuses.filter( + Q(payment__isnull=False, payment__status__in=Payment.PW_PAID_STATUSES) | Q(is_service=True), + ).order_by('-created_at').first() + return bool(last_bonus) and not last_bonus.notified_at + @receiver(post_save, sender=User) def create_auth_token(sender, instance=None, created=False, **kwargs): diff --git a/apps/user/templates/user/bonus-history.html b/apps/user/templates/user/bonus-history.html index ef3bf9d8..1971815a 100644 --- a/apps/user/templates/user/bonus-history.html +++ b/apps/user/templates/user/bonus-history.html @@ -3,7 +3,6 @@ {% load rupluralize from plural %} {% block content %} -
@@ -12,24 +11,72 @@ 1 LIL = 1 ₽
-
- Приглашайте друзей в Lil School и получайте {{ config.REFERRER_BONUS }}% - от суммы их первой покупки. Накапливайте монеты и тратьте их на оплату школы и курсов. -
- Просто отправьте эту ссылку, по которой ваши друзья могут присоединиться к нам: +
+
+
Приглашайте друзей в Lil School
+
+ Получайте {{ config.REFERRER_BONUS }}% от суммы их первой покупки. +
+ Просто отправьте эту ссылку, по которой ваши друзья могут присоединиться к нам: +
+
+
+ + +
-
-
-
- - +
+
Как еще заработать лилики?
+
+ Накапливайте монеты и тратьте их на оплату школы и курсов. Около трети наших учеников обучаются за счет лиликов. +
+ +
+
+
1
+
+
Заполнить профиль
+ Заполните свой профиль, включая номер телефона. +
+
+50 LIL
+ +
+
+
+
2
+
+
Оплата второго месяца или курса
+ Получайте бонусы при оплате последующий месяцев обучения или курсов. Чем большевы с нами, чем больше Лиликов вы получаете. +
+
+100 LIL
+ +
+
+
+
3
+
+
Видео-отзыв о Lil School
+ Выкладывайте свои видео-обзоры и видео-отзывы в Инстаграм с тегом @Lil.School #LilSchool и высылаете отчет на почту school@lil.city +
+
+100 LIL
+ +
+
+
+
4
+
+
На День Рождения!
+ Мы любим наших учеников, поэтому дарим лилики на день рождения. +
+
+200 LIL
+ +
- {% include 'templates/blocks/share.html' with share_object_name="ссылкой" share_url=referrer_url share_tw_title=share_text share_tg_text=share_text %}
diff --git a/project/templates/blocks/lil_store_js.html b/project/templates/blocks/lil_store_js.html index cc334c94..3c312492 100644 --- a/project/templates/blocks/lil_store_js.html +++ b/project/templates/blocks/lil_store_js.html @@ -17,6 +17,8 @@ id: '{{ request.user.id|default:'' }}', role: +'{{ request.user.role }}', photo: '{% if request.user.photo %}{{ request.user.photo.url }}{% else %}{% static 'img/user_default.jpg' %}{% endif %}', + hasNewBonuses: '{{ request.user.has_new_bonuses|yesno:"true,false" }}', + bonus: +'{{ request.user.bonus }}', }, components: {}, urls: { diff --git a/project/templates/blocks/popup_bonuses_came.html b/project/templates/blocks/popup_bonuses_came.html new file mode 100644 index 00000000..b85ceb16 --- /dev/null +++ b/project/templates/blocks/popup_bonuses_came.html @@ -0,0 +1,18 @@ + diff --git a/project/templates/lilcity/index.html b/project/templates/lilcity/index.html index 1e406194..4c228b4e 100644 --- a/project/templates/lilcity/index.html +++ b/project/templates/lilcity/index.html @@ -48,6 +48,7 @@ {% include "templates/blocks/popup_course_lock.html" %} {% include "templates/blocks/popup_subscribe.html" %} {% include "templates/blocks/popup_capture_email.html" %} + {% include "templates/blocks/popup_bonuses_came.html" %}
{% include 'templates/blocks/lil_store_js.html' %} {% block pre_app_js %}{% endblock pre_app_js %} diff --git a/web/src/fonts/ProximaNova-Bold.otf b/web/src/fonts/ProximaNova-Bold.otf new file mode 100644 index 00000000..4df9e171 Binary files /dev/null and b/web/src/fonts/ProximaNova-Bold.otf differ diff --git a/web/src/img/lilcoin48x54.png b/web/src/img/lilcoin48x54.png new file mode 100644 index 00000000..961dbcde Binary files /dev/null and b/web/src/img/lilcoin48x54.png differ diff --git a/web/src/img/lilcoin_spin.gif b/web/src/img/lilcoin_spin.gif new file mode 100644 index 00000000..83157af9 Binary files /dev/null and b/web/src/img/lilcoin_spin.gif differ diff --git a/web/src/js/modules/popup.js b/web/src/js/modules/popup.js index 8d3079ba..cbf94677 100644 --- a/web/src/js/modules/popup.js +++ b/web/src/js/modules/popup.js @@ -303,6 +303,11 @@ $(document).ready(function () { showPopup(); } + if(window.LIL_STORE.user.id && window.LIL_STORE.user.hasNewBonuses){ + popup = $('.js-popup-bonuses-came'); + showPopup(); + } + function showPopup(){ if(! popup && popupName){ popup = $(popupName); diff --git a/web/src/sass/_common.sass b/web/src/sass/_common.sass index 70e754e6..3cecec42 100755 --- a/web/src/sass/_common.sass +++ b/web/src/sass/_common.sass @@ -4457,18 +4457,35 @@ a .referrer-url display: flex + + +m + flex-direction: column + + &__text-column + flex: 50% + padding-right: 16% + padding-top: 8px + + +m + padding-right: 0 + + &__title + font-size: 20px + margin-bottom: 5px + + &__url-column + display: flex + flex-direction: column + flex: 30% + align-items: center + &__input - width: auto height: 40px - border: 1px solid #D1FF7F - padding: 8px - border-radius: 3px 0 0 3px - border-right: none + width: 100% + margin-bottom: 5px - &:focus - border: 1px solid #D1FF7F &__btn - border-radius: 0 3px 3px 0 + width: 100% .bonuses @@ -4557,3 +4574,60 @@ a margin-top: -20px color: #333333 font-size: 12px + + +.bonuses-table + margin-left: -110px + margin-top: 50px + + &__row + display: flex + width: 100% + margin-bottom: 20px + + & > div + font-size: 14px + + & > div:nth-child(1) + flex: 115px + font-size: 40px + margin-top: -7px + text-align: center + & > div:nth-child(2) + flex: 320px + & > div:nth-child(3) + flex: 165px + font-size: 20px + font-weight: bold + text-align: center + & > div:nth-child(4) + flex: 220px + + & .btn + width: 100% + + & > div:nth-child(5) + flex: 40px + text-align: center + + &__title + margin-bottom: 5px + font-size: 20px + + +.bonuses-came + &__body + padding: 30px 30px 50px + text-align: center + + &__title + margin-bottom: 5px + margin-top: 5px + font-size: 25px + + &__bonuses + font-size: 50px + margin-bottom: -8px + + &__text + margin: 40px 0