From 28504cbc45593bc498b3afd2d758c2483ae5ca16 Mon Sep 17 00:00:00 2001 From: ArtemB Date: Mon, 4 Sep 2023 19:09:09 +0300 Subject: [PATCH] 0.0.127 bug fix cargo_type in create_new_route --- static/css/styles.css | 11 +- static/js/user_profile.js | 36 +++- templates/blocks/profile/b_new_route.html | 7 +- templates/widgets/w_route_info.html | 237 ++++++++++++++++------ 4 files changed, 226 insertions(+), 65 deletions(-) diff --git a/static/css/styles.css b/static/css/styles.css index 3fbf68e..b446532 100644 --- a/static/css/styles.css +++ b/static/css/styles.css @@ -1504,6 +1504,9 @@ input#id_extra_phone height: 280px; display: inline-block; } +.route_info_about{ + margin-bottom: 30px; +} .route_info_point { width: 96%; @@ -1578,7 +1581,7 @@ input#id_extra_phone button#edit_route { display: block; height: 44px; - width: 76%; + width: 98%; background: #FF613A; color: #FFF; font-family: Inter; @@ -1602,24 +1605,26 @@ button#remove_route { width: 285px; } button.confirm_remove{ - width: 46% !important; + width: 49% !important; background: #ff0000a8; border-radius: 10px; color: white; font-style: normal; font-weight: 600; margin-right: 3px; + padding: 5px 0px 5px 0px; } button.cancel_remove{ - width: 46%; + width: 48%; background: #808080cc; border-radius: 10px; color: white; font-style: normal; font-weight: 600; + padding: 5px 0px 5px 0px; } diff --git a/static/js/user_profile.js b/static/js/user_profile.js index 3c175ba..7c2872e 100644 --- a/static/js/user_profile.js +++ b/static/js/user_profile.js @@ -364,12 +364,35 @@ function sendRoute(el, routeID = null){ let list_of_elements_form = document.querySelectorAll(".el_form_b_new_route"); + let checked_cargo_type = document.querySelectorAll('.cargo_check'); + + + let obj_w_el_form = {} - for (let i = 0;i < list_of_elements_form.length;i++) { + + + for (let n = 0;n < checked_cargo_type.length; n++){ + let checked_cargo = checked_cargo_type[n] + if(checked_cargo.checked === true){ + let name_cargo = checked_cargo.name + let value_cargo = checked_cargo_type[n].value + obj_w_el_form[name_cargo] = value_cargo + + + } + } + + + + + for (let i = 0; i < list_of_elements_form.length ;i++) { // let id_el = list_of_elements_form[i].id // if (id_el){ // if (id_el === "") // } + + + let name_attr = list_of_elements_form[i].attributes["name"] if (name_attr) { let name_el = name_attr.value @@ -377,6 +400,9 @@ function sendRoute(el, routeID = null){ obj_w_el_form[name_el] = value_el } } + + + let selected_owner_type = document.querySelectorAll("#customer, #mover") selected_owner_type.forEach(function(item) { @@ -434,6 +460,14 @@ function sendRoute(el, routeID = null){ +function validate(el) { + if (el.checked) { + console.log('cheked', el.id); + } else { + console.log("You didn't check it! Let me check it for you.", el.id); + } +} + diff --git a/templates/blocks/profile/b_new_route.html b/templates/blocks/profile/b_new_route.html index 44b0799..e4849d6 100644 --- a/templates/blocks/profile/b_new_route.html +++ b/templates/blocks/profile/b_new_route.html @@ -228,7 +228,8 @@ {% for item in form.fields.cargo_type.choices %}
-
diff --git a/templates/widgets/w_route_info.html b/templates/widgets/w_route_info.html index 01eeb6e..97c8b9b 100644 --- a/templates/widgets/w_route_info.html +++ b/templates/widgets/w_route_info.html @@ -1,7 +1,113 @@ - {% for route in routes %} +{% for route in routes %} -
-
+ {% load static %} + {% load i18n %} + + +
+
+{#
#} +{#
#} +{# Перевозчик:#} +{#
#} +{#
#} +{# {{ route.get_type_transport_display }}#} +{#
#} +{#
#} +{#
#} +
+ + Тип:{{ route.get_cargo_type_display }} + + + + Вес:{{ route.weight }} кг + + + + + {{ route.get_type_transport_display }} + + +
+
+
+ {% if route.from_country %}{{ route.from_country }}{% else %}Неизвестно{% endif %} / {% if route.from_city %}{{ route.from_city }}{% else %}Неизвестно{% endif %} +
+
+
+ {% if route.to_country %}{{ route.to_country }}{% else %}Неизвестно{% endif %} / {% if route.to_city %}{{ route.to_city }}{% else %}Неизвестно{% endif %} +
+
+ {% include "small_INCLUDES/carrier_card/inf_about_moving.html" %} + +
+
+
+
+ {% translate 'Контакты' %} + {% if route.owner_type == 'mover' %} + {% translate "перевозчика" %} + + {% elif route.owner_type == 'customer'%} + {% translate "отправителя" %} + + {% endif %} +
+
+ + {{ route.owner.last_name }} {{ route.owner.first_name }} +
+
+
+ + + {{ route.phone }} + +
+
+ + +
+ +
+
+ +
+
+ {% if route.owner != user %} + + + {% endif %} +
+ + +
+
+ +
+ +{% endfor %} + + +{#
#} +{#
#}
Тип:{{ route.get_cargo_type_display }} @@ -17,68 +123,81 @@
- -
- -
-
- - {{ route.from_country.name }}/{{ route.from_city.name }} - - -
-
+{##} +{#
#} +{##} +{#
#} +{#
#} +{# #} +{# {{ route.from_country.name }}/{{ route.from_city.name }}#} +{# #} +{##} +{#
#} +{#
#} +{##} +{##} +{# #} +{# {{ route.to_country.name }}/{{ route.to_city.name }}#} +{# #} +{#
#} +{#
#} +{##} +{#
#} +{# Отправка: {{route.departure_DT }}#} +{# Прибытие: {{route.arrival_DT }}#} +{#
#} +{##} +{#
#} +{# Откуда заберёт:{{ route.from_place }}#} +{# Куда доставит:{{ route.to_place }}#} +{#
#} +{##} +{#
#} +{##} +{# #} +{#
#} +{##} +{#

Контакты перевозчика:

#} +{##} +{#
#} +{# {{ route.owner.last_name }} {{ route.owner.first_name }}#} +{#
#} +{##} +{#
#} +{# {{ route.phone }}#} +{#
#} +{# {{ route.extra_phone }}#} +{#
#} +{# {{ route.owner.email }}#} +{#
#} +{#
#} +{# #} +{#
#} +{#
#} +{# #} +{# Удалить#} +{# #} +{#
#} +{##} +{#
#} +{#
#} + + + + + + - - {{ route.to_country.name }}/{{ route.to_city.name }} - -
-
- -
- Отправка: {{route.departure_DT }} - Прибытие: {{route.arrival_DT }} -
- -
- Откуда заберёт:{{ route.from_place }} - Куда доставит:{{ route.to_place }} -
- -
-
-

Контакты перевозчика:

-
- {{ route.owner.last_name }} {{ route.owner.first_name }} -
-
- {{ route.phone }} -
- {{ route.extra_phone }} -
- {{ route.owner.email }} -
-
- -
-
- -
-
-
- {% endfor %}