From 0ac8e906a2bf91159d9a224a6ce1b111a6289302 Mon Sep 17 00:00:00 2001 From: sysadminix Date: Wed, 10 Jul 2024 17:56:29 +0300 Subject: [PATCH 01/36] 1.0.24 robots --- templates/blocks/static_pages_blocks/b_mover_search.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/blocks/static_pages_blocks/b_mover_search.html b/templates/blocks/static_pages_blocks/b_mover_search.html index 5182c74..c41d462 100644 --- a/templates/blocks/static_pages_blocks/b_mover_search.html +++ b/templates/blocks/static_pages_blocks/b_mover_search.html @@ -169,7 +169,7 @@
{% if subscribe.price %} - {{ subscribe.price|floatformat }}$ + {{ subscribe.price|floatformat }}₸ {% else %} {% translate "Бесплатно" %} {% endif %} From 1ad58b05efc26f5ccd5a28371d19e51b76be2755 Mon Sep 17 00:00:00 2001 From: SDE Date: Fri, 12 Jul 2024 18:54:14 +0300 Subject: [PATCH 02/36] 1.6.0 parsing timezones --- GeneralApp/views.py | 7 +++++-- ReferenceDataApp/admin.py | 34 +++++++++++++++++++++++++++++++--- ReferenceDataApp/funcs.py | 37 ++++++++++++++++++++++++++++++++----- ReferenceDataApp/models.py | 6 ++++++ requirements.pip | 1 + 5 files changed, 75 insertions(+), 10 deletions(-) diff --git a/GeneralApp/views.py b/GeneralApp/views.py index 54bc80f..831e2e6 100644 --- a/GeneralApp/views.py +++ b/GeneralApp/views.py @@ -22,8 +22,11 @@ def test_code(request): res = None - from SubscribesApp.reports import send_mail_for_user_subscribes_that_is_going_to_finish - send_mail_for_user_subscribes_that_is_going_to_finish() + from ReferenceDataApp.funcs import parse_data + parse_data() + + # from SubscribesApp.reports import send_mail_for_user_subscribes_that_is_going_to_finish + # send_mail_for_user_subscribes_that_is_going_to_finish() if res: if type(res) == str: diff --git a/ReferenceDataApp/admin.py b/ReferenceDataApp/admin.py index 2d5e239..147ff45 100644 --- a/ReferenceDataApp/admin.py +++ b/ReferenceDataApp/admin.py @@ -2,6 +2,7 @@ from django.contrib import admin from sets.admin import Admin_Trans_BaseModel from .models import * from modeltranslation.admin import TranslationAdmin +from django.utils.translation import gettext as _ class Admin_Country(Admin_Trans_BaseModel): fieldsets = [ @@ -10,11 +11,20 @@ class Admin_Country(Admin_Trans_BaseModel): 'fields': [ 'name', 'enable', 'short_code', 'code', ] - }] + }], + [_('Дополнительно'), { + 'classes': ['wide', 'collapse'], + 'fields': ( + 'timezone', + 'geo_lat', 'geo_lon', + 'json_data', + ) + }], ] list_display = [ 'id', 'name', 'name_en', 'name_ru', + 'timezone', 'short_code', 'code', 'enable', 'area_id', 'parsing_finished_DT', 'order', 'modifiedDT', 'createDT'] @@ -28,12 +38,21 @@ class Admin_City(Admin_Trans_BaseModel): 'fields': [ 'name', 'enable', 'country', ] - }] + }], + [_('Дополнительно'), { + 'classes': ['wide', 'collapse'], + 'fields': ( + 'timezone', + 'geo_lat', 'geo_lon', + 'json_data', + ) + }], ] list_display = [ 'id', 'name', 'name_en', 'name_ru', 'country', + 'timezone', 'enable', 'area_id', 'parsing_finished_DT', 'order', 'modifiedDT', 'createDT'] search_fields = ['id', 'name_en', 'name_ru', 'country__name'] @@ -50,12 +69,21 @@ class Admin_Airport(Admin_Trans_BaseModel): 'international_name', # 'area_id' ] - }] + }], + [_('Дополнительно'), { + 'classes': ['wide', 'collapse'], + 'fields': ( + 'timezone', + 'geo_lat', 'geo_lon', + 'json_data', + ) + }], ] list_display = [ 'id', 'name', 'name_en', 'name_ru', 'city', 'iata_code', 'icao_code', + 'timezone', 'international_name', 'enable', 'area_id', 'parsing_finished_DT', 'order', 'modifiedDT', 'createDT'] diff --git a/ReferenceDataApp/funcs.py b/ReferenceDataApp/funcs.py index be2f6f1..1f8ba8a 100644 --- a/ReferenceDataApp/funcs.py +++ b/ReferenceDataApp/funcs.py @@ -3,7 +3,9 @@ from .models import * import hashlib, json from datetime import datetime, timedelta from django.db.models import Q +from timezonefinder import TimezoneFinder +tzf = TimezoneFinder() def search_cities_in_db(search_str): @@ -57,20 +59,31 @@ def create_airports_by_airportsList(airportsList, city=None): if airport_Dict['iata']: kwargs.update({'iata_code': airport_Dict['iata']}) airport = Airport.objects.get(**kwargs) + if airport.geo_lat and airport.geo_lon and not airport.timezone: + airport.timezone = tzf.timezone_at( + lng=float(airport.geo_lon), lat=float(airport.geo_lat)) + airport.save(update_fields=['timezone']) + print(f'airport {airport.international_name} - {airport.timezone}') except Airport.DoesNotExist: print(f' - - {airport_Dict["iata"]} не найден в БД > добавляем') except Exception as e: print(f'error = {str(e)}') if not airport: + geo_lat = float(airport_Dict['@lat']) + geo_lon = float(airport_Dict['@lon']) + tz = tzf.timezone_at(lng=geo_lon, lat=geo_lat) + print(f'airport {airport_Dict["int_name"]} - {tz}') + airport_kwargs = { 'city': city, # 'name_ru': airport_Dict['name:ru'], # 'name_en': airport_Dict['name:en'], + 'timezone': tz, - 'geo_lat': str(airport_Dict['@lat']), - 'geo_lon': str(airport_Dict['@lon']), + 'geo_lat': str(geo_lat), + 'geo_lon': str(geo_lon), 'international_name': airport_Dict['int_name'], @@ -119,7 +132,10 @@ def parse_data(): country = Country.objects.get(**kwargs) - if country.parsing_finished_DT and (datetime.now() - country.parsing_finished_DT).days < 30: + if (country.parsing_finished_DT + and (datetime.now() - country.parsing_finished_DT).days < 30 + and country.timezone + ): print(f' + {country.name} - существует в БД, не требует парсинга') continue @@ -194,6 +210,11 @@ def parse_data(): else: print(f'error = {str(e)}') + geo_lat = float(city_Dict['@lat']) + geo_lon = float(city_Dict['@lon']) + tz = tzf.timezone_at(lng=geo_lon, lat=geo_lat) + print(f'city {city_Dict["name:en"]} - {tz}') + # собираем данные city_kwargs = { 'country': country, @@ -201,8 +222,11 @@ def parse_data(): # 'name_ru': city_Dict['name:ru'], # 'name_en': city_Dict['name:en'], - 'geo_lat': str(city_Dict['@lat']), - 'geo_lon': str(city_Dict['@lon']), + 'timezone': tz, + + 'geo_lat': str(geo_lat), + 'geo_lon': str(geo_lon), + } if city_Dict['name:ru']: @@ -232,6 +256,9 @@ def parse_data(): hash_data = hashlib.md5(json.dumps(country_Dict, sort_keys=True, ensure_ascii=True).encode('utf-8')).hexdigest() country.add_node_to_json_data({'hash': hash_data}) + country.timezone = tzf.timezone_at(lng=float(country.geo_lon), lat=float(country.geo_lat)) + print(f'country {country.name} - {country.timezone}') + if 'parsing_status' in country_Dict and country_Dict['parsing_status'] == 'finished': country.parsing_finished_DT = datetime.now() country.save(update_fields=['parsing_finished_DT']) diff --git a/ReferenceDataApp/models.py b/ReferenceDataApp/models.py index dbd7bf8..dc7aa7f 100644 --- a/ReferenceDataApp/models.py +++ b/ReferenceDataApp/models.py @@ -15,6 +15,8 @@ class Country(BaseModel): geo_lat = models.CharField(max_length=20, verbose_name=_('GPS широта'), blank=True, null=True) geo_lon = models.CharField(max_length=20, verbose_name=_('GPS долгота'), blank=True, null=True) + timezone = models.CharField(max_length=250, verbose_name=_('Часовая зона'), blank=True, null=True) + area_id = models.BigIntegerField(blank=True, null=True) parsing_finished_DT = models.DateTimeField(verbose_name=_('Дата и время завершения парсинга'), blank=True, null=True) @@ -46,6 +48,8 @@ class City(BaseModel): area_id = models.BigIntegerField(blank=True, null=True) + timezone = models.CharField(max_length=250, verbose_name=_('Часовая зона'), blank=True, null=True) + parsing_finished_DT = models.DateTimeField(verbose_name=_('Дата и время завершения парсинга'), blank=True, null=True) def __str__(self): @@ -83,6 +87,8 @@ class Airport(BaseModel): geo_lat = models.CharField(max_length=20, verbose_name=_('GPS широта'), blank=True, null=True) geo_lon = models.CharField(max_length=20, verbose_name=_('GPS долгота'), blank=True, null=True) + timezone = models.CharField(max_length=250, verbose_name=_('Часовая зона'), blank=True, null=True) + area_id = models.BigIntegerField(blank=True, null=True) parsing_finished_DT = models.DateTimeField(verbose_name=_('Дата и время завершения парсинга'), blank=True, null=True) diff --git a/requirements.pip b/requirements.pip index 3900a21..490c825 100644 --- a/requirements.pip +++ b/requirements.pip @@ -16,4 +16,5 @@ pytz==2024.1 requests-pkcs12==1.24 #django-tz-detect==0.4.0 django-rosetta==0.10.0 +timezonefinder==6.5.2 From d981a836526701bc151bf2b6ebe076642f3ad19c Mon Sep 17 00:00:00 2001 From: SDE Date: Fri, 12 Jul 2024 19:01:58 +0300 Subject: [PATCH 03/36] 1.6.1 parsing timezones --- ReferenceDataApp/funcs.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/ReferenceDataApp/funcs.py b/ReferenceDataApp/funcs.py index 1f8ba8a..b779620 100644 --- a/ReferenceDataApp/funcs.py +++ b/ReferenceDataApp/funcs.py @@ -213,7 +213,8 @@ def parse_data(): geo_lat = float(city_Dict['@lat']) geo_lon = float(city_Dict['@lon']) tz = tzf.timezone_at(lng=geo_lon, lat=geo_lat) - print(f'city {city_Dict["name:en"]} - {tz}') + if not city or not city.timezone: + print(f'city {city_Dict["name:en"]} - {tz}') # собираем данные city_kwargs = { @@ -256,11 +257,12 @@ def parse_data(): hash_data = hashlib.md5(json.dumps(country_Dict, sort_keys=True, ensure_ascii=True).encode('utf-8')).hexdigest() country.add_node_to_json_data({'hash': hash_data}) - country.timezone = tzf.timezone_at(lng=float(country.geo_lon), lat=float(country.geo_lat)) - print(f'country {country.name} - {country.timezone}') + if not country.timezone: + country.timezone = tzf.timezone_at(lng=float(country.geo_lon), lat=float(country.geo_lat)) + print(f'country {country.name} - {country.timezone}') if 'parsing_status' in country_Dict and country_Dict['parsing_status'] == 'finished': country.parsing_finished_DT = datetime.now() - country.save(update_fields=['parsing_finished_DT']) + country.save() return True \ No newline at end of file From 3d6fb389379d69ba3650244e12fbe0d250a474f5 Mon Sep 17 00:00:00 2001 From: SDE Date: Fri, 12 Jul 2024 21:07:07 +0300 Subject: [PATCH 04/36] 1.6.2 parsing timezones --- ReferenceDataApp/admin.py | 10 +++++++++- ReferenceDataApp/models.py | 5 +++++ RoutesApp/js_views.py | 1 + 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/ReferenceDataApp/admin.py b/ReferenceDataApp/admin.py index 147ff45..b696571 100644 --- a/ReferenceDataApp/admin.py +++ b/ReferenceDataApp/admin.py @@ -32,6 +32,14 @@ class Admin_Country(Admin_Trans_BaseModel): admin.site.register(Country, Admin_Country) class Admin_City(Admin_Trans_BaseModel): + + def cur_dt(self, obj): + if obj.timezone: + return obj.get_current_datetime() + else: + return '-' + cur_dt.short_description = 'текущее время' + fieldsets = [ [None, { 'classes': ['wide'], @@ -52,7 +60,7 @@ class Admin_City(Admin_Trans_BaseModel): list_display = [ 'id', 'name', 'name_en', 'name_ru', 'country', - 'timezone', + 'timezone', 'cur_dt', 'enable', 'area_id', 'parsing_finished_DT', 'order', 'modifiedDT', 'createDT'] search_fields = ['id', 'name_en', 'name_ru', 'country__name'] diff --git a/ReferenceDataApp/models.py b/ReferenceDataApp/models.py index dc7aa7f..50944f4 100644 --- a/ReferenceDataApp/models.py +++ b/ReferenceDataApp/models.py @@ -1,6 +1,8 @@ +import pytz from django.db import models from BaseModels.base_models import BaseModel from django.utils.translation import gettext_lazy as _ +from datetime import datetime class Country(BaseModel): international_name = models.CharField(max_length=250, verbose_name=_('Международное название'), blank=True, null=True) @@ -58,6 +60,9 @@ class City(BaseModel): else: return f'{self.id}' + def get_current_datetime(self): + return datetime.now(tz=pytz.timezone(self.timezone)) + def get_country_n_city_str(self): country = _('Неизвестно') city = self.name diff --git a/RoutesApp/js_views.py b/RoutesApp/js_views.py index e3d3fbc..60125e4 100644 --- a/RoutesApp/js_views.py +++ b/RoutesApp/js_views.py @@ -258,6 +258,7 @@ def find_routes_ajax(request): if 'errors' in routes_Dict: return JsonResponse(routes_Dict, status=400) + if routes_Dict['routes']: html = render_to_string('blocks/b_search_routes.html', routes_Dict, request=request) else: From 1486879a58c778c66f31a5e9c75eb0c2e0875ec4 Mon Sep 17 00:00:00 2001 From: SDE Date: Sat, 13 Jul 2024 01:29:36 +0300 Subject: [PATCH 05/36] 1.6.3 parsing timezones --- ReferenceDataApp/funcs.py | 5 ++++- ReferenceDataApp/models.py | 8 ++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/ReferenceDataApp/funcs.py b/ReferenceDataApp/funcs.py index b779620..a565786 100644 --- a/ReferenceDataApp/funcs.py +++ b/ReferenceDataApp/funcs.py @@ -62,7 +62,8 @@ def create_airports_by_airportsList(airportsList, city=None): if airport.geo_lat and airport.geo_lon and not airport.timezone: airport.timezone = tzf.timezone_at( lng=float(airport.geo_lon), lat=float(airport.geo_lat)) - airport.save(update_fields=['timezone']) + airport.modifiedDT = datetime.now() + airport.save() print(f'airport {airport.international_name} - {airport.timezone}') except Airport.DoesNotExist: print(f' - - {airport_Dict["iata"]} не найден в БД > добавляем') @@ -89,6 +90,8 @@ def create_airports_by_airportsList(airportsList, city=None): 'iata_code': airport_Dict['iata'], 'icao_code': airport_Dict['icao'], + + 'modifiedDT': datetime.now(), } if airport_Dict['name:ru']: diff --git a/ReferenceDataApp/models.py b/ReferenceDataApp/models.py index 50944f4..b8b322a 100644 --- a/ReferenceDataApp/models.py +++ b/ReferenceDataApp/models.py @@ -60,7 +60,15 @@ class City(BaseModel): else: return f'{self.id}' + def get_n_save_timezone(self): + from ReferenceDataApp.funcs import tzf + self.timezone = tzf.timezone_at(lng=self.geo_lon, lat=self.geo_lat) + self.save(update_fields=['timezone']) + return self.timezone + def get_current_datetime(self): + if not self.timezone: + self.timezone = self.get_n_save_timezone() return datetime.now(tz=pytz.timezone(self.timezone)) def get_country_n_city_str(self): From f23ad1a33a6a069bbd7c5448a9a6229f85c3981d Mon Sep 17 00:00:00 2001 From: sysadminix Date: Mon, 15 Jul 2024 23:40:42 +0300 Subject: [PATCH 06/36] 1.0.25 password text in registration mail --- templates/mail/m_registration.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/mail/m_registration.html b/templates/mail/m_registration.html index 5a5f272..f4c84ad 100644 --- a/templates/mail/m_registration.html +++ b/templates/mail/m_registration.html @@ -24,7 +24,7 @@

{% translate "Ваш аккаунт успешно создан." %}
{% translate "Ваш логин" %}: {{ user.email }}
- {% translate "Ваш пароль" %}: {{ pass }}
+ {% translate "Ваш пароль" %}: Пароль, который Вы вводили при регистрации

From d419131eab398aae81a0fb15053dd5bd97400e24 Mon Sep 17 00:00:00 2001 From: ArtemB Date: Tue, 16 Jul 2024 15:10:43 +0300 Subject: [PATCH 07/36] 1.1.34 upd chat_counter --- static/js/user_profile_2.js | 2 +- templates/widgets/w_carrier_card.html | 2 ++ templates/widgets/w_chat_right_panel_user.html | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/static/js/user_profile_2.js b/static/js/user_profile_2.js index b340bda..784dc48 100644 --- a/static/js/user_profile_2.js +++ b/static/js/user_profile_2.js @@ -581,7 +581,7 @@ function selectedUserMessenger (ticket_id=null,user_id=null,el){ if (loader){ loader.classList.toggle("show") } - update_count_unread_messages() + // let left_curtain = document.querySelector('.curtain.left') document.querySelector(".info_profile").innerHTML = data.html; document.querySelector(".enter-message-inp").focus() diff --git a/templates/widgets/w_carrier_card.html b/templates/widgets/w_carrier_card.html index f76d575..ee93093 100644 --- a/templates/widgets/w_carrier_card.html +++ b/templates/widgets/w_carrier_card.html @@ -2,7 +2,9 @@ {% load i18n %} {% load subscribes_tags_extra %} + {% if route.departure_DT %} +{# {% now 'Y-m-d H:i:s' as current_date %}#} {% now 'Y-m-d H:i:s' as current_date %} {% with departure_date_string=route.departure_DT|date:"Y-m-d H:i:s" %} {% if departure_date_string < current_date %} diff --git a/templates/widgets/w_chat_right_panel_user.html b/templates/widgets/w_chat_right_panel_user.html index f2de44c..6fd3fca 100644 --- a/templates/widgets/w_chat_right_panel_user.html +++ b/templates/widgets/w_chat_right_panel_user.html @@ -12,7 +12,7 @@ {% if item.unread_msgs_count %}
-{# {{ item.unread_msgs_count }}#} + {{ unanswered_msgs_count }}
{% endif %} From 6e5e82401b7ffa7880ed8a955d21ba057c4864b0 Mon Sep 17 00:00:00 2001 From: SDE Date: Tue, 16 Jul 2024 15:19:40 +0300 Subject: [PATCH 08/36] 1.6.4 parsing timezones --- ...timezone_city_timezone_country_timezone.py | 28 +++++++++++++++++++ templates/widgets/w_carrier_card.html | 2 +- 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 ReferenceDataApp/migrations/0006_airport_timezone_city_timezone_country_timezone.py diff --git a/ReferenceDataApp/migrations/0006_airport_timezone_city_timezone_country_timezone.py b/ReferenceDataApp/migrations/0006_airport_timezone_city_timezone_country_timezone.py new file mode 100644 index 0000000..7d95c25 --- /dev/null +++ b/ReferenceDataApp/migrations/0006_airport_timezone_city_timezone_country_timezone.py @@ -0,0 +1,28 @@ +# Generated by Django 4.2.2 on 2024-07-12 17:23 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('ReferenceDataApp', '0005_remove_airport_parsing_finished_and_more'), + ] + + operations = [ + migrations.AddField( + model_name='airport', + name='timezone', + field=models.CharField(blank=True, max_length=250, null=True, verbose_name='Часовая зона'), + ), + migrations.AddField( + model_name='city', + name='timezone', + field=models.CharField(blank=True, max_length=250, null=True, verbose_name='Часовая зона'), + ), + migrations.AddField( + model_name='country', + name='timezone', + field=models.CharField(blank=True, max_length=250, null=True, verbose_name='Часовая зона'), + ), + ] diff --git a/templates/widgets/w_carrier_card.html b/templates/widgets/w_carrier_card.html index ee93093..51d024c 100644 --- a/templates/widgets/w_carrier_card.html +++ b/templates/widgets/w_carrier_card.html @@ -2,7 +2,7 @@ {% load i18n %} {% load subscribes_tags_extra %} - +{{ route.from_city.get_current_datetime }} {% if route.departure_DT %} {# {% now 'Y-m-d H:i:s' as current_date %}#} {% now 'Y-m-d H:i:s' as current_date %} From 0b5e37281b3e741928b6d87b812c171726011e16 Mon Sep 17 00:00:00 2001 From: SDE Date: Tue, 16 Jul 2024 15:34:35 +0300 Subject: [PATCH 09/36] 1.6.5 parsing timezones --- ReferenceDataApp/models.py | 2 +- RoutesApp/views.py | 72 ++++++++++++++++++++------------------ 2 files changed, 38 insertions(+), 36 deletions(-) diff --git a/ReferenceDataApp/models.py b/ReferenceDataApp/models.py index b8b322a..35d35a9 100644 --- a/ReferenceDataApp/models.py +++ b/ReferenceDataApp/models.py @@ -62,7 +62,7 @@ class City(BaseModel): def get_n_save_timezone(self): from ReferenceDataApp.funcs import tzf - self.timezone = tzf.timezone_at(lng=self.geo_lon, lat=self.geo_lat) + self.timezone = tzf.timezone_at(lng=float(self.geo_lon), lat=float(self.geo_lat)) self.save(update_fields=['timezone']) return self.timezone diff --git a/RoutesApp/views.py b/RoutesApp/views.py index 141cbeb..9ff36aa 100644 --- a/RoutesApp/views.py +++ b/RoutesApp/views.py @@ -21,44 +21,46 @@ def route_search_results_View(request): Dict = {} data = {} - try: + # try: - if request.GET: - data = request.GET.dict() + if request.GET: + data = request.GET.dict() - routes_Dict = get_routes_Dict(data=data) - if routes_Dict: - Dict = { - 'routes': routes_Dict['routes'], - 'last_block': routes_Dict['last_block'], - 'show_filter_and_results': True, - 'owner_type': data['owner_type'], - 'last_el': routes_Dict['last_el'], - 'page_type': 'routes', - 'next_page_els_count': routes_Dict['next_page_els_count'], - } - if 'from_address_point_txt' in routes_Dict: - data.update({'from_address_point_txt': routes_Dict['from_address_point_txt']}) - if 'to_address_point_txt' in routes_Dict: - data.update({'to_address_point_txt': routes_Dict['to_address_point_txt']}) - Dict.update({'route_form': RouteForm(initial=data)}) + routes_Dict = get_routes_Dict(data=data) + if routes_Dict: + Dict = { + 'routes': routes_Dict['routes'], + 'last_block': routes_Dict['last_block'], + 'show_filter_and_results': True, + 'owner_type': data['owner_type'], + 'last_el': routes_Dict['last_el'], + 'page_type': 'routes', + 'next_page_els_count': routes_Dict['next_page_els_count'], + } + if 'from_address_point_txt' in routes_Dict: + data.update({'from_address_point_txt': routes_Dict['from_address_point_txt']}) + if 'to_address_point_txt' in routes_Dict: + data.update({'to_address_point_txt': routes_Dict['to_address_point_txt']}) + Dict.update({'route_form': RouteForm(initial=data)}) - title = _('Результат поиска маршрутов') - if 'from_address_point_txt' in data: - title = f'{title} из {data["from_address_point_txt"]}' - if 'to_address_point_txt' in data: - title = f'{title} в {data["to_address_point_txt"]}' + title = _('Результат поиска маршрутов') + if 'from_address_point_txt' in data: + title = f'{title} из {data["from_address_point_txt"]}' + if 'to_address_point_txt' in data: + title = f'{title} в {data["to_address_point_txt"]}' - Dict.update({ - 'page': { - 'title': title, - 'description': title, - 'keywords': title, - } - }) + Dict.update({ + 'page': { + 'title': title, + 'description': title, + 'keywords': title, + } + }) - t = loader.get_template('pages/p_results_find_route.html') - return get_inter_http_response(t, Dict, request) + t = loader.get_template('pages/p_results_find_route.html') + return get_inter_http_response(t, Dict, request) # return HttpResponse(t.render(Dict, request)) - except Exception as e: - raise Http404 + # except Exception as e: + # msg = f'!!! --- route_search_results_View Exception {str(e)}' + # print(msg) + # raise Http404 From b007c3ad232288f1b5350cc63ecbd48453c62994 Mon Sep 17 00:00:00 2001 From: SDE Date: Tue, 16 Jul 2024 15:53:12 +0300 Subject: [PATCH 10/36] 1.6.6 parsing timezones --- RoutesApp/views.py | 76 +++++++++++++++++++++++----------------------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/RoutesApp/views.py b/RoutesApp/views.py index 9ff36aa..d35ba0e 100644 --- a/RoutesApp/views.py +++ b/RoutesApp/views.py @@ -21,46 +21,46 @@ def route_search_results_View(request): Dict = {} data = {} - # try: + try: - if request.GET: - data = request.GET.dict() + if request.GET: + data = request.GET.dict() - routes_Dict = get_routes_Dict(data=data) - if routes_Dict: - Dict = { - 'routes': routes_Dict['routes'], - 'last_block': routes_Dict['last_block'], - 'show_filter_and_results': True, - 'owner_type': data['owner_type'], - 'last_el': routes_Dict['last_el'], - 'page_type': 'routes', - 'next_page_els_count': routes_Dict['next_page_els_count'], - } - if 'from_address_point_txt' in routes_Dict: - data.update({'from_address_point_txt': routes_Dict['from_address_point_txt']}) - if 'to_address_point_txt' in routes_Dict: - data.update({'to_address_point_txt': routes_Dict['to_address_point_txt']}) - Dict.update({'route_form': RouteForm(initial=data)}) + routes_Dict = get_routes_Dict(data=data) + if routes_Dict: + Dict = { + 'routes': routes_Dict['routes'], + 'last_block': routes_Dict['last_block'], + 'show_filter_and_results': True, + 'owner_type': data['owner_type'], + 'last_el': routes_Dict['last_el'], + 'page_type': 'routes', + 'next_page_els_count': routes_Dict['next_page_els_count'], + } + if 'from_address_point_txt' in routes_Dict: + data.update({'from_address_point_txt': routes_Dict['from_address_point_txt']}) + if 'to_address_point_txt' in routes_Dict: + data.update({'to_address_point_txt': routes_Dict['to_address_point_txt']}) + Dict.update({'route_form': RouteForm(initial=data)}) - title = _('Результат поиска маршрутов') - if 'from_address_point_txt' in data: - title = f'{title} из {data["from_address_point_txt"]}' - if 'to_address_point_txt' in data: - title = f'{title} в {data["to_address_point_txt"]}' + title = _('Результат поиска маршрутов') + if 'from_address_point_txt' in data: + title = f'{title} из {data["from_address_point_txt"]}' + if 'to_address_point_txt' in data: + title = f'{title} в {data["to_address_point_txt"]}' - Dict.update({ - 'page': { - 'title': title, - 'description': title, - 'keywords': title, - } - }) + Dict.update({ + 'page': { + 'title': title, + 'description': title, + 'keywords': title, + } + }) - t = loader.get_template('pages/p_results_find_route.html') - return get_inter_http_response(t, Dict, request) - # return HttpResponse(t.render(Dict, request)) - # except Exception as e: - # msg = f'!!! --- route_search_results_View Exception {str(e)}' - # print(msg) - # raise Http404 + t = loader.get_template('pages/p_results_find_route.html') + return get_inter_http_response(t, Dict, request) + + except Exception as e: + msg = f'!!! --- route_search_results_View Exception {str(e)}' + print(msg) + raise Http404 From 61facdb5fb3e1f5ad78dae4e2d4d5c13edb8385d Mon Sep 17 00:00:00 2001 From: ArtemB Date: Wed, 17 Jul 2024 13:10:15 +0300 Subject: [PATCH 11/36] 1.1.35 refactor date comparison logic in Django template --- templates/widgets/w_carrier_card.html | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/templates/widgets/w_carrier_card.html b/templates/widgets/w_carrier_card.html index 51d024c..3b38553 100644 --- a/templates/widgets/w_carrier_card.html +++ b/templates/widgets/w_carrier_card.html @@ -2,19 +2,21 @@ {% load i18n %} {% load subscribes_tags_extra %} -{{ route.from_city.get_current_datetime }} -{% if route.departure_DT %} -{# {% now 'Y-m-d H:i:s' as current_date %}#} - {% now 'Y-m-d H:i:s' as current_date %} - {% with departure_date_string=route.departure_DT|date:"Y-m-d H:i:s" %} - {% if departure_date_string < current_date %} -
- {% else %} -
- {% endif %} - {% endwith %} +{#Current Datetime: {{ route.from_city.get_current_datetime }}
#} +{#Departure DT:{{ route.departure_DT }}
#} +{% if route.departure_DT %} + {% with current_datetime=route.from_city.get_current_datetime %} + {% with departure_datetime=route.departure_DT %} + {% if current_datetime|date:"Y-m-d H:i:s" > departure_datetime|date:"Y-m-d H:i:s" %} +
+ {% else %} +
+ {% endif %} + {% endwith %} + {% endwith %} {% endif %} +
{% if route.owner_type == 'mover' %}
From f609361ee927f054c479a2a234966d40ed942aff Mon Sep 17 00:00:00 2001 From: ArtemB Date: Wed, 17 Jul 2024 15:24:42 +0300 Subject: [PATCH 12/36] 1.1.37 show/hide unanswered_msgs_count --- .../etc_operations_for_chat_socket.js | 42 +++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/static/js/chat_socket_functions/etc_operations_for_chat_socket.js b/static/js/chat_socket_functions/etc_operations_for_chat_socket.js index c45dd9e..33e043b 100644 --- a/static/js/chat_socket_functions/etc_operations_for_chat_socket.js +++ b/static/js/chat_socket_functions/etc_operations_for_chat_socket.js @@ -1,28 +1,28 @@ -function update_count_unread_messages (data) { - let selected_btn = document.querySelector(".selected") - let list_unrd = document.querySelectorAll(".unredmessages_value_text") - let current_count = parseInt(list_unrd[i].innerHTML); - if (selected_btn.dataset['ajaxUrl'] !== 'chats'){ - let list_unrd_parent = document.querySelectorAll(".icon_unread_messages") - let i = 0 +function update_count_unread_messages(data) { + let selected_btn = document.querySelector(".selected"); + let list_unrd = document.querySelectorAll(".unredmessages_value_text"); + let list_unrd_parent = document.querySelectorAll(".icon_unread_messages"); - for (i;i < list_unrd.length;i++){ - - - - if(data.unread_msgs_count){ - list_unrd[i].innerHTML = (current_count + 1).toString(); - } - - if(current_count === 0){ - list_unrd_parent[i].classList.toggle("showed") - } + if (selected_btn.dataset['ajaxUrl'] !== 'chats') { + for (let i = 0; i < list_unrd.length; i++) { + let current_count = parseInt(list_unrd[i].innerHTML); + if (data.unread_msgs_count) { + list_unrd[i].innerHTML = (current_count + 1).toString(); + } + if (current_count === 0) { + list_unrd_parent[i].classList.toggle("showed"); + } } - } else if (current_count === 0){ - list_unrd_parent[i].classList.toggle("showed") - } + } else { + for (let i = 0; i < list_unrd.length; i++) { + let current_count = parseInt(list_unrd[i].innerHTML); + if (current_count === 0) { + list_unrd_parent[i].classList.toggle("showed"); + } + } + } } function play_required_beep (data,beep) { From c999d994d6dc5e90deed27d634dc1a581b6e8831 Mon Sep 17 00:00:00 2001 From: ArtemB Date: Thu, 18 Jul 2024 11:42:29 +0300 Subject: [PATCH 13/36] 1.1.38 show/hide unanswered_msgs_count --- templates/widgets/w_chat_right_panel_user.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/templates/widgets/w_chat_right_panel_user.html b/templates/widgets/w_chat_right_panel_user.html index 6fd3fca..43a231d 100644 --- a/templates/widgets/w_chat_right_panel_user.html +++ b/templates/widgets/w_chat_right_panel_user.html @@ -9,7 +9,8 @@ {{ item.last_name }} {{ item.first_name }} {{ item.last_msg }}
- {% if item.unread_msgs_count %} +{# {% if item.unread_msgs_count %}#} + {% if unanswered_msgs_count > 0 %}
{{ unanswered_msgs_count }} From f61482ded60c7c65975302f1aa1d6a12d1f288d2 Mon Sep 17 00:00:00 2001 From: ArtemB Date: Thu, 18 Jul 2024 12:05:54 +0300 Subject: [PATCH 14/36] 1.1.39 show/hide unanswered_msgs_count --- templates/widgets/w_chat_right_panel_user.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/widgets/w_chat_right_panel_user.html b/templates/widgets/w_chat_right_panel_user.html index 43a231d..8acf4c5 100644 --- a/templates/widgets/w_chat_right_panel_user.html +++ b/templates/widgets/w_chat_right_panel_user.html @@ -9,8 +9,8 @@ {{ item.last_name }} {{ item.first_name }} {{ item.last_msg }}
-{# {% if item.unread_msgs_count %}#} - {% if unanswered_msgs_count > 0 %} + {% if item.unread_msgs_count %} +{# {% if unanswered_msgs_count > 0 %}#}
{{ unanswered_msgs_count }} From 87b21c5f55ab88a762454a6a9503f63cebfb93f1 Mon Sep 17 00:00:00 2001 From: ArtemB Date: Thu, 18 Jul 2024 12:53:04 +0300 Subject: [PATCH 15/36] 1.1.40 show/hide unanswered_msgs_count --- .../chat_socket_functions/etc_operations_for_chat_socket.js | 4 ++++ static/js/user_profile_2.js | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/static/js/chat_socket_functions/etc_operations_for_chat_socket.js b/static/js/chat_socket_functions/etc_operations_for_chat_socket.js index 33e043b..06e7501 100644 --- a/static/js/chat_socket_functions/etc_operations_for_chat_socket.js +++ b/static/js/chat_socket_functions/etc_operations_for_chat_socket.js @@ -15,6 +15,10 @@ function update_count_unread_messages(data) { list_unrd_parent[i].classList.toggle("showed"); } } + } else if(data.unanswered_msgs_count){ + for (let i = 0; i < list_unrd.length; i++){ + list_unrd[i].innerHTML = data.unanswered_msgs_count.toString() + } } else { for (let i = 0; i < list_unrd.length; i++) { let current_count = parseInt(list_unrd[i].innerHTML); diff --git a/static/js/user_profile_2.js b/static/js/user_profile_2.js index 784dc48..848c474 100644 --- a/static/js/user_profile_2.js +++ b/static/js/user_profile_2.js @@ -561,7 +561,7 @@ function selectedUserMessenger (ticket_id=null,user_id=null,el){ } let user_type = getInfoAboutUser() - update_count_unread_messages() + // if (user_type === 'mobile' || user_type === 'laptop') { // open_curtain_w_contacts() // } @@ -592,6 +592,9 @@ function selectedUserMessenger (ticket_id=null,user_id=null,el){ let top = document.querySelector(".tab_user_messanger.select").offsetTop document.querySelector(".menu_buttons.curtain.left.open").scrollTo({top:top}) } + + update_count_unread_messages(data); + // second time beacause we need to close curtain // if (user_type === 'mobile' || user_type === 'laptop') { // open_curtain_w_contacts() From 92e9b1ce63ebce68dd34dd4d5a41071197a2bca1 Mon Sep 17 00:00:00 2001 From: ArtemB Date: Tue, 23 Jul 2024 13:41:41 +0300 Subject: [PATCH 16/36] 1.1.41 show/hide unanswered_msgs_count --- .../etc_operations_for_chat_socket.js | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/static/js/chat_socket_functions/etc_operations_for_chat_socket.js b/static/js/chat_socket_functions/etc_operations_for_chat_socket.js index 06e7501..68ae342 100644 --- a/static/js/chat_socket_functions/etc_operations_for_chat_socket.js +++ b/static/js/chat_socket_functions/etc_operations_for_chat_socket.js @@ -15,18 +15,23 @@ function update_count_unread_messages(data) { list_unrd_parent[i].classList.toggle("showed"); } } - } else if(data.unanswered_msgs_count){ + } else if(data.unanswered_msgs_count || data.unanswered_msgs_count === 0){ for (let i = 0; i < list_unrd.length; i++){ list_unrd[i].innerHTML = data.unanswered_msgs_count.toString() - } - } else { - for (let i = 0; i < list_unrd.length; i++) { - let current_count = parseInt(list_unrd[i].innerHTML); - if (current_count === 0) { - list_unrd_parent[i].classList.toggle("showed"); + if(data.unanswered_msgs_count === 0){ + list_unrd_parent[i].classList.remove("showed"); } } } + + // else { + // for (let i = 0; i < list_unrd.length; i++) { + // let current_count = parseInt(list_unrd[i].innerHTML); + // if (current_count === 0 || selected_btn.dataset['ajaxUrl'] !== 'chats') { + // list_unrd_parent[i].classList.toggle("showed"); + // } + // } + // } } function play_required_beep (data,beep) { From 81af5990ae0abd293296c2bfc690cc9ade7cbd6a Mon Sep 17 00:00:00 2001 From: ArtemB Date: Tue, 23 Jul 2024 14:28:41 +0300 Subject: [PATCH 17/36] 1.1.42 Fix date formatting issue in template --- templates/blocks/profile/b_new_route.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/blocks/profile/b_new_route.html b/templates/blocks/profile/b_new_route.html index b634a1e..c59fd3e 100644 --- a/templates/blocks/profile/b_new_route.html +++ b/templates/blocks/profile/b_new_route.html @@ -110,7 +110,7 @@ id="id_departure_DT" name="departure_DT" placeholder="{% translate "Выберите дату и время" %}" {% if form.initial.departure_DT %} - value="{{ form.initial.departure_DT|date:"d.m.Y H:m" }}"{% endif %}/> + value="{{ form.initial.departure_DT|date:"d.m.Y H:i" }}"{% endif %}/>
{% if not errors_off and form.errors and form.errors.departure_DT %} @@ -147,7 +147,7 @@ id="id_arrival_DT" name="arrival_DT" placeholder="{% translate "Выберите дату и время" %}" {% if form.initial.arrival_DT %} - value="{{ form.initial.arrival_DT|date:"d.m.Y H:m" }}"{% endif %}/> + value="{{ form.initial.arrival_DT|date:"d.m.Y H:i" }}"{% endif %}/>
{# end #} From 617f90e1ac076d588a4b254df435907bb5163a65 Mon Sep 17 00:00:00 2001 From: sysadminix Date: Thu, 25 Jul 2024 01:03:05 +0300 Subject: [PATCH 18/36] 1.0.26 translate --- locale/en/LC_MESSAGES/django.po | 121 +++++++++++++++----------------- 1 file changed, 55 insertions(+), 66 deletions(-) diff --git a/locale/en/LC_MESSAGES/django.po b/locale/en/LC_MESSAGES/django.po index c4c6b51..daa1e05 100644 --- a/locale/en/LC_MESSAGES/django.po +++ b/locale/en/LC_MESSAGES/django.po @@ -9,14 +9,15 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-07-09 12:00+0300\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" +"PO-Revision-Date: 2024-07-25 00:59+0300\n" +"Last-Translator: Саня Шумский \n" "Language-Team: LANGUAGE \n" "Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" +"X-Translated-Using: django-rosetta 0.10.0\n" #: ArticlesApp/admin.py:71 ArticlesApp/admin.py:117 ArticlesApp/models.py:37 msgid "Статья" @@ -334,11 +335,11 @@ msgstr "FAQ Title" #: BaseModels/validators/form_field_validators.py:6 msgid "" -"Некорректные символы в номере, введите номер в международном формате с кодом " -"страны" +"Некорректные символы в номере, введите номер в международном формате с кодом" +" страны" msgstr "" -"Incorrect characters in the number, enter the number in international format " -"with the country code" +"Incorrect characters in the number, enter the number in international format" +" with the country code" #: BillingApp/models.py:10 SubscribesApp/models.py:51 #: SubscribesApp/models.py:61 @@ -882,17 +883,13 @@ msgstr "Show more" #: templates/blocks/b_finded_routes.html:12 msgid "" "\n" -" Упс... Ничего не " -"найдено, попробуйте\n" -" изменить параметры поиска или создайте своё собственное объявление \n" +" Упс... Ничего не найдено, попробуйте\n" +" изменить параметры поиска или создайте своё собственное объявление \n" " " msgstr "" "\n" -" Oops... Nothing was " -"found, try\n" -" to change the search parameters or create your own ad \n" +" Oops... Nothing was found, try\n" +" to change the search parameters or create your own ad \n" " " #: templates/blocks/b_finded_routes.html:29 @@ -1317,8 +1314,7 @@ msgid "Мои обращения:" msgstr "My appeals:" #: templates/blocks/static_pages_blocks/b_about_service.html:4 -msgid "" -"Отправляй посылку в любую точку мира!" +msgid "Отправляй посылку в любую точку мира!" msgstr "" "Send your parcel anywhere in the world!" @@ -1359,10 +1355,10 @@ msgid "" "найти перевозчика, который будет готов взять Вашу посылку и доставить в " "указанное место наземным или авиатранспортом." msgstr "" -"You can place an ad for the transportation of a parcel and carriers from all " -"over the world will respond to your ad or using the search on the website to " -"find a carrier who will be ready to take your parcel and deliver it to the " -"specified place by land or air transport." +"You can place an ad for the transportation of a parcel and carriers from all" +" over the world will respond to your ad or using the search on the website " +"to find a carrier who will be ready to take your parcel and deliver it to " +"the specified place by land or air transport." #: templates/blocks/static_pages_blocks/b_about_service.html:27 #: templates/blocks/static_pages_blocks/b_mover_search.html:56 @@ -1409,8 +1405,8 @@ msgstr "Do you have a question? Send us a message" #: templates/blocks/static_pages_blocks/b_contacts.html:12 #: templates/blocks/static_pages_blocks/b_customer_service.html:11 msgid "" -"Пожалуйста опишите Ваш вопрос максимально подробно, а также укажите Ваш e-" -"mail для обратной связи." +"Пожалуйста опишите Ваш вопрос максимально подробно, а также укажите Ваш " +"e-mail для обратной связи." msgstr "" "Please describe your question in details and specify your e-mail for " "feedback." @@ -1425,8 +1421,8 @@ msgstr "Name" #: templates/blocks/static_pages_blocks/b_advertisement.html:9 msgid "" -"Услуги по рекламе и сотрудничеству с TripWB" +"Услуги по рекламе и сотрудничеству с TripWB" msgstr "" #: templates/blocks/static_pages_blocks/b_advertisement.html:13 @@ -1506,14 +1502,14 @@ msgstr "We are always on site!" #, fuzzy #| msgid "" #| "Отправляй посылку в любую точку мира!" -msgid "" -"Отправить посылку TripWB по всему миру" +msgid "Отправить посылку TripWB по всему миру" msgstr "" "Send your parcel anywhere in the world!" #: templates/blocks/static_pages_blocks/b_mover_search.html:14 #, fuzzy -#| msgid "Станьте партнером Trip With Bonus" +#| msgid "" +#| "Станьте партнером Trip With Bonus" msgid "Перевезти посылку TripWB" msgstr "Become a partner Trip With Bonus" @@ -1666,8 +1662,8 @@ msgstr "" #: templates/blocks/static_pages_blocks/b_send_parcel.html:27 msgid "" -"В отобразившемся списке выберите подходящего отправителя и посылку, откройте " -"контакты и свяжитесь удобным способом. Если не нашли подходящего " +"В отобразившемся списке выберите подходящего отправителя и посылку, откройте" +" контакты и свяжитесь удобным способом. Если не нашли подходящего " "отправителя с посылкой, разместите объявление о возможности перевезти " "посылку и отправители Вас сами найдут" msgstr "" @@ -1679,7 +1675,8 @@ msgstr "" #: templates/blocks/static_pages_blocks/b_send_parcel.html:33 msgid "" "Обсудите с отправителем все условия: время, место и прочие детали. Готово! " -"Доставьте посылку из пункта А в пункт Б и получите благодарность отправителя!" +"Доставьте посылку из пункта А в пункт Б и получите благодарность " +"отправителя!" msgstr "" "Discuss all the conditions with the sender: time, place and other details. " "Ready! Deliver the parcel from point A to point B and receive the sender's " @@ -1821,14 +1818,16 @@ msgstr "" #: templates/mail/m_confirm_email.html:24 msgid "" -"Если это сделали Вы, нажмите на ссылку ниже и пройдите процедуру верификации." +"Если это сделали Вы, нажмите на ссылку ниже и пройдите процедуру " +"верификации." msgstr "" #: templates/mail/m_confirm_email.html:26 msgid "Если это письмо ошибочно попало к Вам, просто проигнорируйте его." msgstr "" -#: templates/mail/m_confirm_email.html:29 templates/mail/m_registration.html:55 +#: templates/mail/m_confirm_email.html:29 +#: templates/mail/m_registration.html:55 msgid "" "\n" " С уважением,
\n" @@ -1881,18 +1880,14 @@ msgstr "to this link and use your login credentials" #: templates/mail/m_found_matched_routes.html:21 #| msgid "" #| "\n" -#| " Если у вас возникнут вопросы или вам потребуется " -#| "помощь, наша служба поддержки всегда готова помочь. Свяжитесь с нами по " -#| "адресу support@tripwb.com\n" +#| " Если у вас возникнут вопросы или вам потребуется помощь, наша служба поддержки всегда готова помочь. Свяжитесь с нами по адресу support@tripwb.com\n" #| " " msgid "" "Если у вас возникнут вопросы или вам потребуется помощь, наша служба " "поддержки всегда готова помочь. Свяжитесь с нами по адресу" msgstr "" "\n" -" If you have any questions or need help, our support team " -"is always ready to help. Contact us at support@tripwb.com\n" +" If you have any questions or need help, our support team is always ready to help. Contact us at support@tripwb.com\n" " " #: templates/mail/m_found_matched_routes.html:22 @@ -1951,8 +1946,8 @@ msgid "" "На главной странице нашего сайта Вы можете указать критерии поиска " "перевозчика посылки или отправителя и напрямую связаться с исполнителем." msgstr "" -"On the main page of our website, you can specify the search criteria for the " -"parcel carrier or sender and contact the contractor directly." +"On the main page of our website, you can specify the search criteria for the" +" parcel carrier or sender and contact the contractor directly." #: templates/mail/m_registration.html:34 msgid "" @@ -1967,27 +1962,21 @@ msgstr "" #: templates/mail/m_registration.html:40 msgid "" "\n" -" Чтобы начать, просто перейдите на сайт и используйте свои учетные данные для входа.\n" +" Чтобы начать, просто перейдите на сайт и используйте свои учетные данные для входа.\n" " " msgstr "" "\n" -" To get started, just go to website and use your login credentials.\n" +" To get started, just go to website and use your login credentials.\n" " " #: templates/mail/m_registration.html:46 msgid "" "\n" -" Если у вас возникнут вопросы или вам потребуется помощь, " -"наша служба поддержки всегда готова помочь. Свяжитесь с нами по адресу support@tripwb.com\n" +" Если у вас возникнут вопросы или вам потребуется помощь, наша служба поддержки всегда готова помочь. Свяжитесь с нами по адресу support@tripwb.com\n" " " msgstr "" "\n" -" If you have any questions or need help, our support team " -"is always ready to help. Contact us at support@tripwb.com\n" +" If you have any questions or need help, our support team is always ready to help. Contact us at support@tripwb.com\n" " " #: templates/mail/m_user_subscribes_that_is_going_to_finish.html:14 @@ -2007,8 +1996,9 @@ msgstr "expires" msgid "" "Вы можете продлить подписку через свой личный кабинет. Пройдите по ссылке " "ниже для входа на сайт." -msgstr "You can renew your subscription through your personal cabinet. Follow the link " -" link below to access the site." +msgstr "" +"You can renew your subscription through your personal cabinet. Follow the " +"link link below to access the site." #: templates/mail/m_user_subscribes_that_is_going_to_finish.html:21 #| msgid "Моя подписка" @@ -2026,9 +2016,11 @@ msgstr "TripWB News" #: templates/pages/p_main.html:18 msgid "" -"Сервис по доставке и перевозке посылок TripWB" -msgstr "Service for delivery and transportation of parcels TripWB." +"Сервис по доставке и перевозке посылок TripWB" +msgstr "" +"Service for delivery and transportation of parcels TripWB." #: templates/pages/p_main.html:23 msgid "Сервис, который позволяет передавать посылки с путешественниками" @@ -2180,8 +2172,8 @@ msgid "" "Работает система оповещения ✓ Большой выбор отправителей посылок ➡️ " "Регистрируйтесь" msgstr "" -"Section for parcel carriers to all countries ✓ Convenient personal account ✓ " -"Notification system in operation ✓ Wide selection of parcel senders ➡️ " +"Section for parcel carriers to all countries ✓ Convenient personal account ✓" +" Notification system in operation ✓ Wide selection of parcel senders ➡️ " "Register now" #: templates/small_INCLUDES/carrier_card/inf_about_moving.html:6 @@ -2279,7 +2271,7 @@ msgstr "sender" #: templates/widgets/routes/w_my_route.html:156 #| msgid "Изменить профиль" msgid "Увеличить просмотры" -msgstr "Change profile" +msgstr "Boost views" #: templates/widgets/routes/w_my_route.html:167 msgid "Редактировать" @@ -2329,21 +2321,18 @@ msgstr "Unassembled tickets" #~ msgid "Автопродление тарифного плана" #~ msgstr "Auto-renewal of the tariff plan" -#~ msgid "" -#~ "Путешествуй по миру и перевози посылки!" -#~ msgstr "" -#~ "Travel the world and deliver parcels!" +#~ msgid "Путешествуй по миру и перевози посылки!" +#~ msgstr "Travel the world and deliver parcels!" #~ msgid "Оформи подписку сейчас и получи" -#~ msgstr "" -#~ "Create a subscription now and get it" +#~ msgstr "Create a subscription now and get it" #~ msgid "" #~ "1 день пользования сервисом в подарок!" #~ msgstr "" -#~ "1 day using the service for free!" +#~ "1 day using the service for free!" #~ msgid "Получить" #~ msgstr "Receive" From 111a7eaff760d3de1b563c786db56fa406215bf1 Mon Sep 17 00:00:00 2001 From: ArtemB Date: Thu, 25 Jul 2024 16:55:13 +0300 Subject: [PATCH 19/36] 1.1.43 add popup display functionality with cookie-based visibility control --- static/css/mobile_styles.css | 13 ++++++++ static/css/styles(boris).css | 61 ++++++++++++++++++++++++++++++++++++ static/js/authorization.js | 3 ++ static/js/global_js.js | 20 ++++++++++-- templates/tb_base.html | 32 +++++++++++++++++++ 5 files changed, 127 insertions(+), 2 deletions(-) diff --git a/static/css/mobile_styles.css b/static/css/mobile_styles.css index 1dde9e8..4b4b6f8 100644 --- a/static/css/mobile_styles.css +++ b/static/css/mobile_styles.css @@ -1510,6 +1510,10 @@ width: 153px; } + .popup_content{ + width: 41%; + } + } @media (max-width: 950px){ @@ -1554,6 +1558,9 @@ .pag_news_item_text{ width: unset; } + .popup_content{ + width: 52%; + } } @media (max-width: 850px){ @@ -1687,6 +1694,9 @@ .marker_messages_mobile.show{ display: block; } + .popup_content>.confirm_profile_btn{ + width: 90%; + } } @media (max-width: 828px){ @@ -1844,6 +1854,9 @@ .inf_carrier_icon{ /*width: 3%;*/ } + .popup_content{ + width: 70%; + } } @media (max-width: 687px){ /*.to_address_point_txt.find_route {*/ diff --git a/static/css/styles(boris).css b/static/css/styles(boris).css index ee1ba62..4385f25 100644 --- a/static/css/styles(boris).css +++ b/static/css/styles(boris).css @@ -3008,6 +3008,8 @@ a.open_inf_carrier{ display: none; } + + .cookie_block.show{ display: block; } @@ -3034,4 +3036,63 @@ a.open_inf_carrier{ height: 25px; width: 95px; cursor: pointer; +} + +/*popup*/ +.popup_wrapper{ + display: none; + position: fixed; /* Используйте fixed, чтобы попап оставался на месте при прокрутке */ + top: 0; + left: 0; + width: 100%; + height: 100%; + background-color: rgba(0, 0, 0, 0.5); /* Полупрозрачный фон */ + justify-content: center; + align-items: center; + z-index: 9999; +} + +.popup_wrapper.show{ + display: flex; +} +.popup_content{ + position: relative; + width: 38%; + height: fit-content; + background: #FFFFFF; + border-radius: 15px; + text-align: center; + padding: 28px; + font-family: Inter; + +} +.popup_cross{ + position: absolute; + right: 5%; +} +.popup_img>img{ + background: #E1E1E1; + border-radius: 39px; + padding: 5px; +} +.popup_title{ + font-weight: 700; + font-size: 34px; + margin-top: 20px; +} +.popup_text{ + line-height: 30px; + font-size: 20px; + margin-top: 10px; + color: #6F6C90; +} +.popup_content>.confirm_profile_btn{ + width: 62%; +} +#poup_text_bold{ + font-weight: 700; + color: #1d1e20; +} +#authenticated_img{ + display: none; } \ No newline at end of file diff --git a/static/js/authorization.js b/static/js/authorization.js index 723adb1..e6cca7a 100644 --- a/static/js/authorization.js +++ b/static/js/authorization.js @@ -20,6 +20,7 @@ function SendLoginForm(el){ data: formData, success: function(data){ + location.href = data.redirect_url//`/profile/page/dashboard/` window.sessionStorage.removeItem('mailingSubscribeRequired') window.sessionStorage.removeItem('email') @@ -29,6 +30,8 @@ function SendLoginForm(el){ + + }, error: function (data, exception){ document.querySelector(".login").innerHTML = data.responseJSON.html diff --git a/static/js/global_js.js b/static/js/global_js.js index c0f251e..ca6b9c1 100644 --- a/static/js/global_js.js +++ b/static/js/global_js.js @@ -227,6 +227,12 @@ function checkStateCookie () { if (!window.document.cookie.includes("allow_cookie=true")){ document.querySelector(".cookie_block").classList.add("show") } + if (!window.document.cookie.includes("popup_show=false")){ + document.querySelector(".popup_wrapper").classList.add("show") + } + if(!window.document.cookie.includes("first_authorization=true") && window.document.getElementById('authenticated_img')){ + document.querySelector(".popup_wrapper").classList.add("show") + } if (window.document.cookie.includes("twb_new_messages=true")){ if (getInfoAboutUser('screen_width') < 800) { let marker_new_messages = document.querySelector(".marker_messages_mobile"); @@ -258,12 +264,22 @@ function getCsrfCookie () { return csrf } -function setCokie (days,name,val) { +function setCokie (days,name,val, url = null) { let date = new Date(); // let days = 182; date.setTime(+ date + (days * 86400000)); window.document.cookie = `${name}=${val}` + "; expires=" + date.toGMTString() + "; path=/"; - document.querySelector(".cookie_block").classList.remove("show") + + if(name === 'allow_cookie' ){ + document.querySelector(".cookie_block").classList.remove("show") + } else if(name === 'popup_show'){ + document.querySelector(".popup_wrapper").classList.remove("show") + if(url){ + window.location.href = url} + } else if (name === 'first_authorization'){ + document.querySelector(".popup_wrapper").classList.remove("show") + } + // return value; } diff --git a/templates/tb_base.html b/templates/tb_base.html index 92a56bd..e7916ad 100644 --- a/templates/tb_base.html +++ b/templates/tb_base.html @@ -119,6 +119,38 @@ + + +