club_update
Razmig Sarkissian 1 year ago
parent cf1fec2a27
commit bce7c3b2ab
  1. 18
      PadelClub/Views/Cashier/Event/EventTournamentsView.swift
  2. 22
      PadelClub/Views/Tournament/Screen/Components/TournamentStatusView.swift
  3. 4
      PadelClub/Views/Tournament/Screen/TournamentSettingsView.swift
  4. 10
      PadelClub/Views/Tournament/TournamentView.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 {

@ -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) {

@ -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:

@ -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)

Loading…
Cancel
Save