0.0.30 upd autocomlitev2.js
This commit is contained in:
@@ -16,7 +16,7 @@ function searchTown(el){
|
||||
// enctype: 'json',
|
||||
data: JSON.stringify(get_address_point),
|
||||
success: function(data){
|
||||
return search(data)
|
||||
return insertSearchList(data, el.name)
|
||||
},
|
||||
error: function (data){
|
||||
console.log('Error')
|
||||
@@ -42,35 +42,37 @@ function selectItemAddrPoint(id, name){
|
||||
}
|
||||
|
||||
|
||||
// function search(data) {
|
||||
//
|
||||
// let ac = document.querySelector("#id_from_address_point_txt");
|
||||
function insertSearchList(data, ctrl_name) {
|
||||
|
||||
// let ac = document.querySelector("#id_from_address_point_txt");
|
||||
let divs = data.res_search_list;
|
||||
let input_list = document.querySelector(".input_list[name=ctrl_name]");
|
||||
input_list.classList.toggle("show");
|
||||
input_list.innerHTML = divs
|
||||
//
|
||||
// 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 '<div onclick="selectItemAddrPoint('+ r.id+', '+ airport_name +')" class="autocomplete-result" data-index="'+ i +'" data-id="'+ r.id + '">'
|
||||
// + '<div><b>'+ r.iata_code +'</b> - '+ r.name +'</div>'
|
||||
// + '<div class="autocomplete-location">'+ r.city__name +', '+ r.city__country__name +'</div>'
|
||||
// + '</div>';
|
||||
// });
|
||||
//
|
||||
//
|
||||
// let input_list = document.querySelector(".input_list");
|
||||
// input_list.classList.toggle("show")
|
||||
// input_list.innerHTML = divs
|
||||
//
|
||||
//
|
||||
// // .html(divs.join(''))
|
||||
// // .attr('data-highlight', selectedIndex);
|
||||
//
|
||||
// //
|
||||
// // let res_data = data.data
|
||||
// //
|
||||
// // var divs = res_data.map(function(r, i) {
|
||||
// // airport_name = "'"+r.iata_code + " - " + r.name+"'";
|
||||
// //
|
||||
// // return '<div onclick="selectItemAddrPoint('+ r.id+', '+ airport_name +')" class="autocomplete-result" data-index="'+ i +'" data-id="'+ r.id + '">'
|
||||
// // + '<div><b>'+ r.iata_code +'</b> - '+ r.name +'</div>'
|
||||
// // + '<div class="autocomplete-location">'+ r.city__name +', '+ r.city__country__name +'</div>'
|
||||
// // + '</div>';
|
||||
// // });
|
||||
// //
|
||||
// //
|
||||
// //
|
||||
// //
|
||||
// //
|
||||
// // // .html(divs.join(''))
|
||||
// // // .attr('data-highlight', selectedIndex);
|
||||
// //
|
||||
// } else {
|
||||
// numResults = 0;
|
||||
// let divs = [];
|
||||
//
|
||||
// }
|
||||
// }
|
||||
}
|
||||
@@ -42,7 +42,7 @@
|
||||
<label for="id_from_address_point">{{ form.fields.from_address_point.label }}</label>
|
||||
<input type="number" name="from_address_point" id="id_from_address_point" hidden />
|
||||
<input oninput="searchTown(this)" type="text" name="from_address_point_txt"{% if form.fields.from_address_point.required %} required{% endif %} id="id_from_address_point_txt">
|
||||
<div class="input_list" name="from_address_point_txt">
|
||||
<div class="input_list" name="from_address_point_txt_list">
|
||||
{% include 'widgets/w_ac_input_address_point.html' %}
|
||||
</div>
|
||||
{% if form.errors and form.errors.from_address_point %}
|
||||
@@ -53,7 +53,7 @@
|
||||
<label for="id_to_address_point">{{ form.fields.to_address_point.label }}</label>
|
||||
<input type="number" name="to_address_point" id="id_to_address_point" hidden />
|
||||
<input oninput="searchTown(this)" type="text" name="to_address_point_txt"{% if form.fields.to_address_point.required %} required{% endif %} id="id_to_address_point"/>
|
||||
<div class="input_list" name="from_address_point_txt">
|
||||
<div class="input_list" name="to_address_point_txt_list">
|
||||
{% include 'widgets/w_ac_input_address_point.html' %}
|
||||
</div>
|
||||
{% if form.errors and form.errors.to_address_point %}
|
||||
|
||||
Reference in New Issue
Block a user