@managesome/eposmatic-toolkit 0.2.448 → 0.2.451
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/helpers/store/common-warehouse-purchase-order-rfq-actions.js +1 -1
- package/lib/helpers/store/common-warehouse-sale-order-actions.d.ts +1 -0
- package/lib/helpers/store/common-warehouse-sale-order-actions.js +5 -0
- package/lib/helpers/store/index.d.ts +1 -1
- package/lib/helpers/store/index.js +1 -1
- package/lib/helpers/store/warehouse-purchase-order-rfq-cart-actions.d.ts +9 -9
- package/lib/helpers/store/warehouse-purchase-order-rfq-cart-actions.js +26 -26
- package/lib/helpers/store/warehouse-sale-order-rfq-cart-actions.d.ts +18 -0
- package/lib/helpers/store/warehouse-sale-order-rfq-cart-actions.js +286 -0
- package/lib/schemas/models/warehouse_sale_invoices.d.ts +1 -1
- package/lib/schemas/models/warehouse_sale_invoices.js +11 -11
- package/lib/schemas/models/warehouse_sale_orders.d.ts +1 -1
- package/lib/schemas/models/warehouse_sale_orders.js +12 -12
- package/package.json +1 -1
|
@@ -80,7 +80,7 @@ function syncWarehousePurchaseOrderRfqData(order) {
|
|
|
80
80
|
...order,
|
|
81
81
|
iterations: [],
|
|
82
82
|
};
|
|
83
|
-
const newOrder = getWarehousePurchaseOrderRfqWithPrice((0, warehouse_purchase_order_rfq_cart_actions_1.
|
|
83
|
+
const newOrder = getWarehousePurchaseOrderRfqWithPrice((0, warehouse_purchase_order_rfq_cart_actions_1.calculateCartWarehousePurchaseOrderRfqOrderInfoAndSyncData)(getWarehousePurchaseOrderRfqWithPrice(updatedOrder), true), true);
|
|
84
84
|
newOrder.iterations = order.iterations;
|
|
85
85
|
return newOrder;
|
|
86
86
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { IWarehouseSaleOrder, IWarehouseSaleOrderCategory, IWarehouseSaleOrderItem, IWarehouseSaleOrderIteration } from '../../schemas';
|
|
2
|
+
export declare function getWarehouseSaleOrdersFetchedData(data: IWarehouseSaleOrder[]): IWarehouseSaleOrder[];
|
|
2
3
|
export declare function getWarehouseSaleOrderIterationsWithPrice(iterations?: IWarehouseSaleOrderIteration[] | undefined, writeable?: boolean): IWarehouseSaleOrderIteration[];
|
|
3
4
|
export declare function getWarehouseSaleOrderItemsWithPrice(items: IWarehouseSaleOrderItem[] | undefined, convertToPrice: (price: number) => number): IWarehouseSaleOrderItem[];
|
|
4
5
|
export declare function getWarehouseSaleOrderCategoriesWithPrice(categories: IWarehouseSaleOrderCategory[] | undefined, convertToPrice: (price: number) => number): IWarehouseSaleOrderCategory[];
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getWarehouseSaleOrdersFetchedData = getWarehouseSaleOrdersFetchedData;
|
|
3
4
|
exports.getWarehouseSaleOrderIterationsWithPrice = getWarehouseSaleOrderIterationsWithPrice;
|
|
4
5
|
exports.getWarehouseSaleOrderItemsWithPrice = getWarehouseSaleOrderItemsWithPrice;
|
|
5
6
|
exports.getWarehouseSaleOrderCategoriesWithPrice = getWarehouseSaleOrderCategoriesWithPrice;
|
|
6
7
|
exports.getWarehouseSaleOrderWithPrice = getWarehouseSaleOrderWithPrice;
|
|
7
8
|
const utils_1 = require("../utils");
|
|
9
|
+
const common_order_actions_1 = require("./common-order-actions");
|
|
10
|
+
function getWarehouseSaleOrdersFetchedData(data) {
|
|
11
|
+
return data.map((order) => getWarehouseSaleOrderWithPrice(order, false)).sort(common_order_actions_1.sortByCreatedAt);
|
|
12
|
+
}
|
|
8
13
|
// ── Iterations ──────────────────────────────────────────────────
|
|
9
14
|
function getWarehouseSaleOrderIterationsWithPrice(iterations, writeable) {
|
|
10
15
|
if (!iterations)
|
|
@@ -4,7 +4,6 @@ export * from './all-warehouse-purchase-order-rfqs-actions';
|
|
|
4
4
|
export * from './all-warehouse-purchase-order-vendor-return-actions';
|
|
5
5
|
export * from './all-warehouse-purchase-orders-actions';
|
|
6
6
|
export * from './all-warehouse-sale-order-rfqs-actions';
|
|
7
|
-
export * from './all-warehouse-sale-orders-actions';
|
|
8
7
|
export * from './cart-actions';
|
|
9
8
|
export * from './catalog-actions';
|
|
10
9
|
export * from './common-order-actions';
|
|
@@ -18,3 +17,4 @@ export * from './offline-ordering';
|
|
|
18
17
|
export * from './warehouse-invoice-cart-actions';
|
|
19
18
|
export * from './warehouse-purchase-order-rfq-cart-actions';
|
|
20
19
|
export * from './warehouse-purchase-orders-cart-actions';
|
|
20
|
+
export * from './warehouse-sale-order-rfq-cart-actions';
|
|
@@ -20,7 +20,6 @@ __exportStar(require("./all-warehouse-purchase-order-rfqs-actions"), exports);
|
|
|
20
20
|
__exportStar(require("./all-warehouse-purchase-order-vendor-return-actions"), exports);
|
|
21
21
|
__exportStar(require("./all-warehouse-purchase-orders-actions"), exports);
|
|
22
22
|
__exportStar(require("./all-warehouse-sale-order-rfqs-actions"), exports);
|
|
23
|
-
__exportStar(require("./all-warehouse-sale-orders-actions"), exports);
|
|
24
23
|
__exportStar(require("./cart-actions"), exports);
|
|
25
24
|
__exportStar(require("./catalog-actions"), exports);
|
|
26
25
|
__exportStar(require("./common-order-actions"), exports);
|
|
@@ -34,3 +33,4 @@ __exportStar(require("./offline-ordering"), exports);
|
|
|
34
33
|
__exportStar(require("./warehouse-invoice-cart-actions"), exports);
|
|
35
34
|
__exportStar(require("./warehouse-purchase-order-rfq-cart-actions"), exports);
|
|
36
35
|
__exportStar(require("./warehouse-purchase-orders-cart-actions"), exports);
|
|
36
|
+
__exportStar(require("./warehouse-sale-order-rfq-cart-actions"), exports);
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { IWarehousePurchaseOrderRFQ, IWarehousePurchaseOrderRFQItem } from '../../schemas';
|
|
2
|
-
export declare function
|
|
3
|
-
export declare function
|
|
2
|
+
export declare function calculateCartWarehousePurchaseOrderRfqOrderInfoAndSyncData<T extends IWarehousePurchaseOrderRFQ | Partial<IWarehousePurchaseOrderRFQ>>(data: T, calculateItemMetadata?: boolean): T;
|
|
3
|
+
export declare function getRemoveItemFromWarehousePurchaseOrderRfqCartData(data: Partial<IWarehousePurchaseOrderRFQ>, payload: {
|
|
4
4
|
_id: string;
|
|
5
5
|
void_reason?: string;
|
|
6
6
|
}): Partial<IWarehousePurchaseOrderRFQ>;
|
|
7
|
-
export declare function
|
|
8
|
-
interface
|
|
7
|
+
export declare function getUpdateWarehousePurchaseOrderRfqCartInfoData(data: Partial<IWarehousePurchaseOrderRFQ>, payload: Partial<IWarehousePurchaseOrderRFQ>): Partial<IWarehousePurchaseOrderRFQ>;
|
|
8
|
+
interface ISetAddItemToPurchaseOrderRfqCartActionPayload {
|
|
9
9
|
name: string;
|
|
10
10
|
category_id: string;
|
|
11
11
|
item: IWarehousePurchaseOrderRFQItem;
|
|
12
12
|
replace_id?: string;
|
|
13
13
|
}
|
|
14
|
-
export declare function
|
|
15
|
-
export declare function
|
|
16
|
-
export declare function
|
|
17
|
-
export declare function
|
|
18
|
-
export declare function
|
|
14
|
+
export declare function getAddItemToWarehousePurchaseOrderRfqCartData(data: Partial<IWarehousePurchaseOrderRFQ>, payload: ISetAddItemToPurchaseOrderRfqCartActionPayload): Partial<IWarehousePurchaseOrderRFQ>;
|
|
15
|
+
export declare function getUpdateItemInWarehousePurchaseOrderRfqCartData(data: Partial<IWarehousePurchaseOrderRFQ>, payload: Partial<IWarehousePurchaseOrderRFQItem>): Partial<IWarehousePurchaseOrderRFQ>;
|
|
16
|
+
export declare function getUpdateItemsInWarehousePurchaseOrderRfqCartData(data: Partial<IWarehousePurchaseOrderRFQ>, payload: Partial<IWarehousePurchaseOrderRFQItem>[]): Partial<IWarehousePurchaseOrderRFQ>;
|
|
17
|
+
export declare function getSplitWarehousePurchaseOrderRfqCartItemToTwo(data: Partial<IWarehousePurchaseOrderRFQ>, orderItemId: string): Partial<IWarehousePurchaseOrderRFQ>;
|
|
18
|
+
export declare function getAddItemsToWarehousePurchaseOrderRfqCartData(data: Partial<IWarehousePurchaseOrderRFQ>, payload: ISetAddItemToPurchaseOrderRfqCartActionPayload[]): Partial<IWarehousePurchaseOrderRFQ>;
|
|
19
19
|
export {};
|
|
@@ -3,14 +3,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
7
|
-
exports.
|
|
8
|
-
exports.
|
|
9
|
-
exports.
|
|
10
|
-
exports.
|
|
11
|
-
exports.
|
|
12
|
-
exports.
|
|
13
|
-
exports.
|
|
6
|
+
exports.calculateCartWarehousePurchaseOrderRfqOrderInfoAndSyncData = calculateCartWarehousePurchaseOrderRfqOrderInfoAndSyncData;
|
|
7
|
+
exports.getRemoveItemFromWarehousePurchaseOrderRfqCartData = getRemoveItemFromWarehousePurchaseOrderRfqCartData;
|
|
8
|
+
exports.getUpdateWarehousePurchaseOrderRfqCartInfoData = getUpdateWarehousePurchaseOrderRfqCartInfoData;
|
|
9
|
+
exports.getAddItemToWarehousePurchaseOrderRfqCartData = getAddItemToWarehousePurchaseOrderRfqCartData;
|
|
10
|
+
exports.getUpdateItemInWarehousePurchaseOrderRfqCartData = getUpdateItemInWarehousePurchaseOrderRfqCartData;
|
|
11
|
+
exports.getUpdateItemsInWarehousePurchaseOrderRfqCartData = getUpdateItemsInWarehousePurchaseOrderRfqCartData;
|
|
12
|
+
exports.getSplitWarehousePurchaseOrderRfqCartItemToTwo = getSplitWarehousePurchaseOrderRfqCartItemToTwo;
|
|
13
|
+
exports.getAddItemsToWarehousePurchaseOrderRfqCartData = getAddItemsToWarehousePurchaseOrderRfqCartData;
|
|
14
14
|
const bson_objectid_1 = __importDefault(require("bson-objectid"));
|
|
15
15
|
const lodash_1 = require("lodash");
|
|
16
16
|
const constants_1 = require("../../constants");
|
|
@@ -20,7 +20,7 @@ const utils_1 = require("../utils");
|
|
|
20
20
|
* IWarehousePurchaseOrderRFQCategory ≡ IPurchaseOrderCategory (same type),
|
|
21
21
|
* IWarehousePurchaseOrderRFQItem ≡ IWarehousePurchaseOrderItem (same type).
|
|
22
22
|
* ================================================================= */
|
|
23
|
-
function
|
|
23
|
+
function calculateCartWarehousePurchaseOrderRfqOrderInfoAndSyncData(data, calculateItemMetadata) {
|
|
24
24
|
const isConfirmed = data.order_status === constants_1.WAREHOUSE_PURCHASE_ORDER_RFQ_STATUS_ENUM.CONFIRMED;
|
|
25
25
|
let subtotal = 0;
|
|
26
26
|
const categories = [];
|
|
@@ -106,14 +106,14 @@ function calculateCartWarehouseRfqOrderInfoAndSyncData(data, calculateItemMetada
|
|
|
106
106
|
};
|
|
107
107
|
}
|
|
108
108
|
// ── Shared ──
|
|
109
|
-
const
|
|
109
|
+
const getUpdatedPurchaseOrderRfqItem = (item) => ({
|
|
110
110
|
item_id: item.item_id,
|
|
111
111
|
name: item.name,
|
|
112
112
|
price: item.price,
|
|
113
113
|
special_instructions: item.special_instructions,
|
|
114
114
|
});
|
|
115
115
|
// ── Remove ──
|
|
116
|
-
function
|
|
116
|
+
function getRemoveItemFromWarehousePurchaseOrderRfqCartData(data, payload) {
|
|
117
117
|
const orderItemIdsMap = {};
|
|
118
118
|
let categories;
|
|
119
119
|
if (data.categories != null) {
|
|
@@ -164,17 +164,17 @@ function getRemoveItemFromWarehouseRfqCartData(data, payload) {
|
|
|
164
164
|
}
|
|
165
165
|
iterations.push({ ...firstIteration, categories: firstIterationCategories }, ...restIterations);
|
|
166
166
|
}
|
|
167
|
-
return
|
|
167
|
+
return calculateCartWarehousePurchaseOrderRfqOrderInfoAndSyncData({
|
|
168
168
|
...data,
|
|
169
169
|
...(iterations.length > 0 && { iterations }),
|
|
170
170
|
categories,
|
|
171
171
|
});
|
|
172
172
|
}
|
|
173
173
|
// ── Update Info ──
|
|
174
|
-
function
|
|
175
|
-
return
|
|
174
|
+
function getUpdateWarehousePurchaseOrderRfqCartInfoData(data, payload) {
|
|
175
|
+
return calculateCartWarehousePurchaseOrderRfqOrderInfoAndSyncData({ ...data, ...payload });
|
|
176
176
|
}
|
|
177
|
-
function
|
|
177
|
+
function getAddItemToWarehousePurchaseOrderRfqCartData(data, payload) {
|
|
178
178
|
const { category_id, name, item, replace_id } = payload;
|
|
179
179
|
let mainItemId = item._id;
|
|
180
180
|
const orderData = { ...data };
|
|
@@ -184,7 +184,7 @@ function getAddItemToWarehouseRfqCartData(data, payload) {
|
|
|
184
184
|
const category = categories[i];
|
|
185
185
|
if (category.category_id !== category_id)
|
|
186
186
|
continue;
|
|
187
|
-
const updatedItem =
|
|
187
|
+
const updatedItem = getUpdatedPurchaseOrderRfqItem(item);
|
|
188
188
|
const allItems = [...category.items];
|
|
189
189
|
let didFindItem = false;
|
|
190
190
|
let itemExists = false;
|
|
@@ -202,7 +202,7 @@ function getAddItemToWarehouseRfqCartData(data, payload) {
|
|
|
202
202
|
if (!didFindItem && itemExists) {
|
|
203
203
|
for (let j = 0; j < allItems.length; j++) {
|
|
204
204
|
const itm = allItems[j];
|
|
205
|
-
if (itm.item_id === item.item_id && (0, lodash_1.isEqual)(
|
|
205
|
+
if (itm.item_id === item.item_id && (0, lodash_1.isEqual)(getUpdatedPurchaseOrderRfqItem(itm), updatedItem)) {
|
|
206
206
|
mainItemId = replace_id ?? itm._id;
|
|
207
207
|
allItems[j] = {
|
|
208
208
|
...item,
|
|
@@ -256,14 +256,14 @@ function getAddItemToWarehouseRfqCartData(data, payload) {
|
|
|
256
256
|
}
|
|
257
257
|
iterations.push({ ...firstIteration, categories: firstIterationCategories }, ...restIterations);
|
|
258
258
|
}
|
|
259
|
-
return
|
|
259
|
+
return calculateCartWarehousePurchaseOrderRfqOrderInfoAndSyncData({
|
|
260
260
|
...orderData,
|
|
261
261
|
...(iterations.length > 0 && { iterations }),
|
|
262
262
|
categories,
|
|
263
263
|
});
|
|
264
264
|
}
|
|
265
265
|
// ── Update Item ──
|
|
266
|
-
function
|
|
266
|
+
function getUpdateItemInWarehousePurchaseOrderRfqCartData(data, payload) {
|
|
267
267
|
const orderItemIdsMap = {};
|
|
268
268
|
let categories;
|
|
269
269
|
if (data.categories != null) {
|
|
@@ -318,18 +318,18 @@ function getUpdateItemInWarehouseRfqCartData(data, payload) {
|
|
|
318
318
|
}
|
|
319
319
|
iterations.push({ ...firstIteration, categories: firstIterationCategories }, ...restIterations);
|
|
320
320
|
}
|
|
321
|
-
return
|
|
321
|
+
return calculateCartWarehousePurchaseOrderRfqOrderInfoAndSyncData({
|
|
322
322
|
...data,
|
|
323
323
|
...(iterations.length > 0 && { iterations }),
|
|
324
324
|
categories,
|
|
325
325
|
});
|
|
326
326
|
}
|
|
327
327
|
// ── Update Items (batch) ──
|
|
328
|
-
function
|
|
329
|
-
return payload.reduce((acc, item) =>
|
|
328
|
+
function getUpdateItemsInWarehousePurchaseOrderRfqCartData(data, payload) {
|
|
329
|
+
return payload.reduce((acc, item) => getUpdateItemInWarehousePurchaseOrderRfqCartData(acc, item), data);
|
|
330
330
|
}
|
|
331
331
|
// ── Split Item ──
|
|
332
|
-
function
|
|
332
|
+
function getSplitWarehousePurchaseOrderRfqCartItemToTwo(data, orderItemId) {
|
|
333
333
|
if (data.categories == null)
|
|
334
334
|
return data;
|
|
335
335
|
const newCategories = [];
|
|
@@ -362,12 +362,12 @@ function getSplitWarehouseRfqCartItemToTwo(data, orderItemId) {
|
|
|
362
362
|
}
|
|
363
363
|
newCategories.push({ ...category, items: newItems });
|
|
364
364
|
}
|
|
365
|
-
return
|
|
365
|
+
return calculateCartWarehousePurchaseOrderRfqOrderInfoAndSyncData({
|
|
366
366
|
...data,
|
|
367
367
|
categories: newCategories,
|
|
368
368
|
});
|
|
369
369
|
}
|
|
370
370
|
// ── Add Items (batch) ──
|
|
371
|
-
function
|
|
372
|
-
return payload.reduce((acc, item) =>
|
|
371
|
+
function getAddItemsToWarehousePurchaseOrderRfqCartData(data, payload) {
|
|
372
|
+
return payload.reduce((acc, item) => getAddItemToWarehousePurchaseOrderRfqCartData(acc, item), data);
|
|
373
373
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { IWarehouseSaleOrderRFQ, IWarehouseSaleOrderRFQItem } from '../../schemas';
|
|
2
|
+
export declare function getRemoveItemFromWarehouseSaleOrderRfqCartData(data: Partial<IWarehouseSaleOrderRFQ>, payload: {
|
|
3
|
+
_id: string;
|
|
4
|
+
void_reason?: string;
|
|
5
|
+
}): Partial<IWarehouseSaleOrderRFQ>;
|
|
6
|
+
export declare function getUpdateWarehouseSaleOrderRfqCartInfoData(data: Partial<IWarehouseSaleOrderRFQ>, payload: Partial<IWarehouseSaleOrderRFQ>): Partial<IWarehouseSaleOrderRFQ>;
|
|
7
|
+
interface ISetAddItemToSaleOrderRfqCartActionPayload {
|
|
8
|
+
name: string;
|
|
9
|
+
category_id: string;
|
|
10
|
+
item: IWarehouseSaleOrderRFQItem;
|
|
11
|
+
replace_id?: string;
|
|
12
|
+
}
|
|
13
|
+
export declare function getAddItemToWarehouseSaleOrderRfqCartData(data: Partial<IWarehouseSaleOrderRFQ>, payload: ISetAddItemToSaleOrderRfqCartActionPayload): Partial<IWarehouseSaleOrderRFQ>;
|
|
14
|
+
export declare function getUpdateItemInWarehouseSaleOrderRfqCartData(data: Partial<IWarehouseSaleOrderRFQ>, payload: Partial<IWarehouseSaleOrderRFQItem>): Partial<IWarehouseSaleOrderRFQ>;
|
|
15
|
+
export declare function getUpdateItemsInWarehouseSaleOrderRfqCartData(data: Partial<IWarehouseSaleOrderRFQ>, payload: Partial<IWarehouseSaleOrderRFQItem>[]): Partial<IWarehouseSaleOrderRFQ>;
|
|
16
|
+
export declare function getSplitWarehouseSaleOrderRfqCartItemToTwo(data: Partial<IWarehouseSaleOrderRFQ>, orderItemId: string): Partial<IWarehouseSaleOrderRFQ>;
|
|
17
|
+
export declare function getAddItemsToWarehouseSaleOrderRfqCartData(data: Partial<IWarehouseSaleOrderRFQ>, payload: ISetAddItemToSaleOrderRfqCartActionPayload[]): Partial<IWarehouseSaleOrderRFQ>;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,286 @@
|
|
|
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.getRemoveItemFromWarehouseSaleOrderRfqCartData = getRemoveItemFromWarehouseSaleOrderRfqCartData;
|
|
7
|
+
exports.getUpdateWarehouseSaleOrderRfqCartInfoData = getUpdateWarehouseSaleOrderRfqCartInfoData;
|
|
8
|
+
exports.getAddItemToWarehouseSaleOrderRfqCartData = getAddItemToWarehouseSaleOrderRfqCartData;
|
|
9
|
+
exports.getUpdateItemInWarehouseSaleOrderRfqCartData = getUpdateItemInWarehouseSaleOrderRfqCartData;
|
|
10
|
+
exports.getUpdateItemsInWarehouseSaleOrderRfqCartData = getUpdateItemsInWarehouseSaleOrderRfqCartData;
|
|
11
|
+
exports.getSplitWarehouseSaleOrderRfqCartItemToTwo = getSplitWarehouseSaleOrderRfqCartItemToTwo;
|
|
12
|
+
exports.getAddItemsToWarehouseSaleOrderRfqCartData = getAddItemsToWarehouseSaleOrderRfqCartData;
|
|
13
|
+
const bson_objectid_1 = __importDefault(require("bson-objectid"));
|
|
14
|
+
const lodash_1 = require("lodash");
|
|
15
|
+
const utils_1 = require("../utils");
|
|
16
|
+
const common_warehouse_sale_order_rfq_actions_1 = require("./common-warehouse-sale-order-rfq-actions");
|
|
17
|
+
/* =================================================================
|
|
18
|
+
* Sale-order RFQ cart helpers — CRUD operations for cart items.
|
|
19
|
+
* Mirrors warehouse-purchase-order-rfq-cart-actions.ts for sale RFQ types.
|
|
20
|
+
* ================================================================= */
|
|
21
|
+
// ── Shared ──
|
|
22
|
+
const getUpdatedSaleOrderRfqItem = (item) => ({
|
|
23
|
+
item_id: item.item_id,
|
|
24
|
+
name: item.name,
|
|
25
|
+
price: item.price,
|
|
26
|
+
special_instructions: item.special_instructions,
|
|
27
|
+
});
|
|
28
|
+
// ── Remove ──
|
|
29
|
+
function getRemoveItemFromWarehouseSaleOrderRfqCartData(data, payload) {
|
|
30
|
+
const orderItemIdsMap = {};
|
|
31
|
+
let categories;
|
|
32
|
+
if (data.categories != null) {
|
|
33
|
+
categories = [];
|
|
34
|
+
for (let i = 0; i < data.categories.length; i++) {
|
|
35
|
+
const category = data.categories[i];
|
|
36
|
+
const items = [];
|
|
37
|
+
for (let j = 0; j < category.items.length; j++) {
|
|
38
|
+
const item = category.items[j];
|
|
39
|
+
if (item._id !== payload._id) {
|
|
40
|
+
items.push(item);
|
|
41
|
+
orderItemIdsMap[item._id] = item.quantity;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
if (items.length > 0) {
|
|
45
|
+
categories.push({ ...category, items });
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
const iterations = [];
|
|
50
|
+
if (data.iterations != null && data.iterations.length > 0) {
|
|
51
|
+
const [firstIteration, ...restIterations] = data.iterations;
|
|
52
|
+
const firstIterationCategories = [];
|
|
53
|
+
for (let i = 0; i < firstIteration.categories.length; i++) {
|
|
54
|
+
const category = firstIteration.categories[i];
|
|
55
|
+
const allPrevItems = [];
|
|
56
|
+
for (let j = 0; j < category.items.length; j++) {
|
|
57
|
+
const prevItem = category.items[j];
|
|
58
|
+
if (prevItem._id === payload._id && payload.void_reason != null) {
|
|
59
|
+
allPrevItems.push({ ...prevItem, void_reason: payload.void_reason });
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
const currentItemQuantity = orderItemIdsMap[prevItem._id];
|
|
63
|
+
const isRemovedItem = !currentItemQuantity || currentItemQuantity < prevItem.quantity;
|
|
64
|
+
if (isRemovedItem) {
|
|
65
|
+
allPrevItems.push(prevItem);
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
const updatedPrevItem = { ...prevItem };
|
|
69
|
+
delete updatedPrevItem.void_reason;
|
|
70
|
+
allPrevItems.push(updatedPrevItem);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
if (allPrevItems.length > 0) {
|
|
75
|
+
firstIterationCategories.push({ ...category, items: allPrevItems });
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
iterations.push({ ...firstIteration, categories: firstIterationCategories }, ...restIterations);
|
|
79
|
+
}
|
|
80
|
+
return (0, common_warehouse_sale_order_rfq_actions_1.calculateCartWarehouseSaleOrderRfqOrderInfoAndSyncData)({
|
|
81
|
+
...data,
|
|
82
|
+
...(iterations.length > 0 && { iterations }),
|
|
83
|
+
categories,
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
// ── Update Info ──
|
|
87
|
+
function getUpdateWarehouseSaleOrderRfqCartInfoData(data, payload) {
|
|
88
|
+
return (0, common_warehouse_sale_order_rfq_actions_1.calculateCartWarehouseSaleOrderRfqOrderInfoAndSyncData)({ ...data, ...payload });
|
|
89
|
+
}
|
|
90
|
+
function getAddItemToWarehouseSaleOrderRfqCartData(data, payload) {
|
|
91
|
+
const { category_id, name, item, replace_id } = payload;
|
|
92
|
+
let mainItemId = item._id;
|
|
93
|
+
const orderData = { ...data };
|
|
94
|
+
const categories = [...(orderData.categories ?? [])];
|
|
95
|
+
let didFindCategory = false;
|
|
96
|
+
for (let i = 0; i < categories.length; i++) {
|
|
97
|
+
const category = categories[i];
|
|
98
|
+
if (category.category_id !== category_id)
|
|
99
|
+
continue;
|
|
100
|
+
const updatedItem = getUpdatedSaleOrderRfqItem(item);
|
|
101
|
+
const allItems = [...category.items];
|
|
102
|
+
let didFindItem = false;
|
|
103
|
+
let itemExists = false;
|
|
104
|
+
for (let j = 0; j < allItems.length; j++) {
|
|
105
|
+
const itm = allItems[j];
|
|
106
|
+
if (itm._id === item._id) {
|
|
107
|
+
allItems[j] = item;
|
|
108
|
+
didFindItem = true;
|
|
109
|
+
break;
|
|
110
|
+
}
|
|
111
|
+
if (itm.item_id === item.item_id) {
|
|
112
|
+
itemExists = true;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
if (!didFindItem && itemExists) {
|
|
116
|
+
for (let j = 0; j < allItems.length; j++) {
|
|
117
|
+
const itm = allItems[j];
|
|
118
|
+
if (itm.item_id === item.item_id && (0, lodash_1.isEqual)(getUpdatedSaleOrderRfqItem(itm), updatedItem)) {
|
|
119
|
+
mainItemId = replace_id ?? itm._id;
|
|
120
|
+
allItems[j] = {
|
|
121
|
+
...item,
|
|
122
|
+
_id: mainItemId,
|
|
123
|
+
quantity: item.quantity + itm.quantity,
|
|
124
|
+
};
|
|
125
|
+
didFindItem = true;
|
|
126
|
+
break;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
if (!didFindItem) {
|
|
131
|
+
allItems.push(item);
|
|
132
|
+
}
|
|
133
|
+
categories[i] = { ...category, items: allItems };
|
|
134
|
+
didFindCategory = true;
|
|
135
|
+
break;
|
|
136
|
+
}
|
|
137
|
+
if (!didFindCategory) {
|
|
138
|
+
categories.push({ category_id, name, items: [item] });
|
|
139
|
+
}
|
|
140
|
+
const iterations = [];
|
|
141
|
+
if (orderData.iterations != null && orderData.iterations.length > 0) {
|
|
142
|
+
const orderItemIdsMap = {};
|
|
143
|
+
for (let i = 0; i < categories.length; i++) {
|
|
144
|
+
for (let j = 0; j < categories[i].items.length; j++) {
|
|
145
|
+
orderItemIdsMap[categories[i].items[j]._id] = categories[i].items[j].quantity;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
const [firstIteration, ...restIterations] = orderData.iterations;
|
|
149
|
+
const firstIterationCategories = [];
|
|
150
|
+
for (let i = 0; i < firstIteration.categories.length; i++) {
|
|
151
|
+
const category = firstIteration.categories[i];
|
|
152
|
+
const allPrevItems = [];
|
|
153
|
+
for (let j = 0; j < category.items.length; j++) {
|
|
154
|
+
const prevItem = category.items[j];
|
|
155
|
+
const currentItemQuantity = orderItemIdsMap[prevItem._id];
|
|
156
|
+
const isRemovedItem = !currentItemQuantity || currentItemQuantity < prevItem.quantity;
|
|
157
|
+
if (isRemovedItem) {
|
|
158
|
+
allPrevItems.push(prevItem);
|
|
159
|
+
}
|
|
160
|
+
else {
|
|
161
|
+
const updatedPrevItem = { ...prevItem };
|
|
162
|
+
delete updatedPrevItem.void_reason;
|
|
163
|
+
allPrevItems.push(updatedPrevItem);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
if (allPrevItems.length > 0) {
|
|
167
|
+
firstIterationCategories.push({ ...category, items: allPrevItems });
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
iterations.push({ ...firstIteration, categories: firstIterationCategories }, ...restIterations);
|
|
171
|
+
}
|
|
172
|
+
return (0, common_warehouse_sale_order_rfq_actions_1.calculateCartWarehouseSaleOrderRfqOrderInfoAndSyncData)({
|
|
173
|
+
...orderData,
|
|
174
|
+
...(iterations.length > 0 && { iterations }),
|
|
175
|
+
categories,
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
// ── Update Item ──
|
|
179
|
+
function getUpdateItemInWarehouseSaleOrderRfqCartData(data, payload) {
|
|
180
|
+
const orderItemIdsMap = {};
|
|
181
|
+
let categories;
|
|
182
|
+
if (data.categories != null) {
|
|
183
|
+
categories = [];
|
|
184
|
+
for (let i = 0; i < data.categories.length; i++) {
|
|
185
|
+
const category = data.categories[i];
|
|
186
|
+
const items = [];
|
|
187
|
+
for (let j = 0; j < category.items.length; j++) {
|
|
188
|
+
const item = category.items[j];
|
|
189
|
+
let newItem = item;
|
|
190
|
+
if (item._id === payload._id) {
|
|
191
|
+
newItem = { ...item, ...payload };
|
|
192
|
+
}
|
|
193
|
+
if (newItem.quantity > 0) {
|
|
194
|
+
items.push(newItem);
|
|
195
|
+
orderItemIdsMap[newItem._id] = newItem.quantity;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
if (items.length > 0) {
|
|
199
|
+
categories.push({ ...category, items });
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
const iterations = [];
|
|
204
|
+
if (payload.quantity != null && data.iterations != null && data.iterations.length > 0) {
|
|
205
|
+
const [firstIteration, ...restIterations] = data.iterations;
|
|
206
|
+
const firstIterationCategories = [];
|
|
207
|
+
for (let i = 0; i < firstIteration.categories.length; i++) {
|
|
208
|
+
const category = firstIteration.categories[i];
|
|
209
|
+
const allPrevItems = [];
|
|
210
|
+
for (let j = 0; j < category.items.length; j++) {
|
|
211
|
+
const prevItem = category.items[j];
|
|
212
|
+
if (prevItem._id === payload._id && payload.void_reason != null) {
|
|
213
|
+
allPrevItems.push({ ...prevItem, void_reason: payload.void_reason });
|
|
214
|
+
}
|
|
215
|
+
else {
|
|
216
|
+
const currentItemQuantity = orderItemIdsMap[prevItem._id];
|
|
217
|
+
const isRemovedItem = !currentItemQuantity || currentItemQuantity < prevItem.quantity;
|
|
218
|
+
if (isRemovedItem) {
|
|
219
|
+
allPrevItems.push(prevItem);
|
|
220
|
+
}
|
|
221
|
+
else {
|
|
222
|
+
const updatedPrevItem = { ...prevItem };
|
|
223
|
+
delete updatedPrevItem.void_reason;
|
|
224
|
+
allPrevItems.push(updatedPrevItem);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
if (allPrevItems.length > 0) {
|
|
229
|
+
firstIterationCategories.push({ ...category, items: allPrevItems });
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
iterations.push({ ...firstIteration, categories: firstIterationCategories }, ...restIterations);
|
|
233
|
+
}
|
|
234
|
+
return (0, common_warehouse_sale_order_rfq_actions_1.calculateCartWarehouseSaleOrderRfqOrderInfoAndSyncData)({
|
|
235
|
+
...data,
|
|
236
|
+
...(iterations.length > 0 && { iterations }),
|
|
237
|
+
categories,
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
// ── Update Items (batch) ──
|
|
241
|
+
function getUpdateItemsInWarehouseSaleOrderRfqCartData(data, payload) {
|
|
242
|
+
return payload.reduce((acc, item) => getUpdateItemInWarehouseSaleOrderRfqCartData(acc, item), data);
|
|
243
|
+
}
|
|
244
|
+
// ── Split Item ──
|
|
245
|
+
function getSplitWarehouseSaleOrderRfqCartItemToTwo(data, orderItemId) {
|
|
246
|
+
if (data.categories == null)
|
|
247
|
+
return data;
|
|
248
|
+
const newCategories = [];
|
|
249
|
+
for (let i = 0; i < data.categories.length; i++) {
|
|
250
|
+
const category = data.categories[i];
|
|
251
|
+
const newItems = [];
|
|
252
|
+
for (let j = 0; j < category.items.length; j++) {
|
|
253
|
+
const item = { ...category.items[j] };
|
|
254
|
+
if (item._id !== orderItemId) {
|
|
255
|
+
newItems.push(item);
|
|
256
|
+
continue;
|
|
257
|
+
}
|
|
258
|
+
if (item.quantity === 1) {
|
|
259
|
+
newItems.push(item);
|
|
260
|
+
continue;
|
|
261
|
+
}
|
|
262
|
+
const newQuantity = item.quantity - 1;
|
|
263
|
+
newItems.push({
|
|
264
|
+
...item,
|
|
265
|
+
quantity: newQuantity,
|
|
266
|
+
subtotal: (0, utils_1.parseNum)(item.price * newQuantity),
|
|
267
|
+
});
|
|
268
|
+
const newId = new bson_objectid_1.default(Math.floor(new bson_objectid_1.default(item._id).getTimestamp().getTime() / 1000) + 1).toHexString();
|
|
269
|
+
newItems.push({
|
|
270
|
+
...item,
|
|
271
|
+
_id: newId,
|
|
272
|
+
quantity: 1,
|
|
273
|
+
subtotal: (0, utils_1.parseNum)(item.price * 1),
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
newCategories.push({ ...category, items: newItems });
|
|
277
|
+
}
|
|
278
|
+
return (0, common_warehouse_sale_order_rfq_actions_1.calculateCartWarehouseSaleOrderRfqOrderInfoAndSyncData)({
|
|
279
|
+
...data,
|
|
280
|
+
categories: newCategories,
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
// ── Add Items (batch) ──
|
|
284
|
+
function getAddItemsToWarehouseSaleOrderRfqCartData(data, payload) {
|
|
285
|
+
return payload.reduce((acc, item) => getAddItemToWarehouseSaleOrderRfqCartData(acc, item), data);
|
|
286
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Schema } from 'mongoose';
|
|
2
2
|
export declare const WAREHOUSE_SALE_INVOICE_COLLECTION_NAME = "warehouse_sale_invoices";
|
|
3
|
-
export declare const
|
|
3
|
+
export declare const WarehouseSaleOrderInvoiceSchema: Schema<any, import("mongoose").Model<any, any, any, any, any, any>, {}, {}, {}, {}, {
|
|
4
4
|
timestamps: true;
|
|
5
5
|
versionKey: false;
|
|
6
6
|
minimize: false;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.WarehouseSaleOrderInvoiceSchema = exports.WAREHOUSE_SALE_INVOICE_COLLECTION_NAME = void 0;
|
|
4
4
|
const mongoose_1 = require("mongoose");
|
|
5
5
|
const constants_1 = require("../../constants");
|
|
6
6
|
const warehouse_items_1 = require("./warehouse_items");
|
|
@@ -11,7 +11,7 @@ const ALL_WAREHOUSE_SALE_ORDER_FIN_DOC_STATUS_NAMES = Array.from(new Set([
|
|
|
11
11
|
...constants_1.ALL_WAREHOUSE_SALE_ORDER_INVOICE_PAYMENT_STATUS_NAMES,
|
|
12
12
|
...constants_1.ALL_WAREHOUSE_SALE_ORDER_CREDIT_NOTE_STATUS_NAMES,
|
|
13
13
|
]));
|
|
14
|
-
const
|
|
14
|
+
const WarehouseSaleOrderInvoiceActorSchema = new mongoose_1.Schema({
|
|
15
15
|
_id: {
|
|
16
16
|
type: String,
|
|
17
17
|
required: true,
|
|
@@ -24,7 +24,7 @@ const SaleOrderInvoiceActorSchema = new mongoose_1.Schema({
|
|
|
24
24
|
_id: false,
|
|
25
25
|
minimize: false,
|
|
26
26
|
});
|
|
27
|
-
const
|
|
27
|
+
const WarehouseSaleOrderInvoiceItemsSchema = new mongoose_1.Schema({
|
|
28
28
|
item_id: {
|
|
29
29
|
type: mongoose_1.Schema.Types.ObjectId,
|
|
30
30
|
required: true,
|
|
@@ -52,7 +52,7 @@ const SaleOrderInvoiceItemsSchema = new mongoose_1.Schema({
|
|
|
52
52
|
_id: false,
|
|
53
53
|
minimize: false,
|
|
54
54
|
});
|
|
55
|
-
exports.
|
|
55
|
+
exports.WarehouseSaleOrderInvoiceSchema = new mongoose_1.Schema({
|
|
56
56
|
_id: {
|
|
57
57
|
type: mongoose_1.Schema.Types.ObjectId,
|
|
58
58
|
required: true,
|
|
@@ -84,7 +84,7 @@ exports.SaleOrderInvoicesSchema = new mongoose_1.Schema({
|
|
|
84
84
|
ref: exports.WAREHOUSE_SALE_INVOICE_COLLECTION_NAME,
|
|
85
85
|
},
|
|
86
86
|
items: {
|
|
87
|
-
type: [
|
|
87
|
+
type: [WarehouseSaleOrderInvoiceItemsSchema],
|
|
88
88
|
default: [],
|
|
89
89
|
},
|
|
90
90
|
amount: {
|
|
@@ -135,27 +135,27 @@ exports.SaleOrderInvoicesSchema = new mongoose_1.Schema({
|
|
|
135
135
|
required: false,
|
|
136
136
|
},
|
|
137
137
|
created_by: {
|
|
138
|
-
type:
|
|
138
|
+
type: WarehouseSaleOrderInvoiceActorSchema,
|
|
139
139
|
required: false,
|
|
140
140
|
},
|
|
141
141
|
posted_by: {
|
|
142
|
-
type:
|
|
142
|
+
type: WarehouseSaleOrderInvoiceActorSchema,
|
|
143
143
|
required: false,
|
|
144
144
|
},
|
|
145
145
|
confirmed_by: {
|
|
146
|
-
type:
|
|
146
|
+
type: WarehouseSaleOrderInvoiceActorSchema,
|
|
147
147
|
required: false,
|
|
148
148
|
},
|
|
149
149
|
refund_pending_by: {
|
|
150
|
-
type:
|
|
150
|
+
type: WarehouseSaleOrderInvoiceActorSchema,
|
|
151
151
|
required: false,
|
|
152
152
|
},
|
|
153
153
|
refunded_by: {
|
|
154
|
-
type:
|
|
154
|
+
type: WarehouseSaleOrderInvoiceActorSchema,
|
|
155
155
|
required: false,
|
|
156
156
|
},
|
|
157
157
|
cancelled_by: {
|
|
158
|
-
type:
|
|
158
|
+
type: WarehouseSaleOrderInvoiceActorSchema,
|
|
159
159
|
required: false,
|
|
160
160
|
},
|
|
161
161
|
posted_at: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Schema } from 'mongoose';
|
|
2
2
|
import { WAREHOUSE_SALES_ORDER_STATUS_ENUM } from '../../constants';
|
|
3
|
-
export declare const
|
|
3
|
+
export declare const WarehouseSaleOrdersSchema: Schema<any, import("mongoose").Model<any, any, any, any, any, any>, {}, {}, {}, {}, {
|
|
4
4
|
timestamps: true;
|
|
5
5
|
versionKey: false;
|
|
6
6
|
minimize: false;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WAREHOUSE_SALE_ORDER_COLLECTION_NAME = exports.
|
|
3
|
+
exports.WAREHOUSE_SALE_ORDER_COLLECTION_NAME = exports.WarehouseSaleOrdersSchema = void 0;
|
|
4
4
|
const mongoose_1 = require("mongoose");
|
|
5
5
|
const constants_1 = require("../../constants");
|
|
6
6
|
const warehouse_categories_1 = require("./warehouse_categories");
|
|
@@ -8,7 +8,7 @@ const warehouse_clients_1 = require("./warehouse_clients");
|
|
|
8
8
|
const warehouse_items_1 = require("./warehouse_items");
|
|
9
9
|
const warehouse_sale_order_rfqs_1 = require("./warehouse_sale_order_rfqs");
|
|
10
10
|
const warehouses_1 = require("./warehouses");
|
|
11
|
-
const
|
|
11
|
+
const WarehouseSaleOrderStaffDetailsSchema = new mongoose_1.Schema({
|
|
12
12
|
staff_id: {
|
|
13
13
|
type: String,
|
|
14
14
|
required: true,
|
|
@@ -26,7 +26,7 @@ const StaffDetailsSchema = new mongoose_1.Schema({
|
|
|
26
26
|
default: null,
|
|
27
27
|
},
|
|
28
28
|
}, { _id: false, minimize: false });
|
|
29
|
-
const
|
|
29
|
+
const WarehouseSaleOrderItemsSchema = new mongoose_1.Schema({
|
|
30
30
|
_id: {
|
|
31
31
|
type: mongoose_1.Schema.Types.ObjectId,
|
|
32
32
|
required: true,
|
|
@@ -93,7 +93,7 @@ const SaleOrderItemsSchema = new mongoose_1.Schema({
|
|
|
93
93
|
_id: false,
|
|
94
94
|
minimize: false,
|
|
95
95
|
});
|
|
96
|
-
const
|
|
96
|
+
const WarehouseSaleOrderCategoriesSchema = new mongoose_1.Schema({
|
|
97
97
|
category_id: {
|
|
98
98
|
type: mongoose_1.Schema.Types.ObjectId,
|
|
99
99
|
required: true,
|
|
@@ -105,16 +105,16 @@ const SaleOrderCategoriesSchema = new mongoose_1.Schema({
|
|
|
105
105
|
required: true,
|
|
106
106
|
},
|
|
107
107
|
items: {
|
|
108
|
-
type: [
|
|
108
|
+
type: [WarehouseSaleOrderItemsSchema],
|
|
109
109
|
default: [],
|
|
110
110
|
},
|
|
111
111
|
}, {
|
|
112
112
|
_id: false,
|
|
113
113
|
minimize: false,
|
|
114
114
|
});
|
|
115
|
-
const
|
|
115
|
+
const WarehouseSaleOrderIterationSchema = new mongoose_1.Schema({
|
|
116
116
|
categories: {
|
|
117
|
-
type: [
|
|
117
|
+
type: [WarehouseSaleOrderCategoriesSchema],
|
|
118
118
|
required: true,
|
|
119
119
|
},
|
|
120
120
|
special_instructions: {
|
|
@@ -142,7 +142,7 @@ const SaleOrderIterationSchema = new mongoose_1.Schema({
|
|
|
142
142
|
required: true,
|
|
143
143
|
},
|
|
144
144
|
staff_details: {
|
|
145
|
-
type:
|
|
145
|
+
type: WarehouseSaleOrderStaffDetailsSchema,
|
|
146
146
|
required: false,
|
|
147
147
|
},
|
|
148
148
|
gst: {
|
|
@@ -172,7 +172,7 @@ const SaleOrderIterationSchema = new mongoose_1.Schema({
|
|
|
172
172
|
timestamps: false,
|
|
173
173
|
versionKey: false,
|
|
174
174
|
});
|
|
175
|
-
exports.
|
|
175
|
+
exports.WarehouseSaleOrdersSchema = new mongoose_1.Schema({
|
|
176
176
|
_id: {
|
|
177
177
|
type: mongoose_1.Schema.Types.ObjectId,
|
|
178
178
|
required: true,
|
|
@@ -198,11 +198,11 @@ exports.SaleOrdersSchema = new mongoose_1.Schema({
|
|
|
198
198
|
ref: warehouse_sale_order_rfqs_1.WAREHOUSE_SALE_ORDER_RFQ_COLLECTION_NAME,
|
|
199
199
|
},
|
|
200
200
|
categories: {
|
|
201
|
-
type: [
|
|
201
|
+
type: [WarehouseSaleOrderCategoriesSchema],
|
|
202
202
|
default: [],
|
|
203
203
|
},
|
|
204
204
|
iterations: {
|
|
205
|
-
type: [
|
|
205
|
+
type: [WarehouseSaleOrderIterationSchema],
|
|
206
206
|
default: [],
|
|
207
207
|
},
|
|
208
208
|
special_instructions: {
|
|
@@ -267,7 +267,7 @@ exports.SaleOrdersSchema = new mongoose_1.Schema({
|
|
|
267
267
|
required: false,
|
|
268
268
|
},
|
|
269
269
|
staff_details: {
|
|
270
|
-
type:
|
|
270
|
+
type: WarehouseSaleOrderStaffDetailsSchema,
|
|
271
271
|
required: true,
|
|
272
272
|
},
|
|
273
273
|
is_deleted: {
|