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
+13 -1
View File
@@ -7,6 +7,7 @@ class ClosedTab {
final String originalTabId;
final String customerName;
final DateTime closedAt;
final String paymentMethod;
final List<ClosedTabItem> items;
ClosedTab({
@@ -14,6 +15,7 @@ class ClosedTab {
required this.originalTabId,
required this.customerName,
required this.closedAt,
required this.paymentMethod,
required this.items,
});
@@ -25,6 +27,14 @@ class ClosedTab {
String get formattedTotal =>
NumberFormat.simpleCurrency().format(totalInCents / 100);
String get formattedPaymentMethod {
return switch (paymentMethod) {
'cash' => 'Cash',
'payconiq' => 'Payconiq',
_ => 'Cash',
};
}
@override
bool operator ==(Object other) =>
identical(this, other) ||
@@ -33,6 +43,7 @@ class ClosedTab {
originalTabId == other.originalTabId &&
customerName == other.customerName &&
closedAt == other.closedAt &&
paymentMethod == other.paymentMethod &&
_listEquals(items, other.items);
@override
@@ -41,6 +52,7 @@ class ClosedTab {
originalTabId,
customerName,
closedAt,
paymentMethod,
Object.hashAll(items),
);
}
@@ -53,4 +65,4 @@ bool _listEquals<T>(List<T>? a, List<T>? b) {
if (a[i] != b[i]) return false;
}
return true;
}
}