|
|
|
|
@ -38,6 +38,7 @@ struct SendToAllView: View { |
|
|
|
|
init(event: Event) { |
|
|
|
|
self.event = event |
|
|
|
|
self.addLink = false |
|
|
|
|
_contactRecipients = .init(wrappedValue: Set(event.confirmedTournaments().map(\.id))) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
init(tournament: Tournament, addLink: Bool) { |
|
|
|
|
@ -74,11 +75,15 @@ struct SendToAllView: View { |
|
|
|
|
} |
|
|
|
|
if let event { |
|
|
|
|
LabeledContent { |
|
|
|
|
Text(event.selectedTeams().count.formatted()) |
|
|
|
|
Text(event.selectedTeams().filter({ contactRecipients.isEmpty || contactRecipients.contains($0.tournament) }).count.formatted()) |
|
|
|
|
} label: { |
|
|
|
|
Text("Participants") |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let confirmedTournaments = event.confirmedTournaments() |
|
|
|
|
ForEach(confirmedTournaments) { tournament in |
|
|
|
|
TournamentCellView(tournament: tournament).tag(tournament.id) |
|
|
|
|
} |
|
|
|
|
} else if let tournament { |
|
|
|
|
Section { |
|
|
|
|
ForEach(tournament.groupStages()) { groupStage in |
|
|
|
|
@ -245,7 +250,7 @@ struct SendToAllView: View { |
|
|
|
|
|
|
|
|
|
func _teams() -> [TeamRegistration] { |
|
|
|
|
if let event { |
|
|
|
|
return event.selectedTeams() |
|
|
|
|
return event.selectedTeams().filter({ contactRecipients.isEmpty || contactRecipients.contains($0.tournament) }) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
guard let tournament else { return [] } |
|
|
|
|
|