diff --git a/static/css/styles.css b/static/css/styles.css index 9c13a4c..34166ab 100644 --- a/static/css/styles.css +++ b/static/css/styles.css @@ -1006,5 +1006,6 @@ form.new_route{ .input_list.show{ display:block; width: 50%; + height: 200px; overflow: scroll; } \ No newline at end of file diff --git a/static/js/autocomlitev2.js b/static/js/autocomlitev2.js index c539222..0474c7d 100644 --- a/static/js/autocomlitev2.js +++ b/static/js/autocomlitev2.js @@ -5,6 +5,11 @@ function searchTown(el){ 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/', @@ -26,24 +31,34 @@ function searchTown(el){ } function selectItemAddrPoint(id, name, ctrl_name){ + //reset value + + if (ctrl_name.startsWith("from")){ + let fap_txt_cont = document.querySelector("#id_" + ctrl_name); + let fap_cont = document.querySelector("#id_" + ctrl_name.slice(0, -4)); + fap_txt_cont.value = name; + fap_cont.value = id; + } + else if (ctrl_name.startsWith("to")) { + 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; + } + + + + - let fap_txt_cont = document.querySelector("#id_" + ctrl_name); - let fap_cont = document.querySelector("#id_" + ctrl_name.slice(0, -4)); - fap_txt_cont.value = name; - fap_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; + + //to_address_point + @@ -56,7 +71,7 @@ function insertSearchList(data, ctrl_name) { let divs = data.res_search_list; let input_list = document.getElementsByName(ctrl_name)[0]; input_list.classList.add("show"); - input_list.innerHTML = divs + input_list.innerHTML = divs; // // if (ac.value.length > 2) { // // diff --git a/templates/blocks/profile/b_new_route.html b/templates/blocks/profile/b_new_route.html index 88500de..a3e5289 100644 --- a/templates/blocks/profile/b_new_route.html +++ b/templates/blocks/profile/b_new_route.html @@ -39,22 +39,22 @@
- - - -
- {% include 'widgets/w_ac_input_address_point.html' %} -
- {% if form.errors and form.errors.from_address_point %} - {{ form.errors.from_address_point}} - {% endif %} + + + +
+ +
+ {% if form.errors and form.errors.from_address_point %} + {{ form.errors.from_address_point}} + {% endif %}
- {% include 'widgets/w_ac_input_address_point.html' %} +
{% if form.errors and form.errors.to_address_point %} {{ form.errors.to_address_point }}