From 44b1b8ac56e7dfbdd44b0e73728e7fbc932bbbf9 Mon Sep 17 00:00:00 2001 From: borissedw Date: Wed, 30 Aug 2023 13:04:18 +0300 Subject: [PATCH] 0.0.201 --- static/css/styles(boris).css | 10 ++++ static/js/dynamic_loading_routes.js | 5 +- static/js/filters_functions_find_route.js | 71 +++++++++++++---------- templates/pages/p_results_find_route.html | 10 ++-- 4 files changed, 58 insertions(+), 38 deletions(-) diff --git a/static/css/styles(boris).css b/static/css/styles(boris).css index 6983df4..6c3af5f 100644 --- a/static/css/styles(boris).css +++ b/static/css/styles(boris).css @@ -1477,6 +1477,16 @@ display: block; } +.loader_filters_routes{ + width: 25px; + height: 25px; + display: none; +} + +.loader_filters_routes.show{ + display: block; +} + .line_separator_page_w_el{ width: 100%; border-bottom: 1px solid #919BA5; diff --git a/static/js/dynamic_loading_routes.js b/static/js/dynamic_loading_routes.js index d38e585..354ff79 100644 --- a/static/js/dynamic_loading_routes.js +++ b/static/js/dynamic_loading_routes.js @@ -7,9 +7,10 @@ function load_routes (el) { 'from_el':parseInt(number_last_route) + 1, 'to_el':parseInt(number_last_route) + 11 } - let list = forloop_func_form(data_d,"get") + let get_url = "" + let list = forloop_func_form(data_d,"get",get_url) data_d = list[0] - let get_url = list[1] + get_url = list[1] let loader = document.querySelector(".loader_f_loading_routes") loader.classList.toggle("show") el.classList.toggle("hide") diff --git a/static/js/filters_functions_find_route.js b/static/js/filters_functions_find_route.js index 72e1206..b54e404 100644 --- a/static/js/filters_functions_find_route.js +++ b/static/js/filters_functions_find_route.js @@ -1,36 +1,43 @@ function filters_func_find_route_main (el){ - event.preventDefault() - // let form = el.form - // let formData = new FormDat a(form) - let data_d = {} - let list = forloop_func_form(data_d,"get") - data_d = list[0] - let get_url = list[1] - $.ajax({ - headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() }, - url: '/ru/routes/find_routes/', - type: "POST", - // async: true, - cache: false, - processData: false, - contentType: false, - // enctype: 'json', - data: JSON.stringify(data_d), - 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 { + if (el !== document.querySelector(".range_slider_form_filters")){ + event.preventDefault() + } + // document.querySelector(".loader_filters_routes").classList.toggle("show") + let one_sec = setTimeout(function (){ + // let form = el.form + // let formData = new FormDat a(form) + let data_d = {} + let get_url = "" + let list = forloop_func_form(data_d,"get",get_url) + data_d = list[0] + get_url = list[1] + $.ajax({ + headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() }, + url: '/ru/routes/find_routes/', + type: "POST", + // async: true, + cache: false, + processData: false, + contentType: false, + // enctype: 'json', + data: JSON.stringify(data_d), + success: function(data){ + // document.querySelector(".loader_filters_routes").classList.toggle("show") document.querySelector(".block-finded-routes").innerHTML = data.html - } - // window.location.href = window.location.href + "?" + get_url - // window.location.search = "?" + get_url - history.pushState({'data':data_d,'str_data':get_url}, "state_filters", `?${get_url}`); - // window.history.pushState({data:get_url - // },{}) - }, - errors: function (data){ + if (data.html === "\n\n\n\n\n"){ + document.querySelector(".block-finded-routes").innerHTML = "Нечего не найдено!" + } else { + document.querySelector(".block-finded-routes").innerHTML = data.html + } + // window.location.href = window.location.href + "?" + get_url + // window.location.search = "?" + get_url + history.pushState({'data':data_d,'str_data':get_url}, "state_filters", `?${get_url}`); + // window.history.pushState({data:get_url + // },{}) + }, + errors: function (data){ - } - }); + } + }); + },1000) } \ No newline at end of file diff --git a/templates/pages/p_results_find_route.html b/templates/pages/p_results_find_route.html index c1de435..fb27884 100644 --- a/templates/pages/p_results_find_route.html +++ b/templates/pages/p_results_find_route.html @@ -148,6 +148,7 @@ type="checkbox" name="type_transport" id="id_cargo_type_car_{{ forloop.counter }}" + onchange="filters_func_find_route_main(this)" value="{{ item.0 }}" /> @@ -173,7 +174,7 @@
Откуда забрать посылку
- {% for item in form.fields.from_place.choices %} @@ -185,7 +186,7 @@
Куда доставить посылку
- {% for item in form.fields.to_place.choices %} @@ -195,7 +196,7 @@
- +
@@ -206,13 +207,14 @@
Сортировать по:
-
+
{% include "blocks/b_search_routes.html" %}