This commit is contained in:
2023-08-28 18:05:53 +03:00
parent 4354d1369d
commit ec8fded136
6 changed files with 45 additions and 22 deletions

View File

@@ -14,6 +14,11 @@ function filters_func_find_route_main (el){
data: formData,
success: function(data){
document.querySelector(".block-finded-routes").innerHTML = data.html
if (data.html === "\n\n\n\n\n"){
document.querySelector(".block-finded-routes").innerHTML = "<span style='color: #ff0000;font-weight: 800;font-size: 18px;padding: 10px;'>Нечего не найдено!</span>"
} else {
document.querySelector(".block-finded-routes").innerHTML = data.html
}
},
errors: function (data){

View File

@@ -56,6 +56,7 @@ function restart_ws (){
console.log("open")
} else {
console.log("connecting...")
}

View File

@@ -345,28 +345,31 @@ function sliderInit() {
}
function sendRoute(el, routeID = null){
let obj ={}
event.preventDefault()
let list_of_elements_form = document.querySelectorAll(".el_form_b_new_route");
let obj_w_el_form = {}
for (let i = 0;i < list_of_elements_form.length;i++) {
let name_attr = list_of_elements_form[i].attributes["name"]
if (name_attr) {
let name_el = name_attr.value
let value_el = list_of_elements_form[i].value
obj_w_el_form[name_el] = value_el
}
}
let selected_owner_type = document.querySelectorAll("#customer, #mover")
selected_owner_type.forEach(function(item) {
if (item.classList.contains('selected')) {
let { id, innerText } = item
obj['owner_type'] = id
}
});
if (item.classList.contains('selected')) {
let { id, innerText } = item
obj_w_el_form['owner_type'] = id
}
});
if (selected_owner_type[0].classList.contains('selected')){
}else
}else{}
event.preventDefault()
let form = el.form;
let formData = new FormData(form);
let data = {
formData,
obj
}
let url = '/ru/routes/create_or_change_route/'
if (routeID !== null){
url = '/ru/routes/change_route/' + routeID + '/'
@@ -381,7 +384,7 @@ function sendRoute(el, routeID = null){
processData: false,
contentType: false,
// enctype: 'json',
data: JSON.stringify(data),
data: JSON.stringify(obj_w_el_form),
success: function(data){
if (data.user_alerts) {
getNewMessageSession()

View File

@@ -33,7 +33,8 @@
<select
onchange="OnSelectionChange(this)"
name="type_transport"
id="id_type_transport">
id="id_type_transport"
class="el_form_b_new_route">
{% for item in form.fields.type_transport.choices %}
<option
@@ -63,6 +64,7 @@
name="departure_DT"
{% if form.fields.departure_DT.required %} required{% endif %}
id="id_departure_DT"
class="el_form_b_new_route"
{% if form.initial.departure_DT %}value="{{ form.initial.departure_DT.date|date:"Y-m-d" }}T{{ form.initial.departure_DT.time|date:"H:i" }}"{% endif %}
/>
@@ -78,6 +80,7 @@
name="arrival_DT"
{% if form.fields.arrival_DT.required %} required{% endif %}
id="id_arrival_DT"
class="el_form_b_new_route"
{% if form.initial.arrival_DT %}value="{{ form.initial.arrival_DT.date|date:"Y-m-d" }}T{{ form.initial.arrival_DT.time|date:"H:i" }}"{% endif %}
/>
{% if not errors_off and form.errors and form.errors.arrival_DT %}
@@ -94,6 +97,7 @@
type="number"
name="from_address_point"
id="id_from_address_point"
class="el_form_b_new_route"
hidden
{% if form.initial.from_address_point %}value="{{ form.initial.from_address_point }}"{% endif %}
/>
@@ -106,7 +110,7 @@
type="text"
minlength="3"
name="from_address_point_txt"
class="from_address_point_txt post_route"
class="from_address_point_txt post_route el_form_b_new_route"
{% if form.fields.from_address_point.required %} required{% endif %}
id="id_from_address_point_txt"
{% if form.initial.from_address_point_txt %}value="{{ form.initial.from_address_point_txt }}"{% endif %}
@@ -128,6 +132,7 @@
type="number"
name="to_address_point"
id="id_to_address_point"
class="el_form_b_new_route"
hidden
{% if form.initial.to_address_point %}value="{{ form.initial.to_address_point}}"{% endif %}
/>
@@ -142,7 +147,7 @@
name="to_address_point_txt"
{% if form.fields.to_address_point.required %} required{% endif %}
id="id_to_address_point_txt"
class="to_address_point_txt post_route"
class="to_address_point_txt post_route el_form_b_new_route"
{% if form.initial.to_address_point_txt %}value="{{ form.initial.to_address_point_txt}}"{% endif %}
/>
@@ -166,6 +171,7 @@
<div>
<label for="id_from_place">{{ form.fields.from_place.label }}</label>
<select
class="el_form_b_new_route"
name="from_place"
{# onchange="hideErrorMsg(this)"#}
id="id_from_place"
@@ -186,6 +192,7 @@
<select
name="to_place"
id="id_to_place"
class="el_form_b_new_route"
{% if form.fields.to_place.required %} required{% endif %}>
{% for item in form.fields.to_place.choices %}
<option
@@ -216,7 +223,8 @@
<input
class="custom-checkbox"
type="checkbox"
name="cargo_type"
name="cargo_type"
class="el_form_b_new_route"
id="id_cargo_type_{{ forloop.counter }}"
{% if form.fields.cargo_type.required %} required{% endif %}
value="{{ item.0 }}"
@@ -248,6 +256,7 @@
maxlength="4"
class="js-input"
placeholder="Укажите вес"
class="el_form_b_new_route"
{% if form.fields.weight.required %} required{% endif %}
/>
@@ -260,7 +269,8 @@
<input
type="text"
id="id_weight"id="id_weight"
id="id_weight" id="id_weight"
class="el_form_b_new_route"
name="weight"
{% if form.initial.weight %}
value="{{ form.initial.weight }}"
@@ -284,6 +294,7 @@
autocomplete="off"
maxlength="13"
minlength="11"
class="el_form_b_new_route"
placeholder="{{ form.fields.phone.label }}"
{% if form.fields.phone.required %} required{% endif %}
id="id_phone"
@@ -302,6 +313,7 @@
type="phone"
name="extra_phone"
id="id_extra_phone"
class="el_form_b_new_route"
autocomplete="off"
maxlength="13"
minlength="11"

View File

@@ -1,4 +1,5 @@
{% load static %}
{% load i18n %}
<div class="title-profile-cont">
Подписка
@@ -7,7 +8,7 @@
<div>
<div class="state_subscribe">
У вас <a>не оформлена подписка</a>
{% translate "У вас" %} <a>{% translate "не оформлена подписка" %}</a>
</div>
<div class="state_subscribe">

View File

@@ -108,6 +108,7 @@
<div class="cont-el-form-search-carrier last">
<label>test</label>
<select name="cargo_type" id="id_cargo_type" {% if form.fields.cargo_type.required %} required{% endif %}>
<option value="" selected="selected">--не имеет значения--</option>
{% for item in form.fields.cargo_type.choices %}
<option value="{{ item.0 }}">{{ item.1 }}</option>
{% endfor %}