This commit is contained in:
2023-08-16 15:15:17 +03:00
parent 66c142a4d6
commit 0acfaca8f6
8 changed files with 227 additions and 16 deletions

View File

@@ -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;
}

View File

@@ -0,0 +1,3 @@
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
<path id="Airplane" d="M13.51 3.07638L10.954 5.48019L13.3883 12.1743L11.5626 14L7.92647 8.67512L6.08558 10.3487V12.1743L4.25991 14L3.17971 10.8127L0 9.74009L1.82567 7.91442H3.65135L5.47702 6.08875L0 2.4374L1.82567 0.611725L8.51981 3.04596L10.9312 0.49762L10.878 0.535655C11.2209 0.192681 11.6861 0 12.1712 0C12.6562 0 13.1214 0.192681 13.4643 0.535655C13.8073 0.878629 14 1.3438 14 1.82884C14 2.31388 13.8073 2.77905 13.4643 3.12203L13.51 3.07638Z" fill="#FF613A"/>
</svg>

After

Width:  |  Height:  |  Size: 569 B

3
static/img/svg/Car.svg Normal file
View File

@@ -0,0 +1,3 @@
<svg width="14" height="12" viewBox="0 0 14 12" fill="none" xmlns="http://www.w3.org/2000/svg">
<path id="Car" d="M12.3822 0.7575C12.2267 0.315 11.7911 0 11.2778 0H2.72222C2.20889 0 1.78111 0.315 1.61778 0.7575L0.0855555 5.01C0.031111 5.1675 0 5.3325 0 5.505V10.875C0 11.4975 0.521111 12 1.16667 12C1.81222 12 2.33333 11.4975 2.33333 10.875V10.5H11.6667V10.875C11.6667 11.49 12.1878 12 12.8333 12C13.4711 12 14 11.4975 14 10.875V5.505C14 5.34 13.9689 5.1675 13.9144 5.01L12.3822 0.7575ZM2.72222 8.25C2.07667 8.25 1.55556 7.7475 1.55556 7.125C1.55556 6.5025 2.07667 6 2.72222 6C3.36778 6 3.88889 6.5025 3.88889 7.125C3.88889 7.7475 3.36778 8.25 2.72222 8.25ZM11.2778 8.25C10.6322 8.25 10.1111 7.7475 10.1111 7.125C10.1111 6.5025 10.6322 6 11.2778 6C11.9233 6 12.4444 6.5025 12.4444 7.125C12.4444 7.7475 11.9233 8.25 11.2778 8.25ZM1.55556 4.5L2.54333 1.635C2.65222 1.335 2.94778 1.125 3.28222 1.125H10.7178C11.0522 1.125 11.3478 1.335 11.4567 1.635L12.4444 4.5H1.55556Z" fill="#FF613A"/>
</svg>

After

Width:  |  Height:  |  Size: 993 B

View File

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

127
static/js/serch_town.js Normal file
View File

@@ -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")
}
}
}

View File

@@ -3,6 +3,7 @@
{% block meta %}
<script src='{% static "js/find_route.js" %}'></script>
<script src="{% static "js/serch_town.js" %}"></script>
{% endblock %}
{% block content %}
@@ -11,19 +12,26 @@
<h1 class="title_page">Поиск перевозчика</h1>
</div>
<div class="container_form_search_carrier">
<form>
<form name="find_route">
{% csrf_token %}
<div class="cont-el-form-search-carrier first abbreviation">
<label>Откуда</label>
<div class="container_inp_w_abr">
<input class="inp_form_find_route_w_abbreviation" type="text">
<input onfocus="focus_el_ins(this)" onclick="show_list_w_places(this)" oninput="searchTown(this)" class="inp_form_find_route_w_abbreviation first" id="inp_form_find_route_w_abbreviation_1" type="text">
<div class="abbreviation_airport_in_search"><text>MSQ</text></div>
<div class="insert-airports-place" id="insert-airports-place_1">
{% include "widgets/w_places_input.html" %}
</div>
</div>
</div>
<div class="cont-el-form-search-carrier">
<label>Куда</label>
<div class="container_inp_w_abr">
<input class="inp_form_find_route_w_abbreviation" type="text">
<input onfocus="focus_el_ins(this)" onclick="show_list_w_places(this)" oninput="searchTown(this)" class="inp_form_find_route_w_abbreviation" id="inp_form_find_route_w_abbreviation_2" type="text">
<div class="abbreviation_airport_in_search"><text>WAW</text></div>
<div class="insert-airports-place" id="insert-airports-place_2">
{% include "widgets/w_ac_input_address_point.html" %}
</div>
</div>
</div>
<div class="cont-el-form-search-carrier">
@@ -48,6 +56,7 @@
<div class="block-filters-find-route">
<div class="title_filters_find_route">Все фильтры</div>
<div class="methods_transportation_form_filters">
<div class="title_el_methods_transportation">Способ перевозки</div>
{# <div>#}
{# <div class="method_transport">#}
{# <input class="method_transport_inp_hide" type="checkbox">#}
@@ -63,13 +72,44 @@
class="custom-checkbox"
type="checkbox"
name="cargo_type"
id="id_cargo_type"
id="id_cargo_type_car"
/>
<label for="id_cargo_type" >
<span>Автоперевозка</span>
<label for="id_cargo_type_car" >
<img style="display: inline-block;padding-top: 11px;" src="{% static "img/svg/Car.svg" %}">
<span style="display: inline-block;width: 80%;">Автоперевозка</span>
</label>
</div>
<div>
<input
class="custom-checkbox"
type="checkbox"
name="cargo_type"
id="id_cargo_type_plane"
/>
<label for="id_cargo_type_plane" >
<img style="display: inline-block;padding-top: 11px;" src="{% static "img/svg/Airplane.svg" %}">
<span style="display: inline-block;width: 80%;">Авиатранспорт</span>
</label>
</div>
</div>
<div class="methods_transportation_form_filters">
<div class="title_el_methods_transportation">Откуда забрать посылку</div>
<select class="select_form_filters_find_route">
<option>Заберу по городу</option>
</select>
</div>
<div class="methods_transportation_form_filters">
<div class="title_el_methods_transportation">Куда доставить посылку</div>
<select class="select_form_filters_find_route">
<option>По договоренности</option>
</select>
</div>
<div class="methods_transportation_form_filters">
<div class="slider_methods_transportation"></div>
<input type="number" class="slider_input_form_method_transportation_1" oninput="insert_data_in_slider(this)">
<input type="number" class="slider_input_form_method_transportation_2" oninput="insert_data_in_slider(this)">
</div>
</div>
<div class="block-finded-routes">

View File

@@ -9,7 +9,9 @@
<script src='{% static "js/jquery_v3_6_4.js" %}'> </script>
<script>
var user_id = {{ user.id }}
{#var user_id = {{ user.id }}#}
ws_url = `ws://localhost:{{ ws_port }}/ws/socket-server/?user_id={{ user.id }}`;
</script>
<script src='{% static "js/chat_sockets.js" %}'></script>

View File

@@ -0,0 +1,5 @@
{% load static %}
<div onmousedown='selectItemAddrPoint({{ id }}, "{{ fullname }}", "{{ ctrl_name }}")' class="autocomplete-result" data-index="{{ index }}">
{% if airport_fullname %}<div>{{ airport_fullname|safe }}</div>{% endif %}
<div class="autocomplete-location">{{ country_name }} / {{ city_name }}</div>
</div>