This commit is contained in:
2023-08-28 17:21:03 +03:00
parent 0457f1f476
commit 4354d1369d
3 changed files with 25 additions and 3 deletions

View File

@@ -1224,6 +1224,7 @@ form.new_route{
line-height: 22px;
appearance: none;
height: 60px;
padding-left: 10px;
}

View File

@@ -345,9 +345,28 @@ function sliderInit() {
}
function sendRoute(el, routeID = null){
let obj ={}
let selected_owner_type = document.querySelectorAll("#customer, #mover")
selected_owner_type.forEach(function(item) {
if (item.classList.contains('selected')) {
let { id, innerText } = item
obj['owner_type'] = id
}
});
if (selected_owner_type[0].classList.contains('selected')){
}else
event.preventDefault()
let form = el.form;
let formData = new FormData(form);
let data = {
formData,
obj
}
let url = '/ru/routes/create_or_change_route/'
if (routeID !== null){
url = '/ru/routes/change_route/' + routeID + '/'
@@ -362,7 +381,7 @@ function sendRoute(el, routeID = null){
processData: false,
contentType: false,
// enctype: 'json',
data: formData,
data: JSON.stringify(data),
success: function(data){
if (data.user_alerts) {
getNewMessageSession()

View File

@@ -1,3 +1,5 @@
{% load i18n %}
<section class="profile" >
{% csrf_token %}
<div
@@ -7,11 +9,11 @@
<img class="svg" src="/static/img/svg/MagnifyingGlass.svg">
<a href="#">Поиск посылки</a>
</div>
<div onclick="createRoute(this, 'customer')">
<div id="customer" onclick="createRoute(this)">
<img class="svg" src="/static/img/svg/PushPin.svg">
<a href="#">Разместить объявление как отправитель</a>
</div>
<div onclick="createRoute(this, 'mover' )">
<div id="mover" onclick="createRoute(this)">
<img class="svg" src="/static/img/svg/PushPin.svg">
<a href="#">Разместить объявление как перевозчик</a>
</div>