feat: add payment method

This commit is contained in:
2026-07-29 21:25:56 +02:00
parent cd75d3a474
commit 3cf4787e8c
14 changed files with 652 additions and 50 deletions
+4 -2
View File
@@ -29,7 +29,7 @@ abstract class BarTabService {
/// Archives the tab's current items into history and clears them.
/// The tab itself stays open under the same customer name.
Future<void> closeTab(String tabId);
Future<void> closeTab(String tabId, {String paymentMethod = 'cash'});
Future<List<ClosedTab>> getClosedTabs();
@@ -234,7 +234,7 @@ class DriftBarTabService implements BarTabService {
}
@override
Future<void> closeTab(String tabId) async {
Future<void> closeTab(String tabId, {String paymentMethod = 'cash'}) async {
await database.transaction(() async {
final tabQuery = database.select(database.barTabs)
..where((tab) => tab.id.equals(tabId));
@@ -261,6 +261,7 @@ class DriftBarTabService implements BarTabService {
originalTabId: tabId,
customerName: tabRow.customerName,
closedAt: DateTime.now(),
paymentMethod: Value(paymentMethod),
),
);
@@ -325,6 +326,7 @@ class DriftBarTabService implements BarTabService {
originalTabId: row.originalTabId,
customerName: row.customerName,
closedAt: row.closedAt,
paymentMethod: row.paymentMethod,
items: itemRows.map<ClosedTabItem>(_mapClosedItemRow).toList(),
),
);