@posx/core 5.5.363 → 5.5.367

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/build/index.d.ts CHANGED
@@ -2725,15 +2725,15 @@ interface IInvoiceCoreLine {
2725
2725
  unit_of_measure: UomType;
2726
2726
  /** Quantity if it is quantity, e.g. 5*/
2727
2727
  quantity: number;
2728
- /** 已发送到厨房的数量,如 qty=5, sent=3 表示还有2个未发送 */
2729
- /** minusLineQuantity (quantity - sent) 计算可自由删除的未发送数量 */
2728
+ /** Whether it is sent to server, e.g. send = 3, it means 2 items are not sent to server*/
2729
+ /** item A, qty = 5 sent 3 => kitchen slip will show quantity 2 on item A */
2730
2730
  sent: number;
2731
- /** UI标志,用于Order List区分已下单/未下单,应与 sent > 0 同步 */
2732
- is_sent: boolean;
2733
2731
  /** Whether cancel slip is printed */
2734
2732
  is_cancel_printed: boolean;
2735
2733
  /** Whether it is selected */
2736
2734
  selected: boolean;
2735
+ /** Sales user uid for this line item */
2736
+ sales_user_uid: string;
2737
2737
  }
2738
2738
  /**
2739
2739
  * Represents a line item on an invoice.
@@ -2863,7 +2863,7 @@ interface IInvoice extends IAppCoreModel {
2863
2863
  customer_id: number;
2864
2864
  /** Remark */
2865
2865
  remark: string;
2866
- /** Sales User ID */
2866
+ /** Sales User UID */
2867
2867
  sales_user_uid: string;
2868
2868
  /** Status */
2869
2869
  status: InvoiceStatus;
@@ -2944,9 +2944,9 @@ declare class InvoiceCoreLine implements IInvoiceCoreLine {
2944
2944
  unit_of_measure: UomType;
2945
2945
  quantity: number;
2946
2946
  sent: number;
2947
- is_sent: boolean;
2948
2947
  is_cancel_printed: boolean;
2949
2948
  selected: boolean;
2949
+ sales_user_uid: string;
2950
2950
  constructor();
2951
2951
  }
2952
2952
  declare class InvoiceLine extends AppCoreModel implements IInvoiceLine {
@@ -2974,9 +2974,9 @@ declare class InvoiceLine extends AppCoreModel implements IInvoiceLine {
2974
2974
  modifiers: any[];
2975
2975
  duplicated_from_uid: string;
2976
2976
  sent: number;
2977
- is_sent: boolean;
2978
2977
  is_cancel_printed: boolean;
2979
2978
  selected: boolean;
2979
+ sales_user_uid: string;
2980
2980
  meta: {};
2981
2981
  constructor();
2982
2982
  }
@@ -4281,6 +4281,8 @@ interface IEmployee extends IAppCoreModel {
4281
4281
  role_uid: string;
4282
4282
  /** language preference */
4283
4283
  language: string;
4284
+ /** Whether employee can login to the system */
4285
+ can_login: boolean;
4284
4286
  }
4285
4287
  declare class Employee extends AppCoreModel implements IEmployee {
4286
4288
  user_uid: string;
@@ -4290,6 +4292,7 @@ declare class Employee extends AppCoreModel implements IEmployee {
4290
4292
  uid: string;
4291
4293
  role_uid: string;
4292
4294
  language: string;
4295
+ can_login: boolean;
4293
4296
  constructor();
4294
4297
  }
4295
4298
  //#endregion
@@ -5097,7 +5100,6 @@ type LineOptions = {
5097
5100
  quantity?: number;
5098
5101
  price?: number;
5099
5102
  remark?: string;
5100
- is_sent?: boolean;
5101
5103
  };
5102
5104
  declare class InvoiceBaseService extends AppRemoteService<IInvoice> implements IInvoiceBaseService {
5103
5105
  readonly http: AxiosInstance;
@@ -5386,7 +5388,7 @@ declare class LineOperationService extends InvoiceBaseService implements ILineOp
5386
5388
  addModifierQuantity(modifiers: IInvoiceCoreLine[], modifier: IInvoiceCoreLine, quantity?: number): IInvoiceCoreLine[];
5387
5389
  changeModifierPrice(modifier: IInvoiceCoreLine, price: number): IInvoiceCoreLine;
5388
5390
  overwriteNoteToLine(line: IInvoiceLine, note: string): IInvoiceLine;
5389
- findOrCreateLine(invoice: IInvoice, item: IItem, quantity: number, price?: number, modifiers?: IInvoiceCoreLine[], remark?: string, createNewLine?: boolean, comboLineUid?: string, comboGroupUid?: string, is_sent?: boolean): IInvoiceLine;
5391
+ findOrCreateLine(invoice: IInvoice, item: IItem, quantity: number, price?: number, modifiers?: IInvoiceCoreLine[], remark?: string, createNewLine?: boolean, comboLineUid?: string, comboGroupUid?: string): IInvoiceLine;
5390
5392
  private createInvoiceLine;
5391
5393
  protected compareModifiers(target: IInvoiceCoreLine[], source: IInvoiceCoreLine[]): boolean;
5392
5394
  /**
package/build/index.js CHANGED
@@ -1715,9 +1715,9 @@ var InvoiceCoreLine = class {
1715
1715
  _defineProperty(this, "unit_of_measure", UomType.quantity);
1716
1716
  _defineProperty(this, "quantity", 0);
1717
1717
  _defineProperty(this, "sent", 0);
1718
- _defineProperty(this, "is_sent", false);
1719
1718
  _defineProperty(this, "is_cancel_printed", false);
1720
1719
  _defineProperty(this, "selected", false);
1720
+ _defineProperty(this, "sales_user_uid", "");
1721
1721
  }
1722
1722
  };
1723
1723
  var InvoiceLine = class extends AppCoreModel {
@@ -1747,9 +1747,9 @@ var InvoiceLine = class extends AppCoreModel {
1747
1747
  _defineProperty(this, "modifiers", []);
1748
1748
  _defineProperty(this, "duplicated_from_uid", "");
1749
1749
  _defineProperty(this, "sent", 0);
1750
- _defineProperty(this, "is_sent", false);
1751
1750
  _defineProperty(this, "is_cancel_printed", false);
1752
1751
  _defineProperty(this, "selected", false);
1752
+ _defineProperty(this, "sales_user_uid", "");
1753
1753
  _defineProperty(this, "meta", {});
1754
1754
  }
1755
1755
  };
@@ -1843,6 +1843,7 @@ var Employee = class extends AppCoreModel {
1843
1843
  _defineProperty(this, "uid", ModelPrefix.Employee + nanoid());
1844
1844
  _defineProperty(this, "role_uid", "");
1845
1845
  _defineProperty(this, "language", "en");
1846
+ _defineProperty(this, "can_login", true);
1846
1847
  }
1847
1848
  };
1848
1849
 
@@ -3624,7 +3625,7 @@ var LineOperationService = class extends InvoiceBaseService {
3624
3625
  ...lineOptions
3625
3626
  };
3626
3627
  if (invoice.lines == null) invoice.lines = [];
3627
- const line = this.findOrCreateLine(invoice, item, options.quantity, options.price, modifiers, options.remark, createNewLine, comboLineUid, comboGroupUid, options.is_sent);
3628
+ const line = this.findOrCreateLine(invoice, item, options.quantity, options.price, modifiers, options.remark, createNewLine, comboLineUid, comboGroupUid);
3628
3629
  if (item.type == ProductType.Combo) line.is_combo = true;
3629
3630
  if (line.uid) {
3630
3631
  line.quantity += options.quantity;
@@ -3745,7 +3746,7 @@ var LineOperationService = class extends InvoiceBaseService {
3745
3746
  line.remark = note;
3746
3747
  return line;
3747
3748
  }
3748
- findOrCreateLine(invoice, item, quantity, price = 0, modifiers = [], remark = "", createNewLine = false, comboLineUid, comboGroupUid, is_sent) {
3749
+ findOrCreateLine(invoice, item, quantity, price = 0, modifiers = [], remark = "", createNewLine = false, comboLineUid, comboGroupUid) {
3749
3750
  price = price ?? item.price;
3750
3751
  if (!invoice.lines || invoice.lines.length <= 0 || createNewLine) return this.createInvoiceLine(item, quantity, price, modifiers, remark);
3751
3752
  else {
@@ -3754,7 +3755,7 @@ var LineOperationService = class extends InvoiceBaseService {
3754
3755
  else {
3755
3756
  if (comboLineUid && comboGroupUid) {
3756
3757
  for (const line of lines.filter((l) => l.is_combo_item)) if (this.compareModifiers(line.modifiers, modifiers) && line.remark === remark && line.price === price && line.combo_line_uid === comboLineUid && line.combo_group_uid === comboGroupUid) return line;
3757
- } else for (const line of lines) if (this.compareModifiers(line.modifiers, modifiers) && line.remark === remark && line.price === price && !line.is_take_out && (is_sent === void 0 || line.is_sent === is_sent)) return line;
3758
+ } else for (const line of lines) if (this.compareModifiers(line.modifiers, modifiers) && line.remark === remark && line.price === price && !line.is_take_out) return line;
3758
3759
  return this.createInvoiceLine(item, quantity, price, modifiers, remark);
3759
3760
  }
3760
3761
  }
@@ -4009,7 +4010,7 @@ var InvoiceOperationService = class extends LineOperationService {
4009
4010
  if (targetSectionItem.status != SectionItemStatus.CLOSED) throw new SystemError("target table is occupied");
4010
4011
  if (invoice.lines == null || invoice.lines.length <= 0) throw new SystemError("source table has nothing to switch");
4011
4012
  targetSectionItem.invoice_uid = invoice.uid;
4012
- targetSectionItem.status = SectionItemStatus.OPENED;
4013
+ targetSectionItem.status = sourceSectionItem.status;
4013
4014
  sourceSectionItem.invoice_uid = "";
4014
4015
  sourceSectionItem.status = SectionItemStatus.CLOSED;
4015
4016
  invoice.table_uid = targetSectionItem.uid;
@@ -4214,7 +4215,8 @@ var InvoiceOperationService = class extends LineOperationService {
4214
4215
  if (!response.results || response.results.length <= 0) throw new SystemError("The invoice does not have a receipt");
4215
4216
  printJob = response.results[0];
4216
4217
  }
4217
- const printer = await this.printerService.getDefaultReceiptPrinter();
4218
+ let printer = await this.printerService.getOne(printJob.printer_uid);
4219
+ if (!printer) printer = await this.printerService.getDefaultReceiptPrinter();
4218
4220
  if (!printer) throw new SystemError("Receipt printer not found");
4219
4221
  printJob = this.printJobService.replacePrinter(printJob, printer);
4220
4222
  printJob.uid = ModelPrefix.PrintJob + nanoid();
@@ -4589,10 +4591,7 @@ var InvoiceOperationService = class extends LineOperationService {
4589
4591
  });
4590
4592
  }
4591
4593
  async preprocessInvoice(invoice) {
4592
- if (invoice.lines) for (const line of invoice.lines) {
4593
- line.sent = line.quantity;
4594
- line.is_sent = true;
4595
- }
4594
+ if (invoice.lines) for (const line of invoice.lines) line.sent = line.quantity;
4596
4595
  return invoice;
4597
4596
  }
4598
4597
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@posx/core",
3
- "version": "5.5.363",
3
+ "version": "5.5.367",
4
4
  "description": "POSX core libraries",
5
5
  "main": "./build/index.js",
6
6
  "author": "Steven Lee",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@posx/core",
3
- "version": "5.5.363",
3
+ "version": "5.5.367",
4
4
  "description": "POSX core libraries",
5
5
  "type": "module",
6
6
  "main": "./build/index.js",