|
|
|
@ -56,7 +56,6 @@ struct InscriptionManagerView: View { |
|
|
|
@State private var showSubscriptionView: Bool = false |
|
|
|
@State private var showSubscriptionView: Bool = false |
|
|
|
@State private var registrationIssues: Int? = nil |
|
|
|
@State private var registrationIssues: Int? = nil |
|
|
|
@State private var sortedTeams: [TeamRegistration] = [] |
|
|
|
@State private var sortedTeams: [TeamRegistration] = [] |
|
|
|
@State private var unfilteredTeams: [TeamRegistration] = [] |
|
|
|
|
|
|
|
@State private var walkoutTeams: [TeamRegistration] = [] |
|
|
|
@State private var walkoutTeams: [TeamRegistration] = [] |
|
|
|
@State private var unsortedTeamsWithoutWO: [TeamRegistration] = [] |
|
|
|
@State private var unsortedTeamsWithoutWO: [TeamRegistration] = [] |
|
|
|
@State private var unsortedPlayers: [PlayerRegistration] = [] |
|
|
|
@State private var unsortedPlayers: [PlayerRegistration] = [] |
|
|
|
@ -118,7 +117,6 @@ struct InscriptionManagerView: View { |
|
|
|
private func _clearScreen() { |
|
|
|
private func _clearScreen() { |
|
|
|
teamPaste = nil |
|
|
|
teamPaste = nil |
|
|
|
unsortedPlayers.removeAll() |
|
|
|
unsortedPlayers.removeAll() |
|
|
|
unfilteredTeams.removeAll() |
|
|
|
|
|
|
|
walkoutTeams.removeAll() |
|
|
|
walkoutTeams.removeAll() |
|
|
|
unsortedTeamsWithoutWO.removeAll() |
|
|
|
unsortedTeamsWithoutWO.removeAll() |
|
|
|
sortedTeams.removeAll() |
|
|
|
sortedTeams.removeAll() |
|
|
|
@ -181,7 +179,7 @@ struct InscriptionManagerView: View { |
|
|
|
_managementView() |
|
|
|
_managementView() |
|
|
|
if _isEditingTeam() { |
|
|
|
if _isEditingTeam() { |
|
|
|
_buildingTeamView() |
|
|
|
_buildingTeamView() |
|
|
|
} else if unfilteredTeams.isEmpty { |
|
|
|
} else if sortedTeams.isEmpty { |
|
|
|
_inscriptionTipsView() |
|
|
|
_inscriptionTipsView() |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
_teamRegisteredView() |
|
|
|
_teamRegisteredView() |
|
|
|
@ -326,6 +324,15 @@ struct InscriptionManagerView: View { |
|
|
|
UpdateSourceRankDateView(currentRankSourceDate: $currentRankSourceDate, confirmUpdateRank: $confirmUpdateRank, tournament: tournament) |
|
|
|
UpdateSourceRankDateView(currentRankSourceDate: $currentRankSourceDate, confirmUpdateRank: $confirmUpdateRank, tournament: tournament) |
|
|
|
.tint(.master) |
|
|
|
.tint(.master) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
.onChange(of: filterMode) { |
|
|
|
|
|
|
|
_prepareTeams() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
.onChange(of: sortingMode) { |
|
|
|
|
|
|
|
_prepareTeams() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
.onChange(of: byDecreasingOrdering) { |
|
|
|
|
|
|
|
_prepareTeams() |
|
|
|
|
|
|
|
} |
|
|
|
.toolbar { |
|
|
|
.toolbar { |
|
|
|
if _isEditingTeam() { |
|
|
|
if _isEditingTeam() { |
|
|
|
ToolbarItem(placement: .cancellationAction) { |
|
|
|
ToolbarItem(placement: .cancellationAction) { |
|
|
|
@ -454,6 +461,9 @@ struct InscriptionManagerView: View { |
|
|
|
} |
|
|
|
} |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
sortedTeams = tournament.sortedTeams() |
|
|
|
sortedTeams = tournament.sortedTeams() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var filteredTeams: [TeamRegistration] { |
|
|
|
|
|
|
|
|
|
|
|
var teams = sortedTeams |
|
|
|
var teams = sortedTeams |
|
|
|
if filterMode == .walkOut { |
|
|
|
if filterMode == .walkOut { |
|
|
|
@ -465,9 +475,9 @@ struct InscriptionManagerView: View { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if byDecreasingOrdering { |
|
|
|
if byDecreasingOrdering { |
|
|
|
self.unfilteredTeams = teams.reversed() |
|
|
|
return teams.reversed() |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
self.unfilteredTeams = teams |
|
|
|
return teams |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -496,10 +506,10 @@ struct InscriptionManagerView: View { |
|
|
|
if presentSearch == false { |
|
|
|
if presentSearch == false { |
|
|
|
_rankHandlerView() |
|
|
|
_rankHandlerView() |
|
|
|
_relatedTips() |
|
|
|
_relatedTips() |
|
|
|
_informationView(count: unfilteredTeams.count) |
|
|
|
_informationView() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
let teams = searchField.isEmpty ? unfilteredTeams : unfilteredTeams.filter({ $0.contains(searchField.canonicalVersion) }) |
|
|
|
let teams = searchField.isEmpty ? filteredTeams : filteredTeams.filter({ $0.contains(searchField.canonicalVersion) }) |
|
|
|
|
|
|
|
|
|
|
|
if teams.isEmpty && searchField.isEmpty == false { |
|
|
|
if teams.isEmpty && searchField.isEmpty == false { |
|
|
|
ContentUnavailableView { |
|
|
|
ContentUnavailableView { |
|
|
|
@ -710,7 +720,7 @@ struct InscriptionManagerView: View { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private func _informationView(count: Int) -> some View { |
|
|
|
private func _informationView() -> some View { |
|
|
|
Section { |
|
|
|
Section { |
|
|
|
LabeledContent { |
|
|
|
LabeledContent { |
|
|
|
Text(unsortedTeamsWithoutWO.count.formatted() + "/" + tournament.teamCount.formatted()).font(.largeTitle) |
|
|
|
Text(unsortedTeamsWithoutWO.count.formatted() + "/" + tournament.teamCount.formatted()).font(.largeTitle) |
|
|
|
@ -872,7 +882,7 @@ struct InscriptionManagerView: View { |
|
|
|
|
|
|
|
|
|
|
|
private func _isDuplicate() -> Bool { |
|
|
|
private func _isDuplicate() -> Bool { |
|
|
|
let ids : [String?] = _currentSelectionIds() |
|
|
|
let ids : [String?] = _currentSelectionIds() |
|
|
|
if unfilteredTeams.anySatisfy({ $0.containsExactlyPlayerLicenses(ids) }) { |
|
|
|
if sortedTeams.anySatisfy({ $0.containsExactlyPlayerLicenses(ids) }) { |
|
|
|
return true |
|
|
|
return true |
|
|
|
} |
|
|
|
} |
|
|
|
return false |
|
|
|
return false |
|
|
|
|