add format edit in matchdetail view

online_payment
Raz 7 months ago
parent 6b573e4505
commit dde95cae2c
  1. 24
      PadelClub/Views/Match/Components/PlayerBlockView.swift
  2. 12
      PadelClub/Views/Match/MatchDetailView.swift

@ -85,20 +85,20 @@ struct PlayerBlockView: View {
.opacity(0)
if let team {
if let teamScore, teamScore.luckyLoser != nil, match.isLoserBracket == false {
Text("Repêchée").italic().font(.caption)
}
VStack(alignment: .leading) {
if let teamScore, teamScore.luckyLoser != nil, match.isLoserBracket == false {
Text("Repêchée").italic().font(.caption)
}
if let teamName = team.name {
Text(teamName).foregroundStyle(.secondary).font(.footnote)
} else if team.players().isEmpty {
if team.isWildCard() {
Text("Place réservée wildcard")
} else {
Text("Place réservée")
if let teamName = team.name {
Text(teamName).foregroundStyle(.secondary).font(.footnote)
} else if team.players().isEmpty {
if team.isWildCard() {
Text("Place réservée wildcard")
} else {
Text("Place réservée")
}
}
}
VStack(alignment: .leading) {
ForEach(team.players()) { player in
Text(player.playerLabel()).lineLimit(1)
.italic(player.isHere() == false)

@ -555,6 +555,18 @@ struct MatchDetailView: View {
_saveMatch()
}
@Bindable var bindableMatch = match
Picker(selection: $bindableMatch.matchFormat) {
ForEach(MatchFormat.allCases) { format in
MatchFormatRowView(matchFormat: format, additionalEstimationDuration: match.currentTournament()?.additionalEstimationDuration).tag(format)
}
} label: {
Text("Format")
}
.onChange(of: match.matchFormat) {
_saveMatch()
}
RowButtonView("Valider") {
match.validateMatch(fromStartDate: startDateSetup == .now ? Date().withoutSeconds() : startDate, toEndDate: endDate, fieldSetup: fieldSetup)

Loading…
Cancel
Save