feat: add equality operators, make history screen paginated, random performance updates
This commit is contained in:
@@ -88,9 +88,11 @@ class BarScreenViewModel extends ChangeNotifier {
|
||||
throw Exception('Product is out of stock.');
|
||||
}
|
||||
|
||||
await barTabService.addProductToTab(tabId: tab.id, product: product);
|
||||
|
||||
await inventory.decreaseStock(product.id, 1);
|
||||
await barTabService.addProductToTab(
|
||||
tabId: tab.id,
|
||||
product: product,
|
||||
stockAdjustment: () => inventory.decreaseStock(product.id, 1),
|
||||
);
|
||||
|
||||
await _reloadTabs();
|
||||
}
|
||||
@@ -101,14 +103,15 @@ class BarScreenViewModel extends ChangeNotifier {
|
||||
await barTabService.updateTabItemQuantity(
|
||||
tabItemId: item.id,
|
||||
quantity: quantity,
|
||||
stockAdjustment: () async {
|
||||
if (difference > 0) {
|
||||
await inventory.decreaseStock(item.productId, difference);
|
||||
} else if (difference < 0) {
|
||||
await inventory.increaseStock(item.productId, -difference);
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
if (difference > 0) {
|
||||
await inventory.decreaseStock(item.productId, difference);
|
||||
} else if (difference < 0) {
|
||||
await inventory.increaseStock(item.productId, -difference);
|
||||
}
|
||||
|
||||
await _reloadTabs();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user