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; font-weight: 700;
background: #FFFFFF; background: #FFFFFF;
box-shadow: -1px 4px 10px 0px rgba(198, 199, 203, 0.20), 0px -1px 10px 0px rgba(198, 199, 203, 0.20); 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{ .msg_send.hide{
display: none; display: none;
} }
.form_wrapper{
position: relative;
}
button.confirm_remove{ button.confirm_remove{
width: 48.5%; width: 48.5%;

View File

@@ -202,6 +202,8 @@ function cancelRemove(route_id) {
function hideBlock(el) { function hideBlock(el) {
el.classList.add('hide') el.classList.add('hide')
let clear_form = document.getElementsByClassName('clear_form');
clear_form[0].reset();
} }
@@ -800,6 +802,9 @@ function RequestCommercialOffer (el){
event.preventDefault() event.preventDefault()
let disable_btn = document.getElementById('send_feedback_form');
disable_btn.setAttribute('disabled', true);
let form = el.form; let form = el.form;
let formData = new FormData(form); let formData = new FormData(form);
let form_name = form.dataset['name'] let form_name = form.dataset['name']
@@ -819,6 +824,8 @@ function RequestCommercialOffer (el){
success: function(data){ success: function(data){
$(data.html).insertBefore(document.querySelector(".feedback_form")) $(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){ // function SendFeedbackForm (el){
//
event.preventDefault() // event.preventDefault()
let form = el.form; // let form = el.form;
let formData = new FormData(form); // let formData = new FormData(form);
let form_name = form.dataset['name'] // let form_name = form.dataset['name']
formData.set('form_name',form_name) // formData.set('form_name',form_name)
//
//
//
//
$.ajax({ // $.ajax({
headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() }, // headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() },
// url: '/user_account/request_offer/', // // url: '/user_account/request_offer/',
type: "POST", // type: "POST",
// async: true, // // async: true,
cache: false, // cache: false,
processData: false, // processData: false,
contentType: false, // contentType: false,
// enctype: 'json', // // enctype: 'json',
data: formData, // data: formData,
success: function(data){ // success: function(data){
//
// location.href = '/profile' // // location.href = '/profile'
//
//
}, // },
error: function (data, exception){ // error: function (data, exception){
// document.querySelector(".login").innerHTML = data.responseJSON.html // // 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 class="footer_logo"><img class="svg" src="/static/img/svg/LogoWhite.svg"></div>
<div> <div>
<div class="footer_text_sub">{% trans "Подпишись и будь в курсе всех событий, а также получай подарки и бонусы от Trip With Bonus" %}</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 id="footer_input_button"><img class="svg" src="/static/img/svg/CaretCircleRight.svg"></div>
</div> </div>
</div> </div>

View File

@@ -53,14 +53,16 @@
</div> </div>
<img src="/static/img/png/Box5.png" alt=""> <img id="box1" src="/static/img/png/Box5.png" alt="">
<img src="/static/img/png/Box4.png" alt=""> <img id="box2" src="/static/img/png/Box4.png" alt="">
<img src="/static/img/png/Box4.png" alt=""> <img id="box3" src="/static/img/png/Box4.png" alt="">
<img src="/static/img/png/Box6.png" alt=""> <img id="box4" src="/static/img/png/Box6.png" alt="">
</div> </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 %} {% endif %}
<form <form
class="clear_form"
{% if page.url == 'contacts' %} data-name="msg_from_contacts"{% endif %} {% 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 == 'about_service' %} data-name="msg_from_about_service"{% endif %}
{% if page.url == 'customer_service' %} data-name="msg_from_customer_service"{% endif %} {% if page.url == 'customer_service' %} data-name="msg_from_customer_service"{% endif %}
> >
<div class="left_inputs_form"> <div class="left_inputs_form">
<div class="inputs_l"> <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 %} {% if form.username and form.errors.username %}
<span>{{ form.errors.username }}</span> <span>{{ form.errors.username }}</span>
{% endif %} {% endif %}
@@ -60,7 +64,7 @@
</div> </div>
<div class="button_feedback_form"> <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> </div>

View File

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