@pisell/pisellos 0.0.145 → 0.0.146
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.
|
@@ -61,6 +61,7 @@ export interface Discount {
|
|
|
61
61
|
applicableProductIds?: number[];
|
|
62
62
|
applicableProductDetails: ApplicableProductDetails[];
|
|
63
63
|
appliedProductDetails: ApplicableProductDetails[];
|
|
64
|
+
isDisabledForProductUsed?: boolean;
|
|
64
65
|
}
|
|
65
66
|
export interface DiscountState {
|
|
66
67
|
discountList: Discount[];
|
|
@@ -460,6 +460,20 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
460
460
|
var newDiscountList = [].concat(editModeDiscountList, _toConsumableArray(discountList.filter(function (item) {
|
|
461
461
|
return !item.isDisabled;
|
|
462
462
|
})));
|
|
463
|
+
var allUsedProductIds = newDiscountList.map(function (n) {
|
|
464
|
+
return n.isSelected ? n.applicableProductIds : [];
|
|
465
|
+
}).flat();
|
|
466
|
+
newDiscountList.forEach(function (item) {
|
|
467
|
+
var _item$applicableProdu;
|
|
468
|
+
var isAllProductUsed = (_item$applicableProdu = item.applicableProductIds) === null || _item$applicableProdu === void 0 ? void 0 : _item$applicableProdu.every(function (id) {
|
|
469
|
+
return allUsedProductIds === null || allUsedProductIds === void 0 ? void 0 : allUsedProductIds.includes(id);
|
|
470
|
+
});
|
|
471
|
+
if (!item.isSelected && isAllProductUsed) {
|
|
472
|
+
item.isDisabledForProductUsed = true;
|
|
473
|
+
} else {
|
|
474
|
+
item.isDisabledForProductUsed = false;
|
|
475
|
+
}
|
|
476
|
+
});
|
|
463
477
|
(_this$store$discount5 = this.store.discount) === null || _this$store$discount5 === void 0 || _this$store$discount5.setDiscountList(newDiscountList);
|
|
464
478
|
this.emitDiscountListChange(newDiscountList);
|
|
465
479
|
return newDiscountList;
|
|
@@ -61,6 +61,7 @@ export interface Discount {
|
|
|
61
61
|
applicableProductIds?: number[];
|
|
62
62
|
applicableProductDetails: ApplicableProductDetails[];
|
|
63
63
|
appliedProductDetails: ApplicableProductDetails[];
|
|
64
|
+
isDisabledForProductUsed?: boolean;
|
|
64
65
|
}
|
|
65
66
|
export interface DiscountState {
|
|
66
67
|
discountList: Discount[];
|
|
@@ -296,6 +296,18 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
|
296
296
|
...editModeDiscountList,
|
|
297
297
|
...discountList.filter((item) => !item.isDisabled)
|
|
298
298
|
];
|
|
299
|
+
const allUsedProductIds = newDiscountList.map((n) => n.isSelected ? n.applicableProductIds : []).flat();
|
|
300
|
+
newDiscountList.forEach((item) => {
|
|
301
|
+
var _a2;
|
|
302
|
+
const isAllProductUsed = (_a2 = item.applicableProductIds) == null ? void 0 : _a2.every((id) => {
|
|
303
|
+
return allUsedProductIds == null ? void 0 : allUsedProductIds.includes(id);
|
|
304
|
+
});
|
|
305
|
+
if (!item.isSelected && isAllProductUsed) {
|
|
306
|
+
item.isDisabledForProductUsed = true;
|
|
307
|
+
} else {
|
|
308
|
+
item.isDisabledForProductUsed = false;
|
|
309
|
+
}
|
|
310
|
+
});
|
|
299
311
|
(_a = this.store.discount) == null ? void 0 : _a.setDiscountList(newDiscountList);
|
|
300
312
|
this.emitDiscountListChange(newDiscountList);
|
|
301
313
|
return newDiscountList;
|