@posx/core 5.5.89 → 5.5.91
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/LICENSE +21 -21
- package/README.md +85 -85
- package/build/index.d.ts +154 -18
- package/build/index.js +1 -1
- package/package.json +1 -1
- package/package.publish.json +116 -116
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2019 Francisco Hodge
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2019 Francisco Hodge
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,85 +1,85 @@
|
|
|
1
|
-
# 第一阶段
|
|
2
|
-
- 1. 创建,更新,删除都是通过 -> Http API
|
|
3
|
-
- 2. 读取是通过本地数据库 -> 本地, (例外:订单从云端读取)
|
|
4
|
-
|
|
5
|
-
# 第二阶段 (单机版)
|
|
6
|
-
1. 创建,更新,删除,读取都通过本地数据库,然后进行数据和云端同步(Web Worker)
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
<div align="center">
|
|
19
|
-
<img align="center" width="230" src="https://i.imgur.com/iHgtvmg.png" />
|
|
20
|
-
<h2>Typescript Library Boilerplate Basic</h2>
|
|
21
|
-
<blockquote>Minimal Library Starter Kit for your Typescript projects</blockquote>
|
|
22
|
-
|
|
23
|
-
<a href="https://www.npmjs.com/package/@hodgef/ts-library-boilerplate-basic"><img src="https://badgen.net/npm/v/@hodgef/ts-library-boilerplate-basic?color=blue" alt="npm version"></a> <a href="https://github.com/hodgef/ts-library-boilerplate"><img src="https://img.shields.io/github/last-commit/hodgef/ts-library-boilerplate" alt="latest commit"></a> <a href="https://github.com/hodgef/ts-library-boilerplate-basic/actions"><img alt="Build Status" src="https://github.com/hodgef/ts-library-boilerplate-basic/workflows/Build/badge.svg?color=green" /></a> <a href="https://github.com/hodgef/ts-library-boilerplate-basic/actions"> <img alt="Publish Status" src="https://github.com/hodgef/ts-library-boilerplate-basic/workflows/Publish/badge.svg?color=green" /></a>
|
|
24
|
-
|
|
25
|
-
<strong>For a plain Javascript alternative, check out [js-library-boilerplate-basic](https://github.com/hodgef/js-library-boilerplate-basic).</strong>
|
|
26
|
-
|
|
27
|
-
</div>
|
|
28
|
-
|
|
29
|
-
## ⭐️ Features
|
|
30
|
-
|
|
31
|
-
- Webpack 5
|
|
32
|
-
- Babel 7
|
|
33
|
-
- Hot reloading (`npm start`)
|
|
34
|
-
- Automatic Types file generation (index.d.ts)
|
|
35
|
-
- UMD exports, so your library works everywhere.
|
|
36
|
-
- Jest unit testing
|
|
37
|
-
- Customizable file headers for your build [(Example 1)](https://github.com/hodgef/ts-library-boilerplate-basic/blob/master/build/index.js) [(Example2)](https://github.com/hodgef/ts-library-boilerplate-basic/blob/master/build/css/index.css)
|
|
38
|
-
- Daily [dependabot](https://dependabot.com) dependency updates
|
|
39
|
-
|
|
40
|
-
## 📦 Getting Started
|
|
41
|
-
|
|
42
|
-
```
|
|
43
|
-
git clone https://github.com/hodgef/ts-library-boilerplate-basic.git myLibrary
|
|
44
|
-
npm install
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
## 💎 Customization
|
|
48
|
-
|
|
49
|
-
> Before shipping, make sure to:
|
|
50
|
-
|
|
51
|
-
1. Edit `LICENSE` file
|
|
52
|
-
2. Edit `package.json` information (These will be used to generate the headers for your built files)
|
|
53
|
-
3. Edit `library: "MyLibrary"` with your library's export name in `./webpack.config.js`
|
|
54
|
-
|
|
55
|
-
## 🚀 Deployment
|
|
56
|
-
|
|
57
|
-
1. `npm publish`
|
|
58
|
-
2. Your users can include your library as usual
|
|
59
|
-
|
|
60
|
-
### npm
|
|
61
|
-
|
|
62
|
-
```
|
|
63
|
-
import MyLibrary from 'my-library';
|
|
64
|
-
const libraryInstance = new MyLibrary();
|
|
65
|
-
...
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
### self-host/cdn
|
|
69
|
-
|
|
70
|
-
```
|
|
71
|
-
<script src="build/index.js"></script>
|
|
72
|
-
|
|
73
|
-
const MyLibrary = window.MyLibrary.default;
|
|
74
|
-
const libraryInstance = new MyLibrary();
|
|
75
|
-
...
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
## ✅ Libraries built with this boilerplate
|
|
79
|
-
|
|
80
|
-
> Made a library using this starter kit? Share it here by [submitting a pull request](https://github.com/hodgef/ts-library-boilerplate-basic/pulls)!
|
|
81
|
-
|
|
82
|
-
- [simple-keyboard](https://github.com/hodgef/simple-keyboard) - Javascript Virtual Keyboard
|
|
83
|
-
- [react-simple-keyboard](https://github.com/hodgef/react-simple-keyboard) - React Virtual Keyboard
|
|
84
|
-
- [simple-keyboard-layouts](https://github.com/hodgef/simple-keyboard-layouts) - Keyboard layouts for simple-keyboard
|
|
85
|
-
- [atlas-monaco](https://github.com/datdao/atlas-monaco) - AtlasHCL for monaco editor
|
|
1
|
+
# 第一阶段
|
|
2
|
+
- 1. 创建,更新,删除都是通过 -> Http API
|
|
3
|
+
- 2. 读取是通过本地数据库 -> 本地, (例外:订单从云端读取)
|
|
4
|
+
|
|
5
|
+
# 第二阶段 (单机版)
|
|
6
|
+
1. 创建,更新,删除,读取都通过本地数据库,然后进行数据和云端同步(Web Worker)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
<div align="center">
|
|
19
|
+
<img align="center" width="230" src="https://i.imgur.com/iHgtvmg.png" />
|
|
20
|
+
<h2>Typescript Library Boilerplate Basic</h2>
|
|
21
|
+
<blockquote>Minimal Library Starter Kit for your Typescript projects</blockquote>
|
|
22
|
+
|
|
23
|
+
<a href="https://www.npmjs.com/package/@hodgef/ts-library-boilerplate-basic"><img src="https://badgen.net/npm/v/@hodgef/ts-library-boilerplate-basic?color=blue" alt="npm version"></a> <a href="https://github.com/hodgef/ts-library-boilerplate"><img src="https://img.shields.io/github/last-commit/hodgef/ts-library-boilerplate" alt="latest commit"></a> <a href="https://github.com/hodgef/ts-library-boilerplate-basic/actions"><img alt="Build Status" src="https://github.com/hodgef/ts-library-boilerplate-basic/workflows/Build/badge.svg?color=green" /></a> <a href="https://github.com/hodgef/ts-library-boilerplate-basic/actions"> <img alt="Publish Status" src="https://github.com/hodgef/ts-library-boilerplate-basic/workflows/Publish/badge.svg?color=green" /></a>
|
|
24
|
+
|
|
25
|
+
<strong>For a plain Javascript alternative, check out [js-library-boilerplate-basic](https://github.com/hodgef/js-library-boilerplate-basic).</strong>
|
|
26
|
+
|
|
27
|
+
</div>
|
|
28
|
+
|
|
29
|
+
## ⭐️ Features
|
|
30
|
+
|
|
31
|
+
- Webpack 5
|
|
32
|
+
- Babel 7
|
|
33
|
+
- Hot reloading (`npm start`)
|
|
34
|
+
- Automatic Types file generation (index.d.ts)
|
|
35
|
+
- UMD exports, so your library works everywhere.
|
|
36
|
+
- Jest unit testing
|
|
37
|
+
- Customizable file headers for your build [(Example 1)](https://github.com/hodgef/ts-library-boilerplate-basic/blob/master/build/index.js) [(Example2)](https://github.com/hodgef/ts-library-boilerplate-basic/blob/master/build/css/index.css)
|
|
38
|
+
- Daily [dependabot](https://dependabot.com) dependency updates
|
|
39
|
+
|
|
40
|
+
## 📦 Getting Started
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
git clone https://github.com/hodgef/ts-library-boilerplate-basic.git myLibrary
|
|
44
|
+
npm install
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## 💎 Customization
|
|
48
|
+
|
|
49
|
+
> Before shipping, make sure to:
|
|
50
|
+
|
|
51
|
+
1. Edit `LICENSE` file
|
|
52
|
+
2. Edit `package.json` information (These will be used to generate the headers for your built files)
|
|
53
|
+
3. Edit `library: "MyLibrary"` with your library's export name in `./webpack.config.js`
|
|
54
|
+
|
|
55
|
+
## 🚀 Deployment
|
|
56
|
+
|
|
57
|
+
1. `npm publish`
|
|
58
|
+
2. Your users can include your library as usual
|
|
59
|
+
|
|
60
|
+
### npm
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
import MyLibrary from 'my-library';
|
|
64
|
+
const libraryInstance = new MyLibrary();
|
|
65
|
+
...
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### self-host/cdn
|
|
69
|
+
|
|
70
|
+
```
|
|
71
|
+
<script src="build/index.js"></script>
|
|
72
|
+
|
|
73
|
+
const MyLibrary = window.MyLibrary.default;
|
|
74
|
+
const libraryInstance = new MyLibrary();
|
|
75
|
+
...
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## ✅ Libraries built with this boilerplate
|
|
79
|
+
|
|
80
|
+
> Made a library using this starter kit? Share it here by [submitting a pull request](https://github.com/hodgef/ts-library-boilerplate-basic/pulls)!
|
|
81
|
+
|
|
82
|
+
- [simple-keyboard](https://github.com/hodgef/simple-keyboard) - Javascript Virtual Keyboard
|
|
83
|
+
- [react-simple-keyboard](https://github.com/hodgef/react-simple-keyboard) - React Virtual Keyboard
|
|
84
|
+
- [simple-keyboard-layouts](https://github.com/hodgef/simple-keyboard-layouts) - Keyboard layouts for simple-keyboard
|
|
85
|
+
- [atlas-monaco](https://github.com/datdao/atlas-monaco) - AtlasHCL for monaco editor
|
package/build/index.d.ts
CHANGED
|
@@ -32,6 +32,17 @@ declare module '@posx/core/index' {
|
|
|
32
32
|
export * from '@posx/core/types/condition.type';
|
|
33
33
|
export * from '@posx/core/types/merchant.type';
|
|
34
34
|
|
|
35
|
+
}
|
|
36
|
+
declare module '@posx/core/libs/FindOptions' {
|
|
37
|
+
export const Include: (query?: string) => (val: any) => any;
|
|
38
|
+
export const In: (query?: never[]) => (val: never) => boolean;
|
|
39
|
+
export const Between: (begin: number, end: number) => (val: number) => boolean;
|
|
40
|
+
export const Not: (query?: any) => (val: any, values: any) => boolean;
|
|
41
|
+
export const Raw: (fn: any) => any;
|
|
42
|
+
export const filterByParams: (params: {
|
|
43
|
+
[key: string]: any;
|
|
44
|
+
}) => (values: any) => boolean;
|
|
45
|
+
|
|
35
46
|
}
|
|
36
47
|
declare module '@posx/core/libs/electron.socket' {
|
|
37
48
|
export class ElectronSocket {
|
|
@@ -247,17 +258,6 @@ declare module '@posx/core/libs/escpos.printer' {
|
|
|
247
258
|
items: IPrintCommandLine[];
|
|
248
259
|
}
|
|
249
260
|
|
|
250
|
-
}
|
|
251
|
-
declare module '@posx/core/libs/FindOptions' {
|
|
252
|
-
export const Include: (query?: string) => (val: any) => any;
|
|
253
|
-
export const In: (query?: never[]) => (val: never) => boolean;
|
|
254
|
-
export const Between: (begin: number, end: number) => (val: number) => boolean;
|
|
255
|
-
export const Not: (query?: any) => (val: any, values: any) => boolean;
|
|
256
|
-
export const Raw: (fn: any) => any;
|
|
257
|
-
export const filterByParams: (params: {
|
|
258
|
-
[key: string]: any;
|
|
259
|
-
}) => (values: any) => boolean;
|
|
260
|
-
|
|
261
261
|
}
|
|
262
262
|
declare module '@posx/core/service.factory' {
|
|
263
263
|
import { IServiceOptions } from '@posx/core/types/misc.type';
|
|
@@ -1138,13 +1138,11 @@ declare module '@posx/core/services/invoice.service' {
|
|
|
1138
1138
|
* @param customer - The customer associated with the invoice.
|
|
1139
1139
|
* @param appConfig - The app configuration.
|
|
1140
1140
|
* @param item - The item to add to the invoice line.
|
|
1141
|
-
* @param quantity - The quantity of the item to add.
|
|
1142
|
-
* @param price - The price of the item.
|
|
1143
1141
|
* @param modifiers - An array of modifiers to apply to the item.
|
|
1144
1142
|
* @param options - Additional options for the line.
|
|
1145
1143
|
* @returns The updated invoice.
|
|
1146
1144
|
*/
|
|
1147
|
-
addItemToLine(invoice: IInvoice, customer: ICustomer, appConfig: IAppConfig, item: IItem, modifiers?: IInvoiceCoreLine[], options?: LineOptions):
|
|
1145
|
+
addItemToLine(invoice: IInvoice, customer: ICustomer, appConfig: IAppConfig, item: IItem, modifiers?: IInvoiceCoreLine[], options?: LineOptions): IInvoiceLine;
|
|
1148
1146
|
/**
|
|
1149
1147
|
* Duplicates an invoice line
|
|
1150
1148
|
* @param invoice - The invoice to duplicate the line in.
|
|
@@ -1246,9 +1244,29 @@ declare module '@posx/core/services/invoice.service' {
|
|
|
1246
1244
|
* @returns The updated invoice line.
|
|
1247
1245
|
*/
|
|
1248
1246
|
overwriteNoteToLine(line: IInvoiceLine, note: string): IInvoiceLine;
|
|
1247
|
+
/**
|
|
1248
|
+
* To add combo items under one combo
|
|
1249
|
+
* @param invoice - The invoice to add the item to.
|
|
1250
|
+
* @param customer - The customer associated with the invoice.
|
|
1251
|
+
* @param appConfig - The app configuration.
|
|
1252
|
+
* @param item - The item to add to the invoice line.
|
|
1253
|
+
* @param comboLineUid the main combo's line uid
|
|
1254
|
+
* @param comboGroupUid the uid of the combo_group the item belongs to
|
|
1255
|
+
* @param modifiers - An array of modifiers to apply to the item (default is [])
|
|
1256
|
+
* @param options - Additional options for the line.
|
|
1257
|
+
*/
|
|
1258
|
+
addComboItemToLine(invoice: IInvoice, customer: ICustomer, appConfig: IAppConfig, item: IItem, comboLineUid: string, comboGroupUid: string, modifiers?: IInvoiceCoreLine[], options?: LineOptions): IInvoiceLine;
|
|
1259
|
+
/**
|
|
1260
|
+
* For combo's operations, if a combo is removed, all combo items under it will be removed
|
|
1261
|
+
* Use this operation to remove all combo items
|
|
1262
|
+
* And use minusLineQuantity to remove main combo.
|
|
1263
|
+
* @param invoice the invoice
|
|
1264
|
+
* @param comboLineUid The combo's line uid
|
|
1265
|
+
*/
|
|
1266
|
+
removeAllComboItems(Invoice: IInvoice, comboLineUid: string): IInvoiceLine[];
|
|
1249
1267
|
}
|
|
1250
1268
|
export class LineOperationService extends InvoiceBaseService implements ILineOperationService {
|
|
1251
|
-
addItemToLine(invoice: IInvoice, customer: ICustomer, appConfig: IAppConfig, item: IItem, modifiers?: IInvoiceCoreLine[], lineOptions?: LineOptions):
|
|
1269
|
+
addItemToLine(invoice: IInvoice, customer: ICustomer, appConfig: IAppConfig, item: IItem, modifiers?: IInvoiceCoreLine[], lineOptions?: LineOptions): IInvoiceLine;
|
|
1252
1270
|
duplicateLine(invoice: IInvoice, line: IInvoiceLine): IInvoice;
|
|
1253
1271
|
calibrateDuplicates(invoice: IInvoice): IInvoice;
|
|
1254
1272
|
toInvoiceCoreLine(modifier: ICoreItem, quantity?: number): IInvoiceCoreLine;
|
|
@@ -1272,6 +1290,8 @@ declare module '@posx/core/services/invoice.service' {
|
|
|
1272
1290
|
* @param source
|
|
1273
1291
|
*/
|
|
1274
1292
|
protected compareLines(target: IInvoiceLine, source: IInvoiceLine): boolean;
|
|
1293
|
+
addComboItemToLine(invoice: IInvoice, customer: ICustomer, appConfig: IAppConfig, item: IItem, comboLineUid: string, comboGroupUid: string, modifiers?: IInvoiceCoreLine[], options?: LineOptions): IInvoiceLine;
|
|
1294
|
+
removeAllComboItems(invoice: IInvoice, comboLineUid: string): IInvoiceLine[];
|
|
1275
1295
|
}
|
|
1276
1296
|
/**
|
|
1277
1297
|
* Interface for invoice operation service that extends line operation service
|
|
@@ -1876,10 +1896,16 @@ declare module '@posx/core/types/config.type' {
|
|
|
1876
1896
|
export interface IAppConfig extends IAppCoreModel {
|
|
1877
1897
|
config: IConfig;
|
|
1878
1898
|
cache: ICache;
|
|
1899
|
+
storage: {
|
|
1900
|
+
pricing_lookup_keys: string[];
|
|
1901
|
+
};
|
|
1879
1902
|
}
|
|
1880
1903
|
export class AppConfig extends AppCoreModel implements IAppConfig {
|
|
1881
1904
|
config: Config;
|
|
1882
1905
|
cache: Cache;
|
|
1906
|
+
storage: {
|
|
1907
|
+
pricing_lookup_keys: any[];
|
|
1908
|
+
};
|
|
1883
1909
|
constructor();
|
|
1884
1910
|
}
|
|
1885
1911
|
export interface ICache {
|
|
@@ -2675,6 +2701,14 @@ declare module '@posx/core/types/invoice.type' {
|
|
|
2675
2701
|
is_duplicate: boolean;
|
|
2676
2702
|
/** The line item that this line item is duplicated from. */
|
|
2677
2703
|
duplicated_from_uid: string;
|
|
2704
|
+
/** Whether the line item is a combo. */
|
|
2705
|
+
is_combo: boolean;
|
|
2706
|
+
/** Whether the line item is a combo item. */
|
|
2707
|
+
is_combo_item: boolean;
|
|
2708
|
+
/** Combo group unique id. */
|
|
2709
|
+
combo_group_uid: string;
|
|
2710
|
+
/** Combo line unique id. */
|
|
2711
|
+
combo_line_uid: string;
|
|
2678
2712
|
/** Any modifiers applied to the line item. */
|
|
2679
2713
|
modifiers: IInvoiceCoreLine[];
|
|
2680
2714
|
/** Meta data for the line item */
|
|
@@ -2853,6 +2887,10 @@ declare module '@posx/core/types/invoice.type' {
|
|
|
2853
2887
|
up_size: boolean;
|
|
2854
2888
|
is_take_out: boolean;
|
|
2855
2889
|
is_duplicate: boolean;
|
|
2890
|
+
is_combo: boolean;
|
|
2891
|
+
is_combo_item: boolean;
|
|
2892
|
+
combo_group_uid: string;
|
|
2893
|
+
combo_line_uid: string;
|
|
2856
2894
|
modifiers: any[];
|
|
2857
2895
|
duplicated_from_uid: string;
|
|
2858
2896
|
sent: number;
|
|
@@ -3041,7 +3079,8 @@ declare module '@posx/core/types/misc.type' {
|
|
|
3041
3079
|
EmployeeRole = "emr_",
|
|
3042
3080
|
OrderDisplaySystem = "ods_",
|
|
3043
3081
|
Charge = "chr_",
|
|
3044
|
-
Price = "prc_"
|
|
3082
|
+
Price = "prc_",
|
|
3083
|
+
ComboGroup = "cbo_"
|
|
3045
3084
|
}
|
|
3046
3085
|
export enum ModelType {
|
|
3047
3086
|
Merchant = "mnt",
|
|
@@ -3795,6 +3834,10 @@ declare module '@posx/core/types/product.type' {
|
|
|
3795
3834
|
* The price of the item.
|
|
3796
3835
|
*/
|
|
3797
3836
|
price: number;
|
|
3837
|
+
/**
|
|
3838
|
+
* The original price of the item.
|
|
3839
|
+
*/
|
|
3840
|
+
original_price: number;
|
|
3798
3841
|
/**
|
|
3799
3842
|
* The price list of the item.
|
|
3800
3843
|
*/
|
|
@@ -3832,6 +3875,7 @@ declare module '@posx/core/types/product.type' {
|
|
|
3832
3875
|
barcode: string;
|
|
3833
3876
|
category_uid: string;
|
|
3834
3877
|
price: number;
|
|
3878
|
+
original_price: number;
|
|
3835
3879
|
prices: Array<IPrice>;
|
|
3836
3880
|
stock: number;
|
|
3837
3881
|
print_on_receipt: boolean;
|
|
@@ -3867,7 +3911,7 @@ declare module '@posx/core/types/product.type' {
|
|
|
3867
3911
|
unit: number;
|
|
3868
3912
|
/**
|
|
3869
3913
|
* Number of items sold
|
|
3870
|
-
|
|
3914
|
+
* @ignore
|
|
3871
3915
|
*/
|
|
3872
3916
|
sold: number;
|
|
3873
3917
|
/**
|
|
@@ -3898,7 +3942,7 @@ declare module '@posx/core/types/product.type' {
|
|
|
3898
3942
|
likes: number;
|
|
3899
3943
|
/**
|
|
3900
3944
|
* Number of dislikes for the item
|
|
3901
|
-
|
|
3945
|
+
* @ignore
|
|
3902
3946
|
*/
|
|
3903
3947
|
dislikes: number;
|
|
3904
3948
|
/**
|
|
@@ -3953,6 +3997,10 @@ declare module '@posx/core/types/product.type' {
|
|
|
3953
3997
|
* if price editor will be opened by default when item is clicked
|
|
3954
3998
|
*/
|
|
3955
3999
|
open_price_editor: boolean;
|
|
4000
|
+
/**
|
|
4001
|
+
* Combo groups (only applicable when type is ProductType.Combo)
|
|
4002
|
+
*/
|
|
4003
|
+
combo_groups: IComboGroup[];
|
|
3956
4004
|
}
|
|
3957
4005
|
export class Item extends CoreItem implements IItem {
|
|
3958
4006
|
codename: string;
|
|
@@ -3989,6 +4037,7 @@ declare module '@posx/core/types/product.type' {
|
|
|
3989
4037
|
label_printers_uids: any[];
|
|
3990
4038
|
open_editor_panel: boolean;
|
|
3991
4039
|
open_price_editor: boolean;
|
|
4040
|
+
combo_groups: IComboGroup[];
|
|
3992
4041
|
constructor();
|
|
3993
4042
|
}
|
|
3994
4043
|
export interface IPrice extends IAppCoreModel {
|
|
@@ -4006,6 +4055,93 @@ declare module '@posx/core/types/product.type' {
|
|
|
4006
4055
|
amount: number;
|
|
4007
4056
|
constructor();
|
|
4008
4057
|
}
|
|
4058
|
+
/**
|
|
4059
|
+
* COMBO PRODUCT IMPLEMENTATION
|
|
4060
|
+
*
|
|
4061
|
+
* Combo products bundle multiple existing products together and sell them as a group,
|
|
4062
|
+
* usually at a discount. This implementation provides minimal impact on existing data structures.
|
|
4063
|
+
*
|
|
4064
|
+
* Usage:
|
|
4065
|
+
* 1. Create combo product with type = ProductType.Combo
|
|
4066
|
+
* 2. Define combo_groups array with component groups and available items
|
|
4067
|
+
* 3. Set combo discount (either amount or percentage)
|
|
4068
|
+
* 4. When adding to invoice, combo appears as single line with selections in combo_components
|
|
4069
|
+
*
|
|
4070
|
+
* Example:
|
|
4071
|
+
* ```
|
|
4072
|
+
* const combo: IItem = {
|
|
4073
|
+
* type: ProductType.Combo,
|
|
4074
|
+
* combo_groups: [
|
|
4075
|
+
* {
|
|
4076
|
+
* name: "Choose your main",
|
|
4077
|
+
* min_selections: 1,
|
|
4078
|
+
* max_selections: 1,
|
|
4079
|
+
* required: true,
|
|
4080
|
+
* items: [
|
|
4081
|
+
* { item_uid: 'burger_uid', is_default: true },
|
|
4082
|
+
* { item_uid: 'chicken_uid', price_override: 2.00 }
|
|
4083
|
+
* ]
|
|
4084
|
+
* },
|
|
4085
|
+
* {
|
|
4086
|
+
* name: "Pick a side",
|
|
4087
|
+
* min_selections: 1,
|
|
4088
|
+
* max_selections: 1,
|
|
4089
|
+
* required: true,
|
|
4090
|
+
* items: [
|
|
4091
|
+
* { item_uid: 'fries_uid', is_default: true },
|
|
4092
|
+
* { item_uid: 'onion_rings_uid', price_override: 1.50 }
|
|
4093
|
+
* ]
|
|
4094
|
+
* }
|
|
4095
|
+
* ],
|
|
4096
|
+
* combo_discount_percent: 15 // 15% discount
|
|
4097
|
+
* }
|
|
4098
|
+
* ```
|
|
4099
|
+
*/
|
|
4100
|
+
/**
|
|
4101
|
+
* Interface for individual items within a combo group
|
|
4102
|
+
*/
|
|
4103
|
+
export interface IComboGroupItem extends IAppModelSequence {
|
|
4104
|
+
/** Item unique id */
|
|
4105
|
+
item_uid: string;
|
|
4106
|
+
/** Combo item */
|
|
4107
|
+
combo_item: ICoreItem;
|
|
4108
|
+
/** Price of the item in combo */
|
|
4109
|
+
price: number;
|
|
4110
|
+
}
|
|
4111
|
+
/**
|
|
4112
|
+
* Interface for combo component groups (e.g., "Main Course", "Side", "Drink")
|
|
4113
|
+
*/
|
|
4114
|
+
export interface IComboGroup extends IAppModelSequence {
|
|
4115
|
+
/** Group unique id */
|
|
4116
|
+
uid: string;
|
|
4117
|
+
/** Group name (e.g., "Choose your main", "Pick a side") */
|
|
4118
|
+
name: string;
|
|
4119
|
+
/** Translations of the name */
|
|
4120
|
+
name_translations: Record<string, string>;
|
|
4121
|
+
/** Minimum selections required from this group */
|
|
4122
|
+
min_order: number;
|
|
4123
|
+
/** Maximum selections allowed from this group */
|
|
4124
|
+
max_order: number;
|
|
4125
|
+
/** Available items in this group */
|
|
4126
|
+
combo_items: IComboGroupItem[];
|
|
4127
|
+
}
|
|
4128
|
+
export class ComboGroupItem implements IComboGroupItem {
|
|
4129
|
+
item_uid: string;
|
|
4130
|
+
combo_item: CoreItem;
|
|
4131
|
+
price: number;
|
|
4132
|
+
sequence: number;
|
|
4133
|
+
constructor();
|
|
4134
|
+
}
|
|
4135
|
+
export class ComboGroup implements IComboGroup {
|
|
4136
|
+
uid: string;
|
|
4137
|
+
name: string;
|
|
4138
|
+
name_translations: Record<string, string>;
|
|
4139
|
+
min_order: number;
|
|
4140
|
+
max_order: number;
|
|
4141
|
+
combo_items: IComboGroupItem[];
|
|
4142
|
+
sequence: number;
|
|
4143
|
+
constructor();
|
|
4144
|
+
}
|
|
4009
4145
|
|
|
4010
4146
|
}
|
|
4011
4147
|
declare module '@posx/core/types/report.type' {
|