This commit is contained in:
2023-10-27 17:19:40 +03:00
parent 02f7edade5
commit b8c282f95f
4 changed files with 281 additions and 226 deletions

View File

@@ -1,5 +1,58 @@
profile_tabs_f_static_map = new Map([
['chats','chat'],
['support_tickets','support'],
['show_cur_subscribe','my_subscribe'],
['change_profile','change_profile'],
['new_route_view_customer','create_route_for_customer'],
['new_route_view_mover','create_route_for_mover']
])
function select_tab_profile (el,url,owner_type=null) {
let data = {}
let confirm_url = `/user_account/${url}/`
if (url.includes('subscribe')){
confirm_url = `/subscribes/${url}/`
} else if (url.includes('new_route')){
data = {
'owner_type': owner_type
}
} else if (url.includes('get_routes')){
confirm_url = `/routes/${url}/`
}
$.ajax({
headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() },
url: confirm_url,
type: "POST",
// async: true,
cache: false,
processData: false,
contentType: false,
// enctype: 'json',
data: JSON.stringify(data),
success: function(data){
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')
let body = document.querySelector("body")
body.style.overflow = "hidden"
if (owner_type){
window.history.pushState(null, null, `/${document.documentElement.lang}/profile/page/${profile_tabs_f_static_map.get(`${url}_${owner_type}`)}/`)
} else {
window.history.pushState(null, null, `/${document.documentElement.lang}/profile/page/${profile_tabs_f_static_map.get(url)}/`)
}
middleWareJS()
},
error: function (data){
console.log(data)
}
});
}
function createTicketShow () {
$.ajax({
headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() },