diff --git a/apps/notification/tasks.py b/apps/notification/tasks.py index 0a3e09cd..7430e0b9 100644 --- a/apps/notification/tasks.py +++ b/apps/notification/tasks.py @@ -12,7 +12,7 @@ from django.conf import settings from apps.notification.models import UserNotification from apps.notification.utils import send_email -from apps.payment.models import SchoolPayment, CoursePayment, Payment, UserGiftCertificate +from apps.payment.models import SchoolPayment, CoursePayment, Payment, UserGiftCertificate, UserBonus from project.celery import app from project.utils.db import format_sql, execute_sql from project.sengrid import get_sendgrid_client @@ -143,3 +143,11 @@ def send_gift_certificate(user_gift_certificate): send_email('Подарочный сертификат от Lil School', user_gift_certificate.user.email, 'notification/email/gift_certificate.html', inline_images=[('twitter_icon', 'img/twitter.png'), ('fb_icon', 'img/fb.png'), ('instagram_icon', 'img/instagram.png'),], user_gift_certificate=user_gift_certificate, gift_certificate=user_gift_certificate.gift_certificate) + + +@app.task +def send_child_birthday_bonuses(): + for u in User.objects.exclude(child_first_name='', child_last_name='',).filter(child_birthday=now().date()): + if not UserBonus.objects.filter(user=u, is_service=True, action_name=UserBonus.ACTION_CHILD_BIRTHDAY).count(): + UserBonus.objects.create(user=u, amount=UserBonus.AMOUNT_CHILD_BIRTHDAY, is_service=True, + action_name=UserBonus.ACTION_CHILD_BIRTHDAY) diff --git a/apps/user/templates/user/bonus-history.html b/apps/user/templates/user/bonus-history.html index 211bf9f5..8a66485f 100644 --- a/apps/user/templates/user/bonus-history.html +++ b/apps/user/templates/user/bonus-history.html @@ -50,7 +50,7 @@
Заполнить профиль
Заполните свой профиль, включая номер телефона. -
+50 LIL
+
+{{ amount_fill_profile }} LIL
ЗАПОЛНИТЬ
{% if request.user.phone and request.user.first_name and request.user.last_name %} {% endif %}
@@ -61,7 +61,7 @@
Оплата второго месяца или курса
Получайте бонусы при оплате последующий месяцев обучения или курсов. Чем большевы с нами, чем больше Лиликов вы получаете. -
+100 LIL
+
+{{ amount_paid_one_more }} LIL
ВЫБРАТЬ КУРС
{% if request.user.paid_one_more %}{% endif %}
@@ -71,7 +71,7 @@
Видео-отзыв о Lil School
Выкладывайте свои видео-обзоры и видео-отзывы в Инстаграм с тегом @Lil.School #LilSchool и высылаете отчет на почту school@lil.city -
+100 LIL
+
+{{ amount_have_review }} LIL
ПОСМОТРЕТЬ ПРИМЕР
{% if request.user.review_url %}{% endif %}
@@ -81,7 +81,7 @@
На День Рождения!
Мы любим наших учеников, поэтому дарим лилики на день рождения. -
+200 LIL
+
+{{ amount_child_birthday }} LIL
ЗАПОЛНИТЬ КАРТОЧКУ РЕБЕНКА
{% if request.user.child_first_name and request.user.child_last_name and request.user.child_birthday %} {% endif %}
diff --git a/apps/user/templates/user/profile-settings.html b/apps/user/templates/user/profile-settings.html index 0ac4bc7d..64bcc234 100644 --- a/apps/user/templates/user/profile-settings.html +++ b/apps/user/templates/user/profile-settings.html @@ -121,8 +121,8 @@
ДАТА РОЖДЕНИЯ
- +
{% for error in form.child_birthday.errors %}
{{ error }}
@@ -187,7 +187,8 @@
ДАТА РОЖДЕНИЯ
- +
{% for error in form.birthday.errors %}
{{ error }}
diff --git a/apps/user/templates/user/profile.html b/apps/user/templates/user/profile.html index 55739737..22e9059e 100644 --- a/apps/user/templates/user/profile.html +++ b/apps/user/templates/user/profile.html @@ -1,6 +1,6 @@ {% extends "templates/lilcity/index.html" %} {% load static %} {% load thumbnail %} {% block content %} -{% if not user.child_first_name and not user.child_last_name %} +{% if not user.child_first_name or not user.child_birthday %}
diff --git a/apps/user/views.py b/apps/user/views.py index e2571acc..fb5b47cb 100644 --- a/apps/user/views.py +++ b/apps/user/views.py @@ -319,6 +319,13 @@ class BonusHistoryView(TemplateView): 'Занимайтесь с ребёнком творчеством, не выходя из дома. ' \ 'Перейдите по ссылке и получите скидку %d%% на первую покупку' \ % (request.user.get_full_name(), config.REFERRAL_BONUS) + context.update({ + 'amount_have_review': UserBonus.AMOUNT_HAVE_REVIEW, + 'amount_fill_profile': UserBonus.AMOUNT_FILL_PROFILE, + 'amount_paid_one_more': UserBonus.AMOUNT_PAID_ONE_MORE, + 'amount_child_birthday': UserBonus.AMOUNT_CHILD_BIRTHDAY, + + }) return self.render_to_response(context) diff --git a/project/settings.py b/project/settings.py index edfcdf90..91912cae 100644 --- a/project/settings.py +++ b/project/settings.py @@ -262,6 +262,11 @@ CELERY_BEAT_SCHEDULE = { 'schedule': crontab(minute=0, hour=3), 'args': (), }, + 'send_child_birthday_bonuses': { + 'task': 'apps.notification.tasks.send_child_birthday_bonuses', + 'schedule': crontab(minute=0, hour=0), + 'args': (), + }, } try: diff --git a/web/src/js/app.js b/web/src/js/app.js index 8b6be846..b05611ba 100644 --- a/web/src/js/app.js +++ b/web/src/js/app.js @@ -23,6 +23,7 @@ import $ from 'jquery'; import Vue from 'vue'; import Vuelidate from 'vuelidate'; import VueAutosize from '../components/directives/autosize' +import DatePicker from 'vuejs-datepicker' import Comments from '../components/Comments'; import Likes from '../components/blocks/Likes.vue'; import FAQ from '../components/FAQ.vue'; @@ -39,6 +40,7 @@ const components = { 'likes': Likes, 'comments': Comments, 'faq': FAQ, + 'vue-datepicker': DatePicker, }; Object.assign(components, window.LIL_STORE.components); diff --git a/web/src/sass/_common.sass b/web/src/sass/_common.sass index a735c24a..3e280cff 100755 --- a/web/src/sass/_common.sass +++ b/web/src/sass/_common.sass @@ -3280,6 +3280,10 @@ a.grey-link padding: 40px 35px background: url(../img/fill-profile-gramota.png) center bottom no-repeat + +m + flex-direction: column + padding: 20px 15px + &:before content: '' position: absolute @@ -3295,6 +3299,11 @@ a.grey-link flex: 0 0 300px font-size: 18px + +m + flex: 1 + font-size: 16px + margin-bottom: 40px + &__img flex: 1 @@ -3302,10 +3311,17 @@ a.grey-link flex: 0 0 205px text-align: right + +m + margin-bottom: 35px + flex: 1 + &__arrow flex: 0 0 50px text-align: right + +m + display: none + .tabs &__nav display: flex