0.0.78 update scrip for menu_user_profile

This commit is contained in:
2023-08-09 15:55:52 +03:00
parent 662b2a0bed
commit e2ff4baef5
2 changed files with 48 additions and 25 deletions

View File

@@ -1,4 +1,4 @@
function writeMessage(){ function writeMessage(el){
$.ajax({ $.ajax({
headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() }, headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() },
url: '/ru/user_account/chats/', url: '/ru/user_account/chats/',
@@ -14,6 +14,9 @@ function writeMessage(){
// 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');
list_div.forEach(el=>{ el.classList.remove('selected'); });
el.classList.add('selected')
}, },
error: function (data, exception){ error: function (data, exception){
@@ -24,7 +27,7 @@ function writeMessage(){
} }
function technicalSupport(){ function technicalSupport(el){
$.ajax({ $.ajax({
headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() }, headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() },
url: '/ru/user_account/support_tickets/', url: '/ru/user_account/support_tickets/',
@@ -41,6 +44,10 @@ function technicalSupport(){
// 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');
list_div.forEach(el=>{ el.classList.remove('selected'); });
el.classList.add('selected')
}, },
error: function (data, exception){ error: function (data, exception){
@@ -49,7 +56,7 @@ function technicalSupport(){
} }
}); });
} }
function mySubscription(){ function mySubscription(el){
$.ajax({ $.ajax({
headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() }, headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() },
url: '/ru/user_account/subscribe/', url: '/ru/user_account/subscribe/',
@@ -66,6 +73,10 @@ function mySubscription(){
// 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');
list_div.forEach(el=>{ el.classList.remove('selected'); });
el.classList.add('selected')
}, },
error: function (data, exception){ error: function (data, exception){
@@ -74,7 +85,7 @@ function mySubscription(){
} }
}); });
} }
function myProfile(){ function myProfile(el){
$.ajax({ $.ajax({
headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() }, headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() },
url: '/ru/user_account/change_profile/', url: '/ru/user_account/change_profile/',
@@ -91,6 +102,10 @@ function myProfile(){
// 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');
list_div.forEach(el=>{ el.classList.remove('selected'); });
el.classList.add('selected')
}, },
error: function (data, exception){ error: function (data, exception){
@@ -100,18 +115,18 @@ function myProfile(){
}); });
} }
function selectMenuItem() { // function selectMenuItem() {
let list_div = document.querySelectorAll('.menu_profile div'); // let list_div = document.querySelectorAll('.menu_profile div');
//
list_div.forEach(item =>{ // list_div.forEach(item =>{
item.addEventListener('click', (e) =>{ // item.addEventListener('click', (e) =>{
list_div.forEach(el=>{ el.classList.remove('selected'); }); // list_div.forEach(el=>{ el.classList.remove('selected'); });
item.classList.add('selected') // item.classList.add('selected')
}) // })
}) // })
//
//
} // }
@@ -376,7 +391,7 @@ function OnSelectionChange(el) {
function createRoute(){ function createRoute(el){
$.ajax({ $.ajax({
headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() }, headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() },
@@ -394,6 +409,10 @@ function createRoute(){
// 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');
list_div.forEach(el=>{ el.classList.remove('selected'); });
el.classList.add('selected')
//get dynamic value //get dynamic value
@@ -413,7 +432,7 @@ function createRoute(){
}); });
} }
function getRoute(){ function getRoute(el){
$.ajax({ $.ajax({
headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() }, headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() },
url: '/ru/routes/get_routes/', url: '/ru/routes/get_routes/',
@@ -430,6 +449,10 @@ function getRoute(){
// 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');
list_div.forEach(el=>{ el.classList.remove('selected'); });
el.classList.add('selected')
}, },
error: function (data, exception){ error: function (data, exception){

View File

@@ -1,33 +1,33 @@
<section class="profile"> <section class="profile">
{% csrf_token %} {% csrf_token %}
<div <div
onclick="selectMenuItem()"
class="menu_profile"> class="menu_profile">
<div> <div>
<img class="svg" src="/static/img/svg/MagnifyingGlass.svg"> <img class="svg" src="/static/img/svg/MagnifyingGlass.svg">
<a href="#">Поиск посылки</a> <a href="#">Поиск посылки</a>
</div> </div>
<div onclick="createRoute()"> <div onclick="createRoute(this)">
<img class="svg" src="/static/img/svg/PushPin.svg"> <img class="svg" src="/static/img/svg/PushPin.svg">
<a href="#">Разместить объявление</a> <a href="#">Разместить объявление</a>
</div> </div>
<div onclick="getRoute()"> <div onclick="getRoute(this)">
<img class="svg" src="/static/img/svg/Cards.svg"> <img class="svg" src="/static/img/svg/Cards.svg">
<a href="#">Мои объявления</a> <a href="#">Мои объявления</a>
</div> </div>
<div onclick="writeMessage()"> <div onclick="writeMessage(this)">
<img class="svg" src="/static/img/svg/ChatCircleDots.svg"> <img class="svg" src="/static/img/svg/ChatCircleDots.svg">
<a href="#">Написать сообщение</a> <a href="#">Написать сообщение</a>
</div> </div>
<div onclick="technicalSupport()"> <div onclick="technicalSupport(this)">
<img class="svg" src="/static/img/svg/Headset.svg"> <img class="svg" src="/static/img/svg/Headset.svg">
<a href="#">Тех. поддержка</a> <a href="#">Тех. поддержка</a>
</div> </div>
<div onclick="mySubscription()"> <div onclick="mySubscription(this)">
<img class="svg" src="/static/img/svg/CurrencyDollar.svg"> <img class="svg" src="/static/img/svg/CurrencyDollar.svg">
<a href="#">Моя подписка</a> <a href="#">Моя подписка</a>
</div> </div>
<div onclick="myProfile()"> <div onclick="myProfile(this)">
<img class="svg" src="/static/img/svg/User.svg"> <img class="svg" src="/static/img/svg/User.svg">
<a href="#">Мой профиль</a> <a href="#">Мой профиль</a>
</div> </div>