From 63879809fd0e1def49ba1c40e67542ea0f982430 Mon Sep 17 00:00:00 2001 From: borissedw Date: Sat, 2 Sep 2023 19:18:36 +0300 Subject: [PATCH] 0.0.221 --- static/css/styles(boris).css | 8 ++ static/js/filters_functions_find_route.js | 99 +++++++++++-------- .../f_find_route_form_main_find_routes.html | 6 +- templates/pages/p_main.html | 7 ++ 4 files changed, 80 insertions(+), 40 deletions(-) diff --git a/static/css/styles(boris).css b/static/css/styles(boris).css index 992adb5..ab9e246 100644 --- a/static/css/styles(boris).css +++ b/static/css/styles(boris).css @@ -796,6 +796,14 @@ height: 60px; } +.cont-el-form-search-carrier > a{ + width: 99%; + border-radius: 10px; + color: #FFFFFF; + background: #FF613A; + height: 60px; +} + .cont-el-form-search-carrier > input{ border: 1px solid #E6E6E6; display: block; diff --git a/static/js/filters_functions_find_route.js b/static/js/filters_functions_find_route.js index b8edafa..46925a2 100644 --- a/static/js/filters_functions_find_route.js +++ b/static/js/filters_functions_find_route.js @@ -1,48 +1,69 @@ -function filters_func_find_route_main (el){ - if (el !== document.querySelector(".range_slider_form_filters")){ +function filters_func_find_route_main (el,owner_type=null,win_loc_replace=null){ + console.log("asd") + if (win_loc_replace){ 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 - 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}`); - let element = document.createElement("img") - element.classList.add("loader_filters_routes") - element.src = "/static/img/svg/loader.svg" - let ins_bef_el = document.querySelector(".block-finded-routes").firstChild - $(element).insertBefore(ins_bef_el) - // window.history.pushState({data:get_url - // },{}) - }, - errors: function (data){ + if (owner_type !== null) { + data_d['owner_type'] = owner_type + } + get_url = get_url + `owner_type=${owner_type}` + window.location.href = `${win_loc_replace}?${get_url}` + // history.pushState({'data':data_d,'str_data':get_url}, "state_filters", `?${get_url}`); + + } 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] + if (owner_type !== null) { + data_d['owner_type'] = owner_type } - }); - },1000) + 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 + 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}`); + let element = document.createElement("img") + element.classList.add("loader_filters_routes") + element.src = "/static/img/svg/loader.svg" + let ins_bef_el = document.querySelector(".block-finded-routes").firstChild + $(element).insertBefore(ins_bef_el) + // window.history.pushState({data:get_url + // },{}) + }, + errors: function (data){ + + } + }); + },1000) + } } \ No newline at end of file diff --git a/templates/forms/f_find_route_form_main_find_routes.html b/templates/forms/f_find_route_form_main_find_routes.html index 2384b7f..8eb3cd2 100644 --- a/templates/forms/f_find_route_form_main_find_routes.html +++ b/templates/forms/f_find_route_form_main_find_routes.html @@ -96,6 +96,10 @@
- + {% if show_filter_and_results %} + + {% else %} + + {% endif %}
\ No newline at end of file diff --git a/templates/pages/p_main.html b/templates/pages/p_main.html index 4f7254b..b00aaee 100644 --- a/templates/pages/p_main.html +++ b/templates/pages/p_main.html @@ -1,4 +1,11 @@ {% extends 'tb_base.html' %} +{% load static %} + +{% block meta %} + + + +{% endblock %} {% block content %} {% include "blocks/b_find_route_form.html" %}