fix: reformat code / code improvements

This commit is contained in:
2026-07-30 01:46:01 +02:00
parent a732e2d07f
commit 498ad68e1c
15 changed files with 85 additions and 169 deletions
+5 -4
View File
@@ -5,6 +5,7 @@ import '../database/app_database.dart';
import '../models/bar_tab.dart';
import '../models/closed_tab.dart';
import '../models/closed_tab_item.dart';
import '../models/payment_method.dart';
import '../models/product.dart';
import '../models/tab_item.dart';
@@ -29,7 +30,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, {String paymentMethod = 'cash'});
Future<void> closeTab(String tabId, {PaymentMethod paymentMethod = PaymentMethod.cash});
Future<List<ClosedTab>> getClosedTabs();
@@ -234,7 +235,7 @@ class DriftBarTabService implements BarTabService {
}
@override
Future<void> closeTab(String tabId, {String paymentMethod = 'cash'}) async {
Future<void> closeTab(String tabId, {PaymentMethod paymentMethod = PaymentMethod.cash}) async {
await database.transaction(() async {
final tabQuery = database.select(database.barTabs)
..where((tab) => tab.id.equals(tabId));
@@ -261,7 +262,7 @@ class DriftBarTabService implements BarTabService {
originalTabId: tabId,
customerName: tabRow.customerName,
closedAt: DateTime.now(),
paymentMethod: Value(paymentMethod),
paymentMethod: Value(paymentMethod.value),
),
);
@@ -326,7 +327,7 @@ class DriftBarTabService implements BarTabService {
originalTabId: row.originalTabId,
customerName: row.customerName,
closedAt: row.closedAt,
paymentMethod: row.paymentMethod,
paymentMethod: PaymentMethod.fromValue(row.paymentMethod),
items: itemRows.map<ClosedTabItem>(_mapClosedItemRow).toList(),
),
);