diff --git a/requirements.pip b/requirements.pip
index 8330467..f4632b1 100644
--- a/requirements.pip
+++ b/requirements.pip
@@ -3,6 +3,6 @@ django-ckeditor==6.5.1
psycopg2-binary==2.9.6
requests
Pillow
-django-modeltranslation=0.18.10
+django-modeltranslation
overpass
geopy
\ No newline at end of file
diff --git a/static/js/autocomlitev2.js b/static/js/autocomlitev2.js
new file mode 100644
index 0000000..b0ae835
--- /dev/null
+++ b/static/js/autocomlitev2.js
@@ -0,0 +1,53 @@
+function searchTown(el){
+ 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})
+
+
+ $.ajax({
+ headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() },
+ url: '/reference_data/get_address_point/',
+ type: "POST",
+ // async: true,
+ cache: false,
+ processData: false,
+ contentType: false,
+ // enctype: 'json',
+ data: get_address_point,
+ success: function(data){
+ return data;
+ },
+ error: function (data){
+ console.log('++')
+ // document.querySelector(".button_register").innerHTML = data.responseJSON.html
+ }
+ });
+}
+
+
+
+function search(e) {
+
+ let ac = document.querySelector("#id_from_country")
+
+ if (ac.value.length > 0) {
+
+ let results = searchTown(ac);
+
+ var divs = results.map()(function(r, i) {
+ return '
'
+ + '
'+ r.iata +' - '+ r.name +'
'
+ + '
'+ r.city +', '+ r.country +'
'
+ + '
';
+ });
+
+ selectedIndex = -1;
+ list.html(divs.join(''))
+ .attr('data-highlight', selectedIndex);
+
+ } else {
+ numResults = 0;
+ list.empty();
+ }
+}
\ No newline at end of file
diff --git a/static/js/autocomplete.js b/static/js/autocomplete.js
index edec1e3..027b924 100644
--- a/static/js/autocomplete.js
+++ b/static/js/autocomplete.js
@@ -18,25 +18,27 @@
function searchTown(el){
let form = el.form;
- let formData = new FormData(form);
+ let type_transport = form['type_transport'].value;
+ let search_str = el.value;
+ let get_address_point = new Object({type_transport, search_str})
+
$.ajax({
headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() },
- url: '/ru/routes/create_route/',
+ url: '/reference_data/get_address_point/',
type: "POST",
// async: true,
cache: false,
processData: false,
contentType: false,
// enctype: 'json',
- data: formData,
+ data: get_address_point,
success: function(data){
- console.log('data received')
- // location.href = '/profile'
- document.querySelector(".info_profile").innerHTML = data.html
+ return data;
},
- error: function (data, exception){
- document.querySelector(".button_register").innerHTML = data.responseJSON.html
+ error: function (data){
+ console.log('++')
+ // document.querySelector(".button_register").innerHTML = data.responseJSON.html
}
});
}
@@ -45,7 +47,7 @@ var ac = $('#id_from_country')
.on('click', function(e) {
e.stopPropagation();
})
- .on('focus keyup', search)
+ .on('keyup', search)
.on('keydown', onKeyDown);
var wrap = $('')
@@ -93,13 +95,15 @@ function search(e) {
return;
}
- if (ac.val().length > 0) {
+ let ac = document.querySelector("#id_from_country")
+
+ if (ac.value.length > 0) {
// results = _.take(fuse.search(ac.val()), 7);
// numResults = results.length;
- results = searchTown.success(data);
+ let results = searchTown(ac);
- var divs = results.map(function(r, i) {
+ var divs = results.map()(function(r, i) {
return '
'
+ '
'+ r.iata +' - '+ r.name +'
'
+ '
'+ r.city +', '+ r.country +'
'
diff --git a/static/js/newRoute.js b/static/js/newRoute.js
index edb9cf5..017e6f0 100644
--- a/static/js/newRoute.js
+++ b/static/js/newRoute.js
@@ -11,7 +11,7 @@ function createRoute(){
// enctype: 'json',
// data: {},
success: function(data){
- console.log('data received')
+ // console.log('data received')
// location.href = '/profile'
document.querySelector(".info_profile").innerHTML = data.html
diff --git a/static/js/sendRoute.js b/static/js/sendRoute.js
index 04419bc..782a5ed 100644
--- a/static/js/sendRoute.js
+++ b/static/js/sendRoute.js
@@ -17,9 +17,21 @@ function sendRoute(el){
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,
+ from: 500,
+ step: 1,
+ grid: true,
+ grid_num: 5,
+ });
}
});
}
diff --git a/templates/blocks/profile/b_new_route.html b/templates/blocks/profile/b_new_route.html
index ed6d1dd..3f4011b 100644
--- a/templates/blocks/profile/b_new_route.html
+++ b/templates/blocks/profile/b_new_route.html
@@ -40,7 +40,7 @@