diff --git a/static/css/styles.css b/static/css/styles.css index 4ef3b81..9c13a4c 100644 --- a/static/css/styles.css +++ b/static/css/styles.css @@ -1005,7 +1005,6 @@ form.new_route{ .input_list.show{ display:block; - height: 300px; width: 50%; overflow: scroll; } \ No newline at end of file diff --git a/static/js/autocomlitev2.js b/static/js/autocomlitev2.js index 5287eea..3943588 100644 --- a/static/js/autocomlitev2.js +++ b/static/js/autocomlitev2.js @@ -19,49 +19,58 @@ function searchTown(el){ return search(data) }, error: function (data){ - console.log('++') - // document.querySelector(".button_register").innerHTML = data.responseJSON.html + console.log('Error') + } }); } function selectItemAddrPoint(id, name){ - let ap_txt_cont = document.querySelector("#id_from_address_point_txt"); - let ap_cont = document.querySelector("#id_from_address_point"); - ap_txt_cont.value = name; - ap_cont.value = id; + // from_address_point + let fap_txt_cont = document.querySelector("#id_from_address_point_txt"); + let fap_cont = document.querySelector("#id_from_address_point"); + fap_txt_cont.value = name; + fap_cont.value = id; + + //to_address_point + let tap_txt_cont = document.querySelector("#id_to_address_point_txt"); + let tap_cont = document.querySelector("#id_to_address_point"); + + tap_txt_cont.value = name; + tap_cont.value = id; } -function search(data) { - let ac = document.querySelector("#id_from_address_point_txt"); - - if (ac.value.length > 2) { - - let res_data = data.data - - var divs = res_data.map(function(r, i) { - airport_name = "'"+r.iata_code + " - " + r.name+"'"; - - return '
' - + '
'+ r.iata_code +' - '+ r.name +'
' - + '
'+ r.city__name +', '+ r.city__country__name +'
' - + '
'; - }); - - - let input_list = document.querySelector(".input_list"); - input_list.classList.toggle("show") - input_list.innerHTML = divs - - - // .html(divs.join('')) - // .attr('data-highlight', selectedIndex); - - } else { - numResults = 0; - let divs = []; - - } -} \ No newline at end of file +// function search(data) { +// +// let ac = document.querySelector("#id_from_address_point_txt"); +// +// if (ac.value.length > 2) { +// +// let res_data = data.data +// +// var divs = res_data.map(function(r, i) { +// airport_name = "'"+r.iata_code + " - " + r.name+"'"; +// +// return '
' +// + '
'+ r.iata_code +' - '+ r.name +'
' +// + '
'+ r.city__name +', '+ r.city__country__name +'
' +// + '
'; +// }); +// +// +// let input_list = document.querySelector(".input_list"); +// input_list.classList.toggle("show") +// input_list.innerHTML = divs +// +// +// // .html(divs.join('')) +// // .attr('data-highlight', selectedIndex); +// +// } else { +// numResults = 0; +// let divs = []; +// +// } +// } \ No newline at end of file diff --git a/templates/blocks/profile/b_new_route.html b/templates/blocks/profile/b_new_route.html index 95efad6..a76a4dd 100644 --- a/templates/blocks/profile/b_new_route.html +++ b/templates/blocks/profile/b_new_route.html @@ -42,17 +42,23 @@ -
+
+ {% include 'widgets/w_autocomplete_input.html' %} +
{% if form.errors and form.errors.from_address_point %} {{ form.errors.from_address_point}} {% endif %}
- + + +
+ {% include 'widgets/w_autocomplete_input.html' %} +
{% if form.errors and form.errors.to_address_point %} - {{ form.errors.to_address_point }} - {% endif %} + {{ form.errors.to_address_point }} + {% endif %}
{#
#} diff --git a/templates/widgets/w_autocomplete_input.html b/templates/widgets/w_autocomplete_input.html new file mode 100644 index 0000000..df4c10b --- /dev/null +++ b/templates/widgets/w_autocomplete_input.html @@ -0,0 +1,6 @@ +
+
+ +
+
+
\ No newline at end of file