@managesome/eposmatic-toolkit 0.2.342-beta.0 → 0.2.342
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 -35
- package/lib/constants/ENUMS.js +3 -48
- package/lib/helpers/store/common-purchase-order-actions.d.ts +2 -2
- package/lib/helpers/store/purchase-orders-cart-actions.d.ts +6 -7
- package/lib/helpers/utils/index.d.ts +1 -0
- package/lib/helpers/utils/index.js +1 -0
- package/lib/helpers/utils/offer-apply-helpers.d.ts +63 -1
- package/lib/helpers/utils/offer-apply-helpers.js +61 -3
- package/lib/helpers/utils/offers-helpers.d.ts +23 -4
- package/lib/helpers/utils/offers-helpers.js +260 -101
- package/lib/schemas/models/index.d.ts +0 -3
- package/lib/schemas/models/index.js +0 -3
- package/lib/schemas/models/purchase_orders.d.ts +0 -3
- package/lib/schemas/models/purchase_orders.js +1 -10
- package/lib/schemas/models/void_purchase_order_items.js +1 -2
- package/lib/schemas/models/warehouse.d.ts +1 -7
- package/lib/schemas/models/warehouse.js +0 -9
- package/lib/schemas/models/warehouse_items.d.ts +0 -19
- package/lib/schemas/models/warehouse_items.js +0 -29
- package/lib/schemas/models/warehouse_vendors.d.ts +3 -3
- package/lib/schemas/types/index.d.ts +0 -4
- package/lib/schemas/types/index.js +0 -4
- package/lib/schemas/types/purchase_orders.d.ts +43 -7
- package/lib/schemas/types/warehouse.d.ts +1 -3
- package/lib/schemas/types/warehouse_items.d.ts +1 -7
- package/package.json +2 -2
|
@@ -4,9 +4,6 @@ exports.PURCHASE_ORDER_COLLECTION_NAME = exports.PurchaseOrderSchema = void 0;
|
|
|
4
4
|
const mongoose_1 = require("mongoose");
|
|
5
5
|
const constants_1 = require("../../constants");
|
|
6
6
|
const common_models_1 = require("./common-models");
|
|
7
|
-
const purchase_order_rfq_1 = require("./purchase_order_rfq");
|
|
8
|
-
const warehouse_categories_1 = require("./warehouse_categories");
|
|
9
|
-
const warehouse_items_1 = require("./warehouse_items");
|
|
10
7
|
const warehouse_1 = require("./warehouse");
|
|
11
8
|
const warehouse_vendors_1 = require("./warehouse_vendors");
|
|
12
9
|
const StaffDetailsSchema = new mongoose_1.Schema({
|
|
@@ -37,7 +34,6 @@ const ItemsModal = new mongoose_1.Schema({
|
|
|
37
34
|
type: mongoose_1.Schema.Types.ObjectId,
|
|
38
35
|
required: true,
|
|
39
36
|
immutable: true,
|
|
40
|
-
ref: warehouse_items_1.WAREHOUSE_ITEMS_COLLECTION_NAME,
|
|
41
37
|
},
|
|
42
38
|
is_ready: {
|
|
43
39
|
type: Boolean,
|
|
@@ -96,7 +92,7 @@ const CatergoriesSchema = new mongoose_1.Schema({
|
|
|
96
92
|
type: mongoose_1.Schema.Types.ObjectId,
|
|
97
93
|
required: true,
|
|
98
94
|
immutable: true,
|
|
99
|
-
ref:
|
|
95
|
+
ref: 'warehouse_categories',
|
|
100
96
|
},
|
|
101
97
|
name: {
|
|
102
98
|
type: String,
|
|
@@ -194,11 +190,6 @@ exports.PurchaseOrderSchema = new mongoose_1.Schema({
|
|
|
194
190
|
type: String,
|
|
195
191
|
default: '',
|
|
196
192
|
},
|
|
197
|
-
rfq_id: {
|
|
198
|
-
type: mongoose_1.Schema.Types.ObjectId,
|
|
199
|
-
required: false,
|
|
200
|
-
ref: purchase_order_rfq_1.PURCHASE_ORDER_RFQ_COLLECTION_NAME,
|
|
201
|
-
},
|
|
202
193
|
categories: {
|
|
203
194
|
type: [CatergoriesSchema],
|
|
204
195
|
default: [],
|
|
@@ -4,7 +4,6 @@ exports.VOID_PURCHASE_ORDER_ITEMS_COLLECTION_NAME = exports.VoidPurchaseOrderIte
|
|
|
4
4
|
const mongoose_1 = require("mongoose");
|
|
5
5
|
const constants_1 = require("../../constants");
|
|
6
6
|
const purchase_orders_1 = require("./purchase_orders");
|
|
7
|
-
const warehouse_items_1 = require("./warehouse_items");
|
|
8
7
|
const warehouse_1 = require("./warehouse");
|
|
9
8
|
const warehouse_vendors_1 = require("./warehouse_vendors");
|
|
10
9
|
const VoidPurchaseOrderItemAdjustmentSchema = new mongoose_1.Schema({
|
|
@@ -76,7 +75,7 @@ exports.VoidPurchaseOrderItemSchema = new mongoose_1.Schema({
|
|
|
76
75
|
type: mongoose_1.Schema.Types.ObjectId,
|
|
77
76
|
required: true,
|
|
78
77
|
immutable: true,
|
|
79
|
-
ref:
|
|
78
|
+
ref: 'items',
|
|
80
79
|
},
|
|
81
80
|
order_item_id: {
|
|
82
81
|
type: mongoose_1.Schema.Types.ObjectId,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Schema } from 'mongoose';
|
|
2
|
-
import { COUNTRY_ALPHA_2_ENUM, COUNTRY_ALPHA_3_ENUM, COUNTRY_CODE_ENUM, COUNTRY_FLAG_ENUM, COUNTRY_NAME_ENUM, CURRENCY_CODE_ENUM, CURRENCY_NAME_ENUM, CURRENCY_SYMBOL_ENUM, GST_TYPE_ENUM,
|
|
2
|
+
import { COUNTRY_ALPHA_2_ENUM, COUNTRY_ALPHA_3_ENUM, COUNTRY_CODE_ENUM, COUNTRY_FLAG_ENUM, COUNTRY_NAME_ENUM, CURRENCY_CODE_ENUM, CURRENCY_NAME_ENUM, CURRENCY_SYMBOL_ENUM, GST_TYPE_ENUM, TRACK_ORDER_NUMBER_ENUM } from '../../constants';
|
|
3
3
|
export declare const WarehouseSchema: Schema<any, import("mongoose").Model<any, any, any, any, any, any>, {}, {}, {}, {}, {
|
|
4
4
|
timestamps: true;
|
|
5
5
|
versionKey: false;
|
|
@@ -44,8 +44,6 @@ export declare const WarehouseSchema: Schema<any, import("mongoose").Model<any,
|
|
|
44
44
|
alert_phone_numbers: string[];
|
|
45
45
|
alert_email_addresses: string[];
|
|
46
46
|
alert_when: string[];
|
|
47
|
-
enable_lot_serial_tracking: boolean;
|
|
48
|
-
default_removal_strategy: REMOVAL_STRATEGY_ENUM;
|
|
49
47
|
po_custom_payment_types: string[];
|
|
50
48
|
invoice_custom_payment_types: string[];
|
|
51
49
|
exclude_discount_from_gst?: boolean | null | undefined;
|
|
@@ -94,8 +92,6 @@ export declare const WarehouseSchema: Schema<any, import("mongoose").Model<any,
|
|
|
94
92
|
alert_phone_numbers: string[];
|
|
95
93
|
alert_email_addresses: string[];
|
|
96
94
|
alert_when: string[];
|
|
97
|
-
enable_lot_serial_tracking: boolean;
|
|
98
|
-
default_removal_strategy: REMOVAL_STRATEGY_ENUM;
|
|
99
95
|
po_custom_payment_types: string[];
|
|
100
96
|
invoice_custom_payment_types: string[];
|
|
101
97
|
exclude_discount_from_gst?: boolean | null | undefined;
|
|
@@ -144,8 +140,6 @@ export declare const WarehouseSchema: Schema<any, import("mongoose").Model<any,
|
|
|
144
140
|
alert_phone_numbers: string[];
|
|
145
141
|
alert_email_addresses: string[];
|
|
146
142
|
alert_when: string[];
|
|
147
|
-
enable_lot_serial_tracking: boolean;
|
|
148
|
-
default_removal_strategy: REMOVAL_STRATEGY_ENUM;
|
|
149
143
|
po_custom_payment_types: string[];
|
|
150
144
|
invoice_custom_payment_types: string[];
|
|
151
145
|
exclude_discount_from_gst?: boolean | null | undefined;
|
|
@@ -186,15 +186,6 @@ exports.WarehouseSchema = new mongoose_1.Schema({
|
|
|
186
186
|
type: [String],
|
|
187
187
|
default: [],
|
|
188
188
|
},
|
|
189
|
-
enable_lot_serial_tracking: {
|
|
190
|
-
type: Boolean,
|
|
191
|
-
default: false,
|
|
192
|
-
},
|
|
193
|
-
default_removal_strategy: {
|
|
194
|
-
type: String,
|
|
195
|
-
enum: constants_1.ALL_REMOVAL_STRATEGY_TYPES,
|
|
196
|
-
default: constants_1.REMOVAL_STRATEGY_ENUM.FIFO,
|
|
197
|
-
},
|
|
198
189
|
po_custom_payment_types: {
|
|
199
190
|
type: [String],
|
|
200
191
|
default: [],
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Schema } from 'mongoose';
|
|
2
|
-
import { TRACKING_MODE_ENUM } from '../../constants';
|
|
3
2
|
export declare const WarehouseItemSchema: Schema<any, import("mongoose").Model<any, any, any, any, any, any>, {}, {}, {}, {}, {
|
|
4
3
|
timestamps: true;
|
|
5
4
|
versionKey: false;
|
|
@@ -44,12 +43,6 @@ export declare const WarehouseItemSchema: Schema<any, import("mongoose").Model<a
|
|
|
44
43
|
purchase_price: {
|
|
45
44
|
BASE_PRICE: number;
|
|
46
45
|
};
|
|
47
|
-
tracking_mode: TRACKING_MODE_ENUM;
|
|
48
|
-
expiry_tracked: boolean;
|
|
49
|
-
expiration_days: number;
|
|
50
|
-
best_before_days: number;
|
|
51
|
-
removal_days: number;
|
|
52
|
-
alert_days: number;
|
|
53
46
|
}, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
|
|
54
47
|
createdAt: NativeDate;
|
|
55
48
|
updatedAt: NativeDate;
|
|
@@ -90,12 +83,6 @@ export declare const WarehouseItemSchema: Schema<any, import("mongoose").Model<a
|
|
|
90
83
|
purchase_price: {
|
|
91
84
|
BASE_PRICE: number;
|
|
92
85
|
};
|
|
93
|
-
tracking_mode: TRACKING_MODE_ENUM;
|
|
94
|
-
expiry_tracked: boolean;
|
|
95
|
-
expiration_days: number;
|
|
96
|
-
best_before_days: number;
|
|
97
|
-
removal_days: number;
|
|
98
|
-
alert_days: number;
|
|
99
86
|
}>> & import("mongoose").FlatRecord<{
|
|
100
87
|
createdAt: NativeDate;
|
|
101
88
|
updatedAt: NativeDate;
|
|
@@ -136,12 +123,6 @@ export declare const WarehouseItemSchema: Schema<any, import("mongoose").Model<a
|
|
|
136
123
|
purchase_price: {
|
|
137
124
|
BASE_PRICE: number;
|
|
138
125
|
};
|
|
139
|
-
tracking_mode: TRACKING_MODE_ENUM;
|
|
140
|
-
expiry_tracked: boolean;
|
|
141
|
-
expiration_days: number;
|
|
142
|
-
best_before_days: number;
|
|
143
|
-
removal_days: number;
|
|
144
|
-
alert_days: number;
|
|
145
126
|
}> & Required<{
|
|
146
127
|
_id: import("mongoose").Types.ObjectId;
|
|
147
128
|
}> & {
|
|
@@ -108,35 +108,6 @@ exports.WarehouseItemSchema = new mongoose_1.Schema({
|
|
|
108
108
|
type: String,
|
|
109
109
|
default: null,
|
|
110
110
|
},
|
|
111
|
-
tracking_mode: {
|
|
112
|
-
type: String,
|
|
113
|
-
enum: constants_1.ALL_TRACKING_MODES,
|
|
114
|
-
default: constants_1.TRACKING_MODE_ENUM.NONE,
|
|
115
|
-
},
|
|
116
|
-
expiry_tracked: {
|
|
117
|
-
type: Boolean,
|
|
118
|
-
default: false,
|
|
119
|
-
},
|
|
120
|
-
expiration_days: {
|
|
121
|
-
type: Number,
|
|
122
|
-
default: 0,
|
|
123
|
-
min: 0,
|
|
124
|
-
},
|
|
125
|
-
best_before_days: {
|
|
126
|
-
type: Number,
|
|
127
|
-
default: 0,
|
|
128
|
-
min: 0,
|
|
129
|
-
},
|
|
130
|
-
removal_days: {
|
|
131
|
-
type: Number,
|
|
132
|
-
default: 0,
|
|
133
|
-
min: 0,
|
|
134
|
-
},
|
|
135
|
-
alert_days: {
|
|
136
|
-
type: Number,
|
|
137
|
-
default: 0,
|
|
138
|
-
min: 0,
|
|
139
|
-
},
|
|
140
111
|
createdAt: {
|
|
141
112
|
type: mongoose_1.Schema.Types.Date,
|
|
142
113
|
required: true,
|
|
@@ -27,8 +27,8 @@ export declare const WarehouseVendorsSchema: Schema<any, import("mongoose").Mode
|
|
|
27
27
|
phone_number: string;
|
|
28
28
|
uid: string;
|
|
29
29
|
email: string;
|
|
30
|
-
warehouse_id: string;
|
|
31
30
|
tax_business_number: string;
|
|
31
|
+
warehouse_id: string;
|
|
32
32
|
}, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
|
|
33
33
|
createdAt: NativeDate;
|
|
34
34
|
updatedAt: NativeDate;
|
|
@@ -53,8 +53,8 @@ export declare const WarehouseVendorsSchema: Schema<any, import("mongoose").Mode
|
|
|
53
53
|
phone_number: string;
|
|
54
54
|
uid: string;
|
|
55
55
|
email: string;
|
|
56
|
-
warehouse_id: string;
|
|
57
56
|
tax_business_number: string;
|
|
57
|
+
warehouse_id: string;
|
|
58
58
|
}>> & import("mongoose").FlatRecord<{
|
|
59
59
|
createdAt: NativeDate;
|
|
60
60
|
updatedAt: NativeDate;
|
|
@@ -79,8 +79,8 @@ export declare const WarehouseVendorsSchema: Schema<any, import("mongoose").Mode
|
|
|
79
79
|
phone_number: string;
|
|
80
80
|
uid: string;
|
|
81
81
|
email: string;
|
|
82
|
-
warehouse_id: string;
|
|
83
82
|
tax_business_number: string;
|
|
83
|
+
warehouse_id: string;
|
|
84
84
|
}> & Required<{
|
|
85
85
|
_id: import("mongoose").Types.ObjectId;
|
|
86
86
|
}> & {
|
|
@@ -41,10 +41,6 @@ export * from './operational_roles';
|
|
|
41
41
|
export * from './order';
|
|
42
42
|
export * from './printer_settings';
|
|
43
43
|
export * from './public_holidays';
|
|
44
|
-
export * from './purchase_order_common';
|
|
45
|
-
export * from './purchase_order_receipts';
|
|
46
|
-
export * from './purchase_order_rfq';
|
|
47
|
-
export * from './purchase_order_vendor_returns';
|
|
48
44
|
export * from './purchase_orders';
|
|
49
45
|
export * from './reservations';
|
|
50
46
|
export * from './reviews';
|
|
@@ -57,10 +57,6 @@ __exportStar(require("./operational_roles"), exports);
|
|
|
57
57
|
__exportStar(require("./order"), exports);
|
|
58
58
|
__exportStar(require("./printer_settings"), exports);
|
|
59
59
|
__exportStar(require("./public_holidays"), exports);
|
|
60
|
-
__exportStar(require("./purchase_order_common"), exports);
|
|
61
|
-
__exportStar(require("./purchase_order_receipts"), exports);
|
|
62
|
-
__exportStar(require("./purchase_order_rfq"), exports);
|
|
63
|
-
__exportStar(require("./purchase_order_vendor_returns"), exports);
|
|
64
60
|
__exportStar(require("./purchase_orders"), exports);
|
|
65
61
|
__exportStar(require("./reservations"), exports);
|
|
66
62
|
__exportStar(require("./reviews"), exports);
|
|
@@ -1,19 +1,55 @@
|
|
|
1
1
|
import { PURCHASE_ORDER_STATUS_ENUM } from '../../constants';
|
|
2
|
-
import { IOrderPayment } from './order';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
import { IOrderPayment, IStaffDetails } from './order';
|
|
3
|
+
export interface IPurchaseOrderItem {
|
|
4
|
+
_id: string;
|
|
5
|
+
item_id: string;
|
|
6
|
+
is_ready?: boolean;
|
|
7
|
+
void_reason?: string;
|
|
8
|
+
name: string;
|
|
9
|
+
price: number;
|
|
10
|
+
subtotal: number;
|
|
11
|
+
quantity: number;
|
|
12
|
+
_net_amount: number;
|
|
13
|
+
_gross_amount: number;
|
|
14
|
+
_gst_amount: number;
|
|
15
|
+
_discount_amount: number;
|
|
16
|
+
special_instructions: string;
|
|
17
|
+
}
|
|
18
|
+
export interface IPurchaseOrderCategory {
|
|
19
|
+
name: string;
|
|
20
|
+
category_id: string;
|
|
21
|
+
items: IPurchaseOrderItem[];
|
|
22
|
+
}
|
|
23
|
+
export interface IPurchaseOrderIteration {
|
|
24
|
+
categories: IPurchaseOrderCategory[];
|
|
7
25
|
payments: IOrderPayment[];
|
|
26
|
+
staff_details: IStaffDetails;
|
|
27
|
+
is_gst_inclusive?: boolean;
|
|
28
|
+
gst?: number;
|
|
29
|
+
gst_amount?: number;
|
|
30
|
+
special_instructions: string;
|
|
31
|
+
order_status: PURCHASE_ORDER_STATUS_ENUM;
|
|
32
|
+
/**
|
|
33
|
+
* price is the total price of the all items in the order
|
|
34
|
+
* without any discounts
|
|
35
|
+
*/
|
|
36
|
+
price: number;
|
|
37
|
+
/**
|
|
38
|
+
* amount_earned is the total amount amount_earned by the store
|
|
39
|
+
*/
|
|
40
|
+
amount_earned: number;
|
|
41
|
+
/**
|
|
42
|
+
* grand_total is the final amount of the order including all taxes and discounts
|
|
43
|
+
*/
|
|
44
|
+
grand_total: number;
|
|
8
45
|
tax_number: string;
|
|
46
|
+
updatedAt: Date;
|
|
9
47
|
}
|
|
10
48
|
export interface IPurchaseOrder extends IPurchaseOrderIteration {
|
|
11
49
|
_id: string;
|
|
12
50
|
warehouse_id: string;
|
|
13
51
|
vendor_id: string;
|
|
14
52
|
vendor_name: string;
|
|
15
|
-
/** Source RFQ reference when this PO is converted from an RFQ. */
|
|
16
|
-
rfq_id?: string | null;
|
|
17
53
|
iterations: IPurchaseOrderIteration[];
|
|
18
54
|
/**
|
|
19
55
|
* amount_collected is the total amount collected from the consumer
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { COUNTRY_ALPHA_2_ENUM, COUNTRY_ALPHA_3_ENUM, COUNTRY_CODE_ENUM, COUNTRY_FLAG_ENUM, COUNTRY_NAME_ENUM, CURRENCY_CODE_ENUM, CURRENCY_NAME_ENUM, CURRENCY_SYMBOL_ENUM, GST_TYPE_ENUM,
|
|
1
|
+
import { COUNTRY_ALPHA_2_ENUM, COUNTRY_ALPHA_3_ENUM, COUNTRY_CODE_ENUM, COUNTRY_FLAG_ENUM, COUNTRY_NAME_ENUM, CURRENCY_CODE_ENUM, CURRENCY_NAME_ENUM, CURRENCY_SYMBOL_ENUM, GST_TYPE_ENUM, TAX_INVOICE_PROVIDER_ENUM, TRACK_ORDER_NUMBER_ENUM } from '../../constants';
|
|
2
2
|
export interface IWarehouse {
|
|
3
3
|
_id: string;
|
|
4
4
|
brand_id: string;
|
|
@@ -39,8 +39,6 @@ export interface IWarehouse {
|
|
|
39
39
|
alert_phone_numbers: string[];
|
|
40
40
|
alert_email_addresses: string[];
|
|
41
41
|
alert_when: string[];
|
|
42
|
-
enable_lot_serial_tracking: boolean;
|
|
43
|
-
default_removal_strategy: REMOVAL_STRATEGY_ENUM;
|
|
44
42
|
po_custom_payment_types: string[];
|
|
45
43
|
invoice_custom_payment_types: string[];
|
|
46
44
|
active: boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { INVENTORY_ITEM_TYPE_ENUM, INVENTORY_ITEM_UNIT_ENUM
|
|
1
|
+
import { INVENTORY_ITEM_TYPE_ENUM, INVENTORY_ITEM_UNIT_ENUM } from '../../constants';
|
|
2
2
|
import { IGeneralPrice, IIngredient } from './common';
|
|
3
3
|
export interface IWarehouseItem {
|
|
4
4
|
_id: string;
|
|
@@ -22,12 +22,6 @@ export interface IWarehouseItem {
|
|
|
22
22
|
ingredients?: IIngredient[] | null;
|
|
23
23
|
keywords: string[];
|
|
24
24
|
image_url: string | null;
|
|
25
|
-
tracking_mode: TRACKING_MODE_ENUM;
|
|
26
|
-
expiry_tracked?: boolean;
|
|
27
|
-
expiration_days?: number;
|
|
28
|
-
best_before_days?: number;
|
|
29
|
-
removal_days?: number;
|
|
30
|
-
alert_days?: number;
|
|
31
25
|
createdAt: Date;
|
|
32
26
|
updatedAt: Date;
|
|
33
27
|
}
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@managesome/eposmatic-toolkit",
|
|
3
|
-
"version": "0.2.342
|
|
3
|
+
"version": "0.2.342",
|
|
4
4
|
"description": "A Toolkit Library for Eposmatic",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"test": "jest --config jestconfig.json",
|
|
8
|
+
"test": "jest --config jestconfig.json --passWithNoTests",
|
|
9
9
|
"build": "npm run test && tsc",
|
|
10
10
|
"prepare": "npm run build",
|
|
11
11
|
"prepublishOnly": "npm run lint",
|