/*
* PrivateShop
*
* Do not edit or add to this file.
* You are not authorized to modify, copy or redistribute this file.
* Permissions are reserved by FME Modules.
*
* @author FME Modules
* @copyright 2021 FME Modules All right reserved
* @license FME Modules
* @category FMM Modules
* @package PrivateShop
*/
$(document).on('submit', '#private-page', function(e){
e.preventDefault();
e.stopImmediatePropagation();
var jsonData = {
type : "POST",
cache : false,
url : $(this).attr('action'),
dataType : "json",
data : {
action : 'protectedAccess',
ajax : true,
passwd : $.trim($('input[name=password]').val())
},
success: function(response) {
if (response.success == false && response.errors != '') {
var __html = '
';
$('#protect-access-error').html(__html);
} else if (response.success) {
$('#protect-access-error').html('');
window.location.reload();
//location.href = response.redirect_url;
}
},
error : function(XMLHttpRequest, textStatus, errorThrown) {
console.log(textStatus + '
' + errorThrown);
}
};
$.ajax(jsonData);
});
function ContactForm()
{
$('.alert-danger, .error').hide();
$('#private_page_password_form').hide();
$('#private-login').hide();
$('#private-contact-form').show();
$('.alert').addClass('private_error_resp');
}
function backToPrevious() {
$('.alert-danger, .error').hide();
$('#private-contact-form').hide()
$('#private_page_password_form').show();
}
function sendMessage(el) {
var gif_loader = $('#gif_loader');
gif_loader.show();
var form_data = $('#private-contact_form form').serialize();
var formData = new FormData($(el).closest('form').get(0));
var requestData = {
type : 'POST',
url : message_url,
dataType : 'json',
data : formData,
contentType : false,
cache : false,
processData : false,
success: function(jsonData) {
if (jsonData.errors > 0) {
var __html = '';
$('#error_holder').html(__html);
gif_loader.hide();
} else {
console.log(jsonData);
$('#error_holder').html('');
if (jsonData.redirect === true) {
window.location = jsonData.redirect_url;
} else {
$('#new-private-account').html(jsonData.message);
}
$('#customer_message_email').val('');
$('#customer_message_subject').val('');
$('#customer_message_message').val('');
$('#privateshoplite_pending_message').html('You message request has been sent');
$('#private-back').show();
gif_loader.hide();
}
},
error : function(XMLHttpRequest, textStatus, errorThrown) {
gif_loader.hide();
}
};
$.ajax(requestData);
}