@managesome/eposmatic-toolkit 0.2.529 → 0.2.530
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.
|
@@ -407,6 +407,7 @@ function syncOrderData(order) {
|
|
|
407
407
|
}
|
|
408
408
|
function getVoidItemsWithReason({ currentCategories, iterationsFromFrontend, previousCategories, platform, }) {
|
|
409
409
|
const voidOrderItemReasonsMap = {};
|
|
410
|
+
const voidOrderItemIsReadyMap = {};
|
|
410
411
|
const latestIterationCategories = iterationsFromFrontend?.[0]?.categories;
|
|
411
412
|
if (latestIterationCategories != null && latestIterationCategories.length > 0) {
|
|
412
413
|
for (let i = 0; i < latestIterationCategories.length; i++) {
|
|
@@ -416,6 +417,9 @@ function getVoidItemsWithReason({ currentCategories, iterationsFromFrontend, pre
|
|
|
416
417
|
if (item.void_reason != null && item.void_reason.length > 0) {
|
|
417
418
|
voidOrderItemReasonsMap[item._id] = item.void_reason;
|
|
418
419
|
}
|
|
420
|
+
if (item.is_ready != null) {
|
|
421
|
+
voidOrderItemIsReadyMap[item._id] = item.is_ready;
|
|
422
|
+
}
|
|
419
423
|
}
|
|
420
424
|
}
|
|
421
425
|
}
|
|
@@ -435,8 +439,10 @@ function getVoidItemsWithReason({ currentCategories, iterationsFromFrontend, pre
|
|
|
435
439
|
for (let i = 0; i < removedItems.length; i++) {
|
|
436
440
|
const { orderItem } = removedItems[i];
|
|
437
441
|
const voidReason = voidOrderItemReasonsMap[orderItem._id];
|
|
442
|
+
const isReady = voidOrderItemIsReadyMap[orderItem._id];
|
|
438
443
|
voidOrderItems.push({
|
|
439
444
|
...orderItem,
|
|
445
|
+
...(isReady != null ? { is_ready: isReady } : {}),
|
|
440
446
|
subtotal: Math.round(orderItem.subtotal),
|
|
441
447
|
void_reason: voidReason ?? '-',
|
|
442
448
|
});
|
|
@@ -451,6 +457,7 @@ function getVoidItemsWithReason({ currentCategories, iterationsFromFrontend, pre
|
|
|
451
457
|
for (let j = 0; j < category.items.length; j++) {
|
|
452
458
|
const prevItem = category.items[j];
|
|
453
459
|
const voidReason = newVoidOrderItemReasonsMap[prevItem._id];
|
|
460
|
+
const isReady = voidOrderItemIsReadyMap[prevItem._id];
|
|
454
461
|
const orderItem = {
|
|
455
462
|
...prevItem,
|
|
456
463
|
subtotal: Math.round(prevItem.subtotal),
|
|
@@ -458,6 +465,9 @@ function getVoidItemsWithReason({ currentCategories, iterationsFromFrontend, pre
|
|
|
458
465
|
if (voidReason != null) {
|
|
459
466
|
orderItem.void_reason = voidReason;
|
|
460
467
|
}
|
|
468
|
+
if (isReady != null) {
|
|
469
|
+
orderItem.is_ready = isReady;
|
|
470
|
+
}
|
|
461
471
|
newCategoryItems.push(orderItem);
|
|
462
472
|
}
|
|
463
473
|
if (newCategoryItems.length === 0)
|