0.0.161 routes
This commit is contained in:
@@ -12,11 +12,14 @@
|
||||
display: grid;
|
||||
grid-template-columns: 30% calc(100% - 30% - 41px);
|
||||
gap: 41px;
|
||||
/*.routes_search_results{*/
|
||||
/* @media (max-width: 1160px) {*/
|
||||
/* width: calc(100dvw - 40px);*/
|
||||
/* }*/
|
||||
/*}*/
|
||||
.routes_search_results{
|
||||
.next_page{
|
||||
margin: 50px 0;
|
||||
width: 100%;
|
||||
background: #212121;
|
||||
height: 1px;
|
||||
}
|
||||
}
|
||||
@media (max-width: 1440px) {
|
||||
margin-top: 40px;
|
||||
}
|
||||
|
||||
@@ -17,11 +17,48 @@ function searchRoutes (form=undefined) {
|
||||
data_type: 'formData',
|
||||
success: function (res) {
|
||||
if (!res.html) return;
|
||||
let $parent = $('.routes_search_results .routes_cont')[0]
|
||||
let $parent = $('.routes_search_results')[0];
|
||||
|
||||
$parent.innerHTML = res.html;
|
||||
}
|
||||
})
|
||||
|
||||
request.ajaxRequest()
|
||||
}
|
||||
|
||||
function loadMoreRoutes (el) {
|
||||
if (!el) return;
|
||||
let from_el = parseInt(el.dataset.from_el);
|
||||
let to_el = from_el + parseInt(el.dataset.more_count);
|
||||
let $filter_form = $('.b_filter_routes form')[0];
|
||||
let $search_form = $('.b_search_routes form')[0];
|
||||
|
||||
let formData = getFormData($search_form);
|
||||
formData = getFormData($filter_form, formData);
|
||||
let owner_type = 'mover'
|
||||
formData.append('owner_type', owner_type);
|
||||
formData.append('from_el', from_el);
|
||||
formData.append('to_el', to_el);
|
||||
|
||||
let query = formDataToQueryString(formData, [$filter_form, $search_form]);
|
||||
query+=`owner_type=${owner_type}`
|
||||
window.history.pushState(null, null, `?${query}`);
|
||||
let request = new api({
|
||||
url: '/routes/find_routes/',
|
||||
data: formData,
|
||||
data_type: 'formData',
|
||||
success: function (res) {
|
||||
if (!res.html) return;
|
||||
let $parent = $('.routes_search_results')[0];
|
||||
let $next_page_btn = $parent.querySelector('.container_btns[data-next_page_btn]')
|
||||
$next_page_btn.remove();
|
||||
|
||||
appendNodes($parent, templateStrToNode(`
|
||||
<div class="next_page"></div>
|
||||
`));
|
||||
appendNodes($parent, templateStrToNode(res.html));
|
||||
}
|
||||
})
|
||||
|
||||
request.ajaxRequest()
|
||||
}
|
||||
@@ -5,6 +5,14 @@
|
||||
{% include "v2/widgets/w_route_card_for_search.html" %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
<div class="container_btns" style="--justify: center;">
|
||||
<div class="primary_btn" style="--padding: 19px 34px 21px 34px">{% trans "Показать ещё 10" %}</div>
|
||||
</div>
|
||||
{% if not last_block %}
|
||||
<div class="container_btns" data-next_page_btn="true" style="--justify: center;">
|
||||
<div class="primary_btn"
|
||||
onclick="loadMoreRoutes(this)"
|
||||
style="--padding: 19px 34px 21px 34px"
|
||||
data-from_el="{{ last_el }}"
|
||||
data-more_count="{{ next_page_els_count }}">
|
||||
{% trans "Показать ещё" %} {{ next_page_els_count }}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
Reference in New Issue
Block a user