Merge remote-tracking branch 'origin/main'

This commit is contained in:
SBD
2024-01-22 17:41:33 +03:00
20 changed files with 494 additions and 135 deletions

View File

@@ -415,7 +415,7 @@ def registration_ajax(request):
user = User.objects.create_user(username=form.data['email'], email=form.data['email'], password=form.data['password'])
# user = auth.authenticate(username=new_user_Dict['name'], password=new_user_Dict['pass'])
if user:
auth.login(request, user)
auth.login(request, user, backend='django.contrib.auth.backends.ModelBackend')
user.last_name = form.data['lastname']
user.first_name = form.data['firstname']

View File

@@ -74,8 +74,23 @@ class UserProfile(BaseModel):
def create_user_profile(sender, instance, created, **kwargs):
user_profile = None
if created:
UserProfile.objects.create(user=instance)
user_profile = UserProfile.objects.create(user=instance)
# if user_profile and not user_profile.avatar:
# from allauth.socialaccount.models import SocialAccount
# # try:
# social_accounts = SocialAccount.objects.filter(user=instance)
# if social_accounts:
# for social_account in social_accounts:
# if 'picture' in social_account.account.extra_data and social_account.account.extra_data['picture']:
# with open(social_account.account.extra_data['picture'], 'rb') as fd:
# user_profile.avatar.save(f'avatar_{instance.id}.jpeg', fd.read(), True)
#
# # except Exception as e:
# # msg = f'post_save create_user_profile Error = {str(e)}'
# # print(msg)
post_save.connect(create_user_profile, sender=User, dispatch_uid='post_save_connect')
@@ -85,6 +100,7 @@ def preSaveUser(sender, instance, **kwargs):
if not instance.email:
instance.email = str(instance.username).lower()
try:
instance.user_profile.modifiedDT = datetime.now()
except:

View File

@@ -21,6 +21,8 @@ urlpatterns = [
path('login/', login_View, name='login_profile'),
path('logout/', logout_View, name='logout_profile'),
path('account/signup/', login_View, name="custom_singup" ),
# ajax ----------------
# url(r'^login$', user_login_View_ajax, name='user_login_View_ajax'),

View File

@@ -266,19 +266,22 @@ def techSendMail(sets, html_content, title=None, add_emails=None):
# return msg
print('techSendMail')
project_name = ''
if 'project_name' in sets:
project_name = sets['project_name']
try:
# subject = u'truEnergy Data техническое оповещение'
from_email = 'support@truenergy.by'
from_email = sets['sender_email']
to = ['web@syncsystems.net']
if add_emails:
to.extend(add_emails)
text_content = 'Technical message from truEnergy.'
text_content = f'Technical message from {project_name}'
if title:
subject = title
else:
subject = u'truEnergy Data техническое оповещение'
subject = f'{project_name} - техническое оповещение'
res = admin_send_mail_by_SMTPlib(sets, subject, from_email, to, html_content)

View File

@@ -0,0 +1,51 @@
from allauth.socialaccount.adapter import DefaultSocialAccountAdapter
from allauth.account.utils import user_field
from django.conf import settings
from allauth.account.adapter import DefaultAccountAdapter
import requests
from django.core.files import File
from django.core.files.temp import NamedTemporaryFile
class MyAccountAdapter(DefaultAccountAdapter):
def get_login_redirect_url(self, request):
path = super(MyAccountAdapter, self).get_login_redirect_url(request)
try:
user = request.user
user_profile = user.user_profile
if user_profile and not user_profile.avatar:
social_accounts = user.socialaccount_set.all()
if social_accounts:
for social_account in social_accounts:
if 'picture' in social_account.extra_data and social_account.extra_data['picture']:
r = requests.get(social_account.extra_data['picture'])
img_temp = NamedTemporaryFile()
img_temp.write(r.content)
img_temp.flush()
user_profile.avatar.save(f'avatar_{user.id}.jpeg', File(img_temp), True)
break
except Exception as e:
msg = f'post_save create_user_profile Error = {str(e)}'
print(msg)
return path
# class CustomSocialAccountAdapter(DefaultSocialAccountAdapter):
# def populate_user(self, request, sociallogin, data):
# from AuthApp.models import UserProfile
#
# user = super().populate_user(request, sociallogin, data)
# try:
# picture = sociallogin.account.extra_data['picture']
# user_profile = UserProfile.objects.get_or_create(user=user)
# with open(picture, 'rb') as fd:
# user_profile.avatar.save(f'user_{user.id}_avatar.jpeg', fd.read(), True)
# # user_field(user, "profile_photo", picture)
# except Exception as e:
# msg = f'CustomSocialAccountAdapter populate_user Error = {str(e)}'
# print(msg)
#
# return user

View File

@@ -13,6 +13,16 @@ def get_options_by_opt_types(opt_types, only_vals=False):
res = {}
opts = opts.values('opt_type', 'value', 'prefix')
for item in opts:
if item['opt_type'] == 'domain':
try:
from django.contrib.sites.models import Site
current_site = Site.objects.get_current()
res.update({item['opt_type']: current_site.domain})
continue
except Exception as e:
print(str(e))
if item['prefix']:
res.update({item['opt_type']: f"{item['prefix']}{item['value']}"})
else:
@@ -29,6 +39,6 @@ def get_first_option_value_by_opt_type(opt_type):
return None
def get_mail_send_options():
opt_types = ['mail_server_url', 'mail_server_smtp_port', 'sender_mail_login', 'sender_mail_password', 'sender_email']
opt_types = ['mail_server_url', 'mail_server_smtp_port', 'sender_mail_login', 'sender_mail_password', 'sender_email', 'project_name']
return get_options_by_opt_types(opt_types, only_vals=True)

View File

@@ -19,6 +19,11 @@ def test_code(request):
from RoutesApp.models import Route
from ReferenceDataApp.models import Airport, City
# import allauth
# from allauth.socialaccount.models import SocialApp
# apps = SocialApp.objects.all()
# apps.delete()
from RoutesApp.search_matches import search_matches
search_matches()

View File

@@ -6,6 +6,7 @@ from webpush import send_user_notification
import json
from django.shortcuts import render, get_object_or_404
from django.conf import settings
from django.utils.translation import gettext as _
def get_key_Dict():
@@ -16,7 +17,7 @@ def get_key_Dict():
}
return Dict
def send_push(user, title, text, img=None):
def send_push(user, title, text, url=None, button_name=None, img=None):
try:
# body = request.body
# data = json.loads(body)
@@ -28,8 +29,17 @@ def send_push(user, title, text, img=None):
# user = get_object_or_404(User, pk=user_id)
Dict = {
'head': title,
'body': text
'body': text,
}
if url:
Dict['url'] = url
if button_name:
Dict['button_name'] = button_name
else:
Dict['button_name'] = _('Перейти'),
if img:
Dict['img'] = img
# payload = {'head': data['head'], 'body': data['body']}
send_user_notification(user=user, payload=Dict, ttl=1000)

View File

@@ -150,6 +150,16 @@ def get_routes_Dict(user=None, data=None):
res_Dict = {}
if data:
type_transport = None
if 'type_transport' in data and data['type_transport']:
items_list = data['type_transport'].split(',')
kwargs.update({f'type_transport__in': items_list})
if len(items_list) == 1:
type_transport = items_list[0]
for key, val in data.items():
if val:
if key == 'weight':
@@ -162,9 +172,9 @@ def get_routes_Dict(user=None, data=None):
else:
kwargs.update({f'{key}__lte': int(weight_list[0])})
if key == 'type_transport':
items_list = val.split(',')
kwargs.update({f'{key}__in': items_list})
# if key == 'type_transport':
# items_list = val.split(',')
# kwargs.update({f'{key}__in': items_list})
if key in (
@@ -184,19 +194,18 @@ def get_routes_Dict(user=None, data=None):
kwargs.update({key: val})
if key == 'from_address_point':
kwargs.update({f'from_city__id': val})
city = get_city_by_type_transport_and_address_point(type_transport, val)
kwargs.update({f'from_city': city})
res_Dict.update({
'from_address_point_txt': get_country_n_city_str_by_type_transport_and_address_point(
'road', val
)
'from_address_point_txt': city.get_country_n_city_str()
})
if key == 'to_address_point':
kwargs.update({f'to_city__id': val})
city = get_city_by_type_transport_and_address_point(type_transport, val)
kwargs.update({f'to_city': city})
res_Dict.update({
'to_address_point_txt': get_country_n_city_str_by_type_transport_and_address_point(
'road', val
)
'to_address_point_txt': city.get_country_n_city_str()
})
if key == 'from_el':

View File

@@ -5,22 +5,53 @@ from django.template.loader import render_to_string
from GeneralApp.funcs_options import get_options_by_opt_types, get_mail_send_options
from BaseModels.mailSender import admin_send_mail_by_SMTPlib, techSendMail
def send_mail_found_matches_routes(route, kwargs, search_owner_type):
def get_Dict_for_send_msgs(kwargs, search_owner_type):
print('get_Dict_for_send_msgs')
Dict = {
'route': route,
'search_owner_type': search_owner_type
}
sets = get_options_by_opt_types(['domain', 'project_name'], only_vals=True)
Dict.update(sets)
Dict.update({'logo': f'{sets["domain"]}/static/img/svg/LogoMobile.svg',})
Dict.update({'logo': f'{sets["domain"]}/static/img/svg/LogoMobile.svg', })
find_routes_page_url = f'{sets["domain"]}/routes/route_search_results/?'
kwargs_list = [f'{key}={value}' for key, value in kwargs.items()]
kwargs_list.append(f'owner_type={search_owner_type}')
find_routes_page_url += f'{"&".join(kwargs_list)}'
Dict.update({'find_routes_page_url': find_routes_page_url})
return Dict
def send_push_message_for_found_matches_routes(route, data_Dict):
print(f'send_push_message_for_found_matches_routes to route id = {route.id}')
if not route.owner.is_authenticated:
return None
from PushMessages.views import send_push
title = 'Мы нашли исполнителя по Вашему объявлению!'
text = 'Для просмотра результата нажмите на кнопку ниже'
send_push(route.owner, title, text, url=data_Dict['find_routes_page_url'], button_name=_('Перейти к найденному'))
return None
def send_mail_found_matches_routes(route, data_Dict):
print(f'send_mail_found_matches_routes to route id = {route.id}')
Dict = {
'route': route,
}
Dict.update(data_Dict)
html = render_to_string('mail/m_found_matched_routes.html', Dict)
@@ -38,6 +69,7 @@ def send_mail_found_matches_routes(route, kwargs, search_owner_type):
def search_matches(for_routes=None):
print('search_matches')
log = ''
@@ -53,6 +85,11 @@ def search_matches(for_routes=None):
'from_place', 'to_place', 'cargo_type', 'weight'
]
if for_routes:
msg = f'last hour create routes count = {for_routes.count()}'
else:
msg = f'last hour not create routes'
print(msg)
for route in for_routes:
kwargs = {}
@@ -87,15 +124,22 @@ def search_matches(for_routes=None):
)
if found_routes:
msg = send_mail_found_matches_routes(route, params, found_routes[0].owner_type)
msg = f'found routes for send messages = {found_routes.count()}'
data_Dict = get_Dict_for_send_msgs(params, found_routes[0].owner_type)
msg = send_push_message_for_found_matches_routes(route, data_Dict)
if msg:
log += msg
msg = send_mail_found_matches_routes(route, data_Dict)
if msg:
log += msg
except Exception as e:
msg = f'<br>\n! search_matches Error = {str(e)}'
print(msg)
log += msg
mail_sets = get_mail_send_options()
techSendMail(mail_sets, log, msg)
techSendMail(mail_sets, log, title='search_matches fail')
return log

View File

@@ -36,6 +36,40 @@ WEBPUSH_SETTINGS = {
"VAPID_ADMIN_EMAIL": "admin@tripwb.com"
}
SOCIALACCOUNT_LOGIN_ON_GET=True
ACCOUNT_DEFAULT_HTTP_PROTOCOL='https'
ACCOUNT_EMAIL_REQUIRED = True
ACCOUNT_USERNAME_REQUIRED = False
ACCOUNT_AUTHENTICATION_METHOD = 'email'
ACCOUNT_EMAIL_VERIFICATION = 'optional'
LOGIN_REDIRECT_URL = '/profile/page/dashboard/'
LOGOUT_REDIRECT_URL = '/profile/login/'
ACCOUNT_SIGNUP_REDIRECT_URL = '/profile/page/dashboard/'
ACCOUNT_LOGOUT_ON_GET = True
# SOCIALACCOUNT_ADAPTER = 'GeneralApp.allauth_funcs.MyAccountAdapter'
ACCOUNT_ADAPTER = 'GeneralApp.allauth_funcs.MyAccountAdapter'
AUTHENTICATION_BACKENDS = [
'django.contrib.auth.backends.ModelBackend',
'allauth.account.auth_backends.AuthenticationBackend',
]
SOCIALACCOUNT_PROVIDERS = {
'google': {
'SCOPE': [
'profile',
'email',
],
'AUTH_PARAMS': {
'access_type': 'online',
},
}
}
# NOTIFICATION_KEY = 'BJLyGzmo8sLI3Qkc6pN2cz11frCXiJdewvgve7Yps-_fM1lY1LSnTQfQxYtAgQ_26nAji_rgeYC1DkLiTwxw0Mo'
# SESSION_COOKIE_HTTPONLY = False
@@ -56,6 +90,8 @@ INSTALLED_APPS = [
'django.contrib.staticfiles',
'django.contrib.humanize',
'django.contrib.sites',
'colorfield',
'ckeditor',
@@ -63,6 +99,11 @@ INSTALLED_APPS = [
'webpush',
'allauth',
'allauth.account',
'allauth.socialaccount',
'allauth.socialaccount.providers.google',
'GeneralApp',
'AuthApp',
'RoutesApp',
@@ -82,8 +123,12 @@ MIDDLEWARE = [
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'AuthApp.middleware.ResponseInterceptionMiddleware',
"allauth.account.middleware.AccountMiddleware",
]
SITE_ID = 1
ROOT_URLCONF = 'TWB.urls'
TEMPLATES = [

View File

@@ -4,6 +4,7 @@ from django.urls import path, include
from django.conf.urls.static import static
from django.conf import settings
from GeneralApp.views import Page404
from AuthApp.views import login_View
handler404 = Page404
@@ -12,12 +13,17 @@ urlpatterns = [
path('ckeditor/', include('ckeditor_uploader.urls')),
path('i18n/', include('django.conf.urls.i18n')),
# path('webpush/', include('webpush.urls')),
path('accounts/signup/', login_View, name='signup'),
path('accounts/', include('allauth.urls')),
path('accounts/', include('allauth.socialaccount.urls')),
path('messages/', include('ChatServiceApp.urls')),
path('user_account/', include('AuthApp.js_urls')),
path('routes/', include('RoutesApp.js_urls')),
path('subscribes/', include('SubscribesApp.js_urls')),

View File

@@ -11,4 +11,5 @@ daphne==4.0.0
channels-redis==4.1.0
django-colorfield
django-webpush==0.3.5
django-allauth==0.60.0

View File

@@ -71,41 +71,41 @@
left: 33%;
}
.cards_item_1,
.cards_item_2,
.cards_item_3,
.cards_item_4
{
width: 46%;
height: 180px;
background-size:60%;
}
/* .cards_item_1,*/
/*.cards_item_2,*/
/*.cards_item_3,*/
/*.cards_item_4*/
/*{*/
/* width: 46%;*/
/* height: 180px;*/
/* background-size:60%;*/
/*}*/
.card_title_1{
font-size: 34px;
font-style: normal;
font-weight: 700;
line-height: 42px;
margin: 22px 0 0 10px;
text-shadow: 1px 1px 0px #272424;
}
.card_title_2{
font-size: 17px;
font-style: normal;
font-weight: 600;
line-height: 26px;
margin: 10px 0 0 10px;
text-shadow: 1px 1px 0px #272424;
}
.card_title_3{
margin: 10px 0 0 10px;
width: 95%;
font-size: 12px;
font-style: normal;
font-weight: 400;
line-height: 20px;
text-shadow: 1px 1px 0px #272424;
}
/* .card_title_1{*/
/* font-size: 34px;*/
/* font-style: normal;*/
/* font-weight: 700;*/
/* line-height: 42px;*/
/* margin: 22px 0 0 10px;*/
/* text-shadow: 1px 1px 0px #272424;*/
/*}*/
/*.card_title_2{*/
/* font-size: 17px;*/
/* font-style: normal;*/
/* font-weight: 600;*/
/* line-height: 26px;*/
/* margin: 10px 0 0 10px;*/
/* text-shadow: 1px 1px 0px #272424;*/
/*}*/
/*.card_title_3{*/
/* margin: 10px 0 0 10px;*/
/* width: 95%;*/
/* font-size: 12px;*/
/* font-style: normal;*/
/* font-weight: 400;*/
/* line-height: 20px;*/
/* text-shadow: 1px 1px 0px #272424;*/
/*}*/
.sf_1_column {
padding-left: 25px;
padding-right: 90px;
@@ -159,6 +159,17 @@
rotate: 270deg;
}
.cards_item_1,
.cards_item_2,
.cards_item_3,
.cards_item_4{
height: 322px;
width: 65%;
float: unset;
margin: 15px auto;
}
.filter_img{
width: 15px;
display: block;
@@ -420,7 +431,7 @@
margin-top: unset;
}
button#more_button{
#more_button{
width: 50%;
/*margin-top: 40px;*/
}
@@ -1511,6 +1522,45 @@
.cards_item_1,
.cards_item_2,
.cards_item_3,
.cards_item_4{
width: 70%;
height: unset;
float: unset;
margin: 15px auto;
}
.cards_item_img, .cards_item_text{
float: unset;
width: unset;
}
.cards_item_1>.cards_item_img>img,
.cards_item_2>.cards_item_img>img,
.cards_item_3>.cards_item_img>img,
.cards_item_4>.cards_item_img>img{
float: unset;
aspect-ratio: 4/3;
object-fit: cover;
width: 100%;
border-radius: 10px;
}
.cards_item_text{
padding-bottom: 20px;
}
.card_title_1{
margin: 25px 0 0 20px;
}
.read_more_about_subscribe{
padding: 0 14px;
height: 30px;
@@ -1792,7 +1842,7 @@
width: 100%;
margin-top: 20px;
}
button#more_button{
#more_button{
width: 100%;
margin-top: 40px;
}
@@ -1802,14 +1852,32 @@
justify-content: center;
}
.cards_item_1,
.cards_item_2,
.cards_item_3,
.cards_item_4
{
width: 100%;
height: 180px;
background-size:60%;
/*.cards_item_1,*/
/*.cards_item_2,*/
/*.cards_item_3,*/
/*.cards_item_4*/
/*{*/
/* width: 100%;*/
/* height: 180px;*/
/* background-size:60%;*/
/*}*/
.card_title_1{
font-size: 34px;
font-style: normal;
font-weight: 700;
line-height: 42px;
}
.card_title_2{
font-size: 18px;
font-style: normal;
font-weight: 600;
line-height: 26px;
}
.card_title_3{
font-size: 12px;
font-style: normal;
font-weight: 400;
line-height: 20px;
}
.cards_wrapper{

View File

@@ -780,7 +780,7 @@ span.btn_profile_name {
/*height: 60px;*/
font-size: 18px;
font-weight: 500;
width: 100%;
width: 80%;
margin-top: 10px;
display: inline-block;
@@ -2137,9 +2137,9 @@ span#sub_title_static{
}
button#more_button{
#more_button{
display: inline-block;
height: 60px;
/*height: 60px;*/
width: 20%;
background: #FF613A;
color: #FFF;
@@ -2652,18 +2652,40 @@ button#send_feedback_form:active{
}
.cards_wrapper{
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: center;
/*display: flex;*/
/*flex-direction: row;*/
/*flex-wrap: wrap;*/
/*justify-content: center;*/
display: inline-block;
}
.cards_item_1, .cards_item_3{
float: left;
}
.cards_item_2, .cards_item_4{
float: right;
}
.cards_item_1>.cards_item_img>img,
.cards_item_2>.cards_item_img>img,
.cards_item_3>.cards_item_img>img,
.cards_item_4>.cards_item_img>img{
float: right;
}
#reg_or_text{
margin: 10px;
}
.cards_item_2>.cards_item_text>div, .cards_item_3>.cards_item_text>div{
color: #1d1e20;
}
.cards_item_1{
width: 48%;
height: 322px;
border-radius: 10px;
background: url(/static/img/png/cards_item_1.png) #1d1e20 50%;
/*background: url(/static/img/png/cards_item_1.png) #1d1e20 50%;*/
background: #1d1e20 50%;
background-repeat: no-repeat;
background-position: right;
@@ -2672,13 +2694,7 @@ button#send_feedback_form:active{
margin: 10px;
}
.cards_item_1_left,
.cards_item_2_left,
.cards_item_3_left,
.cards_item_4_left{
width: 55%;
float: left;
}
@@ -2693,10 +2709,9 @@ button#send_feedback_form:active{
}
.cards_item_2{
width: 48%;
height: 322px;
border-radius: 10px;
background: url(/static/img/png/cards_item_2.png) white 50%;
border-radius: 10px;
/*background: url(/static/img/png/cards_item_2.png) white 50%;*/
background: white 50%;
background-repeat: no-repeat;
background-position: right;
@@ -2706,13 +2721,23 @@ button#send_feedback_form:active{
}
.cards_item_2>div,
.cards_item_3>div{
color: black;
text-shadow: none;
text-shadow: 1px 1px 0px #ffffff;
.cards_item_text {
float: left;
width: 50%;
}
.cards_item_img {
float: right;
width: 50%;
}
/*.cards_item_2>div,*/
/*.cards_item_3>div{*/
/* color: black;*/
/* text-shadow: none;*/
/* text-shadow: 1px 1px 0px #ffffff;*/
/*}*/
.cards_item_2_right{
float: right;
border-radius: 10px;
@@ -2738,10 +2763,9 @@ button#send_feedback_form:active{
.cards_item_3{
width: 48%;
height: 322px;
border-radius: 10px;
background: url(/static/img/png/cards_item_3.png) white 50%;
/*background: url(/static/img/png/cards_item_3.png) white 50%;*/
background: white 50%;
background-repeat: no-repeat;
background-position: right;
box-shadow: -1px 4px 10px 0px rgba(198, 199, 203, 0.20), 0px -1px 10px 0px rgba(198, 199, 203, 0.20);
@@ -2761,10 +2785,9 @@ button#send_feedback_form:active{
.cards_item_4{
width: 48%;
height: 322px;
border-radius: 10px;
background: url(/static/img/png/cards_item_4.png), #111217 50%;
/*background: url(/static/img/png/cards_item_4.png), #111217 50%;*/
background: #111217 50%;
background-repeat: no-repeat;
background-position: right;
@@ -2773,6 +2796,16 @@ button#send_feedback_form:active{
margin: 10px;
}
.cards_item_1,
.cards_item_2,
.cards_item_3,
.cards_item_4{
height: 322px;
width: 48%;
}
.cards_item_4_right{
float: right;
border-radius: 10px;
@@ -2789,7 +2822,7 @@ button#send_feedback_form:active{
font-style: normal;
font-weight: 700;
line-height: 52px; /* 118.182% */
margin: 104px 0 0 20px;
margin: 67px 0 0 20px;
}
.card_title_2{
color: #FFF;
@@ -2806,7 +2839,7 @@ button#send_feedback_form:active{
font-weight: 400;
line-height: 22px;
margin: 20px 0 0 20px;
width: 50%;
}
/*faq_main_page*/

View File

@@ -66,7 +66,7 @@
{# <div class="button_profile_header" onclick="open_curtain(null,'right')" data-user-id="{{ user.id }}">#}
<span class="btn_profile_name">
{{ user.first_name }} {{ user.last_name }}
{{ user.first_name|truncatechars:6}} {{ user.last_name|truncatechars:5 }}
</span>
<span id="placeholder1"></span>
<div class="icon_unread_messages" style="position:relative;top: 4px;padding-right: 13px;">

View File

@@ -1,12 +1,13 @@
{% load i18n %}
{% load socialaccount %}
{% trans "Логин" as p_login %}
{% trans "Пароль" as p_password %}
<section class="login">
<h1>{% translate "Войдите в профиль" %}</h1>
<h1>{% translate "Войдите в профиль" %}</h1>
<form class="login_form" name="login_form" method="post">
<form class="login_form" name="login_form" method="post">
{% csrf_token %}
<div>
{% if form.errors.all__ %}
@@ -29,10 +30,13 @@
</div>
<div class="button_register"><button onclick="SendLoginForm(this)">{% translate "Войти" %}</button></div>
<div class="agree_text_l">{% translate "Авторизуясь, вы соглашаетесь с Лицензионным соглашением Политикой конфиденциальности" %}</div>
{# <div>Или</div>#}
{# <div id = "google_text" class="google"><img src="/static/img/png/google.png" alt="">#}
{# <div>Войти через Google</div>#}
{# </div>#}
<div id="reg_or_text">{% translate "Или" %}</div>
<a href="{% provider_login_url 'google' %}">
<div id = "google_text" class="google"><img src="/static/img/png/google.png" alt="">
<div> {% translate "Войти через" %} Google</div>
</div>
</a>
<div class="call_to_reg">{% translate "Нет аккаунта?" %} <a href="/ru/profile/registration/">{% translate "Зарегистрируйтесь" %}</a></div>
</div>
</form>

View File

@@ -98,7 +98,7 @@
<div class="benefit_img_item">
<img src="/static/img/svg/Contact_carrier.svg" alt="">
<h3>{% translate "Свяжитесь с перевозчиком" %}</h3>
<span>{% translate "Откройте контакты на сайте и договоритесь о месте встречи и условиях перевозки" %}</span>
<span>{% translate "Откройте контакты на сайте и договоритесь о месте встречи и условиях перевозки. В случае, если Вы не нашли объявления о перевозчиках по Вашему запросу, Вы можете разместить свое объявление воспользовавшись формой в личном кабинете." %}</span>
</div>
<img src="/static/img/svg/Arrow_direction.svg" alt="">
@@ -112,7 +112,10 @@
</div>
<div class="button_container">
<a class="a_btn_standart" href="{% url 'profile_page' 'create_route_for_customer' %}" id="more_button">{% translate "Отправить посылку" %}</a>
<a class="a_btn_standart"
href="{% url 'profile_page' 'create_route_for_customer' %}"
id="more_button">{% translate "Отправить посылку" %}
</a>
</div>
</div>
<div id="content-2">
@@ -121,8 +124,8 @@
<div class="benefit_img_item">
<img src="/static/img/svg/Find_carrier.svg" alt="">
<h3>{% translate "Разместите объявление" %}</h3>
<span>{% translate "Укажите откуда, куда хотите перевезти посылку, а также Вашу дату отправления и прибытия. При желании Вы можете указать дополнительные параметры: тип, вес, вид перевозки и т.д" %}</span>
<h3>{% translate "Найдите отправителя" %}</h3>
<span>{% translate "Зайдите на сайт Trip With Bonus и в форме вверху страницы, заполните данные для поиска отправителя посылки." %}</span>
</div>
@@ -131,7 +134,7 @@
<div class="benefit_img_item">
<img src="/static/img/svg/Contact_carrier.svg" alt="">
<h3>{% translate "Свяжитесь с отправителем" %}</h3>
<span>{% translate "В отобразившемся списке выберите подходящего отправителя и посылку, откройте контакты и свяжитесь удобным способом. Если не нашли подходящего отправителя с посылкой, разместите объявление о возможности перевезти посылку и отправители Вас сами найдут" %}</span>
<span>{% translate "Откройте контакты на сайте и договоритесь о месте встречи и условиях перевозки. В случае, если Вы не нашли объявления об отправителях по Вашему запросу, Вы можете разместить свое объявление воспользовавшись формой в личном кабинете." %}</span>
</div>
@@ -140,7 +143,7 @@
<div class="benefit_img_item">
<img src="/static/img/svg/Pass_package.svg" alt="">
<h3>{% translate "Передайте посылку" %}</h3>
<span>{% translate "Обсудите с отправителем все условия: время, место и прочие детали. Готово! Доставьте посылку из пункта А в пункт Б и получите благодарность отправителя!" %}</span>
<span>{% translate "Встречайтесь, знакомьтесь и принимайте посылку" %}</span>
</div>
@@ -148,7 +151,10 @@
<div class="button_container">
<button id="more_button">{% translate "Перевезти посылку" %}</button>
<a class="a_btn_standart"
href="{% url 'profile_page' 'create_route_for_mover' %}"
id="more_button">{% translate "Перевезти посылку" %}
</a>
</div>
</div>
@@ -167,31 +173,47 @@
<div class="cards_wrapper">
<div class="cards_item_1">
<div class="cards_item_img">
<img src="/static/img/png/cards_item_1.png" alt="">
</div>
<div class="cards_item_text">
<div class="card_title_1">{% translate "+5%" %}</div>
<div class="card_title_2">{% translate "рост путешествий ежегодно" %}</div>
<div class="card_title_3">{% translate "В среднем на 5% растёт количество путешествий ежегодно. Просто путешествуй и получай бонусы." %}</div>
{# <div class="cards_item_1_right">#}
{# <div class="card_gradient_black"></div>#}
{# </div>#}
</div>
</div>
<div class="cards_item_2">
<div class="cards_item_img">
<img src="/static/img/png/cards_item_2.png" alt="">
</div>
<div class="cards_item_text">
<div class="card_title_1">{% translate "в 3 раза" %}</div>
<div class="card_title_2">{% translate "быстрее других сервисов" %}</div>
<div class="card_title_3">{% translate "Почтовые сервисы доставляет посылки в среднем за 10 дней. С нами - быстрее!" %}</div>
</div>
{# <div class="card_gradient"></div>#}
{# <div class="cards_item_2_right">#}
{# #}
{# </div>#}
</div>
<div class="cards_item_3">
<div class="cards_item_img">
<img src="/static/img/png/cards_item_3.png" alt="">
</div>
<div class="cards_item_text">
<div class="card_title_1">{% translate "+142" %}</div>
<div class="card_title_2">{% translate "заявки ежедневно" %}</div>
<div class="card_title_3">{% translate "На перевозку или отправку посылок в разные уголки мира" %}</div>
</div>
{# <div class="cards_item_3_right">#}
{# <div class="card_gradient"></div>#}
@@ -199,9 +221,16 @@
</div>
<div class="cards_item_4">
<div class="card_title_1">{% translate "30+" %}</div>
<div class="card_title_2">{% translate "стран" %}</div>
<div class="card_title_3">{% translate "С TWB отправляй посылки по всему миру! С нами нет границ!" %}</div>
<div class="cards_item_img">
<img src="/static/img/png/cards_item_4.png" alt="">
</div>
<div class="cards_item_text">
<div class="card_title_1">{% translate "30+" %}</div>
<div class="card_title_2">{% translate "стран" %}</div>
<div class="card_title_3">{% translate "С TWB отправляй посылки по всему миру! С нами нет границ!" %}</div>
</div>
{# <div class="cards_item_4_right">#}
{# <div class="card_gradient_black"></div>#}

View File

@@ -7,12 +7,32 @@ self.addEventListener('push', function (event) {
const data = JSON.parse(eventInfo);
const head = data.head || 'New Notification 🕺🕺';
const body = data.body || 'This is default content. Your notification didn\'t have one 🙄🙄';
const icon = data.img || 'static/img/svg/Logo.svg';
let notificationOptions = {
body: body,
icon: icon,
};
if ('url' in data){
notificationOptions['data'] = { url: data.url };
notificationOptions['actions'] = [{action: "open_url", title: data.button_name}]
}
// Keep the service worker alive until the notification is created.
event.waitUntil(
self.registration.showNotification(head, {
body: body,
icon: 'static/img/svg/Logo.svg'
})
self.registration.showNotification(head, notificationOptions)
);
});
});
self.addEventListener('notificationclick', function(event) {
switch(event.action){
case 'open_url':
clients.openWindow(event.notification.data.url);
break;
case 'any_other_action':
clients.openWindow("https://www.example.com");
break;
}
}
, false);

View File

@@ -33,7 +33,7 @@
init_ws()
const beep = new Audio('/static/sounds/beep_2.mp3')
</script>
{% endif %}
@@ -56,6 +56,9 @@
{% block meta %}
{% endblock %}
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-6320323599773844" crossorigin="anonymous"></script>
</head>
<body{% if page_type == 'routes' %} onscroll="scroll_ev(event,this)"{% endif %}>