1.1.1 autosubscribe to null price subscribe
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
from django.template.loader import render_to_string
|
from django.template.loader import render_to_string
|
||||||
|
from SubscribesApp.funcs import check_option_in_cur_user_subscribe
|
||||||
|
|
||||||
|
|
||||||
def get_user_timezone_Dict(user, request=None):
|
def get_user_timezone_Dict(user, request=None):
|
||||||
@@ -30,10 +31,12 @@ def get_profile_page_content_html(request, page_name, data):
|
|||||||
if page_name == 'chat':
|
if page_name == 'chat':
|
||||||
from ChatServiceApp.funcs import get_chat_page_content_html
|
from ChatServiceApp.funcs import get_chat_page_content_html
|
||||||
return get_chat_page_content_html(request, data)
|
return get_chat_page_content_html(request, data)
|
||||||
elif page_name == 'create_route_for_customer':
|
elif (page_name == 'create_route_for_customer' and
|
||||||
|
check_option_in_cur_user_subscribe(request.user, 'размещение заявок')):
|
||||||
from RoutesApp.funcs import get_profile_new_route_page_html
|
from RoutesApp.funcs import get_profile_new_route_page_html
|
||||||
return get_profile_new_route_page_html(request, {'owner_type': 'customer'})
|
return get_profile_new_route_page_html(request, {'owner_type': 'customer'})
|
||||||
elif page_name == 'create_route_for_mover':
|
elif (page_name == 'create_route_for_mover' and
|
||||||
|
check_option_in_cur_user_subscribe(request.user, 'размещение заявок')):
|
||||||
from RoutesApp.funcs import get_profile_new_route_page_html
|
from RoutesApp.funcs import get_profile_new_route_page_html
|
||||||
return get_profile_new_route_page_html(request, {'owner_type': 'mover'})
|
return get_profile_new_route_page_html(request, {'owner_type': 'mover'})
|
||||||
elif page_name == 'my_routes':
|
elif page_name == 'my_routes':
|
||||||
|
|||||||
@@ -47,8 +47,12 @@ def profile_page_View(request, page_name, id=None):
|
|||||||
|
|
||||||
lang = get_and_set_lang(request)
|
lang = get_and_set_lang(request)
|
||||||
|
|
||||||
|
page_html = get_profile_page_content_html(request, page_name, id)
|
||||||
|
if not page_html:
|
||||||
|
raise Http404
|
||||||
|
|
||||||
Dict = {
|
Dict = {
|
||||||
'page_html': get_profile_page_content_html(request, page_name, id),
|
'page_html': page_html,
|
||||||
'page_name': page_name,
|
'page_name': page_name,
|
||||||
'page_type': 'profile'
|
'page_type': 'profile'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import json
|
|||||||
from django.shortcuts import render, get_object_or_404
|
from django.shortcuts import render, get_object_or_404
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.utils.translation import gettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
from SubscribesApp.funcs import check_option_in_cur_user_subscribe
|
||||||
|
|
||||||
|
|
||||||
def get_key_Dict():
|
def get_key_Dict():
|
||||||
@@ -18,6 +19,9 @@ def get_key_Dict():
|
|||||||
return Dict
|
return Dict
|
||||||
|
|
||||||
def send_push(user, title, text, url=None, button_name=None, img=None):
|
def send_push(user, title, text, url=None, button_name=None, img=None):
|
||||||
|
if not check_option_in_cur_user_subscribe(user, 'push уведомления'):
|
||||||
|
return False
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# body = request.body
|
# body = request.body
|
||||||
# data = json.loads(body)
|
# data = json.loads(body)
|
||||||
|
|||||||
@@ -16,13 +16,16 @@ from django.urls import reverse
|
|||||||
from .forms import *
|
from .forms import *
|
||||||
from .funcs import *
|
from .funcs import *
|
||||||
from GeneralApp.funcs import get_and_set_lang
|
from GeneralApp.funcs import get_and_set_lang
|
||||||
|
from SubscribesApp.funcs import check_option_in_cur_user_subscribe
|
||||||
|
|
||||||
|
|
||||||
def del_route_ajax(request):
|
def del_route_ajax(request):
|
||||||
if request.method != 'POST':
|
if request.method != 'POST':
|
||||||
raise Http404
|
raise Http404
|
||||||
|
|
||||||
|
if not check_option_in_cur_user_subscribe(request.user, 'размещение заявок'):
|
||||||
|
return JsonResponse({'html': 'нет доступа'}, status=403)
|
||||||
|
|
||||||
lang = get_and_set_lang(request)
|
lang = get_and_set_lang(request)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@@ -58,6 +61,9 @@ def edit_route_ajax(request):
|
|||||||
if request.method != 'POST':
|
if request.method != 'POST':
|
||||||
raise Http404
|
raise Http404
|
||||||
|
|
||||||
|
if not check_option_in_cur_user_subscribe(request.user, 'размещение заявок'):
|
||||||
|
return JsonResponse({'html': 'нет доступа'}, status=403)
|
||||||
|
|
||||||
lang = get_and_set_lang(request)
|
lang = get_and_set_lang(request)
|
||||||
|
|
||||||
data = json.loads(request.body)
|
data = json.loads(request.body)
|
||||||
@@ -108,6 +114,8 @@ def edit_route_ajax(request):
|
|||||||
def new_route_view_ajax(request):
|
def new_route_view_ajax(request):
|
||||||
if request.method != 'POST':
|
if request.method != 'POST':
|
||||||
raise Http404
|
raise Http404
|
||||||
|
if not check_option_in_cur_user_subscribe(request.user, 'размещение заявок'):
|
||||||
|
return JsonResponse({'html': 'нет доступа'}, status=403)
|
||||||
|
|
||||||
lang = get_and_set_lang(request)
|
lang = get_and_set_lang(request)
|
||||||
|
|
||||||
@@ -222,6 +230,9 @@ def create_or_change_route_ajax(request, route_id=None):
|
|||||||
if request.method != 'POST':
|
if request.method != 'POST':
|
||||||
raise Http404
|
raise Http404
|
||||||
|
|
||||||
|
if not check_option_in_cur_user_subscribe(request.user, 'размещение заявок'):
|
||||||
|
return JsonResponse({'html': 'нет доступа'}, status=403)
|
||||||
|
|
||||||
lang = get_and_set_lang(request)
|
lang = get_and_set_lang(request)
|
||||||
|
|
||||||
Dict = {}
|
Dict = {}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ from django.utils.translation import gettext as _
|
|||||||
from django.template.loader import render_to_string
|
from django.template.loader import render_to_string
|
||||||
from GeneralApp.funcs_options import get_options_by_opt_types, get_mail_send_options
|
from GeneralApp.funcs_options import get_options_by_opt_types, get_mail_send_options
|
||||||
from BaseModels.mailSender import admin_send_mail_by_SMTPlib, techSendMail
|
from BaseModels.mailSender import admin_send_mail_by_SMTPlib, techSendMail
|
||||||
|
from SubscribesApp.funcs import check_option_in_cur_user_subscribe
|
||||||
|
|
||||||
|
|
||||||
def get_Dict_for_send_msgs(kwargs, search_owner_type):
|
def get_Dict_for_send_msgs(kwargs, search_owner_type):
|
||||||
@@ -36,6 +36,9 @@ def send_push_message_for_found_matches_routes(route, data_Dict):
|
|||||||
if not route.owner.is_authenticated:
|
if not route.owner.is_authenticated:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
if not check_option_in_cur_user_subscribe(route.owner, 'push уведомления'):
|
||||||
|
return False
|
||||||
|
|
||||||
from PushMessages.views import send_push
|
from PushMessages.views import send_push
|
||||||
title = 'Мы нашли исполнителя по Вашему объявлению!'
|
title = 'Мы нашли исполнителя по Вашему объявлению!'
|
||||||
text = 'Для просмотра результата нажмите на кнопку ниже'
|
text = 'Для просмотра результата нажмите на кнопку ниже'
|
||||||
@@ -126,24 +129,38 @@ def search_matches(for_routes=None):
|
|||||||
if found_routes:
|
if found_routes:
|
||||||
msg = f'found routes for send messages = {found_routes.count()}'
|
msg = f'found routes for send messages = {found_routes.count()}'
|
||||||
|
|
||||||
|
data_Dict = None
|
||||||
try:
|
try:
|
||||||
data_Dict = get_Dict_for_send_msgs(params, found_routes[0].owner_type)
|
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
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
msg = f'<br>\n! search_matches Error send_push_message_for_found_matches_routes = {str(e)}'
|
msg = f'<br>\n! search_matches Error get_Dict_for_send_msgs = {str(e)}'
|
||||||
print(msg)
|
print(msg)
|
||||||
log += msg
|
log += msg
|
||||||
|
|
||||||
try:
|
if data_Dict and check_option_in_cur_user_subscribe(
|
||||||
msg = send_mail_found_matches_routes(route, data_Dict)
|
route.owner, 'push уведомления'
|
||||||
if msg:
|
):
|
||||||
|
try:
|
||||||
|
msg = send_push_message_for_found_matches_routes(route, data_Dict)
|
||||||
|
if msg:
|
||||||
|
log += msg
|
||||||
|
except Exception as e:
|
||||||
|
msg = f'<br>\n! search_matches Error send_push_message_for_found_matches_routes = {str(e)}'
|
||||||
|
print(msg)
|
||||||
|
log += msg
|
||||||
|
|
||||||
|
if data_Dict and check_option_in_cur_user_subscribe(
|
||||||
|
route.owner,
|
||||||
|
'уведомление на e-mail о появлении перевозчика по заданным критериям'
|
||||||
|
):
|
||||||
|
try:
|
||||||
|
msg = send_mail_found_matches_routes(route, data_Dict)
|
||||||
|
if msg:
|
||||||
|
log += msg
|
||||||
|
except Exception as e:
|
||||||
|
msg = f'<br>\n! search_matches Error send_mail_found_matches_routes = {str(e)}'
|
||||||
|
print(msg)
|
||||||
log += msg
|
log += msg
|
||||||
except Exception as e:
|
|
||||||
msg = f'<br>\n! search_matches Error send_mail_found_matches_routes = {str(e)}'
|
|
||||||
print(msg)
|
|
||||||
log += msg
|
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
msg = f'<br>\n! search_matches Error = {str(e)}'
|
msg = f'<br>\n! search_matches Error = {str(e)}'
|
||||||
|
|||||||
@@ -4,6 +4,22 @@ from django.utils.translation import get_language, activate
|
|||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
import json
|
import json
|
||||||
|
|
||||||
|
def check_option_in_cur_user_subscribe(user, option_name):
|
||||||
|
if not user or not user.is_active or not user.is_authenticated:
|
||||||
|
return False
|
||||||
|
|
||||||
|
user_subscribe = get_cur_user_subscribe(user)
|
||||||
|
try:
|
||||||
|
option = SubscribeOption.objects.get(
|
||||||
|
rel_subscribes_for_option=user_subscribe.subscribe,
|
||||||
|
name_ru__iexact=option_name
|
||||||
|
)
|
||||||
|
return True
|
||||||
|
except SubscribeOption.DoesNotExist:
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def get_null_price_subscribe():
|
def get_null_price_subscribe():
|
||||||
subscribes_null_price = Subscribe.objects.filter(
|
subscribes_null_price = Subscribe.objects.filter(
|
||||||
enable=True,
|
enable=True,
|
||||||
@@ -31,6 +47,9 @@ def subscribe_user_to_null_price_subscribe(user):
|
|||||||
|
|
||||||
def get_cur_user_subscribe(user):
|
def get_cur_user_subscribe(user):
|
||||||
|
|
||||||
|
if not user or not user.is_active or not user.is_authenticated:
|
||||||
|
return None
|
||||||
|
|
||||||
try:
|
try:
|
||||||
user_subscribe = SubscribeForUser.objects.get(enable=True, user=user)
|
user_subscribe = SubscribeForUser.objects.get(enable=True, user=user)
|
||||||
except SubscribeForUser.DoesNotExist:
|
except SubscribeForUser.DoesNotExist:
|
||||||
|
|||||||
@@ -3,6 +3,16 @@ from BaseModels.base_models import BaseModel
|
|||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
from colorfield.fields import ColorField
|
from colorfield.fields import ColorField
|
||||||
|
|
||||||
|
|
||||||
|
# options_list 29.05.2024
|
||||||
|
# СМС уведомления
|
||||||
|
# push уведомления
|
||||||
|
# выделение заявки цветом (20 заявок) + 70 поднятий
|
||||||
|
# выделение заявок цветом (3 заявки) + 5 поднятий
|
||||||
|
# уведомление на e-mail о появлении перевозчика по заданным критериям
|
||||||
|
# размещение заявок
|
||||||
|
# просмотр контактов
|
||||||
|
|
||||||
class SubscribeOption(BaseModel):
|
class SubscribeOption(BaseModel):
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
@@ -16,7 +26,8 @@ class Subscribe(BaseModel):
|
|||||||
|
|
||||||
price = models.FloatField(verbose_name='Стоимость', default=0)
|
price = models.FloatField(verbose_name='Стоимость', default=0)
|
||||||
options = models.ManyToManyField(
|
options = models.ManyToManyField(
|
||||||
SubscribeOption, verbose_name=_('Подключенные опции'), blank=True, related_name='rel_subscribes_for_option'
|
SubscribeOption, verbose_name=_('Подключенные опции'), blank=True,
|
||||||
|
related_name='rel_subscribes_for_option'
|
||||||
)
|
)
|
||||||
period_name = models.CharField(max_length=250, verbose_name=_('Название периода'))
|
period_name = models.CharField(max_length=250, verbose_name=_('Название периода'))
|
||||||
period = models.IntegerField(default=0, verbose_name=_('Длительность подписки в часах'))
|
period = models.IntegerField(default=0, verbose_name=_('Длительность подписки в часах'))
|
||||||
|
|||||||
1
SubscribesApp/templatetags/__init__.py
Normal file
1
SubscribesApp/templatetags/__init__.py
Normal file
@@ -0,0 +1 @@
|
|||||||
|
__author__ = 'SDE'
|
||||||
157
SubscribesApp/templatetags/subscribes_tags_extra.py
Normal file
157
SubscribesApp/templatetags/subscribes_tags_extra.py
Normal file
@@ -0,0 +1,157 @@
|
|||||||
|
__author__ = 'SDE'
|
||||||
|
|
||||||
|
from django import template
|
||||||
|
from django.template.defaultfilters import stringfilter
|
||||||
|
|
||||||
|
register = template.Library()
|
||||||
|
|
||||||
|
from django.core.serializers import serialize
|
||||||
|
from django.db.models.query import QuerySet
|
||||||
|
# import simplejson
|
||||||
|
from django.template import Library
|
||||||
|
from django.utils.html import mark_safe
|
||||||
|
|
||||||
|
# @register.filter('get_value_from_dict')
|
||||||
|
# def get_value_from_dict(dict_data, key):
|
||||||
|
# """
|
||||||
|
# usage example {{ your_dict|get_value_from_dict:your_key }}
|
||||||
|
# """
|
||||||
|
#
|
||||||
|
# if key in dict_data:
|
||||||
|
# res = dict_data[key]
|
||||||
|
# return res
|
||||||
|
#
|
||||||
|
# return False
|
||||||
|
#
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# @register.filter()
|
||||||
|
# def get_rows_count_by_cols_count(data, cols_count):
|
||||||
|
# rows_count = len(data) // cols_count
|
||||||
|
# if len(data) % cols_count:
|
||||||
|
# rows_count += 1
|
||||||
|
# return rows_count
|
||||||
|
#
|
||||||
|
# @register.filter()
|
||||||
|
# def get_numbers_list(from_el, to_el):
|
||||||
|
# res = range(from_el, to_el+1)
|
||||||
|
# return res
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# def val_type(value):
|
||||||
|
# res = type(value)
|
||||||
|
# return res.__name__
|
||||||
|
# register.filter('val_type', val_type)
|
||||||
|
#
|
||||||
|
# @register.filter()
|
||||||
|
# def get_cols_table_data_for_row_when_cols3(value, row):
|
||||||
|
# el_count = 3
|
||||||
|
# from_el = (row-1) * el_count
|
||||||
|
# to_el = row * el_count
|
||||||
|
# part = list(value)[from_el:to_el]
|
||||||
|
# return part
|
||||||
|
# # register.filter('val_type', val_type)
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# @register.filter
|
||||||
|
# @stringfilter
|
||||||
|
# def correct_for_tables(value):
|
||||||
|
# if value in ['None', '0.0']:
|
||||||
|
# return '-'
|
||||||
|
# return value
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# @register.filter
|
||||||
|
# @stringfilter
|
||||||
|
# def del_bad_symbols(value):
|
||||||
|
# from BaseModels.functions import del_bad_symbols
|
||||||
|
# return del_bad_symbols(value)
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# @register.filter
|
||||||
|
# @stringfilter
|
||||||
|
# def del_amp_symbols(value):
|
||||||
|
# from BaseModels.functions import del_nbsp
|
||||||
|
# return del_nbsp(value)
|
||||||
|
#
|
||||||
|
# @register.filter
|
||||||
|
@register.simple_tag()
|
||||||
|
def check_subscribe_option(s_user, option_name):
|
||||||
|
from ..funcs import check_option_in_cur_user_subscribe
|
||||||
|
res = check_option_in_cur_user_subscribe(s_user, option_name)
|
||||||
|
return res
|
||||||
|
#
|
||||||
|
# @register.filter
|
||||||
|
# @stringfilter
|
||||||
|
# def get_color_by_number(value, arg=None):
|
||||||
|
#
|
||||||
|
# color = None
|
||||||
|
# try:
|
||||||
|
# val = float(value)
|
||||||
|
#
|
||||||
|
# if not color and arg == u'%':
|
||||||
|
#
|
||||||
|
# color = u'black'
|
||||||
|
# if val > 50:
|
||||||
|
# color = u'green'
|
||||||
|
# elif val <= 50 and val >= 25:
|
||||||
|
# color = u'#6c8107'
|
||||||
|
# elif val <= 25 and val >= 10:
|
||||||
|
# color = u'#a89803'
|
||||||
|
# elif val <= 10 and val >= 5:
|
||||||
|
# color = u'#e6a707'
|
||||||
|
# elif val <= 5 and val >= 0:
|
||||||
|
# color = u'#e67307'
|
||||||
|
# elif val <= 0:
|
||||||
|
# color = u'red'
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# # val_range = val_max - val_min
|
||||||
|
# # # val_percent = (val_range * 100 / val) - 100
|
||||||
|
# # offset = -(val_min + -(val))
|
||||||
|
# # if val <0:
|
||||||
|
# # val = offset
|
||||||
|
# # if val > val_max:
|
||||||
|
# # val = val_max
|
||||||
|
# # elif val < 0:
|
||||||
|
# # val = 0
|
||||||
|
# #
|
||||||
|
# # color_range = 16711680 - 1211136
|
||||||
|
# # val_1unit = float(color_range) / float(val_range)
|
||||||
|
# # dec_color = 16711680 - int(val_1unit * val)
|
||||||
|
#
|
||||||
|
# if not color:
|
||||||
|
# color = u'black'
|
||||||
|
# if val > 1000:
|
||||||
|
# color = u'green'
|
||||||
|
# elif val <= 1000 and val >= 500:
|
||||||
|
# color = u'#6c8107'
|
||||||
|
# elif val <= 500 and val >= 250:
|
||||||
|
# color = u'#a89803'
|
||||||
|
# elif val <= 250 and val >= 125:
|
||||||
|
# color = u'#e6a707'
|
||||||
|
# elif val <= 125 and val >= 50:
|
||||||
|
# color = u'#e67307'
|
||||||
|
# elif val <= 50:
|
||||||
|
# color = u'red'
|
||||||
|
#
|
||||||
|
# # s = u'style="color: #{0}12;"'.format(str(hex(dec_color))[2:6])
|
||||||
|
# s = u'style="color: {0};"'.format(color)
|
||||||
|
# return s
|
||||||
|
# except:
|
||||||
|
# return u''
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# # @register.filter
|
||||||
|
# # @stringfilter
|
||||||
|
# # def check_aprox_compare_strings(search_phrase, txt):
|
||||||
|
# # from ProductApp.search import get_highlight_string
|
||||||
|
# #
|
||||||
|
# # s = get_highlight_string(search_phrase, txt)
|
||||||
|
# #
|
||||||
|
# # return s
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
{% load static %}
|
{% load static %}
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
|
{% load subscribes_tags_extra %}
|
||||||
|
|
||||||
{%trans "Профиль" as t_prof %}
|
{%trans "Профиль" as t_prof %}
|
||||||
{%trans "Разместить объявление как отправитель" as t_customer %}
|
{%trans "Разместить объявление как отправитель" as t_customer %}
|
||||||
@@ -11,6 +12,7 @@
|
|||||||
{%trans "Моя подписка" as t_subscribe %}
|
{%trans "Моя подписка" as t_subscribe %}
|
||||||
{%trans "Изменить профиль" as t_change_profile %}
|
{%trans "Изменить профиль" as t_change_profile %}
|
||||||
{%trans "Выход" as t_logout %}
|
{%trans "Выход" as t_logout %}
|
||||||
|
{% check_subscribe_option user 'размещение заявок' as create_routes_allow %}
|
||||||
|
|
||||||
<div class="menu_profile {% if not page_type == 'profile' %}background{% endif %}">
|
<div class="menu_profile {% if not page_type == 'profile' %}background{% endif %}">
|
||||||
<div class="subscribe_type_txt"> {% if user_subscribe %}<span class="f-l">{% trans "Подписка" %}:</span> <span class="f-r">{{ user_subscribe.subscribe.name }}</span>{% endif %}<div class="clear_both"></div></div>
|
<div class="subscribe_type_txt"> {% if user_subscribe %}<span class="f-l">{% trans "Подписка" %}:</span> <span class="f-r">{{ user_subscribe.subscribe.name }}</span>{% endif %}<div class="clear_both"></div></div>
|
||||||
@@ -18,12 +20,14 @@
|
|||||||
{% with sel_page_name='create_route_for_mover' sel_page_name='dashboard' ajax_url="dashboard" title=t_prof img_path="/static/img/svg/User.svg"%}
|
{% with sel_page_name='create_route_for_mover' sel_page_name='dashboard' ajax_url="dashboard" title=t_prof img_path="/static/img/svg/User.svg"%}
|
||||||
{% include "widgets/profile/w_button_for_profile_menu.html" %}
|
{% include "widgets/profile/w_button_for_profile_menu.html" %}
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
{% with sel_page_name='create_route_for_customer' dom_id="customer" ajax_url="new_route_view" owner_type="customer" title=t_customer img_path="/static/img/svg/PushPin.svg"%}
|
{% if create_routes_allow %}
|
||||||
{% include "widgets/profile/w_button_for_profile_menu.html" %}
|
{% with sel_page_name='create_route_for_customer' dom_id="customer" ajax_url="new_route_view" owner_type="customer" title=t_customer img_path="/static/img/svg/PushPin.svg"%}
|
||||||
{% endwith %}
|
{% include "widgets/profile/w_button_for_profile_menu.html" %}
|
||||||
{% with sel_page_name='create_route_for_mover' dom_id="mover" ajax_url="new_route_view" owner_type="mover" title=t_mover img_path="/static/img/svg/PushPin.svg"%}
|
{% endwith %}
|
||||||
{% include "widgets/profile/w_button_for_profile_menu.html" %}
|
{% with sel_page_name='create_route_for_mover' dom_id="mover" ajax_url="new_route_view" owner_type="mover" title=t_mover img_path="/static/img/svg/PushPin.svg"%}
|
||||||
{% endwith %}
|
{% include "widgets/profile/w_button_for_profile_menu.html" %}
|
||||||
|
{% endwith %}
|
||||||
|
{% endif %}
|
||||||
{% with sel_page_name='my_routes' dom_id="my_routes_id" ajax_url="get_routes" title=t_my_routes img_path="/static/img/svg/Cards.svg"%}
|
{% with sel_page_name='my_routes' dom_id="my_routes_id" ajax_url="get_routes" title=t_my_routes img_path="/static/img/svg/Cards.svg"%}
|
||||||
{% include "widgets/profile/w_button_for_profile_menu.html" %}
|
{% include "widgets/profile/w_button_for_profile_menu.html" %}
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
{% load static %}
|
{% load static %}
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
|
{% load subscribes_tags_extra %}
|
||||||
|
|
||||||
{% if route.departure_DT %}
|
{% if route.departure_DT %}
|
||||||
{% now 'Y-m-d H:i:s' as current_date %}
|
{% now 'Y-m-d H:i:s' as current_date %}
|
||||||
@@ -99,43 +100,44 @@
|
|||||||
{# {% endif %}#}
|
{# {% endif %}#}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{% check_subscribe_option request.user 'просмотр контактов' as show_contacts_allow %}
|
||||||
|
|
||||||
<div name="form_carrier">
|
<div name="form_carrier">
|
||||||
{% if user.is_authenticated %}
|
{% if user.is_authenticated and show_contacts_allow %}
|
||||||
<div class="inf_carrier">
|
<div class="inf_carrier">
|
||||||
<img class="route_contact_avatar {% if route.owner == user %} active{% endif %}" {% if route.owner.user_profile.avatar %}
|
<img class="route_contact_avatar {% if route.owner == user %} active{% endif %}" {% if route.owner.user_profile.avatar %}
|
||||||
src="{{ route.owner.user_profile.avatar.url }}"
|
src="{{ route.owner.user_profile.avatar.url }}"
|
||||||
{% else %}src="{% static "img/svg/user_icon_standart.png" %}"{% endif %}>
|
{% else %}src="{% static "img/svg/user_icon_standart.png" %}"{% endif %}>
|
||||||
|
|
||||||
{% if user.is_authenticated %}
|
{% if user.is_authenticated %}
|
||||||
{# <span class="name_carrier">{{ route.owner.last_name }} {{ route.owner.first_name }}</span>#}
|
{# <span class="name_carrier">{{ route.owner.last_name }} {{ route.owner.first_name }}</span>#}
|
||||||
<span class="name_carrier{% if route.owner == user %}active{% endif %} el_for_open_el">{{ route.owner.last_name }} {{ route.owner.first_name }}</span>
|
<span class="name_carrier{% if route.owner == user %}active{% endif %} el_for_open_el">{{ route.owner.last_name }} {{ route.owner.first_name }}</span>
|
||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if not user.is_authenticated %}
|
{% if not user.is_authenticated %}
|
||||||
<span class="name_carrier"></span>
|
<span class="name_carrier"></span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<a class="phones_carrier" data-href="tel:{{ route.phone }}">
|
<a class="phones_carrier" data-href="tel:{{ route.phone }}">
|
||||||
<img class="inf_carrier_icon" src="{% static "/img/svg/phone.svg" %}"/>
|
<img class="inf_carrier_icon" src="{% static "/img/svg/phone.svg" %}"/>
|
||||||
<span class="phones_carrier_span el_for_open_el {% if route.owner == user %} active{% endif %}">{{ route.phone }}</span>
|
<span class="phones_carrier_span el_for_open_el {% if route.owner == user %} active{% endif %}">{{ route.phone }}</span>
|
||||||
{# <input value="{{ route.phone }}">#}
|
{# <input value="{{ route.phone }}">#}
|
||||||
<div class="clear_both"></div>
|
<div class="clear_both"></div>
|
||||||
</a>
|
</a>
|
||||||
<a class="email_carrier" data-href="mailto:{{ route.owner.email }}">
|
<a class="email_carrier" data-href="mailto:{{ route.owner.email }}">
|
||||||
<img class="inf_carrier_icon" src="{% static "/img/svg/email.svg" %}">
|
<img class="inf_carrier_icon" src="{% static "/img/svg/email.svg" %}">
|
||||||
<span class="email_carrier_span el_for_open_el {% if route.owner == user %} active{% endif %}">{{ route.owner.email }}</span>
|
<span class="email_carrier_span el_for_open_el {% if route.owner == user %} active{% endif %}">{{ route.owner.email }}</span>
|
||||||
{# <input value="{{ route.owner.email }}">#}
|
{# <input value="{{ route.owner.email }}">#}
|
||||||
<div class="clear_both"></div>
|
<div class="clear_both"></div>
|
||||||
{# <div>{{ route.get_cargo_type_display }}</div>#}
|
{# <div>{{ route.get_cargo_type_display }}</div>#}
|
||||||
{# <div>{{ route.weight }}</div>#}
|
{# <div>{{ route.weight }}</div>#}
|
||||||
{# <div>{{ route.get_owner_type_display }}</div>#}
|
{# <div>{{ route.get_owner_type_display }}</div>#}
|
||||||
{# <div>{{ route.id }},{{ forloop.counter }}</div>#}
|
{# <div>{{ route.id }},{{ forloop.counter }}</div>#}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if not user.is_authenticated %}
|
{% if not user.is_authenticated or not show_contacts_allow %}
|
||||||
<div class="inf_carrier">
|
<div class="inf_carrier">
|
||||||
<a class="phones_carrier">
|
<a class="phones_carrier">
|
||||||
<img class="inf_carrier_icon" src="{% static "/img/svg/phone.svg" %}"/>
|
<img class="inf_carrier_icon" src="{% static "/img/svg/phone.svg" %}"/>
|
||||||
@@ -155,7 +157,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
{% if not user.is_anonymous and route.owner != user %}
|
{% if not user.is_anonymous and route.owner != user and show_contacts_allow %}
|
||||||
<button class="open_chat_carrier" onclick="open_chat({{ route.owner_id }})">
|
<button class="open_chat_carrier" onclick="open_chat({{ route.owner_id }})">
|
||||||
<img src="{% static "img/svg/Logo.svg" %}" width="30px">
|
<img src="{% static "img/svg/Logo.svg" %}" width="30px">
|
||||||
<span> {% translate "Написать сообщение" %}</span>
|
<span> {% translate "Написать сообщение" %}</span>
|
||||||
@@ -163,7 +165,7 @@
|
|||||||
</button>
|
</button>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if user.is_authenticated %}
|
{% if user.is_authenticated and show_contacts_allow %}
|
||||||
<button
|
<button
|
||||||
class="open_inf_carrier"
|
class="open_inf_carrier"
|
||||||
{% if route.owner == user %} style="display: none;"{% endif %}
|
{% if route.owner == user %} style="display: none;"{% endif %}
|
||||||
@@ -174,7 +176,7 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|
||||||
{% if not user.is_authenticated %}
|
{% if not user.is_authenticated and show_contacts_allow %}
|
||||||
<div class="show_contact_wrapper">
|
<div class="show_contact_wrapper">
|
||||||
<a class="open_inf_carrier" href='{% url "login_profile" %}'>
|
<a class="open_inf_carrier" href='{% url "login_profile" %}'>
|
||||||
{% translate "Открыть контакт"%}
|
{% translate "Открыть контакт"%}
|
||||||
|
|||||||
Reference in New Issue
Block a user