diff --git a/PadelClub/Views/Cashier/Event/EventTournamentsView.swift b/PadelClub/Views/Cashier/Event/EventTournamentsView.swift index 0db2191..60f24b8 100644 --- a/PadelClub/Views/Cashier/Event/EventTournamentsView.swift +++ b/PadelClub/Views/Cashier/Event/EventTournamentsView.swift @@ -27,14 +27,18 @@ struct EventTournamentsView: View { let tournaments = event.tournaments List { ForEach(tournaments) { tournament in - TournamentCellView(tournament: tournament) - .contextMenu { - Button { - navigation.openTournamentInOrganizer(tournament) - } label: { - Label("Voir dans le gestionnaire", systemImage: "line.diagonal.arrow") + NavigationLink { + TournamentStatusView(tournament: tournament) + } label: { + TournamentCellView(tournament: tournament) + .contextMenu { + Button { + navigation.openTournamentInOrganizer(tournament) + } label: { + Label("Voir dans le gestionnaire", systemImage: "line.diagonal.arrow") + } } - } + } } } .toolbar { diff --git a/PadelClub/Views/Tournament/Screen/Components/TournamentStatusView.swift b/PadelClub/Views/Tournament/Screen/Components/TournamentStatusView.swift index 3b83c2b..5bd20ca 100644 --- a/PadelClub/Views/Tournament/Screen/Components/TournamentStatusView.swift +++ b/PadelClub/Views/Tournament/Screen/Components/TournamentStatusView.swift @@ -10,12 +10,11 @@ import LeStorage struct TournamentStatusView: View { @Environment(\.dismiss) private var dismiss - @Environment(Tournament.self) private var tournament: Tournament @Environment(NavigationViewModel.self) private var navigation: NavigationViewModel @EnvironmentObject var dataStore: DataStore - + @Bindable var tournament: Tournament + var body: some View { - @Bindable var tournament = tournament Form { #if DEBUG RowButtonView("debug: Un-delete le tournoi") { @@ -86,19 +85,20 @@ struct TournamentStatusView: View { } } - Section { - Toggle(isOn: $tournament.isPrivate) { - Text("Tournoi privé") - } - } footer: { - Text(.init("Le tournoi sera masqué sur le site [Padel Club](\(URLs.main.rawValue))")) - } +// Section { +// Toggle(isOn: $tournament.isPrivate) { +// Text("Tournoi privé") +// } +// } footer: { +// Text(.init("Le tournoi sera masqué sur le site [Padel Club](\(URLs.main.rawValue))")) +// } } + .navigationTitle("Gestion du tournoi") .toolbarBackground(.visible, for: .navigationBar) .onChange(of: tournament.endDate) { _save() } - .onChange(of: [tournament.isDeleted, tournament.isPrivate]) { + .onChange(of: tournament.isDeleted) { _save() } .onChange(of: tournament.isCanceled) { diff --git a/PadelClub/Views/Tournament/Screen/TournamentSettingsView.swift b/PadelClub/Views/Tournament/Screen/TournamentSettingsView.swift index 9a819bd..bc9db77 100644 --- a/PadelClub/Views/Tournament/Screen/TournamentSettingsView.swift +++ b/PadelClub/Views/Tournament/Screen/TournamentSettingsView.swift @@ -59,7 +59,7 @@ struct TournamentSettingsView: View { @Environment(Tournament.self) var tournament: Tournament private func destinations() -> [TournamentSettings] { - [.status, .general, .club(tournament), .matchFormats] + [.general, .club(tournament), .matchFormats] } var body: some View { @@ -67,7 +67,7 @@ struct TournamentSettingsView: View { GenericDestinationPickerView(selectedDestination: $selectedDestination, destinations: destinations(), nilDestinationIsValid: false) switch selectedDestination! { case .status: - TournamentStatusView() + TournamentStatusView(tournament: tournament) case .matchFormats: TournamentMatchFormatsSettingsView() case .general: diff --git a/PadelClub/Views/Tournament/TournamentView.swift b/PadelClub/Views/Tournament/TournamentView.swift index bef203d..b61d21a 100644 --- a/PadelClub/Views/Tournament/TournamentView.swift +++ b/PadelClub/Views/Tournament/TournamentView.swift @@ -174,6 +174,7 @@ struct TournamentView: View { Text("Gestion de l'événement") } + NavigationLink(value: Screen.settings) { LabelSettings() } @@ -190,6 +191,15 @@ struct TournamentView: View { } } + + Divider() + + NavigationLink { + TournamentStatusView(tournament: tournament) + } label: { + Text("Gestion du tournoi") + Text("Annuler, supprimer ou terminer le tournoi") + } } label: { LabelOptions() .popoverTip(tournamentRunningTip)