Merge remote-tracking branch 'origin/main'
This commit is contained in:
@@ -74,6 +74,29 @@ class Route(BaseModel):
|
||||
verbose_name_plural = _(u'Маршруты')
|
||||
ordering = ('name',)
|
||||
|
||||
def from_country_n_city_str(self):
|
||||
country = 'Неизвестно'
|
||||
if self.from_city:
|
||||
city = self.from_city.name
|
||||
if self.from_city.country:
|
||||
country = self.from_city.country
|
||||
else:
|
||||
city = 'Неизвестно'
|
||||
|
||||
return f'{city} / {country}'
|
||||
|
||||
def to_country_n_city_str(self):
|
||||
country = 'Неизвестно'
|
||||
if self.to_city:
|
||||
city = self.to_city.name
|
||||
if self.to_city.country:
|
||||
country = self.to_city.country
|
||||
else:
|
||||
city = 'Неизвестно'
|
||||
|
||||
return f'{city} / {country}'
|
||||
|
||||
|
||||
def get_address_points(self):
|
||||
from ReferenceDataApp.models import Airport, City
|
||||
|
||||
|
||||
@@ -1632,25 +1632,26 @@ button#remove_route {
|
||||
}
|
||||
button.confirm_remove{
|
||||
width: 49% !important;
|
||||
background: #ff0000a8;
|
||||
border: 1px solid #ff0000a8;
|
||||
border-radius: 10px;
|
||||
color: white;
|
||||
color: #ff0000a8;
|
||||
font-style: normal;
|
||||
font-weight: 600;
|
||||
margin-right: 3px;
|
||||
padding: 5px 0px 5px 0px;
|
||||
|
||||
|
||||
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
button.cancel_remove{
|
||||
width: 48%;
|
||||
background: #808080cc;
|
||||
border: 1px solid #808080cc;
|
||||
border-radius: 10px;
|
||||
color: white;
|
||||
color: #808080cc;
|
||||
font-style: normal;
|
||||
font-weight: 600;
|
||||
padding: 5px 0px 5px 0px;
|
||||
font-size: 16px;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -153,32 +153,92 @@ function myProfile(el){
|
||||
|
||||
|
||||
|
||||
function removeRoute(el) {
|
||||
let data = el.currentTarget.closest('.carrier-card');
|
||||
let remove_item = data.dataset.numberOfRoute
|
||||
let remove_data = {}
|
||||
let name_route = 'route_id'
|
||||
remove_data[name_route] = remove_item
|
||||
|
||||
// console.log(remove_item)
|
||||
|
||||
$.ajax({
|
||||
headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() },
|
||||
url: '/ru/routes/del_route/',
|
||||
type: "POST",
|
||||
// async: true,
|
||||
cache: false,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
// enctype: 'json',
|
||||
data: JSON.stringify(remove_data) ,
|
||||
success: function(data){
|
||||
if (data.user_alerts) {
|
||||
getNewMessageSession()
|
||||
}
|
||||
|
||||
// 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
|
||||
window.history.pushState(null, null, '/ru/profile/page/change_profile/')
|
||||
|
||||
|
||||
},
|
||||
error: function (data, exception){
|
||||
console.log(400)
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
function cancelRemove() {
|
||||
let parent_cancel_button = document.querySelector('.button_remove_route')
|
||||
let cancel_button = document.querySelector('.cancel_remove')
|
||||
parent_cancel_button.removeChild(cancel_button)
|
||||
|
||||
let remove_button = document.querySelector('.confirm_remove');
|
||||
remove_button.classList.remove('confirm_remove');
|
||||
remove_button.innerText = 'Удалить';
|
||||
remove_button.setAttribute("id", "remove_route");
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
function confirmRemove(el) {
|
||||
|
||||
// let new_button = document.querySelector('.cancel_remove')
|
||||
// if(!new_button){
|
||||
|
||||
// }
|
||||
el.setAttribute("id", "select-remove");
|
||||
let btn = document.querySelector("#select-remove");
|
||||
|
||||
if(!btn.classList.contains('confirm_remove')){
|
||||
btn.classList.add('confirm_remove')
|
||||
btn.innerText = 'Подтвердить удаление'
|
||||
// let place = document.querySelector('.button_remove_route')
|
||||
let cancel_button = document.createElement('button')
|
||||
if (!btn.classList.contains('confirm_remove')) {
|
||||
btn.classList.add('confirm_remove');
|
||||
btn.innerText = 'Подтвердить удаление';
|
||||
btn.addEventListener('click', removeRoute, { once: true });
|
||||
|
||||
let cancel_button = document.createElement('button');
|
||||
cancel_button.className = "cancel_remove";
|
||||
cancel_button.innerText = "Отменить удаление";
|
||||
let place = btn.closest(".button_remove_route")
|
||||
cancel_button.addEventListener('click', cancelRemove)
|
||||
|
||||
|
||||
let place = btn.closest(".button_remove_route");
|
||||
place.insertBefore(cancel_button, btn.nextSibling);
|
||||
|
||||
btn.removeAttribute( "select-remove");
|
||||
|
||||
|
||||
}
|
||||
btn.removeAttribute("id", "select-remove")
|
||||
}
|
||||
|
||||
|
||||
|
||||
function searchTown(el){
|
||||
|
||||
if (el.value.length > 0){
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<div onmousedown='selectItemAddrPoint({{ id }}, "{{ fullname }}", "{{ ctrl_name }}")' class="autocomplete-result" data-index="{{ index }}">
|
||||
{% if airport_fullname %}<div>{{ airport_fullname|safe }}</div>{% endif %}
|
||||
<div class="autocomplete-location">{{ country_name }} / {{ city_name }}</div>
|
||||
<div class="autocomplete-location">{{ city_name }} / {{ country_name }}</div>
|
||||
</div>
|
||||
@@ -11,12 +11,12 @@
|
||||
<div class="clear_both"></div>
|
||||
</div>
|
||||
<div class="from-to-country-container-carrier">
|
||||
<div class="from-to-country-text left fl-left txt-al-right" title="{% if route.from_country %}{{ route.from_country }}{% else %}Неизвестно{% endif %} / {% if route.from_city %}{{ route.from_city }}{% else %}Неизвестно{% endif %}">
|
||||
{% if route.from_country %}{{ route.from_country }}{% else %}Неизвестно{% endif %} / {% if route.from_city %}{{ route.from_city }}{% else %}Неизвестно{% endif %}
|
||||
<div class="from-to-country-text left fl-left txt-al-right" title="{{ route.from_country_n_city_str }}">
|
||||
{{ route.from_country_n_city_str }}
|
||||
</div>
|
||||
<div class="splitter-from-to-country"></div>
|
||||
<div class="from-to-country-text right fl-right txt-al-left" title="{% if route.to_country %}{{ route.to_country }}{% else %}Неизвестно{% endif %} / {% if route.to_city %}{{ route.to_city }}{% else %}Неизвестно{% endif %}">
|
||||
{% if route.to_country %}{{ route.to_country }}{% else %}Неизвестно{% endif %} / {% if route.to_city %}{{ route.to_city }}{% else %}Неизвестно{% endif %}
|
||||
<div class="from-to-country-text right fl-right txt-al-left" title="{{ route.to_country_n_city_str }}">
|
||||
{{ route.to_country_n_city_str }}
|
||||
</div>
|
||||
</div>
|
||||
{% include "small_INCLUDES/carrier_card/inf_about_moving.html" %}
|
||||
|
||||
@@ -31,12 +31,12 @@
|
||||
|
||||
</div>
|
||||
<div class="from-to-country-container-carrier">
|
||||
<div class="from-to-country-text left fl-left txt-al-right" title="{% if route.from_country %}{{ route.from_country }}{% else %}Неизвестно{% endif %} / {% if route.from_city %}{{ route.from_city }}{% else %}Неизвестно{% endif %}">
|
||||
{% if route.from_country %}{{ route.from_country }}{% else %}Неизвестно{% endif %} / {% if route.from_city %}{{ route.from_city }}{% else %}Неизвестно{% endif %}
|
||||
<div class="from-to-country-text left fl-left txt-al-right" title="{{ route.from_country_n_city_str }}">
|
||||
{{ route.from_country_n_city_str }}
|
||||
</div>
|
||||
<div class="splitter-from-to-country"></div>
|
||||
<div class="from-to-country-text right fl-right txt-al-left" title="{% if route.to_country %}{{ route.to_country }}{% else %}Неизвестно{% endif %} / {% if route.to_city %}{{ route.to_city }}{% else %}Неизвестно{% endif %}">
|
||||
{% if route.to_country %}{{ route.to_country }}{% else %}Неизвестно{% endif %} / {% if route.to_city %}{{ route.to_city }}{% else %}Неизвестно{% endif %}
|
||||
<div class="from-to-country-text right fl-right txt-al-left" title="{{ route.to_country_n_city_str }}">
|
||||
{{ route.to_country_n_city_str }}
|
||||
</div>
|
||||
</div>
|
||||
{% include "small_INCLUDES/carrier_card/inf_about_moving.html" %}
|
||||
@@ -108,21 +108,21 @@
|
||||
|
||||
{#<div class="my_route">#}
|
||||
{# <div class="route_info">#}
|
||||
<div class="route_info_about">
|
||||
<span>
|
||||
Тип:{{ route.get_cargo_type_display }}
|
||||
</span>
|
||||
|
||||
<span>
|
||||
Вес:{{ route.weight }} кг
|
||||
</span>
|
||||
|
||||
<span>
|
||||
|
||||
{{ route.get_type_transport_display }}
|
||||
</span>
|
||||
|
||||
</div>
|
||||
{# <div class="route_info_about">#}
|
||||
{# <span>#}
|
||||
{# Тип:{{ route.get_cargo_type_display }}#}
|
||||
{# </span>#}
|
||||
{##}
|
||||
{# <span>#}
|
||||
{# Вес:{{ route.weight }} кг#}
|
||||
{# </span>#}
|
||||
{##}
|
||||
{# <span>#}
|
||||
{##}
|
||||
{# {{ route.get_type_transport_display }}#}
|
||||
{# </span>#}
|
||||
{##}
|
||||
{# </div>#}
|
||||
{##}
|
||||
{# <div class="route_info_point">#}
|
||||
{##}
|
||||
|
||||
Reference in New Issue
Block a user