diff --git a/ArticlesApp/models.py b/ArticlesApp/models.py
index cbc5cf7..9502cfe 100644
--- a/ArticlesApp/models.py
+++ b/ArticlesApp/models.py
@@ -19,7 +19,7 @@ from django.utils.translation import gettext_lazy as _
class UserPageModel(BaseModelViewPage):
# pub_DT = models.DateTimeField(verbose_name=u'Дата и время публикации', auto_created=True)
- text = RichTextUploadingField(verbose_name=u'Текст')
+ text = RichTextUploadingField(verbose_name=_('Текст'))
class Meta:
verbose_name=_("Пользовательская страница")
diff --git a/AuthApp/admin.py b/AuthApp/admin.py
index f83ba94..b4a262d 100644
--- a/AuthApp/admin.py
+++ b/AuthApp/admin.py
@@ -48,7 +48,7 @@ class Admin_ProfileInline(admin.StackedInline):
'comment', 'creator'
)
}),
- ('Дополнительно', {
+ (_('Дополнительно'), {
'classes': ['wide'],
'fields': (
('json_data',)
diff --git a/AuthApp/js_urls.py b/AuthApp/js_urls.py
index 795d2f9..9cfcbcf 100644
--- a/AuthApp/js_urls.py
+++ b/AuthApp/js_urls.py
@@ -27,4 +27,7 @@ urlpatterns = [
path('change_profile/', change_profile_ajax, name='change_profile_ajax'),
path('change_profile_confirm/', change_profile_confirm_ajax, name='change_profile_confirm_ajax'),
path('change_avatar_confirm/', change_avatar_confirm_ajax, name='change_avatar_confirm_ajax'),
+
+ path('request_offer/', request_offer_ajax, name='request_offer_ajax')
+
]
\ No newline at end of file
diff --git a/AuthApp/js_views.py b/AuthApp/js_views.py
index 5dffd9d..8d77ece 100644
--- a/AuthApp/js_views.py
+++ b/AuthApp/js_views.py
@@ -29,6 +29,57 @@ import base64
# html = render_to_string('blocks/profile/b_subscribe.html', Dict, request=request)
# return JsonResponse({'html': html}, status=200)
+
+
+def request_offer_ajax(request):
+ if request.method != 'POST':
+ raise Http404
+
+ data = request.POST
+ if not data and request.body:
+ data = request.body
+
+ from GeneralApp.funcs_options import get_options_by_opt_types, get_mail_send_options
+ sets = get_options_by_opt_types(['domain', 'project_name'], only_vals=True)
+
+ request_type = None
+ subject = _('Получен запрос')
+ if 'form_name' in data:
+ if data['form_name'] == 'msg_from_advertisement':
+ subject = _('Получен запрос на рекламу')
+ request_type = _('запрос на рекламу')
+
+ if request_type:
+ request_type_str = f'{_("Тип запроса")}: {request_type}
'
+ else:
+ request_type_str = ''
+
+ Dict = {
+ 'logo': f'{request.scheme}://{sets["domain"]}/static/img/svg/LogoMobile.svg',
+ 'project_name': sets['project_name'],
+ 'message_title': subject,
+ 'message_text': f'
{_("ДАННЫЕ ЗАПРОСА")}
'
+ f''
+ f'{request_type_str}'
+ f'{_("Имя")}: {data["name"]}
'
+ f'{_("Телефон")}: {data["phone"]}'
+ f'
'
+ }
+
+ html = render_to_string('mail/m_request_offer.html', Dict, request)
+ from BaseModels.mailSender import admin_send_mail_by_SMTPlib
+ mail_sets = get_mail_send_options()
+ to = [mail_sets['sender_email'], 'web@syncsystems.net']
+ res = admin_send_mail_by_SMTPlib(
+ mail_sets,
+ subject=subject,
+ from_email=mail_sets['sender_email'], to=to,
+ html_content=html
+ )
+
+ return JsonResponse({'status': 'sended'})
+
+
@login_required(login_url='/profile/login/')
def chats_ajax(request):
if request.method != 'POST':
diff --git a/BaseModels/admin_utils.py b/BaseModels/admin_utils.py
index dde9ac3..b283960 100644
--- a/BaseModels/admin_utils.py
+++ b/BaseModels/admin_utils.py
@@ -37,14 +37,14 @@ def get_base_fieldsets():
)
}],
- (u'Описание и текст', {
+ (_('Описание и текст'), {
'classes': ['wide', 'collapse'],
'fields': (
'description', 'text',
)
}),
- (u'Промо ФОН', {
+ (_('Промо ФОН'), {
'classes': ['wide', 'collapse'],
'fields': (
'background_promo_show', 'background_promo_inherits',
@@ -64,7 +64,7 @@ def get_base_fieldsets():
)
}),
- (u'Партнерские ссылки', {
+ (_('Партнерские ссылки'), {
'classes': ['wide', 'collapse'],
'fields': (
'link_left_promo_show',
diff --git a/BaseModels/mailSender.py b/BaseModels/mailSender.py
index 1417d09..8c2cfd3 100644
--- a/BaseModels/mailSender.py
+++ b/BaseModels/mailSender.py
@@ -91,7 +91,7 @@ def admin_send_mail_by_SMTPlib(sets, subject, from_email, to, html_content, atta
smtp_port = sets['mail_server_smtp_port']
smtp_password = sets['sender_mail_password']
smtp_login = sets['sender_mail_login']
- res = send_mail_by_SMTPlib(subject, from_email, to, html_content, smtp_server, smtp_port, smtp_login,
+ res = send_mail_by_SMTPlib(sets, subject, from_email, to, html_content, smtp_server, smtp_port, smtp_login,
smtp_password, attachments)
@@ -106,14 +106,14 @@ def admin_send_mail_by_SMTPlib(sets, subject, from_email, to, html_content, atta
def send_mail_by_SMTPlib(sets, subject, from_email, to_init, html_content, smtp_server, smtp_port, smtp_login, smtp_password,
attachments=None):
to = to_init
- if not settings.prod_server:
- to = 'web@syncsystems.net'
- else:
- to = to_init
- try:
- from settings_local import DEBUG
- except:
- print('get settings_local fail')
+ # if not settings.prod_server:
+ # to = 'web@syncsystems.net'
+ # else:
+ # to = to_init
+ # try:
+ # from settings_local import DEBUG
+ # except:
+ # print('get settings_local fail')
res = None
mail_lib = None
@@ -153,8 +153,8 @@ def send_mail_by_SMTPlib(sets, subject, from_email, to_init, html_content, smtp_
else:
to_str = to[0]
else:
- if to == sets['sender_email']:
- return None
+ # if to == sets['sender_email']:
+ # return None
to_str = to
to = []
to.append(to_str)
diff --git a/GeneralApp/admin.py b/GeneralApp/admin.py
index 7399cfa..fba6770 100644
--- a/GeneralApp/admin.py
+++ b/GeneralApp/admin.py
@@ -1,6 +1,7 @@
from sets.admin import *
from .models import *
from django.contrib import admin
+from django.utils.translation import gettext as _
class Admin_StaticPage(Admin_Trans_BaseModelViewPage):
@@ -14,7 +15,7 @@ class Admin_StaticPage(Admin_Trans_BaseModelViewPage):
'order',
)
}),
- ('Настройки', {
+ (_('Настройки'), {
'classes': ['wide', 'collapse'],
'fields': (
'FAQ_title',
@@ -51,34 +52,35 @@ class Admin_StaticPage(Admin_Trans_BaseModelViewPage):
admin.site.register(StaticPage,Admin_StaticPage)
-class Admin_Block(Admin_BaseBlock):
+class Admin_Block(Admin_Trans_BaseModel):
+ pass
- def get_fieldsets(self, request, obj=None):
- fieldsets = super(type(self), self).get_fieldsets(request, obj)
- if not request.user.is_superuser and obj.name and obj.name in ('About US', 'machines', 'works'):
- fieldsets[0][1]['fields'].pop(0)
- fieldsets.insert(
- 1, ('Контент', {
- 'classes': ['wide'],
- 'fields': (
- 'title', 'description', 'text',
- 'picture',
- )
-
- })
- )
- return fieldsets
-
- def has_delete_permission(self, request, obj=None):
- if request.user.is_superuser:
- return True
-
- if obj.name in ('About US', 'machines', 'works'):
- return False
+ # def get_fieldsets(self, request, obj=None):
+ # fieldsets = super(type(self), self).get_fieldsets(request, obj)
+ # if not request.user.is_superuser and obj.name and obj.name in ('About US', 'machines', 'works'):
+ # fieldsets[0][1]['fields'].pop(0)
+ # fieldsets.insert(
+ # 1, (_('Контент'), {
+ # 'classes': ['wide'],
+ # 'fields': (
+ # 'title', 'description', 'text',
+ # 'picture',
+ # )
+ #
+ # })
+ # )
+ # return fieldsets
+ #
+ # def has_delete_permission(self, request, obj=None):
+ # if request.user.is_superuser:
+ # return True
+ #
+ # if obj.name in ('About US', 'machines', 'works'):
+ # return False
admin.site.register(Block,Admin_Block)
-class Admin_Option(Admin_BaseModel):
+class Admin_Option(Admin_Trans_BaseModel):
# def get_fieldsets(self, request, obj=None):
# fieldsets = super(type(self), self).get_fieldsets(request, obj)
@@ -95,7 +97,7 @@ class Admin_Option(Admin_BaseModel):
fieldsets = [
- ('Контент', {
+ (_('Контент'), {
'classes': ['wide'],
'fields': (
'name', 'opt_type', 'prefix', 'value', 'picture'
diff --git a/GeneralApp/funcs_options.py b/GeneralApp/funcs_options.py
index fb4c1ab..bf34d9d 100644
--- a/GeneralApp/funcs_options.py
+++ b/GeneralApp/funcs_options.py
@@ -10,8 +10,8 @@ def get_options_by_opt_types(opt_types, only_vals=False):
opts = Option.objects.filter(**kwargs)
if opts and only_vals:
- opts = opts.values('name', 'value')
- opts = {item['name']: item['value'] for item in opts}
+ opts = opts.values('opt_type', 'value')
+ opts = {item['opt_type']: item['value'] for item in opts}
return opts
def get_first_option_value_by_opt_type(opt_type):
diff --git a/GeneralApp/init_options.py b/GeneralApp/init_options.py
index 5849f91..bc8ce1f 100644
--- a/GeneralApp/init_options.py
+++ b/GeneralApp/init_options.py
@@ -1,49 +1,50 @@
from .models import *
+from django.utils.translation import gettext as _
required_options_Dict = {
'Адрес почтового сервера': {
- 'name': 'Адрес почтового сервера',
+ 'name_ru': 'Адрес почтового сервера',
'opt_type': 'mail_server_url',
'value': '213.142.147.40',
},
'SMTP порт почтового сервера': {
- 'name': 'SMTP порт почтового сервера',
+ 'name_ru': 'SMTP порт почтового сервера',
'opt_type': 'mail_server_smtp_port',
'value': 587,
},
'login для отправки писем с сайта': {
- 'name': 'email для отправки писем с сайта',
+ 'name_ru': 'email для отправки писем с сайта',
'opt_type': 'sender_mail_login',
'value': 'admin@tripwb.com',
},
'email для отправки': {
- 'name': 'email для отправки',
+ 'name_ru': 'email для отправки',
'opt_type': 'sender_email',
'value': 'admin@tripwb.com',
},
'Пароль для отправки писем с сайта': {
- 'name': 'пароль для отправки писем с сайта',
+ 'name_ru': 'пароль для отправки писем с сайта',
'opt_type': 'sender_mail_password',
'value': 't5Fdcah^gdajY',
},
'Название проекта': {
- 'name': 'Название проекта',
+ 'name_ru': 'Название проекта',
'opt_type': 'project_name',
'value': 'TWB',
},
'Адрес сайта': {
- 'name': 'Адрес сайта',
+ 'name_ru': 'Адрес сайта',
'opt_type': 'domain',
'value': 'tripwb.com',
},
'email техподдержки': {
- 'name': 'email техподдержки',
+ 'name_ru': 'email техподдержки',
'opt_type': 'support_email',
'value': 'admin@tripwb.com',
},
'корпоративный email': {
- 'name': 'корпоративный email',
+ 'name_ru': 'корпоративный email',
'opt_type': 'corp_email',
'value': 'admin@tripwb.com',
},
diff --git a/GeneralApp/migrations/0005_option_name_en_option_name_ru_option_prefix_en_and_more.py b/GeneralApp/migrations/0005_option_name_en_option_name_ru_option_prefix_en_and_more.py
new file mode 100644
index 0000000..6e2ade0
--- /dev/null
+++ b/GeneralApp/migrations/0005_option_name_en_option_name_ru_option_prefix_en_and_more.py
@@ -0,0 +1,43 @@
+# Generated by Django 4.2.2 on 2023-11-30 13:42
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('GeneralApp', '0004_alter_block_description_alter_block_description_en_and_more'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='option',
+ name='name_en',
+ field=models.TextField(blank=True, help_text='Название', null=True, verbose_name='Название'),
+ ),
+ migrations.AddField(
+ model_name='option',
+ name='name_ru',
+ field=models.TextField(blank=True, help_text='Название', null=True, verbose_name='Название'),
+ ),
+ migrations.AddField(
+ model_name='option',
+ name='prefix_en',
+ field=models.CharField(blank=True, max_length=250, null=True, verbose_name='Префикс'),
+ ),
+ migrations.AddField(
+ model_name='option',
+ name='prefix_ru',
+ field=models.CharField(blank=True, max_length=250, null=True, verbose_name='Префикс'),
+ ),
+ migrations.AddField(
+ model_name='option',
+ name='value_en',
+ field=models.CharField(max_length=250, null=True, verbose_name='Значение'),
+ ),
+ migrations.AddField(
+ model_name='option',
+ name='value_ru',
+ field=models.CharField(max_length=250, null=True, verbose_name='Значение'),
+ ),
+ ]
diff --git a/GeneralApp/translation.py b/GeneralApp/translation.py
index 59a74b2..2427687 100644
--- a/GeneralApp/translation.py
+++ b/GeneralApp/translation.py
@@ -14,6 +14,12 @@ class Block_TranslationOptions(TranslationOptions):
)
translator.register(Block, Block_TranslationOptions)
+class Option_TranslationOptions(TranslationOptions):
+ fields = (
+ 'name', 'value', 'prefix'
+ )
+translator.register(Option, Option_TranslationOptions)
+
class FAQitem_TranslationOptions(TranslationOptions):
fields = (
diff --git a/RoutesApp/js_views.py b/RoutesApp/js_views.py
index 3e57579..8cf7ffb 100644
--- a/RoutesApp/js_views.py
+++ b/RoutesApp/js_views.py
@@ -143,8 +143,10 @@ def find_routes_ajax(request):
if 'errors' in routes_Dict:
return JsonResponse(routes_Dict, status=400)
-
- html = render_to_string('blocks/b_search_routes.html', routes_Dict, request=request)
+ if routes_Dict['routes']:
+ html = render_to_string('blocks/b_search_routes.html', routes_Dict, request=request)
+ else:
+ html = render_to_string('templates_js_translate/not_found_find_routes.html', routes_Dict, request=request)
res_Dict = {
'html': html,
@@ -240,6 +242,8 @@ def create_or_change_route_ajax(request, route_id=None):
obj.owner = request.user
obj.save()
+ route_id = obj.id
+
routes_Dict = get_routes_Dict(request.user)
if 'errors' in routes_Dict:
diff --git a/RoutesApp/models.py b/RoutesApp/models.py
index 69a7b06..6172981 100644
--- a/RoutesApp/models.py
+++ b/RoutesApp/models.py
@@ -75,14 +75,14 @@ class Route(BaseModel):
ordering = ('name',)
def from_country_n_city_str(self):
- res = 'Неизвестно'
+ res = _('Неизвестно')
if self.from_city:
res = self.from_city.get_country_n_city_str()
return res
def to_country_n_city_str(self):
- res = 'Неизвестно'
+ res = _('Неизвестно')
if self.to_city:
res = self.to_city.get_country_n_city_str()
diff --git a/SubscribesApp/migrations/0003_alter_subscribe_bg_color_alter_subscribe_text_color.py b/SubscribesApp/migrations/0003_alter_subscribe_bg_color_alter_subscribe_text_color.py
new file mode 100644
index 0000000..a7321de
--- /dev/null
+++ b/SubscribesApp/migrations/0003_alter_subscribe_bg_color_alter_subscribe_text_color.py
@@ -0,0 +1,24 @@
+# Generated by Django 4.2.2 on 2023-11-30 13:42
+
+import colorfield.fields
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('SubscribesApp', '0002_alter_subscribeoption_options_subscribe_bg_color_and_more'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name='subscribe',
+ name='bg_color',
+ field=colorfield.fields.ColorField(default='#FFFFFF', image_field=None, max_length=25, samples=None, verbose_name='Цвет фона'),
+ ),
+ migrations.AlterField(
+ model_name='subscribe',
+ name='text_color',
+ field=colorfield.fields.ColorField(default='#000000', image_field=None, max_length=25, samples=None, verbose_name='Цвет текста'),
+ ),
+ ]
diff --git a/static/css/styles(boris).css b/static/css/styles(boris).css
index 442ac67..49240ec 100644
--- a/static/css/styles(boris).css
+++ b/static/css/styles(boris).css
@@ -2817,4 +2817,31 @@
text-align: left;
top: 0;
left: 19px;
+}
+
+.btn_a_anchor{
+ border-radius: 10px;
+ background: #E6E6E6;
+ width: 20%;
+ height: 60px;
+ font-size: 18px;
+ font-style: normal;
+ font-weight: 600;
+ line-height: 26px;
+ color: rgba(39, 36, 36, 0.60);
+ margin-left: 5px;
+ display: block;
+}
+
+.btn_a_anchor.partners{
+ background: #FF613A;
+ color: #FFF;
+}
+
+.text_in_btn_a_anchor{
+ padding-top: 20px;
+}
+
+.anchor{
+ scroll-margin-top: 60px;
}
\ No newline at end of file
diff --git a/static/css/styles.css b/static/css/styles.css
index 11ef580..8077e12 100644
--- a/static/css/styles.css
+++ b/static/css/styles.css
@@ -1964,8 +1964,8 @@ button#more_button{
border-radius: 10px;
text-align: center;
box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.12);
- margin: 0 auto;
-
+ margin-left: 0;
+ margin-right: 0;
}
@@ -2203,23 +2203,26 @@ figure{
text-align: -moz-center;
width: 100%;
margin-top: 40px;
+ display: flex;
+ justify-content: center;
+ flex-wrap: wrap;
}
-#how_it_work_b{
- border-radius: 10px;
- background: #E6E6E6;
- width: 20%;
- height: 60px;
- font-size: 18px;
- font-style: normal;
- font-weight: 600;
- line-height: 26px;
- color: rgba(39, 36, 36, 0.60);
- margin-left: 5px;
+/*#how_it_work_b{*/
+/* border-radius: 10px;*/
+/* background: #E6E6E6;*/
+/* width: 20%;*/
+/* height: 60px;*/
+/* font-size: 18px;*/
+/* font-style: normal;*/
+/* font-weight: 600;*/
+/* line-height: 26px;*/
+/* color: rgba(39, 36, 36, 0.60);*/
+/* margin-left: 5px;*/
-}
+/*}*/
.benefit_img_item{
width: 30%;
diff --git a/static/js/filters_functions_find_route.js b/static/js/filters_functions_find_route.js
index 66b3b56..77dc79d 100644
--- a/static/js/filters_functions_find_route.js
+++ b/static/js/filters_functions_find_route.js
@@ -114,17 +114,9 @@ function ajax_for_filter (data_d,get_url){
}
}
}
- if (data.html === "\n\n\n\n\n"){
+ if (data.html.includes("not_found_routes")){
// document.querySelector(".block-finded-routes").innerHTML = "Нечего не найдено!"
- document.querySelector(".block-finded-routes").innerHTML = "\n" +
- "
\n" +
- " Упс... Ничего не найдено, попробуйте\n" +
- " изменить параметры поиска или оставьте заявку\n" +
- " на перевозку посылки\n" +
- "
\n" +
- "

\n" +
- "

\n" +
- "
"
+ document.querySelector(".block-finded-routes").innerHTML = data.html
} else {
diff --git a/static/js/global_js.js b/static/js/global_js.js
index 0d3fd28..5d0f8a5 100644
--- a/static/js/global_js.js
+++ b/static/js/global_js.js
@@ -5,31 +5,6 @@
// window.onfocus = function () {
// getSocketState()
// }
-let map_of_words_en = new Map([
- ['закрыть'],['Close']
-])
-let map_of_words_ru = new Map([
- ['close'],['Закрыть']
-])
-function translate_words (word,lang){
- let corr_word = word.toLowersCase()
- let trans_word = null
- if (lang === 'ru'){
- trans_word = map_of_words_ru.get(`${corr_word}`)
-
- } else if (lang === 'en') {
- trans_word = map_of_words_en.get(`${corr_word}`)
- }
-
-}
-
-function check_return_trans_word (str) {
- if (!str === undefined && str === '' && str){
- return str
- } else {
- console.log(`error! str = ${str}`)
- }
-}
window.onload = function (){
middleWareJS()
diff --git a/static/js/user_profile.js b/static/js/user_profile.js
index 62f8fd3..7e58997 100644
--- a/static/js/user_profile.js
+++ b/static/js/user_profile.js
@@ -332,7 +332,9 @@ function selectItemAddrPoint(id, name, ctrl_name,){
tap_txt_cont.setAttribute('title',name)
let tap_cont = document.querySelector("#id_" + ctrl_name.slice(0, -4));
tap_cont.value = id;
- changeWidthEL(tap_txt_cont)
+ if (!window.location.href.includes("profile")){
+ changeWidthEL(tap_txt_cont)
+ }
input_list.classList.remove('show');
if (document.querySelector(".container_form_search_carrier")){
document.querySelector(".container_form_search_carrier").style.zIndex = 'unset'
@@ -522,15 +524,21 @@ function sendRoute(el, routeID = null){
data: JSON.stringify(obj_w_el_form),
success: function(data){
-
+ let data_route_id = data.route_id
// location.href = '/profile'
document.querySelector(".info_profile").innerHTML = data.html
- let el_route = document.querySelector(`[data-number-of-route="${routeID}"]`);
-
- el_route.scrollIntoView(true);
+ let el_route = document.querySelector(`[data-number-of-route="${data_route_id}"]`);
+ if (routeID){
+ el_route = document.querySelector(`[data-number-of-route="${routeID}"]`);
+ }
+ el_route.scrollIntoView({
+ behavior:"smooth",
+ block:'start',
+ inline:'start'
+ });
diff --git a/templates/blocks/profile/b_profile.html b/templates/blocks/profile/b_profile.html
index 1c98c35..89cfcac 100644
--- a/templates/blocks/profile/b_profile.html
+++ b/templates/blocks/profile/b_profile.html
@@ -40,7 +40,7 @@
{% if profileForm.errors.tel %}{{ profileForm.errors.tel }}
{% endif %}
diff --git a/templates/blocks/profile/b_subscribe_variants.html b/templates/blocks/profile/b_subscribe_variants.html
index d2b7d97..ba3bbc8 100644
--- a/templates/blocks/profile/b_subscribe_variants.html
+++ b/templates/blocks/profile/b_subscribe_variants.html
@@ -8,7 +8,9 @@
diff --git a/templates/blocks/static_pages_blocks/b_advertisement.html b/templates/blocks/static_pages_blocks/b_advertisement.html
index b133090..dbc4093 100644
--- a/templates/blocks/static_pages_blocks/b_advertisement.html
+++ b/templates/blocks/static_pages_blocks/b_advertisement.html
@@ -8,9 +8,9 @@
{{ page.title }}
{{ page.description }}
@@ -42,7 +42,7 @@
-
@@ -55,7 +54,7 @@
{% include "blocks/static_pages_blocks/b_benefit_img_about_service.html" %}
-
+
- Опции:
+ {% trans "Опции" %}:
diff --git a/templates/blocks/static_pages_blocks/b_partners.html b/templates/blocks/static_pages_blocks/b_partners.html
index f747f85..e42ee66 100644
--- a/templates/blocks/static_pages_blocks/b_partners.html
+++ b/templates/blocks/static_pages_blocks/b_partners.html
@@ -6,9 +6,9 @@
{{ page.description }}
@@ -30,7 +30,7 @@
-