Merge remote-tracking branch 'origin/main'
This commit is contained in:
@@ -27,4 +27,7 @@ urlpatterns = [
|
|||||||
path('change_profile/', change_profile_ajax, name='change_profile_ajax'),
|
path('change_profile/', change_profile_ajax, name='change_profile_ajax'),
|
||||||
path('change_profile_confirm/', change_profile_confirm_ajax, name='change_profile_confirm_ajax'),
|
path('change_profile_confirm/', change_profile_confirm_ajax, name='change_profile_confirm_ajax'),
|
||||||
path('change_avatar_confirm/', change_avatar_confirm_ajax, name='change_avatar_confirm_ajax'),
|
path('change_avatar_confirm/', change_avatar_confirm_ajax, name='change_avatar_confirm_ajax'),
|
||||||
|
|
||||||
|
path('request_offer/', request_offer_ajax, name='request_offer_ajax')
|
||||||
|
|
||||||
]
|
]
|
||||||
@@ -29,6 +29,57 @@ import base64
|
|||||||
# html = render_to_string('blocks/profile/b_subscribe.html', Dict, request=request)
|
# html = render_to_string('blocks/profile/b_subscribe.html', Dict, request=request)
|
||||||
# return JsonResponse({'html': html}, status=200)
|
# return JsonResponse({'html': html}, status=200)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def request_offer_ajax(request):
|
||||||
|
if request.method != 'POST':
|
||||||
|
raise Http404
|
||||||
|
|
||||||
|
data = request.POST
|
||||||
|
if not data and request.body:
|
||||||
|
data = request.body
|
||||||
|
|
||||||
|
from GeneralApp.funcs_options import get_options_by_opt_types, get_mail_send_options
|
||||||
|
sets = get_options_by_opt_types(['domain', 'project_name'], only_vals=True)
|
||||||
|
|
||||||
|
request_type = None
|
||||||
|
subject = 'Получен запрос'
|
||||||
|
if 'form_name' in data:
|
||||||
|
if data['form_name'] == 'msg_from_advertisement':
|
||||||
|
subject = 'Получен запрос на рекламу'
|
||||||
|
request_type = 'запрос на рекламу'
|
||||||
|
|
||||||
|
if request_type:
|
||||||
|
request_type_str = f'<b>Тип запроса:</b> {request_type}<br>'
|
||||||
|
else:
|
||||||
|
request_type_str = ''
|
||||||
|
|
||||||
|
Dict = {
|
||||||
|
'logo': f'{request.scheme}://{sets["domain"]}/static/img/svg/LogoMobile.svg',
|
||||||
|
'project_name': sets['project_name'],
|
||||||
|
'message_title': subject,
|
||||||
|
'message_text': f'<p><b>ДАННЫЕ ЗАПРОСА</b></p>'
|
||||||
|
f'<p style="padding-left: 20px; line-height: 30px;">'
|
||||||
|
f'{request_type_str}'
|
||||||
|
f'<b>Имя:</b> {data["name"]}<br>'
|
||||||
|
f'<b>Телефон:</b> {data["phone"]}'
|
||||||
|
f'</p>'
|
||||||
|
}
|
||||||
|
|
||||||
|
html = render_to_string('mail/m_request_offer.html', Dict, request)
|
||||||
|
from BaseModels.mailSender import admin_send_mail_by_SMTPlib
|
||||||
|
mail_sets = get_mail_send_options()
|
||||||
|
to = [mail_sets['sender_email'], 'web@syncsystems.net']
|
||||||
|
res = admin_send_mail_by_SMTPlib(
|
||||||
|
mail_sets,
|
||||||
|
subject=subject,
|
||||||
|
from_email=mail_sets['sender_email'], to=to,
|
||||||
|
html_content=html
|
||||||
|
)
|
||||||
|
|
||||||
|
return JsonResponse({'status': 'sended'})
|
||||||
|
|
||||||
|
|
||||||
@login_required(login_url='/profile/login/')
|
@login_required(login_url='/profile/login/')
|
||||||
def chats_ajax(request):
|
def chats_ajax(request):
|
||||||
if request.method != 'POST':
|
if request.method != 'POST':
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ def admin_send_mail_by_SMTPlib(sets, subject, from_email, to, html_content, atta
|
|||||||
smtp_port = sets['mail_server_smtp_port']
|
smtp_port = sets['mail_server_smtp_port']
|
||||||
smtp_password = sets['sender_mail_password']
|
smtp_password = sets['sender_mail_password']
|
||||||
smtp_login = sets['sender_mail_login']
|
smtp_login = sets['sender_mail_login']
|
||||||
res = send_mail_by_SMTPlib(subject, from_email, to, html_content, smtp_server, smtp_port, smtp_login,
|
res = send_mail_by_SMTPlib(sets, subject, from_email, to, html_content, smtp_server, smtp_port, smtp_login,
|
||||||
smtp_password, attachments)
|
smtp_password, attachments)
|
||||||
|
|
||||||
|
|
||||||
@@ -106,14 +106,14 @@ def admin_send_mail_by_SMTPlib(sets, subject, from_email, to, html_content, atta
|
|||||||
def send_mail_by_SMTPlib(sets, subject, from_email, to_init, html_content, smtp_server, smtp_port, smtp_login, smtp_password,
|
def send_mail_by_SMTPlib(sets, subject, from_email, to_init, html_content, smtp_server, smtp_port, smtp_login, smtp_password,
|
||||||
attachments=None):
|
attachments=None):
|
||||||
to = to_init
|
to = to_init
|
||||||
if not settings.prod_server:
|
# if not settings.prod_server:
|
||||||
to = 'web@syncsystems.net'
|
# to = 'web@syncsystems.net'
|
||||||
else:
|
# else:
|
||||||
to = to_init
|
# to = to_init
|
||||||
try:
|
# try:
|
||||||
from settings_local import DEBUG
|
# from settings_local import DEBUG
|
||||||
except:
|
# except:
|
||||||
print('get settings_local fail')
|
# print('get settings_local fail')
|
||||||
|
|
||||||
res = None
|
res = None
|
||||||
mail_lib = None
|
mail_lib = None
|
||||||
@@ -153,8 +153,8 @@ def send_mail_by_SMTPlib(sets, subject, from_email, to_init, html_content, smtp_
|
|||||||
else:
|
else:
|
||||||
to_str = to[0]
|
to_str = to[0]
|
||||||
else:
|
else:
|
||||||
if to == sets['sender_email']:
|
# if to == sets['sender_email']:
|
||||||
return None
|
# return None
|
||||||
to_str = to
|
to_str = to
|
||||||
to = []
|
to = []
|
||||||
to.append(to_str)
|
to.append(to_str)
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ def get_options_by_opt_types(opt_types, only_vals=False):
|
|||||||
|
|
||||||
opts = Option.objects.filter(**kwargs)
|
opts = Option.objects.filter(**kwargs)
|
||||||
if opts and only_vals:
|
if opts and only_vals:
|
||||||
opts = opts.values('name', 'value')
|
opts = opts.values('opt_type', 'value')
|
||||||
opts = {item['name']: item['value'] for item in opts}
|
opts = {item['opt_type']: item['value'] for item in opts}
|
||||||
return opts
|
return opts
|
||||||
|
|
||||||
def get_first_option_value_by_opt_type(opt_type):
|
def get_first_option_value_by_opt_type(opt_type):
|
||||||
|
|||||||
@@ -832,36 +832,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']
|
||||||
//
|
formData.set('form_name',form_name)
|
||||||
//
|
|
||||||
//
|
|
||||||
// $.ajax({
|
|
||||||
// headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() },
|
|
||||||
// url: '/user_account/request_offer/',
|
$.ajax({
|
||||||
// type: "POST",
|
headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() },
|
||||||
// // async: true,
|
// url: '/user_account/request_offer/',
|
||||||
// cache: false,
|
type: "POST",
|
||||||
// processData: false,
|
// async: true,
|
||||||
// contentType: false,
|
cache: false,
|
||||||
// // enctype: 'json',
|
processData: false,
|
||||||
// data: formData,
|
contentType: false,
|
||||||
// success: function(data){
|
// enctype: 'json',
|
||||||
//
|
data: formData,
|
||||||
// // location.href = '/profile'
|
success: function(data){
|
||||||
//
|
|
||||||
//
|
// location.href = '/profile'
|
||||||
// },
|
|
||||||
// error: function (data, exception){
|
|
||||||
// // document.querySelector(".login").innerHTML = data.responseJSON.html
|
},
|
||||||
// }
|
error: function (data, exception){
|
||||||
// });
|
// document.querySelector(".login").innerHTML = data.responseJSON.html
|
||||||
// }
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,11 @@
|
|||||||
<span id="sub_title_static">{% translate "Пожалуйста опишите Ваш вопрос максимально подробно, а также укажите Ваш e-mail для обратной связи." %}</span>
|
<span id="sub_title_static">{% translate "Пожалуйста опишите Ваш вопрос максимально подробно, а также укажите Ваш e-mail для обратной связи." %}</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<form>
|
<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="left_inputs_form">
|
||||||
<div class="inputs_l">
|
<div class="inputs_l">
|
||||||
<input name="username" type="text" placeholder="{% translate 'Имя' %}" {% if form.data.username %} value="{{ form.data.username }}"{% endif %}>
|
<input name="username" type="text" placeholder="{% translate 'Имя' %}" {% if form.data.username %} value="{{ form.data.username }}"{% endif %}>
|
||||||
|
|||||||
65
templates/mail/m_request_offer.html
Normal file
65
templates/mail/m_request_offer.html
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
|
||||||
|
<div style="font-family:Calibri,Candara,Segoe,'Segoe UI',Optima,Arial,sans-serif; padding:10px; background-color: #F8F8F8;">
|
||||||
|
<div style="line-height:1.0em;width: 660px">
|
||||||
|
<div style="padding:5px; text-align: center;">
|
||||||
|
<img src="{{ logo }}" alt="{{ project_name }}" style="margin:0;padding:0;">
|
||||||
|
</div>
|
||||||
|
<p style="font-weight:700;font-size:25px;text-align:center;padding:0;line-height:1em; text-transform: uppercase; color: #ff613a;">
|
||||||
|
{{ message_title|safe }}
|
||||||
|
</p>
|
||||||
|
<div style="line-height:1.0em;font-size:18px;margin-top: 5px; margin-left: 30px; box-shadow: -1px 4px 10px 0 rgba(198, 199, 203, 0.20), 0 -1px 10px 0 rgba(198, 199, 203, 0.20); padding: 30px; border-radius: 10px; background-color: #FFF;">
|
||||||
|
{# <p style="line-height:1.0em;font-size:18px;margin-top: 5px; margin-left: 80px">#}
|
||||||
|
{{ message_text|safe }}
|
||||||
|
{# </p>#}
|
||||||
|
</div>
|
||||||
|
{% for button in message_buttons %}
|
||||||
|
<div style="text-align:center;font-weight: 700;">
|
||||||
|
<a href="{{ button.url }}">
|
||||||
|
<div style="display:inline-block;text-align:center;font-size:18px;padding:5px 10px;margin:5px;border-radius:2px;background-color:#61aeb6;color:#fff;text-decoration:none;line-height:1.0em;cursor:pointer">
|
||||||
|
{{ button.caption }}
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
|
||||||
|
<div style="text-align:center;width: 660px;line-height:1.1em">
|
||||||
|
<div style="margin: 40px 10px 10px;">
|
||||||
|
<hr>
|
||||||
|
{# <nobr><b>Адрес кафе:</b> Минск, ул. Будславская, 2</nobr>#}
|
||||||
|
{# <br>#}
|
||||||
|
{# <nobr><b>График работы:</b> пн-вс 12:00 - 24:00</nobr>#}
|
||||||
|
{# <br>#}
|
||||||
|
{# <nobr><b>Телефоны кафе:</b> +375 44 77 321 77</nobr>#}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style="text-align: center;margin-top:5px">
|
||||||
|
{# <a href="https://baldenini.by/event/dostavka-edy" style="text-decoration: none;">#}
|
||||||
|
{# <div style="color: #311A12;#}
|
||||||
|
{# padding: 10px;#}
|
||||||
|
{# margin: 5px 10px 0 10px;#}
|
||||||
|
{# border: 2px solid #311A12;#}
|
||||||
|
{# border-radius: 5px;#}
|
||||||
|
{# font-size: 20px;#}
|
||||||
|
{# display: inline-block;#}
|
||||||
|
{# font-weight: 700;#}
|
||||||
|
{# text-transform: uppercase;">О ДОСТАВКЕ#}
|
||||||
|
{# </div>#}
|
||||||
|
{# </a>#}
|
||||||
|
{# <a href="https://baldenini.by/page/baldenini-cafe-o-nas" style="text-decoration: none;">#}
|
||||||
|
{# <div style="color: #311A12;#}
|
||||||
|
{# padding: 10px;#}
|
||||||
|
{# margin: 5px 10px 0 10px;#}
|
||||||
|
{# border: 2px solid #311A12;#}
|
||||||
|
{# border-radius: 5px;#}
|
||||||
|
{# font-size: 20px;#}
|
||||||
|
{# display: inline-block;#}
|
||||||
|
{# font-weight: 700;#}
|
||||||
|
{# text-transform: uppercase;">О BALDENINI CAFE#}
|
||||||
|
{# </div>#}
|
||||||
|
{# </a>#}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@@ -44,7 +44,7 @@
|
|||||||
|
|
||||||
<div class="news_item_static">
|
<div class="news_item_static">
|
||||||
|
|
||||||
<div class="news_img"><img src="{{ MEDIA_URL }} {{ page.picture }}" /></div>
|
<div class="news_img"><img src="{{ MEDIA_URL }}{{ page.picture }}" /></div>
|
||||||
<div class="news_header">{{ page.name }}</div>
|
<div class="news_header">{{ page.name }}</div>
|
||||||
<div class="news_description">
|
<div class="news_description">
|
||||||
{{ page.description|truncatechars:100 }}
|
{{ page.description|truncatechars:100 }}
|
||||||
|
|||||||
Reference in New Issue
Block a user