1.1.1 highlighting and raising routes

This commit is contained in:
2024-06-03 21:35:15 +03:00
parent 40951fdfcb
commit d89730ffbf
3 changed files with 198 additions and 1 deletions

View File

@@ -612,6 +612,87 @@ function sendRoute(el, routeID = null){
});
}
function confirmUpgrade(el, routeID){
event.preventDefault()
el.disabled = true
let form = el.form
let formData = new FormData(form);
formData.set('route_id', routeID)
let url = '/routes/'
let checkboxes = document.querySelectorAll('input[name="route_option"]');
for (let i = 0; i < checkboxes.length; i++) {
if (checkboxes[i].checked && checkboxes[i].id === "highlight_route" ) {
url = '/routes/highlight_route/'
}else if(checkboxes[i].checked && checkboxes[i].id === "raise_route"){
url = '/routes/raise_route/'
}
}
$.ajax({
headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() },
url: url,
type: "POST",
// async: true,
cache: false,
processData: false,
contentType: false,
// enctype: 'json',
// data: JSON.stringify(obj_w_el_form),
data: formData,
success: function(data){
let data_route_id = data.route_id
// location.href = '/profile'
// document.querySelector(".info_profile").innerHTML = data.html
let el_route = document.querySelector(`[data-number-of-route="${data_route_id}"]`);
if (routeID){
el_route = document.querySelector(`[data-number-of-route="${routeID}"]`);
}
el_route.scrollIntoView({
behavior:"smooth",
block:'start',
inline:'start'
});
// document.querySelector(".tab_user_messanger.select").scrollIntoView({behavior: "smooth",block:'nearest',inline:'nearest'});
let list_div = document.querySelectorAll('.menu_profile div');
let my_routes = document.getElementById("my_routes_id")
list_div.forEach(el=>{ el.classList.remove('selected'); });
my_routes.classList.add('selected')
middleWareJS()
},
error: function (data, exception){
document.querySelector(".info_profile").innerHTML = data.responseJSON.html;
// $(el).attr('disabled', 'false')
document.getElementById('id_type_transport').scrollIntoView({behavior: "smooth",block:'nearest',inline:'nearest'});
sliderInit();
init_departure_DT()
init_arrival_DT()
}
});
}
// function validate(el) {
@@ -836,6 +917,18 @@ function showMenu(el, event) {
menu.classList.add('show')
}
}
function showControlFrame(el, route_id){
let menu = document.getElementById('control_frame_'+ route_id );
if(menu.classList.contains('show')){
menu.classList.remove('show')
} else {
menu.classList.add('show')
}
}
function showLang(el) {
let lang = document.querySelector('.dropdown-content-lang');
if(lang.classList.contains('show')){