diff --git a/static/css/styles(boris).css b/static/css/styles(boris).css index 8bac9f9..f8d28e0 100644 --- a/static/css/styles(boris).css +++ b/static/css/styles(boris).css @@ -699,9 +699,10 @@ border-left: 1px solid #E6E6E6; display: block; height: 97%; - width: 73%; + width: 63%; border-radius: 0; float: left; + padding: 0 5%; } @@ -720,6 +721,8 @@ .container_inp_w_abr{ height: 66%; + width: 98%; + position: relative; } .cont-el-form-search-carrier > button{ @@ -734,7 +737,7 @@ border: 1px solid #E6E6E6; display: block; height: 20px; - width: 89%; + width: 88%; padding: 20px 10px; } @@ -1292,6 +1295,7 @@ text-align: center; width: 100%; color: #272424; + margin-bottom: 20px; } .method_transport{ @@ -1304,6 +1308,37 @@ position: absolute; } -.method_transport_inp{ +.methods_transportation_form_filters{ + margin-bottom: 20px; +} +.title_el_methods_transportation{ + font-size: 16px; + color: #272424; + font-weight: 500; + margin-bottom: 15px; +} + +.select_form_filters_find_route{ + width: 100%; + margin-top: 10px; +} +.select_form_filters_find_route:focus-visible{ + outline: none; +} + +.insert-airports-place{ + background: #919BA5; + width: 100%; + display: block; + height: 200px; + overflow-y: auto; + position: absolute; + top: 62px; + border-radius: 0 0 10px 10px; + z-index: 10; + display: none; +} +.insert-airports-place.show{ + display: block; } \ No newline at end of file diff --git a/static/img/svg/Airplane.svg b/static/img/svg/Airplane.svg new file mode 100644 index 0000000..c6edec8 --- /dev/null +++ b/static/img/svg/Airplane.svg @@ -0,0 +1,3 @@ + diff --git a/static/img/svg/Car.svg b/static/img/svg/Car.svg new file mode 100644 index 0000000..69aa2b8 --- /dev/null +++ b/static/img/svg/Car.svg @@ -0,0 +1,3 @@ + diff --git a/static/js/chat_sockets.js b/static/js/chat_sockets.js index 2c83d94..3f535cf 100644 --- a/static/js/chat_sockets.js +++ b/static/js/chat_sockets.js @@ -40,11 +40,7 @@ // } // var i = 0 - - -url = `ws://localhost:8000/ws/socket-server/?user_id=${user_id}`; - -const chatSocket = new WebSocket(url); +const chatSocket = new WebSocket(ws_url); function sendMessageSocket (data) { diff --git a/static/js/serch_town.js b/static/js/serch_town.js new file mode 100644 index 0000000..dd868a3 --- /dev/null +++ b/static/js/serch_town.js @@ -0,0 +1,127 @@ +var listener = 0 +var cur_el_ins = null + +function focus_el_ins (el) { + if (el.value.length > 0) { + cur_el_ins = el + } +} + + +function searchTown(el){ + + // document.getElementById('id_from_address_point_txt').style.background = 'white url("/static/img/svg/loader.svg") no-repeat calc(100% - 15px) center'; + // document.getElementById('id_to_address_point_txt').style.background = 'white url("/static/img/svg/loader.svg") no-repeat calc(100% - 15px) center'; + + if(el.value.length >= 3){ + let timer = null + if (timer) { + clearTimeout(timer); + } + let element = el + timer = setTimeout(function(){ + + timer = null; + // let form = el.form; + let type_transport = 'road'; + let search_str = el.value; + let get_address_point = new Object({type_transport, search_str}); + get_address_point['ctrl_name'] = "govno" + get_address_point['for_filter'] = true + + $.ajax({ + headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() }, + url: '/ru/reference_data/get_address_point/', + type: "POST", + // async: true, + cache: false, + processData: false, + contentType: false, + // enctype: 'json', + data: JSON.stringify(get_address_point), + success: function(data){ + // document.getElementById('id_from_address_point_txt').style.background = 'white url("/static/img/png/icon-arrow.svg") no-repeat calc(100% - 15px) center'; + // document.getElementById('id_to_address_point_txt').style.background = 'white url("/static/img/png/icon-arrow.svg") no-repeat calc(100% - 15px) center'; + + + getNewMessageSession() + let insert_place_1 = element.nextSibling + let insert_place_2 = insert_place_1.nextSibling + let insert_place = insert_place_2.nextSibling + if (data.res_search_list !== null || data.res_search_list !== ""){ + insert_place.innerHTML = data.res_search_list + insert_place.nextSibling.classList.add("show") + } else { + if (insert_place.classList.contains("show")){ + insert_place.classList.remove("show") + } + } + listener = 0 + // return insertSearchList(data, el.name + '_list'); + + }, + error: function (data){ + + console.log('Error') + listener = 1 + + } + }); + }, 1500); + } + +} + +function show_list_w_places (el){ + let value = el.value + if (value.length > 0){ + if (listener === 0){ + let listener_ev = document.querySelector("body") + listener_ev.setAttribute('onclick',"listen_body(event)") + } + } +} + +function listen_body (event){ + let input_1 = document.querySelector("#inp_form_find_route_w_abbreviation_1") + let input_2 = document.querySelector("#inp_form_find_route_w_abbreviation_2") + let place_1 = document.querySelectorAll(".insert-airports-place")[0] + let place_2 = document.querySelectorAll(".insert-airports-place")[1] + let list_els = [input_1,input_2,place_1,place_2] + let i = 0 + let true_ev = false + list_els.map(function (){ + if (event.target.id === list_els[i].id){ + console.log("true") + true_ev = true + if (cur_el_ins !== event.target){ + let cur_el_insert_1 = event.target.nextSibling + let cur_el_insert_2 = cur_el_insert_1.nextSibling + let cur_el_insert_3 = cur_el_insert_2.nextSibling + let cur_el_insert = cur_el_insert_3.nextSibling + if (cur_el_insert.classList.contains("show")) { + cur_el_insert.classList.remove("show") + } + } + } + i++ + }) + + if (true_ev === false) { + if (input_1.focus() === true){ + if (place_1.classList.contains("show")){ + place_1.remove("show") + listener++ + } + } else if (input_2.focus === true){ + if (place_2.classList.contains("show")){ + place_2.remove("show") + listener++ + } + } else { + console.log("error") + } + } + +} + diff --git a/templates/pages/p_results_find_route.html b/templates/pages/p_results_find_route.html index 961a2d3..587ab4b 100644 --- a/templates/pages/p_results_find_route.html +++ b/templates/pages/p_results_find_route.html @@ -2,7 +2,8 @@ {% load static %} {% block meta %} - + + {% endblock %} {% block content %} @@ -11,19 +12,26 @@