0.0.128 remove_route func v0.1
This commit is contained in:
@@ -153,8 +153,52 @@ function myProfile(el){
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function removeRoute(el) {
|
||||||
|
|
||||||
|
|
||||||
|
let remove_item = el.currentTarget.parentNode.parentNode.parentNode.parentNode.parentNode.dataset.numberOfRoute
|
||||||
|
let remove_data = {}
|
||||||
|
let name_route = 'route.id'
|
||||||
|
remove_data[name_route] = remove_item
|
||||||
|
|
||||||
|
// console.log(remove_item)
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() },
|
||||||
|
url: '/ru/routes/del_route/',
|
||||||
|
type: "POST",
|
||||||
|
// async: true,
|
||||||
|
cache: false,
|
||||||
|
processData: false,
|
||||||
|
contentType: false,
|
||||||
|
// enctype: 'json',
|
||||||
|
data: JSON.stringify(remove_data) ,
|
||||||
|
success: function(data){
|
||||||
|
if (data.user_alerts) {
|
||||||
|
getNewMessageSession()
|
||||||
|
}
|
||||||
|
|
||||||
|
// location.href = '/profile'
|
||||||
|
document.querySelector(".info_profile").innerHTML = data.html;
|
||||||
|
|
||||||
|
// let list_div = document.querySelectorAll('.menu_profile div');
|
||||||
|
// list_div.forEach(el=>{ el.classList.remove('selected'); });
|
||||||
|
// el.classList.add('selected')
|
||||||
|
|
||||||
|
//updating the url without reloading
|
||||||
|
window.history.pushState(null, null, '/ru/profile/page/change_profile/')
|
||||||
|
|
||||||
|
|
||||||
|
},
|
||||||
|
error: function (data, exception){
|
||||||
|
console.log(400)
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function confirmRemove(el) {
|
function confirmRemove(el) {
|
||||||
@@ -166,7 +210,7 @@ function confirmRemove(el) {
|
|||||||
el.setAttribute("id", "select-remove");
|
el.setAttribute("id", "select-remove");
|
||||||
let btn = document.querySelector("#select-remove");
|
let btn = document.querySelector("#select-remove");
|
||||||
|
|
||||||
if(!btn.classList.contains('confirm_remove')){
|
if (!btn.classList.contains('confirm_remove')) {
|
||||||
btn.classList.add('confirm_remove')
|
btn.classList.add('confirm_remove')
|
||||||
btn.innerText = 'Подтвердить удаление'
|
btn.innerText = 'Подтвердить удаление'
|
||||||
// let place = document.querySelector('.button_remove_route')
|
// let place = document.querySelector('.button_remove_route')
|
||||||
@@ -175,10 +219,16 @@ function confirmRemove(el) {
|
|||||||
cancel_button.innerText = "Отменить удаление";
|
cancel_button.innerText = "Отменить удаление";
|
||||||
let place = btn.closest(".button_remove_route")
|
let place = btn.closest(".button_remove_route")
|
||||||
place.insertBefore(cancel_button, btn.nextSibling);
|
place.insertBefore(cancel_button, btn.nextSibling);
|
||||||
|
|
||||||
|
btn.addEventListener('click', removeRoute, { once: true })
|
||||||
|
btn.removeAttribute("id", "select-remove")
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
btn.removeAttribute("id", "select-remove")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function searchTown(el){
|
function searchTown(el){
|
||||||
|
|
||||||
if (el.value.length > 0){
|
if (el.value.length > 0){
|
||||||
|
|||||||
@@ -108,21 +108,21 @@
|
|||||||
|
|
||||||
{#<div class="my_route">#}
|
{#<div class="my_route">#}
|
||||||
{# <div class="route_info">#}
|
{# <div class="route_info">#}
|
||||||
<div class="route_info_about">
|
{# <div class="route_info_about">#}
|
||||||
<span>
|
{# <span>#}
|
||||||
Тип:{{ route.get_cargo_type_display }}
|
{# Тип:{{ route.get_cargo_type_display }}#}
|
||||||
</span>
|
{# </span>#}
|
||||||
|
{##}
|
||||||
<span>
|
{# <span>#}
|
||||||
Вес:{{ route.weight }} кг
|
{# Вес:{{ route.weight }} кг#}
|
||||||
</span>
|
{# </span>#}
|
||||||
|
{##}
|
||||||
<span>
|
{# <span>#}
|
||||||
|
{##}
|
||||||
{{ route.get_type_transport_display }}
|
{# {{ route.get_type_transport_display }}#}
|
||||||
</span>
|
{# </span>#}
|
||||||
|
{##}
|
||||||
</div>
|
{# </div>#}
|
||||||
{##}
|
{##}
|
||||||
{# <div class="route_info_point">#}
|
{# <div class="route_info_point">#}
|
||||||
{##}
|
{##}
|
||||||
|
|||||||
Reference in New Issue
Block a user