club_update
Razmig Sarkissian 1 year ago
parent cf1fec2a27
commit bce7c3b2ab
  1. 4
      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,6 +27,9 @@ struct EventTournamentsView: View {
let tournaments = event.tournaments let tournaments = event.tournaments
List { List {
ForEach(tournaments) { tournament in ForEach(tournaments) { tournament in
NavigationLink {
TournamentStatusView(tournament: tournament)
} label: {
TournamentCellView(tournament: tournament) TournamentCellView(tournament: tournament)
.contextMenu { .contextMenu {
Button { Button {
@ -37,6 +40,7 @@ struct EventTournamentsView: View {
} }
} }
} }
}
.toolbar { .toolbar {
ToolbarItem(placement: .topBarTrailing) { ToolbarItem(placement: .topBarTrailing) {
BarButtonView("Ajouter un tournoi", icon: "plus.circle.fill") { BarButtonView("Ajouter un tournoi", icon: "plus.circle.fill") {

@ -10,12 +10,11 @@ import LeStorage
struct TournamentStatusView: View { struct TournamentStatusView: View {
@Environment(\.dismiss) private var dismiss @Environment(\.dismiss) private var dismiss
@Environment(Tournament.self) private var tournament: Tournament
@Environment(NavigationViewModel.self) private var navigation: NavigationViewModel @Environment(NavigationViewModel.self) private var navigation: NavigationViewModel
@EnvironmentObject var dataStore: DataStore @EnvironmentObject var dataStore: DataStore
@Bindable var tournament: Tournament
var body: some View { var body: some View {
@Bindable var tournament = tournament
Form { Form {
#if DEBUG #if DEBUG
RowButtonView("debug: Un-delete le tournoi") { RowButtonView("debug: Un-delete le tournoi") {
@ -86,19 +85,20 @@ struct TournamentStatusView: View {
} }
} }
Section { // Section {
Toggle(isOn: $tournament.isPrivate) { // Toggle(isOn: $tournament.isPrivate) {
Text("Tournoi privé") // Text("Tournoi privé")
} // }
} footer: { // } footer: {
Text(.init("Le tournoi sera masqué sur le site [Padel Club](\(URLs.main.rawValue))")) // Text(.init("Le tournoi sera masqué sur le site [Padel Club](\(URLs.main.rawValue))"))
} // }
} }
.navigationTitle("Gestion du tournoi")
.toolbarBackground(.visible, for: .navigationBar) .toolbarBackground(.visible, for: .navigationBar)
.onChange(of: tournament.endDate) { .onChange(of: tournament.endDate) {
_save() _save()
} }
.onChange(of: [tournament.isDeleted, tournament.isPrivate]) { .onChange(of: tournament.isDeleted) {
_save() _save()
} }
.onChange(of: tournament.isCanceled) { .onChange(of: tournament.isCanceled) {

@ -59,7 +59,7 @@ struct TournamentSettingsView: View {
@Environment(Tournament.self) var tournament: Tournament @Environment(Tournament.self) var tournament: Tournament
private func destinations() -> [TournamentSettings] { private func destinations() -> [TournamentSettings] {
[.status, .general, .club(tournament), .matchFormats] [.general, .club(tournament), .matchFormats]
} }
var body: some View { var body: some View {
@ -67,7 +67,7 @@ struct TournamentSettingsView: View {
GenericDestinationPickerView(selectedDestination: $selectedDestination, destinations: destinations(), nilDestinationIsValid: false) GenericDestinationPickerView(selectedDestination: $selectedDestination, destinations: destinations(), nilDestinationIsValid: false)
switch selectedDestination! { switch selectedDestination! {
case .status: case .status:
TournamentStatusView() TournamentStatusView(tournament: tournament)
case .matchFormats: case .matchFormats:
TournamentMatchFormatsSettingsView() TournamentMatchFormatsSettingsView()
case .general: case .general:

@ -174,6 +174,7 @@ struct TournamentView: View {
Text("Gestion de l'événement") Text("Gestion de l'événement")
} }
NavigationLink(value: Screen.settings) { NavigationLink(value: Screen.settings) {
LabelSettings() 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: { } label: {
LabelOptions() LabelOptions()
.popoverTip(tournamentRunningTip) .popoverTip(tournamentRunningTip)

Loading…
Cancel
Save