0.0.161 routes

This commit is contained in:
SBD
2025-02-17 17:20:04 +03:00
parent e3fd8457c0
commit 4f2e3776ed
3 changed files with 57 additions and 9 deletions

View File

@@ -12,11 +12,14 @@
display: grid; display: grid;
grid-template-columns: 30% calc(100% - 30% - 41px); grid-template-columns: 30% calc(100% - 30% - 41px);
gap: 41px; gap: 41px;
/*.routes_search_results{*/ .routes_search_results{
/* @media (max-width: 1160px) {*/ .next_page{
/* width: calc(100dvw - 40px);*/ margin: 50px 0;
/* }*/ width: 100%;
/*}*/ background: #212121;
height: 1px;
}
}
@media (max-width: 1440px) { @media (max-width: 1440px) {
margin-top: 40px; margin-top: 40px;
} }

View File

@@ -17,7 +17,7 @@ function searchRoutes (form=undefined) {
data_type: 'formData', data_type: 'formData',
success: function (res) { success: function (res) {
if (!res.html) return; if (!res.html) return;
let $parent = $('.routes_search_results .routes_cont')[0] let $parent = $('.routes_search_results')[0];
$parent.innerHTML = res.html; $parent.innerHTML = res.html;
} }
@@ -25,3 +25,40 @@ function searchRoutes (form=undefined) {
request.ajaxRequest() 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()
}

View File

@@ -5,6 +5,14 @@
{% include "v2/widgets/w_route_card_for_search.html" %} {% include "v2/widgets/w_route_card_for_search.html" %}
{% endfor %} {% endfor %}
</div> </div>
<div class="container_btns" style="--justify: center;"> {% if not last_block %}
<div class="primary_btn" style="--padding: 19px 34px 21px 34px">{% trans "Показать ещё 10" %}</div> <div class="container_btns" data-next_page_btn="true" style="--justify: center;">
</div> <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 %}