|
|
|
@ -81,6 +81,14 @@ struct AddTeamView: View { |
|
|
|
fetchRequest = FetchRequest(fetchRequest: request, animation: .default) |
|
|
|
fetchRequest = FetchRequest(fetchRequest: request, animation: .default) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var selectionLimit: Int { |
|
|
|
|
|
|
|
if tournament.isAnimation() { |
|
|
|
|
|
|
|
return -1 |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
return tournament.significantPlayerCount() - _currentSelectionIds().count |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var body: some View { |
|
|
|
var body: some View { |
|
|
|
if let pasteString, pasteString.isEmpty == false, fetchPlayers.isEmpty == false { |
|
|
|
if let pasteString, pasteString.isEmpty == false, fetchPlayers.isEmpty == false { |
|
|
|
computedBody |
|
|
|
computedBody |
|
|
|
@ -163,7 +171,7 @@ struct AddTeamView: View { |
|
|
|
} |
|
|
|
} |
|
|
|
.sheet(isPresented: $presentPlayerSearch) { |
|
|
|
.sheet(isPresented: $presentPlayerSearch) { |
|
|
|
NavigationStack { |
|
|
|
NavigationStack { |
|
|
|
SelectablePlayerListView(allowSelection: 2 - _currentSelectionIds().count, isPresented: true, searchField: searchField, filterOption: _filterOption(), showFemaleInMaleAssimilation: tournament.tournamentCategory.showFemaleInMaleAssimilation) { players in |
|
|
|
SelectablePlayerListView(allowSelection: selectionLimit, isPresented: true, searchField: searchField, filterOption: _filterOption(), showFemaleInMaleAssimilation: tournament.tournamentCategory.showFemaleInMaleAssimilation) { players in |
|
|
|
players.forEach { player in |
|
|
|
players.forEach { player in |
|
|
|
let newPlayer = PlayerRegistration(importedPlayer: player) |
|
|
|
let newPlayer = PlayerRegistration(importedPlayer: player) |
|
|
|
newPlayer.setComputedRank(in: tournament) |
|
|
|
newPlayer.setComputedRank(in: tournament) |
|
|
|
|