window['RequestAccessConst'] = { moduleId: 'mmarket', host: 'https://nextype.ru', formAction: '/solutions/access/script.php', cssFiles: [ 'https://nextype.ru/solutions/access/styles.css?b3de975de2592072f0f9c2e366609755' ], templates: { container: '
Доступ в админку
', form: '
Демо-доступ к сайту
Логин и пароль для доступа мы пришлем на указанный e-mail
', success: '
Запрос на демо-доступ к сайту принят
Логин и пароль для доступа мы пришлем на указанный e-mail
' } }; var RequestAccess = { container: false, init: function () { var self = this; BX.loadCSS(window.RequestAccessConst.cssFiles); self.container = $('
').addClass(window.RequestAccessConst.moduleId).html(window.RequestAccessConst.templates.container); self.container.find('.nt_aaccess_btn').on('click', function () { $(this).parents('.nt_aaccess').addClass('open'); }); self.container.find('.nt_aaccess_close').on('click', function () { $(this).parents('.nt_aaccess').removeClass('open'); }); var form = self.container.find('.nt_aaccess_form').html(window.RequestAccessConst.templates.form).find('form'); form.on('submit', function (event) { $(this).find('button[type="submit"]').attr('disabled', 'disabled'); $.ajax({ url: window.RequestAccessConst.host + window.RequestAccessConst.formAction, type: 'post', dataType: "html", data: $(this).serialize(), success: function (data) { self.container.find('.nt_aaccess_form').addClass('success').html(window.RequestAccessConst.templates.success); self.container.find('.nt_aaccess_close_btn').on('click', function () { self.container.removeClass('open'); }); }, fail: function () { $(this).find('button[type="submit"]').removeAttr('disabled'); alert('При отправке запроса произошла ошибка. Повторите запрос позже.'); } }); event.preventDefault(); return false; }); form.find('input[name="agree"]').on('change', function () { if (!$(this).is(':checked')) { $(this).parents('form').find('button[type="submit"]').attr('disabled', 'disabled'); } else { $(this).parents('form').find('button[type="submit"]').removeAttr('disabled'); } }); self.container.find('.nt_aaccess_overflow').on('click', function () { self.container.removeClass('open'); }); $("body").append(self.container); } }; $(function() { RequestAccess.init(); });