Merge remote-tracking branch 'origin/main'
This commit is contained in:
@@ -1450,4 +1450,14 @@
|
|||||||
|
|
||||||
.from_address_point_txt.find_route{
|
.from_address_point_txt.find_route{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.button-find-more-routes{
|
||||||
|
width: 220px;
|
||||||
|
height: 60px;
|
||||||
|
background: #FF613A;
|
||||||
|
color: #FFFFFF;
|
||||||
|
font-size: 18px;
|
||||||
|
font-weight: 600;
|
||||||
|
border-radius: 10px;
|
||||||
}
|
}
|
||||||
47
static/js/dynamic_loading_routes.js
Normal file
47
static/js/dynamic_loading_routes.js
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
let page_iterator = 2
|
||||||
|
|
||||||
|
|
||||||
|
function load_routes (el) {
|
||||||
|
event.preventDefault()
|
||||||
|
// let el_parent = el.parentNode
|
||||||
|
// let new_el = el_parent.previousSibling.previousSibling
|
||||||
|
// let new_el_dataset = new_el.dataset
|
||||||
|
// if (new_el_dataset){
|
||||||
|
// let number_last_route = new_el_dataset['numberOfRoute']
|
||||||
|
let number_last_route = el.dataset['lastRoute']
|
||||||
|
let data = {
|
||||||
|
'from_el':parseInt(number_last_route) + 1,
|
||||||
|
'to_el':parseInt(number_last_route) + 11
|
||||||
|
}
|
||||||
|
$.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),
|
||||||
|
success: function(data){
|
||||||
|
// new_el.parentNode.insertBefore(data.html, new_el.nextSibling);
|
||||||
|
let url_insert = ".page_routes_" + page_iterator
|
||||||
|
document.querySelector(url_insert).innerHTML = data.html
|
||||||
|
let old_page_iterator = page_iterator
|
||||||
|
page_iterator++
|
||||||
|
|
||||||
|
let new_page_routes = document.createElement("div")
|
||||||
|
new_page_routes.classList.add("page_routes_" + page_iterator)
|
||||||
|
$(new_page_routes).insertAfter(".page_routes_" + old_page_iterator);
|
||||||
|
// document.querySelector(".info_profile").innerHTML = data.html;
|
||||||
|
|
||||||
|
},
|
||||||
|
error: function (data){
|
||||||
|
|
||||||
|
document.querySelector(".info_profile").innerHTML = data.responseJSON.html;
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// }
|
||||||
|
|
||||||
|
}
|
||||||
@@ -12,6 +12,7 @@
|
|||||||
<script src='{% static "js/user_profile(boris).js" %}'> </script>
|
<script src='{% static "js/user_profile(boris).js" %}'> </script>
|
||||||
{% include "connect_ws_js.html" %}
|
{% include "connect_ws_js.html" %}
|
||||||
<script src="{% static "js/filters_functions_find_route.js" %}"></script>
|
<script src="{% static "js/filters_functions_find_route.js" %}"></script>
|
||||||
|
<script src="{% static "js/dynamic_loading_routes.js" %}"></script>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
@@ -52,7 +53,7 @@
|
|||||||
minlength="3"
|
minlength="3"
|
||||||
name="from_address_point_txt"
|
name="from_address_point_txt"
|
||||||
class="from_address_point_txt find_route first"
|
class="from_address_point_txt find_route first"
|
||||||
{% if form.fields.from_address_point.required %} required{% endif %}
|
{# {% if form.fields.from_address_point.required %} required{% endif %}#}
|
||||||
id="id_from_address_point_txt"
|
id="id_from_address_point_txt"
|
||||||
{% if form.initial.from_address_point_txt %}value="{{ form.initial.from_address_point_txt }}"{% endif %}
|
{% if form.initial.from_address_point_txt %}value="{{ form.initial.from_address_point_txt }}"{% endif %}
|
||||||
/>
|
/>
|
||||||
@@ -88,7 +89,7 @@
|
|||||||
autocomplete="off"
|
autocomplete="off"
|
||||||
type="text"
|
type="text"
|
||||||
name="to_address_point_txt"
|
name="to_address_point_txt"
|
||||||
{% if form.fields.to_address_point.required %} required{% endif %}
|
{# {% if form.fields.to_address_point.required %} required{% endif %}#}
|
||||||
id="id_to_address_point_txt"
|
id="id_to_address_point_txt"
|
||||||
class="to_address_point_txt find_route"
|
class="to_address_point_txt find_route"
|
||||||
{% if form.initial.to_address_point_txt %}value="{{ form.initial.to_address_point_txt}}"{% endif %}/>
|
{% if form.initial.to_address_point_txt %}value="{{ form.initial.to_address_point_txt}}"{% endif %}/>
|
||||||
@@ -100,15 +101,15 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="cont-el-form-search-carrier">
|
<div class="cont-el-form-search-carrier">
|
||||||
<label for="id_departure_DT">Дата отправки</label>
|
<label for="id_departure_DT">Дата отправки</label>
|
||||||
<input name="departure_DT" id="id_departure_DT" type="date" {% if form.fields.departure_DT.required %} required{% endif %}>
|
<input name="departure_DT" id="id_departure_DT" type="date" {% if form.fields.departure_DT.required %} {% endif %}>
|
||||||
</div>
|
</div>
|
||||||
<div class="cont-el-form-search-carrier">
|
<div class="cont-el-form-search-carrier">
|
||||||
<label for="id_arrival_DT">Дата прибытия</label>
|
<label for="id_arrival_DT">Дата прибытия</label>
|
||||||
<input name="arrival_DT" id="id_arrival_DT" type="date" {% if form.fields.arrival_DT.required %} required{% endif %}>
|
<input name="arrival_DT" id="id_arrival_DT" type="date" {% if form.fields.arrival_DT.required %} {% endif %}>
|
||||||
</div>
|
</div>
|
||||||
<div class="cont-el-form-search-carrier last">
|
<div class="cont-el-form-search-carrier last">
|
||||||
<label>test</label>
|
<label>test</label>
|
||||||
<select name="cargo_type" id="id_cargo_type" {% if form.fields.cargo_type.required %} required{% endif %}>
|
<select name="cargo_type" id="id_cargo_type" {% if form.fields.cargo_type.required %} {% endif %}>
|
||||||
<option value="" selected="selected">--не имеет значения--</option>
|
<option value="" selected="selected">--не имеет значения--</option>
|
||||||
{% for item in form.fields.cargo_type.choices %}
|
{% for item in form.fields.cargo_type.choices %}
|
||||||
<option value="{{ item.0 }}">{{ item.1 }}</option>
|
<option value="{{ item.0 }}">{{ item.1 }}</option>
|
||||||
@@ -210,7 +211,15 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="block-finded-routes">
|
<div class="block-finded-routes">
|
||||||
{% include "blocks/b_search_routes.html" %}
|
<div class="page_routes_1">
|
||||||
|
{% include "blocks/b_search_routes.html" %}
|
||||||
|
</div>
|
||||||
|
<div class="page_routes_2">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="text-align-center">
|
||||||
|
<button class="button-find-more-routes" data-last-route="25" onclick="load_routes(this)">Показать ещё 10</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="clear_both"></div>
|
<div class="clear_both"></div>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{% load static %}
|
{% load static %}
|
||||||
<div class="carrier-card">
|
<div class="carrier-card" data-number-of-route="{{ route.id }}">
|
||||||
<div class="left-part-carrier-card">
|
<div class="left-part-carrier-card">
|
||||||
<div class="first-line-card-carrier">
|
<div class="first-line-card-carrier">
|
||||||
<div class="carrier-title">
|
<div class="carrier-title">
|
||||||
@@ -45,7 +45,7 @@
|
|||||||
<div>{{ route.get_cargo_type_display }}</div>
|
<div>{{ route.get_cargo_type_display }}</div>
|
||||||
<div>{{ route.weight }}</div>
|
<div>{{ route.weight }}</div>
|
||||||
<div>{{ route.get_owner_type_display }}</div>
|
<div>{{ route.get_owner_type_display }}</div>
|
||||||
<div>{{ forloop.counter }}</div>
|
<div>{{ route.id }},{{ forloop.counter }}</div>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
{% if route.owner != user %}
|
{% if route.owner != user %}
|
||||||
|
|||||||
Reference in New Issue
Block a user