Skip to content

Commit

Permalink
feat: Added printing
Browse files Browse the repository at this point in the history
  • Loading branch information
styrix560 committed Sep 10, 2024
1 parent 1f4bb37 commit 9de4650
Show file tree
Hide file tree
Showing 7 changed files with 521 additions and 265 deletions.
2 changes: 1 addition & 1 deletion lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Future<bool> appInitialization() async {
);

assert(seatLayout['Parkett']!.sum == 555);
assert(seatLayout['Sparkassenrang']!.sum == 133);
assert(seatLayout['Sparkassen Rang']!.sum == 133);
assert(maxRowLength == 28);

return Config.loadConfig("assets/config.json");
Expand Down
40 changes: 31 additions & 9 deletions lib/types/booking.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,25 @@ class Booking {
final PriceType priceType;
final String comments;

Booking copy() => Booking(
id,
firstName,
lastName,
className,
Set.of(seats),
pricePaid,
priceType,
comments,
Booking copy({
String? id,
String? firstName,
String? lastName,
String? className,
Set<Seat>? seats,
int? pricePaid,
PriceType? priceType,
String? comments,
}) =>
Booking(
id ?? this.id,
firstName ?? this.firstName,
lastName ?? this.lastName,
className ?? this.className,
seats ?? Set.of(this.seats),
pricePaid ?? this.pricePaid,
priceType ?? this.priceType,
comments ?? this.comments,
);

int getPrice({required BookingTime bookingTime}) =>
Expand All @@ -49,6 +59,18 @@ class Booking {
},
);

Map<String, List<Seat>> getSeatsByGroup() {
final groups = <String, List<Seat>>{};
for (final seat in seats) {
if (groups.containsKey(seat.groupName)) {
groups[seat.groupName]!.add(seat);
} else {
groups[seat.groupName] = [seat];
}
}
return groups;
}

bool matches(String query) =>
firstName.toLowerCase().contains(query.toLowerCase()) ||
lastName.toLowerCase().contains(query.toLowerCase()) ||
Expand Down
2 changes: 1 addition & 1 deletion lib/types/seat_layout.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class Rectangle {

final Map<String, List<int>> seatLayout = {
"Parkett": [for (var i = 0; i < 19; i++) 28, 23],
"Sparkassenrang": [
"Sparkassen Rang": [
for (var i = 0; i < 5; i++) 23,
18,
],
Expand Down
3 changes: 3 additions & 0 deletions lib/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ import "main.dart";
extension BuildExt on BuildContext {
Future<void> gotoNoback(Widget widget) async => Navigator.of(this)
.pushReplacement(MaterialPageRoute<void>(builder: (_) => widget));

Future<void> goto(Widget widget) async =>
Navigator.of(this).push(MaterialPageRoute<void>(builder: (_) => widget));
}

void snackbar([String msg = "Dieses Feature funktioniert noch nicht ganz."]) =>
Expand Down
Loading

0 comments on commit 9de4650

Please sign in to comment.