@managesome/eposmatic-toolkit 0.2.431 → 0.2.433
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/constants/ENUMS.d.ts +0 -289
- package/lib/constants/ENUMS.js +2 -393
- package/lib/constants/PURCHASE_ORDER.d.ts +5 -3
- package/lib/constants/PURCHASE_ORDER.js +58 -20
- package/lib/constants/WAREHOUSE_ANALYTICS.d.ts +41 -41
- package/lib/constants/WAREHOUSE_ANALYTICS.js +28 -28
- package/lib/constants/WAREHOUSE_ENUMS.d.ts +289 -0
- package/lib/constants/WAREHOUSE_ENUMS.js +392 -0
- package/lib/constants/WAREHOUSE_INVOICE.js +10 -10
- package/lib/constants/WORKER_ENDPOINTS.d.ts +63 -0
- package/lib/constants/WORKER_ENDPOINTS.js +76 -0
- package/lib/constants/index.d.ts +2 -0
- package/lib/constants/index.js +2 -0
- package/lib/helpers/order/generate-purchase-order-rfq.d.ts +3 -3
- package/lib/helpers/order/generate-purchase-order-rfq.js +2 -2
- package/lib/helpers/order/generate-purchase-order.d.ts +8 -8
- package/lib/helpers/order/generate-purchase-order.js +2 -2
- package/lib/helpers/order/generate-warehouse-purchase-order-rfq.d.ts +3 -0
- package/lib/helpers/order/generate-warehouse-purchase-order-rfq.js +64 -0
- package/lib/helpers/order/generate-warehouse-purchase-order.d.ts +11 -0
- package/lib/helpers/order/generate-warehouse-purchase-order.js +196 -0
- package/lib/helpers/order/index.d.ts +2 -2
- package/lib/helpers/order/index.js +2 -2
- package/lib/helpers/store/all-purchase-orders-actions.d.ts +7 -7
- package/lib/helpers/store/all-purchase-orders-actions.js +2 -2
- package/lib/helpers/store/all-sale-orders-actions.d.ts +2 -2
- package/lib/helpers/store/all-warehouse-purchase-orders-actions.d.ts +13 -0
- package/lib/helpers/store/all-warehouse-purchase-orders-actions.js +56 -0
- package/lib/helpers/store/all-warehouse-sale-orders-actions.d.ts +2 -0
- package/lib/helpers/store/all-warehouse-sale-orders-actions.js +8 -0
- package/lib/helpers/store/common-purchase-order-actions.d.ts +15 -15
- package/lib/helpers/store/common-sale-order-actions.d.ts +5 -5
- package/lib/helpers/store/common-warehouse-purchase-order-actions.d.ts +31 -0
- package/lib/helpers/store/common-warehouse-purchase-order-actions.js +545 -0
- package/lib/helpers/store/common-warehouse-sale-order-actions.d.ts +5 -0
- package/lib/helpers/store/common-warehouse-sale-order-actions.js +65 -0
- package/lib/helpers/store/index.d.ts +6 -6
- package/lib/helpers/store/index.js +6 -6
- package/lib/helpers/store/purchase-order-rfq-cart-actions.d.ts +11 -11
- package/lib/helpers/store/purchase-order-rfq-cart-actions.js +3 -3
- package/lib/helpers/store/purchase-orders-cart-actions.d.ts +18 -18
- package/lib/helpers/store/purchase-orders-cart-actions.js +1 -1
- package/lib/helpers/store/warehouse-purchase-order-rfq-cart-actions.d.ts +19 -0
- package/lib/helpers/store/warehouse-purchase-order-rfq-cart-actions.js +373 -0
- package/lib/helpers/store/warehouse-purchase-orders-cart-actions.d.ts +57 -0
- package/lib/helpers/store/warehouse-purchase-orders-cart-actions.js +486 -0
- package/lib/helpers/types/index.d.ts +1 -1
- package/lib/helpers/types/index.js +1 -1
- package/lib/helpers/types/purchase-order-cart-actions.d.ts +2 -2
- package/lib/helpers/types/warehouse-purchase-order-cart-actions.d.ts +26 -0
- package/lib/helpers/types/warehouse-purchase-order-cart-actions.js +2 -0
- package/lib/helpers/types/workers.d.ts +39 -32
- package/lib/helpers/utils/index.d.ts +8 -8
- package/lib/helpers/utils/index.js +8 -11
- package/lib/helpers/utils/invoice-x-report-helpers.d.ts +2 -2
- package/lib/helpers/utils/invoice-x-report-helpers.js +14 -14
- package/lib/helpers/utils/purchase-order-engine.d.ts +4 -4
- package/lib/helpers/utils/purchase-order-receipt-engine.d.ts +5 -5
- package/lib/helpers/utils/purchase-order-receipt-engine.js +2 -2
- package/lib/helpers/utils/purchase-order-x-report-helpers.js +2 -2
- package/lib/helpers/utils/sale-x-report-helpers.js +2 -2
- package/lib/helpers/utils/void-purchase-order-items-helpers.d.ts +3 -3
- package/lib/helpers/utils/void-purchase-order-items-report-helpers.d.ts +2 -2
- package/lib/helpers/utils/void-warehouse-invoice-items-helpers.d.ts +3 -3
- package/lib/helpers/utils/void-warehouse-invoice-items-helpers.js +2 -2
- package/lib/helpers/utils/void-warehouse-invoice-items-report-helpers.d.ts +5 -5
- package/lib/helpers/utils/warehouse-catalog-conversion.d.ts +3 -3
- package/lib/helpers/utils/warehouse-catalog-conversion.js +9 -7
- package/lib/helpers/utils/warehouse-invoice-order-engine.js +1 -1
- package/lib/helpers/utils/warehouse-invoice-x-report-helpers.d.ts +58 -0
- package/lib/helpers/utils/warehouse-invoice-x-report-helpers.js +1432 -0
- package/lib/helpers/utils/warehouse-purchase-order-engine.d.ts +9 -0
- package/lib/helpers/utils/warehouse-purchase-order-engine.js +34 -0
- package/lib/helpers/utils/warehouse-purchase-order-receipt-engine.d.ts +149 -0
- package/lib/helpers/utils/warehouse-purchase-order-receipt-engine.js +214 -0
- package/lib/helpers/utils/warehouse-purchase-order-x-report-helpers.d.ts +58 -0
- package/lib/helpers/utils/warehouse-purchase-order-x-report-helpers.js +1440 -0
- package/lib/helpers/utils/warehouse-sale-order-x-report-helpers.d.ts +30 -0
- package/lib/helpers/utils/warehouse-sale-order-x-report-helpers.js +2 -0
- package/lib/helpers/utils/warehouse-sale-x-report-helpers.d.ts +58 -0
- package/lib/helpers/utils/warehouse-sale-x-report-helpers.js +1456 -0
- package/lib/helpers/utils/warehouse-void-purchase-order-items-helpers.d.ts +3 -0
- package/lib/helpers/utils/warehouse-void-purchase-order-items-helpers.js +38 -0
- package/lib/helpers/utils/warehouse-void-purchase-order-items-report-helpers.d.ts +13 -0
- package/lib/helpers/utils/warehouse-void-purchase-order-items-report-helpers.js +22 -0
- package/lib/schemas/models/gift_cards.d.ts +108 -108
- package/lib/schemas/models/halfhalf_setup.d.ts +3 -3
- package/lib/schemas/models/index.d.ts +7 -7
- package/lib/schemas/models/index.js +7 -7
- package/lib/schemas/models/internal_invoices.d.ts +6 -6
- package/lib/schemas/models/inventory_lot_serial_numbers.d.ts +6 -6
- package/lib/schemas/models/inventory_transactions.d.ts +3 -3
- package/lib/schemas/models/item_transactions.d.ts +6 -6
- package/lib/schemas/models/offers.d.ts +146 -146
- package/lib/schemas/models/orders.d.ts +2573 -2573
- package/lib/schemas/models/printer_settings.d.ts +12 -12
- package/lib/schemas/models/reservations.d.ts +6 -6
- package/lib/schemas/models/rewards_usage.d.ts +6 -6
- package/lib/schemas/models/riders.d.ts +3 -3
- package/lib/schemas/models/tenants.d.ts +135 -135
- package/lib/schemas/models/void_order_items.d.ts +15 -15
- package/lib/schemas/models/void_warehouse_invoice_items.d.ts +25 -25
- package/lib/schemas/models/void_warehouse_invoice_items.js +2 -2
- package/lib/schemas/models/vouchers.d.ts +9 -9
- package/lib/schemas/models/warehouse-activity-logs.d.ts +13 -13
- package/lib/schemas/models/warehouse-activity-logs.js +4 -4
- package/lib/schemas/models/warehouse_categories.d.ts +4 -4
- package/lib/schemas/models/warehouse_categories.js +2 -2
- package/lib/schemas/models/warehouse_communications.d.ts +21 -21
- package/lib/schemas/models/warehouse_internal_movements.d.ts +33 -33
- package/lib/schemas/models/warehouse_internal_movements.js +8 -8
- package/lib/schemas/models/warehouse_inventory_lot_serial_numbers.d.ts +154 -0
- package/lib/schemas/models/warehouse_inventory_lot_serial_numbers.js +193 -0
- package/lib/schemas/models/warehouse_inventory_transactions.d.ts +6 -6
- package/lib/schemas/models/warehouse_invoices.d.ts +351 -351
- package/lib/schemas/models/warehouse_item_transactions.d.ts +9 -9
- package/lib/schemas/models/warehouse_items.d.ts +13 -13
- package/lib/schemas/models/warehouse_items.js +2 -2
- package/lib/schemas/models/warehouse_operational_roles.d.ts +3 -3
- package/lib/schemas/models/warehouse_purchase_order_receipts.d.ts +165 -0
- package/lib/schemas/models/warehouse_purchase_order_receipts.js +151 -0
- package/lib/schemas/models/warehouse_purchase_order_rfqs.d.ts +1959 -0
- package/lib/schemas/models/warehouse_purchase_order_rfqs.js +328 -0
- package/lib/schemas/models/warehouse_purchase_order_vendor_returns.d.ts +234 -0
- package/lib/schemas/models/warehouse_purchase_order_vendor_returns.js +188 -0
- package/lib/schemas/models/warehouse_purchase_orders.d.ts +2678 -0
- package/lib/schemas/models/warehouse_purchase_orders.js +336 -0
- package/lib/schemas/models/warehouse_sale_deliveries.d.ts +15 -15
- package/lib/schemas/models/warehouse_sale_deliveries.js +7 -4
- package/lib/schemas/models/warehouse_sale_invoices.d.ts +30 -30
- package/lib/schemas/models/warehouse_sale_invoices.js +8 -5
- package/lib/schemas/models/warehouse_sale_order_rfqs.d.ts +362 -362
- package/lib/schemas/models/warehouse_sale_order_rfqs.js +5 -5
- package/lib/schemas/models/warehouse_sale_orders.d.ts +367 -367
- package/lib/schemas/models/warehouse_sale_orders.js +5 -5
- package/lib/schemas/models/warehouse_void_invoice_items.d.ts +176 -0
- package/lib/schemas/models/warehouse_void_invoice_items.js +176 -0
- package/lib/schemas/models/warehouse_void_purchase_order_items.d.ts +176 -0
- package/lib/schemas/models/warehouse_void_purchase_order_items.js +177 -0
- package/lib/schemas/models/warehouses.d.ts +52 -52
- package/lib/schemas/models/warehouses.js +2 -2
- package/lib/schemas/types/index.d.ts +9 -9
- package/lib/schemas/types/index.js +9 -9
- package/lib/schemas/types/inventory_lot_serial_numbers.d.ts +5 -5
- package/lib/schemas/types/warehouse-activity-logs.d.ts +7 -7
- package/lib/schemas/types/warehouse_categories.d.ts +2 -2
- package/lib/schemas/types/warehouse_internal_movements.d.ts +9 -9
- package/lib/schemas/types/warehouse_inventory_lot_serial_numbers.d.ts +85 -0
- package/lib/schemas/types/warehouse_inventory_lot_serial_numbers.js +4 -0
- package/lib/schemas/types/warehouse_items.d.ts +2 -2
- package/lib/schemas/types/warehouse_purchase_order_common.d.ts +39 -0
- package/lib/schemas/types/warehouse_purchase_order_common.js +2 -0
- package/lib/schemas/types/warehouse_purchase_order_receipts.d.ts +39 -0
- package/lib/schemas/types/warehouse_purchase_order_receipts.js +21 -0
- package/lib/schemas/types/warehouse_purchase_order_rfqs.d.ts +33 -0
- package/lib/schemas/types/warehouse_purchase_order_rfqs.js +2 -0
- package/lib/schemas/types/warehouse_purchase_order_vendor_returns.d.ts +48 -0
- package/lib/schemas/types/warehouse_purchase_order_vendor_returns.js +2 -0
- package/lib/schemas/types/warehouse_purchase_orders.d.ts +33 -0
- package/lib/schemas/types/warehouse_purchase_orders.js +2 -0
- package/lib/schemas/types/warehouse_sale_deliveries.d.ts +29 -29
- package/lib/schemas/types/warehouse_sale_invoices.d.ts +17 -17
- package/lib/schemas/types/warehouse_sale_order_common.d.ts +39 -0
- package/lib/schemas/types/warehouse_sale_order_common.js +2 -0
- package/lib/schemas/types/warehouse_sale_order_rfqs.d.ts +7 -7
- package/lib/schemas/types/warehouse_sale_orders.d.ts +7 -7
- package/lib/schemas/types/warehouse_void_invoice_items.d.ts +37 -0
- package/lib/schemas/types/warehouse_void_invoice_items.js +2 -0
- package/lib/schemas/types/warehouse_void_purchase_order_items.d.ts +37 -0
- package/lib/schemas/types/warehouse_void_purchase_order_items.js +2 -0
- package/lib/schemas/types/warehouses.d.ts +2 -2
- package/package.json +1 -1
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function calculateCartRfqOrderInfoAndSyncData<T extends
|
|
3
|
-
export declare function getRemoveItemFromRfqCartData(data: Partial<
|
|
1
|
+
import { WarehouseIPurchaseOrderRFQ, WarehouseIPurchaseOrderRFQItem } from '../../schemas';
|
|
2
|
+
export declare function calculateCartRfqOrderInfoAndSyncData<T extends WarehouseIPurchaseOrderRFQ | Partial<WarehouseIPurchaseOrderRFQ>>(data: T, calculateItemMetadata?: boolean): T;
|
|
3
|
+
export declare function getRemoveItemFromRfqCartData(data: Partial<WarehouseIPurchaseOrderRFQ>, payload: {
|
|
4
4
|
_id: string;
|
|
5
5
|
void_reason?: string;
|
|
6
|
-
}): Partial<
|
|
7
|
-
export declare function getUpdateRfqCartInfoData(data: Partial<
|
|
6
|
+
}): Partial<WarehouseIPurchaseOrderRFQ>;
|
|
7
|
+
export declare function getUpdateRfqCartInfoData(data: Partial<WarehouseIPurchaseOrderRFQ>, payload: Partial<WarehouseIPurchaseOrderRFQ>): Partial<WarehouseIPurchaseOrderRFQ>;
|
|
8
8
|
interface ISetAddItemToRfqCartActionPayload {
|
|
9
9
|
name: string;
|
|
10
10
|
category_id: string;
|
|
11
|
-
item:
|
|
11
|
+
item: WarehouseIPurchaseOrderRFQItem;
|
|
12
12
|
replace_id?: string;
|
|
13
13
|
}
|
|
14
|
-
export declare function getAddItemToRfqCartData(data: Partial<
|
|
15
|
-
export declare function getUpdateItemInRfqCartData(data: Partial<
|
|
16
|
-
export declare function getUpdateItemsInRfqCartData(data: Partial<
|
|
17
|
-
export declare function getSplitRfqCartItemToTwo(data: Partial<
|
|
18
|
-
export declare function getAddItemsToRfqCartData(data: Partial<
|
|
14
|
+
export declare function getAddItemToRfqCartData(data: Partial<WarehouseIPurchaseOrderRFQ>, payload: ISetAddItemToRfqCartActionPayload): Partial<WarehouseIPurchaseOrderRFQ>;
|
|
15
|
+
export declare function getUpdateItemInRfqCartData(data: Partial<WarehouseIPurchaseOrderRFQ>, payload: Partial<WarehouseIPurchaseOrderRFQItem>): Partial<WarehouseIPurchaseOrderRFQ>;
|
|
16
|
+
export declare function getUpdateItemsInRfqCartData(data: Partial<WarehouseIPurchaseOrderRFQ>, payload: Partial<WarehouseIPurchaseOrderRFQItem>[]): Partial<WarehouseIPurchaseOrderRFQ>;
|
|
17
|
+
export declare function getSplitRfqCartItemToTwo(data: Partial<WarehouseIPurchaseOrderRFQ>, orderItemId: string): Partial<WarehouseIPurchaseOrderRFQ>;
|
|
18
|
+
export declare function getAddItemsToRfqCartData(data: Partial<WarehouseIPurchaseOrderRFQ>, payload: ISetAddItemToRfqCartActionPayload[]): Partial<WarehouseIPurchaseOrderRFQ>;
|
|
19
19
|
export {};
|
|
@@ -17,11 +17,11 @@ const constants_1 = require("../../constants");
|
|
|
17
17
|
const utils_1 = require("../utils");
|
|
18
18
|
/* =================================================================
|
|
19
19
|
* RFQ cart helpers — fully typed, no delegation to PO functions.
|
|
20
|
-
*
|
|
21
|
-
*
|
|
20
|
+
* WarehouseIPurchaseOrderRFQCategory ≡ IPurchaseOrderCategory (same type),
|
|
21
|
+
* WarehouseIPurchaseOrderRFQItem ≡ WarehouseIPurchaseOrderItem (same type).
|
|
22
22
|
* ================================================================= */
|
|
23
23
|
function calculateCartRfqOrderInfoAndSyncData(data, calculateItemMetadata) {
|
|
24
|
-
const isConfirmed = data.order_status === constants_1.
|
|
24
|
+
const isConfirmed = data.order_status === constants_1.WAREHOUSE_PURCHASE_ORDER_RFQ_STATUS_ENUM.CONFIRMED;
|
|
25
25
|
let subtotal = 0;
|
|
26
26
|
const categories = [];
|
|
27
27
|
const length = data.categories?.length ?? 0;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
export declare function calculateCartPurchaseOrderInfoAndSyncData<T extends
|
|
4
|
-
export declare const getPurchaseOrderItemComaparableData: (item:
|
|
5
|
-
export declare function getUpdatedPurchaseOrderCartInfoOnInit(data: Partial<
|
|
1
|
+
import { WAREHOUSE_PURCHASE_ORDER_STATUS_ENUM } from '../../constants';
|
|
2
|
+
import { WarehouseIPurchaseOrder, WarehouseIPurchaseOrderItem, WarehouseIPurchaseOrderIteration } from '../../schemas';
|
|
3
|
+
export declare function calculateCartPurchaseOrderInfoAndSyncData<T extends WarehouseIPurchaseOrder | Partial<WarehouseIPurchaseOrder>>(data: T, calculateItemMetadata?: boolean): T;
|
|
4
|
+
export declare const getPurchaseOrderItemComaparableData: (item: WarehouseIPurchaseOrderItem) => Partial<WarehouseIPurchaseOrderItem>;
|
|
5
|
+
export declare function getUpdatedPurchaseOrderCartInfoOnInit(data: Partial<WarehouseIPurchaseOrder>, order: Partial<WarehouseIPurchaseOrder>): {
|
|
6
6
|
_id?: string | undefined;
|
|
7
7
|
warehouse_id?: string | undefined;
|
|
8
8
|
vendor_id?: string | undefined;
|
|
9
9
|
vendor_name?: string | undefined;
|
|
10
10
|
rfq_id?: string | null;
|
|
11
|
-
iterations?:
|
|
11
|
+
iterations?: WarehouseIPurchaseOrderIteration[] | undefined;
|
|
12
12
|
amount_collected?: number | undefined;
|
|
13
13
|
order_number?: number | null | undefined;
|
|
14
14
|
delete_reason?: string | null;
|
|
@@ -23,7 +23,7 @@ export declare function getUpdatedPurchaseOrderCartInfoOnInit(data: Partial<IPur
|
|
|
23
23
|
createdAt?: Date | undefined;
|
|
24
24
|
payments?: import("../../schemas").IOrderPayment[] | undefined;
|
|
25
25
|
tax_number?: string | undefined;
|
|
26
|
-
categories?: import("../../schemas").
|
|
26
|
+
categories?: import("../../schemas").WarehouseIPurchaseOrderCommonCategoryByCategoryId[] | undefined;
|
|
27
27
|
staff_details?: import("../../schemas").IStaffDetails | undefined;
|
|
28
28
|
is_gst_inclusive?: boolean;
|
|
29
29
|
gst?: number | null;
|
|
@@ -32,26 +32,26 @@ export declare function getUpdatedPurchaseOrderCartInfoOnInit(data: Partial<IPur
|
|
|
32
32
|
price?: number | undefined;
|
|
33
33
|
amount_earned?: number | undefined;
|
|
34
34
|
grand_total?: number | undefined;
|
|
35
|
-
order_status?:
|
|
35
|
+
order_status?: WAREHOUSE_PURCHASE_ORDER_STATUS_ENUM | undefined;
|
|
36
36
|
updatedAt?: Date | undefined;
|
|
37
37
|
};
|
|
38
|
-
export declare function getRemoveItemFromPurchaseOrderCartData(data: Partial<
|
|
38
|
+
export declare function getRemoveItemFromPurchaseOrderCartData(data: Partial<WarehouseIPurchaseOrder>, payload: {
|
|
39
39
|
_id: string;
|
|
40
40
|
void_reason?: string;
|
|
41
|
-
}): Partial<
|
|
42
|
-
export declare function getUpdatePurchaseOrderCartInfoData(data: Partial<
|
|
41
|
+
}): Partial<WarehouseIPurchaseOrder>;
|
|
42
|
+
export declare function getUpdatePurchaseOrderCartInfoData(data: Partial<WarehouseIPurchaseOrder>, payload: Partial<WarehouseIPurchaseOrder>): Partial<WarehouseIPurchaseOrder>;
|
|
43
43
|
export interface ISetAddItemToPurchaseOrderCartActionPayload {
|
|
44
44
|
name: string;
|
|
45
45
|
category_id: string;
|
|
46
|
-
item:
|
|
46
|
+
item: WarehouseIPurchaseOrderItem;
|
|
47
47
|
replace_id?: string;
|
|
48
48
|
}
|
|
49
|
-
export declare function getAddItemToPurchaseOrderCartData(data: Partial<
|
|
50
|
-
export declare function getUpdateItemInPurchaseOrderCartData(data: Partial<
|
|
51
|
-
export declare function getUpdateItemsInPurchaseOrderCartData(data: Partial<
|
|
49
|
+
export declare function getAddItemToPurchaseOrderCartData(data: Partial<WarehouseIPurchaseOrder>, payload: ISetAddItemToPurchaseOrderCartActionPayload): Partial<WarehouseIPurchaseOrder>;
|
|
50
|
+
export declare function getUpdateItemInPurchaseOrderCartData(data: Partial<WarehouseIPurchaseOrder>, payload: Partial<WarehouseIPurchaseOrderItem>): Partial<WarehouseIPurchaseOrder>;
|
|
51
|
+
export declare function getUpdateItemsInPurchaseOrderCartData(data: Partial<WarehouseIPurchaseOrder>, payload: Partial<WarehouseIPurchaseOrderItem>[]): Partial<WarehouseIPurchaseOrder>;
|
|
52
52
|
export interface IGetSplitPurchaseOrderCartItemToTwo {
|
|
53
|
-
data: Partial<
|
|
53
|
+
data: Partial<WarehouseIPurchaseOrder>;
|
|
54
54
|
orderItemId: string;
|
|
55
55
|
}
|
|
56
|
-
export declare function getSplitPurchaseOrderCartItemToTwo({ data, orderItemId, }: IGetSplitPurchaseOrderCartItemToTwo): Partial<
|
|
57
|
-
export declare function getAddItemsToPurchaseOrderCartData(data: Partial<
|
|
56
|
+
export declare function getSplitPurchaseOrderCartItemToTwo({ data, orderItemId, }: IGetSplitPurchaseOrderCartItemToTwo): Partial<WarehouseIPurchaseOrder>;
|
|
57
|
+
export declare function getAddItemsToPurchaseOrderCartData(data: Partial<WarehouseIPurchaseOrder>, payload: ISetAddItemToPurchaseOrderCartActionPayload[]): Partial<WarehouseIPurchaseOrder>;
|
|
@@ -18,7 +18,7 @@ const lodash_1 = require("lodash");
|
|
|
18
18
|
const constants_1 = require("../../constants");
|
|
19
19
|
const utils_1 = require("../utils");
|
|
20
20
|
function calculateCartPurchaseOrderInfoAndSyncData(data, calculateItemMetadata) {
|
|
21
|
-
const isCompleted = data.order_status === constants_1.
|
|
21
|
+
const isCompleted = data.order_status === constants_1.WAREHOUSE_PURCHASE_ORDER_STATUS_ENUM.COMPLETED;
|
|
22
22
|
/* ===============================><=============================== */
|
|
23
23
|
let subtotal = 0;
|
|
24
24
|
const categories = [];
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { IWarehousePurchaseOrderRFQ, IWarehousePurchaseOrderRFQItem } from '../../schemas';
|
|
2
|
+
export declare function calculateCartWarehouseRfqOrderInfoAndSyncData<T extends IWarehousePurchaseOrderRFQ | Partial<IWarehousePurchaseOrderRFQ>>(data: T, calculateItemMetadata?: boolean): T;
|
|
3
|
+
export declare function getRemoveItemFromWarehouseRfqCartData(data: Partial<IWarehousePurchaseOrderRFQ>, payload: {
|
|
4
|
+
_id: string;
|
|
5
|
+
void_reason?: string;
|
|
6
|
+
}): Partial<IWarehousePurchaseOrderRFQ>;
|
|
7
|
+
export declare function getUpdateWarehouseRfqCartInfoData(data: Partial<IWarehousePurchaseOrderRFQ>, payload: Partial<IWarehousePurchaseOrderRFQ>): Partial<IWarehousePurchaseOrderRFQ>;
|
|
8
|
+
interface ISetAddItemToRfqCartActionPayload {
|
|
9
|
+
name: string;
|
|
10
|
+
category_id: string;
|
|
11
|
+
item: IWarehousePurchaseOrderRFQItem;
|
|
12
|
+
replace_id?: string;
|
|
13
|
+
}
|
|
14
|
+
export declare function getAddItemToWarehouseRfqCartData(data: Partial<IWarehousePurchaseOrderRFQ>, payload: ISetAddItemToRfqCartActionPayload): Partial<IWarehousePurchaseOrderRFQ>;
|
|
15
|
+
export declare function getUpdateItemInWarehouseRfqCartData(data: Partial<IWarehousePurchaseOrderRFQ>, payload: Partial<IWarehousePurchaseOrderRFQItem>): Partial<IWarehousePurchaseOrderRFQ>;
|
|
16
|
+
export declare function getUpdateItemsInWarehouseRfqCartData(data: Partial<IWarehousePurchaseOrderRFQ>, payload: Partial<IWarehousePurchaseOrderRFQItem>[]): Partial<IWarehousePurchaseOrderRFQ>;
|
|
17
|
+
export declare function getSplitWarehouseRfqCartItemToTwo(data: Partial<IWarehousePurchaseOrderRFQ>, orderItemId: string): Partial<IWarehousePurchaseOrderRFQ>;
|
|
18
|
+
export declare function getAddItemsToWarehouseRfqCartData(data: Partial<IWarehousePurchaseOrderRFQ>, payload: ISetAddItemToRfqCartActionPayload[]): Partial<IWarehousePurchaseOrderRFQ>;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,373 @@
|
|
|
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.calculateCartWarehouseRfqOrderInfoAndSyncData = calculateCartWarehouseRfqOrderInfoAndSyncData;
|
|
7
|
+
exports.getRemoveItemFromWarehouseRfqCartData = getRemoveItemFromWarehouseRfqCartData;
|
|
8
|
+
exports.getUpdateWarehouseRfqCartInfoData = getUpdateWarehouseRfqCartInfoData;
|
|
9
|
+
exports.getAddItemToWarehouseRfqCartData = getAddItemToWarehouseRfqCartData;
|
|
10
|
+
exports.getUpdateItemInWarehouseRfqCartData = getUpdateItemInWarehouseRfqCartData;
|
|
11
|
+
exports.getUpdateItemsInWarehouseRfqCartData = getUpdateItemsInWarehouseRfqCartData;
|
|
12
|
+
exports.getSplitWarehouseRfqCartItemToTwo = getSplitWarehouseRfqCartItemToTwo;
|
|
13
|
+
exports.getAddItemsToWarehouseRfqCartData = getAddItemsToWarehouseRfqCartData;
|
|
14
|
+
const bson_objectid_1 = __importDefault(require("bson-objectid"));
|
|
15
|
+
const lodash_1 = require("lodash");
|
|
16
|
+
const constants_1 = require("../../constants");
|
|
17
|
+
const utils_1 = require("../utils");
|
|
18
|
+
/* =================================================================
|
|
19
|
+
* RFQ cart helpers — fully typed, no delegation to PO functions.
|
|
20
|
+
* IWarehousePurchaseOrderRFQCategory ≡ IPurchaseOrderCategory (same type),
|
|
21
|
+
* IWarehousePurchaseOrderRFQItem ≡ IWarehousePurchaseOrderItem (same type).
|
|
22
|
+
* ================================================================= */
|
|
23
|
+
function calculateCartWarehouseRfqOrderInfoAndSyncData(data, calculateItemMetadata) {
|
|
24
|
+
const isConfirmed = data.order_status === constants_1.WAREHOUSE_PURCHASE_ORDER_RFQ_STATUS_ENUM.CONFIRMED;
|
|
25
|
+
let subtotal = 0;
|
|
26
|
+
const categories = [];
|
|
27
|
+
const length = data.categories?.length ?? 0;
|
|
28
|
+
for (let c = 0; c < length; c++) {
|
|
29
|
+
const category = data.categories[c];
|
|
30
|
+
const newItems = [];
|
|
31
|
+
const itemsLength = category.items.length;
|
|
32
|
+
for (let i = 0; i < itemsLength; i++) {
|
|
33
|
+
const item = category.items[i];
|
|
34
|
+
const itemSubtotal = (0, utils_1.parseNum)(item.price * item.quantity);
|
|
35
|
+
const newItem = {
|
|
36
|
+
...item,
|
|
37
|
+
is_ready: item.is_ready || isConfirmed,
|
|
38
|
+
subtotal: itemSubtotal,
|
|
39
|
+
_discount_amount: 0,
|
|
40
|
+
_gross_amount: 0,
|
|
41
|
+
_gst_amount: 0,
|
|
42
|
+
_net_amount: 0,
|
|
43
|
+
};
|
|
44
|
+
delete newItem.void_reason;
|
|
45
|
+
newItems.push(newItem);
|
|
46
|
+
subtotal += itemSubtotal;
|
|
47
|
+
}
|
|
48
|
+
categories.push({ ...category, items: newItems });
|
|
49
|
+
}
|
|
50
|
+
let grand_total = subtotal;
|
|
51
|
+
let gst_amount = 0;
|
|
52
|
+
const gst = data.gst ?? 0;
|
|
53
|
+
if (data.is_gst_inclusive) {
|
|
54
|
+
gst_amount = (0, utils_1.parseFloatCeil)((grand_total * gst) / (100 + gst));
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
gst_amount = (0, utils_1.getPercentageAmount)(grand_total, gst);
|
|
58
|
+
grand_total += gst_amount;
|
|
59
|
+
}
|
|
60
|
+
grand_total = (0, utils_1.parseNum)(grand_total);
|
|
61
|
+
const amount_earned = (0, utils_1.parseNum)(grand_total);
|
|
62
|
+
if (calculateItemMetadata) {
|
|
63
|
+
let leftGrossAmount = subtotal;
|
|
64
|
+
let leftNetAmount = subtotal;
|
|
65
|
+
let leftDiscountAmount = 0;
|
|
66
|
+
let leftGstAmount = gst_amount;
|
|
67
|
+
categories.forEach((category, categoryIndex) => {
|
|
68
|
+
const isLastCategory = categoryIndex === categories.length - 1;
|
|
69
|
+
category.items.forEach((item, itemIndex) => {
|
|
70
|
+
const isLastItem = isLastCategory && itemIndex === category.items.length - 1;
|
|
71
|
+
let grossAmount = item.subtotal;
|
|
72
|
+
let netAmount = item.subtotal;
|
|
73
|
+
let itemTotalDiscountAmount = 0;
|
|
74
|
+
let itemGst = 0;
|
|
75
|
+
if (gst_amount > 0) {
|
|
76
|
+
itemGst = (item.subtotal / subtotal) * gst_amount;
|
|
77
|
+
}
|
|
78
|
+
grossAmount = (0, utils_1.parseFloatCeil)(grossAmount);
|
|
79
|
+
const netAmountParsed = (0, utils_1.parseFloatCeil)(netAmount);
|
|
80
|
+
const itemTotalDiscountAmountParsed = (0, utils_1.parseFloatCeil)(itemTotalDiscountAmount);
|
|
81
|
+
itemGst = (0, utils_1.parseFloatCeil)(itemGst);
|
|
82
|
+
leftGrossAmount -= grossAmount;
|
|
83
|
+
leftNetAmount -= netAmountParsed;
|
|
84
|
+
leftDiscountAmount -= itemTotalDiscountAmountParsed;
|
|
85
|
+
leftGstAmount -= itemGst;
|
|
86
|
+
if (isLastItem) {
|
|
87
|
+
grossAmount += leftGrossAmount;
|
|
88
|
+
netAmount += leftNetAmount;
|
|
89
|
+
itemTotalDiscountAmount += leftDiscountAmount;
|
|
90
|
+
itemGst += leftGstAmount;
|
|
91
|
+
}
|
|
92
|
+
item._gross_amount = Math.max(grossAmount, 0);
|
|
93
|
+
item._net_amount = Math.max(netAmount, 0);
|
|
94
|
+
item._discount_amount = Math.max(itemTotalDiscountAmount, 0);
|
|
95
|
+
item._gst_amount = Math.max(itemGst, 0);
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
return {
|
|
100
|
+
...data,
|
|
101
|
+
categories,
|
|
102
|
+
amount_earned,
|
|
103
|
+
gst_amount,
|
|
104
|
+
price: (0, utils_1.parseNum)(subtotal),
|
|
105
|
+
grand_total,
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
// ── Shared ──
|
|
109
|
+
const getUpdatedRfqItem = (item) => ({
|
|
110
|
+
item_id: item.item_id,
|
|
111
|
+
name: item.name,
|
|
112
|
+
price: item.price,
|
|
113
|
+
special_instructions: item.special_instructions,
|
|
114
|
+
});
|
|
115
|
+
// ── Remove ──
|
|
116
|
+
function getRemoveItemFromWarehouseRfqCartData(data, payload) {
|
|
117
|
+
const orderItemIdsMap = {};
|
|
118
|
+
let categories;
|
|
119
|
+
if (data.categories != null) {
|
|
120
|
+
categories = [];
|
|
121
|
+
for (let i = 0; i < data.categories.length; i++) {
|
|
122
|
+
const category = data.categories[i];
|
|
123
|
+
const items = [];
|
|
124
|
+
for (let j = 0; j < category.items.length; j++) {
|
|
125
|
+
const item = category.items[j];
|
|
126
|
+
if (item._id !== payload._id) {
|
|
127
|
+
items.push(item);
|
|
128
|
+
orderItemIdsMap[item._id] = item.quantity;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
if (items.length > 0) {
|
|
132
|
+
categories.push({ ...category, items });
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
const iterations = [];
|
|
137
|
+
if (data.iterations != null && data.iterations.length > 0) {
|
|
138
|
+
const [firstIteration, ...restIterations] = data.iterations;
|
|
139
|
+
const firstIterationCategories = [];
|
|
140
|
+
for (let i = 0; i < firstIteration.categories.length; i++) {
|
|
141
|
+
const category = firstIteration.categories[i];
|
|
142
|
+
const allPrevItems = [];
|
|
143
|
+
for (let j = 0; j < category.items.length; j++) {
|
|
144
|
+
const prevItem = category.items[j];
|
|
145
|
+
if (prevItem._id === payload._id && payload.void_reason != null) {
|
|
146
|
+
allPrevItems.push({ ...prevItem, void_reason: payload.void_reason });
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
const currentItemQuantity = orderItemIdsMap[prevItem._id];
|
|
150
|
+
const isRemovedItem = !currentItemQuantity || currentItemQuantity < prevItem.quantity;
|
|
151
|
+
if (isRemovedItem) {
|
|
152
|
+
allPrevItems.push(prevItem);
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
const updatedPrevItem = { ...prevItem };
|
|
156
|
+
delete updatedPrevItem.void_reason;
|
|
157
|
+
allPrevItems.push(updatedPrevItem);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
if (allPrevItems.length > 0) {
|
|
162
|
+
firstIterationCategories.push({ ...category, items: allPrevItems });
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
iterations.push({ ...firstIteration, categories: firstIterationCategories }, ...restIterations);
|
|
166
|
+
}
|
|
167
|
+
return calculateCartWarehouseRfqOrderInfoAndSyncData({
|
|
168
|
+
...data,
|
|
169
|
+
...(iterations.length > 0 && { iterations }),
|
|
170
|
+
categories,
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
// ── Update Info ──
|
|
174
|
+
function getUpdateWarehouseRfqCartInfoData(data, payload) {
|
|
175
|
+
return calculateCartWarehouseRfqOrderInfoAndSyncData({ ...data, ...payload });
|
|
176
|
+
}
|
|
177
|
+
function getAddItemToWarehouseRfqCartData(data, payload) {
|
|
178
|
+
const { category_id, name, item, replace_id } = payload;
|
|
179
|
+
let mainItemId = item._id;
|
|
180
|
+
const orderData = { ...data };
|
|
181
|
+
const categories = [...(orderData.categories ?? [])];
|
|
182
|
+
let didFindCategory = false;
|
|
183
|
+
for (let i = 0; i < categories.length; i++) {
|
|
184
|
+
const category = categories[i];
|
|
185
|
+
if (category.category_id !== category_id)
|
|
186
|
+
continue;
|
|
187
|
+
const updatedItem = getUpdatedRfqItem(item);
|
|
188
|
+
const allItems = [...category.items];
|
|
189
|
+
let didFindItem = false;
|
|
190
|
+
let itemExists = false;
|
|
191
|
+
for (let j = 0; j < allItems.length; j++) {
|
|
192
|
+
const itm = allItems[j];
|
|
193
|
+
if (itm._id === item._id) {
|
|
194
|
+
allItems[j] = item;
|
|
195
|
+
didFindItem = true;
|
|
196
|
+
break;
|
|
197
|
+
}
|
|
198
|
+
if (itm.item_id === item.item_id) {
|
|
199
|
+
itemExists = true;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
if (!didFindItem && itemExists) {
|
|
203
|
+
for (let j = 0; j < allItems.length; j++) {
|
|
204
|
+
const itm = allItems[j];
|
|
205
|
+
if (itm.item_id === item.item_id && (0, lodash_1.isEqual)(getUpdatedRfqItem(itm), updatedItem)) {
|
|
206
|
+
mainItemId = replace_id ?? itm._id;
|
|
207
|
+
allItems[j] = {
|
|
208
|
+
...item,
|
|
209
|
+
_id: mainItemId,
|
|
210
|
+
quantity: item.quantity + itm.quantity,
|
|
211
|
+
};
|
|
212
|
+
didFindItem = true;
|
|
213
|
+
break;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
if (!didFindItem) {
|
|
218
|
+
allItems.push(item);
|
|
219
|
+
}
|
|
220
|
+
categories[i] = { ...category, items: allItems };
|
|
221
|
+
didFindCategory = true;
|
|
222
|
+
break;
|
|
223
|
+
}
|
|
224
|
+
if (!didFindCategory) {
|
|
225
|
+
categories.push({ category_id, name, items: [item] });
|
|
226
|
+
}
|
|
227
|
+
const iterations = [];
|
|
228
|
+
if (orderData.iterations != null && orderData.iterations.length > 0) {
|
|
229
|
+
const orderItemIdsMap = {};
|
|
230
|
+
for (let i = 0; i < categories.length; i++) {
|
|
231
|
+
for (let j = 0; j < categories[i].items.length; j++) {
|
|
232
|
+
orderItemIdsMap[categories[i].items[j]._id] = categories[i].items[j].quantity;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
const [firstIteration, ...restIterations] = orderData.iterations;
|
|
236
|
+
const firstIterationCategories = [];
|
|
237
|
+
for (let i = 0; i < firstIteration.categories.length; i++) {
|
|
238
|
+
const category = firstIteration.categories[i];
|
|
239
|
+
const allPrevItems = [];
|
|
240
|
+
for (let j = 0; j < category.items.length; j++) {
|
|
241
|
+
const prevItem = category.items[j];
|
|
242
|
+
const currentItemQuantity = orderItemIdsMap[prevItem._id];
|
|
243
|
+
const isRemovedItem = !currentItemQuantity || currentItemQuantity < prevItem.quantity;
|
|
244
|
+
if (isRemovedItem) {
|
|
245
|
+
allPrevItems.push(prevItem);
|
|
246
|
+
}
|
|
247
|
+
else {
|
|
248
|
+
const updatedPrevItem = { ...prevItem };
|
|
249
|
+
delete updatedPrevItem.void_reason;
|
|
250
|
+
allPrevItems.push(updatedPrevItem);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
if (allPrevItems.length > 0) {
|
|
254
|
+
firstIterationCategories.push({ ...category, items: allPrevItems });
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
iterations.push({ ...firstIteration, categories: firstIterationCategories }, ...restIterations);
|
|
258
|
+
}
|
|
259
|
+
return calculateCartWarehouseRfqOrderInfoAndSyncData({
|
|
260
|
+
...orderData,
|
|
261
|
+
...(iterations.length > 0 && { iterations }),
|
|
262
|
+
categories,
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
// ── Update Item ──
|
|
266
|
+
function getUpdateItemInWarehouseRfqCartData(data, payload) {
|
|
267
|
+
const orderItemIdsMap = {};
|
|
268
|
+
let categories;
|
|
269
|
+
if (data.categories != null) {
|
|
270
|
+
categories = [];
|
|
271
|
+
for (let i = 0; i < data.categories.length; i++) {
|
|
272
|
+
const category = data.categories[i];
|
|
273
|
+
const items = [];
|
|
274
|
+
for (let j = 0; j < category.items.length; j++) {
|
|
275
|
+
const item = category.items[j];
|
|
276
|
+
let newItem = item;
|
|
277
|
+
if (item._id === payload._id) {
|
|
278
|
+
newItem = { ...item, ...payload };
|
|
279
|
+
}
|
|
280
|
+
if (newItem.quantity > 0) {
|
|
281
|
+
items.push(newItem);
|
|
282
|
+
orderItemIdsMap[newItem._id] = newItem.quantity;
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
if (items.length > 0) {
|
|
286
|
+
categories.push({ ...category, items });
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
const iterations = [];
|
|
291
|
+
if (payload.quantity != null && data.iterations != null && data.iterations.length > 0) {
|
|
292
|
+
const [firstIteration, ...restIterations] = data.iterations;
|
|
293
|
+
const firstIterationCategories = [];
|
|
294
|
+
for (let i = 0; i < firstIteration.categories.length; i++) {
|
|
295
|
+
const category = firstIteration.categories[i];
|
|
296
|
+
const allPrevItems = [];
|
|
297
|
+
for (let j = 0; j < category.items.length; j++) {
|
|
298
|
+
const prevItem = category.items[j];
|
|
299
|
+
if (prevItem._id === payload._id && payload.void_reason != null) {
|
|
300
|
+
allPrevItems.push({ ...prevItem, void_reason: payload.void_reason });
|
|
301
|
+
}
|
|
302
|
+
else {
|
|
303
|
+
const currentItemQuantity = orderItemIdsMap[prevItem._id];
|
|
304
|
+
const isRemovedItem = !currentItemQuantity || currentItemQuantity < prevItem.quantity;
|
|
305
|
+
if (isRemovedItem) {
|
|
306
|
+
allPrevItems.push(prevItem);
|
|
307
|
+
}
|
|
308
|
+
else {
|
|
309
|
+
const updatedPrevItem = { ...prevItem };
|
|
310
|
+
delete updatedPrevItem.void_reason;
|
|
311
|
+
allPrevItems.push(updatedPrevItem);
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
if (allPrevItems.length > 0) {
|
|
316
|
+
firstIterationCategories.push({ ...category, items: allPrevItems });
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
iterations.push({ ...firstIteration, categories: firstIterationCategories }, ...restIterations);
|
|
320
|
+
}
|
|
321
|
+
return calculateCartWarehouseRfqOrderInfoAndSyncData({
|
|
322
|
+
...data,
|
|
323
|
+
...(iterations.length > 0 && { iterations }),
|
|
324
|
+
categories,
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
// ── Update Items (batch) ──
|
|
328
|
+
function getUpdateItemsInWarehouseRfqCartData(data, payload) {
|
|
329
|
+
return payload.reduce((acc, item) => getUpdateItemInWarehouseRfqCartData(acc, item), data);
|
|
330
|
+
}
|
|
331
|
+
// ── Split Item ──
|
|
332
|
+
function getSplitWarehouseRfqCartItemToTwo(data, orderItemId) {
|
|
333
|
+
if (data.categories == null)
|
|
334
|
+
return data;
|
|
335
|
+
const newCategories = [];
|
|
336
|
+
for (let i = 0; i < data.categories.length; i++) {
|
|
337
|
+
const category = data.categories[i];
|
|
338
|
+
const newItems = [];
|
|
339
|
+
for (let j = 0; j < category.items.length; j++) {
|
|
340
|
+
const item = { ...category.items[j] };
|
|
341
|
+
if (item._id !== orderItemId) {
|
|
342
|
+
newItems.push(item);
|
|
343
|
+
continue;
|
|
344
|
+
}
|
|
345
|
+
if (item.quantity === 1) {
|
|
346
|
+
newItems.push(item);
|
|
347
|
+
continue;
|
|
348
|
+
}
|
|
349
|
+
const newQuantity = item.quantity - 1;
|
|
350
|
+
newItems.push({
|
|
351
|
+
...item,
|
|
352
|
+
quantity: newQuantity,
|
|
353
|
+
subtotal: (0, utils_1.parseNum)(item.price * newQuantity),
|
|
354
|
+
});
|
|
355
|
+
const newId = new bson_objectid_1.default(Math.floor(new bson_objectid_1.default(item._id).getTimestamp().getTime() / 1000) + 1).toHexString();
|
|
356
|
+
newItems.push({
|
|
357
|
+
...item,
|
|
358
|
+
_id: newId,
|
|
359
|
+
quantity: 1,
|
|
360
|
+
subtotal: (0, utils_1.parseNum)(item.price * 1),
|
|
361
|
+
});
|
|
362
|
+
}
|
|
363
|
+
newCategories.push({ ...category, items: newItems });
|
|
364
|
+
}
|
|
365
|
+
return calculateCartWarehouseRfqOrderInfoAndSyncData({
|
|
366
|
+
...data,
|
|
367
|
+
categories: newCategories,
|
|
368
|
+
});
|
|
369
|
+
}
|
|
370
|
+
// ── Add Items (batch) ──
|
|
371
|
+
function getAddItemsToWarehouseRfqCartData(data, payload) {
|
|
372
|
+
return payload.reduce((acc, item) => getAddItemToWarehouseRfqCartData(acc, item), data);
|
|
373
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { WAREHOUSE_PURCHASE_ORDER_STATUS_ENUM } from '../../constants';
|
|
2
|
+
import { IWarehousePurchaseOrder, IWarehousePurchaseOrderItem, IWarehousePurchaseOrderIteration } from '../../schemas';
|
|
3
|
+
export declare function calculateCartWarehousePurchaseOrderInfoAndSyncData<T extends IWarehousePurchaseOrder | Partial<IWarehousePurchaseOrder>>(data: T, calculateItemMetadata?: boolean): T;
|
|
4
|
+
export declare const getWarehousePurchaseOrderItemComaparableData: (item: IWarehousePurchaseOrderItem) => Partial<IWarehousePurchaseOrderItem>;
|
|
5
|
+
export declare function getUpdatedWarehousePurchaseOrderCartInfoOnInit(data: Partial<IWarehousePurchaseOrder>, order: Partial<IWarehousePurchaseOrder>): {
|
|
6
|
+
_id?: string | undefined;
|
|
7
|
+
warehouse_id?: string | undefined;
|
|
8
|
+
vendor_id?: string | undefined;
|
|
9
|
+
vendor_name?: string | undefined;
|
|
10
|
+
rfq_id?: string | null;
|
|
11
|
+
iterations?: IWarehousePurchaseOrderIteration[] | undefined;
|
|
12
|
+
amount_collected?: number | undefined;
|
|
13
|
+
order_number?: number | null | undefined;
|
|
14
|
+
delete_reason?: string | null;
|
|
15
|
+
cancel_reason?: string | null;
|
|
16
|
+
is_deleted?: boolean | undefined;
|
|
17
|
+
order_status_updated_at?: Date | undefined;
|
|
18
|
+
is_reopened?: boolean;
|
|
19
|
+
deferred_settlement?: boolean;
|
|
20
|
+
order_settled_at?: Date | undefined;
|
|
21
|
+
order_settled_at_mins?: number | undefined;
|
|
22
|
+
createdAt_mins?: number | undefined;
|
|
23
|
+
createdAt?: Date | undefined;
|
|
24
|
+
payments?: import("../../schemas").IOrderPayment[] | undefined;
|
|
25
|
+
tax_number?: string | undefined;
|
|
26
|
+
categories?: import("../../schemas").IWarehousePurchaseOrderCommonCategoryByCategoryId[] | undefined;
|
|
27
|
+
staff_details?: import("../../schemas").IStaffDetails | undefined;
|
|
28
|
+
is_gst_inclusive?: boolean;
|
|
29
|
+
gst?: number | null;
|
|
30
|
+
gst_amount?: number | null;
|
|
31
|
+
special_instructions?: string | undefined;
|
|
32
|
+
price?: number | undefined;
|
|
33
|
+
amount_earned?: number | undefined;
|
|
34
|
+
grand_total?: number | undefined;
|
|
35
|
+
order_status?: WAREHOUSE_PURCHASE_ORDER_STATUS_ENUM | undefined;
|
|
36
|
+
updatedAt?: Date | undefined;
|
|
37
|
+
};
|
|
38
|
+
export declare function getRemoveItemFromWarehousePurchaseOrderCartData(data: Partial<IWarehousePurchaseOrder>, payload: {
|
|
39
|
+
_id: string;
|
|
40
|
+
void_reason?: string;
|
|
41
|
+
}): Partial<IWarehousePurchaseOrder>;
|
|
42
|
+
export declare function getUpdateWarehousePurchaseOrderCartInfoData(data: Partial<IWarehousePurchaseOrder>, payload: Partial<IWarehousePurchaseOrder>): Partial<IWarehousePurchaseOrder>;
|
|
43
|
+
export interface ISetAddItemToPurchaseOrderCartActionPayload {
|
|
44
|
+
name: string;
|
|
45
|
+
category_id: string;
|
|
46
|
+
item: IWarehousePurchaseOrderItem;
|
|
47
|
+
replace_id?: string;
|
|
48
|
+
}
|
|
49
|
+
export declare function getAddItemToWarehousePurchaseOrderCartData(data: Partial<IWarehousePurchaseOrder>, payload: ISetAddItemToPurchaseOrderCartActionPayload): Partial<IWarehousePurchaseOrder>;
|
|
50
|
+
export declare function getUpdateItemInWarehousePurchaseOrderCartData(data: Partial<IWarehousePurchaseOrder>, payload: Partial<IWarehousePurchaseOrderItem>): Partial<IWarehousePurchaseOrder>;
|
|
51
|
+
export declare function getUpdateItemsInWarehousePurchaseOrderCartData(data: Partial<IWarehousePurchaseOrder>, payload: Partial<IWarehousePurchaseOrderItem>[]): Partial<IWarehousePurchaseOrder>;
|
|
52
|
+
export interface IGetSplitPurchaseOrderCartItemToTwo {
|
|
53
|
+
data: Partial<IWarehousePurchaseOrder>;
|
|
54
|
+
orderItemId: string;
|
|
55
|
+
}
|
|
56
|
+
export declare function getSplitWarehousePurchaseOrderCartItemToTwo({ data, orderItemId, }: IGetSplitPurchaseOrderCartItemToTwo): Partial<IWarehousePurchaseOrder>;
|
|
57
|
+
export declare function getAddItemsToWarehousePurchaseOrderCartData(data: Partial<IWarehousePurchaseOrder>, payload: ISetAddItemToPurchaseOrderCartActionPayload[]): Partial<IWarehousePurchaseOrder>;
|