parent
167a6470b3
commit
a8b8e0b83a
14 changed files with 192 additions and 25 deletions
@ -0,0 +1,23 @@ |
||||
# Generated by Django 2.0.6 on 2018-08-20 08:53 |
||||
|
||||
from django.db import migrations |
||||
|
||||
|
||||
class Migration(migrations.Migration): |
||||
|
||||
dependencies = [ |
||||
('config', '0009_auto_20180729_0503'), |
||||
] |
||||
|
||||
operations = [ |
||||
migrations.RenameField( |
||||
model_name='config', |
||||
old_name='REFERRAL_DISCOUNT', |
||||
new_name='REFERRAL_BONUS', |
||||
), |
||||
migrations.RenameField( |
||||
model_name='config', |
||||
old_name='REFERRER_CASHBACK', |
||||
new_name='REFERRER_BONUS', |
||||
), |
||||
] |
||||
@ -0,0 +1,28 @@ |
||||
# Generated by Django 2.0.6 on 2018-08-20 06:51 |
||||
|
||||
from django.conf import settings |
||||
from django.db import migrations, models |
||||
import django.db.models.deletion |
||||
|
||||
|
||||
class Migration(migrations.Migration): |
||||
|
||||
dependencies = [ |
||||
('user', '0025_auto_20180820_0651'), |
||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL), |
||||
('payment', '0019_payment_roistat_visit'), |
||||
] |
||||
|
||||
operations = [ |
||||
migrations.CreateModel( |
||||
name='UserBonus', |
||||
fields=[ |
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), |
||||
('amount', models.DecimalField(decimal_places=2, default=0, editable=False, max_digits=8)), |
||||
('created_at', models.DateTimeField(auto_now_add=True)), |
||||
('payment', models.OneToOneField(null=True, on_delete=django.db.models.deletion.SET_NULL, to='payment.Payment')), |
||||
('referral', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='user.Referral')), |
||||
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='bonuses', to=settings.AUTH_USER_MODEL)), |
||||
], |
||||
), |
||||
] |
||||
@ -0,0 +1,20 @@ |
||||
# Generated by Django 2.0.6 on 2018-08-20 06:51 |
||||
|
||||
from django.conf import settings |
||||
from django.db import migrations, models |
||||
import django.db.models.deletion |
||||
|
||||
|
||||
class Migration(migrations.Migration): |
||||
|
||||
dependencies = [ |
||||
('user', '0024_referral_payment'), |
||||
] |
||||
|
||||
operations = [ |
||||
migrations.AlterField( |
||||
model_name='referral', |
||||
name='referral', |
||||
field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='referral', to=settings.AUTH_USER_MODEL), |
||||
), |
||||
] |
||||
@ -0,0 +1,9 @@ |
||||
<div class="section section_gray section_menu"> |
||||
<div class="section__center center center_xs"> |
||||
<div class="menu"> |
||||
<a class="menu__link" href="{% url 'user-edit-profile' %}">Профиль</a> |
||||
<a class="menu__link" href="{% url 'user-edit-notifications' user.id %}">Уведомления</a> |
||||
<a class="menu__link active" href="{% url 'user-edit-payments' user.id %}">Платежи</a> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
@ -0,0 +1,54 @@ |
||||
{% extends "templates/lilcity/index.html" %} |
||||
{% load static %} |
||||
{% load rupluralize from plural %} |
||||
|
||||
{% block content %} |
||||
{% include "../blocks/menu.html" %} |
||||
|
||||
<div class="section section_gray"> |
||||
<div class="section__center center center_xs"> |
||||
<div class="title title_sm">Бонусы</div> |
||||
<div class="text">У вас {{ request.user.bonus|rupluralize:"бонус,бонуса,бонусов" }}</div> |
||||
<div> |
||||
Вы можете пригласить своих друзей в наш сервис, за это вы получите {{ config.REFERRER_BONUS }} % от суммы |
||||
их первой покупки и они получат {{ config.REFERRAL_BONUS }} % от суммы покупки на свой бонусный счет <br> |
||||
Просто отправьте им эту ссылку, по которой они смогут зарегестрироваться: |
||||
</div> |
||||
<div class="text">{{ referrer_url }}</div> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="section section_gray"> |
||||
<div class="section__center center center_xs"> |
||||
<div class="title title_sm">История бонусов</div> |
||||
<div class="transactions"> |
||||
<div class="transactions__wrap"> |
||||
{% for bonus in bonuses %} |
||||
<div class="transactions__row"> |
||||
{% with payment=bonus.payment %} |
||||
{% if payment.course %} |
||||
<div class="transactions__cell">Курс. {{ payment.course.title }}</div> |
||||
{% else %} |
||||
<div class="transactions__cell"> |
||||
Школа. {% if payment.date_start and payment.date_end %}{{ payment.date_start }} - {{ payment.date_end }}{% endif %} |
||||
</div> |
||||
{% endif %} |
||||
{% if payment.balance %} |
||||
<div class="transactions__cell">{{payment.balance.amount}}</div> |
||||
{% else %} |
||||
<div class="transactions__cell">{{payment.amount}}</div> |
||||
{% endif %} |
||||
{% if bonus.referral %} |
||||
<div class="transactions__cell"><a href="{% url 'user' id=bonus.referral.id %}">{{ bonus.referral.get_full_name }}</a></div> |
||||
{% endif %} |
||||
<div class="transactions__cell">{{ bonus.amount }}</div> |
||||
{% endwith %} |
||||
</div> |
||||
{% empty %} |
||||
Нет истории бонусов |
||||
{% endfor %} |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
{% endblock content %} |
||||
Loading…
Reference in new issue