feat: add more detailed history and group per day
This commit is contained in:
@@ -5,6 +5,8 @@ class ClosedTabItem {
|
||||
final String productName;
|
||||
final int quantity;
|
||||
final int unitPriceInCents;
|
||||
final DateTime? purchasedAt;
|
||||
final DateTime? removedAt;
|
||||
|
||||
ClosedTabItem({
|
||||
required this.id,
|
||||
@@ -13,9 +15,13 @@ class ClosedTabItem {
|
||||
required this.productName,
|
||||
required this.quantity,
|
||||
required this.unitPriceInCents,
|
||||
this.purchasedAt,
|
||||
this.removedAt,
|
||||
});
|
||||
|
||||
int get lineTotalInCents => quantity * unitPriceInCents;
|
||||
bool get isRemoved => removedAt != null;
|
||||
|
||||
int get lineTotalInCents => isRemoved ? 0 : quantity * unitPriceInCents;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
@@ -26,15 +32,19 @@ class ClosedTabItem {
|
||||
productId == other.productId &&
|
||||
productName == other.productName &&
|
||||
quantity == other.quantity &&
|
||||
unitPriceInCents == other.unitPriceInCents;
|
||||
unitPriceInCents == other.unitPriceInCents &&
|
||||
purchasedAt == other.purchasedAt &&
|
||||
removedAt == other.removedAt;
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(
|
||||
id,
|
||||
closedTabId,
|
||||
productId,
|
||||
productName,
|
||||
quantity,
|
||||
unitPriceInCents,
|
||||
);
|
||||
id,
|
||||
closedTabId,
|
||||
productId,
|
||||
productName,
|
||||
quantity,
|
||||
unitPriceInCents,
|
||||
purchasedAt,
|
||||
removedAt,
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user