<!-- Для формы стандартного блока -->
<script>
let newSuccMsg='';
function writeMessage(em){
newSuccMsg= `Уважаемый, ${em.personNm}<br>
Номер Вашей заявки: ${em.personLeadNum}<br>
В течении 30 минут менеджер Вам перезвонит.<br>
Спасибо за обращение.`;
};
window.mySuccessFunction = function ($form) {
let formresult = $form.data('tildaformresult');
let leadid = formresult.tranId;
let arr = {};
$($form.serializeArray()).each(function (i, el) {
arr[el.name] = el.value;
});
$form.find('.t-form__inputsbox').hide();
if (leadid !== undefined && leadid !== '0' && arr.Name !== undefined && arr.Name !== '' ) {
let personInfo={};
personInfo['personNm'] = arr.Name;
personInfo['personLeadNum'] = leadid.split(':')[1];;
localStorage.setItem ("personInfo", JSON.stringify(personInfo));
writeMessage(personInfo);
$('.js-successbox').html(newSuccMsg);
};
let successUrl = $form.attr('data-success-url');
if (successUrl !== undefined && successUrl !== '') {window.location.href = successUrl };
};
$(document).ready(function () {
$('.js-form-proccess').each(function () {
$(this).attr('data-success-callback', 'window.mySuccessFunction');
});
if (localStorage.getItem('personInfo') !== null) {
let personInfoLoad = JSON.parse(localStorage.getItem("personInfo"));
writeMessage(personInfoLoad);
$('.personinfo .tn-atom').html(newSuccMsg);
};
});
</script>
<!-- Для корзины -->
<script>
let newSuccMsg='';
function writeMessage(em){
newSuccMsg= `Уважаемый, ${em.personNm}<br>
Номер Вашего заказа: ${em.personLeadNum}<br>
В течении 30 минут менеджер Вам перезвонит.<br>
Спасибо за обращение.`;
};
window.myAfterSendedFunction = function ($form) {
let formresult = $form.data('tildaformresult');
let leadid = formresult.orderId;
let arr = {};
$($form.serializeArray()).each(function (i, el) {
arr[el.name] = el.value;
});
$form.find('.t-form__inputsbox').hide();
if (leadid !== undefined && leadid !== '0' && arr.Name !== undefined && arr.Name !== '' ) {
let personInfo={};
personInfo['personNm'] = arr.Name;
personInfo['personLeadNum'] = leadid.split('-')[1];;
localStorage.setItem ("personInfo", JSON.stringify(personInfo));
writeMessage(personInfo);
$('.js-successbox').html(newSuccMsg);
};
let successUrl = $form.attr('data-success-url');
if (successUrl !== undefined && successUrl !== '') {window.location.href = successUrl };
};
$(document).ready(function () {
$('.t706 form').each(function () {
$(this).attr('data-formsended-callback', 'window.myAfterSendedFunction');
});
if (localStorage.getItem('personInfo') !== null) {
let personInfoLoad = JSON.parse(localStorage.getItem("personInfo"));
writeMessage(personInfoLoad);
$('.personinfo .tn-atom').html(newSuccMsg);
};
});
</script>
<!-- Для ZeroBlock -->
<script>
let newSuccMsg='';
function writeMessage(em){
newSuccMsg= `Уважаемый, ${em.personNm}<br>
Номер Вашей заявки: ${em.personLeadNum}<br>
В течении 30 минут менеджер Вам перезвонит.<br>
Спасибо за обращение.`;
};
function t396_onSuccess($form) {
let formresult = $form.data('tildaformresult');
let leadid = formresult.tranId;
var arr = {};
$($form.serializeArray()).each(function (i, el) {
arr[el.name] = el.value;
});
if (leadid !== undefined && leadid !== '0' && arr.Name !== undefined && arr.Name !== '' ) {
let personInfo={};
personInfo['personNm'] = arr.Name;
personInfo['personLeadNum'] = leadid.split(':')[1];
localStorage.setItem ("personInfo", JSON.stringify(personInfo));
writeMessage(personInfo);
$('.t-form-success-popup__text').html(newSuccMsg);
};
let successUrl = $form.attr('data-success-url');
if (successUrl !== undefined && successUrl !== '') {window.location.href = successUrl };
};
$(document).ready(function () {
if (localStorage.getItem('personInfo') !== null) {
let personInfoLoad = JSON.parse(localStorage.getItem("personInfo"));
writeMessage(personInfoLoad);
$('.personinfo .tn-atom').html(newSuccMsg);
};
});
</script>