This commit is contained in:
2023-07-25 18:41:13 +03:00
parent 0febab97c8
commit 578d86456d
5 changed files with 123 additions and 43 deletions

View File

@@ -27,6 +27,7 @@ function searchTown(el){
return insertSearchList(data, el.name + '_list')
},
error: function (data){
console.log('Error')
}

View File

@@ -21,7 +21,7 @@ function createRoute(){
type: "single",
min: 0,
max: 1000,
from: 500,
from: 100,
step: 1,
grid: true,
grid_num: 5,

View File

@@ -18,16 +18,18 @@ function sendRoute(el){
// location.href = '/profile'
document.querySelector(".info_profile").innerHTML = data.html
},
error: function (data, exception){
document.querySelector(".info_profile").innerHTML = data.responseJSON.html
document.querySelector(".info_profile").innerHTML = data.responseJSON.html;
$('#id_weight').ionRangeSlider({
skin: "round",
type: "single",
min: 0,
max: 1000,
from: 500,
step: 1,
grid: true,
grid_num: 5,

View File

@@ -9,31 +9,50 @@
<label for="id_type_transport">{{ form.fields.type_transport.label }}</label>
</div>
<div>
<select onchange="OnSelectionChange(this)" name="type_transport" id="id_type_transport"{% if form.fields.type_transport.required %} required{% endif %}>
{% for item in form.fields.type_transport.choices %}
<option value="{{ item.0 }}"{% if form.fields.type_transport.initial == item.0 %} selected="selected"{% endif %}>{{ item.1 }}</option>
{% endfor %}
<select
onchange="OnSelectionChange(this)"
name="type_transport"
id="id_type_transport">
{% for item in form.fields.type_transport.choices %}
<option
value="{{ item.0 }}"{% if form.cleaned_data.type_transport == item.0 %}
selected="selected"{% endif %}>{{ item.1 }}
</option>
{% endfor %}
</select>
{% if form.errors and form.errors.type_transport %}
<span>{{ form.errors.type_transport }}</span>
{% endif %}
<span>{{ form.errors.type_transport }}</span>
{% endif %}
</div>
<hr>
<div class="departure_arrival">
<div>
<label for="id_departure_DT">{{ form.fields.departure_DT.label }}</label>
<input type="date" name="departure_DT"{% if form.fields.departure_DT.required %} required{% endif %} id="id_departure_DT">
{% if form.errors and form.errors.departure_DT %}
<span>{{ form.errors.departure_DT }}</span>
{% endif %}
<input
type="datetime-local"
name="departure_DT"
{% if form.fields.departure_DT.required %} required{% endif %}
id="id_departure_DT"
{% if form.data.departure_DT %}value="{{ form.data.departure_DT }}"{% endif %}
/>
{% if form.errors and form.errors.departure_DT %}
<span>{{ form.errors.departure_DT }}</span>
{% endif %}
</div>
<div>
<label for="id_arrival_DT">{{ form.fields.arrival_DT.label }}</label>
<input type="date" name="arrival_DT"{% if form.fields.arrival_DT.required %} required{% endif %} id="id_arrival_DT">
{% if form.errors and form.errors.arrival_DT %}
<span>{{ form.errors.arrival_DT }}</span>
{% endif %}
<input
type="datetime-local"
name="arrival_DT"
{% if form.fields.arrival_DT.required %} required{% endif %}
id="id_arrival_DT"
{% if form.data.arrival_DT %}value="{{ form.data.arrival_DT }}"{% endif %}
{# |date: 'Y-m-d H:i' #}
/>
{% if form.errors and form.errors.arrival_DT %}
<span>{{ form.errors.arrival_DT }}</span>
{% endif %}
</div>
</div>
<hr>
@@ -41,7 +60,16 @@
<div class="from_country_container">
<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)" onclick="searchTown(this)" onblur="onblurInputField(event, this)" type="text" name="from_address_point_txt"{% if form.fields.from_address_point.required %} required{% endif %} id="id_from_address_point_txt">
<input
oninput="searchTown(this)"
onclick="searchTown(this)"
onblur="onblurInputField(event, this)"
type="text"
name="from_address_point_txt"
{% if form.fields.from_address_point.required %} required{% endif %}
id="id_from_address_point_txt"
{% if form.cleaned_data.from_address_point_txt %}value="{{ form.cleaned_data.from_address_point_txt }}"{% endif %}
/>
<div class="input_list" name="from_address_point_txt_list">
</div>
{% if form.errors and form.errors.from_address_point %}
@@ -51,7 +79,16 @@
<div>
<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)" onclick="searchTown(this)" onblur="onblurInputField(event, this)" type="text" name="to_address_point_txt"{% if form.fields.to_address_point.required %} required{% endif %} id="id_to_address_point_txt"/>
<input
oninput="searchTown(this)"
onclick="searchTown(this)"
onblur="onblurInputField(event, this)"
type="text"
name="to_address_point_txt"
{% if form.fields.to_address_point.required %} required{% endif %}
id="id_to_address_point_txt"
{% if form.cleaned_data.to_address_point_txt %}value="{{ form.cleaned_data.to_address_point_txt}}"{% endif %}
/>
<div class="input_list" name="to_address_point_txt_list">
</div>
@@ -71,10 +108,16 @@
<div class="from_to_place">
<div>
<label for="id_from_place">{{ form.fields.from_place.label }}</label>
<select name="from_place" id="id_from_place" {% if form.fields.from_place.required %} required{% endif %}>
{% for item in form.fields.from_place.choices %}
<option value="{{ item.0 }}"{% if form.fields.type_transport.initial == item.0 %} selected="selected"{% endif %}>{{ item.1 }}</option>
{% endfor %}
<select
name="from_place"
id="id_from_place"
{% if form.fields.from_place.required %} required{% endif %}>
{% for item in form.fields.from_place.choices %}
<option
value="{{ item.0 }}"{% if form.cleaned_data.from_place == item.0 %}
selected="selected"{% endif %}>{{ item.1 }}
</option>
{% endfor %}
</select>
{% if form.errors and form.errors.from_place %}
<span>{{ form.errors.from_place }}</span>
@@ -82,10 +125,16 @@
</div>
<div>
<label for="id_to_place">{{ form.fields.to_place.label }}</label>
<select name="to_place" id="id_to_place" {% if form.fields.to_place.required %} required{% endif %}>
{% for item in form.fields.to_place.choices %}
<option value="{{ item.0 }}"{% if form.fields.to_place.initial == item.0 %} selected="selected"{% endif %}>{{ item.1 }}</option>
{% endfor %}
<select
name="to_place"
id="id_to_place"
{% if form.fields.to_place.required %} required{% endif %}>
{% for item in form.fields.to_place.choices %}
<option
value="{{ item.0 }}"{% if form.cleaned_data.to_place == item.0 %}
selected="selected"{% endif %}>{{ item.1 }}
</option>
{% endfor %}
</select>
{% if form.errors and form.errors.to_place %}
<span>{{ form.errors.to_place }}</span>
@@ -99,10 +148,19 @@
<label for="id_cargo_type">{{ form.fields.cargo_type.label }}</label>
</div>
<div>
<select multiple size="5" name="cargo_type" id="id_cargo_type" {% if form.fields.cargo_type.required %} required{% endif %}>
{% for item in form.fields.cargo_type.choices %}
<option value="{{ item.0 }}"{% if form.fields.cargo_type.initial == item.0 %} selected="selected"{% endif %}>{{ item.1 }}</option>
{% endfor %}
<select
multiple
size="5"
name="cargo_type"
id="id_cargo_type"
{% if form.fields.cargo_type.required %} required{% endif %}>
{% for item in form.fields.cargo_type.choices %}
<option
value="{{ item.0 }}"{% if form.fields.cargo_type == item.0 %}
selected="selected"{% endif %}>{{ item.1 }}
</option>
{% endfor %}
</select>
{% if form.errors and form.errors.cargo_type %}
<span>{{ form.errors.cargo_type }}</span>
@@ -113,27 +171,46 @@
<div class="range-slider">
<label for="id_weight">{{ form.fields.weight.label }}</label>
<input type="text" id="id_weight"{% if form.fields.weight.required %} required{% endif %} name="weight" value="" />
<input
type="text"
id="id_weight"
{% if form.fields.weight.required %} required{% endif %}
name="weight"
{# value=""#}
{% if form.cleaned_data.weight %}value="{{ form.cleaned_data.weight}}"{% endif %}
/>
{% if form.errors and form.errors.weight %}
<span>{{ form.errors.weight }}</span>
{% endif %}
<span>{{ form.errors.weight }}</span>
{% endif %}
</div>
<hr>
<div>
<label for="id_phone">{{ form.fields.phone.label }}</label>
<input type="text" name="phone"{% if form.fields.phone.required %} required{% endif %} id="id_phone">
{% if form.errors and form.errors.phone %}
<span>{{ form.errors.phone }}</span>
{% endif %}
<input
type="text"
name="phone"
{% if form.fields.phone.required %} required{% endif %}
id="id_phone"
{% if form.cleaned_data.phone %}value="{{ form.cleaned_data.phone}}"{% endif %}
/>
{% if form.errors and form.errors.phone %}
<span>{{ form.errors.phone }}</span>
{% endif %}
</div>
<div>
<label for="id_extra_phone">{{ form.fields.extra_phone.label }}</label>
<input type="text" name="extra_phone" id="id_extra_phone">
{% if form.errors and form.errors.extra_phone %}
<span>{{ form.errors.extra_phone }}</span>
{% endif %}
<input
type="text"
name="extra_phone"
id="id_extra_phone"
{% if form.cleaned_data.extra_phone %}value="{{ form.cleaned_data.extra_phone}}"{% endif %}
/>
{% if form.errors and form.errors.extra_phone %}
<span>{{ form.errors.extra_phone }}</span>
{% endif %}
</div>
<hr>

View File

@@ -8,7 +8,7 @@
<script src='{% static "js/sendRoute.js" %}'></script>
<script src='{% static "js/jquery_v3_6_4.js" %}'> </script>
<script src='{% static "js/ion.rangeSlider.min.js" %}'> </script>
<script src='{% static "js/autocomlitev2.js" %}'> </script>
<script src='{% static "js/autocomlite.js" %}'> </script>
<link rel="stylesheet" href="{% static 'css/ion.rangeSlider.min.css' %}">