request_offer_ajax
This commit is contained in:
SDE
2023-11-30 08:15:02 +03:00
parent de098bdf55
commit 6fc40452d9
2 changed files with 23 additions and 10 deletions

View File

@@ -42,15 +42,28 @@ def request_offer_ajax(request):
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)
subject = 'Получен запрос на рекламу'
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'{sets["domain"]}/static/img/svg/LogoMobile.svg',
'logo': f'{request.scheme}://{sets["domain"]}/static/img/svg/LogoMobile.svg',
'project_name': sets['project_name'],
'message_title': subject,
'message_text': f'<b>ДАННЫЕ ЗАПРОСА</b><br>'
f'Имя: {data["name"]}<br>'
f'Телефон: {data["phone"]}<br>'
'message_text': f'<p><b>ДАННЫЕ ЗАПРОСА</b></p>'
f'<p style="padding-left: 20px;">'
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)
@@ -64,7 +77,7 @@ def request_offer_ajax(request):
html_content=html
)
return JsonResponse('OK')
return JsonResponse({'status': 'sended'})
@login_required(login_url='/profile/login/')

View File

@@ -1,13 +1,13 @@
<div style="font-family:Calibri,Candara,Segoe,'Segoe UI',Optima,Arial,sans-serif;padding:10px;">
<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="background-color: #F8F8F8;padding:5px">
<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">
<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">
<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>#}