/** * 2017-2019 Zemez * * JX Deal of Day * * NOTICE OF LICENSE * * This source file is subject to the General Public License (GPL 2.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://opensource.org/licenses/GPL-2.0 * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade the module to newer * versions in the future. * * @author Zemez (Sergiy Sakun) * @copyright 2017-2019 Zemez * @license http://opensource.org/licenses/GPL-2.0 General Public License (GPL 2.0) */ function JXDayDealCheckbox() { $('.daydeal-checkbox').click(function() { if ($(this).prop('checked') == true) { $('#module_form .form-wrapper .form-group').next().addClass('hidden'); } else if ($(this).prop('checked') == false) { $('#module_form .form-wrapper .form-group').next().removeClass('hidden'); } $('.daydeal-checkbox').not(this).prop('checked', false); }); } $(document).ready(function() { $('select#reduction_type').bind('change', function(e) { if ($('select#reduction_type').val() == 'percentage') { $('select#reduction_tax').hide(); } else { $('select#reduction_tax').show(); } }).trigger('change'); $('.daydeal-alert-container').insertAfter('#divproducts'); JXDayDealCheckbox(); }); function updateProductInfo() { $('.daydeal-prices').remove(); $('#module_form .form-wrapper .form-group').next().removeClass('hidden'); var product_id = $('input#inputproducts').val().replace(/\-/g, ''); $.ajax({ type : 'POST', url : theme_url + '&ajax', headers : {"cache-control" : "no-cache"}, dataType : 'json', async : false, data : { action : 'getProductsSpecificPrice', productId : product_id }, success : function(response) { if (response.status) { displayJXDayDealWarning(response.data); } } }); } function displayJXDayDealWarning(data) { jxdaydealWarningMessage = ''; for (i = 0; i < data.length; i++) { jxdaydealWarningMessage += '
'; jxdaydealWarningMessage += jxdd_msg; jxdaydealWarningMessage += '
'; jxdaydealWarningMessage += ''; jxdaydealWarningMessage += jxdd_msg_period; jxdaydealWarningMessage += ' ' jxdaydealWarningMessage += data[i]['from']; jxdaydealWarningMessage += ' - '; jxdaydealWarningMessage += data[i]['to']; jxdaydealWarningMessage += '
'; jxdaydealWarningMessage += ''; jxdaydealWarningMessage += jxdd_msg_sale; jxdaydealWarningMessage += ' ' jxdaydealWarningMessage += data[i]['reduction']; jxdaydealWarningMessage += ' ' jxdaydealWarningMessage += data[i]['reduction_type']; if (data[i]['reduction_type'] == 'amount') { jxdaydealWarningMessage += ','; jxdaydealWarningMessage += ' ' if (data[i]['reduction_tax'] == 1) { jxdaydealWarningMessage += jxdd_msg_included; } if (data[i]['reduction_tax'] == 0) { jxdaydealWarningMessage += jxdd_msg_excluded; } } jxdaydealWarningMessage += '
'; if (!data[i]['status']) { id_specific_price = data[i]['id_specific_price']; jxdaydealWarningMessage += ''; } jxdaydealWarningMessage += '