remotes/origin/feature/LIL-711
gzbender 7 years ago
parent 1e4e451115
commit 0b8390cf03
  1. 1
      apps/notification/tasks.py
  2. 25
      apps/notification/templates/notification/email/gift_certificate.html
  3. 23
      apps/notification/utils.py
  4. 3
      apps/payment/templates/payment/gift_certificate_get.html
  5. 13
      apps/payment/templates/payment/gift_certificate_item.html
  6. 9
      apps/payment/templates/payment/gift_certificates.html
  7. 5
      apps/payment/views.py
  8. 6
      apps/user/templates/user/profile.html
  9. 23
      project/templates/blocks/popup_enter_gift_code.html
  10. 4
      project/templates/blocks/popup_gift_certificate.html
  11. 1
      project/templates/lilcity/index.html
  12. BIN
      web/src/img/clock.png
  13. BIN
      web/src/img/done.png
  14. BIN
      web/src/img/fb.png
  15. BIN
      web/src/img/instagram.png
  16. BIN
      web/src/img/twitter.png
  17. 4
      web/src/js/modules/popup.js
  18. 21
      web/src/sass/_common.sass

@ -107,4 +107,5 @@ def sendgrid_update_recipients():
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',
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)

@ -92,24 +92,21 @@
<div style="
margin-bottom: 10px;
text-align: center;">
{% if config.SERVICE_TWITTER_URL %}
<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>
<img src="cid:{{ twitter_icon }}" />
</a>
{% endif %}
{% if config.SERVICE_FB_URL %}
<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>
<img src="cid:{{ fb_icon }}" />
</a>
{% endif %}
{% if config.SERVICE_INSTAGRAM_URL %}
<a href="{{ config.SERVICE_INSTAGRAM_URL }}">
<img src="cid:{{ instagram_icon }}" />
</a>
{% endif %}
</div>
{% endblock content %}

@ -1,16 +1,27 @@
from django.contrib.staticfiles.storage import staticfiles_storage
from twilio.rest import Client
from django.core.mail import EmailMessage
from django.core.mail import EmailMessage, EmailMultiAlternatives
from anymail.message import attach_inline_image_file
from django.conf import settings
from django.template.loader import get_template
from project.celery import app
@app.task
def send_email(subject, to_email, template_name, attachments=[], **kwargs):
html = get_template(template_name).render(kwargs)
email = EmailMessage(subject, html, to=[to_email], attachments=attachments)
email.content_subtype = 'html'
def send_email(subject, to_email, template_name, attachments=[], inline_images=[], **kwargs):
if inline_images:
email = EmailMultiAlternatives(subject, '', to=[to_email], attachments=attachments)
context = kwargs
for name, path in inline_images:
cid = attach_inline_image_file(email, staticfiles_storage.path(path))
context[name] = cid
html = get_template(template_name).render(context)
email.attach_alternative(html, "text/html")
else:
html = get_template(template_name).render(kwargs)
email = EmailMessage(subject, html, to=[to_email], attachments=attachments)
email.content_subtype = 'html'
email.send()

@ -5,7 +5,8 @@
<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 'school:school' %}"
style="margin-bottom: 10px;">Записаться в школу</a>
<a class="done__btn btn btn_md btn_stroke" href="{% url 'courses' %}">Купить курсы</a>
</div>
</div>

@ -5,22 +5,21 @@
<div class="gift-certificates__item">
<div class="gift-certificates__preview {{ theme_color }}"></div>
<div class="gift-certificates__details">
<span class="gift-certificates__title theme {{ theme_color }}">подарочный сертификат</span>
<span class="gift-certificates__title theme {{ theme_color }}">
{% if user_gift_certificate and not user_gift_certificate.bonuses_sent %}
<a href="{% url 'gift-certificate-get' user_gift_certificate.code %}">подарочный сертификат</a>
{% else %}подарочный сертификат{% endif %}</span>
<div class="gift-certificates__price">{{ gift_certificate.price|floatformat:"-2" }}₽</div>
</div>
{% if user_gift_certificate %}
{% if user_gift_certificate.bonuses_sent %}
<div class="gift-certificates__status">
<svg class="icon">
<use xlink:href="{% static 'img/sprite.svg' %}#icon-add-plus"></use>
</svg>
<img class="icon" src="{% static 'img/done.png' %}" />
Получено
</div>
{% else %}
<div class="gift-certificates__status">
<svg class="icon">
<use xlink:href="{% static 'img/sprite.svg' %}#icon-time"></use>
</svg>
<img class="icon" style="margin-top: -1px; height: auto;" src="{% static 'img/clock.png' %}" />
Ожидает получения
</div>
{% endif %}

@ -18,9 +18,12 @@
<div class="section section_courses">
<div class="section__center center">
<div class="text text_courses">Если вам не совсем удобно заниматься с нами каждый день в нашей онлайн-школе, специально для вас мы
делаем отдельные уроки в записи, которые вы можете проходить, когда вам будет удобно.<br><br>
Учите и развивайте креативное мышление когда и где угодно
<div class="text text_courses">Подарочный сертификат Lil City - отличный презент на любой праздник.<br>
А также сертификат можно подарить без повода - развитие <br>творческого потенциала всегда уместно и актуально.
При покупке подарочного сертификата мы высылаем письмо,<br>
где будет уникальный код и уникальная ссылка. Письмо или ссылку<br>
на него вы можете переслать другому. Сертификатом можно<br>
воспользоваться, перейдя по ссылке.
<img src="/static/img/curve-1.svg" class="text__curve text__curve_one">
</div>
<div class="title title_center">Сертификаты</div>

@ -377,7 +377,10 @@ 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))
try:
ugs = get_object_or_404(UserGiftCertificate, pk=short_url.decode_url(slug))
except:
raise Http404()
if UserBonus.objects.filter(payment=ugs.payment).exists():
raise Http404()
bonuses = UserBonus.objects.create(user=request.user, amount=ugs.gift_certificate.price,

@ -2,8 +2,10 @@
<div class="section">
<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__btns">
<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>
<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 }}" />

@ -8,19 +8,16 @@
</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 class="subtitle2">Введите код из подарочного сертификата</div>
<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;">
<a href="#" class="enter-gift-code__btn btn btn_light" tabindex="3">Подтвердить</a>
</div>
</div>
</div>
</div>

@ -8,8 +8,10 @@
</button>
<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 }}
<div class="subtitle2">{{ user_gift_certificate.user.get_full_name }}
подарил{% if user_gift_certificate.user.gender == 'f' %}а{% endif %} вам Сертификат!</div>
{% else %}
<div class="subtitle2">Получите подарочный сертификат на сумму {{ gift_certificate.price|floatformat:"-2" }}₽!</div>
{% endif %}
<div class="gift-certificates__item" style="margin: 0;">
<div class="gift-certificates__preview theme_pink2"></div>

@ -148,6 +148,7 @@
{% if is_gift_certificate_url %}
{% include "templates/blocks/popup_gift_certificate.html" %}
{% endif %}
{% include "templates/blocks/popup_enter_gift_code.html" %}
{% include "templates/blocks/popup_course_lock.html" %}
{% include "templates/blocks/popup_subscribe.html" %}
</div>

Binary file not shown.

After

Width:  |  Height:  |  Size: 367 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 308 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

@ -147,9 +147,9 @@ $(document).ready(function () {
const code = $giftCode.val();
if(! code){
$giftError.text('Укажите код');
return;
return false;
}
// TODO
window.location.href = `/gift-certificate/${code}/get`;
});
}
});

@ -834,6 +834,11 @@ a[name]
+t
text-align: center
.subtitle2
margin-bottom: 20px
font-size: 18px
font-weight: bold
.text
position: relative
max-width: 620px
@ -3209,12 +3214,16 @@ a.grey-link
background: transparent
border: 1px solid $gray
color: $gray
&_edit
position: absolute
top: 0
right: 0
+m
display: none !important
margin-bottom: 10px
width: 100%
&__btns
position: absolute
top: 0
right: 0
display: flex
flex-direction: column
+m
display: none !important
&__row
display: flex
margin-bottom: 25px

Loading…
Cancel
Save