0.0.60 optimization
This commit is contained in:
@@ -1149,11 +1149,10 @@ input#id_cargo_type{
|
||||
width: 59%;
|
||||
height: 280px;
|
||||
display: inline-block;
|
||||
|
||||
}
|
||||
|
||||
.route_info_point {
|
||||
width: 462px;
|
||||
width: 96%;
|
||||
height: 60px;
|
||||
border-radius: 10px;
|
||||
background: #F8F8F8;
|
||||
@@ -1215,12 +1214,11 @@ button#remove_route {
|
||||
height: 44px;
|
||||
width: 285px;
|
||||
}
|
||||
.confirm_remove{
|
||||
width: 43% !important;
|
||||
button.confirm_remove{
|
||||
width: 46% !important;
|
||||
background: #ff0000a8;
|
||||
border-radius: 10px;
|
||||
color: white;
|
||||
font-size: 18px;
|
||||
font-style: normal;
|
||||
font-weight: 600;
|
||||
|
||||
@@ -1229,11 +1227,10 @@ button#remove_route {
|
||||
}
|
||||
button.cancel_remove{
|
||||
height: 44px;
|
||||
width: 43%;
|
||||
width: 45%;
|
||||
background: #808080cc;
|
||||
border-radius: 10px;
|
||||
color: white;
|
||||
font-size: 18px;
|
||||
font-style: normal;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
@@ -1,95 +0,0 @@
|
||||
function searchTown(el){
|
||||
|
||||
let timer = null
|
||||
if (timer) {
|
||||
clearTimeout(timer);
|
||||
}
|
||||
timer = setTimeout(function(){
|
||||
|
||||
timer = null;
|
||||
let form = el.form;
|
||||
let type_transport = form['type_transport'].value;
|
||||
let search_str = el.value;
|
||||
let get_address_point = new Object({type_transport, search_str});
|
||||
get_address_point['ctrl_name'] = el.name;
|
||||
|
||||
$.ajax({
|
||||
headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() },
|
||||
url: '/ru/reference_data/get_address_point/',
|
||||
type: "POST",
|
||||
// async: true,
|
||||
cache: false,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
// enctype: 'json',
|
||||
data: JSON.stringify(get_address_point),
|
||||
success: function(data){
|
||||
return insertSearchList(data, el.name + '_list')
|
||||
},
|
||||
error: function (data){
|
||||
|
||||
console.log('Error')
|
||||
|
||||
}
|
||||
});
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function selectItemAddrPoint(id, name, ctrl_name,){
|
||||
let input_list = document.getElementsByName(ctrl_name + '_list')[0];
|
||||
let tap_txt_cont = document.querySelector("#id_" + ctrl_name);
|
||||
tap_txt_cont.value = name;
|
||||
let tap_cont = document.querySelector("#id_" + ctrl_name.slice(0, -4));
|
||||
tap_cont.value = id;
|
||||
|
||||
input_list.classList.remove('show');
|
||||
|
||||
}
|
||||
|
||||
|
||||
function insertSearchList(data, ctrl_name) {
|
||||
|
||||
let input_list = document.getElementsByName(ctrl_name)[0];
|
||||
let divs = data.res_search_list;
|
||||
|
||||
if (divs.length > 0) {
|
||||
input_list.classList.add("show");
|
||||
input_list.innerHTML = divs;
|
||||
} else {
|
||||
input_list.classList.remove("show");
|
||||
}
|
||||
|
||||
}
|
||||
function showSearchList() {
|
||||
let input_list = document.getElementsByClassName('input_list');
|
||||
if(input_list.classList.contains('show')){
|
||||
input_list.classList.add("show");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function onblurInputField(event,el){
|
||||
|
||||
// if(el.classList.contains("from_country_container")){
|
||||
let search_list = document.getElementsByName(el.name + '_list')[0];
|
||||
let parent_event = $(event.explicitOriginalTarget).parents('.input_list' );
|
||||
if(!parent_event || parent_event[0] !== search_list){
|
||||
|
||||
search_list.classList.remove('show')
|
||||
}
|
||||
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
// function hideErrorMsg(el) {
|
||||
// let hide_element = document.querySelector()
|
||||
// if(el.value !== 0){
|
||||
// hide_element.classList.add('hide')
|
||||
// }
|
||||
//
|
||||
// }
|
||||
@@ -1,73 +0,0 @@
|
||||
function createRoute(){
|
||||
|
||||
$.ajax({
|
||||
headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() },
|
||||
url: '/ru/user_account/new_route_view/',
|
||||
type: "POST",
|
||||
// async: true,
|
||||
cache: false,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
// enctype: 'json',
|
||||
// data: {},
|
||||
success: function(data){
|
||||
// console.log('data received')
|
||||
// location.href = '/profile'
|
||||
document.querySelector(".info_profile").innerHTML = data.html
|
||||
|
||||
$(document).ready(function (e){
|
||||
$('#id_weight').ionRangeSlider({
|
||||
skin: "round",
|
||||
type: "single",
|
||||
min: 0,
|
||||
max: 1000,
|
||||
from: 100,
|
||||
step: 1,
|
||||
grid: true,
|
||||
grid_num: 5,
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
//get dynamic value
|
||||
// let fromCountry = document.getElementById('id_from_country');
|
||||
// let toCounytry = document.getElementById('id_to_country')
|
||||
//
|
||||
// toCounytry.oninput = function (){
|
||||
// console.log(toCounytry.value)
|
||||
// }
|
||||
// fromCountry.oninput = function (){
|
||||
// console.log(fromCountry.value)
|
||||
//
|
||||
// };
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function getRoute(){
|
||||
$.ajax({
|
||||
headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() },
|
||||
url: '/ru/routes/get_routes/',
|
||||
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(101)
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,52 +0,0 @@
|
||||
|
||||
|
||||
$(document).ready(function (e){
|
||||
$('#id_weight').ionRangeSlider({
|
||||
skin: "round",
|
||||
type: "single",
|
||||
min: 0,
|
||||
max: 1000,
|
||||
from: 0,
|
||||
step: 1,
|
||||
grid: true,
|
||||
grid_num: 5,
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
//
|
||||
// var RangeSlider = function () {
|
||||
//
|
||||
// // Private functions
|
||||
// var demos = function () {
|
||||
// // basic demo
|
||||
// $('#id_weight').ionRangeSlider({
|
||||
// skin: "round",
|
||||
// type: "single",
|
||||
// min: 0,
|
||||
// max: 1000,
|
||||
// from: 0,
|
||||
// step: 1,
|
||||
// grid: true,
|
||||
// grid_num: 5,
|
||||
// });
|
||||
//
|
||||
// }
|
||||
//
|
||||
// return {
|
||||
// // public functions
|
||||
// init: function() {
|
||||
// demos();
|
||||
// }
|
||||
// };
|
||||
// }();
|
||||
//
|
||||
// jQuery(document).ready(function() {
|
||||
// RangeSlider.init();
|
||||
// });
|
||||
|
||||
|
||||
|
||||
@@ -1,87 +0,0 @@
|
||||
function sendRoute(el){
|
||||
event.preventDefault()
|
||||
let form = el.form;
|
||||
let formData = new FormData(form);
|
||||
|
||||
$.ajax({
|
||||
headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() },
|
||||
url: '/ru/routes/create_route/',
|
||||
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){
|
||||
document.querySelector(".info_profile").innerHTML = data.responseJSON.html;
|
||||
|
||||
|
||||
|
||||
$('#id_weight').ionRangeSlider({
|
||||
skin: "round",
|
||||
type: "single",
|
||||
min: 0,
|
||||
max: 1000,
|
||||
step: 1,
|
||||
grid: true,
|
||||
grid_num: 5,
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
//cleaning route inputs after selection changes
|
||||
function OnSelectionChange(el) {
|
||||
event.preventDefault()
|
||||
|
||||
let form = el.form;
|
||||
let formData = new FormData(form);
|
||||
|
||||
$.ajax({
|
||||
headers: {"X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val()},
|
||||
url: '/ru/user_account/new_route_view/',
|
||||
type: "POST",
|
||||
// async: true,
|
||||
cache: false,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
// enctype: 'json',
|
||||
data: formData,
|
||||
success: function (data) {
|
||||
console.log('data.html');
|
||||
// location.href = '/profile'
|
||||
document.querySelector(".info_profile").innerHTML = data.html
|
||||
//
|
||||
|
||||
$('#id_weight').ionRangeSlider({
|
||||
skin: "round",
|
||||
type: "single",
|
||||
min: 0,
|
||||
max: 1000,
|
||||
from: 0,
|
||||
step: 1,
|
||||
grid: true,
|
||||
grid_num: 5,
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -95,17 +95,278 @@ function myProfile(){
|
||||
}
|
||||
|
||||
function confirmRemove(el) {
|
||||
let place = document.querySelector('.button_remove_route')
|
||||
|
||||
// let new_button = document.querySelector('.cancel_remove')
|
||||
// if(!button){
|
||||
// if(!new_button){
|
||||
|
||||
// }
|
||||
if(!el.classList.contains('confirm_remove')){
|
||||
el.classList.add('confirm_remove')
|
||||
el.innerText = 'Подтвердить удаление'
|
||||
let place = document.querySelector('.button_remove_route')
|
||||
let cancel_button = document.createElement('button')
|
||||
cancel_button.className = "cancel_remove";
|
||||
cancel_button.innerText = "Отменить удаление";
|
||||
place.appendChild(cancel_button);
|
||||
}
|
||||
}
|
||||
|
||||
function searchTown(el){
|
||||
|
||||
let timer = null
|
||||
if (timer) {
|
||||
clearTimeout(timer);
|
||||
}
|
||||
timer = setTimeout(function(){
|
||||
|
||||
timer = null;
|
||||
let form = el.form;
|
||||
let type_transport = form['type_transport'].value;
|
||||
let search_str = el.value;
|
||||
let get_address_point = new Object({type_transport, search_str});
|
||||
get_address_point['ctrl_name'] = el.name;
|
||||
|
||||
$.ajax({
|
||||
headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() },
|
||||
url: '/ru/reference_data/get_address_point/',
|
||||
type: "POST",
|
||||
// async: true,
|
||||
cache: false,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
// enctype: 'json',
|
||||
data: JSON.stringify(get_address_point),
|
||||
success: function(data){
|
||||
return insertSearchList(data, el.name + '_list')
|
||||
},
|
||||
error: function (data){
|
||||
|
||||
console.log('Error')
|
||||
|
||||
}
|
||||
});
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function selectItemAddrPoint(id, name, ctrl_name,){
|
||||
let input_list = document.getElementsByName(ctrl_name + '_list')[0];
|
||||
let tap_txt_cont = document.querySelector("#id_" + ctrl_name);
|
||||
tap_txt_cont.value = name;
|
||||
let tap_cont = document.querySelector("#id_" + ctrl_name.slice(0, -4));
|
||||
tap_cont.value = id;
|
||||
|
||||
input_list.classList.remove('show');
|
||||
|
||||
}
|
||||
|
||||
|
||||
function insertSearchList(data, ctrl_name) {
|
||||
|
||||
let input_list = document.getElementsByName(ctrl_name)[0];
|
||||
let divs = data.res_search_list;
|
||||
|
||||
if (divs.length > 0) {
|
||||
input_list.classList.add("show");
|
||||
input_list.innerHTML = divs;
|
||||
} else {
|
||||
input_list.classList.remove("show");
|
||||
}
|
||||
|
||||
}
|
||||
function showSearchList() {
|
||||
let input_list = document.getElementsByClassName('input_list');
|
||||
if(input_list.classList.contains('show')){
|
||||
input_list.classList.add("show");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function onblurInputField(event,el){
|
||||
|
||||
// if(el.classList.contains("from_country_container")){
|
||||
let search_list = document.getElementsByName(el.name + '_list')[0];
|
||||
let parent_event = $(event.explicitOriginalTarget).parents('.input_list' );
|
||||
if(!parent_event || parent_event[0] !== search_list){
|
||||
|
||||
search_list.classList.remove('show')
|
||||
}
|
||||
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
// function hideErrorMsg(el) {
|
||||
// let hide_element = document.querySelector()
|
||||
// if(el.value !== 0){
|
||||
// hide_element.classList.add('hide')
|
||||
// }
|
||||
//
|
||||
// }
|
||||
|
||||
|
||||
function sendRoute(el){
|
||||
event.preventDefault()
|
||||
let form = el.form;
|
||||
let formData = new FormData(form);
|
||||
|
||||
$.ajax({
|
||||
headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() },
|
||||
url: '/ru/routes/create_route/',
|
||||
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){
|
||||
document.querySelector(".info_profile").innerHTML = data.responseJSON.html;
|
||||
|
||||
|
||||
|
||||
$('#id_weight').ionRangeSlider({
|
||||
skin: "round",
|
||||
type: "single",
|
||||
min: 0,
|
||||
max: 1000,
|
||||
step: 1,
|
||||
grid: true,
|
||||
grid_num: 5,
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
//cleaning route inputs after selection changes
|
||||
function OnSelectionChange(el) {
|
||||
event.preventDefault()
|
||||
|
||||
let form = el.form;
|
||||
let formData = new FormData(form);
|
||||
|
||||
$.ajax({
|
||||
headers: {"X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val()},
|
||||
url: '/ru/user_account/new_route_view/',
|
||||
type: "POST",
|
||||
// async: true,
|
||||
cache: false,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
// enctype: 'json',
|
||||
data: formData,
|
||||
success: function (data) {
|
||||
console.log('data.html');
|
||||
// location.href = '/profile'
|
||||
document.querySelector(".info_profile").innerHTML = data.html
|
||||
//
|
||||
|
||||
$('#id_weight').ionRangeSlider({
|
||||
skin: "round",
|
||||
type: "single",
|
||||
min: 0,
|
||||
max: 1000,
|
||||
from: 0,
|
||||
step: 1,
|
||||
grid: true,
|
||||
grid_num: 5,
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
function createRoute(){
|
||||
|
||||
$.ajax({
|
||||
headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() },
|
||||
url: '/ru/user_account/new_route_view/',
|
||||
type: "POST",
|
||||
// async: true,
|
||||
cache: false,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
// enctype: 'json',
|
||||
// data: {},
|
||||
success: function(data){
|
||||
// console.log('data received')
|
||||
// location.href = '/profile'
|
||||
document.querySelector(".info_profile").innerHTML = data.html
|
||||
|
||||
$(document).ready(function (e){
|
||||
$('#id_weight').ionRangeSlider({
|
||||
skin: "round",
|
||||
type: "single",
|
||||
min: 0,
|
||||
max: 1000,
|
||||
from: 100,
|
||||
step: 1,
|
||||
grid: true,
|
||||
grid_num: 5,
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
//get dynamic value
|
||||
// let fromCountry = document.getElementById('id_from_country');
|
||||
// let toCounytry = document.getElementById('id_to_country')
|
||||
//
|
||||
// toCounytry.oninput = function (){
|
||||
// console.log(toCounytry.value)
|
||||
// }
|
||||
// fromCountry.oninput = function (){
|
||||
// console.log(fromCountry.value)
|
||||
//
|
||||
// };
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function getRoute(){
|
||||
$.ajax({
|
||||
headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() },
|
||||
url: '/ru/routes/get_routes/',
|
||||
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(101)
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
el.classList.add('confirm_remove')
|
||||
el.innerText = 'Подтвердить удаление'
|
||||
|
||||
}
|
||||
@@ -2,11 +2,6 @@
|
||||
<script src='{% static "js/jquery_v3_6_4.js" %}'> </script>
|
||||
<script src='{% static "js/registration.js" %}'></script>
|
||||
<script src='{% static "js/authorization.js" %}'></script>
|
||||
<script src='{% static "js/newRoute.js" %}'></script>
|
||||
<script src='{% static "js/sendRoute.js" %}'></script>
|
||||
|
||||
<script src='{% static "js/rangeSlider.js" %}'></script>
|
||||
<script src='{% static "js/sendRoute.js" %}'></script>
|
||||
<script src='{% static "js/ion.rangeSlider.min.js" %}'></script>
|
||||
|
||||
<link rel="stylesheet" href="{% static 'css/styles.css' %}">
|
||||
|
||||
@@ -3,12 +3,8 @@
|
||||
|
||||
|
||||
{% block meta %}
|
||||
<script src='{% static "js/newRoute.js" %}'></script>
|
||||
<script src='{% static "js/rangeSlider.js" %}'></script>
|
||||
<script src='{% static "js/sendRoute.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/autocomlite.js" %}'> </script>
|
||||
<script src='{% static "js/user_profile.js" %}'> </script>
|
||||
|
||||
<link rel="stylesheet" href="{% static 'css/ion.rangeSlider.min.css' %}">
|
||||
|
||||
Reference in New Issue
Block a user