club_update
Razmig Sarkissian 1 year ago
parent 8373509a14
commit c24835052b
  1. 2
      PadelClub/Data/Match.swift
  2. 3
      PadelClub/Data/TeamRegistration.swift
  3. 2
      PadelClub/Views/Cashier/Event/EventTournamentsView.swift
  4. 1
      PadelClub/Views/GroupStage/GroupStageView.swift
  5. 4
      PadelClub/Views/Match/Components/MatchDateView.swift
  6. 11
      PadelClub/Views/Navigation/Ongoing/OngoingView.swift
  7. 4
      PadelClub/Views/Tournament/Screen/Components/TournamentStatusView.swift
  8. 2
      PadelClub/Views/Tournament/TournamentView.swift

@ -488,6 +488,8 @@ defer {
winningTeamId = teamOne?.id winningTeamId = teamOne?.id
losingTeamId = teamTwo?.id losingTeamId = teamTwo?.id
confirmed = true
groupStageObject?.updateGroupStageState() groupStageObject?.updateGroupStageState()
roundObject?.updateTournamentState() roundObject?.updateTournamentState()
updateFollowingMatchTeamScore() updateFollowingMatchTeamScore()

@ -119,6 +119,9 @@ final class TeamRegistration: ModelObject, Storable {
let seedPosition: Int = match.lockAndGetSeedPosition(atTeamPosition: slot, opposingSeeding: opposingSeeding) let seedPosition: Int = match.lockAndGetSeedPosition(atTeamPosition: slot, opposingSeeding: opposingSeeding)
tournamentObject()?.resetTeamScores(in: bracketPosition) tournamentObject()?.resetTeamScores(in: bracketPosition)
self.bracketPosition = seedPosition self.bracketPosition = seedPosition
if groupStagePosition != nil && qualified == false {
qualified = true
}
tournamentObject()?.updateTeamScores(in: bracketPosition) tournamentObject()?.updateTeamScores(in: bracketPosition)
} }

@ -28,7 +28,7 @@ struct EventTournamentsView: View {
List { List {
ForEach(tournaments) { tournament in ForEach(tournaments) { tournament in
NavigationLink { NavigationLink {
TournamentStatusView(tournament: tournament) TournamentStatusView(tournament: tournament, eventDismiss: true)
} label: { } label: {
TournamentCellView(tournament: tournament) TournamentCellView(tournament: tournament)
.contextMenu { .contextMenu {

@ -46,6 +46,7 @@ struct GroupStageView: View {
} }
.pickerStyle(.segmented) .pickerStyle(.segmented)
.fixedSize()
Spacer() Spacer()
} }
} }

@ -27,6 +27,9 @@ struct MatchDateView: View {
} }
var body: some View { var body: some View {
if match.endDate != nil {
label
} else {
Menu { Menu {
let estimatedDuration = match.getDuration() let estimatedDuration = match.getDuration()
if match.startDate == nil && isReady { if match.startDate == nil && isReady {
@ -72,6 +75,7 @@ struct MatchDateView: View {
} }
.buttonStyle(.plain) .buttonStyle(.plain)
} }
}
@ViewBuilder @ViewBuilder
var label: some View { var label: some View {

@ -65,10 +65,10 @@ struct OngoingView: View {
} }
} }
.navigationTitle("En cours") .navigationTitle("En cours")
.navigationBarTitleDisplayMode(.inline) .toolbarBackground(.visible, for: .bottomBar)
.toolbar(matches.isEmpty ? .hidden : .visible, for: .navigationBar) .toolbar(matches.isEmpty ? .hidden : .visible, for: .navigationBar)
.toolbar { .toolbar {
ToolbarItem(placement: .principal) { ToolbarItem(placement: .status) {
Picker(selection: $sortByField) { Picker(selection: $sortByField) {
Text("tri par date").tag(true) Text("tri par date").tag(true)
Text("tri par terrain").tag(false) Text("tri par terrain").tag(false)
@ -76,11 +76,8 @@ struct OngoingView: View {
} }
.pickerStyle(.segmented) .pickerStyle(.segmented)
} .fixedSize()
ToolbarItem(placement: .status) { .offset(y: -4)
if matches.isEmpty == false {
Text("\(matches.count) match" + matches.count.pluralSuffix)
}
} }
} }
} }

@ -13,6 +13,7 @@ struct TournamentStatusView: View {
@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 @Bindable var tournament: Tournament
var eventDismiss: Bool = false
var body: some View { var body: some View {
Form { Form {
@ -64,9 +65,12 @@ struct TournamentStatusView: View {
Logger.error(error) Logger.error(error)
} }
} }
if eventDismiss {
navigation.path = NavigationPath() navigation.path = NavigationPath()
} }
} }
}
if tournament.hasEnded() == false && tournament.isCanceled == false { if tournament.hasEnded() == false && tournament.isCanceled == false {
Section { Section {

@ -199,7 +199,9 @@ struct TournamentView: View {
TournamentStatusView(tournament: tournament) TournamentStatusView(tournament: tournament)
} label: { } label: {
Text("Gestion du tournoi") Text("Gestion du tournoi")
.foregroundStyle(.logoRed)
Text("Annuler, supprimer ou terminer le tournoi") Text("Annuler, supprimer ou terminer le tournoi")
.foregroundStyle(.logoRed)
} }
} label: { } label: {
LabelOptions() LabelOptions()

Loading…
Cancel
Save