0.0.33 upd autocomlitev2.js

This commit is contained in:
2023-07-21 16:42:54 +03:00
parent 57780ef93e
commit 63d1661612
3 changed files with 38 additions and 22 deletions

View File

@@ -1006,5 +1006,6 @@ form.new_route{
.input_list.show{
display:block;
width: 50%;
height: 200px;
overflow: scroll;
}

View File

@@ -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) {
// //