0.0.221
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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 = "<span style='color: #ff0000;font-weight: 800;font-size: 18px;padding: 10px;'>Нечего не найдено!</span>"
|
||||
} 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 = "<span style='color: #ff0000;font-weight: 800;font-size: 18px;padding: 10px;'>Нечего не найдено!</span>"
|
||||
} 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)
|
||||
}
|
||||
}
|
||||
@@ -96,6 +96,10 @@
|
||||
</div>
|
||||
<div class="cont-el-form-search-carrier el_form_find_route">
|
||||
<label style="opacity: 0">test</label>
|
||||
<button onclick="filters_func_find_route_main(this)">Найти</button>
|
||||
{% if show_filter_and_results %}
|
||||
<button onclick="filters_func_find_route_main(this,{{ owner_type }})">Найти</button>
|
||||
{% else %}
|
||||
<button onclick="filters_func_find_route_main(this,'{{ owner_type }}','{% url "route_search_results_View" %}')">Найти</button>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,4 +1,11 @@
|
||||
{% extends 'tb_base.html' %}
|
||||
{% load static %}
|
||||
|
||||
{% block meta %}
|
||||
<script src='{% static "js/find_route.js" %}'></script>
|
||||
<script src="{% static "js/filters_functions_find_route.js" %}"></script>
|
||||
<script src="{% static "js/dynamic_loading_routes.js" %}"></script>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
{% include "blocks/b_find_route_form.html" %}
|
||||
|
||||
Reference in New Issue
Block a user