vhobjects-user 1.0.8 → 1.0.9

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.
@@ -18,6 +18,10 @@ export declare class AtwButtonQuantity implements OnInit {
18
18
  ngOnChanges(changes: SimpleChanges): void;
19
19
  decAmount(): void;
20
20
  incAmount(): void;
21
+ onInput(event: Event): void;
22
+ onBlur(event: Event): void;
23
+ /** Giới hạn value trong [1, max]; max = tồn kho - số lượng đang có trong giỏ */
24
+ private clamp;
21
25
  static ɵfac: i0.ɵɵFactoryDeclaration<AtwButtonQuantity, never>;
22
26
  static ɵcmp: i0.ɵɵComponentDeclaration<AtwButtonQuantity, "atw-button-quantity", never, { "product": "product"; "device": "device"; "data": "data"; "type": "type"; }, {}, never, never>;
23
27
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vhobjects-user",
3
- "version": "1.0.8",
3
+ "version": "1.0.9",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^12.2.0",
6
6
  "@angular/core": "^12.2.0"
@@ -112,7 +112,7 @@ export declare class CartService {
112
112
  * hàm này thực hiện đặt hàng
113
113
  * @param value thông tin của bill: id_branch, ghi chú
114
114
  */
115
- payment(value: any): any;
115
+ payment(value: any): Promise<any>;
116
116
  /**
117
117
  * hàm tạo lên db, get lại dữ liệu từ db
118
118
  */
@@ -133,6 +133,27 @@ export declare class CartService {
133
133
  * Build message sent to Zalo
134
134
  */
135
135
  private buildZaloOrderMessage;
136
+ /**
137
+ * Lấy số lượng tồn kho hiện tại của sản phẩm/subproduct
138
+ * @notice giả định field lưu tồn kho là `quantity` — đổi tên field cho đúng data thực tế của bạn
139
+ */
140
+ private getAvailableQuantity;
141
+ /**
142
+ * Kiểm tra tồn kho MỚI NHẤT (không dùng data cũ trong cart) trước khi cho đặt hàng
143
+ * remaining = quantity mới nhất - số lượng khách đặt
144
+ * remaining < 0 => không đủ hàng, chặn đặt hàng
145
+ */
146
+ private validateStockBeforeOrder;
147
+ /**
148
+ * Sau khi đặt hàng thành công: cập nhật quantity = quantity cũ - số lượng đã đặt
149
+ * @notice TODO: thay this.vhQueryAutoWeb.updateProduct(...) bằng API update sản phẩm thật của bạn
150
+ */
151
+ private deductStockAfterOrder;
152
+ /**
153
+ * Số lượng tối đa khách còn có thể chọn thêm = tồn kho - số lượng đã có trong giỏ
154
+ * @returns null nếu sản phẩm không quản lý tồn kho (không giới hạn)
155
+ */
156
+ getMaxQuantityCanAdd(product: any): number | null;
136
157
  static ɵfac: i0.ɵɵFactoryDeclaration<CartService, never>;
137
158
  static ɵprov: i0.ɵɵInjectableDeclaration<CartService>;
138
159
  }