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 -4
View File
@@ -115,18 +115,18 @@ class BarScreenViewModel extends ChangeNotifier {
await _reloadTabs();
}
Future<void> closeSelectedTab() async {
Future<void> closeSelectedTab({String paymentMethod = 'cash'}) async {
final tab = selectedTab;
if (tab == null) return;
await barTabService.closeTab(tab.id);
await barTabService.closeTab(tab.id, paymentMethod: paymentMethod);
await _reloadTabs();
}
Future<void> closeTab(String tabId) async {
await barTabService.closeTab(tabId);
Future<void> closeTab(String tabId, {String paymentMethod = 'cash'}) async {
await barTabService.closeTab(tabId, paymentMethod: paymentMethod);
await _reloadTabs();
}
+3
View File
@@ -1,4 +1,5 @@
import 'package:flutter/foundation.dart';
import 'package:drift/drift.dart';
import 'package:kooltab2/database/app_database.dart';
import 'package:kooltab2/services/bar_tab_service.dart';
import 'package:kooltab2/services/pin_lock_service.dart';
@@ -274,6 +275,7 @@ class DevMenuViewModel extends ChangeNotifier {
'Sam', 'Tina', 'Umar', 'Vera', 'Wes', 'Xena',
'Yves', 'Zara',
];
const paymentMethods = ['cash', 'payconiq'];
await database.transaction(() async {
for (var i = 0; i < count; i++) {
@@ -295,6 +297,7 @@ class DevMenuViewModel extends ChangeNotifier {
originalTabId: uuid.v4(),
customerName: customer,
closedAt: closedAt,
paymentMethod: Value(paymentMethods[(i * 3) % paymentMethods.length]),
),
);