|
|
|
|
@ -11,7 +11,6 @@ import LeStorage |
|
|
|
|
struct MatchDetailView: View { |
|
|
|
|
|
|
|
|
|
@EnvironmentObject var dataStore: DataStore |
|
|
|
|
@Environment(Tournament.self) var tournament: Tournament |
|
|
|
|
|
|
|
|
|
@EnvironmentObject var networkMonitor: NetworkMonitor |
|
|
|
|
@Environment(\.dismiss) var dismiss |
|
|
|
|
@ -36,7 +35,7 @@ struct MatchDetailView: View { |
|
|
|
|
@State var showUserCreationView: Bool = false |
|
|
|
|
|
|
|
|
|
var tournamentStore: TournamentStore { |
|
|
|
|
return self.tournament.tournamentStore |
|
|
|
|
return match.tournamentStore |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
var messageSentFailed: Binding<Bool> { |
|
|
|
|
@ -94,11 +93,13 @@ struct MatchDetailView: View { |
|
|
|
|
showDetails = true |
|
|
|
|
} |
|
|
|
|
Spacer() |
|
|
|
|
MenuWarningView(tournament: self.match.currentTournament()!, teams: match.teams(), message: match.matchWarningMessage(), umpireMail: dataStore.user.email, subject: match.matchWarningSubject(), contactType: $contactType) |
|
|
|
|
if let tournament = match.currentTournament() { |
|
|
|
|
MenuWarningView(tournament: tournament, teams: match.teams(), message: match.matchWarningMessage(), umpireMail: dataStore.user.email, subject: match.matchWarningSubject(), contactType: $contactType) |
|
|
|
|
.buttonStyle(.borderless) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Section { |
|
|
|
|
RowButtonView("Saisir les résultats", systemImage: "list.clipboard") { |
|
|
|
|
@ -455,7 +456,7 @@ struct MatchDetailView: View { |
|
|
|
|
if match.isReady() == false && match.teams().count == 2 { |
|
|
|
|
let teamsScores = match.getOrCreateTeamScores() |
|
|
|
|
do { |
|
|
|
|
try self.tournamentStore.teamScores.addOrUpdate(contentOfs: teamsScores) |
|
|
|
|
try tournamentStore.teamScores.addOrUpdate(contentOfs: teamsScores) |
|
|
|
|
} catch { |
|
|
|
|
Logger.error(error) |
|
|
|
|
} |
|
|
|
|
@ -477,7 +478,7 @@ struct MatchDetailView: View { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
fileprivate func _payTournamentAndExecute(_ handler: () -> ()) { |
|
|
|
|
guard let tournament = self.match.currentTournament() else { fatalError("missing tournament") } |
|
|
|
|
guard let tournament = match.currentTournament() else { fatalError("missing tournament") } |
|
|
|
|
|
|
|
|
|
do { |
|
|
|
|
try tournament.payIfNecessary() |
|
|
|
|
@ -489,7 +490,7 @@ struct MatchDetailView: View { |
|
|
|
|
|
|
|
|
|
private func save() { |
|
|
|
|
do { |
|
|
|
|
try self.tournamentStore.matches.addOrUpdate(instance: match) |
|
|
|
|
try tournamentStore.matches.addOrUpdate(instance: match) |
|
|
|
|
} catch { |
|
|
|
|
Logger.error(error) |
|
|
|
|
} |
|
|
|
|
|