Merge remote-tracking branch 'origin/v2' into v2
This commit is contained in:
50
static/v2/js/forms/f_make_mover_order.js
Normal file
50
static/v2/js/forms/f_make_mover_order.js
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
function makeMoverOrder(form) {
|
||||||
|
event.preventDefault()
|
||||||
|
|
||||||
|
let formData = getFormData(form);
|
||||||
|
formData.append('owner_type', 'mover');
|
||||||
|
|
||||||
|
let request = new api({
|
||||||
|
url: '/routes/create_or_change_route/',
|
||||||
|
data: formData,
|
||||||
|
data_type: 'formData',
|
||||||
|
success: function (res) {
|
||||||
|
if (!res) return;
|
||||||
|
let created_route_id = res.route_id;
|
||||||
|
if (!created_route_id) return;
|
||||||
|
|
||||||
|
let profile_root = document.querySelector(".info_profile")
|
||||||
|
if (!profile_root) return;
|
||||||
|
profile_root.innerHTML = res.html
|
||||||
|
|
||||||
|
let created_route = document.querySelector(`[data-number-of-route="${created_route_id}"]`);
|
||||||
|
created_route.scrollIntoView({
|
||||||
|
behavior:"smooth",
|
||||||
|
block:'start',
|
||||||
|
inline:'start'
|
||||||
|
});
|
||||||
|
|
||||||
|
let new_url = window.location.pathname
|
||||||
|
new_url.replace('/create_route_for_customer', '/my_routes');
|
||||||
|
new_url.replace('/create_route_for_mover', '/my_routes');
|
||||||
|
|
||||||
|
window.location.pathname.replace(new_url, '')
|
||||||
|
|
||||||
|
}, error: function (res) {
|
||||||
|
if (!res.responseJSON) return;
|
||||||
|
|
||||||
|
let $parent = form.closest('.b_make_poster_order')
|
||||||
|
let $title = $parent.querySelector(".make_poster_order_title")
|
||||||
|
let $form = $parent.querySelector(".f_make_poster_order")
|
||||||
|
$form.remove()
|
||||||
|
|
||||||
|
$('body')[0].scrollIntoView({behavior: 'smooth', top: 0});
|
||||||
|
|
||||||
|
$(res.responseJSON.html).insertAfter($($title))
|
||||||
|
|
||||||
|
daterangepickerInit($('.w_daterangepicker'), daterangepickerInit)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
request.ajaxRequest()
|
||||||
|
}
|
||||||
@@ -35,6 +35,7 @@
|
|||||||
<script src='{% static "v2/js/widgets/w_daterangepicker.js" %}'></script>
|
<script src='{% static "v2/js/widgets/w_daterangepicker.js" %}'></script>
|
||||||
<script src='{% static "v2/js/widgets/w_textarea_w_counter.js" %}'></script>
|
<script src='{% static "v2/js/widgets/w_textarea_w_counter.js" %}'></script>
|
||||||
<script src='{% static "v2/js/forms/f_make_poster_order.js" %}'></script>
|
<script src='{% static "v2/js/forms/f_make_poster_order.js" %}'></script>
|
||||||
|
<script src='{% static "v2/js/forms/f_make_mover_order.js" %}'></script>
|
||||||
{% include "connect_ws_js.html" %}
|
{% include "connect_ws_js.html" %}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,6 @@
|
|||||||
<link rel="stylesheet" href="{% static "v2/css/widgets/w_textarea_w_counter.css" %}">
|
<link rel="stylesheet" href="{% static "v2/css/widgets/w_textarea_w_counter.css" %}">
|
||||||
|
|
||||||
<div class="b_make_poster_order">
|
<div class="b_make_poster_order">
|
||||||
<div class="make_poster_order_title">{% trans "Заполните форму, чтобы отправить посылку" %}</div>
|
<div class="make_poster_order_title">{% trans "Заполните форму, чтобы перевезти посылку" %}</div>
|
||||||
{% include 'v2/forms/f_make_poster_order.html' %}
|
{% include 'v2/forms/f_make_mover_order.html' %}
|
||||||
</div>
|
</div>
|
||||||
@@ -2,41 +2,46 @@
|
|||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
|
|
||||||
<form name="make_mover_order" class="f_make_poster_order">
|
<form name="make_mover_order" class="f_make_poster_order">
|
||||||
{% trans "Укажите город" as placeholder_for_city %}
|
<div class="form_line">
|
||||||
|
<div class="field_container" data-type="radio" data-name="type_transport">
|
||||||
|
{% trans "Обязательно учитывайте Правила и особенности перевозки выбранным Вами видом транспорта" as attention_type_transport %}
|
||||||
|
<label for="id_cargo_type"><div class="required_field_icon">*</div> {% trans "Укажите способ, которым вы можете перевезти" %}</label>
|
||||||
|
{% include 'v2/widgets/w_radio_inputs.html' with name='type_transport' list=form.fields.type_transport.choices initial=form.initial.type_transport %}
|
||||||
|
{% include 'v2/widgets/w_pay_attention.html' with text=attention_type_transport %}
|
||||||
|
{% if form.errors.type_transport %}<div class="error_container">{{ form.errors.type_transport.0 }}</div>{% endif %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{% trans "Укажите город" as placeholder_for_city %}
|
||||||
<div class="form_line _50_grid">
|
<div class="form_line _50_grid">
|
||||||
<div class="field_container" data-type="location" data-name="from_city">
|
<div class="field_container" data-type="location" data-name="from_city">
|
||||||
<label for="id_from_city"><div class="required_field_icon">*</div> {% trans "Откуда забрать посылку" %}</label>
|
<label for="id_from_city"><div class="required_field_icon">*</div> {% trans "Пункт отправления" %}</label>
|
||||||
{% include 'v2/widgets/w_select_country.html' with name='from_city' placeholder=placeholder_for_city initial=form.initial.from_city %}
|
{% include 'v2/widgets/w_select_country.html' with name='from_city' placeholder=placeholder_for_city initial=form.initial.from_city %}
|
||||||
{% if form.errors.from_city %}<div class="error_container">{{ form.errors.from_city.0 }}</div>{% endif %}
|
{% if form.errors.from_city %}<div class="error_container">{{ form.errors.from_city.0 }}</div>{% endif %}
|
||||||
</div>
|
</div>
|
||||||
<div class="field_container" data-type="location" data-name="to_city">
|
<div class="field_container" data-type="location" data-name="to_city">
|
||||||
<label for="id_from_city"><div class="required_field_icon">*</div> {% trans "Куда доставить посылку" %}</label>
|
<label for="id_from_city"><div class="required_field_icon">*</div> {% trans "Пункт прибытия" %}</label>
|
||||||
{% include 'v2/widgets/w_select_country.html' with name='to_city' placeholder=placeholder_for_city initial=form.initial.to_city %}
|
{% include 'v2/widgets/w_select_country.html' with name='to_city' placeholder=placeholder_for_city initial=form.initial.to_city %}
|
||||||
{% if form.errors.to_city %}<div class="error_container">{{ form.errors.to_city.0 }}</div>{% endif %}
|
{% if form.errors.to_city %}<div class="error_container">{{ form.errors.to_city.0 }}</div>{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form_line">
|
|
||||||
<div class="field_container" data-type="radio" data-name="cargo_type">
|
|
||||||
<label for="id_cargo_type"><div class="required_field_icon">*</div> {% trans "Выберите кого (что) вы можете перевезти:" %}</label>
|
|
||||||
{% include 'v2/widgets/w_radio_inputs.html' with name='cargo_type' list=form.fields.cargo_type.choices initial=form.initial.cargo_type %}
|
|
||||||
{% if form.errors.cargo_type %}<div class="error_container">{{ form.errors.cargo_type.0 }}</div>{% endif %}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form_line _50_grid">
|
<div class="form_line _50_grid">
|
||||||
<div class="field_container" data-type="date" data-name="arrival_DT">
|
<div class="field_container" data-type="date" data-name="arrival_DT">
|
||||||
<label for="id_arrival_DT"><div class="required_field_icon">*</div> {% trans "Дата доставки посылки" %}</label>
|
<label for="id_arrival_DT"><div class="required_field_icon">*</div> {% trans "Дата доставки посылки" %}</label>
|
||||||
{% include 'v2/widgets/w_daterangepicker.html' with name='arrival_DT' initial=form.initial.arrival_DT %}
|
{% include 'v2/widgets/w_daterangepicker.html' with name='arrival_DT' initial=form.initial.arrival_DT %}
|
||||||
{% if form.errors.arrival_DT %}<div class="error_container">{{ form.errors.arrival_DT.0 }}</div>{% endif %}
|
{% if form.errors.arrival_DT %}<div class="error_container">{{ form.errors.arrival_DT.0 }}</div>{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
<div class="field_container" data-type="date" data-name="departure_DT">
|
||||||
|
<label for="id_arrival_DT"><div class="required_field_icon">*</div> {% trans "Дата доставки посылки" %}</label>
|
||||||
|
{% include 'v2/widgets/w_daterangepicker.html' with name='departure_DT' initial=form.initial.departure_DT %}
|
||||||
|
{% if form.errors.departure_DT %}<div class="error_container">{{ form.errors.departure_DT.0 }}</div>{% endif %}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form_line">
|
<div class="form_line">
|
||||||
<div class="field_container" data-type="radio" data-name="type_transport">
|
<div class="field_container" data-type="radio" data-name="cargo_type">
|
||||||
{% trans "Обязательно учитывайте Правила и особенности перевозки выбранным Вами видом транспорта" as attention_type_transport %}
|
<label for="id_cargo_type"><div class="required_field_icon">*</div> {% trans "Выберите кого (что) вы можете перевезти:" %}</label>
|
||||||
<label for="id_cargo_type"><div class="required_field_icon">*</div> {% trans "Каким способом Вы хотите отправить?" %}</label>
|
{% include 'v2/widgets/w_radio_inputs.html' with name='cargo_type' list=form.fields.cargo_type.choices initial=form.initial.cargo_type %}
|
||||||
{% include 'v2/widgets/w_radio_inputs.html' with name='type_transport' list=form.fields.type_transport.choices initial=form.initial.type_transport %}
|
{% if form.errors.cargo_type %}<div class="error_container">{{ form.errors.cargo_type.0 }}</div>{% endif %}
|
||||||
{% include 'v2/widgets/w_pay_attention.html' with text=attention_type_transport %}
|
|
||||||
{% if form.errors.type_transport %}<div class="error_container">{{ form.errors.type_transport.0 }}</div>{% endif %}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form_line">
|
<div class="form_line">
|
||||||
@@ -65,5 +70,5 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<button type="submit" onclick="makePosterOrder(this.form)">{% trans "Разместить объявление" %}</button>
|
<button type="submit" onclick="makeMoverOrder(this.form)">{% trans "Разместить объявление" %}</button>
|
||||||
</form>
|
</form>
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="form_line">
|
<div class="form_line">
|
||||||
<div class="field_container" data-type="radio" data-name="cargo_type">
|
<div class="field_container" data-type="radio" data-name="cargo_type">
|
||||||
<label for="id_cargo_type"><div class="required_field_icon">*</div> {% trans "Выберите кого (что) вы можете перевезти:" %}</label>
|
<label for="id_cargo_type"><div class="required_field_icon">*</div> {% trans "Каким способом Вы хотите отправить?" %}</label>
|
||||||
{% include 'v2/widgets/w_radio_inputs.html' with name='cargo_type' list=form.fields.cargo_type.choices initial=form.initial.cargo_type %}
|
{% include 'v2/widgets/w_radio_inputs.html' with name='cargo_type' list=form.fields.cargo_type.choices initial=form.initial.cargo_type %}
|
||||||
{% if form.errors.cargo_type %}<div class="error_container">{{ form.errors.cargo_type.0 }}</div>{% endif %}
|
{% if form.errors.cargo_type %}<div class="error_container">{{ form.errors.cargo_type.0 }}</div>{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user