feat: add alot

This commit is contained in:
2026-10-08 04:12:36 +02:00
parent ccf5165417
commit fc607cb7bd
99 changed files with 4981 additions and 3655 deletions
+4 -22
View File
@@ -1,23 +1,20 @@
import 'package:flutter/foundation.dart';
import 'tab_item.dart';
import '../utils/collection_utils.dart';
class BarTab {
final String id;
final String customerName;
final String status;
final DateTime openedAt;
final DateTime? closedAt;
final int version;
final List<TabItem> items;
const BarTab({
required this.id,
required this.customerName,
required this.status,
required this.openedAt,
this.version = 0,
required this.items,
this.closedAt,
});
int get totalInCents {
@@ -28,32 +25,17 @@ class BarTab {
return items.fold<int>(0, (total, item) => total + item.quantity);
}
String get formattedTotal {
return '€${(totalInCents / 100).toStringAsFixed(2)}';
}
bool get isOpen => status == 'open';
@override
bool operator ==(Object other) =>
identical(this, other) ||
other is BarTab &&
id == other.id &&
customerName == other.customerName &&
status == other.status &&
openedAt == other.openedAt &&
closedAt == other.closedAt &&
version == other.version &&
listEquals(items, other.items);
@override
int get hashCode => Object.hash(
id,
customerName,
status,
openedAt,
closedAt,
version,
Object.hashAll(items),
);
int get hashCode =>
Object.hash(id, customerName, openedAt, version, Object.hashAll(items));
}