diff --git a/src/customer/context_processors.py b/src/customer/context_processors.py index 1c3bd3b..591c290 100644 --- a/src/customer/context_processors.py +++ b/src/customer/context_processors.py @@ -1,5 +1,8 @@ # -*- coding: utf-8 -*- import logging + +from pytils import numeral + from datetime import datetime, timedelta from django.core.cache import cache from customer.models import License @@ -86,4 +89,6 @@ def confirm_user_bonus(request): message = get_display_message_for_bonus(confirm_bonus_days) context['message_bonus'] = message + context['message_days'] = f'{confirm_bonus_days} ' \ + f'{numeral.choose_plural(confirm_bonus_days, "день, дня, дней")}' return context diff --git a/src/customer/utils.py b/src/customer/utils.py index 1bcca3c..ed6e0ec 100644 --- a/src/customer/utils.py +++ b/src/customer/utils.py @@ -152,11 +152,11 @@ def get_display_message_for_bonus(day_count): return message if day_count == 0: - message = f'Сегодня последний день что бы получить бонус' + message = f'Сегодня последний день что бы получить бонус' if day_count > 0: message = f'У вас есть ещё {day_count} ' \ f'{numeral.choose_plural(day_count, "день, дня, дней")}, ' \ - f'чтобы получить бонус' + f'чтобы получить бонус' return message diff --git a/static/css/style.css b/static/css/style.css index cec64b5..31548bc 100644 --- a/static/css/style.css +++ b/static/css/style.css @@ -1188,3 +1188,72 @@ input[type=number] { #doc_reason_date { margin-left: -96px; } + +/* modal dialog bonus */ +#containerBonusMsg { + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 100%; + visibility:hidden; + display:none; + background-color: rgba(22,22,22,0.5); + z-index: 100; +} + +#containerBonusMsg:target { + visibility: visible; + display: block; +} + +.modal-bonus { + position: relative; + background: #fff; + top: 50%; + left: 50%; + width: 800px; + height: 320px; + -ms-transform: translate(-50%,-50%); + -moz-transform:translate(-50%,-50%); + -webkit-transform: translate(-50%,-50%); + transform: translate(-50%,-50%); +} + +.modal-bonus__wrapper { + padding: 5px; +} + +.modal-bonus__header { + padding: .4em 1em; +} + +.modal-bonus__title { + vertical-align: middle; + text-transform: uppercase; + color: #646669; + font-size: 18px; + font-weight: normal; + font-stretch: ultra-condensed; + font-family: "Arial Narrow", Arial, sans-serif; + display: inline-block; + width: 735px; +} + +.modal-bonus__close-button { + vertical-align: middle; + display: inline-block; + background: url(../img/close.png) no-repeat top; + opacity: 0.5; + width: 22px; + height: 22px; + cursor: pointer; +} + +.modal-bonus__close-button:hover { + opacity: 1; +} + +.modal-bonus__body { + padding: .5em 1em; +} diff --git a/static/js/commons.js b/static/js/commons.js index e50ed16..49a57bc 100644 --- a/static/js/commons.js +++ b/static/js/commons.js @@ -157,3 +157,17 @@ function getUrlVars() { return vars; } +(function($) { + $.fn.invisible = function() { + return this.each(function() { + $(this).css("visibility", "hidden"); + $(this).hide(); + }); + }; + $.fn.visible = function() { + return this.each(function() { + $(this).css("visibility", "visible"); + $(this).show(); + }); + }; +}(jQuery)); diff --git a/static/js/profile/asset.js b/static/js/profile/asset.js index 06ff2e9..e9c3b0c 100644 --- a/static/js/profile/asset.js +++ b/static/js/profile/asset.js @@ -1,19 +1,3 @@ -(function($) { - $.fn.invisible = function() { - return this.each(function() { - $(this).css("visibility", "hidden"); - $(this).hide(); - }); - }; - $.fn.visible = function() { - return this.each(function() { - $(this).css("visibility", "visible"); - $(this).show(); - }); - }; -}(jQuery)); - - $(document).ready(function () { var $uploadCrop, diff --git a/templates/base.html b/templates/base.html index 0c13016..09a584b 100644 --- a/templates/base.html +++ b/templates/base.html @@ -78,6 +78,33 @@ {% endblock %} {% block content %}{% endblock %} + + {% if message_bonus %} +
+ +
+ {% endif %} + {% block bottom_wide %}{% endblock %} {% block footer %} @@ -128,7 +155,7 @@ {% endif %} - + {% block common_js %} @@ -151,6 +178,34 @@ window.daDataExternalApiKey = "{{ dadata_api_key }}"; }); + + {% endblock %} {% block js %}{% endblock %} diff --git a/templates/customer/profile/edit.html b/templates/customer/profile/edit.html index 879177c..6e5a52a 100644 --- a/templates/customer/profile/edit.html +++ b/templates/customer/profile/edit.html @@ -449,7 +449,7 @@ -
+