update
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
/**
|
||||
* Copyright since 2007 PrestaShop SA and Contributors
|
||||
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.md.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* https://opensource.org/licenses/OSL-3.0
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to https://devdocs.prestashop.com/ for more information.
|
||||
*
|
||||
* @author PrestaShop SA and Contributors <contact@prestashop.com>
|
||||
* @copyright Since 2007 PrestaShop SA and Contributors
|
||||
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
||||
*/
|
||||
|
||||
/**
|
||||
* Defines all selectors that are used in catalog price rule add/edit form.
|
||||
*/
|
||||
export default {
|
||||
// mapping for price-field-availability-handler
|
||||
initialPrice: '#catalog_price_rule_leave_initial_price',
|
||||
price: '#catalog_price_rule_price',
|
||||
|
||||
// mapping for include-tax-field-visibility-handler
|
||||
reductionType: '.js-reduction-type-source',
|
||||
includeTax: '.js-include-tax-target',
|
||||
};
|
||||
@@ -0,0 +1,53 @@
|
||||
/**
|
||||
* Copyright since 2007 PrestaShop SA and Contributors
|
||||
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.md.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* https://opensource.org/licenses/OSL-3.0
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to https://devdocs.prestashop.com/ for more information.
|
||||
*
|
||||
* @author PrestaShop SA and Contributors <contact@prestashop.com>
|
||||
* @copyright Since 2007 PrestaShop SA and Contributors
|
||||
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
||||
*/
|
||||
|
||||
const {$} = window;
|
||||
|
||||
/**
|
||||
* Shows/hides 'include_tax' field depending from 'reduction_type' field value
|
||||
*/
|
||||
export default class IncludeTaxFieldVisibilityHandler {
|
||||
constructor(sourceSelector, targetSelector) {
|
||||
this.$sourceSelector = $(sourceSelector);
|
||||
this.$targetSelector = $(targetSelector);
|
||||
this.handle();
|
||||
this.$sourceSelector.on('change', () => this.handle());
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
/**
|
||||
* When source value is 'percentage', target field is shown, else hidden
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
handle() {
|
||||
if (this.$sourceSelector.val() === 'percentage') {
|
||||
this.$targetSelector.fadeOut();
|
||||
} else {
|
||||
this.$targetSelector.fadeIn();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
/**
|
||||
* Copyright since 2007 PrestaShop SA and Contributors
|
||||
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.md.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* https://opensource.org/licenses/OSL-3.0
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to https://devdocs.prestashop.com/ for more information.
|
||||
*
|
||||
* @author PrestaShop SA and Contributors <contact@prestashop.com>
|
||||
* @copyright Since 2007 PrestaShop SA and Contributors
|
||||
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
||||
*/
|
||||
|
||||
import PriceFieldAvailabilityHandler
|
||||
from './price-field-availability-handler';
|
||||
|
||||
import IncludeTaxFieldVisibilityHandler
|
||||
from './include-tax-field-visibility-handler';
|
||||
import CatalogPriceRuleFormMap from './catalog-price-rule-form-map';
|
||||
|
||||
const {$} = window;
|
||||
|
||||
$(() => {
|
||||
new PriceFieldAvailabilityHandler(
|
||||
CatalogPriceRuleFormMap.initialPrice,
|
||||
CatalogPriceRuleFormMap.price,
|
||||
);
|
||||
new IncludeTaxFieldVisibilityHandler(
|
||||
CatalogPriceRuleFormMap.reductionType,
|
||||
CatalogPriceRuleFormMap.includeTax,
|
||||
);
|
||||
});
|
||||
@@ -0,0 +1,51 @@
|
||||
/**
|
||||
* Copyright since 2007 PrestaShop SA and Contributors
|
||||
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.md.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* https://opensource.org/licenses/OSL-3.0
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to https://devdocs.prestashop.com/ for more information.
|
||||
*
|
||||
* @author PrestaShop SA and Contributors <contact@prestashop.com>
|
||||
* @copyright Since 2007 PrestaShop SA and Contributors
|
||||
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
||||
*/
|
||||
|
||||
const {$} = window;
|
||||
|
||||
/**
|
||||
* Enables/disables 'price' field depending from 'leave_initial_price' field checkbox value
|
||||
*/
|
||||
export default class PriceFieldAvailabilityHandler {
|
||||
constructor(checkboxSelector, targetSelector) {
|
||||
this.$sourceSelector = $(checkboxSelector);
|
||||
this.$targetSelector = $(targetSelector);
|
||||
this.handle();
|
||||
this.$sourceSelector.on('change', () => this.handle());
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
/**
|
||||
* When checkbox value is 1, target field is disabled, else enabled
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
handle() {
|
||||
const checkboxVal = this.$sourceSelector.is(':checked');
|
||||
|
||||
this.$targetSelector.prop('disabled', checkboxVal);
|
||||
}
|
||||
}
|
||||
50
iadmin/themes/new-theme/js/pages/catalog-price-rule/index.js
Normal file
50
iadmin/themes/new-theme/js/pages/catalog-price-rule/index.js
Normal file
@@ -0,0 +1,50 @@
|
||||
/**
|
||||
* Copyright since 2007 PrestaShop SA and Contributors
|
||||
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.md.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* https://opensource.org/licenses/OSL-3.0
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to https://devdocs.prestashop.com/ for more information.
|
||||
*
|
||||
* @author PrestaShop SA and Contributors <contact@prestashop.com>
|
||||
* @copyright Since 2007 PrestaShop SA and Contributors
|
||||
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
||||
*/
|
||||
|
||||
import Grid from '@components/grid/grid';
|
||||
import SortingExtension from '@components/grid/extension/sorting-extension';
|
||||
import FiltersResetExtension from '@components/grid/extension/filters-reset-extension';
|
||||
import ReloadListActionExtension from '@components/grid/extension/reload-list-extension';
|
||||
import SubmitRowActionExtension from '@components/grid/extension/action/row/submit-row-action-extension';
|
||||
import SubmitBulkExtension from '@components/grid/extension/submit-bulk-action-extension';
|
||||
import BulkActionCheckboxExtension from '@components/grid/extension/bulk-action-checkbox-extension';
|
||||
import ExportToSqlManagerExtension from '@components/grid/extension/export-to-sql-manager-extension';
|
||||
import FiltersSubmitButtonEnablerExtension
|
||||
from '@components/grid/extension/filters-submit-button-enabler-extension';
|
||||
|
||||
const {$} = window;
|
||||
|
||||
$(() => {
|
||||
const priceRuleGrid = new Grid('catalog_price_rule');
|
||||
|
||||
priceRuleGrid.addExtension(new ExportToSqlManagerExtension());
|
||||
priceRuleGrid.addExtension(new ReloadListActionExtension());
|
||||
priceRuleGrid.addExtension(new SortingExtension());
|
||||
priceRuleGrid.addExtension(new FiltersResetExtension());
|
||||
priceRuleGrid.addExtension(new SubmitRowActionExtension());
|
||||
priceRuleGrid.addExtension(new SubmitBulkExtension());
|
||||
priceRuleGrid.addExtension(new BulkActionCheckboxExtension());
|
||||
priceRuleGrid.addExtension(new FiltersSubmitButtonEnablerExtension());
|
||||
});
|
||||
Reference in New Issue
Block a user