Files
b2b.redline.com.pl/modules/privateshoplite/views/js/protected-page.js
Jacek Pyziak 4d2561ce4e Add PrivateShop module templates and initial setup files
- Created restricted.tpl for displaying restricted access messages with customizable background options.
- Added index.php files in hook and main template directories to prevent direct access and ensure proper redirection.
- Implemented info.tpl to provide module information and support links, enhancing user experience with promotional content.
- Included necessary CSS styles for the new templates to ensure proper layout and responsiveness.
2025-07-04 01:27:12 +02:00

100 lines
3.4 KiB
JavaScript

/*
* 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 = '<div class="alert alert-danger"><ol><li>' + response.errors + '</li></ol></div>';
$('#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 + '<br>' + 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 = '<div class="alert alert-danger" id="ps17_errors"><ol><li>' + jsonData.html + '</li></ol></div>';
$('#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);
}