TRI-293: edit form-poster + page styles

This commit is contained in:
2024-12-25 16:54:57 +03:00
parent 951315a1a4
commit 7d00e92aac
6 changed files with 282 additions and 148 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1,96 +1,115 @@
!function () { !function () {
'use strict'; 'use strict';
var posterApp = { var posterApp = {
// todo определение фоормата даты можно вынести на бэк для контроля
initDatePickerr: function () { initDatePickerr: function () {
const _this = this;
[this._selector.inpDeparture, this._selector.inpArrival].forEach(i => { [this._selector.inpDeparture, this._selector.inpArrival].forEach(i => {
let date = i.val(); if(!i.length) return
let date = i.val().trim() ? i.val() : new Date();
if (!i.length) return false
let startDate = null let startDate = null
if (window.location.href.includes("/ru/")) { if (window.location.href.includes("/ru/")) {
startDate = moment(date, "D MMMM YYYY г. HH:mm", 'ru'); startDate = moment(date, this._data.formatDateClient, 'ru');
} else { } else {
startDate = moment(date, "MMMM D, YYYY, h:mm a", 'en'); startDate = moment(date, this._data.formatDateClient, 'en');
} }
if (!i.attr('hidden')) { if (!i.attr('hidden')) {
i.daterangepicker({ i.daterangepicker({
"autoapply": true, "autoapply": true,
"linkedCalendars": false, "linkedCalendars": false,
"singleDatePicker": true, "singleDatePicker": true,
"timePicker": true, "timePicker": false,
"timePicker24Hour": true, "timePicker24Hour": false,
"minDate": startDate, "minDate": startDate,
"locale": changeLangForDateTimePicker(), "locale": changeLangForDateTimePicker(),
}, function (start, end, label) { }, function (start, end, label) {
i.val(start.format('DD.MM.YYYY HH:mm')); i.val(start.format('DD.MM.YYYY'));
}); });
} }
i.off('mouseleave.i-disable').on('mouseleave.i-disable', e => {
i.attr('readonly', false);
i.blur();
})
i.off('mouseover.i-disable').on('mouseover.i-disable', e => {
i.attr('readonly', true);
})
i.off('focus.i-disable').on('focus.i-disable', e => {
i.blur()
})
}); });
}, },
changeCargoType: function () { changeCargoType: function () {
let inpTypeAvia = this._selector.typeItems.filter((d,i)=>i.value === 'avia'); let inpTypeAvia = this._selector.typeItems.filter((d, i) => i.value === 'avia');
let inpTypePassenger = this._selector.cargoItems.filter((d,i)=>i.value === 'passenger'); let inpTypePassenger = this._selector.cargoItems.filter((d, i) => i.value === 'passenger');
this._selector.cargoItems.off('change.i-disable').on('change.i-disable', (e)=>{ this._selector.cargoItems.off('change.i-disable').on('change.i-disable', (e) => {
this.handlerDisabled(e.target,inpTypeAvia,'passenger') this.handlerDisabled(e.target, inpTypeAvia, 'passenger')
}) })
// change other type // change other type
this.handlerDisabled(inpTypePassenger,inpTypeAvia,'passenger') this.handlerDisabled(inpTypePassenger, inpTypeAvia, 'passenger')
}, },
handlerDisabled: function (el,el2,text) { handlerDisabled: function (el, el2, text) {
if($(el).val() === text) { if ($(el).val() === text) {
$(el2).attr('disabled', true); $(el2).attr('disabled', true);
} else { } else {
$(el2).attr('disabled', false); $(el2).attr('disabled', false);
} }
}, },
changeTransportType: function () { changeTransportType: function () {
let inpTypePassenger = this._selector.cargoItems.filter((d,i)=>i.value === 'passenger'); let inpTypePassenger = this._selector.cargoItems.filter((d, i) => i.value === 'passenger');
this._selector.typeItems.off('change.i-disable').on('change.i-disable', (e)=>{ this._selector.typeItems.off('change.i-disable').on('change.i-disable', (e) => {
this.handlerDisabled(e.target,inpTypePassenger,'avia') this.handlerDisabled(e.target, inpTypePassenger, 'avia');
}) })
}, },
createInpCoutryData: function (el, data) {
el.dataCoutry?.remove();
let template =
`<div class="poster__inp-country">
<img src="${data[4]}" alt="${data[1]}">
<span>${data[2] || 'BY'}</span>
</div>`;
el.after(template);
el.dataCoutry = el.next('.poster__inp-country');
el.parent().addClass('is-set')
},
initHandlerItemsTowns: function (el) { initHandlerItemsTowns: function (el) {
el.list.off('click.item').on('click.item', (e) => { el.list.off('click.item').on('click.item', (e) => {
let target = $(e.target) let target = $(e.target)
let item = target.hasClass('autocomplete-result') ? target : target.parents('.autocomplete-result') let item = target.hasClass('poster__towns-item') ? target : target.parents('.poster__towns-item')
let dataStr = item.data('attr') let data = item.data('attrs')
if (!dataStr.length) return if (!data.length) return
dataStr = dataStr.slice(1, -1).replace(/"/g, ''); let [id, txt] = data;
this.createInpCoutryData(el, data);
let [id, txt, name, date] = dataStr.split(', ');
let inpNames = { let inpNames = {
id: 'from_address_point', id: 'from_city',
txt: 'from_address_point_txt', txt: 'from_address_point_txt',
date: 'departure_DT'
} }
if (name.match(/to/)) { if (el[0].name.match(/to/)) {
inpNames = { inpNames = {
id: 'to_address_point', id: 'to_city',
txt: 'to_address_point_txt', txt: 'to_address_point_txt',
date: 'arrival_DT'
} }
} }
const collection = this._selector.root[0].elements; const collection = this._selector.root[0].elements;
collection[inpNames.id].value = id; collection[inpNames.id].value = id;
collection[inpNames.txt].value = txt; collection[inpNames.txt].value = txt;
collection[inpNames.date].value = date; this.handlerShowList(el);
this.handlerShowList(el) el.prevValue = el.val();
}) })
}, },
setDataTowns: function (data, inp) { setDataTowns: function (data, inp) {
if (!data.res_search_list.length) return const newSearchlist = data.res_search_list;
const newSearchlist = data.res_search_list.replace(/onmousedown=\'selectItemAddrPoint/g, 'data-attr=\'')
inp.list.html(newSearchlist); inp.list.html(newSearchlist);
}, },
@@ -111,7 +130,7 @@
subtree: false, subtree: false,
characterDataOldValue: false characterDataOldValue: false
}); });
}, },
handlerShowList: function (i, isHide) { handlerShowList: function (i, isHide) {
if (!isHide && i.list.text()) { if (!isHide && i.list.text()) {
@@ -127,16 +146,30 @@
return formData; return formData;
}, },
validForm: function () {
let elems = this._selector.root[0].elements
//todo пустые значения
elems.departure_DT.value = elems.departure_DT.value.trim()
if (!elems.departure_DT.value) {
elems.departure_DT.value = moment(new Date()).format(this._data.formatDate);
}
// console.log(elems.departure_DT.value.trim(), elems.departure_DT.value === '', elems.departure_DT.value, elems.departure_DT)
},
initSubmit: function () { initSubmit: function () {
const _this = this; const _this = this;
this._selector.root.off('submit').on('submit', function (e) { this._selector.root.off('submit').on('submit', function (e) {
e.preventDefault(); e.preventDefault();
_this.validForm();
let routeId = _this._selector.submitBtn.data('routeId'); let routeId = _this._selector.submitBtn.data('routeId');
var formData = _this.getDataForm(); var formData = _this.getDataForm();
let url = '/routes/create_or_change_route/' let url = '/routes/create_or_change_route/'
if (routeId) { if (routeId) {
url = '/routes/change_route/' + routeId + '/' url = '/routes/change_route/' + routeId + '/'
} }
if (_this.getDataForm(true))
console.log(_this.getDataForm(true))
$.ajax({ $.ajax({
headers: {"X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val()}, headers: {"X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val()},
url: url, url: url,
@@ -146,7 +179,7 @@
contentType: false, contentType: false,
data: formData, data: formData,
success: function (data) { success: function (data) {
return // return
let data_route_id = data.route_id let data_route_id = data.route_id
document.querySelector(".info_profile").innerHTML = data.html document.querySelector(".info_profile").innerHTML = data.html
@@ -154,7 +187,7 @@
if (routeId) { if (routeId) {
el_route = document.querySelector(`[data-number-of-route="${routeId}"]`); el_route = document.querySelector(`[data-number-of-route="${routeId}"]`);
} }
if(el_route) { if (el_route) {
el_route.scrollIntoView({ el_route.scrollIntoView({
behavior: "smooth", behavior: "smooth",
block: 'start', block: 'start',
@@ -172,6 +205,7 @@
window.history.replaceState(null, '', newUrl); window.history.replaceState(null, '', newUrl);
}, },
error: function (data, exception) { error: function (data, exception) {
console.log(data)
document.querySelector(".info_profile").innerHTML = data.responseJSON.html; document.querySelector(".info_profile").innerHTML = data.responseJSON.html;
document.getElementById('departure_DT')?.scrollIntoView({ document.getElementById('departure_DT')?.scrollIntoView({
behavior: "smooth", behavior: "smooth",
@@ -185,62 +219,71 @@
getTowns: function (el) { getTowns: function (el) {
const _this = this; const _this = this;
let timer = null let data = _this.getDataForm(true);
if (timer) { let getTownData = {
clearTimeout(timer); type_transport: data.type_transport,
search_str: el.val(),
ctrl_name: el.attr('name')
} }
timer = setTimeout(function () { $.ajax({
timer = null; headers: {"X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val()},
let data = _this.getDataForm(true); url: '/reference_data/get_address_point/',
let getTownData = { type: "POST",
type_transport: data.type_transport, cache: false,
search_str: el.val(), processData: false,
ctrl_name: el.attr('name') contentType: false,
} data: JSON.stringify(getTownData),
$.ajax({ success: function (data) {
headers: {"X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val()}, el.removeClass('loading');
url: '/reference_data/get_address_point/', const {res_search_list, unanswered_msgs_count} = data;
type: "POST", _this.setDataTowns(data, el)
cache: false, _this.initHandlerItemsTowns(el)
processData: false, _this.handlerShowList(el)
contentType: false, if (res_search_list.length) {
data: JSON.stringify(getTownData), el.addClass('is-items')
success: function (data) { el.parent().addClass('is-items')
el.removeClass('loading'); el.list.addClass('is-items')
const {res_search_list, unanswered_msgs_count} = data; } else {
_this.setDataTowns(data, el) el.parent().removeClass('is-items')
_this.initHandlerItemsTowns(el) el.removeClass('is-items')
_this.handlerShowList(el) el.list.removeClass('is-items')
if (res_search_list.length) {
el.addClass('is-items')
el.parent().addClass('is-items')
el.list.addClass('is-items')
} else {
el.parent().removeClass('is-items')
el.removeClass('is-items')
el.list.removeClass('is-items')
}
console.log('fetch', data)
},
error: function (data) {
console.log('Error')
} }
}); console.log('fetch', data)
}, 500); },
error: function (data) {
console.log('Error')
}
});
}, },
handlerSearchTown: function (e, i) { handlerSearchTown: function (e, i) {
this._cl('handlerSearchTown'); this._cl('handlerSearchTown');
let el = i; let el = i;
console.log('out', el.prevValue, el.val())
if (el.prevValue && el.val().length < el.prevValue.length) {
el.parent().removeClass('is-set')
el.next('.poster__inp-country').remove()
console.log(el, `${el[0].name.split('_')[0]}_city`, this._selector.root[0].elements[`${el[0].name.split('_')[0]}_city`])
this._selector.root[0].elements[`${el[0].name.split('_')[0]}_city`].value = ''
el.val('');
}
if (el.val().length > 2) { if (el.val().length > 2) {
console.log('in')
el.addClass('loading'); el.addClass('loading');
this.getTowns(el);
clearTimeout(el.timer)
el.timer = setTimeout(() => {
this.getTowns(el);
el.timer = null;
}, 500)
} else { } else {
el.removeClass('loading'); el.removeClass('loading');
} }
el.prevValue = el.val();
}, },
initHandlerRoute: function () { initHandlerRoute: function () {
@@ -249,8 +292,8 @@
[this._selector.inpFrom, this._selector.inpTo].forEach(i => { [this._selector.inpFrom, this._selector.inpTo].forEach(i => {
if (!i.length) return false if (!i.length) return false
i.off('input.routes').on('input.routes', (e) => _this.handlerSearchTown(e, i)); i.off('input.routes').on('input.routes', (e) => _this.handlerSearchTown(e, i));
i.off('click.routes').on('click.routes', () => _this.handlerShowList(i)); i.parent().off('click.routes').on('click.routes', () => _this.handlerShowList(i));
i.list.off('mouseleave.routes').on('mouseleave.routes', () => _this.handlerShowList(i, true)); i.parent().parent().off('mouseleave.routes').on('mouseleave.routes', () => _this.handlerShowList(i, true));
}); });
}, },
@@ -267,15 +310,20 @@
initData: function (root) { initData: function (root) {
window.posterApp = this; window.posterApp = this;
this._data = { this._data = {
debug: true debug: true,
formatDate: 'DD.MM.YYYY',
formatDateClient: window.location.href.includes("/ru/")
? "D MMMM YYYY г."
: "MMMM D, YYYY",
}; };
this._selector = { this._selector = {
root: root, root: root,
wrapper: $('.info_profile'), wrapper: $('.info_profile'),
inpFrom: root.find('#from'), inpFrom: root.find('#from'),
inpFromList: root.find('#from').siblings('.poster__towns-list'), inpFromList: root.find('#from').parent().siblings('.poster__towns-list'),
inpTo: root.find('#to'), inpTo: root.find('#to'),
inpToList: root.find('#to').siblings('.poster__towns-list'), inpToList: root.find('#to').parent().siblings('.poster__towns-list'),
cargoItems: root.find('.cargo__inp[name="cargo_type"]'), cargoItems: root.find('.cargo__inp[name="cargo_type"]'),
typeItems: root.find('.cargo__inp[name="type_transport"]'), typeItems: root.find('.cargo__inp[name="type_transport"]'),
inpDeparture: root.find('#departure_DT'), inpDeparture: root.find('#departure_DT'),
@@ -296,10 +344,10 @@
this._cl(this); this._cl(this);
this.handlerPageOut(); this.handlerPageOut();
this.initHandlerRoute(); this.initHandlerRoute();
this.initDatePickerr() this.initDatePickerr();
this.initSubmit(); this.initSubmit();
this.changeCargoType(); this.changeCargoType();
this.changeTransportType() this.changeTransportType();
}, },
}; };

View File

@@ -273,6 +273,36 @@ $row-gap: 40px;
&__label { &__label {
margin-bottom: 10px; margin-bottom: 10px;
cursor: default;
}
&__inp-box {
position: relative;
&.is-set {
.poster__locate {
padding-left: 65px;
}
}
input {
}
.poster__inp-country {
position: absolute;
display: flex;
align-items: center;
left: 10px;
top: 50%;
gap: 5px;
transform: translateY(-50%);
img {
width: 24px;
}
}
} }
&__area-descr { &__area-descr {
@@ -320,8 +350,42 @@ $row-gap: 40px;
} }
&__towns-item {
display: flex;
align-items: center;
padding: 5px 5px;
font-size: 16px;
line-height: 22px;
cursor: pointer;
&:hover {
background: var(--brand-grey);
}
img {
width: 24px;
margin-right: 5px;
}
span {
margin-right: 8px;
}
}
&__locate { &__locate {
appearance: none; appearance: none;
//&:not(:placeholder-shown) {
// padding-left: 65px;
//}
//&:placeholder-shown {
//
// +.poster__inp-country {
// display: none;
// }
//}
} }
.btn { .btn {

View File

@@ -27,9 +27,9 @@
<div hidden> <div hidden>
csrfmiddlewaretoken: eoN2nLYYo46PpDIhi82dmTFASHH4ONiBdEQOz1jQNyUpsHJ4RrvcmFwfnM45TNtl csrfmiddlewaretoken: eoN2nLYYo46PpDIhi82dmTFASHH4ONiBdEQOz1jQNyUpsHJ4RrvcmFwfnM45TNtl
type_transport: road type_transport: road
from_address_point: 59613 4267 from_city: 59613 4267
from_address_point_txt: Москаленки / Россия from_address_point_txt: Москаленки / Россия
to_address_point: 2824 to_city: 2824
to_address_point_txt: Берлар / Бельгия to_address_point_txt: Берлар / Бельгия
departure_DT: 17.12.2024 23:04 departure_DT: 17.12.2024 23:04
arrival_DT: 29.12.2024 20:04 arrival_DT: 29.12.2024 20:04
@@ -54,20 +54,20 @@
{% csrf_token %} {% csrf_token %}
<input <input
type="number" type="number"
name="from_address_point" name="from_city"
id="from_address_point" id="from_city"
hidden hidden
{% if form.initial.from_address_point %}value="{{ form.initial.from_address_point }}"{% endif %} {% if form.initial.from_city %}value="{{ form.initial.from_city }}"{% endif %}
/> />
<input <input
type="number" type="number"
name="to_address_point" name="to_city"
id="to_address_point" id="to_city"
hidden hidden
{% if form.initial.to_address_point %}value="{{ form.initial.to_address_point }}"{% endif %} {% if form.initial.to_city %}value="{{ form.initial.to_city }}"{% endif %}
/> />
<input <input
id="hide_owner_type" id="owner_type"
name="owner_type" name="owner_type"
hidden hidden
{% if form.initial.owner_type %} {% if form.initial.owner_type %}
@@ -76,17 +76,6 @@
value="{{ form.data.owner_type }}" value="{{ form.data.owner_type }}"
{% endif %} {% endif %}
> >
<input
id="hiddenTime"
type="text"
name="hiddenTime"
hidden
{% if route.departure_DT %}
value="{{ route.from_city.get_current_datetime }}"
{% elif form.initial.departure_DT %}
value="{{ form.initial.departure_DT }}"
{% endif %}
>
{#type-transport#} {#type-transport#}
<div class="poster__row poster__row--transport"> <div class="poster__row poster__row--transport">
<div class="poster__col col-12"> <div class="poster__col col-12">
@@ -126,8 +115,18 @@
<label for="from" class="poster__label " required> <label for="from" class="poster__label " required>
{{ l_from }} {{ l_from }}
</label> </label>
<input type="text" autocomplete="off" name="from_address_point_txt" id="from" class="poster__locate locate" <div class="poster__inp-box">
placeholder="{% translate "Укажите город" %}" required>
<input type="text" autocomplete="off" name="from_address_point_txt" id="from" class="poster__locate locate"
placeholder="{% translate "Укажите город" %}" required
{% if form.initial.from_address_point_txt %}value="{{ form.initial.from_address_point_txt }}"{% endif %}
>
{# <div class="poster__inp-country">#}
{# <img src="/media/uploads/flags/HU_-_Hungary.svg" alt="Венгрия">#}
{# <span>BY</span>#}
{# </div>#}
</div>
<div class="poster__towns-list"></div> <div class="poster__towns-list"></div>
{% if not errors_off and form.errors and form.errors.from_address_point %} {% if not errors_off and form.errors and form.errors.from_address_point %}
<span id="error_from_address_point">{{ form.errors.from_address_point }}</span> <span id="error_from_address_point">{{ form.errors.from_address_point }}</span>
@@ -137,8 +136,18 @@
<label for="to" class="poster__label " required> <label for="to" class="poster__label " required>
{{ l_to }} {{ l_to }}
</label> </label>
<input type="text" autocomplete="off" name="to_address_point_txt" id="to" class="poster__locate locate" <div class="poster__inp-box">
placeholder="{% translate "Укажите город" %}" required> <input
type="text"
autocomplete="off"
name="to_address_point_txt"
id="to"
class="poster__locate locate"
placeholder="{% translate "Укажите город" %}"
required
{% if form.initial.to_address_point_txt %}value="{{ form.initial.to_address_point_txt }}"{% endif %}
>
</div>
<div class="poster__towns-list"></div> <div class="poster__towns-list"></div>
{% if not errors_off and form.errors and form.errors.from_address_point %} {% if not errors_off and form.errors and form.errors.from_address_point %}
<span id="error_to_address_point">{{ form.errors.from_address_point }}</span> <span id="error_to_address_point">{{ form.errors.from_address_point }}</span>
@@ -149,7 +158,7 @@
<div class="poster__col poster__col--inner"> <div class="poster__col poster__col--inner">
{#date-from#} {#date-from#}
<div class="poster__col"> <div class="poster__col">
<label for="departure_DT" required class="poster__label col-12 "> <label for="departure_DT" class="poster__label col-12" required>
{{ l_date_from }} {{ l_date_from }}
</label> </label>
<input <input
@@ -158,11 +167,15 @@
id="departure_DT" id="departure_DT"
name="departure_DT" name="departure_DT"
readonly readonly
value="{% if route.departure_DT %} required
{{ route.from_city.get_current_datetime }}{% elif form.initial.departure_DT %}{{ form.initial.departure_DT }}{% endif %}" {% if route.departure_DT %}
value="{{ route.from_city.get_current_datetime.strip }}"
{% elif form.initial.departure_DT %}
value="{{ form.initial.departure_DT }}"
{% endif %}
/> />
{% if not errors_off and form.errors and form.errors.departure_DT %} {% if not errors_off and form.errors and form.errors.departure_DT %}
<span id="error_arrival_DT">{{ form.errors.departure_DT }}</span> <span id="error_departure_DT">{{ form.errors.departure_DT }}</span>
{% endif %} {% endif %}
</div> </div>
{#date-to#} {#date-to#}
@@ -176,11 +189,11 @@
id="arrival_DT" id="arrival_DT"
name="arrival_DT" name="arrival_DT"
readonly readonly
value="{% if route.departure_DT %} {% if route.arrival_DT %}
{{ route.from_city.get_current_datetime }} value="{{ route.from_city.get_current_datetime }}"
{% elif form.initial.arrival_DT %} {% elif form.initial.arrival_DT %}
{{ form.initial.arrival_DT }} value="{{ form.initial.arrival_DT }}"
{% endif %}" {% endif %}
/> />
{% if not errors_off and form.errors and form.errors.arrival_DT %} {% if not errors_off and form.errors and form.errors.arrival_DT %}
<span id="error_arrival_DT">{{ form.errors.arrival_DT }}</span> <span id="error_arrival_DT">{{ form.errors.arrival_DT }}</span>
@@ -229,7 +242,7 @@
<div class="poster__row poster__row--date"> <div class="poster__row poster__row--date">
{#date-to#} {#date-to#}
<div class="poster__col"> <div class="poster__col">
<label for="arrival_DT" required class="poster__label col-12 "> <label for="arrival_DT" class="poster__label col-12" required>
{{ l_date_to }} {{ l_date_to }}
</label> </label>
<input <input
@@ -237,12 +250,13 @@
class="poster__date date" class="poster__date date"
id="arrival_DT" id="arrival_DT"
name="arrival_DT" name="arrival_DT"
readonly placeholder="{% translate "Выберите дату" %}"
value="{% if route.arrival_DT %} required
{{ route.from_city.get_current_datetime }} {% if route.arrival_DT %}
{% elif form.initial.arrival_DT %} value="{{ route.from_city.get_current_datetime }}"
{{ form.initial.arrival_DT }} {% elif form.initial.arrival_DT %}
{% endif %}" value="{{ form.initial.arrival_DT }}"
{% endif %}
/> />
{% if not errors_off and form.errors and form.errors.arrival_DT %} {% if not errors_off and form.errors and form.errors.arrival_DT %}
<span id="error_arrival_DT">{{ form.errors.arrival_DT }}</span> <span id="error_arrival_DT">{{ form.errors.arrival_DT }}</span>
@@ -254,12 +268,11 @@
id="departure_DT" id="departure_DT"
name="departure_DT" name="departure_DT"
hidden hidden
value="
{% if route.departure_DT %} {% if route.departure_DT %}
{{ route.from_city.get_current_datetime }} value="{{ route.from_city.get_current_datetime.strip }}"
{% elif form.initial.departure_DT %} {% elif form.initial.departure_DT %}
{{ form.initial.departure_DT }} value="{{ form.initial.departure_DT }}"
{% endif %}" {% endif %}
/> />
</div> </div>
</div> </div>
@@ -271,8 +284,16 @@
<label for="phone" class="col-12"> <label for="phone" class="col-12">
{% translate "Контактный номер телефона, по которому с Вами могут связаться перевозчики" %} {% translate "Контактный номер телефона, по которому с Вами могут связаться перевозчики" %}
</label> </label>
<input class="col-12 col-xl-6" type="text" pattern="[0-9\-+]{5,}" maxlength="30" <input id="phone"
placeholder="{% translate "Укажите телефон" %}" title="{% translate "Только цифры или - или +" %}"> name="phone"
class="col-12 col-xl-6"
type="text"
pattern="[0-9\-+]{5,}"
maxlength="30"
{% if form.initial.phone %}value="{{ form.initial.phone}}"{% endif %}
placeholder="{% translate "Укажите телефон" %}"
title="{% translate "Только цифры или - или +" %}"
>
<div class="poster__info"> <div class="poster__info">
{% translate "Если вы оставите это поле пустым - перевозчики смогут только написать вам в личные сообщения на нашем сайте TripWB.com" %} {% translate "Если вы оставите это поле пустым - перевозчики смогут только написать вам в личные сообщения на нашем сайте TripWB.com" %}
</div> </div>
@@ -281,16 +302,17 @@
{% endif %} {% endif %}
</div> </div>
</div> </div>
{#description#} {#comment#}
<div class="poster__row poster__row--description"> <div class="poster__row poster__row--description">
<div class="poster__col col-12"> <div class="poster__col col-12">
<label for="description" class="col-12"> <label for="comment" class="col-12">
{% translate "Примечание (необязательно)" %} {% translate "Примечание (необязательно)" %}
</label> </label>
<textarea <textarea
name="description" name="comment"
id="description" id="comment"
value="{{ form.initial.comment }}"
maxlength="{{ maxLetterLength }}" maxlength="{{ maxLetterLength }}"
placeholder="{% translate "Если желаете, то здесь можно указать важную информацию, например: вес, габариты посылки, количество попутчиков и т.д.)" %}" placeholder="{% translate "Если желаете, то здесь можно указать важную информацию, например: вес, габариты посылки, количество попутчиков и т.д.)" %}"
></textarea> ></textarea>
@@ -310,7 +332,7 @@
name="receive_msg_by_email" name="receive_msg_by_email"
class="cargo__inp" class="cargo__inp"
{% if form.initial.receive_msg_by_email == True %} {% if form.initial.receive_msg_by_email == True %}
checked="checked" checked
{% endif %} {% endif %}
id="receive_msg_by_email"> id="receive_msg_by_email">

View File

@@ -1,5 +1,5 @@
<div onmousedown='selectItemAddrPoint({{ id }}, "{{ name }} / {{ country__name }}", "{{ ctrl_name }}", "{{ timezone }}")' class="autocomplete-result" data-index="{{ index }}"> <div class="poster__towns-item" data-attrs='[{{ id }}, "{{ name }}/{{ country__name }}", "{{ ctrl_name }}", "{{ timezone }}", "{{ MEDIA_URL }}{{ country__flag }}"]'>
{# {% if airport_fullname %}<div>{{ airport_fullname|safe }}</div>{% endif %}#}
<div class="autocomplete-location">{{ name }} / {{ country__name }}</div>
<img src="{{ MEDIA_URL }}{{ country__flag }}" alt="{{ country__name }}" /> <img src="{{ MEDIA_URL }}{{ country__flag }}" alt="{{ country__name }}" />
</div> <span>BY{# {{ TODO нужны правильные значения }} #}</span>
{{ name }}/{{ country__name }}
</div>