0.0.283 add success_msg for forms, clear forms

This commit is contained in:
2023-12-01 00:34:42 +03:00
parent fd1f4ff9b1
commit fde640e997
6 changed files with 75 additions and 42 deletions

View File

@@ -1888,11 +1888,26 @@ button#edit_route {
font-weight: 700;
background: #FFFFFF;
box-shadow: -1px 4px 10px 0px rgba(198, 199, 203, 0.20), 0px -1px 10px 0px rgba(198, 199, 203, 0.20);
z-index: 1;
position: absolute;
height: 100%;
width: 101%;
border-radius: 10px;
}
.msg_text {
margin-top: 100px;
}
.msg_send.hide{
display: none;
}
.form_wrapper{
position: relative;
}
button.confirm_remove{
width: 48.5%;

View File

@@ -202,6 +202,8 @@ function cancelRemove(route_id) {
function hideBlock(el) {
el.classList.add('hide')
let clear_form = document.getElementsByClassName('clear_form');
clear_form[0].reset();
}
@@ -800,6 +802,9 @@ function RequestCommercialOffer (el){
event.preventDefault()
let disable_btn = document.getElementById('send_feedback_form');
disable_btn.setAttribute('disabled', true);
let form = el.form;
let formData = new FormData(form);
let form_name = form.dataset['name']
@@ -819,6 +824,8 @@ function RequestCommercialOffer (el){
success: function(data){
$(data.html).insertBefore(document.querySelector(".feedback_form"))
let disable_btn = document.getElementById('send_feedback_form');
disable_btn.removeAttribute('disabled');
},
@@ -828,38 +835,38 @@ function RequestCommercialOffer (el){
});
}
function SendFeedbackForm (el){
event.preventDefault()
let form = el.form;
let formData = new FormData(form);
let form_name = form.dataset['name']
formData.set('form_name',form_name)
$.ajax({
headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() },
// url: '/user_account/request_offer/',
type: "POST",
// async: true,
cache: false,
processData: false,
contentType: false,
// enctype: 'json',
data: formData,
success: function(data){
// location.href = '/profile'
},
error: function (data, exception){
// document.querySelector(".login").innerHTML = data.responseJSON.html
}
});
}
// function SendFeedbackForm (el){
//
// event.preventDefault()
// let form = el.form;
// let formData = new FormData(form);
// let form_name = form.dataset['name']
// formData.set('form_name',form_name)
//
//
//
//
// $.ajax({
// headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() },
// // url: '/user_account/request_offer/',
// type: "POST",
// // async: true,
// cache: false,
// processData: false,
// contentType: false,
// // enctype: 'json',
// data: formData,
// success: function(data){
//
// // location.href = '/profile'
//
//
// },
// error: function (data, exception){
// // document.querySelector(".login").innerHTML = data.responseJSON.html
// }
// });
// }

View File

@@ -7,7 +7,9 @@
<div class="footer_logo"><img class="svg" src="/static/img/svg/LogoWhite.svg"></div>
<div>
<div class="footer_text_sub">{% trans "Подпишись и будь в курсе всех событий, а также получай подарки и бонусы от Trip With Bonus" %}</div>
<div class="footer_input_wrap"><input class="footer_input" type="text" placeholder="{% trans "Введите ваш e-mail" %}">
<div class="footer_input_wrap">
<input class="footer_input" type="text" placeholder="{% trans "Введите ваш e-mail" %}">
<div id="footer_input_button"><img class="svg" src="/static/img/svg/CaretCircleRight.svg"></div>
</div>
</div>

View File

@@ -53,14 +53,16 @@
</div>
<img src="/static/img/png/Box5.png" alt="">
<img src="/static/img/png/Box4.png" alt="">
<img src="/static/img/png/Box4.png" alt="">
<img src="/static/img/png/Box6.png" alt="">
<img id="box1" src="/static/img/png/Box5.png" alt="">
<img id="box2" src="/static/img/png/Box4.png" alt="">
<img id="box3" src="/static/img/png/Box4.png" alt="">
<img id="box4" src="/static/img/png/Box6.png" alt="">
</div>
<div class="form_wrapper">
{% include "blocks/static_pages_blocks/b_feedback_form.html" %}
{% include "blocks/static_pages_blocks/b_feedback_form.html" %}
</div>

View File

@@ -14,13 +14,17 @@
{% endif %}
<form
class="clear_form"
{% if page.url == 'contacts' %} data-name="msg_from_contacts"{% endif %}
{% if page.url == 'about_service' %} data-name="msg_from_about_service"{% endif %}
{% if page.url == 'customer_service' %} data-name="msg_from_customer_service"{% endif %}
>
<div class="left_inputs_form">
<div class="inputs_l">
<input name="name" type="text" placeholder="{% translate 'Имя' %}" {% if form.data.username %} value="{{ form.data.username }}"{% endif %}>
<input name="name"
type="text"
required
placeholder="{% translate 'Имя' %}" {% if form.data.username %} value="{{ form.data.username }}"{% endif %}>
{% if form.username and form.errors.username %}
<span>{{ form.errors.username }}</span>
{% endif %}
@@ -60,7 +64,7 @@
</div>
<div class="button_feedback_form">
<button onclick="RequestCommercialOffer(this)" id="send_feedback_form">{% translate 'Отправить сообщение' %}</button>
<button onclick="RequestCommercialOffer(this, {once: true})" id="send_feedback_form">{% translate 'Отправить сообщение' %}</button>
</div>

View File

@@ -3,7 +3,10 @@
<div
onclick="hideBlock(this)"
class="msg_send">
class="msg_send"
>
<div class="msg_text"> {% translate 'Ваше сообщение отправлено' %}</div>
{% translate 'Ваше сообщение отправлено' %}
</div>