@posx/core 5.5.367 → 5.5.371
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 +24 -0
- package/build/index.js +50 -4
- package/package.json +1 -1
- package/package.publish.json +1 -1
package/build/index.d.ts
CHANGED
|
@@ -1524,6 +1524,8 @@ interface ISectionItem extends IAppBaseModel {
|
|
|
1524
1524
|
receipt_printer_uid: string;
|
|
1525
1525
|
/** Check printer UID for this section item */
|
|
1526
1526
|
check_printer_uid: string;
|
|
1527
|
+
/** QR printer UID for this section item */
|
|
1528
|
+
qr_printer_uid: string;
|
|
1527
1529
|
/** Total amount */
|
|
1528
1530
|
total: number;
|
|
1529
1531
|
/** Time duration */
|
|
@@ -1557,12 +1559,14 @@ interface ISectionItem extends IAppBaseModel {
|
|
|
1557
1559
|
/** Soup base type */
|
|
1558
1560
|
soup_base_type: number;
|
|
1559
1561
|
meta: Record<string, any>;
|
|
1562
|
+
customer: Record<string, any>;
|
|
1560
1563
|
}
|
|
1561
1564
|
declare class SectionItem extends AppBaseModel implements ISectionItem {
|
|
1562
1565
|
printer_id_order_list: number[];
|
|
1563
1566
|
order_printer_uids: string[];
|
|
1564
1567
|
receipt_printer_uid: string;
|
|
1565
1568
|
check_printer_uid: string;
|
|
1569
|
+
qr_printer_uid: string;
|
|
1566
1570
|
total: number;
|
|
1567
1571
|
time: number;
|
|
1568
1572
|
pax: number;
|
|
@@ -1582,6 +1586,7 @@ declare class SectionItem extends AppBaseModel implements ISectionItem {
|
|
|
1582
1586
|
soup_base_type: number;
|
|
1583
1587
|
is_delete: boolean;
|
|
1584
1588
|
meta: Record<string, any>;
|
|
1589
|
+
customer: Record<string, any>;
|
|
1585
1590
|
constructor();
|
|
1586
1591
|
}
|
|
1587
1592
|
type ISection = IAppBaseModel & IAppModelSequence;
|
|
@@ -3941,6 +3946,8 @@ declare class PaymentSummary implements IPaymentSummary {
|
|
|
3941
3946
|
type ILoyaltyProgramSummary = {
|
|
3942
3947
|
add_credit_total: number;
|
|
3943
3948
|
add_credit_count: number;
|
|
3949
|
+
topup_paid_total: number;
|
|
3950
|
+
topup_paid_count: number;
|
|
3944
3951
|
rewarded_credit_total: number;
|
|
3945
3952
|
rewarded_credit_count: number;
|
|
3946
3953
|
minus_credit_total: number;
|
|
@@ -3953,6 +3960,8 @@ type ILoyaltyProgramSummary = {
|
|
|
3953
3960
|
declare class LoyaltyProgramSummary implements ILoyaltyProgramSummary {
|
|
3954
3961
|
add_credit_total: number;
|
|
3955
3962
|
add_credit_count: number;
|
|
3963
|
+
topup_paid_total: number;
|
|
3964
|
+
topup_paid_count: number;
|
|
3956
3965
|
rewarded_credit_total: number;
|
|
3957
3966
|
rewarded_credit_count: number;
|
|
3958
3967
|
minus_credit_total: number;
|
|
@@ -4367,6 +4376,17 @@ interface ISectionItemService extends IAppRemoteService<ISectionItem> {
|
|
|
4367
4376
|
* @returns A promise that resolves with the updated section item.
|
|
4368
4377
|
*/
|
|
4369
4378
|
changeToTakeOut(uid: string): Promise<ISectionItem>;
|
|
4379
|
+
/**
|
|
4380
|
+
* Resets section item data (total, pax, customer) to default values.
|
|
4381
|
+
* @param sectionItem - The section item to reset.
|
|
4382
|
+
*/
|
|
4383
|
+
reset(sectionItem: ISectionItem): void;
|
|
4384
|
+
/**
|
|
4385
|
+
* Syncs invoice data (total, pax, customer) to section item.
|
|
4386
|
+
* @param sectionItem - The section item to sync to.
|
|
4387
|
+
* @param invoice - The invoice to sync from.
|
|
4388
|
+
*/
|
|
4389
|
+
syncInvoiceData(sectionItem: ISectionItem, invoice: IInvoice): void;
|
|
4370
4390
|
}
|
|
4371
4391
|
/**
|
|
4372
4392
|
* Represents a service for managing employees.
|
|
@@ -4631,6 +4651,8 @@ declare class SectionItemService extends AppRemoteService<ISectionItem> implemen
|
|
|
4631
4651
|
readonly methodName: string;
|
|
4632
4652
|
constructor(http: AxiosInstance$3, db: Dexie, options: IServiceOptions, moduleName?: string, methodName?: string);
|
|
4633
4653
|
changeToTakeOut(uid: string): Promise<ISectionItem>;
|
|
4654
|
+
reset(sectionItem: ISectionItem): void;
|
|
4655
|
+
syncInvoiceData(sectionItem: ISectionItem, invoice: IInvoice): void;
|
|
4634
4656
|
}
|
|
4635
4657
|
type IProductService = IAppRemoteService<IItem>;
|
|
4636
4658
|
declare class ProductService extends AppRemoteService<IItem> implements IProductService {
|
|
@@ -4710,6 +4732,7 @@ interface IPaymentMethodService extends IAppRemoteService<IPaymentMethod> {
|
|
|
4710
4732
|
disablePaymentMethod(paymentMethod: IPaymentMethod): Promise<IPaymentMethod>;
|
|
4711
4733
|
/**
|
|
4712
4734
|
* Changes the sequence of a payment method.
|
|
4735
|
+
* @deprecated Use AppMiscService.changeSequence instead
|
|
4713
4736
|
* @param paymentMethod - The payment method to change the sequence of.
|
|
4714
4737
|
* @param sequence - The new sequence number for the payment method.
|
|
4715
4738
|
* @returns A promise that resolves with the updated IPaymentMethod object.
|
|
@@ -4726,6 +4749,7 @@ declare class PaymentMethodService extends AppRemoteService<IPaymentMethod> impl
|
|
|
4726
4749
|
syncStandardPaymentMethods(): Promise<IPaymentMethod[]>;
|
|
4727
4750
|
enablePaymentMethod(paymentMethod: IPaymentMethod): Promise<IPaymentMethod>;
|
|
4728
4751
|
disablePaymentMethod(paymentMethod: IPaymentMethod): Promise<IPaymentMethod>;
|
|
4752
|
+
/** @deprecated Use AppMiscService.changeSequence instead */
|
|
4729
4753
|
changeSequence(paymentMethod: IPaymentMethod, sequence: number): Promise<IPaymentMethod>;
|
|
4730
4754
|
}
|
|
4731
4755
|
/**
|
package/build/index.js
CHANGED
|
@@ -421,6 +421,7 @@ var SectionItem = class extends AppBaseModel {
|
|
|
421
421
|
_defineProperty(this, "order_printer_uids", []);
|
|
422
422
|
_defineProperty(this, "receipt_printer_uid", "");
|
|
423
423
|
_defineProperty(this, "check_printer_uid", "");
|
|
424
|
+
_defineProperty(this, "qr_printer_uid", "");
|
|
424
425
|
_defineProperty(this, "total", 0);
|
|
425
426
|
_defineProperty(this, "time", 0);
|
|
426
427
|
_defineProperty(this, "pax", 0);
|
|
@@ -440,6 +441,7 @@ var SectionItem = class extends AppBaseModel {
|
|
|
440
441
|
_defineProperty(this, "soup_base_type", 0);
|
|
441
442
|
_defineProperty(this, "is_delete", false);
|
|
442
443
|
_defineProperty(this, "meta", {});
|
|
444
|
+
_defineProperty(this, "customer", {});
|
|
443
445
|
}
|
|
444
446
|
};
|
|
445
447
|
var Section = class extends AppBaseModel {
|
|
@@ -2396,6 +2398,8 @@ var LoyaltyProgramSummary = class {
|
|
|
2396
2398
|
constructor() {
|
|
2397
2399
|
_defineProperty(this, "add_credit_total", 0);
|
|
2398
2400
|
_defineProperty(this, "add_credit_count", 0);
|
|
2401
|
+
_defineProperty(this, "topup_paid_total", 0);
|
|
2402
|
+
_defineProperty(this, "topup_paid_count", 0);
|
|
2399
2403
|
_defineProperty(this, "rewarded_credit_total", 0);
|
|
2400
2404
|
_defineProperty(this, "rewarded_credit_count", 0);
|
|
2401
2405
|
_defineProperty(this, "minus_credit_total", 0);
|
|
@@ -3838,8 +3842,7 @@ var InvoiceOperationService = class extends LineOperationService {
|
|
|
3838
3842
|
invoice.table_uid = sectionItem.uid;
|
|
3839
3843
|
sectionItem.invoice_uid = invoice.uid;
|
|
3840
3844
|
sectionItem.status = SectionItemStatus.OPENED;
|
|
3841
|
-
sectionItem
|
|
3842
|
-
sectionItem.pax = invoice.pax;
|
|
3845
|
+
this.sectionItemService.syncInvoiceData(sectionItem, invoice);
|
|
3843
3846
|
this.addEmployeeToInvoice(invoice, employee);
|
|
3844
3847
|
invoice.created_at = /* @__PURE__ */ new Date();
|
|
3845
3848
|
invoice.created_at_timestamp = invoice.created_at.getTime();
|
|
@@ -3883,8 +3886,7 @@ var InvoiceOperationService = class extends LineOperationService {
|
|
|
3883
3886
|
}
|
|
3884
3887
|
}
|
|
3885
3888
|
async updateInvoice(invoice, sectionItem, employee) {
|
|
3886
|
-
sectionItem
|
|
3887
|
-
sectionItem.pax = invoice.pax;
|
|
3889
|
+
this.sectionItemService.syncInvoiceData(sectionItem, invoice);
|
|
3888
3890
|
this.addEmployeeToInvoice(invoice, employee);
|
|
3889
3891
|
invoice.updated_at = /* @__PURE__ */ new Date();
|
|
3890
3892
|
const kitchenPrintJobs = await this.createKitchenPrintJobs(invoice);
|
|
@@ -3940,6 +3942,7 @@ var InvoiceOperationService = class extends LineOperationService {
|
|
|
3940
3942
|
invoice.status = InvoiceStatus.Void;
|
|
3941
3943
|
sectionItem.invoice_uid = "";
|
|
3942
3944
|
sectionItem.status = SectionItemStatus.CLOSED;
|
|
3945
|
+
this.sectionItemService.reset(sectionItem);
|
|
3943
3946
|
this.addEmployeeToInvoice(invoice, employee);
|
|
3944
3947
|
const billPrintJob = await this.createReceiptPrintJob(invoice, PrinterType.ReceiptPrinter, true);
|
|
3945
3948
|
const options = {
|
|
@@ -4011,8 +4014,10 @@ var InvoiceOperationService = class extends LineOperationService {
|
|
|
4011
4014
|
if (invoice.lines == null || invoice.lines.length <= 0) throw new SystemError("source table has nothing to switch");
|
|
4012
4015
|
targetSectionItem.invoice_uid = invoice.uid;
|
|
4013
4016
|
targetSectionItem.status = sourceSectionItem.status;
|
|
4017
|
+
this.sectionItemService.syncInvoiceData(targetSectionItem, invoice);
|
|
4014
4018
|
sourceSectionItem.invoice_uid = "";
|
|
4015
4019
|
sourceSectionItem.status = SectionItemStatus.CLOSED;
|
|
4020
|
+
this.sectionItemService.reset(sourceSectionItem);
|
|
4016
4021
|
invoice.table_uid = targetSectionItem.uid;
|
|
4017
4022
|
invoice.table_name = targetSectionItem.name;
|
|
4018
4023
|
this.addEmployeeToInvoice(invoice, employee);
|
|
@@ -4041,6 +4046,7 @@ var InvoiceOperationService = class extends LineOperationService {
|
|
|
4041
4046
|
invoice.status = InvoiceStatus.Paid;
|
|
4042
4047
|
sectionItem.invoice_uid = "";
|
|
4043
4048
|
sectionItem.status = SectionItemStatus.CLOSED;
|
|
4049
|
+
this.sectionItemService.reset(sectionItem);
|
|
4044
4050
|
this.addEmployeeToInvoice(invoice, employee);
|
|
4045
4051
|
invoice.paid_at = /* @__PURE__ */ new Date();
|
|
4046
4052
|
const config = (await this.configService.getDefaultOne()).config;
|
|
@@ -5056,6 +5062,19 @@ var SectionItemService = class extends AppRemoteService {
|
|
|
5056
5062
|
item.is_take_out = !item.is_take_out;
|
|
5057
5063
|
return this.updateOne(item.id_in_server, item);
|
|
5058
5064
|
}
|
|
5065
|
+
reset(sectionItem) {
|
|
5066
|
+
sectionItem.total = 0;
|
|
5067
|
+
sectionItem.pax = 0;
|
|
5068
|
+
sectionItem.customer = {};
|
|
5069
|
+
}
|
|
5070
|
+
syncInvoiceData(sectionItem, invoice) {
|
|
5071
|
+
sectionItem.total = invoice.grand_total;
|
|
5072
|
+
sectionItem.pax = invoice.pax;
|
|
5073
|
+
sectionItem.customer = {
|
|
5074
|
+
name: invoice.customer?.display_name || "",
|
|
5075
|
+
phone: invoice.customer?.phone_number || ""
|
|
5076
|
+
};
|
|
5077
|
+
}
|
|
5059
5078
|
};
|
|
5060
5079
|
var ProductService = class extends AppRemoteService {
|
|
5061
5080
|
constructor(http, db, options, moduleName = "products", methodName = "product") {
|
|
@@ -5197,6 +5216,7 @@ var PaymentMethodService = class extends AppRemoteService {
|
|
|
5197
5216
|
paymentMethod.is_disabled = true;
|
|
5198
5217
|
return this.updateOne(paymentMethod.id_in_server, paymentMethod);
|
|
5199
5218
|
}
|
|
5219
|
+
/** @deprecated Use AppMiscService.changeSequence instead */
|
|
5200
5220
|
async changeSequence(paymentMethod, sequence) {
|
|
5201
5221
|
const otherMethods = (await this.db.table(this.moduleName).filter((pm) => !pm.is_disabled).sortBy("sequence")).filter((pm) => pm.id_in_server !== paymentMethod.id_in_server);
|
|
5202
5222
|
if (sequence < 0) sequence = 0;
|
|
@@ -5360,8 +5380,30 @@ var AppReportService = class extends AppRemoteService {
|
|
|
5360
5380
|
reportData.sales_summary.tax_total += invoice.tax;
|
|
5361
5381
|
reportData.sales_summary.service_charge_total += invoice.service_charge;
|
|
5362
5382
|
reportData.sales_summary.discount_total += invoice.discount_amount;
|
|
5383
|
+
if (invoice.add_credit > 0) {
|
|
5384
|
+
reportData.loyalty_program_summary.add_credit_total += invoice.add_credit;
|
|
5385
|
+
reportData.loyalty_program_summary.add_credit_count++;
|
|
5386
|
+
reportData.loyalty_program_summary.topup_paid_count++;
|
|
5387
|
+
}
|
|
5388
|
+
if (invoice.rewarded_credit > 0) {
|
|
5389
|
+
reportData.loyalty_program_summary.rewarded_credit_total += invoice.rewarded_credit;
|
|
5390
|
+
reportData.loyalty_program_summary.rewarded_credit_count++;
|
|
5391
|
+
}
|
|
5392
|
+
if (invoice.minus_credit > 0) {
|
|
5393
|
+
reportData.loyalty_program_summary.minus_credit_total += invoice.minus_credit;
|
|
5394
|
+
reportData.loyalty_program_summary.minus_credit_count++;
|
|
5395
|
+
}
|
|
5396
|
+
if (invoice.rewarded_point > 0) {
|
|
5397
|
+
reportData.loyalty_program_summary.rewarded_point_total += invoice.rewarded_point;
|
|
5398
|
+
reportData.loyalty_program_summary.rewarded_point_count++;
|
|
5399
|
+
}
|
|
5400
|
+
if (invoice.minus_point > 0) {
|
|
5401
|
+
reportData.loyalty_program_summary.minus_point_total += invoice.minus_point;
|
|
5402
|
+
reportData.loyalty_program_summary.minus_point_count++;
|
|
5403
|
+
}
|
|
5363
5404
|
reportData.sales_summary.total_pax += invoice.pax;
|
|
5364
5405
|
invoice.lines.forEach((line) => {
|
|
5406
|
+
if (line.item.add_credit > 0) reportData.loyalty_program_summary.topup_paid_total += line.subtotal;
|
|
5365
5407
|
const itemKey = this.generateItemKey(line);
|
|
5366
5408
|
let existingItem = itemSalesMap.get(itemKey);
|
|
5367
5409
|
if (existingItem) {
|
|
@@ -5497,6 +5539,10 @@ var AppReportService = class extends AppRemoteService {
|
|
|
5497
5539
|
reportData.sales_summary.discount_total = preciseRound(reportData.sales_summary.discount_total);
|
|
5498
5540
|
reportData.sales_summary.foc_sales_total = preciseRound(reportData.sales_summary.foc_sales_total);
|
|
5499
5541
|
reportData.sales_summary.void_invoice_total = preciseRound(reportData.sales_summary.void_invoice_total);
|
|
5542
|
+
reportData.loyalty_program_summary.add_credit_total = preciseRound(reportData.loyalty_program_summary.add_credit_total);
|
|
5543
|
+
reportData.loyalty_program_summary.topup_paid_total = preciseRound(reportData.loyalty_program_summary.topup_paid_total);
|
|
5544
|
+
reportData.loyalty_program_summary.rewarded_credit_total = preciseRound(reportData.loyalty_program_summary.rewarded_credit_total);
|
|
5545
|
+
reportData.loyalty_program_summary.minus_credit_total = preciseRound(reportData.loyalty_program_summary.minus_credit_total);
|
|
5500
5546
|
return reportData;
|
|
5501
5547
|
}
|
|
5502
5548
|
/**
|
package/package.json
CHANGED