@managesome/eposmatic-toolkit 0.2.455 → 0.2.458

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.
Files changed (176) hide show
  1. package/lib/constants/WORKER_ENDPOINTS.d.ts +1 -0
  2. package/lib/constants/WORKER_ENDPOINTS.js +2 -0
  3. package/lib/helpers/types/workers.d.ts +15 -1
  4. package/package.json +1 -1
  5. package/lib/constants/PURCHASE_ORDER.d.ts +0 -16
  6. package/lib/constants/PURCHASE_ORDER.js +0 -100
  7. package/lib/constants/RFQ.d.ts +0 -0
  8. package/lib/constants/RFQ.js +0 -1
  9. package/lib/helpers/order/generate-purchase-order-rfq.d.ts +0 -3
  10. package/lib/helpers/order/generate-purchase-order-rfq.js +0 -64
  11. package/lib/helpers/order/generate-purchase-order.d.ts +0 -11
  12. package/lib/helpers/order/generate-purchase-order.js +0 -196
  13. package/lib/helpers/store/all-purchase-orders-actions.d.ts +0 -13
  14. package/lib/helpers/store/all-purchase-orders-actions.js +0 -56
  15. package/lib/helpers/store/all-sale-orders-actions.d.ts +0 -2
  16. package/lib/helpers/store/all-sale-orders-actions.js +0 -8
  17. package/lib/helpers/store/all-warehouse-sale-orders-actions.d.ts +0 -2
  18. package/lib/helpers/store/all-warehouse-sale-orders-actions.js +0 -8
  19. package/lib/helpers/store/common-purchase-order-actions.d.ts +0 -31
  20. package/lib/helpers/store/common-purchase-order-actions.js +0 -543
  21. package/lib/helpers/store/common-sale-order-actions.d.ts +0 -5
  22. package/lib/helpers/store/common-sale-order-actions.js +0 -65
  23. package/lib/helpers/store/purchase-order-rfq-cart-actions.d.ts +0 -19
  24. package/lib/helpers/store/purchase-order-rfq-cart-actions.js +0 -373
  25. package/lib/helpers/store/purchase-orders-cart-actions.d.ts +0 -57
  26. package/lib/helpers/store/purchase-orders-cart-actions.js +0 -486
  27. package/lib/helpers/types/purchase-order-cart-actions.d.ts +0 -26
  28. package/lib/helpers/types/purchase-order-cart-actions.js +0 -2
  29. package/lib/helpers/utils/invoice-x-report-helpers.d.ts +0 -58
  30. package/lib/helpers/utils/invoice-x-report-helpers.js +0 -1432
  31. package/lib/helpers/utils/purchase-order-engine.d.ts +0 -9
  32. package/lib/helpers/utils/purchase-order-engine.js +0 -34
  33. package/lib/helpers/utils/purchase-order-receipt-engine.d.ts +0 -149
  34. package/lib/helpers/utils/purchase-order-receipt-engine.js +0 -214
  35. package/lib/helpers/utils/purchase-order-x-report-helpers.d.ts +0 -58
  36. package/lib/helpers/utils/purchase-order-x-report-helpers.js +0 -1440
  37. package/lib/helpers/utils/sale-order-x-report-helpers.d.ts +0 -44
  38. package/lib/helpers/utils/sale-order-x-report-helpers.js +0 -22
  39. package/lib/helpers/utils/sale-x-report-helpers.d.ts +0 -58
  40. package/lib/helpers/utils/sale-x-report-helpers.js +0 -1456
  41. package/lib/helpers/utils/terminal-devices-helpers.d.ts +0 -2
  42. package/lib/helpers/utils/terminal-devices-helpers.js +0 -13
  43. package/lib/helpers/utils/void-purchase-order-items-helpers.d.ts +0 -3
  44. package/lib/helpers/utils/void-purchase-order-items-helpers.js +0 -38
  45. package/lib/helpers/utils/void-purchase-order-items-report-helpers.d.ts +0 -13
  46. package/lib/helpers/utils/void-purchase-order-items-report-helpers.js +0 -22
  47. package/lib/schemas/models/applied-order-discounts.d.ts +0 -80
  48. package/lib/schemas/models/applied-order-discounts.js +0 -106
  49. package/lib/schemas/models/brand.d.ts +0 -45
  50. package/lib/schemas/models/brand.js +0 -45
  51. package/lib/schemas/models/category.d.ts +0 -60
  52. package/lib/schemas/models/category.js +0 -67
  53. package/lib/schemas/models/dinein_table_fingerprints.d.ts +0 -65
  54. package/lib/schemas/models/dinein_table_fingerprints.js +0 -85
  55. package/lib/schemas/models/expense_category.d.ts +0 -83
  56. package/lib/schemas/models/expense_category.js +0 -64
  57. package/lib/schemas/models/internal_movements.d.ts +0 -357
  58. package/lib/schemas/models/internal_movements.js +0 -323
  59. package/lib/schemas/models/inventory.d.ts +0 -99
  60. package/lib/schemas/models/inventory.js +0 -87
  61. package/lib/schemas/models/inventory_lot_serial_numbers.d.ts +0 -154
  62. package/lib/schemas/models/inventory_lot_serial_numbers.js +0 -193
  63. package/lib/schemas/models/item.d.ts +0 -11269
  64. package/lib/schemas/models/item.js +0 -333
  65. package/lib/schemas/models/menu.d.ts +0 -941
  66. package/lib/schemas/models/menu.js +0 -69
  67. package/lib/schemas/models/order.d.ts +0 -15437
  68. package/lib/schemas/models/order.js +0 -891
  69. package/lib/schemas/models/purchase_order_receipts.d.ts +0 -165
  70. package/lib/schemas/models/purchase_order_receipts.js +0 -151
  71. package/lib/schemas/models/purchase_order_rfq.d.ts +0 -1959
  72. package/lib/schemas/models/purchase_order_rfq.js +0 -328
  73. package/lib/schemas/models/purchase_order_rfqs.d.ts +0 -1959
  74. package/lib/schemas/models/purchase_order_rfqs.js +0 -328
  75. package/lib/schemas/models/purchase_order_vendor_returns.d.ts +0 -234
  76. package/lib/schemas/models/purchase_order_vendor_returns.js +0 -188
  77. package/lib/schemas/models/purchase_orders.d.ts +0 -2678
  78. package/lib/schemas/models/purchase_orders.js +0 -336
  79. package/lib/schemas/models/rider.d.ts +0 -65
  80. package/lib/schemas/models/rider.js +0 -74
  81. package/lib/schemas/models/sale_order_deliveries.d.ts +0 -167
  82. package/lib/schemas/models/sale_order_deliveries.js +0 -155
  83. package/lib/schemas/models/sale_order_invoices.d.ts +0 -227
  84. package/lib/schemas/models/sale_order_invoices.js +0 -206
  85. package/lib/schemas/models/sale_order_rfq.d.ts +0 -1938
  86. package/lib/schemas/models/sale_order_rfq.js +0 -309
  87. package/lib/schemas/models/sale_orders.d.ts +0 -1943
  88. package/lib/schemas/models/sale_orders.js +0 -324
  89. package/lib/schemas/models/tenant.d.ts +0 -528
  90. package/lib/schemas/models/tenant.js +0 -755
  91. package/lib/schemas/models/tenant_staff.d.ts +0 -932
  92. package/lib/schemas/models/tenant_staff.js +0 -96
  93. package/lib/schemas/models/track_order_number.d.ts +0 -413
  94. package/lib/schemas/models/track_order_number.js +0 -45
  95. package/lib/schemas/models/void_purchase_order_items.d.ts +0 -176
  96. package/lib/schemas/models/void_purchase_order_items.js +0 -177
  97. package/lib/schemas/models/void_warehouse_invoice_items.d.ts +0 -176
  98. package/lib/schemas/models/void_warehouse_invoice_items.js +0 -176
  99. package/lib/schemas/models/wallet.d.ts +0 -38
  100. package/lib/schemas/models/wallet.js +0 -37
  101. package/lib/schemas/models/warehouse-communications.d.ts +0 -228
  102. package/lib/schemas/models/warehouse-communications.js +0 -216
  103. package/lib/schemas/models/warehouse.d.ts +0 -162
  104. package/lib/schemas/models/warehouse.js +0 -222
  105. package/lib/schemas/models/warehouse_staff.d.ts +0 -65
  106. package/lib/schemas/models/warehouse_staff.js +0 -78
  107. package/lib/schemas/models/warehouse_track_order_number.d.ts +0 -50
  108. package/lib/schemas/models/warehouse_track_order_number.js +0 -52
  109. package/lib/schemas/types/applied-order-discounts.d.ts +0 -22
  110. package/lib/schemas/types/applied-order-discounts.js +0 -2
  111. package/lib/schemas/types/brand.d.ts +0 -32
  112. package/lib/schemas/types/brand.js +0 -2
  113. package/lib/schemas/types/category.d.ts +0 -15
  114. package/lib/schemas/types/category.js +0 -2
  115. package/lib/schemas/types/expense_category.d.ts +0 -20
  116. package/lib/schemas/types/expense_category.js +0 -2
  117. package/lib/schemas/types/internal_movements.d.ts +0 -73
  118. package/lib/schemas/types/internal_movements.js +0 -2
  119. package/lib/schemas/types/inventory.d.ts +0 -48
  120. package/lib/schemas/types/inventory.js +0 -2
  121. package/lib/schemas/types/inventory_lot_serial_numbers.d.ts +0 -85
  122. package/lib/schemas/types/inventory_lot_serial_numbers.js +0 -4
  123. package/lib/schemas/types/item.d.ts +0 -89
  124. package/lib/schemas/types/item.js +0 -2
  125. package/lib/schemas/types/menu.d.ts +0 -17
  126. package/lib/schemas/types/menu.js +0 -2
  127. package/lib/schemas/types/order.d.ts +0 -242
  128. package/lib/schemas/types/order.js +0 -2
  129. package/lib/schemas/types/purchase_order_common.d.ts +0 -39
  130. package/lib/schemas/types/purchase_order_common.js +0 -2
  131. package/lib/schemas/types/purchase_order_receipts.d.ts +0 -39
  132. package/lib/schemas/types/purchase_order_receipts.js +0 -21
  133. package/lib/schemas/types/purchase_order_rfq.d.ts +0 -33
  134. package/lib/schemas/types/purchase_order_rfq.js +0 -2
  135. package/lib/schemas/types/purchase_order_rfqs.d.ts +0 -33
  136. package/lib/schemas/types/purchase_order_rfqs.js +0 -2
  137. package/lib/schemas/types/purchase_order_vendor_returns.d.ts +0 -49
  138. package/lib/schemas/types/purchase_order_vendor_returns.js +0 -42
  139. package/lib/schemas/types/purchase_orders.d.ts +0 -33
  140. package/lib/schemas/types/purchase_orders.js +0 -2
  141. package/lib/schemas/types/rider.d.ts +0 -16
  142. package/lib/schemas/types/rider.js +0 -2
  143. package/lib/schemas/types/sale_order_common.d.ts +0 -39
  144. package/lib/schemas/types/sale_order_common.js +0 -2
  145. package/lib/schemas/types/sale_order_deliveries.d.ts +0 -67
  146. package/lib/schemas/types/sale_order_deliveries.js +0 -2
  147. package/lib/schemas/types/sale_order_invoices.d.ts +0 -49
  148. package/lib/schemas/types/sale_order_invoices.js +0 -2
  149. package/lib/schemas/types/sale_order_rfq.d.ts +0 -25
  150. package/lib/schemas/types/sale_order_rfq.js +0 -2
  151. package/lib/schemas/types/sale_orders.d.ts +0 -30
  152. package/lib/schemas/types/sale_orders.js +0 -2
  153. package/lib/schemas/types/tenant.d.ts +0 -205
  154. package/lib/schemas/types/tenant.js +0 -2
  155. package/lib/schemas/types/tenant_staff.d.ts +0 -22
  156. package/lib/schemas/types/tenant_staff.js +0 -2
  157. package/lib/schemas/types/track_order_number.d.ts +0 -10
  158. package/lib/schemas/types/track_order_number.js +0 -2
  159. package/lib/schemas/types/void_purchase_order_items.d.ts +0 -37
  160. package/lib/schemas/types/void_purchase_order_items.js +0 -2
  161. package/lib/schemas/types/void_warehouse_invoice_items.d.ts +0 -37
  162. package/lib/schemas/types/void_warehouse_invoice_items.js +0 -2
  163. package/lib/schemas/types/wallet.d.ts +0 -7
  164. package/lib/schemas/types/wallet.js +0 -2
  165. package/lib/schemas/types/warehouse-communications.d.ts +0 -54
  166. package/lib/schemas/types/warehouse-communications.js +0 -2
  167. package/lib/schemas/types/warehouse.d.ts +0 -49
  168. package/lib/schemas/types/warehouse.js +0 -2
  169. package/lib/schemas/types/warehouse_purchase_order_common.d.ts +0 -39
  170. package/lib/schemas/types/warehouse_purchase_order_common.js +0 -2
  171. package/lib/schemas/types/warehouse_sale_order_common.d.ts +0 -39
  172. package/lib/schemas/types/warehouse_sale_order_common.js +0 -2
  173. package/lib/schemas/types/warehouse_staff.d.ts +0 -17
  174. package/lib/schemas/types/warehouse_staff.js +0 -2
  175. package/lib/schemas/types/warehouse_track_order_number.d.ts +0 -11
  176. package/lib/schemas/types/warehouse_track_order_number.js +0 -2
@@ -61,4 +61,5 @@ export declare const WORKER_ENDPOINTS: {
61
61
  readonly UPDATED_FOODSTREET_SPLIT_ORDER: "/updated-foodstreet-split-order";
62
62
  readonly REOPENED_FOODSTREET_ORIGINAL_ORDER: "/reopened-foodstreet-original-order";
63
63
  readonly REOPENED_FOODSTREET_SPLIT_ORDER: "/reopened-foodstreet-split-order";
64
+ readonly POST_WAREHOUSE_ACTIVITY_LOGS: "/post-warehouse-activity-logs";
64
65
  };
@@ -74,4 +74,6 @@ exports.WORKER_ENDPOINTS = {
74
74
  UPDATED_FOODSTREET_SPLIT_ORDER: '/updated-foodstreet-split-order',
75
75
  REOPENED_FOODSTREET_ORIGINAL_ORDER: '/reopened-foodstreet-original-order',
76
76
  REOPENED_FOODSTREET_SPLIT_ORDER: '/reopened-foodstreet-split-order',
77
+ // ========================>> Activity Logs <<======================= //
78
+ POST_WAREHOUSE_ACTIVITY_LOGS: '/post-warehouse-activity-logs',
77
79
  };
@@ -1,5 +1,6 @@
1
- import { CARD_PROCESSING_PROVIDERS_ENUM, CURRENCY_SYMBOL_ENUM, DELIVERY_STATUS_ENUM, ORDER_STATUS_ENUM, PLATFORM_TYPE_ENUM, PLATFORMS_ENUM, VOID_ORDER_ITEM_TYPE_ENUM, WALLET_ASSET_TYPE_ENUM, WALLET_ASSIGNMENT_BEHAVIOR_ENUM, WAREHOUSE_INTERNAL_MOVEMENT_STATUS_ENUM, WAREHOUSE_INVOICE_STATUS_ENUM, WAREHOUSE_REMOVAL_STRATEGY_ENUM, WAREHOUSE_TRACKING_MODE_ENUM } from '../../constants';
1
+ import { CARD_PROCESSING_PROVIDERS_ENUM, CURRENCY_SYMBOL_ENUM, DELIVERY_STATUS_ENUM, ORDER_STATUS_ENUM, PLATFORM_TYPE_ENUM, PLATFORMS_ENUM, VOID_ORDER_ITEM_TYPE_ENUM, WALLET_ASSET_TYPE_ENUM, WALLET_ASSIGNMENT_BEHAVIOR_ENUM, WAREHOUSE_ACTIVITY_LOG_ACTION_ENUM, WAREHOUSE_ACTIVITY_LOG_ENTITY_TYPE_ENUM, WAREHOUSE_INTERNAL_MOVEMENT_STATUS_ENUM, WAREHOUSE_INVOICE_STATUS_ENUM, WAREHOUSE_REMOVAL_STRATEGY_ENUM, WAREHOUSE_TRACKING_MODE_ENUM } from '../../constants';
2
2
  import { IDineinTableFingerprint, IInternalLead, IModifierExtra, IOrder, IOrderItem, IOrderPayment, ITenantPurchaseOrder, IWarehouseClientInvoice, IWarehouseInternalMovement, IWarehousePurchaseOrder, IWarehousePurchaseOrderReceipt, IWarehousePurchaseOrderVendorReturn, IWarehouseSaleOrder, IWarehouseSaleOrderDelivery } from '../../schemas';
3
+ import { IWarehouseActivityLogChange } from '../../schemas/types/warehouse-activity-logs';
3
4
  import { ISwitchPayEWalletRequestBody, ISwitchPayRefundRequestBody } from './switchpay';
4
5
  export interface IWorker_CreateDelivery {
5
6
  order: IOrder;
@@ -407,3 +408,16 @@ export interface ITrackedRollbackPlanLine {
407
408
  tracking_mode: WAREHOUSE_TRACKING_MODE_ENUM.LOT | WAREHOUSE_TRACKING_MODE_ENUM.SERIAL;
408
409
  quantity: number;
409
410
  }
411
+ export interface IWorker_PostWarehouseActivityLogs {
412
+ logs: {
413
+ warehouse_id: string;
414
+ entity_type: WAREHOUSE_ACTIVITY_LOG_ENTITY_TYPE_ENUM;
415
+ entity_id: string;
416
+ entity_number?: number | null;
417
+ action: WAREHOUSE_ACTIVITY_LOG_ACTION_ENUM;
418
+ title: string;
419
+ description?: string | null;
420
+ changes?: IWarehouseActivityLogChange[];
421
+ staff_id?: string;
422
+ }[];
423
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@managesome/eposmatic-toolkit",
3
- "version": "0.2.455",
3
+ "version": "0.2.458",
4
4
  "description": "A Toolkit Library for Eposmatic",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -1,16 +0,0 @@
1
- import { IWarehousePurchaseOrderVendorReturnStatus } from '../schemas';
2
- import { WAREHOUSE_PURCHASE_ORDER_STATUS_ENUM } from './WAREHOUSE_ENUMS';
3
- export interface IPurchaseOrderStatus {
4
- status: WAREHOUSE_PURCHASE_ORDER_STATUS_ENUM;
5
- color: string;
6
- contrast_color: string;
7
- priority: number;
8
- }
9
- export interface IPurchaseOrderStatusColorCode {
10
- color: string;
11
- contrast_color: string;
12
- }
13
- export type IPurchaseOrderStatusColorCodeMap = Record<WAREHOUSE_PURCHASE_ORDER_STATUS_ENUM, IPurchaseOrderStatusColorCode>;
14
- export declare const DEFAULT_PURCHASE_ORDER_STATUS_COLOR_CODE_MAP: IPurchaseOrderStatusColorCodeMap;
15
- export declare const DEFAULT_PURCHASE_ORDER_STATUS: IPurchaseOrderStatus[];
16
- export declare const DEFAULT_PURCHASE_ORDER_VENDOR_RETURN_STATUSES: IWarehousePurchaseOrderVendorReturnStatus[];
@@ -1,100 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DEFAULT_PURCHASE_ORDER_VENDOR_RETURN_STATUSES = exports.DEFAULT_PURCHASE_ORDER_STATUS = exports.DEFAULT_PURCHASE_ORDER_STATUS_COLOR_CODE_MAP = void 0;
4
- const WAREHOUSE_ENUMS_1 = require("./WAREHOUSE_ENUMS");
5
- exports.DEFAULT_PURCHASE_ORDER_STATUS_COLOR_CODE_MAP = {
6
- [WAREHOUSE_ENUMS_1.WAREHOUSE_PURCHASE_ORDER_STATUS_ENUM.DRAFT]: {
7
- color: '#727472',
8
- contrast_color: '#FFFFFF',
9
- },
10
- [WAREHOUSE_ENUMS_1.WAREHOUSE_PURCHASE_ORDER_STATUS_ENUM.SUBMITTED]: {
11
- color: '#0000FF',
12
- contrast_color: '#FFFFFF',
13
- },
14
- [WAREHOUSE_ENUMS_1.WAREHOUSE_PURCHASE_ORDER_STATUS_ENUM.PARTIALLY_RECEIVED]: {
15
- color: '#E67E22',
16
- contrast_color: '#FFFFFF',
17
- },
18
- [WAREHOUSE_ENUMS_1.WAREHOUSE_PURCHASE_ORDER_STATUS_ENUM.RECEIVED]: {
19
- color: '#FBB117',
20
- contrast_color: '#FFFFFF',
21
- },
22
- [WAREHOUSE_ENUMS_1.WAREHOUSE_PURCHASE_ORDER_STATUS_ENUM.COMPLETED]: {
23
- color: '#4CC417',
24
- contrast_color: '#FFFFFF',
25
- },
26
- [WAREHOUSE_ENUMS_1.WAREHOUSE_PURCHASE_ORDER_STATUS_ENUM.CANCELLED]: {
27
- color: '#FF0000',
28
- contrast_color: '#FFFFFF',
29
- },
30
- };
31
- exports.DEFAULT_PURCHASE_ORDER_STATUS = [
32
- {
33
- status: WAREHOUSE_ENUMS_1.WAREHOUSE_PURCHASE_ORDER_STATUS_ENUM.DRAFT,
34
- ...exports.DEFAULT_PURCHASE_ORDER_STATUS_COLOR_CODE_MAP[WAREHOUSE_ENUMS_1.WAREHOUSE_PURCHASE_ORDER_STATUS_ENUM.DRAFT],
35
- priority: 0,
36
- },
37
- {
38
- status: WAREHOUSE_ENUMS_1.WAREHOUSE_PURCHASE_ORDER_STATUS_ENUM.SUBMITTED,
39
- ...exports.DEFAULT_PURCHASE_ORDER_STATUS_COLOR_CODE_MAP[WAREHOUSE_ENUMS_1.WAREHOUSE_PURCHASE_ORDER_STATUS_ENUM.SUBMITTED],
40
- priority: 1,
41
- },
42
- {
43
- status: WAREHOUSE_ENUMS_1.WAREHOUSE_PURCHASE_ORDER_STATUS_ENUM.PARTIALLY_RECEIVED,
44
- ...exports.DEFAULT_PURCHASE_ORDER_STATUS_COLOR_CODE_MAP[WAREHOUSE_ENUMS_1.WAREHOUSE_PURCHASE_ORDER_STATUS_ENUM.PARTIALLY_RECEIVED],
45
- priority: 2,
46
- },
47
- {
48
- status: WAREHOUSE_ENUMS_1.WAREHOUSE_PURCHASE_ORDER_STATUS_ENUM.RECEIVED,
49
- ...exports.DEFAULT_PURCHASE_ORDER_STATUS_COLOR_CODE_MAP[WAREHOUSE_ENUMS_1.WAREHOUSE_PURCHASE_ORDER_STATUS_ENUM.RECEIVED],
50
- priority: 3,
51
- },
52
- {
53
- status: WAREHOUSE_ENUMS_1.WAREHOUSE_PURCHASE_ORDER_STATUS_ENUM.COMPLETED,
54
- ...exports.DEFAULT_PURCHASE_ORDER_STATUS_COLOR_CODE_MAP[WAREHOUSE_ENUMS_1.WAREHOUSE_PURCHASE_ORDER_STATUS_ENUM.COMPLETED],
55
- priority: 4,
56
- },
57
- {
58
- status: WAREHOUSE_ENUMS_1.WAREHOUSE_PURCHASE_ORDER_STATUS_ENUM.CANCELLED,
59
- ...exports.DEFAULT_PURCHASE_ORDER_STATUS_COLOR_CODE_MAP[WAREHOUSE_ENUMS_1.WAREHOUSE_PURCHASE_ORDER_STATUS_ENUM.CANCELLED],
60
- priority: 5,
61
- },
62
- ];
63
- exports.DEFAULT_PURCHASE_ORDER_VENDOR_RETURN_STATUSES = [
64
- {
65
- status: WAREHOUSE_ENUMS_1.WAREHOUSE_PURCHASE_ORDER_VENDOR_RETURN_STATUS_ENUM.CREATED,
66
- color: '#727472',
67
- contrast_color: '#FFFFFF',
68
- priority: 0,
69
- },
70
- {
71
- status: WAREHOUSE_ENUMS_1.WAREHOUSE_PURCHASE_ORDER_VENDOR_RETURN_STATUS_ENUM.APPROVED,
72
- color: '#0000FF',
73
- contrast_color: '#FFFFFF',
74
- priority: 1,
75
- },
76
- {
77
- status: WAREHOUSE_ENUMS_1.WAREHOUSE_PURCHASE_ORDER_VENDOR_RETURN_STATUS_ENUM.DISPATCHED,
78
- color: '#FBB117',
79
- contrast_color: '#FFFFFF',
80
- priority: 2,
81
- },
82
- {
83
- status: WAREHOUSE_ENUMS_1.WAREHOUSE_PURCHASE_ORDER_VENDOR_RETURN_STATUS_ENUM.VENDOR_CONFIRMED,
84
- color: '#17A2B8',
85
- contrast_color: '#FFFFFF',
86
- priority: 3,
87
- },
88
- {
89
- status: WAREHOUSE_ENUMS_1.WAREHOUSE_PURCHASE_ORDER_VENDOR_RETURN_STATUS_ENUM.COMPLETED,
90
- color: '#4CC417',
91
- contrast_color: '#FFFFFF',
92
- priority: 4,
93
- },
94
- {
95
- status: WAREHOUSE_ENUMS_1.WAREHOUSE_PURCHASE_ORDER_VENDOR_RETURN_STATUS_ENUM.CANCELLED,
96
- color: '#FF0000',
97
- contrast_color: '#FFFFFF',
98
- priority: 5,
99
- },
100
- ];
File without changes
@@ -1 +0,0 @@
1
- "use strict";
@@ -1,3 +0,0 @@
1
- import { WarehouseIPurchaseOrderRFQ, WarehouseIPurchaseOrderRFQIteration } from '../../schemas';
2
- export declare function generatePurchaseOrderRfqCategories(categories?: WarehouseIPurchaseOrderRFQ['categories']): WarehouseIPurchaseOrderRFQ['categories'];
3
- export declare function generatePurchaseOrderRfqIteration(order: WarehouseIPurchaseOrderRFQ | WarehouseIPurchaseOrderRFQIteration, partial?: boolean, skipItemMetadata?: boolean): WarehouseIPurchaseOrderRFQIteration;
@@ -1,64 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.generatePurchaseOrderRfqCategories = generatePurchaseOrderRfqCategories;
7
- exports.generatePurchaseOrderRfqIteration = generatePurchaseOrderRfqIteration;
8
- const mongoose_1 = __importDefault(require("mongoose"));
9
- const common_warehouse_purchase_order_actions_1 = require("../store/common-warehouse-purchase-order-actions");
10
- function generatePurchaseOrderRfqCategories(categories) {
11
- if (!categories)
12
- return [];
13
- return categories.map((category) => ({
14
- ...category,
15
- category_id: new mongoose_1.default.Types.ObjectId(category.category_id),
16
- items: category.items.map((item) => ({
17
- ...item,
18
- _id: new mongoose_1.default.Types.ObjectId(item._id),
19
- item_id: new mongoose_1.default.Types.ObjectId(item.item_id),
20
- })),
21
- }));
22
- }
23
- function getCommonOptionalBoolFieldsRfqIteration(order, partial) {
24
- const defaultValue = partial ? undefined : false;
25
- return {
26
- is_gst_inclusive: order.is_gst_inclusive || defaultValue,
27
- };
28
- }
29
- function getCommonOptionalNumFieldsRfqIteration(order, partial) {
30
- const defaultValue = partial ? undefined : 0;
31
- return {
32
- gst: order.gst || defaultValue,
33
- gst_amount: order.gst_amount || defaultValue,
34
- };
35
- }
36
- function generatePurchaseOrderRfqIteration(order, partial = true, skipItemMetadata) {
37
- const iteration = {
38
- ...getCommonOptionalBoolFieldsRfqIteration(order, partial),
39
- ...getCommonOptionalNumFieldsRfqIteration(order, partial),
40
- ...(skipItemMetadata && order.categories != null
41
- ? {
42
- categories: (0, common_warehouse_purchase_order_actions_1.skipItemMetadataFromPurchaseOrderCategories)(order.categories),
43
- }
44
- : {
45
- categories: generatePurchaseOrderRfqCategories(order.categories),
46
- }),
47
- staff_details: order.staff_details,
48
- special_instructions: order.special_instructions,
49
- order_status: order.order_status,
50
- price: order.price,
51
- amount_earned: order.amount_earned,
52
- grand_total: order.grand_total,
53
- tax_number: order.tax_number,
54
- updatedAt: order.updatedAt,
55
- };
56
- if (partial) {
57
- Object.keys(iteration).forEach((key) => {
58
- if (iteration[key] === undefined) {
59
- delete iteration[key];
60
- }
61
- });
62
- }
63
- return iteration;
64
- }
@@ -1,11 +0,0 @@
1
- import { WarehouseIPurchaseOrder, WarehouseIPurchaseOrderIteration } from '../../schemas';
2
- export declare function generatePurchaseOrderCategories(categories?: WarehouseIPurchaseOrder['categories']): WarehouseIPurchaseOrder['categories'];
3
- export declare function generatePurchaseOrderIteration(order: WarehouseIPurchaseOrder | WarehouseIPurchaseOrderIteration, partial?: boolean, skipItemMetadata?: boolean): WarehouseIPurchaseOrderIteration;
4
- export declare function generatePurchaseOrderOnCreate<T extends WarehouseIPurchaseOrder | Partial<WarehouseIPurchaseOrder>>(order: T, withIterations?: boolean): T;
5
- export declare function generatePurchaseOrderOnUpdate(partialUpdatedOrder: Partial<WarehouseIPurchaseOrder>): {
6
- updateOperation: {
7
- $unset?: Partial<Record<keyof WarehouseIPurchaseOrder, any>> | undefined;
8
- $set?: Partial<Record<keyof WarehouseIPurchaseOrder, any>> | undefined;
9
- };
10
- partialResponseOrder: Partial<WarehouseIPurchaseOrder>;
11
- };
@@ -1,196 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.generatePurchaseOrderCategories = generatePurchaseOrderCategories;
7
- exports.generatePurchaseOrderIteration = generatePurchaseOrderIteration;
8
- exports.generatePurchaseOrderOnCreate = generatePurchaseOrderOnCreate;
9
- exports.generatePurchaseOrderOnUpdate = generatePurchaseOrderOnUpdate;
10
- const mongoose_1 = __importDefault(require("mongoose"));
11
- const constants_1 = require("../../constants");
12
- const common_warehouse_purchase_order_actions_1 = require("../store/common-warehouse-purchase-order-actions");
13
- function generatePurchaseOrderCategories(categories) {
14
- if (!categories)
15
- return [];
16
- return categories.map((category) => ({
17
- ...category,
18
- category_id: new mongoose_1.default.Types.ObjectId(category.category_id),
19
- items: category.items.map((item) => ({
20
- ...item,
21
- _id: new mongoose_1.default.Types.ObjectId(item._id),
22
- item_id: new mongoose_1.default.Types.ObjectId(item.item_id),
23
- })),
24
- }));
25
- }
26
- function getCommonOptionalBoolFieldsPurchaseOrderIteration(order, partial) {
27
- const defaultValue = partial ? undefined : false;
28
- return {
29
- is_gst_inclusive: order.is_gst_inclusive || defaultValue,
30
- };
31
- }
32
- function getCommonOptionalNumFieldsPurchaseOrderIteration(order, partial) {
33
- const defaultValue = partial ? undefined : 0;
34
- return {
35
- gst: order.gst || defaultValue,
36
- gst_amount: order.gst_amount || defaultValue,
37
- };
38
- }
39
- function generatePurchaseOrderIteration(order, partial = true, skipItemMetadata) {
40
- const iteration = {
41
- ...getCommonOptionalBoolFieldsPurchaseOrderIteration(order, partial),
42
- ...getCommonOptionalNumFieldsPurchaseOrderIteration(order, partial),
43
- ...(skipItemMetadata && order.categories != null
44
- ? {
45
- categories: (0, common_warehouse_purchase_order_actions_1.skipItemMetadataFromPurchaseOrderCategories)(order.categories),
46
- }
47
- : {
48
- categories: generatePurchaseOrderCategories(order.categories),
49
- }),
50
- payments: order.payments,
51
- staff_details: order.staff_details,
52
- special_instructions: order.special_instructions,
53
- order_status: order.order_status,
54
- price: order.price,
55
- amount_earned: order.amount_earned,
56
- grand_total: order.grand_total,
57
- tax_number: order.tax_number,
58
- updatedAt: order.updatedAt,
59
- };
60
- if (partial) {
61
- Object.keys(iteration).forEach((key) => {
62
- if (iteration[key] === undefined) {
63
- delete iteration[key];
64
- }
65
- });
66
- }
67
- return iteration;
68
- }
69
- function getPurchaseOrderIterations(iterations) {
70
- if (!iterations)
71
- return [];
72
- return iterations.map((iteration) => ({
73
- ...iteration,
74
- categories: generatePurchaseOrderCategories(iteration.categories),
75
- updatedAt: new Date(iteration.updatedAt),
76
- }));
77
- }
78
- function generatePurchaseOrderOnCreate(order, withIterations) {
79
- const newOrder = {
80
- ...order,
81
- ...(order.payments != null
82
- ? {
83
- payments: order.payments.map((payment) => ({
84
- ...payment,
85
- _id: new mongoose_1.default.Types.ObjectId(payment._id),
86
- })),
87
- }
88
- : {}),
89
- ...(order.categories != null ? { categories: generatePurchaseOrderCategories(order.categories) } : {}),
90
- _id: new mongoose_1.default.Types.ObjectId(order._id),
91
- iterations: withIterations ? getPurchaseOrderIterations(order.iterations) : [],
92
- };
93
- if (!newOrder.delete_reason) {
94
- delete newOrder.delete_reason;
95
- }
96
- if (!newOrder.cancel_reason) {
97
- delete newOrder.cancel_reason;
98
- }
99
- if (!newOrder.is_reopened) {
100
- delete newOrder.is_reopened;
101
- }
102
- if (!newOrder.staff_details) {
103
- delete newOrder.staff_details;
104
- }
105
- if (!newOrder.gst) {
106
- delete newOrder.gst;
107
- delete newOrder.gst_amount;
108
- delete newOrder.is_gst_inclusive;
109
- }
110
- else {
111
- if (newOrder.gst_amount === 0) {
112
- delete newOrder.gst_amount;
113
- }
114
- if (newOrder.is_gst_inclusive === false) {
115
- delete newOrder.is_gst_inclusive;
116
- }
117
- }
118
- if (newOrder.payments?.some((payment) => payment.payment_type === constants_1.PAYMENT_TYPE_ENUM.PAY_LATER && payment.payment_status === constants_1.PAYMENT_STATUS_ENUM.PENDING)) {
119
- newOrder.deferred_settlement = true;
120
- }
121
- else {
122
- delete newOrder.deferred_settlement;
123
- }
124
- return newOrder;
125
- }
126
- function generatePurchaseOrderOnUpdate(partialUpdatedOrder) {
127
- const partialResponseOrder = {
128
- ...partialUpdatedOrder,
129
- };
130
- const unset = {};
131
- const set = {
132
- ...partialUpdatedOrder,
133
- ...(partialUpdatedOrder.iterations != null
134
- ? {
135
- iterations: getPurchaseOrderIterations(partialUpdatedOrder.iterations),
136
- }
137
- : {}),
138
- ...(partialUpdatedOrder.payments != null
139
- ? {
140
- payments: partialUpdatedOrder.payments.map((payment) => ({
141
- ...payment,
142
- _id: new mongoose_1.default.Types.ObjectId(payment._id),
143
- })),
144
- }
145
- : {}),
146
- ...(partialUpdatedOrder.categories != null
147
- ? { categories: generatePurchaseOrderCategories(partialUpdatedOrder.categories) }
148
- : {}),
149
- };
150
- if (set.delete_reason === null) {
151
- delete set.delete_reason;
152
- unset['delete_reason'] = '';
153
- }
154
- if (set.cancel_reason === null) {
155
- delete set.cancel_reason;
156
- unset['cancel_reason'] = '';
157
- }
158
- if (set.is_reopened === false) {
159
- delete set.is_reopened;
160
- unset['is_reopened'] = '';
161
- }
162
- if (set.staff_details === null) {
163
- delete set.staff_details;
164
- unset['staff_details'] = '';
165
- }
166
- if (set.gst === 0) {
167
- delete set.gst;
168
- delete set.gst_amount;
169
- unset['gst'] = '';
170
- unset['gst_amount'] = '';
171
- }
172
- else {
173
- if (set.gst_amount === 0) {
174
- delete set.gst_amount;
175
- unset['gst_amount'] = '';
176
- }
177
- if (set.is_gst_inclusive === false) {
178
- delete set.is_gst_inclusive;
179
- unset['is_gst_inclusive'] = '';
180
- }
181
- }
182
- if (set.payments != null) {
183
- if (set.payments.some((payment) => payment.payment_type === constants_1.PAYMENT_TYPE_ENUM.PAY_LATER &&
184
- payment.payment_status === constants_1.PAYMENT_STATUS_ENUM.PENDING)) {
185
- set.deferred_settlement = true;
186
- }
187
- else {
188
- unset['deferred_settlement'] = '';
189
- }
190
- }
191
- const updateOperation = {
192
- ...(Object.keys(set).length > 0 ? { $set: set } : {}),
193
- ...(Object.keys(unset).length > 0 ? { $unset: unset } : {}),
194
- };
195
- return { updateOperation, partialResponseOrder };
196
- }
@@ -1,13 +0,0 @@
1
- import { IPurchaseOrderStatus, WAREHOUSE_PURCHASE_ORDER_STATUS_ENUM } from '../../constants';
2
- import { WarehouseIPurchaseOrder } from '../../schemas';
3
- export declare function getPurchaseOrdersFetchedData(data: WarehouseIPurchaseOrder[]): WarehouseIPurchaseOrder[];
4
- export declare function getPurchaseOrdersPostedData(data: WarehouseIPurchaseOrder[], order: WarehouseIPurchaseOrder): WarehouseIPurchaseOrder[];
5
- export declare function getPurchaseOrdersUpdatedData(data: WarehouseIPurchaseOrder[], order: Partial<WarehouseIPurchaseOrder>): WarehouseIPurchaseOrder[];
6
- export declare function getPurchaseOrdersDeletedData(data: WarehouseIPurchaseOrder[], orderId: string): WarehouseIPurchaseOrder[];
7
- interface IGetPurchaseOrderStatusInfoReturn {
8
- currentOrderStatus: IPurchaseOrderStatus | null;
9
- nextOrderStatus: IPurchaseOrderStatus | null;
10
- orderProgress: number;
11
- }
12
- export declare function getPurchaseOrderStatusInfo(currentStatus: WAREHOUSE_PURCHASE_ORDER_STATUS_ENUM): IGetPurchaseOrderStatusInfoReturn;
13
- export {};
@@ -1,56 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getPurchaseOrdersFetchedData = getPurchaseOrdersFetchedData;
4
- exports.getPurchaseOrdersPostedData = getPurchaseOrdersPostedData;
5
- exports.getPurchaseOrdersUpdatedData = getPurchaseOrdersUpdatedData;
6
- exports.getPurchaseOrdersDeletedData = getPurchaseOrdersDeletedData;
7
- exports.getPurchaseOrderStatusInfo = getPurchaseOrderStatusInfo;
8
- const constants_1 = require("../../constants");
9
- const common_order_actions_1 = require("./common-order-actions");
10
- const common_purchase_order_actions_1 = require("./common-purchase-order-actions");
11
- function getPurchaseOrdersFetchedData(data) {
12
- return data.map((order) => (0, common_purchase_order_actions_1.getPurchaseOrderWithPrice)(order, false)).sort(common_order_actions_1.sortByCreatedAt);
13
- }
14
- function getPurchaseOrdersPostedData(data, order) {
15
- const newOrders = data.filter((item) => item._id !== order._id).concat((0, common_purchase_order_actions_1.getPurchaseOrderWithPrice)(order));
16
- return newOrders.sort(common_order_actions_1.sortByCreatedAt);
17
- }
18
- function getPurchaseOrdersUpdatedData(data, order) {
19
- const updatedOrder = (0, common_purchase_order_actions_1.getPurchaseOrderWithPrice)(order);
20
- const newOrders = data.map((item) => item._id === updatedOrder._id ? { ...item, ...updatedOrder } : item);
21
- return newOrders;
22
- }
23
- function getPurchaseOrdersDeletedData(data, orderId) {
24
- const filteredOrders = data.filter((item) => item._id !== orderId);
25
- return filteredOrders;
26
- }
27
- function getPurchaseOrderStatusInfo(currentStatus) {
28
- const info = {
29
- orderProgress: 0,
30
- nextOrderStatus: null,
31
- currentOrderStatus: null,
32
- };
33
- let currentStatusIndex;
34
- for (let i = 0; i < constants_1.DEFAULT_PURCHASE_ORDER_STATUS.length; i++) {
35
- const obj = constants_1.DEFAULT_PURCHASE_ORDER_STATUS[i];
36
- if (obj.status === currentStatus) {
37
- info.currentOrderStatus = obj;
38
- currentStatusIndex = i;
39
- if (info.currentOrderStatus.status !== constants_1.WAREHOUSE_PURCHASE_ORDER_STATUS_ENUM.CANCELLED) {
40
- // Total is -2 because we don't want to count unconfrimed and cancelled
41
- const total = constants_1.DEFAULT_PURCHASE_ORDER_STATUS.length - 2;
42
- info.orderProgress = Math.round((obj.priority / total) * 100);
43
- }
44
- break;
45
- }
46
- }
47
- if (currentStatusIndex == null) {
48
- return info;
49
- }
50
- const nextObj = constants_1.DEFAULT_PURCHASE_ORDER_STATUS[currentStatusIndex + 1];
51
- if (!nextObj || nextObj.status === constants_1.WAREHOUSE_PURCHASE_ORDER_STATUS_ENUM.CANCELLED) {
52
- return info;
53
- }
54
- info.nextOrderStatus = nextObj;
55
- return info;
56
- }
@@ -1,2 +0,0 @@
1
- import { WarehouseISaleOrder } from '../../schemas';
2
- export declare function getSaleOrdersFetchedData(data: WarehouseISaleOrder[]): WarehouseISaleOrder[];
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getSaleOrdersFetchedData = getSaleOrdersFetchedData;
4
- const common_order_actions_1 = require("./common-order-actions");
5
- const common_sale_order_actions_1 = require("./common-sale-order-actions");
6
- function getSaleOrdersFetchedData(data) {
7
- return data.map((order) => (0, common_sale_order_actions_1.getSaleOrderWithPrice)(order, false)).sort(common_order_actions_1.sortByCreatedAt);
8
- }
@@ -1,2 +0,0 @@
1
- import { IWarehouseSaleOrder } from '../../schemas';
2
- export declare function getWarehouseSaleOrdersFetchedData(data: IWarehouseSaleOrder[]): IWarehouseSaleOrder[];
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getWarehouseSaleOrdersFetchedData = getWarehouseSaleOrdersFetchedData;
4
- const common_order_actions_1 = require("./common-order-actions");
5
- const common_warehouse_sale_order_actions_1 = require("./common-warehouse-sale-order-actions");
6
- function getWarehouseSaleOrdersFetchedData(data) {
7
- return data.map((order) => (0, common_warehouse_sale_order_actions_1.getWarehouseSaleOrderWithPrice)(order, false)).sort(common_order_actions_1.sortByCreatedAt);
8
- }
@@ -1,31 +0,0 @@
1
- import { SORT_TYPE_ENUM } from '../../constants';
2
- import { IOrderPayment, WarehouseIPurchaseOrder, WarehouseIPurchaseOrderCategory, WarehouseIPurchaseOrderItem, WarehouseIPurchaseOrderIteration } from '../../schemas';
3
- import { IGeneralPurchaseOrderItem, IPurchaseOrderCartItemsObj } from '../types';
4
- export declare function getPurchaseOrderIterationsWithPrice(iterations?: WarehouseIPurchaseOrderIteration[] | undefined, writeable?: boolean): WarehouseIPurchaseOrderIteration[];
5
- export declare function getPurchaseOrderPaymentsWithPrice(payments: IOrderPayment[] | undefined, convertToPrice: (price: number) => number): IOrderPayment[];
6
- export declare function getPurchaseOrderItemsWithPrice(items: WarehouseIPurchaseOrderItem[] | undefined, convertToPrice: (price: number) => number): WarehouseIPurchaseOrderItem[];
7
- export declare function getPurchaseOrderCategoriesWithPrice(categories: WarehouseIPurchaseOrderCategory[] | undefined, convertToPrice: (price: number) => number): WarehouseIPurchaseOrderCategory[];
8
- export declare function getPurchaseOrderWithPrice<T extends Partial<WarehouseIPurchaseOrder> | WarehouseIPurchaseOrder | WarehouseIPurchaseOrderIteration>(order: T, writeable?: boolean): T;
9
- export declare function syncPurchaseOrderData(order: WarehouseIPurchaseOrder): WarehouseIPurchaseOrder;
10
- export declare function skipItemMetadataFromPurchaseOrderCategories(categories: WarehouseIPurchaseOrder['categories'], previousCategories?: WarehouseIPurchaseOrder['categories']): WarehouseIPurchaseOrder['categories'];
11
- export declare function getPurchaseOrderWithAllFields<T extends WarehouseIPurchaseOrder | Partial<WarehouseIPurchaseOrder>>(order: T, skipItemMetadata?: boolean): T;
12
- export interface IGetPurchaseOrderCartItemsObjPayload {
13
- currentIterationCategories: WarehouseIPurchaseOrderCategory[] | undefined;
14
- previousIterationCategories: WarehouseIPurchaseOrderCategory[] | undefined;
15
- mappedItems: Record<string, IGeneralPurchaseOrderItem>;
16
- shouldSortItemsViaId?: boolean;
17
- isAnEdit?: boolean;
18
- sortType?: SORT_TYPE_ENUM;
19
- }
20
- export declare function getPurchaseOrderCartItemsObj({ currentIterationCategories, previousIterationCategories, mappedItems, shouldSortItemsViaId, isAnEdit, sortType, }: IGetPurchaseOrderCartItemsObjPayload): IPurchaseOrderCartItemsObj;
21
- interface IGetVoidItemsWithReasonPurchaseOrder {
22
- currentCategories: WarehouseIPurchaseOrderCategory[];
23
- iterationsFromFrontend: WarehouseIPurchaseOrderIteration[] | undefined;
24
- previousCategories: WarehouseIPurchaseOrderCategory[];
25
- }
26
- export declare function getVoidItemsWithReasonPurchaseOrder({ currentCategories, iterationsFromFrontend, previousCategories, }: IGetVoidItemsWithReasonPurchaseOrder): {
27
- newIterationCategories: import("../../schemas").WarehouseIPurchaseOrderCommonCategoryByCategoryId[];
28
- voidOrderItems: import("../../schemas").WarehouseIPurchaseOrderCommonItem[];
29
- hasNewItems: boolean;
30
- };
31
- export {};