0.0.47 add checkbox

This commit is contained in:
2023-07-27 13:56:15 +03:00
parent 1cf3041e95
commit e420dc17f2
11 changed files with 181 additions and 92 deletions

View File

@@ -1067,4 +1067,14 @@ select#id_cargo_type{
div.from_to_place>div>select{
width: 392px;
}
}
/*my routes*/
.my_route{
display: block ruby;
margin: 15px 5px;
}
/*my routes*/

95
static/js/user_profile.js Normal file
View File

@@ -0,0 +1,95 @@
function writeMessage(){
$.ajax({
headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() },
url: '/ru/user_account/new_msg_to_user/',
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;
},
error: function (data, exception){
console.log(400)
}
});
}
function technicalSupport(){
$.ajax({
headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() },
url: '/ru/user_account/new_msg_to_support/',
type: "POST",
// async: true,
cache: false,
processData: false,
contentType: false,
// enctype: 'json',
// data: formData,
success: function(data){
console.log('data received')
// location.href = '/profile'
document.querySelector(".info_profile").innerHTML = data.html;
},
error: function (data, exception){
console.log(400)
}
});
}
function mySubscription(){
$.ajax({
headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() },
url: '/ru/user_account/subscribe/',
type: "POST",
// async: true,
cache: false,
processData: false,
contentType: false,
// enctype: 'json',
// data: formData,
success: function(data){
console.log('data received')
// location.href = '/profile'
document.querySelector(".info_profile").innerHTML = data.html;
},
error: function (data, exception){
console.log(400)
}
});
}
function myProfile(){
$.ajax({
headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() },
url: '/ru/user_account/change_profile/',
type: "POST",
// async: true,
cache: false,
processData: false,
contentType: false,
// enctype: 'json',
// data: formData,
success: function(data){
console.log('data received')
// location.href = '/profile'
document.querySelector(".info_profile").innerHTML = data.html;
},
error: function (data, exception){
console.log(400)
}
});
}

View File

@@ -13,19 +13,19 @@
<img class="svg" src="/static/img/svg/Cards.svg">
<a href="#">Мои объявления</a>
</div>
<div>
<div onclick="writeMessage()">
<img class="svg" src="/static/img/svg/ChatCircleDots.svg">
<a href="#">Написать сообщение</a>
</div>
<div>
<div onclick="technicalSupport()">
<img class="svg" src="/static/img/svg/Headset.svg">
<a href="#">Тех. поддержка</a>
</div>
<div>
<div onclick="mySubscription()">
<img class="svg" src="/static/img/svg/CurrencyDollar.svg">
<a href="#">Моя подписка</a>
</div>
<div>
<div onclick="myProfile()">
<img class="svg" src="/static/img/svg/User.svg">
<a href="#">Мой профиль</a>
</div>

View File

@@ -1,33 +1,3 @@
<div>
{% for route in routes %}
<div class="wraper">
<div class="route_info">
{{ route.get_cargo_type_display }}
{{ route.weight }}
{{ route.get_type_transport_display }}
<div class="route_info_point">
{{ route.from_address_point }}
{{ route.to_adress_point }}
</div>
<div class="route_info_date">
Отправка: {{route.departure_DT }}
Прибытие: {{route.arrival_DT }}
</div>
<div class="route_info_ft_place">
Откуда заберёт:{{ route.from_place }}
Куда доставит:{{ route.to_place }}
</div>
</div>
<div class="route_contact">
</div>
</div>
{% endfor %}
{% include 'widgets/w_route_info.html' %}
</div>

View File

@@ -1,10 +1 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
</body>
</html>
<div>Тех поддрежка</div>

View File

@@ -1,10 +1 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
</body>
</html>
<div>Написать сообщение</div>

View File

@@ -148,25 +148,40 @@
<div>
<label for="id_cargo_type">{{ form.fields.cargo_type.label }}</label>
</div>
<div>
<select
multiple
size="5"
name="cargo_type"
id="id_cargo_type"
{% if form.fields.cargo_type.required %} required{% endif %}>
{% for item in form.fields.cargo_type.choices %}
<option
value="{{ item.0 }}"{% if form.fields.cargo_type == item.0 %}
selected="selected"{% endif %}>{{ item.1 }}
</option>
{% endfor %}
{#<div>#}
{# <select#}
{# multiple#}
{# size="5"#}
{# name="cargo_type"#}
{# id="id_cargo_type"#}
{# {% if form.fields.cargo_type.required %} required{% endif %}>#}
{# {% for item in form.fields.cargo_type.choices %}#}
{# <option#}
{# value="{{ item.0 }}"{% if form.fields.cargo_type == item.0 %}#}
{# selected="selected"{% endif %}>{{ item.1 }}#}
{# </option>#}
{# {% endfor %}#}
{##}
{# </select>#}
</select>
{% if form.errors and form.errors.cargo_type %}
{# </div>#}
<div>
{% for item in form.fields.cargo_type.choices %}
<input
type="checkbox"
name="cargo_type"
id="id_cargo_type"
{% if form.fields.cargo_type.required %} required{% endif %}
value="{{ item.0 }}"
{% if form.fields.cargo_type == item.0 %}
{% endif %}/>{{ item.1 }}
{% endfor %}
{% if form.errors and form.errors.cargo_type %}
<span>{{ form.errors.cargo_type }}</span>
{% endif %}
</div>
</div>
<hr>

View File

@@ -1,10 +1 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
</body>
</html>
<div>Мой профиль</div>

View File

@@ -1,10 +1 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
</body>
</html>
<div>Моя подписка</div>

View File

@@ -9,6 +9,7 @@
<script src='{% static "js/jquery_v3_6_4.js" %}'> </script>
<script src='{% static "js/ion.rangeSlider.min.js" %}'> </script>
<script src='{% static "js/autocomlite.js" %}'> </script>
<script src='{% static "js/user_profile.js" %}'> </script>
<link rel="stylesheet" href="{% static 'css/ion.rangeSlider.min.css' %}">

View File

@@ -0,0 +1,34 @@
{% for route in routes %}
<div class="my_route">
<div class="route_info">
{{ route.get_cargo_type_display }}
{{ route.weight }}
{{ route.get_type_transport_display }}
<div class="route_info_point">
{{ route.from_country }}/{{ route.from_city }}
{{ route.to_country }}/{{ route.to_city }}
</div>
<div class="route_info_date">
Отправка: {{route.departure_DT }}
Прибытие: {{route.arrival_DT }}
</div>
<div class="route_info_ft_place">
Откуда заберёт:{{ route.from_place }}
Куда доставит:{{ route.to_place }}
</div>
</div>
<div class="route_contact">
Контакты перевозчика:
{{ route.owner.last_name }} {{ route.owner.first_name }}
{{ route.phone }}
{{ route.extra_phone }}
{{ route.owner.email }}
</div>
</div>
{% endfor %}