ng-easycommerce 0.0.623 → 0.0.624
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/assets/ec-i18n/ct.json +2 -1
- package/assets/ec-i18n/en.json +2 -1
- package/assets/ec-i18n/es.json +1 -0
- package/assets/ec-i18n/fr.json +2 -1
- package/assets/ec-i18n/gl.json +2 -1
- package/assets/ec-i18n/pr.json +2 -1
- package/bundles/ng-easycommerce.umd.js +48 -19
- package/bundles/ng-easycommerce.umd.js.map +1 -1
- package/bundles/ng-easycommerce.umd.min.js +1 -1
- package/bundles/ng-easycommerce.umd.min.js.map +1 -1
- package/esm2015/lib/ec-component/product-detail-ec/product-detail-ec.component.js +35 -17
- package/esm2015/lib/services/products/product-detail.service.js +11 -4
- package/esm5/lib/ec-component/product-detail-ec/product-detail-ec.component.js +39 -17
- package/esm5/lib/services/products/product-detail.service.js +11 -4
- package/fesm2015/ng-easycommerce.js +44 -19
- package/fesm2015/ng-easycommerce.js.map +1 -1
- package/fesm5/ng-easycommerce.js +48 -19
- package/fesm5/ng-easycommerce.js.map +1 -1
- package/lib/ec-component/product-detail-ec/product-detail-ec.component.d.ts +9 -7
- package/package.json +1 -1
package/fesm5/ng-easycommerce.js
CHANGED
|
@@ -10750,15 +10750,22 @@ var ProductDetailService = /** @class */ (function () {
|
|
|
10750
10750
|
this.validateQuantity = function (quantity) {
|
|
10751
10751
|
var actualQuantity = _this.cartService.getCountFromItemInCart(_this.variants[0].code);
|
|
10752
10752
|
var asociatedData = _this.asociatedDataSubject.value;
|
|
10753
|
-
|
|
10754
|
-
|
|
10753
|
+
var totalQuantity = actualQuantity + quantity;
|
|
10754
|
+
console.log('La cantidad que llegó: ', quantity, ' y la cantidad actual: ', actualQuantity);
|
|
10755
|
+
if (asociatedData.maximumItemsQuantity && totalQuantity > asociatedData.maximumItemsQuantity) {
|
|
10755
10756
|
_this.toastrService.show('maximum-items-quantity', { quantity: asociatedData.maximumItemsQuantity });
|
|
10756
10757
|
return false;
|
|
10757
10758
|
}
|
|
10758
|
-
if (
|
|
10759
|
+
if (asociatedData.minimumItemsQuantity && totalQuantity < asociatedData.minimumItemsQuantity) {
|
|
10759
10760
|
_this.toastrService.show('minimum-items-quantity', { quantity: asociatedData.minimumItemsQuantity });
|
|
10760
10761
|
return false;
|
|
10761
10762
|
}
|
|
10763
|
+
if (asociatedData.multipleQuantity && asociatedData.multipleQuantity > 0) {
|
|
10764
|
+
if (totalQuantity % asociatedData.multipleQuantity !== 0) {
|
|
10765
|
+
_this.toastrService.show('must-be-multiple', { quantity: asociatedData.multipleQuantity });
|
|
10766
|
+
return false;
|
|
10767
|
+
}
|
|
10768
|
+
}
|
|
10762
10769
|
return true;
|
|
10763
10770
|
};
|
|
10764
10771
|
this.validatePriceAndCredits = function (price) {
|
|
@@ -10989,29 +10996,51 @@ var ProductDetailEcComponent = /** @class */ (function (_super) {
|
|
|
10989
10996
|
};
|
|
10990
10997
|
/**
|
|
10991
10998
|
* @description actualiza la variable quantity sumandole 'x' contenido.
|
|
10992
|
-
* @param stock
|
|
10993
|
-
* @param
|
|
10999
|
+
* @param stock número máximo disponible en stock.
|
|
11000
|
+
* @param changeAmount cantidad que se quiere sumar.
|
|
11001
|
+
* @param forceMultiple si es true, obliga a que el resultado sea múltiplo de changeAmount.
|
|
10994
11002
|
*/
|
|
10995
|
-
_this.plus = function (stock,
|
|
10996
|
-
if (
|
|
10997
|
-
|
|
10998
|
-
|
|
11003
|
+
_this.plus = function (stock, changeAmount, forceMultiple) {
|
|
11004
|
+
if (changeAmount === void 0) { changeAmount = 1; }
|
|
11005
|
+
if (forceMultiple === void 0) { forceMultiple = false; }
|
|
11006
|
+
var newQuantity = _this.quantity + changeAmount;
|
|
11007
|
+
if (forceMultiple && changeAmount > 0) {
|
|
11008
|
+
if (_this.quantity < changeAmount) {
|
|
11009
|
+
newQuantity = changeAmount;
|
|
11010
|
+
}
|
|
11011
|
+
else {
|
|
11012
|
+
newQuantity = Math.ceil(newQuantity / changeAmount) * changeAmount;
|
|
11013
|
+
}
|
|
11014
|
+
}
|
|
11015
|
+
if (!stock || newQuantity <= stock) {
|
|
11016
|
+
_this.quantity = newQuantity;
|
|
10999
11017
|
}
|
|
11000
11018
|
else {
|
|
11001
|
-
|
|
11002
|
-
: _this.quantity = _this.quantity + 1;
|
|
11019
|
+
_this.toastrService.show('out-of-stock-actually');
|
|
11003
11020
|
}
|
|
11004
11021
|
};
|
|
11005
11022
|
/**
|
|
11006
|
-
|
|
11007
|
-
|
|
11008
|
-
|
|
11009
|
-
|
|
11010
|
-
|
|
11011
|
-
|
|
11023
|
+
* @description actualiza la variable quantity restandole 'x' contenido.
|
|
11024
|
+
* @param changeAmount cantidad que se quiere restar.
|
|
11025
|
+
* @param forceMultiple si es true, obliga a que el resultado sea múltiplo de changeAmount.
|
|
11026
|
+
*/
|
|
11027
|
+
_this.less = function (changeAmount, forceMultiple) {
|
|
11028
|
+
if (changeAmount === void 0) { changeAmount = 1; }
|
|
11029
|
+
if (forceMultiple === void 0) { forceMultiple = false; }
|
|
11030
|
+
var newQuantity = _this.quantity - changeAmount;
|
|
11031
|
+
if (forceMultiple && changeAmount > 0) {
|
|
11032
|
+
if (_this.quantity <= changeAmount) {
|
|
11033
|
+
newQuantity = changeAmount;
|
|
11034
|
+
}
|
|
11035
|
+
else {
|
|
11036
|
+
newQuantity = Math.floor(newQuantity / changeAmount) * changeAmount;
|
|
11037
|
+
}
|
|
11038
|
+
if (newQuantity < changeAmount) {
|
|
11039
|
+
newQuantity = changeAmount;
|
|
11040
|
+
}
|
|
11012
11041
|
}
|
|
11013
|
-
|
|
11014
|
-
_this.quantity
|
|
11042
|
+
if (newQuantity >= 1) {
|
|
11043
|
+
_this.quantity = newQuantity;
|
|
11015
11044
|
}
|
|
11016
11045
|
};
|
|
11017
11046
|
_this.showContact = function () { return _this.show = true; };
|