meemup-library 1.2.17 → 1.2.19
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/dist/controllers/ProductModalController.d.ts +3 -3
- package/dist/controllers/ProductModalController.js +7 -70
- package/dist/interfaces/ISelectedExtraItem.d.ts +2 -0
- package/dist/interfaces/ISelectedExtraItem.js +0 -5
- package/dist/interfaces/database/IDProductDefaultExtraItem.d.ts +1 -0
- package/dist/interfaces/order/IOrderExtraItem.d.ts +2 -0
- package/dist/interfaces/print/IOrderDetailProductsExtra.d.ts +2 -0
- package/package.json +2 -2
|
@@ -12,9 +12,9 @@ declare const _default: {
|
|
|
12
12
|
getExtraSelectedItems(list: ISelectedProductExtra[], extraId: number): ISelectedExtraItem[];
|
|
13
13
|
canAddToBasket(product: IProduct, selected: ISelectedProductExtra[], extras: IExtra[]): boolean;
|
|
14
14
|
productModalToBasketItem(product: IProduct, selectedExtraList: ISelectedProductExtra[], extras: IExtra[], count: number, price: number, note: string): IOrderItem;
|
|
15
|
-
productName(product: IProduct
|
|
16
|
-
productImage(product: IProduct
|
|
17
|
-
productPrice(product: IProduct
|
|
15
|
+
productName(product: IProduct): string;
|
|
16
|
+
productImage(product: IProduct): string;
|
|
17
|
+
productPrice(product: IProduct, orderType: EnumOrderType): number;
|
|
18
18
|
baseItem(list: ISelectedProductExtra[], extraList: IExtra[]): TBaseExtra;
|
|
19
19
|
defaultExtraOfProductToSelectedExtras(product: IProduct, extras: IExtra[]): ISelectedProductExtra[];
|
|
20
20
|
defaultExtraOfProductToBasketItem(product: IProduct, extras: IExtra[], orderType: EnumOrderType): IOrderItem;
|
|
@@ -125,7 +125,9 @@ export default new class ProductModalController {
|
|
|
125
125
|
text: `${extraItem.quantity}x ${extraItem.title}`,
|
|
126
126
|
cartItemId: -1,
|
|
127
127
|
extraItemTitle: extraItem.title,
|
|
128
|
-
extraTitle: ((_a = extras.find(i => i.id === extra.extraId)) === null || _a === void 0 ? void 0 : _a.title) + ""
|
|
128
|
+
extraTitle: ((_a = extras.find(i => i.id === extra.extraId)) === null || _a === void 0 ? void 0 : _a.title) + "",
|
|
129
|
+
extraItemOptionId: extraItem.optionId,
|
|
130
|
+
extraItemOptionTitle: extraItem.optionTitle,
|
|
129
131
|
});
|
|
130
132
|
});
|
|
131
133
|
});
|
|
@@ -186,6 +188,7 @@ export default new class ProductModalController {
|
|
|
186
188
|
let selectedList = [];
|
|
187
189
|
if (extraModel !== undefined) {
|
|
188
190
|
value.items.forEach(it => {
|
|
191
|
+
var _a;
|
|
189
192
|
let extraItemModel = extraModel.items.find((i) => i.id === it.extraItemId);
|
|
190
193
|
if (extraItemModel !== undefined) {
|
|
191
194
|
selectedList.push({
|
|
@@ -213,7 +216,9 @@ export default new class ProductModalController {
|
|
|
213
216
|
oldId: extraItemModel.oldId,
|
|
214
217
|
packagingCost: extraItemModel.packagingCost,
|
|
215
218
|
weight: extraItemModel.weight,
|
|
216
|
-
options: extraItemModel.options
|
|
219
|
+
options: extraItemModel.options,
|
|
220
|
+
optionId: it.extraItemOptionId,
|
|
221
|
+
optionTitle: ((_a = extraItemModel.options.find(i => i.id === it.extraItemOptionId)) === null || _a === void 0 ? void 0 : _a.title) + ""
|
|
217
222
|
});
|
|
218
223
|
}
|
|
219
224
|
});
|
|
@@ -255,64 +260,6 @@ export default new class ProductModalController {
|
|
|
255
260
|
}
|
|
256
261
|
return list;
|
|
257
262
|
}
|
|
258
|
-
// pizzaSelectExtraPrice = (extra: IExtra, base: TBaseExtra, item: IExtraItem, selectedList: ISelectedExtraItem[] = []) => {
|
|
259
|
-
//
|
|
260
|
-
// let _item: ISelectedExtraItem | undefined = selectedList.find(i => i.id === item.id);
|
|
261
|
-
//
|
|
262
|
-
// if (_item !== undefined) {
|
|
263
|
-
//
|
|
264
|
-
// let p: number = +item.price;
|
|
265
|
-
//
|
|
266
|
-
// if (base[1] && base[1]?.increasingOtherExtraItemsPrice) {
|
|
267
|
-
// // @ts-ignore
|
|
268
|
-
// if (+base[0]?.extraId === +extra.id) return p;
|
|
269
|
-
//
|
|
270
|
-
// // @ts-ignore
|
|
271
|
-
// const { increasingPriceType, increasingAmount, increasingPercentage } = base[0]?.selected[0];
|
|
272
|
-
//
|
|
273
|
-
// switch (increasingPriceType) {
|
|
274
|
-
// case 1:
|
|
275
|
-
// p += (item.price * increasingPercentage) / 100;
|
|
276
|
-
// break;
|
|
277
|
-
// case 2:
|
|
278
|
-
// p += increasingAmount;
|
|
279
|
-
// if (p < 0) p = 0;
|
|
280
|
-
// break;
|
|
281
|
-
// default:
|
|
282
|
-
// break;
|
|
283
|
-
// }
|
|
284
|
-
// }
|
|
285
|
-
//
|
|
286
|
-
// if (extra.choosablePizzaToppingsSides) {
|
|
287
|
-
// if (this.scaleSum(selectedList) <= extra.numberOfFreeItems)
|
|
288
|
-
// return 0;
|
|
289
|
-
//
|
|
290
|
-
// let index = selectedList.findIndex((element) => +element.id === +item.id);
|
|
291
|
-
//
|
|
292
|
-
// if (index === -1)
|
|
293
|
-
// return p;
|
|
294
|
-
//
|
|
295
|
-
// let sliceArray = selectedList.slice(0, index + 1);
|
|
296
|
-
//
|
|
297
|
-
// if (this.scaleSum(sliceArray) <= extra.numberOfFreeItems)
|
|
298
|
-
// return 0;
|
|
299
|
-
//
|
|
300
|
-
// }
|
|
301
|
-
//
|
|
302
|
-
// return +p;
|
|
303
|
-
// }
|
|
304
|
-
// return 0;
|
|
305
|
-
// };
|
|
306
|
-
// scalePizzaSum(array: ISelectedExtraItem[] = []) {
|
|
307
|
-
// let s = 0;
|
|
308
|
-
// array.forEach((item) => {
|
|
309
|
-
// s += item["quantity"] * item["scale"];
|
|
310
|
-
// if (item.pizzaSide === EnumPizzaSide.right || item.pizzaSide === EnumPizzaSide.left)
|
|
311
|
-
// s = parseInt((s / 2) + "");
|
|
312
|
-
//
|
|
313
|
-
// });
|
|
314
|
-
// return s;
|
|
315
|
-
// }
|
|
316
263
|
scaleSum(array = []) {
|
|
317
264
|
let s = 0;
|
|
318
265
|
array.forEach((item) => {
|
|
@@ -418,16 +365,6 @@ export default new class ProductModalController {
|
|
|
418
365
|
});
|
|
419
366
|
return s;
|
|
420
367
|
}
|
|
421
|
-
// createSubtitle(items: ISelectedExtraItem[] = []): string {
|
|
422
|
-
// if (items.length === 1) {
|
|
423
|
-
// let { title, quantity } = items[0];
|
|
424
|
-
// return (quantity > 1 ? quantity + "x " : "") + title;
|
|
425
|
-
// } else if (items.length > 1) {
|
|
426
|
-
// return this.quantitySum(items) + " Item selected";
|
|
427
|
-
// } else {
|
|
428
|
-
// return "";
|
|
429
|
-
// }
|
|
430
|
-
// };
|
|
431
368
|
productMinAndMaxOptions(product) {
|
|
432
369
|
let list = [];
|
|
433
370
|
for (let index = product.minOrderQuantity; index <= product.maxOrderQuantity; index++) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "meemup-library",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.19",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"remove:one": "rimraf dist",
|
|
12
12
|
"remove:two": "rimraf ./src/dist",
|
|
13
13
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
14
|
-
"commit": "git add . && git commit -m \"version.1.2.
|
|
14
|
+
"commit": "git add . && git commit -m \"version.1.2.19\" && git push origin "
|
|
15
15
|
},
|
|
16
16
|
"files": [
|
|
17
17
|
"/dist"
|