Files
b2b.redline.com.pl/modules/privateshoplite/views/js/back.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

127 lines
4.3 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).ready(function() {
toggleCategoryField('CATEGORY_SELECTION_ENABLED_DISABLED', 'categories_selection');
toggleCategoryField('PRODUCT_SELECTION_ENABLED_DISABLED', 'product_selection');
toggleCategoryField('SUPPLIER_SELECTION_ENABLED_DISABLED', 'supplier_selection');
toggleCategoryField('MANUFACTURER_SELECTION_ENABLED_DISABLED', 'manufacturer_selection');
toggleCategoryField('CMS_SELECTION_ENABLED_DISABLED', 'cms_selection');
togglemodule('PRIVATE_ENABLED_DISABLED', 'general_selected_part');
$('input[name="CATEGORY_SELECTION_ENABLED_DISABLED"]').change(function() {
toggleCategoryField('CATEGORY_SELECTION_ENABLED_DISABLED', 'categories_selection');
});
$('input[name="PRIVATE_ENABLED_DISABLED"]').change(function() {
togglemodule('PRIVATE_ENABLED_DISABLED', 'general_selected_part');
});
$('input[name="PRODUCT_SELECTION_ENABLED_DISABLED"]').change(function() {
toggleCategoryField('PRODUCT_SELECTION_ENABLED_DISABLED', 'product_selection');
});
$('input[name="SUPPLIER_SELECTION_ENABLED_DISABLED"]').change(function() {
toggleCategoryField('SUPPLIER_SELECTION_ENABLED_DISABLED', 'supplier_selection');
});
$('input[name="MANUFACTURER_SELECTION_ENABLED_DISABLED"]').change(function() {
toggleCategoryField('MANUFACTURER_SELECTION_ENABLED_DISABLED', 'manufacturer_selection');
});
$('input[name="CMS_SELECTION_ENABLED_DISABLED"]').change(function() {
toggleCategoryField('CMS_SELECTION_ENABLED_DISABLED', 'cms_selection');
});
$('#privateshop-settings-delete-logo').on('click', function() {
var filename = $('#privateshop-settings-delete-logo').data('filename');
$.ajax({
type: 'POST',
url: delete_url,
dataType : 'json',
data: {
key: 'PRIVATE_CUSTOM_LOGO_IMG'
},
success: function(jsonData) {
var messageDiv = $('#logo-message');
messageDiv.hide();
if (jsonData['success']) {
location.reload();
} else {
messageDiv
.removeClass('alert-success')
.addClass('alert alert-danger')
.text('An error occurred: ' + [jsonData['message']].message)
.show();
}
},
error: function(xhr, status, error) {
$('#logo-message')
.removeClass('alert-success')
.addClass('alert alert-danger')
.text('An error occurred: ' + error)
.show();
}
});
});
$('#privateshop-settings-delete-temp-img').on('click', function() {
var filename = $('#privateshop-settings-delete-temp-img').data('filename');
$.ajax({
type: 'POST',
url: delete_url,
dataType : 'json',
data: {
key: 'BACKGROUND_VIDEO_IMG'
},
success: function(response) {
var messageDiv = $('#temp-img-message');
messageDiv.hide();
if (response['success']) {
location.reload();
} else {
messageDiv
.removeClass('alert-success')
.addClass('alert alert-danger')
.text('An error occurred: ' + [response['message']].message)
.show();
}
},
error: function(xhr, status, error) {
$('#logo-message')
.removeClass('alert-success')
.addClass('alert alert-danger')
.text('An error occurred: ' + error)
.show();
}
});
});
});
function toggleCategoryField(fieldname, id) {
if ($('input[name="' + fieldname + '"]:checked').val() == '1') {
$('#' + id).show();
} else {
$('#' + id).hide();
}
}
function togglemodule(fieldname, cl) {
if ($('input[name="' + fieldname + '"]:checked').val() == '1') {
$('.' + cl).show();
} else {
$('.' + cl).hide();
}
}