@managesome/eposmatic-toolkit 0.2.444 → 0.2.446

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.
@@ -59,14 +59,14 @@ export declare enum WAREHOUSE_PURCHASE_ORDER_RFQ_STATUS_ENUM {
59
59
  CANCELLED = "CANCELLED"
60
60
  }
61
61
  export declare const ALL_WAREHOUSE_PURCHASE_ORDER_RFQ_STATUS_NAMES: WAREHOUSE_PURCHASE_ORDER_RFQ_STATUS_ENUM[];
62
- export declare enum WAREHOUSE_RFQ_VENDOR_STATUS_ENUM {
62
+ export declare enum WAREHOUSE_PURCHASE_ORDER_RFQ_VENDOR_STATUS_ENUM {
63
63
  PENDING = "PENDING",
64
64
  SENT = "SENT",
65
65
  ACCEPTED = "ACCEPTED",
66
66
  CONFIRMED = "CONFIRMED",
67
67
  REJECTED = "REJECTED"
68
68
  }
69
- export declare const ALL_WAREHOUSE_RFQ_VENDOR_STATUS_NAMES: WAREHOUSE_RFQ_VENDOR_STATUS_ENUM[];
69
+ export declare const ALL_WAREHOUSE_RFQ_VENDOR_STATUS_NAMES: WAREHOUSE_PURCHASE_ORDER_RFQ_VENDOR_STATUS_ENUM[];
70
70
  export declare enum WAREHOUSE_SALE_ORDER_RFQ_STATUS_ENUM {
71
71
  DRAFT = "DRAFT",
72
72
  SENT = "SENT",
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ALL_WAREHOUSE_INTERNAL_MOVEMENT_LOCATION_TYPE_NAMES = exports.WAREHOUSE_INTERNAL_MOVEMENT_LOCATION_TYPE_ENUM = exports.ALL_WAREHOUSE_INTERNAL_MOVEMENT_FLOW_NAMES = exports.WAREHOUSE_INTERNAL_MOVEMENT_FLOW_ENUM = exports.ALL_WAREHOUSE_INTERNAL_MOVEMENT_EDIT_REQUEST_STATUS_NAMES = exports.ALL_WAREHOUSE_INVENTORY_LOT_SERIAL_MUTATION_ACTION_NAMES = exports.WAREHOUSE_INVENTORY_LOT_SERIAL_MUTATION_ACTION_ENUM = exports.ALL_WAREHOUSE_INVENTORY_LOT_SERIAL_MOVEMENT_TYPE_NAMES = exports.WAREHOUSE_INVENTORY_LOT_SERIAL_MOVEMENT_TYPE_ENUM = exports.WAREHOUSE_INTERNAL_MOVEMENT_EDIT_REQUEST_STATUS_ENUM = exports.ALL_WAREHOUSE_INTERNAL_MOVEMENT_STATUS_NAMES = exports.WAREHOUSE_INTERNAL_MOVEMENT_STATUS_ENUM = exports.ALL_WAREHOUSE_INTERNAL_MOVEMENT_RECORD_TYPE_NAMES = exports.WAREHOUSE_INTERNAL_MOVEMENT_RECORD_TYPE_ENUM = exports.ALL_WAREHOUSE_REF_TYPE_NAMES = exports.WAREHOUSE_REF_TYPE_ENUM = exports.ALL_WAREHOUSE_SALE_ORDER_DELIVERY_RETURN_STATUS_NAMES = exports.WAREHOUSE_SALE_ORDER_DELIVERY_RETURN_STATUS_ENUM = exports.ALL_WAREHOUSE_SALE_ORDER_DELIVERY_STATUS_NAMES = exports.WAREHOUSE_SALE_ORDER_DELIVERY_STATUS_ENUM = exports.ALL_WAREHOUSE_SALE_ORDER_PHYSICAL_DOC_KIND_NAMES = exports.WAREHOUSE_SALE_ORDER_PHYSICAL_DOC_KIND_ENUM = exports.ALL_WAREHOUSE_SALE_ORDER_CREDIT_NOTE_STATUS_NAMES = exports.WAREHOUSE_SALE_ORDER_CREDIT_NOTE_STATUS_ENUM = exports.ALL_WAREHOUSE_SALE_ORDER_INVOICE_PAYMENT_STATUS_NAMES = exports.WAREHOUSE_SALE_ORDER_INVOICE_PAYMENT_STATUS_ENUM = exports.ALL_WAREHOUSE_SALE_ORDER_INVOICE_TYPE_NAMES = exports.WAREHOUSE_SALE_ORDER_INVOICE_TYPE_ENUM = exports.ALL_WAREHOUSE_SALE_ORDER_FIN_DOC_KIND_NAMES = exports.WAREHOUSE_SALE_ORDER_FIN_DOC_KIND_ENUM = exports.ALL_WAREHOUSE_SALES_ORDER_STATUS_NAMES = exports.WAREHOUSE_SALES_ORDER_STATUS_ENUM = exports.ALL_WAREHOUSE_SALE_ORDER_RFQ_STATUS_NAMES = exports.WAREHOUSE_SALE_ORDER_RFQ_STATUS_ENUM = exports.ALL_WAREHOUSE_RFQ_VENDOR_STATUS_NAMES = exports.WAREHOUSE_RFQ_VENDOR_STATUS_ENUM = exports.ALL_WAREHOUSE_PURCHASE_ORDER_RFQ_STATUS_NAMES = exports.WAREHOUSE_PURCHASE_ORDER_RFQ_STATUS_ENUM = exports.ALL_WAREHOUSE_PURCHASE_ORDER_STATUS_NAMES = exports.WAREHOUSE_PURCHASE_ORDER_STATUS_ENUM = exports.ALL_VOID_WAREHOUSE_INVOICE_ITEM_TYPE_NAMES = exports.VOID_WAREHOUSE_INVOICE_ITEM_TYPE_ENUM = exports.ALL_WAREHOUSE_REMOVAL_STRATEGY_NAMES = exports.WAREHOUSE_REMOVAL_STRATEGY_ENUM = exports.ALL_WAREHOUSE_LOT_SERIAL_MOVEMENT_SOURCE_NAMES = exports.WAREHOUSE_LOT_SERIAL_MOVEMENT_SOURCE_ENUM = exports.ALL_WAREHOUSE_LOT_SERIAL_DOC_TYPE_NAMES = exports.WAREHOUSE_LOT_SERIAL_DOC_TYPE_ENUM = exports.ALL_WAREHOUSE_TRACKING_MODE_NAMES = exports.WAREHOUSE_TRACKING_MODE_ENUM = void 0;
3
+ exports.ALL_WAREHOUSE_INTERNAL_MOVEMENT_LOCATION_TYPE_NAMES = exports.WAREHOUSE_INTERNAL_MOVEMENT_LOCATION_TYPE_ENUM = exports.ALL_WAREHOUSE_INTERNAL_MOVEMENT_FLOW_NAMES = exports.WAREHOUSE_INTERNAL_MOVEMENT_FLOW_ENUM = exports.ALL_WAREHOUSE_INTERNAL_MOVEMENT_EDIT_REQUEST_STATUS_NAMES = exports.ALL_WAREHOUSE_INVENTORY_LOT_SERIAL_MUTATION_ACTION_NAMES = exports.WAREHOUSE_INVENTORY_LOT_SERIAL_MUTATION_ACTION_ENUM = exports.ALL_WAREHOUSE_INVENTORY_LOT_SERIAL_MOVEMENT_TYPE_NAMES = exports.WAREHOUSE_INVENTORY_LOT_SERIAL_MOVEMENT_TYPE_ENUM = exports.WAREHOUSE_INTERNAL_MOVEMENT_EDIT_REQUEST_STATUS_ENUM = exports.ALL_WAREHOUSE_INTERNAL_MOVEMENT_STATUS_NAMES = exports.WAREHOUSE_INTERNAL_MOVEMENT_STATUS_ENUM = exports.ALL_WAREHOUSE_INTERNAL_MOVEMENT_RECORD_TYPE_NAMES = exports.WAREHOUSE_INTERNAL_MOVEMENT_RECORD_TYPE_ENUM = exports.ALL_WAREHOUSE_REF_TYPE_NAMES = exports.WAREHOUSE_REF_TYPE_ENUM = exports.ALL_WAREHOUSE_SALE_ORDER_DELIVERY_RETURN_STATUS_NAMES = exports.WAREHOUSE_SALE_ORDER_DELIVERY_RETURN_STATUS_ENUM = exports.ALL_WAREHOUSE_SALE_ORDER_DELIVERY_STATUS_NAMES = exports.WAREHOUSE_SALE_ORDER_DELIVERY_STATUS_ENUM = exports.ALL_WAREHOUSE_SALE_ORDER_PHYSICAL_DOC_KIND_NAMES = exports.WAREHOUSE_SALE_ORDER_PHYSICAL_DOC_KIND_ENUM = exports.ALL_WAREHOUSE_SALE_ORDER_CREDIT_NOTE_STATUS_NAMES = exports.WAREHOUSE_SALE_ORDER_CREDIT_NOTE_STATUS_ENUM = exports.ALL_WAREHOUSE_SALE_ORDER_INVOICE_PAYMENT_STATUS_NAMES = exports.WAREHOUSE_SALE_ORDER_INVOICE_PAYMENT_STATUS_ENUM = exports.ALL_WAREHOUSE_SALE_ORDER_INVOICE_TYPE_NAMES = exports.WAREHOUSE_SALE_ORDER_INVOICE_TYPE_ENUM = exports.ALL_WAREHOUSE_SALE_ORDER_FIN_DOC_KIND_NAMES = exports.WAREHOUSE_SALE_ORDER_FIN_DOC_KIND_ENUM = exports.ALL_WAREHOUSE_SALES_ORDER_STATUS_NAMES = exports.WAREHOUSE_SALES_ORDER_STATUS_ENUM = exports.ALL_WAREHOUSE_SALE_ORDER_RFQ_STATUS_NAMES = exports.WAREHOUSE_SALE_ORDER_RFQ_STATUS_ENUM = exports.ALL_WAREHOUSE_RFQ_VENDOR_STATUS_NAMES = exports.WAREHOUSE_PURCHASE_ORDER_RFQ_VENDOR_STATUS_ENUM = exports.ALL_WAREHOUSE_PURCHASE_ORDER_RFQ_STATUS_NAMES = exports.WAREHOUSE_PURCHASE_ORDER_RFQ_STATUS_ENUM = exports.ALL_WAREHOUSE_PURCHASE_ORDER_STATUS_NAMES = exports.WAREHOUSE_PURCHASE_ORDER_STATUS_ENUM = exports.ALL_VOID_WAREHOUSE_INVOICE_ITEM_TYPE_NAMES = exports.VOID_WAREHOUSE_INVOICE_ITEM_TYPE_ENUM = exports.ALL_WAREHOUSE_REMOVAL_STRATEGY_NAMES = exports.WAREHOUSE_REMOVAL_STRATEGY_ENUM = exports.ALL_WAREHOUSE_LOT_SERIAL_MOVEMENT_SOURCE_NAMES = exports.WAREHOUSE_LOT_SERIAL_MOVEMENT_SOURCE_ENUM = exports.ALL_WAREHOUSE_LOT_SERIAL_DOC_TYPE_NAMES = exports.WAREHOUSE_LOT_SERIAL_DOC_TYPE_ENUM = exports.ALL_WAREHOUSE_TRACKING_MODE_NAMES = exports.WAREHOUSE_TRACKING_MODE_ENUM = void 0;
4
4
  exports.ALL_WAREHOUSE_CLIENT_TYPE_NAMES = exports.WAREHOUSE_CLIENT_TYPE_ENUM = exports.ALL_WAREHOUSE_SUPPORT_SPECIALIST_PERMISSION_NAMES = exports.ALL_WAREHOUSE_MODERATOR_PERMISSION_NAMES = exports.ALL_WAREHOUSE_USER_PERMISSION_NAMES = exports.WAREHOUSE_USER_PERMISSIONS_ENUM = exports.ALL_WAREHOUSE_INVOICE_STATUS_NAMES = exports.WAREHOUSE_INVOICE_STATUS_ENUM = exports.ALL_WAREHOUSE_ACTIVITY_LOG_SEVERITY_NAMES = exports.WAREHOUSE_ACTIVITY_LOG_SEVERITY_ENUM = exports.ALL_WAREHOUSE_ACTIVITY_LOG_ACTIONS_ENUM_NAMES = exports.WAREHOUSE_ACTIVITY_LOG_ACTIONS_ENUM = exports.ALL_WAREHOUSE_ACTIVITY_LOG_ACTION_NAMES = exports.WAREHOUSE_ACTIVITY_LOG_ACTION_ENUM = exports.ALL_WAREHOUSE_ACTIVITY_LOG_ENTITY_TYPE_NAMES = exports.WAREHOUSE_ACTIVITY_LOG_ENTITY_TYPE_ENUM = exports.ALL_WAREHOUSE_PURCHASE_ORDER_VENDOR_RETURN_STATUS_NAMES = exports.WAREHOUSE_PURCHASE_ORDER_VENDOR_RETURN_STATUS_ENUM = exports.ALL_WAREHOUSE_PURCHASE_ORDER_RECEIPT_STATUS_NAMES = exports.WAREHOUSE_PURCHASE_ORDER_RECEIPT_STATUS_ENUM = exports.ALL_WAREHOUSE_INTERNAL_MOVEMENT_DIRECTION_NAMES = exports.WAREHOUSE_INTERNAL_MOVEMENT_DIRECTION_ENUM = void 0;
5
5
  // ======================>> <<====================== //
6
6
  var WAREHOUSE_TRACKING_MODE_ENUM;
@@ -78,15 +78,15 @@ var WAREHOUSE_PURCHASE_ORDER_RFQ_STATUS_ENUM;
78
78
  })(WAREHOUSE_PURCHASE_ORDER_RFQ_STATUS_ENUM || (exports.WAREHOUSE_PURCHASE_ORDER_RFQ_STATUS_ENUM = WAREHOUSE_PURCHASE_ORDER_RFQ_STATUS_ENUM = {}));
79
79
  exports.ALL_WAREHOUSE_PURCHASE_ORDER_RFQ_STATUS_NAMES = Object.values(WAREHOUSE_PURCHASE_ORDER_RFQ_STATUS_ENUM);
80
80
  // ======================>> <<====================== //
81
- var WAREHOUSE_RFQ_VENDOR_STATUS_ENUM;
82
- (function (WAREHOUSE_RFQ_VENDOR_STATUS_ENUM) {
83
- WAREHOUSE_RFQ_VENDOR_STATUS_ENUM["PENDING"] = "PENDING";
84
- WAREHOUSE_RFQ_VENDOR_STATUS_ENUM["SENT"] = "SENT";
85
- WAREHOUSE_RFQ_VENDOR_STATUS_ENUM["ACCEPTED"] = "ACCEPTED";
86
- WAREHOUSE_RFQ_VENDOR_STATUS_ENUM["CONFIRMED"] = "CONFIRMED";
87
- WAREHOUSE_RFQ_VENDOR_STATUS_ENUM["REJECTED"] = "REJECTED";
88
- })(WAREHOUSE_RFQ_VENDOR_STATUS_ENUM || (exports.WAREHOUSE_RFQ_VENDOR_STATUS_ENUM = WAREHOUSE_RFQ_VENDOR_STATUS_ENUM = {}));
89
- exports.ALL_WAREHOUSE_RFQ_VENDOR_STATUS_NAMES = Object.values(WAREHOUSE_RFQ_VENDOR_STATUS_ENUM);
81
+ var WAREHOUSE_PURCHASE_ORDER_RFQ_VENDOR_STATUS_ENUM;
82
+ (function (WAREHOUSE_PURCHASE_ORDER_RFQ_VENDOR_STATUS_ENUM) {
83
+ WAREHOUSE_PURCHASE_ORDER_RFQ_VENDOR_STATUS_ENUM["PENDING"] = "PENDING";
84
+ WAREHOUSE_PURCHASE_ORDER_RFQ_VENDOR_STATUS_ENUM["SENT"] = "SENT";
85
+ WAREHOUSE_PURCHASE_ORDER_RFQ_VENDOR_STATUS_ENUM["ACCEPTED"] = "ACCEPTED";
86
+ WAREHOUSE_PURCHASE_ORDER_RFQ_VENDOR_STATUS_ENUM["CONFIRMED"] = "CONFIRMED";
87
+ WAREHOUSE_PURCHASE_ORDER_RFQ_VENDOR_STATUS_ENUM["REJECTED"] = "REJECTED";
88
+ })(WAREHOUSE_PURCHASE_ORDER_RFQ_VENDOR_STATUS_ENUM || (exports.WAREHOUSE_PURCHASE_ORDER_RFQ_VENDOR_STATUS_ENUM = WAREHOUSE_PURCHASE_ORDER_RFQ_VENDOR_STATUS_ENUM = {}));
89
+ exports.ALL_WAREHOUSE_RFQ_VENDOR_STATUS_NAMES = Object.values(WAREHOUSE_PURCHASE_ORDER_RFQ_VENDOR_STATUS_ENUM);
90
90
  // ======================>> <<====================== //
91
91
  var WAREHOUSE_SALE_ORDER_RFQ_STATUS_ENUM;
92
92
  (function (WAREHOUSE_SALE_ORDER_RFQ_STATUS_ENUM) {
@@ -1,5 +1,31 @@
1
+ import { SORT_TYPE_ENUM } from '../../constants';
1
2
  import { IWarehouseSaleOrderRFQ, IWarehouseSaleOrderRFQCategory, IWarehouseSaleOrderRFQItem, IWarehouseSaleOrderRFQIteration } from '../../schemas';
3
+ import { IWarehouseGeneralSaleOrderRfqItem, IWarehouseSaleOrderRfqCartItemsObj } from '../types';
2
4
  export declare function getWarehouseSaleOrderRfqIterationsWithPrice(iterations?: IWarehouseSaleOrderRFQIteration[] | undefined, writeable?: boolean): IWarehouseSaleOrderRFQIteration[];
3
5
  export declare function getWarehouseSaleOrderRfqItemsWithPrice(items: IWarehouseSaleOrderRFQItem[] | undefined, convertToPrice: (price: number) => number): IWarehouseSaleOrderRFQItem[];
4
6
  export declare function getWarehouseSaleOrderRfqCategoriesWithPrice(categories: IWarehouseSaleOrderRFQCategory[] | undefined, convertToPrice: (price: number) => number): IWarehouseSaleOrderRFQCategory[];
5
7
  export declare function getWarehouseSaleOrderRfqWithPrice<T extends Partial<IWarehouseSaleOrderRFQ> | IWarehouseSaleOrderRFQ | IWarehouseSaleOrderRFQIteration>(order: T, writeable?: boolean): T;
8
+ export declare function calculateCartWarehouseSaleOrderRfqOrderInfoAndSyncData<T extends IWarehouseSaleOrderRFQ | Partial<IWarehouseSaleOrderRFQ>>(data: T, calculateItemMetadata?: boolean): T;
9
+ export declare function syncWarehouseSaleOrderRfqData(order: IWarehouseSaleOrderRFQ): IWarehouseSaleOrderRFQ;
10
+ export declare function skipItemMetadataFromWarehouseSaleOrderRfqCategories(categories: IWarehouseSaleOrderRFQ['categories'], previousCategories?: IWarehouseSaleOrderRFQ['categories']): IWarehouseSaleOrderRFQ['categories'];
11
+ export declare function getWarehouseSaleOrderRfqWithAllFields<T extends IWarehouseSaleOrderRFQ | Partial<IWarehouseSaleOrderRFQ>>(order: T, skipItemMetadata?: boolean): T;
12
+ export interface IGetSaleOrderRfqCartItemsObjPayload {
13
+ currentIterationCategories: IWarehouseSaleOrderRFQCategory[] | undefined;
14
+ previousIterationCategories: IWarehouseSaleOrderRFQCategory[] | undefined;
15
+ mappedItems: Record<string, IWarehouseGeneralSaleOrderRfqItem>;
16
+ shouldSortItemsViaId?: boolean;
17
+ isAnEdit?: boolean;
18
+ sortType?: SORT_TYPE_ENUM;
19
+ }
20
+ export declare function getWarehouseSaleOrderRfqCartItemsObj({ currentIterationCategories, previousIterationCategories, mappedItems, shouldSortItemsViaId, isAnEdit, sortType, }: IGetSaleOrderRfqCartItemsObjPayload): IWarehouseSaleOrderRfqCartItemsObj;
21
+ interface IGetVoidItemsWithReasonSaleOrderRfq {
22
+ currentCategories: IWarehouseSaleOrderRFQCategory[];
23
+ iterationsFromFrontend: IWarehouseSaleOrderRFQIteration[] | undefined;
24
+ previousCategories: IWarehouseSaleOrderRFQCategory[];
25
+ }
26
+ export declare function getVoidItemsWithReasonWarehouseSaleOrderRfq({ currentCategories, iterationsFromFrontend, previousCategories, }: IGetVoidItemsWithReasonSaleOrderRfq): {
27
+ newIterationCategories: import("../../schemas").IWarehouseSaleOrderCommonCategoryByCategoryId[];
28
+ voidOrderItems: import("../../schemas").IWarehouseSaleOrderCommonItem[];
29
+ hasNewItems: boolean;
30
+ };
31
+ export {};
@@ -1,10 +1,26 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.getWarehouseSaleOrderRfqIterationsWithPrice = getWarehouseSaleOrderRfqIterationsWithPrice;
4
7
  exports.getWarehouseSaleOrderRfqItemsWithPrice = getWarehouseSaleOrderRfqItemsWithPrice;
5
8
  exports.getWarehouseSaleOrderRfqCategoriesWithPrice = getWarehouseSaleOrderRfqCategoriesWithPrice;
6
9
  exports.getWarehouseSaleOrderRfqWithPrice = getWarehouseSaleOrderRfqWithPrice;
10
+ exports.calculateCartWarehouseSaleOrderRfqOrderInfoAndSyncData = calculateCartWarehouseSaleOrderRfqOrderInfoAndSyncData;
11
+ exports.syncWarehouseSaleOrderRfqData = syncWarehouseSaleOrderRfqData;
12
+ exports.skipItemMetadataFromWarehouseSaleOrderRfqCategories = skipItemMetadataFromWarehouseSaleOrderRfqCategories;
13
+ exports.getWarehouseSaleOrderRfqWithAllFields = getWarehouseSaleOrderRfqWithAllFields;
14
+ exports.getWarehouseSaleOrderRfqCartItemsObj = getWarehouseSaleOrderRfqCartItemsObj;
15
+ exports.getVoidItemsWithReasonWarehouseSaleOrderRfq = getVoidItemsWithReasonWarehouseSaleOrderRfq;
16
+ const bson_objectid_1 = __importDefault(require("bson-objectid"));
17
+ const lodash_1 = require("lodash");
18
+ const constants_1 = require("../../constants");
7
19
  const utils_1 = require("../utils");
20
+ /* =================================================================
21
+ * Sale-order RFQ common helpers — price conversion, field defaults, cart UI.
22
+ * Mirrors common-warehouse-purchase-order-rfq-actions.ts for sale RFQ types.
23
+ * ================================================================= */
8
24
  // ── Iterations ──────────────────────────────────────────────────
9
25
  function getWarehouseSaleOrderRfqIterationsWithPrice(iterations, writeable) {
10
26
  if (!iterations)
@@ -58,3 +74,550 @@ function getWarehouseSaleOrderRfqWithPrice(order, writeable) {
58
74
  };
59
75
  return payload;
60
76
  }
77
+ // ── Cart calculation ──
78
+ function calculateCartWarehouseSaleOrderRfqOrderInfoAndSyncData(data, calculateItemMetadata) {
79
+ const isConfirmed = data.order_status === constants_1.WAREHOUSE_SALE_ORDER_RFQ_STATUS_ENUM.CONFIRMED;
80
+ let subtotal = 0;
81
+ const categories = [];
82
+ const length = data.categories?.length ?? 0;
83
+ for (let c = 0; c < length; c++) {
84
+ const category = data.categories[c];
85
+ const newItems = [];
86
+ const itemsLength = category.items.length;
87
+ for (let i = 0; i < itemsLength; i++) {
88
+ const item = category.items[i];
89
+ const itemSubtotal = (0, utils_1.parseNum)(item.price * item.quantity);
90
+ const newItem = {
91
+ ...item,
92
+ is_ready: item.is_ready || isConfirmed,
93
+ subtotal: itemSubtotal,
94
+ _discount_amount: 0,
95
+ _gross_amount: 0,
96
+ _gst_amount: 0,
97
+ _net_amount: 0,
98
+ };
99
+ delete newItem.void_reason;
100
+ newItems.push(newItem);
101
+ subtotal += itemSubtotal;
102
+ }
103
+ categories.push({ ...category, items: newItems });
104
+ }
105
+ let grand_total = subtotal;
106
+ let gst_amount = 0;
107
+ const gst = data.gst ?? 0;
108
+ if (data.is_gst_inclusive) {
109
+ gst_amount = (0, utils_1.parseFloatCeil)((grand_total * gst) / (100 + gst));
110
+ }
111
+ else {
112
+ gst_amount = (0, utils_1.getPercentageAmount)(grand_total, gst);
113
+ grand_total += gst_amount;
114
+ }
115
+ grand_total = (0, utils_1.parseNum)(grand_total);
116
+ const amount_earned = (0, utils_1.parseNum)(grand_total);
117
+ if (calculateItemMetadata) {
118
+ let leftGrossAmount = subtotal;
119
+ let leftNetAmount = subtotal;
120
+ let leftDiscountAmount = 0;
121
+ let leftGstAmount = gst_amount;
122
+ categories.forEach((category, categoryIndex) => {
123
+ const isLastCategory = categoryIndex === categories.length - 1;
124
+ category.items.forEach((item, itemIndex) => {
125
+ const isLastItem = isLastCategory && itemIndex === category.items.length - 1;
126
+ let grossAmount = item.subtotal;
127
+ let netAmount = item.subtotal;
128
+ let itemTotalDiscountAmount = 0;
129
+ let itemGst = 0;
130
+ if (gst_amount > 0) {
131
+ itemGst = (item.subtotal / subtotal) * gst_amount;
132
+ }
133
+ grossAmount = (0, utils_1.parseFloatCeil)(grossAmount);
134
+ const netAmountParsed = (0, utils_1.parseFloatCeil)(netAmount);
135
+ const itemTotalDiscountAmountParsed = (0, utils_1.parseFloatCeil)(itemTotalDiscountAmount);
136
+ itemGst = (0, utils_1.parseFloatCeil)(itemGst);
137
+ leftGrossAmount -= grossAmount;
138
+ leftNetAmount -= netAmountParsed;
139
+ leftDiscountAmount -= itemTotalDiscountAmountParsed;
140
+ leftGstAmount -= itemGst;
141
+ if (isLastItem) {
142
+ grossAmount += leftGrossAmount;
143
+ netAmount += leftNetAmount;
144
+ itemTotalDiscountAmount += leftDiscountAmount;
145
+ itemGst += leftGstAmount;
146
+ }
147
+ item._gross_amount = Math.max(grossAmount, 0);
148
+ item._net_amount = Math.max(netAmount, 0);
149
+ item._discount_amount = Math.max(itemTotalDiscountAmount, 0);
150
+ item._gst_amount = Math.max(itemGst, 0);
151
+ });
152
+ });
153
+ }
154
+ return {
155
+ ...data,
156
+ categories,
157
+ amount_earned,
158
+ gst_amount,
159
+ price: (0, utils_1.parseNum)(subtotal),
160
+ grand_total,
161
+ };
162
+ }
163
+ // ── Sync ──
164
+ function syncWarehouseSaleOrderRfqData(order) {
165
+ const updatedOrder = {
166
+ ...order,
167
+ iterations: [],
168
+ };
169
+ const newOrder = getWarehouseSaleOrderRfqWithPrice(calculateCartWarehouseSaleOrderRfqOrderInfoAndSyncData(getWarehouseSaleOrderRfqWithPrice(updatedOrder), true), true);
170
+ newOrder.iterations = order.iterations;
171
+ return newOrder;
172
+ }
173
+ // ── Skip item metadata ──
174
+ function skipItemMetadataFromWarehouseSaleOrderRfqCategories(categories, previousCategories) {
175
+ return categories.map((category) => {
176
+ const previousCategory = previousCategories?.find((prevCategory) => prevCategory.category_id === category.category_id);
177
+ return {
178
+ ...category,
179
+ items: category.items.map((item) => {
180
+ const previousItem = previousCategory?.items.find((prevItem) => prevItem._id === item._id);
181
+ const void_reason = previousItem?.void_reason ?? item.void_reason;
182
+ const newItem = {
183
+ ...item,
184
+ void_reason,
185
+ _discount_amount: 0,
186
+ _gst_amount: 0,
187
+ _gross_amount: 0,
188
+ _net_amount: 0,
189
+ };
190
+ return newItem;
191
+ }),
192
+ };
193
+ });
194
+ }
195
+ // ── Optional field helpers ──
196
+ function getCommonOptionalBoolFieldsSaleOrderRfq(order, partial) {
197
+ const defaultValue = partial ? undefined : false;
198
+ return {
199
+ is_gst_inclusive: order['is_gst_inclusive'] || defaultValue,
200
+ is_reopened: order['is_reopened'] || defaultValue,
201
+ };
202
+ }
203
+ function getCommonOptionalNumFieldsSaleOrderRfq(order, partial) {
204
+ const defaultValue = partial ? undefined : 0;
205
+ return {
206
+ gst: order['gst'] || defaultValue,
207
+ gst_amount: order['gst_amount'] || defaultValue,
208
+ };
209
+ }
210
+ function getWarehouseSaleOrderRfqWithAllFields(order, skipItemMetadata) {
211
+ return {
212
+ ...order,
213
+ ...getCommonOptionalBoolFieldsSaleOrderRfq(order, false),
214
+ ...getCommonOptionalNumFieldsSaleOrderRfq(order, false),
215
+ ...(skipItemMetadata && order.categories != null
216
+ ? {
217
+ categories: skipItemMetadataFromWarehouseSaleOrderRfqCategories(order.categories),
218
+ }
219
+ : {}),
220
+ delete_reason: order['delete_reason'] ?? null,
221
+ cancel_reason: order['cancel_reason'] ?? null,
222
+ };
223
+ }
224
+ const getSaleRfqItemComparableData = (item) => ({
225
+ item_id: item.item_id,
226
+ name: item.name,
227
+ price: item.price,
228
+ special_instructions: item.special_instructions,
229
+ _id: item._id,
230
+ quantity: item.quantity,
231
+ });
232
+ function getWarehouseSaleOrderRfqCartItemsObj({ currentIterationCategories, previousIterationCategories, mappedItems, shouldSortItemsViaId = true, isAnEdit, sortType, }) {
233
+ const newMappedItems = { ...mappedItems };
234
+ if (Object.keys(newMappedItems).length === 0) {
235
+ previousIterationCategories?.forEach((category) => {
236
+ category.items.forEach((item) => {
237
+ if (newMappedItems[item.item_id] == null) {
238
+ newMappedItems[item.item_id] = {
239
+ _id: item.item_id,
240
+ name: item.name,
241
+ category_id: category.category_id,
242
+ category_name: category.name,
243
+ category_image_url: '',
244
+ image_url: '',
245
+ description: '',
246
+ };
247
+ }
248
+ });
249
+ });
250
+ currentIterationCategories?.forEach((category) => {
251
+ category.items.forEach((item) => {
252
+ if (newMappedItems[item.item_id] == null) {
253
+ newMappedItems[item.item_id] = {
254
+ _id: item.item_id,
255
+ name: item.name,
256
+ category_id: category.category_id,
257
+ category_name: category.name,
258
+ category_image_url: '',
259
+ image_url: '',
260
+ description: '',
261
+ };
262
+ }
263
+ });
264
+ });
265
+ }
266
+ // =====================><=====================
267
+ const getCartItems = (items) => {
268
+ const orderItems = items.map((item) => {
269
+ const selectedItem = newMappedItems[item.item_id] ?? {};
270
+ return {
271
+ orderItem: item,
272
+ image_url: selectedItem.image_url ?? '',
273
+ description: selectedItem.description ?? '',
274
+ category_name: selectedItem.category_name ?? '',
275
+ category_id: selectedItem.category_id ?? '',
276
+ };
277
+ });
278
+ if (shouldSortItemsViaId) {
279
+ if (sortType === constants_1.SORT_TYPE_ENUM.DESC) {
280
+ orderItems.sort((a, b) => (0, bson_objectid_1.default)(b.orderItem._id).getTimestamp().getTime() - (0, bson_objectid_1.default)(a.orderItem._id).getTimestamp().getTime());
281
+ }
282
+ else {
283
+ orderItems.sort((a, b) => (0, bson_objectid_1.default)(a.orderItem._id).getTimestamp().getTime() - (0, bson_objectid_1.default)(b.orderItem._id).getTimestamp().getTime());
284
+ }
285
+ }
286
+ return orderItems;
287
+ };
288
+ // =====================><=====================
289
+ /*
290
+ If the order has iterations in it, then we get the last iteration.
291
+ We would compare the changes in the last iteration with the current iteration
292
+ and show the changes in the cart.
293
+ */
294
+ let totalItemsInCart = 0;
295
+ const currentItems = [];
296
+ if (currentIterationCategories != null) {
297
+ for (let i = 0; i < currentIterationCategories.length; i++) {
298
+ const category = currentIterationCategories[i];
299
+ for (let j = 0; j < category.items.length; j++) {
300
+ const item = { ...category.items[j] };
301
+ currentItems.push(item);
302
+ totalItemsInCart += item.quantity;
303
+ }
304
+ }
305
+ }
306
+ let unChangedItems = currentItems;
307
+ const editedItems = [];
308
+ let removedItems = [];
309
+ let newItems = [];
310
+ let disabledReason = '';
311
+ // If previous iteration exists, then it's an update to the order.
312
+ // In that case we would keep the previous iteration as it is and
313
+ // compare the current iteration with the previous iteration.
314
+ // If the current iteration is different from the previous iteration in any way
315
+ // then we would update the current iteration with only those items that are different
316
+ const isAnUpdate = isAnEdit ?? (previousIterationCategories != null && previousIterationCategories.length > 0);
317
+ if (isAnUpdate) {
318
+ // we need to compare the current iteration with the previous iteration
319
+ const currentItemsMap = currentItems.reduce((acc, currentItem) => {
320
+ acc[currentItem._id] = currentItem;
321
+ return acc;
322
+ }, {});
323
+ const prevItems = [];
324
+ const prevItemsMap = {};
325
+ const prevCategories = previousIterationCategories ?? [];
326
+ for (let i = 0; i < prevCategories.length; i++) {
327
+ const category = prevCategories[i];
328
+ for (let j = 0; j < category.items.length; j++) {
329
+ const prevItem = category.items[j];
330
+ let item = prevItem;
331
+ const currentItem = currentItemsMap[prevItem._id];
332
+ if (currentItem != null && currentItem.is_ready != null) {
333
+ item = {
334
+ ...item,
335
+ is_ready: currentItem.is_ready,
336
+ };
337
+ }
338
+ prevItems.push(item);
339
+ prevItemsMap[item._id] = item;
340
+ }
341
+ }
342
+ // NOTE: We will always set the items from currentItemsMap because we are dealing with current iteration
343
+ unChangedItems = [];
344
+ let totalTempRemovedItems = 0;
345
+ for (let i = 0; i < prevItems.length; i++) {
346
+ const prevItem = {
347
+ ...prevItems[i],
348
+ };
349
+ const currentItem = {
350
+ ...currentItemsMap[prevItem._id],
351
+ };
352
+ // Step 1: Get the items that are not present in the current iteration
353
+ if (currentItemsMap[prevItem._id] == null) {
354
+ removedItems.push(prevItem);
355
+ }
356
+ // Step 2: Get the items that are same in the current iteration
357
+ else if ((0, lodash_1.isEqual)(getSaleRfqItemComparableData(currentItem), getSaleRfqItemComparableData(prevItem))) {
358
+ unChangedItems.push(prevItem);
359
+ }
360
+ // Step 3: Get the items that are present in the previous iteration but
361
+ // This is turn for edit items
362
+ // but we change logic for display purpose
363
+ else {
364
+ const currQty = currentItem.quantity;
365
+ const prevQty = prevItem.quantity;
366
+ if (currQty !== prevQty) {
367
+ const subtotalForOne = currentItem.subtotal / currentItem.quantity;
368
+ // currQty = 8
369
+ // prevQty = 3
370
+ // diff = 5
371
+ const diff = currQty - prevQty;
372
+ const changeQty = Math.abs(diff);
373
+ const itm = {
374
+ ...currentItem,
375
+ quantity: changeQty,
376
+ subtotal: (0, utils_1.parseNum)(changeQty * subtotalForOne),
377
+ };
378
+ if (diff > 0) {
379
+ // We need to show it as a new item
380
+ newItems.push(itm);
381
+ const unchangedQty = currQty - changeQty;
382
+ const tempUnchangedItm = {
383
+ ...currentItem,
384
+ quantity: unchangedQty,
385
+ subtotal: (0, utils_1.parseNum)(unchangedQty * subtotalForOne),
386
+ };
387
+ unChangedItems.push(tempUnchangedItm);
388
+ }
389
+ else {
390
+ itm.void_reason = prevItem.void_reason ?? currentItem.void_reason;
391
+ // We need to show it as a removed item
392
+ removedItems.push(itm);
393
+ const unchangedQty = prevQty - changeQty;
394
+ const tempUnchangedItm = {
395
+ ...currentItem,
396
+ quantity: unchangedQty,
397
+ subtotal: (0, utils_1.parseNum)(unchangedQty * subtotalForOne),
398
+ };
399
+ unChangedItems.push(tempUnchangedItm);
400
+ totalTempRemovedItems++;
401
+ }
402
+ }
403
+ else {
404
+ const curr = {
405
+ _id: currentItem._id,
406
+ item_id: currentItem.item_id,
407
+ name: currentItem.name,
408
+ special_instructions: currentItem.special_instructions,
409
+ };
410
+ const prev = {
411
+ _id: prevItem._id,
412
+ item_id: prevItem.item_id,
413
+ name: prevItem.name,
414
+ special_instructions: prevItem.special_instructions,
415
+ };
416
+ const isBothEqual = (0, lodash_1.isEqual)(curr, prev);
417
+ if (isBothEqual) {
418
+ unChangedItems.push(currentItem);
419
+ }
420
+ else {
421
+ // For edited item, we don't need to have tempUnchangedItemIds
422
+ // because it's the turn for edited item
423
+ editedItems.push(currentItem);
424
+ }
425
+ }
426
+ }
427
+ }
428
+ // Step 4: Get the items that are present in the current iteration
429
+ // but not present in the previous iteration
430
+ for (let i = 0; i < currentItems.length; i++) {
431
+ const item = currentItems[i];
432
+ if (prevItemsMap[item._id] == null) {
433
+ newItems.push(item);
434
+ }
435
+ }
436
+ // Lastly, we need to check if any same item has been removed and added
437
+ // If so, the we need to remove the item from removedItems and newItems, and add it to unChangedItems
438
+ if (removedItems.length > 0 && newItems.length > 0) {
439
+ const newItemsMap = newItems.reduce((acc, item) => {
440
+ acc[item.item_id] = [...(acc[item.item_id] ?? []), item];
441
+ return acc;
442
+ }, {});
443
+ const revertedRemovedItems = [];
444
+ const revertedNewItems = [];
445
+ const additionalNewItems = [];
446
+ for (let i = 0; i < removedItems.length; i++) {
447
+ const removedItem = removedItems[i];
448
+ // Need to check if the removed item is present in the newItems
449
+ const newItemsForItem = newItemsMap[removedItem.item_id];
450
+ if (newItemsForItem == null)
451
+ continue;
452
+ if (newItemsForItem.length > 0) {
453
+ const newItemsForItemLength = newItemsForItem.length;
454
+ for (let j = 0; j < newItemsForItemLength; j++) {
455
+ const newItem = newItemsForItem[j];
456
+ const newI = {
457
+ // _id: newItem._id,
458
+ item_id: newItem.item_id,
459
+ name: newItem.name,
460
+ price: newItem.price,
461
+ // subtotal: number;
462
+ // quantity: newItem.quantity,
463
+ special_instructions: newItem.special_instructions,
464
+ };
465
+ const removedI = {
466
+ // _id: removedItem._id,
467
+ item_id: removedItem.item_id,
468
+ name: removedItem.name,
469
+ price: removedItem.price,
470
+ // subtotal: number;
471
+ // quantity: removedItem.quantity,
472
+ special_instructions: removedItem.special_instructions,
473
+ };
474
+ if ((0, lodash_1.isEqual)(newI, removedI)) {
475
+ if (newItem.quantity === removedItem.quantity) {
476
+ newItemsMap[removedItem.item_id] = newItemsForItem.filter((item) => item._id !== newItem._id);
477
+ if (newItemsMap[removedItem.item_id].length === 0) {
478
+ delete newItemsMap[removedItem.item_id];
479
+ }
480
+ revertedNewItems.push(newItem);
481
+ revertedRemovedItems.push(removedItem);
482
+ // We will break the loop when ever we push to revertedRemovedItems
483
+ break;
484
+ }
485
+ else {
486
+ if (removedItem.quantity > newItem.quantity) {
487
+ newItemsMap[removedItem.item_id] = newItemsForItem.filter((item) => item._id !== newItem._id);
488
+ if (newItemsMap[removedItem.item_id].length === 0) {
489
+ delete newItemsMap[removedItem.item_id];
490
+ }
491
+ revertedNewItems.push(newItem);
492
+ const subtotalForSingle = removedItem.subtotal / removedItem.quantity;
493
+ // We will only minus the quantity from removedItem
494
+ const newQuantity = removedItem.quantity - newItem.quantity;
495
+ const newSubtotal = (0, utils_1.parseNum)(newQuantity * subtotalForSingle);
496
+ removedItem.quantity = newQuantity;
497
+ removedItem.subtotal = newSubtotal;
498
+ }
499
+ else {
500
+ revertedRemovedItems.push(removedItem);
501
+ const nQuantity = newItem.quantity;
502
+ const subtotalForSingle = newItem.subtotal / nQuantity;
503
+ const newQuantity = nQuantity - removedItem.quantity;
504
+ const newSubtotal = (0, utils_1.parseNum)(newQuantity * subtotalForSingle);
505
+ newItem.quantity = newQuantity;
506
+ newItem.subtotal = newSubtotal;
507
+ // =====================><=====================
508
+ const remainingQuantity = nQuantity - newQuantity;
509
+ const adItem = {
510
+ ...newItem,
511
+ quantity: remainingQuantity,
512
+ subtotal: (0, utils_1.parseNum)(remainingQuantity * subtotalForSingle),
513
+ };
514
+ additionalNewItems.push(adItem);
515
+ // We will break the loop when ever we push to revertedRemovedItems
516
+ break;
517
+ }
518
+ }
519
+ }
520
+ }
521
+ }
522
+ else {
523
+ delete newItemsMap[removedItem.item_id];
524
+ }
525
+ }
526
+ for (let i = 0; i < revertedRemovedItems.length; i++) {
527
+ const rItem = revertedRemovedItems[i];
528
+ removedItems = removedItems.filter((item) => item._id !== rItem._id);
529
+ }
530
+ for (let i = 0; i < revertedNewItems.length; i++) {
531
+ const nItem = revertedNewItems[i];
532
+ newItems = newItems.filter((item) => item._id !== nItem._id);
533
+ unChangedItems.push(nItem);
534
+ }
535
+ for (let i = 0; i < additionalNewItems.length; i++) {
536
+ const aItem = additionalNewItems[i];
537
+ unChangedItems.push(aItem);
538
+ }
539
+ }
540
+ disabledReason =
541
+ unChangedItems.length === prevItems.length &&
542
+ newItems.length === 0 &&
543
+ removedItems.length === 0 &&
544
+ editedItems.length === 0
545
+ ? 'No changes in the order'
546
+ : prevItems.length === removedItems.length - totalTempRemovedItems &&
547
+ editedItems.length === 0 &&
548
+ newItems.length === 0
549
+ ? 'At least one item is required'
550
+ : '';
551
+ }
552
+ const cartItemsObj = {
553
+ unChangedItems: getCartItems(unChangedItems),
554
+ editedItems: getCartItems(editedItems),
555
+ removedItems: getCartItems(removedItems),
556
+ newItems: getCartItems(newItems),
557
+ totalSelectedItems: (0, utils_1.parseNum)(totalItemsInCart, true),
558
+ disabledReason,
559
+ isAnUpdate,
560
+ };
561
+ return cartItemsObj;
562
+ }
563
+ function getVoidItemsWithReasonWarehouseSaleOrderRfq({ currentCategories, iterationsFromFrontend, previousCategories, }) {
564
+ const voidOrderItemReasonsMap = {};
565
+ const latestIterationCategories = iterationsFromFrontend?.[0]?.categories;
566
+ if (latestIterationCategories != null && latestIterationCategories.length > 0) {
567
+ for (let i = 0; i < latestIterationCategories.length; i++) {
568
+ const category = latestIterationCategories[i];
569
+ for (let j = 0; j < category.items.length; j++) {
570
+ const item = category.items[j];
571
+ if (item.void_reason != null && item.void_reason.length > 0) {
572
+ voidOrderItemReasonsMap[item._id] = item.void_reason;
573
+ }
574
+ }
575
+ }
576
+ }
577
+ const { newItems, removedItems } = getWarehouseSaleOrderRfqCartItemsObj({
578
+ currentIterationCategories: currentCategories,
579
+ previousIterationCategories: previousCategories,
580
+ mappedItems: {},
581
+ shouldSortItemsViaId: false,
582
+ isAnEdit: true,
583
+ });
584
+ const hasNewItems = newItems.length > 0;
585
+ const voidOrderItems = [];
586
+ const newVoidOrderItemReasonsMap = {};
587
+ for (let i = 0; i < removedItems.length; i++) {
588
+ const { orderItem } = removedItems[i];
589
+ const voidReason = voidOrderItemReasonsMap[orderItem._id];
590
+ voidOrderItems.push({
591
+ ...orderItem,
592
+ subtotal: Math.round(orderItem.subtotal),
593
+ void_reason: voidReason ?? '-',
594
+ });
595
+ if (voidReason != null) {
596
+ newVoidOrderItemReasonsMap[orderItem._id] = voidReason;
597
+ }
598
+ }
599
+ const newIterationCategories = [];
600
+ for (let i = 0; i < previousCategories.length; i++) {
601
+ const category = previousCategories[i];
602
+ const newCategoryItems = [];
603
+ for (let j = 0; j < category.items.length; j++) {
604
+ const prevItem = category.items[j];
605
+ const voidReason = newVoidOrderItemReasonsMap[prevItem._id];
606
+ const orderItem = {
607
+ ...prevItem,
608
+ subtotal: Math.round(prevItem.subtotal),
609
+ };
610
+ if (voidReason != null) {
611
+ orderItem.void_reason = voidReason;
612
+ }
613
+ newCategoryItems.push(orderItem);
614
+ }
615
+ if (newCategoryItems.length === 0)
616
+ continue;
617
+ newIterationCategories.push({
618
+ ...category,
619
+ items: newCategoryItems,
620
+ });
621
+ }
622
+ return { newIterationCategories, voidOrderItems, hasNewItems };
623
+ }
@@ -18,6 +18,7 @@ export * from './order-engine';
18
18
  export * from './pra-generate-invoice';
19
19
  export * from './warehouse-purchase-order-cart-actions';
20
20
  export * from './warehouse-purchase-order-rfq-cart-actions';
21
+ export * from './warehouse-sale-order-rfq-cart-actions';
21
22
  export * from './report-webview';
22
23
  export * from './reports';
23
24
  export * from './smartpay-apis';
@@ -34,6 +34,7 @@ __exportStar(require("./order-engine"), exports);
34
34
  __exportStar(require("./pra-generate-invoice"), exports);
35
35
  __exportStar(require("./warehouse-purchase-order-cart-actions"), exports);
36
36
  __exportStar(require("./warehouse-purchase-order-rfq-cart-actions"), exports);
37
+ __exportStar(require("./warehouse-sale-order-rfq-cart-actions"), exports);
37
38
  __exportStar(require("./report-webview"), exports);
38
39
  __exportStar(require("./reports"), exports);
39
40
  __exportStar(require("./smartpay-apis"), exports);
@@ -0,0 +1,26 @@
1
+ import { IWarehouseSaleOrderRFQItem } from '../../schemas';
2
+ export interface IWarehouseGeneralSaleOrderRfqItem {
3
+ _id: string;
4
+ name: string;
5
+ category_id: string;
6
+ category_name: string;
7
+ category_image_url: string | null;
8
+ image_url: string | null;
9
+ description: string;
10
+ }
11
+ export interface IWarehouseSaleOrderRfqCartItem {
12
+ orderItem: IWarehouseSaleOrderRFQItem;
13
+ image_url: string | null;
14
+ description: string;
15
+ category_name: string;
16
+ category_id: string;
17
+ }
18
+ export interface IWarehouseSaleOrderRfqCartItemsObj {
19
+ unChangedItems: IWarehouseSaleOrderRfqCartItem[];
20
+ editedItems: IWarehouseSaleOrderRfqCartItem[];
21
+ removedItems: IWarehouseSaleOrderRfqCartItem[];
22
+ newItems: IWarehouseSaleOrderRfqCartItem[];
23
+ totalSelectedItems: number;
24
+ disabledReason: string;
25
+ isAnUpdate: boolean;
26
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,5 +1,5 @@
1
1
  import { Schema } from 'mongoose';
2
- import { WAREHOUSE_PURCHASE_ORDER_RFQ_STATUS_ENUM, WAREHOUSE_RFQ_VENDOR_STATUS_ENUM } from '../../constants';
2
+ import { WAREHOUSE_PURCHASE_ORDER_RFQ_STATUS_ENUM, WAREHOUSE_PURCHASE_ORDER_RFQ_VENDOR_STATUS_ENUM } from '../../constants';
3
3
  export declare const PurchaseOrderRFQSchema: Schema<any, import("mongoose").Model<any, any, any, any, any, any>, {}, {}, {}, {}, {
4
4
  timestamps: true;
5
5
  versionKey: false;
@@ -646,7 +646,7 @@ export declare const PurchaseOrderRFQSchema: Schema<any, import("mongoose").Mode
646
646
  vendor_name?: string | null | undefined;
647
647
  vendor_id?: import("mongoose").Types.ObjectId | null | undefined;
648
648
  requested_vendors?: Map<string, {
649
- status: WAREHOUSE_RFQ_VENDOR_STATUS_ENUM;
649
+ status: WAREHOUSE_PURCHASE_ORDER_RFQ_VENDOR_STATUS_ENUM;
650
650
  vendor_id: import("mongoose").Types.ObjectId;
651
651
  vendor_name?: string | null | undefined;
652
652
  vendor_email?: string | null | undefined;
@@ -1295,7 +1295,7 @@ export declare const PurchaseOrderRFQSchema: Schema<any, import("mongoose").Mode
1295
1295
  vendor_name?: string | null | undefined;
1296
1296
  vendor_id?: import("mongoose").Types.ObjectId | null | undefined;
1297
1297
  requested_vendors?: Map<string, {
1298
- status: WAREHOUSE_RFQ_VENDOR_STATUS_ENUM;
1298
+ status: WAREHOUSE_PURCHASE_ORDER_RFQ_VENDOR_STATUS_ENUM;
1299
1299
  vendor_id: import("mongoose").Types.ObjectId;
1300
1300
  vendor_name?: string | null | undefined;
1301
1301
  vendor_email?: string | null | undefined;
@@ -1944,7 +1944,7 @@ export declare const PurchaseOrderRFQSchema: Schema<any, import("mongoose").Mode
1944
1944
  vendor_name?: string | null | undefined;
1945
1945
  vendor_id?: import("mongoose").Types.ObjectId | null | undefined;
1946
1946
  requested_vendors?: Map<string, {
1947
- status: WAREHOUSE_RFQ_VENDOR_STATUS_ENUM;
1947
+ status: WAREHOUSE_PURCHASE_ORDER_RFQ_VENDOR_STATUS_ENUM;
1948
1948
  vendor_id: import("mongoose").Types.ObjectId;
1949
1949
  vendor_name?: string | null | undefined;
1950
1950
  vendor_email?: string | null | undefined;
@@ -123,7 +123,7 @@ const RequestedVendorEntrySchema = new mongoose_1.Schema({
123
123
  status: {
124
124
  type: String,
125
125
  enum: constants_1.ALL_WAREHOUSE_RFQ_VENDOR_STATUS_NAMES,
126
- default: constants_1.WAREHOUSE_RFQ_VENDOR_STATUS_ENUM.PENDING,
126
+ default: constants_1.WAREHOUSE_PURCHASE_ORDER_RFQ_VENDOR_STATUS_ENUM.PENDING,
127
127
  },
128
128
  }, { _id: false, minimize: false });
129
129
  const PurchaseOrderRFQIterationSchema = new mongoose_1.Schema({
@@ -1,4 +1,4 @@
1
- import { WAREHOUSE_PURCHASE_ORDER_RFQ_STATUS_ENUM, WAREHOUSE_RFQ_VENDOR_STATUS_ENUM } from '../../constants';
1
+ import { WAREHOUSE_PURCHASE_ORDER_RFQ_STATUS_ENUM, WAREHOUSE_PURCHASE_ORDER_RFQ_VENDOR_STATUS_ENUM } from '../../constants';
2
2
  import { IStaffDetails } from './orders';
3
3
  export type IWarehousePurchaseOrderRFQItem = {
4
4
  _id: string;
@@ -39,7 +39,7 @@ export interface IWarehouseRFQVendorEntry {
39
39
  vendor_name: string;
40
40
  vendor_email?: string | null;
41
41
  vendor_price?: number | null;
42
- status: WAREHOUSE_RFQ_VENDOR_STATUS_ENUM;
42
+ status: WAREHOUSE_PURCHASE_ORDER_RFQ_VENDOR_STATUS_ENUM;
43
43
  }
44
44
  export interface IWarehousePurchaseOrderRFQ extends IWarehousePurchaseOrderRFQIteration {
45
45
  _id: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@managesome/eposmatic-toolkit",
3
- "version": "0.2.444",
3
+ "version": "0.2.446",
4
4
  "description": "A Toolkit Library for Eposmatic",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",