2 Commits

Author SHA1 Message Date
cc86400957 Merge remote-tracking branch 'origin/main'
# Conflicts:
#	static/js/user_profile.js
2023-10-27 17:21:28 +03:00
b8c282f95f 0.0.299 2023-10-27 17:19:40 +03:00
4 changed files with 281 additions and 283 deletions

View File

@@ -1,171 +1,135 @@
function writeMessage(el){ // function writeMessage(el){
$.ajax({ // $.ajax({
headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() }, // headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() },
url: '/user_account/chats/', // url: '/user_account/chats/',
type: "POST", // type: "POST",
// async: true, // // async: true,
cache: false, // cache: false,
processData: false, // processData: false,
contentType: false, // contentType: false,
// enctype: 'json', // // enctype: 'json',
// data: formData, // // data: formData,
success: function(data){ // success: function(data){
//
// location.href = '/profile' // // location.href = '/profile'
document.querySelector(".info_profile").innerHTML = data.html; // document.querySelector(".info_profile").innerHTML = data.html;
//
let list_div = document.querySelectorAll('.menu_profile div'); // let list_div = document.querySelectorAll('.menu_profile div');
let ru_lang = document.getElementById('ru_lang'); // list_div.forEach(el=>{ el.classList.remove('selected'); });
let en_lang = document.getElementById('en_lang'); // el.classList.add('selected')
ru_lang.pathname = "/ru/profile/page/chat/"; // let body = document.querySelector("body")
en_lang.pathname = "/en/profile/page/chat/"; // body.style.overflow = "hidden"
list_div.forEach(el=>{ el.classList.remove('selected'); }); // //updating the url without reloading
el.classList.add('selected') // window.history.pushState(null, null, '/ru/profile/page/chat/')
let body = document.querySelector("body") // middleWareJS()
body.style.overflow = "hidden" //
//updating the url without reloading // },
if (window.location.href.indexOf("/ru/") > -1) { // error: function (data, exception){
window.history.pushState(null, null, '/ru/profile/page/chat/') // console.log(400)
//
} else if(window.location.href.indexOf("/en/") > -1){ // }
window.history.pushState(null, null, '/en/profile/page/chat/') // });
} // }
//
middleWareJS() //
// function technicalSupport(el){
}, // $.ajax({
error: function (data, exception){ // headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() },
console.log(400) // url: '/user_account/support_tickets/',
// type: "POST",
} // // async: true,
}); // cache: false,
} // processData: false,
// contentType: false,
// // enctype: 'json',
function technicalSupport(el){ // // data: formData,
console.log(el) // success: function(data){
$.ajax({ //
headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() }, //
url: '/user_account/support_tickets/', // // location.href = '/profile'
type: "POST", // document.querySelector(".info_profile").innerHTML = data.html;
// async: true, //
cache: false, // let list_div = document.querySelectorAll('.menu_profile div');
processData: false, // list_div.forEach(el=>{ el.classList.remove('selected'); });
contentType: false, // el.classList.add('selected')
// enctype: 'json', //
// data: formData, // //updating the url without reloading
success: function(data){ // window.history.pushState(null, null, '/ru/profile/page/support/')
// middleWareJS()
//
// location.href = '/profile' // },
document.querySelector(".info_profile").innerHTML = data.html; // error: function (data, exception){
// console.log(400)
let list_div = document.querySelectorAll('.menu_profile div'); //
let ru_lang = document.getElementById('ru_lang'); // }
let en_lang = document.getElementById('en_lang'); // });
ru_lang.pathname = "/ru/profile/page/support/"; // }
en_lang.pathname = "/en/profile/page/support/"; // function mySubscription(el){
list_div.forEach(el=>{ el.classList.remove('selected'); }); // // boris changed
el.classList.add('selected') // $.ajax({
// headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() },
//updating the url without reloading // url: '/subscribes/show_cur_subscribe/',
if (window.location.href.indexOf("/ru/") > -1) { // type: "POST",
window.history.pushState(null, null, '/ru/profile/page/support/') // // async: true,
// cache: false,
} else if(window.location.href.indexOf("/en/") > -1){ // processData: false,
window.history.pushState(null, null, '/en/profile/page/support/') // contentType: false,
} // // enctype: 'json',
middleWareJS() // // data: formData,
// success: function(data){
}, //
error: function (data, exception){ // document.querySelector(".info_profile").innerHTML = data.html;
console.log(400) //
// // location.href = '/profile'
} // // document.querySelector(".info_profile").innerHTML = data.html;
}); //
} // let list_div = document.querySelectorAll('.menu_profile div');
function mySubscription(el){ // list_div.forEach(el=>{ el.classList.remove('selected'); });
// boris changed // el.classList.add('selected')
$.ajax({ //
headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() }, // //updating the url without reloading
url: '/subscribes/show_cur_subscribe/', // window.history.pushState(null, null, '/ru/profile/page/my_subscribe/')
type: "POST", // middleWareJS()
// async: true, //
cache: false, // },
processData: false, // error: function (data, exception){
contentType: false, // console.log(400)
// enctype: 'json', //
// data: formData, // }
success: function(data){ // });
// }
document.querySelector(".info_profile").innerHTML = data.html; // function myProfile(el){
// $.ajax({
// location.href = '/profile' // headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() },
// document.querySelector(".info_profile").innerHTML = data.html; // url: '/user_account/change_profile/',
let ru_lang = document.getElementById('ru_lang'); // type: "POST",
let en_lang = document.getElementById('en_lang'); // // async: true,
ru_lang.pathname = "/ru/profile/page/my_subscribe/"; // cache: false,
en_lang.pathname = "/en/profile/page/my_subscribe/"; // processData: false,
let list_div = document.querySelectorAll('.menu_profile div'); // contentType: false,
list_div.forEach(el=>{ el.classList.remove('selected'); }); // // enctype: 'json',
el.classList.add('selected') // // data: formData,
// success: function(data){
//updating the url without reloading //
if (window.location.href.indexOf("/ru/") > -1) { //
window.history.pushState(null, null, '/ru/profile/page/my_subscribe/') // // location.href = '/profile'
// document.querySelector(".info_profile").innerHTML = data.html;
} else if(window.location.href.indexOf("/en/") > -1){ //
window.history.pushState(null, null, '/en/profile/page/my_subscribe/') // let list_div = document.querySelectorAll('.menu_profile div');
} // list_div.forEach(el=>{ el.classList.remove('selected'); });
middleWareJS() // el.classList.add('selected')
//
}, // //updating the url without reloading
error: function (data, exception){ // window.history.pushState(null, null, '/ru/profile/page/change_profile/')
console.log(400) // middleWareJS()
//
} // },
}); // error: function (data, exception){
} // console.log(400)
function myProfile(el){ //
$.ajax({ // }
headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() }, // });
url: '/user_account/change_profile/', // }
type: "POST",
// async: true,
cache: false,
processData: false,
contentType: false,
// enctype: 'json',
// data: formData,
success: function(data){
// location.href = '/profile'
document.querySelector(".info_profile").innerHTML = data.html;
let ru_lang = document.getElementById('ru_lang');
let en_lang = document.getElementById('en_lang');
ru_lang.pathname = "/ru/profile/page/change_profile/";
en_lang.pathname = "/en/profile/page/change_profile/";
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
if (window.location.href.indexOf("/ru/") > -1) {
window.history.pushState(null, null, '/ru/profile/page/change_profile/')
} else if(window.location.href.indexOf("/en/") > -1){
window.history.pushState(null, null, '/en/profile/page/change_profile/')
}
middleWareJS()
},
error: function (data, exception){
console.log(400)
}
});
}
// function selectMenuItem() { // function selectMenuItem() {
// let list_div = document.querySelectorAll('.menu_profile div'); // let list_div = document.querySelectorAll('.menu_profile div');
@@ -622,115 +586,96 @@ function OnSelectionChange(el) {
function createRoute(el, owner_type){ // function createRoute(el, owner_type){
let obj = { // let obj = {
'owner_type': owner_type // 'owner_type': owner_type
} // }
$.ajax({
headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() },
url: '/user_account/new_route_view/',
type: "POST",
// async: true,
cache: false,
processData: false,
contentType: false,
// enctype: 'json',
data: JSON.stringify(obj),
success: function(data){
// location.href = '/profile'
document.querySelector(".info_profile").innerHTML = data.html
let list_div = document.querySelectorAll('.menu_profile div');
let ru_lang = document.getElementById('ru_lang');
let en_lang = document.getElementById('en_lang');
list_div.forEach(el=>{ el.classList.remove('selected'); });
el.classList.add('selected')
// updating the url without reload
if(el.id === 'customer'){
window.history.pushState(null, null, '/ru/profile/page/create_route_for_customer/')
ru_lang.pathname = "/ru/profile/page/create_route_for_customer/";
en_lang.pathname = "/en/profile/page/create_route_for_customer/";
} else {
window.history.pushState(null, null, '/ru/profile/page/create_route_for_mover/')
ru_lang.pathname = "/ru/profile/page/create_route_for_mover/";
en_lang.pathname = "/en/profile/page/create_route_for_mover/";
}
middleWareJS()
//get dynamic value
// let fromCountry = document.getElementById('id_from_country');
// let toCounytry = document.getElementById('id_to_country')
//
// toCounytry.oninput = function (){
// console.log(toCounytry.value)
// }
// fromCountry.oninput = function (){
// console.log(fromCountry.value)
// //
// }; // $.ajax({
// headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() },
// url: '/user_account/new_route_view/',
// type: "POST",
// // async: true,
// cache: false,
// processData: false,
// contentType: false,
// // enctype: 'json',
// data: JSON.stringify(obj),
// success: function(data){
//
//
// // 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
// if(el.id == 'customer'){
// window.history.pushState(null, null, '/ru/profile/page/create_route_for_customer/')
// } else {
// window.history.pushState(null, null, '/ru/profile/page/create_route_for_mover/')
// }
// middleWareJS()
//
//
//
// //get dynamic value
// // let fromCountry = document.getElementById('id_from_country');
// // let toCounytry = document.getElementById('id_to_country')
// //
// // toCounytry.oninput = function (){
// // console.log(toCounytry.value)
// // }
// // fromCountry.oninput = function (){
// // console.log(fromCountry.value)
// //
// // };
//
//
// },
// error: function (data, exception){
// console.log(101)
//
// }
// });
// }
// function getRoute(el){
}, // $.ajax({
error: function (data, exception){ // headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() },
console.log(101) // url: '/routes/get_routes/',
// type: "POST",
} // // async: true,
}); // cache: false,
} // processData: false,
// contentType: false,
function getRoute(el){ // // enctype: 'json',
$.ajax({ // // data: formData,
headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() }, // success: function(data){
url: '/routes/get_routes/', //
type: "POST", //
// async: true, // // location.href = '/profile'
cache: false, // document.querySelector(".info_profile").innerHTML = data.html;
processData: false, //
contentType: false, // let list_div = document.querySelectorAll('.menu_profile div');
// enctype: 'json', // list_div.forEach(el=>{ el.classList.remove('selected'); });
// data: formData, // el.classList.add('selected')
success: function(data){ //
// window.history.pushState(null, null, '/ru/profile/page/my_routes/')
//
// location.href = '/profile' // middleWareJS()
//
document.querySelector(".info_profile").innerHTML = data.html; // },
// error: function (data, exception){
let ru_lang = document.getElementById('ru_lang'); // console.log(101)
let en_lang = document.getElementById('en_lang'); //
ru_lang.pathname = "/ru/profile/page/my_routes/"; // }
en_lang.pathname = "/en/profile/page/my_routes/"; // });
// }
let list_div = document.querySelectorAll('.menu_profile div'); // ЛОСЬ ДЫРЯВЫЙ
list_div.forEach(el=>{ el.classList.remove('selected'); }); function editRoute(id) {
el.classList.add('selected')
if (window.location.href.indexOf("/ru/") > -1) {
window.history.pushState(null, null, '/ru/profile/page/my_routes/')
} else if(window.location.href.indexOf("/en/") > -1){
window.history.pushState(null, null, '/en/profile/page/my_routes/')
}
middleWareJS()
},
error: function (data, exception){
console.log(101)
}
});
}function editRoute(id) {
let route_obj = { let route_obj = {
'route_id': id 'route_id': id
} }

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 () { function createTicketShow () {
$.ajax({ $.ajax({
headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() }, headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() },

View File

@@ -11,7 +11,7 @@
</div> </div>
<div <div
id="customer" id="customer"
onclick="createRoute(this)" onclick="select_tab_profile(this,'new_route_view','customer')"
{% if page_name == 'create_route_for_customer' %} {% if page_name == 'create_route_for_customer' %}
class="selected" class="selected"
{% endif %} > {% endif %} >
@@ -20,7 +20,7 @@
</div> </div>
<div <div
id="mover" id="mover"
onclick="createRoute(this)" onclick="select_tab_profile(this,'new_route_view','mover')"
{% if page_name == 'create_route_for_mover' %} {% if page_name == 'create_route_for_mover' %}
class="selected" class="selected"
{% endif %}> {% endif %}>
@@ -29,7 +29,7 @@
</div> </div>
<div <div
id="my_routes_id" id="my_routes_id"
onclick="getRoute(this)" onclick="select_tab_profile(this,'get_routes')"
{% if page_name == 'my_routes' %} {% if page_name == 'my_routes' %}
class="selected" class="selected"
{% endif %}> {% endif %}>
@@ -37,7 +37,7 @@
<a href="#">Мои объявления</a> <a href="#">Мои объявления</a>
</div> </div>
<div <div
onclick="writeMessage(this)" onclick="select_tab_profile(this,'chats')"
{% if page_name == 'chat' %} {% if page_name == 'chat' %}
class="selected" class="selected"
{% endif %}> {% endif %}>
@@ -51,7 +51,7 @@
</a> </a>
</div> </div>
<div <div
onclick="technicalSupport(this)" onclick="select_tab_profile(this,'support_tickets')"
{% if page_name == 'support' %} {% if page_name == 'support' %}
class="selected" class="selected"
{% endif %}> {% endif %}>
@@ -59,7 +59,7 @@
<a href="#">Тех. поддержка</a> <a href="#">Тех. поддержка</a>
</div> </div>
<div <div
onclick="mySubscription(this)" onclick="select_tab_profile(this,'show_cur_subscribe')"
{% if page_name == 'my_subscribe' %} {% if page_name == 'my_subscribe' %}
class="selected" class="selected"
{% endif %}> {% endif %}>
@@ -67,7 +67,7 @@
<a href="#">Моя подписка</a> <a href="#">Моя подписка</a>
</div> </div>
<div <div
onclick="myProfile(this)" onclick="select_tab_profile(this,'change_profile')"
{% if page_name == 'change_profile' %} {% if page_name == 'change_profile' %}
class="selected" class="selected"
{% endif %}> {% endif %}>

View File

@@ -2,7 +2,7 @@
{% load tt_chat %} {% load tt_chat %}
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="{{ request.LANGUAGE_CODE }}">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=100%,maximum-scale=5,minimum-scale=1,initial-scale=1"> <meta name="viewport" content="width=100%,maximum-scale=5,minimum-scale=1,initial-scale=1">