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{ div.from_to_place>div>select{
width: 392px; 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"> <img class="svg" src="/static/img/svg/Cards.svg">
<a href="#">Мои объявления</a> <a href="#">Мои объявления</a>
</div> </div>
<div> <div onclick="writeMessage()">
<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> <div onclick="technicalSupport()">
<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> <div onclick="mySubscription()">
<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> <div onclick="myProfile()">
<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>

View File

@@ -1,33 +1,3 @@
<div> <div>
{% for route in routes %} {% include 'widgets/w_route_info.html' %}
<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 %}
</div> </div>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -9,6 +9,7 @@
<script src='{% static "js/jquery_v3_6_4.js" %}'> </script> <script src='{% static "js/jquery_v3_6_4.js" %}'> </script>
<script src='{% static "js/ion.rangeSlider.min.js" %}'> </script> <script src='{% static "js/ion.rangeSlider.min.js" %}'> </script>
<script src='{% static "js/autocomlite.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' %}"> <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 %}