|
|
|
@ -10,14 +10,21 @@ import SwiftUI |
|
|
|
struct InscriptionInfoView: View { |
|
|
|
struct InscriptionInfoView: View { |
|
|
|
@EnvironmentObject var dataStore: DataStore |
|
|
|
@EnvironmentObject var dataStore: DataStore |
|
|
|
@Environment(Tournament.self) var tournament |
|
|
|
@Environment(Tournament.self) var tournament |
|
|
|
@State private var duplicates = [PlayerRegistration]() |
|
|
|
|
|
|
|
@State private var problematicPlayers = [PlayerRegistration]() |
|
|
|
var players : [PlayerRegistration] { tournament.unsortedPlayers() } |
|
|
|
@State private var inadequatePlayers = [PlayerRegistration]() |
|
|
|
var selectedTeams : [TeamRegistration] { tournament.selectedSortedTeams() } |
|
|
|
@State private var playersWithoutValidLicense = [PlayerRegistration]() |
|
|
|
|
|
|
|
@State private var entriesFromBeachPadel = [TeamRegistration]() |
|
|
|
var callDateIssue : [TeamRegistration] { |
|
|
|
@State private var playersMissing = [TeamRegistration]() |
|
|
|
selectedTeams.filter { tournament.isStartDateIsDifferentThanCallDate($0) } |
|
|
|
@State private var waitingList = [TeamRegistration]() |
|
|
|
} |
|
|
|
@State private var selectedTeams = [TeamRegistration]() |
|
|
|
|
|
|
|
|
|
|
|
var waitingList : [TeamRegistration] { tournament.waitingListTeams(in: selectedTeams) } |
|
|
|
|
|
|
|
var duplicates : [PlayerRegistration] { tournament.duplicates(in: players) } |
|
|
|
|
|
|
|
var problematicPlayers : [PlayerRegistration] { players.filter({ $0.sex == -1 }) } |
|
|
|
|
|
|
|
var inadequatePlayers : [PlayerRegistration] { tournament.inadequatePlayers(in: players) } |
|
|
|
|
|
|
|
var playersWithoutValidLicense : [PlayerRegistration] { tournament.playersWithoutValidLicense(in: players) } |
|
|
|
|
|
|
|
var entriesFromBeachPadel : [TeamRegistration] { tournament.unsortedTeams().filter({ $0.isImported() }) } |
|
|
|
|
|
|
|
var playersMissing : [TeamRegistration] { selectedTeams.filter({ $0.unsortedPlayers().count < 2 }) } |
|
|
|
|
|
|
|
|
|
|
|
var body: some View { |
|
|
|
var body: some View { |
|
|
|
List { |
|
|
|
List { |
|
|
|
@ -47,6 +54,30 @@ struct InscriptionInfoView: View { |
|
|
|
.listRowView(color: .green) |
|
|
|
.listRowView(color: .green) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Section { |
|
|
|
|
|
|
|
DisclosureGroup { |
|
|
|
|
|
|
|
ForEach(callDateIssue) { team in |
|
|
|
|
|
|
|
CallView.TeamView(team: team) |
|
|
|
|
|
|
|
if let groupStage = team.groupStageObject(), let callDate = groupStage.startDate { |
|
|
|
|
|
|
|
CallView(teams: [team], callDate: callDate, matchFormat: groupStage.matchFormat, roundLabel: "poule") |
|
|
|
|
|
|
|
} else if let initialRound = team.initialRound(), |
|
|
|
|
|
|
|
let initialMatch = team.initialMatch(), |
|
|
|
|
|
|
|
let callDate = initialMatch.startDate { |
|
|
|
|
|
|
|
CallView(teams: [team], callDate: callDate, matchFormat: initialMatch.matchFormat, roundLabel: initialRound.roundTitle()) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} label: { |
|
|
|
|
|
|
|
LabeledContent { |
|
|
|
|
|
|
|
Text(callDateIssue.count.formatted()) |
|
|
|
|
|
|
|
} label: { |
|
|
|
|
|
|
|
Text("Erreur de convocation") |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
.listRowView(color: .brown) |
|
|
|
|
|
|
|
} footer: { |
|
|
|
|
|
|
|
Text("L'horaire de la convocation est différente du match initial") |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
let waitingListInBracket = waitingList.filter({ $0.bracketPosition != nil }) |
|
|
|
let waitingListInBracket = waitingList.filter({ $0.bracketPosition != nil }) |
|
|
|
let waitingListInGroupStage = waitingList.filter({ $0.groupStage != nil }) |
|
|
|
let waitingListInGroupStage = waitingList.filter({ $0.groupStage != nil }) |
|
|
|
|
|
|
|
|
|
|
|
@ -166,21 +197,6 @@ struct InscriptionInfoView: View { |
|
|
|
.navigationTitle("Synthèse") |
|
|
|
.navigationTitle("Synthèse") |
|
|
|
.navigationBarTitleDisplayMode(.inline) |
|
|
|
.navigationBarTitleDisplayMode(.inline) |
|
|
|
.toolbarBackground(.visible, for: .navigationBar) |
|
|
|
.toolbarBackground(.visible, for: .navigationBar) |
|
|
|
.onAppear { |
|
|
|
|
|
|
|
_initData() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private func _initData() { |
|
|
|
|
|
|
|
let players = tournament.unsortedPlayers() |
|
|
|
|
|
|
|
selectedTeams = tournament.selectedSortedTeams() |
|
|
|
|
|
|
|
waitingList = tournament.waitingListTeams(in: selectedTeams) |
|
|
|
|
|
|
|
duplicates = tournament.duplicates(in: players) |
|
|
|
|
|
|
|
problematicPlayers = players.filter({ $0.sex == -1 }) |
|
|
|
|
|
|
|
inadequatePlayers = tournament.inadequatePlayers(in: players) |
|
|
|
|
|
|
|
playersWithoutValidLicense = tournament.playersWithoutValidLicense(in: players) |
|
|
|
|
|
|
|
entriesFromBeachPadel = tournament.unsortedTeams().filter({ $0.isImported() }) |
|
|
|
|
|
|
|
playersMissing = selectedTeams.filter({ $0.unsortedPlayers().count < 2 }) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|