Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate Sell > Catalog > Catalog price rule create/edit action #13716

Merged
merged 54 commits into from Nov 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
84df352
Initial commit. Renders empty create page
zuk3975 May 8, 2019
5b3be5f
Creates form type
zuk3975 May 8, 2019
2bc90f4
Adds shop names choice provider
zuk3975 May 9, 2019
54bec08
Renders create form
zuk3975 May 9, 2019
a831335
Moves choice providers outside form type
zuk3975 May 9, 2019
bcf4de5
Implements create action
zuk3975 May 9, 2019
c5450f3
Enables javascript for create form
zuk3975 May 9, 2019
098e7a1
Implements edit action
zuk3975 May 10, 2019
e22a2e9
Applies cs-fixer
zuk3975 May 10, 2019
31074ea
Restricts to all shop context for SpecificPriceRule controller
zuk3975 May 13, 2019
9ea3417
Removes wrong date fill on add action
zuk3975 May 13, 2019
4d109af
Modifies "todo" comments, adds float typecasting instead of hardcoded…
zuk3975 May 13, 2019
30d9833
Extends datepicker to enable modifying date-time format
zuk3975 May 14, 2019
f745395
Adds constraint to price field
zuk3975 May 14, 2019
2ae9635
Modifies price checkless than zero instead of float
zuk3975 May 14, 2019
24e5e18
Adds missing discount application to products and fixes multiShop beh…
zuk3975 May 15, 2019
bde4c4f
Optimizes code with minor refactoring works
zuk3975 May 15, 2019
079d8c1
Clarifies and fixes some properties in commands
zuk3975 May 15, 2019
831737a
Optimizes code, fixes caching issue on edit action
zuk3975 May 16, 2019
aa9a130
Enable legacy_links
zuk3975 May 16, 2019
440d8f6
Fixes tiny wording typo
zuk3975 May 21, 2019
dede143
WIP
zuk3975 Jun 13, 2019
d2c4271
Adds include tax fiel show/hide handler
zuk3975 Jun 13, 2019
32f9d8f
Fixes initial price
zuk3975 Jun 13, 2019
f074be7
Creats new VO Reduction with its business logic. Modifies create/edit…
zuk3975 Jun 13, 2019
18a1509
Adds reduction constraint
zuk3975 Jun 17, 2019
9960307
Refactors reduction constraint
zuk3975 Jun 17, 2019
30ff804
Removes testing data from choice provider
zuk3975 Jun 17, 2019
bae49f4
Fixes default Reduction constraint messages
zuk3975 Jun 17, 2019
740c5d2
Switched to using VO's in EditableCatalogPriceRule constructor instea…
zuk3975 Jun 17, 2019
8ee75a9
Switches using constants in choice provider. Removed unnecessary code.
zuk3975 Jun 17, 2019
2295f6d
Adds form_rest
zuk3975 Jun 25, 2019
e7d60b0
Some minor argument renaming and code styling
zuk3975 Jun 25, 2019
fcf414f
In progress implementing strict typing
zuk3975 Jul 18, 2019
d3de3bd
Adds strict types to this pr classes
zuk3975 Jul 19, 2019
8572a66
Catch generic Exception. Handle dateTime null.
zuk3975 Jul 19, 2019
ed0e83e
Adds js selectors mapping in form
zuk3975 Jul 19, 2019
fa84321
adds index.js file that belong sto previous commit
zuk3975 Jul 19, 2019
c5b415d
Adds todo in routes, modifies translation wording in form
zuk3975 Jul 19, 2019
579988b
Modify DateTime Error message
zuk3975 Jul 19, 2019
fbaeb49
Minor optimization in VO
zuk3975 Jul 19, 2019
70952b2
Implements Decimal/Numeric to price and reduction
zuk3975 Jul 22, 2019
a61330a
Minor code cleaning in reduction VO
zuk3975 Jul 22, 2019
bbb0538
Adds quantity field constraint
zuk3975 Sep 24, 2019
7749d89
Fixes todo for DateTime::Null constant
zuk3975 Sep 24, 2019
4cf935e
Fix typo in const
zuk3975 Sep 24, 2019
193a486
Removes unused types, added on rebasing
zuk3975 Sep 24, 2019
847fe2c
Extract Reduction validation from constructor in Constraint validator
zuk3975 Sep 24, 2019
1db8083
Clarify exception names
zuk3975 Sep 24, 2019
c29aa51
Some code optimization
zuk3975 Sep 27, 2019
50b9c77
Set error path for ReductionConstraint
zuk3975 Oct 9, 2019
ffd12e6
Adds validation of date range
zuk3975 Oct 9, 2019
1b300df
Fix wrong array element selction in handler. Add namespace for native…
zuk3975 Oct 10, 2019
82de15e
rebuilds assets
zuk3975 Nov 11, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions admin-dev/themes/new-theme/.webpack/common.js
Expand Up @@ -38,6 +38,7 @@ module.exports = {
backup: './js/pages/backup',
catalog: './js/app/pages/catalog',
catalog_product: './js/pages/catalog/product',
catalog_price_rule_form: './js/pages/catalog-price-rule/form',
category: './js/pages/category',
cldr: './js/app/cldr',
cms_page: './js/pages/cms-page',
Expand Down
@@ -0,0 +1,37 @@
/**
* 2007-2019 PrestaShop and Contributors
*
* 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.txt.
* 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://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2019 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/

/**
* 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 @@
/**
* 2007-2019 PrestaShop and Contributors
*
* 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.txt.
* 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://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2019 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/

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 @@
/**
* 2007-2019 PrestaShop and Contributors
*
* 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.txt.
* 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://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2019 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/

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 @@
/**
* 2007-2019 PrestaShop and Contributors
*
* 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.txt.
* 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://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2019 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/

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);
}
}
4 changes: 2 additions & 2 deletions admin-dev/themes/new-theme/public/attachment.bundle.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.