From ec8fded13645da4cb1a4b04497b2c1c090d9a39e Mon Sep 17 00:00:00 2001 From: borissedw Date: Mon, 28 Aug 2023 18:05:53 +0300 Subject: [PATCH] 0.0.180 --- static/js/filters_functions_find_route.js | 5 ++++ static/js/global_js.js | 1 + static/js/user_profile.js | 35 ++++++++++++----------- templates/blocks/profile/b_new_route.html | 22 ++++++++++---- templates/blocks/profile/b_subscribe.html | 3 +- templates/pages/p_results_find_route.html | 1 + 6 files changed, 45 insertions(+), 22 deletions(-) diff --git a/static/js/filters_functions_find_route.js b/static/js/filters_functions_find_route.js index 517e589..5a532d2 100644 --- a/static/js/filters_functions_find_route.js +++ b/static/js/filters_functions_find_route.js @@ -14,6 +14,11 @@ function filters_func_find_route_main (el){ data: formData, success: function(data){ document.querySelector(".block-finded-routes").innerHTML = data.html + if (data.html === "\n\n\n\n\n"){ + document.querySelector(".block-finded-routes").innerHTML = "Нечего не найдено!" + } else { + document.querySelector(".block-finded-routes").innerHTML = data.html + } }, errors: function (data){ diff --git a/static/js/global_js.js b/static/js/global_js.js index bef7c71..372b5a6 100644 --- a/static/js/global_js.js +++ b/static/js/global_js.js @@ -56,6 +56,7 @@ function restart_ws (){ console.log("open") } else { + console.log("connecting...") } diff --git a/static/js/user_profile.js b/static/js/user_profile.js index 8c50b12..0b8453a 100644 --- a/static/js/user_profile.js +++ b/static/js/user_profile.js @@ -345,28 +345,31 @@ function sliderInit() { } function sendRoute(el, routeID = null){ - let obj ={} + event.preventDefault() + + let list_of_elements_form = document.querySelectorAll(".el_form_b_new_route"); + let obj_w_el_form = {} + for (let i = 0;i < list_of_elements_form.length;i++) { + let name_attr = list_of_elements_form[i].attributes["name"] + if (name_attr) { + let name_el = name_attr.value + let value_el = list_of_elements_form[i].value + obj_w_el_form[name_el] = value_el + } + } let selected_owner_type = document.querySelectorAll("#customer, #mover") selected_owner_type.forEach(function(item) { - if (item.classList.contains('selected')) { - let { id, innerText } = item - obj['owner_type'] = id - } -}); + if (item.classList.contains('selected')) { + let { id, innerText } = item + obj_w_el_form['owner_type'] = id + } + }); if (selected_owner_type[0].classList.contains('selected')){ - }else + }else{} - - event.preventDefault() - let form = el.form; - let formData = new FormData(form); - let data = { - formData, - obj - } let url = '/ru/routes/create_or_change_route/' if (routeID !== null){ url = '/ru/routes/change_route/' + routeID + '/' @@ -381,7 +384,7 @@ function sendRoute(el, routeID = null){ processData: false, contentType: false, // enctype: 'json', - data: JSON.stringify(data), + data: JSON.stringify(obj_w_el_form), success: function(data){ if (data.user_alerts) { getNewMessageSession() diff --git a/templates/blocks/profile/b_new_route.html b/templates/blocks/profile/b_new_route.html index 2e07573..e79eb2b 100644 --- a/templates/blocks/profile/b_new_route.html +++ b/templates/blocks/profile/b_new_route.html @@ -33,7 +33,8 @@ {% for item in form.fields.to_place.choices %}