ng-easycommerce 0.0.631 → 0.0.632

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.
@@ -4122,6 +4122,14 @@ var ChannelConfigService = /** @class */ (function () {
4122
4122
  this.getChannels();
4123
4123
  this.getLocales();
4124
4124
  }
4125
+ /**
4126
+ * @description Devuelve si se deben mostrar precios con impuestos durante la navegación.
4127
+ * @returns {boolean | null} true/false si está definido, null si aún no hay configuración
4128
+ */
4129
+ ChannelConfigService$1.prototype.getShowPricesWithTaxes = function () {
4130
+ var _a, _b;
4131
+ return _b = (_a = this.channel) === null || _a === void 0 ? void 0 : _a.showPriceWithTaxesWhileBrowsing, (_b !== null && _b !== void 0 ? _b : null);
4132
+ };
4125
4133
  ChannelConfigService$1.ctorParameters = function () { return [
4126
4134
  { type: Constants },
4127
4135
  { type: undefined, decorators: [{ type: Inject, args: ['env',] }] },
@@ -10844,11 +10852,18 @@ var ProductDetailService = /** @class */ (function () {
10844
10852
  return min_price == max_price ? max_price.toString() : min_price + ' - ' + max_price;
10845
10853
  };
10846
10854
  this.inRange = function (quantity, min, max) { return ((quantity - min) * (quantity - max) <= 0); };
10847
- this.validateQuantity = function (quantity) {
10848
- var actualQuantity = _this.cartService.getCountFromItemInCart(_this.variants[0].code);
10855
+ this.validateQuantity = function (quantity, variantCode) {
10856
+ var _a, _b;
10857
+ var codeToCheck = variantCode || _this.variants[0].code;
10858
+ var actualQuantity = _this.cartService.getCountFromItemInCart(codeToCheck);
10849
10859
  var asociatedData = _this.asociatedDataSubject.value;
10850
10860
  var totalQuantity = actualQuantity + quantity;
10851
- console.log('La cantidad que llegó: ', quantity, ' y la cantidad actual: ', actualQuantity);
10861
+ var variant = _this.variants.find(function (v) { return v.code === codeToCheck; });
10862
+ var stock = (_b = (_a = variant) === null || _a === void 0 ? void 0 : _a.stock, (_b !== null && _b !== void 0 ? _b : 0));
10863
+ if (totalQuantity > stock) {
10864
+ _this.toastrService.show('out-of-stock-actually');
10865
+ return false;
10866
+ }
10852
10867
  if (asociatedData.maximumItemsQuantity && totalQuantity > asociatedData.maximumItemsQuantity) {
10853
10868
  _this.toastrService.show('maximum-items-quantity', { quantity: asociatedData.maximumItemsQuantity });
10854
10869
  return false;
@@ -10941,7 +10956,7 @@ var ProductDetailService = /** @class */ (function () {
10941
10956
  }
10942
10957
  if (!variant)
10943
10958
  return;
10944
- if (!this.validateQuantity(quantity))
10959
+ if (!this.validateQuantity(quantity, variant.code))
10945
10960
  return;
10946
10961
  var priceToValidate = product_selected.saleprice ? product_selected.saleprice * quantity : product_selected.price * quantity;
10947
10962
  if (!this.validatePriceAndCredits(priceToValidate))