@managesome/eposmatic-toolkit 0.2.529 → 0.2.531

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.
@@ -83,6 +83,7 @@ export declare function getUpdateCartInfoData(data: Partial<IOrder>, payload: Pa
83
83
  export declare function getRemoveItemFromCartData(data: Partial<IOrder>, payload: {
84
84
  _id: string;
85
85
  void_reason?: string;
86
+ is_ready?: boolean;
86
87
  }, courses: ICourse[], listnerSettings: ICartListnerSettings, appliedCustomDiscounts?: IAppliedCustomDiscount[]): Partial<IOrder>;
87
88
  export declare function getUpdatedCartInfoOnInit(data: Partial<IOrder>, order: Partial<IOrder>, courses: ICourse[], platform: PLATFORMS_ENUM | undefined, categories: IOrderCategory[] | undefined, mappedItems: Record<string, IItem>, tenantId: string | undefined, listnerSettings: ICartListnerSettings, offers: IOffer[] | undefined): Partial<IOrder>;
88
89
  /**
@@ -2341,6 +2341,9 @@ function getUpdateItemInCartData(data, payload, courses, listnerSettings, applie
2341
2341
  ...prevItem,
2342
2342
  void_reason: payload.void_reason,
2343
2343
  };
2344
+ if (payload.is_ready != null) {
2345
+ updatedPrevItem.is_ready = payload.is_ready;
2346
+ }
2344
2347
  allPrevItems.push(updatedPrevItem);
2345
2348
  }
2346
2349
  else {
@@ -2468,6 +2471,9 @@ function getRemoveItemFromCartData(data, payload, courses, listnerSettings, appl
2468
2471
  ...prevItem,
2469
2472
  void_reason: payload.void_reason,
2470
2473
  };
2474
+ if (payload.is_ready != null) {
2475
+ newItem.is_ready = payload.is_ready;
2476
+ }
2471
2477
  allPrevItems.push(newItem);
2472
2478
  }
2473
2479
  else {
@@ -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)
@@ -25,6 +25,7 @@ export declare const InventoryTransactionsSchema: Schema<any, import("mongoose")
25
25
  order_id?: import("mongoose").Types.ObjectId | null | undefined;
26
26
  description?: string | null | undefined;
27
27
  department_code?: string | null | undefined;
28
+ ref_id?: import("mongoose").Types.ObjectId | null | undefined;
28
29
  order_number?: number | null | undefined;
29
30
  stock_price?: number | null | undefined;
30
31
  stock_expiry_date?: NativeDate | null | undefined;
@@ -50,6 +51,7 @@ export declare const InventoryTransactionsSchema: Schema<any, import("mongoose")
50
51
  order_id?: import("mongoose").Types.ObjectId | null | undefined;
51
52
  description?: string | null | undefined;
52
53
  department_code?: string | null | undefined;
54
+ ref_id?: import("mongoose").Types.ObjectId | null | undefined;
53
55
  order_number?: number | null | undefined;
54
56
  stock_price?: number | null | undefined;
55
57
  stock_expiry_date?: NativeDate | null | undefined;
@@ -75,6 +77,7 @@ export declare const InventoryTransactionsSchema: Schema<any, import("mongoose")
75
77
  order_id?: import("mongoose").Types.ObjectId | null | undefined;
76
78
  description?: string | null | undefined;
77
79
  department_code?: string | null | undefined;
80
+ ref_id?: import("mongoose").Types.ObjectId | null | undefined;
78
81
  order_number?: number | null | undefined;
79
82
  stock_price?: number | null | undefined;
80
83
  stock_expiry_date?: NativeDate | null | undefined;
@@ -63,7 +63,6 @@ exports.InventoryTransactionsSchema = new mongoose_1.Schema({
63
63
  type: String,
64
64
  required: true,
65
65
  enum: constants_1.ALL_INVENTORY_TRANSACTION_CATEGORIES,
66
- immutable: true,
67
66
  },
68
67
  stock_price: {
69
68
  type: Number,
@@ -83,6 +82,10 @@ exports.InventoryTransactionsSchema = new mongoose_1.Schema({
83
82
  required: false,
84
83
  immutable: true,
85
84
  },
85
+ ref_id: {
86
+ type: mongoose_1.Schema.Types.ObjectId,
87
+ required: false,
88
+ },
86
89
  description: {
87
90
  type: String,
88
91
  required: false,
@@ -25,6 +25,7 @@ export declare const TenantInventoryDepartmentTransactionsSchema: Schema<any, im
25
25
  transaction_quantity: number;
26
26
  order_id?: import("mongoose").Types.ObjectId | null | undefined;
27
27
  description?: string | null | undefined;
28
+ ref_id?: import("mongoose").Types.ObjectId | null | undefined;
28
29
  order_number?: number | null | undefined;
29
30
  stock_price?: number | null | undefined;
30
31
  stock_expiry_date?: NativeDate | null | undefined;
@@ -50,6 +51,7 @@ export declare const TenantInventoryDepartmentTransactionsSchema: Schema<any, im
50
51
  transaction_quantity: number;
51
52
  order_id?: import("mongoose").Types.ObjectId | null | undefined;
52
53
  description?: string | null | undefined;
54
+ ref_id?: import("mongoose").Types.ObjectId | null | undefined;
53
55
  order_number?: number | null | undefined;
54
56
  stock_price?: number | null | undefined;
55
57
  stock_expiry_date?: NativeDate | null | undefined;
@@ -75,6 +77,7 @@ export declare const TenantInventoryDepartmentTransactionsSchema: Schema<any, im
75
77
  transaction_quantity: number;
76
78
  order_id?: import("mongoose").Types.ObjectId | null | undefined;
77
79
  description?: string | null | undefined;
80
+ ref_id?: import("mongoose").Types.ObjectId | null | undefined;
78
81
  order_number?: number | null | undefined;
79
82
  stock_price?: number | null | undefined;
80
83
  stock_expiry_date?: NativeDate | null | undefined;
@@ -64,7 +64,6 @@ exports.TenantInventoryDepartmentTransactionsSchema = new mongoose_1.Schema({
64
64
  type: String,
65
65
  required: true,
66
66
  enum: constants_1.ALL_INVENTORY_TRANSACTION_CATEGORIES,
67
- immutable: true,
68
67
  },
69
68
  stock_price: {
70
69
  type: Number,
@@ -84,6 +83,10 @@ exports.TenantInventoryDepartmentTransactionsSchema = new mongoose_1.Schema({
84
83
  required: false,
85
84
  immutable: true,
86
85
  },
86
+ ref_id: {
87
+ type: mongoose_1.Schema.Types.ObjectId,
88
+ required: false,
89
+ },
87
90
  description: {
88
91
  type: String,
89
92
  required: false,
@@ -17,6 +17,7 @@ export interface IInventoryDepartmentTransaction {
17
17
  stock_expiry_date?: Date | null;
18
18
  order_id?: string;
19
19
  order_number?: number | null;
20
+ ref_id?: string | null;
20
21
  description?: string;
21
22
  createdAt_mins: number;
22
23
  createdAt: Date;
@@ -17,6 +17,7 @@ export interface IInventoryTransaction {
17
17
  stock_expiry_date?: Date | null;
18
18
  order_id?: string;
19
19
  order_number?: number | null;
20
+ ref_id?: string | null;
20
21
  description?: string;
21
22
  createdAt_mins: number;
22
23
  createdAt: Date;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@managesome/eposmatic-toolkit",
3
- "version": "0.2.529",
3
+ "version": "0.2.531",
4
4
  "description": "A Toolkit Library for Eposmatic",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",