|
|
|
@ -53,11 +53,87 @@ struct InscriptionManagerView: View { |
|
|
|
@State private var refreshResult: String? = nil |
|
|
|
@State private var refreshResult: String? = nil |
|
|
|
@State private var refreshInProgress: Bool = false |
|
|
|
@State private var refreshInProgress: Bool = false |
|
|
|
@State private var refreshStatus: Bool? |
|
|
|
@State private var refreshStatus: Bool? |
|
|
|
|
|
|
|
@State private var showLegendView: Bool = false |
|
|
|
|
|
|
|
|
|
|
|
var tournamentStore: TournamentStore { |
|
|
|
var tournamentStore: TournamentStore { |
|
|
|
return self.tournament.tournamentStore |
|
|
|
return self.tournament.tournamentStore |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
enum LegendPositionTip: Int, Identifiable, CaseIterable { |
|
|
|
|
|
|
|
var id: Int { self.rawValue } |
|
|
|
|
|
|
|
case groupStage |
|
|
|
|
|
|
|
case bracket |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func legendDescriptionLabel() -> String { |
|
|
|
|
|
|
|
return "" |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var isActive: Bool { |
|
|
|
|
|
|
|
switch self { |
|
|
|
|
|
|
|
case .groupStage: |
|
|
|
|
|
|
|
return true |
|
|
|
|
|
|
|
case .bracket: |
|
|
|
|
|
|
|
return true |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var color: Color { |
|
|
|
|
|
|
|
switch self { |
|
|
|
|
|
|
|
case .groupStage: |
|
|
|
|
|
|
|
return .red |
|
|
|
|
|
|
|
case .bracket: |
|
|
|
|
|
|
|
return .green |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var hideColorVariation: Bool { |
|
|
|
|
|
|
|
switch self { |
|
|
|
|
|
|
|
case .groupStage: |
|
|
|
|
|
|
|
return true |
|
|
|
|
|
|
|
case .bracket: |
|
|
|
|
|
|
|
return true |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
enum LegendInscriptionTip: Int, Identifiable, CaseIterable { |
|
|
|
|
|
|
|
var id: Int { self.rawValue } |
|
|
|
|
|
|
|
case groupStage |
|
|
|
|
|
|
|
case bracket |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func legendDescriptionLabel() -> String { |
|
|
|
|
|
|
|
return "" |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var isActive: Bool { |
|
|
|
|
|
|
|
switch self { |
|
|
|
|
|
|
|
case .groupStage: |
|
|
|
|
|
|
|
return true |
|
|
|
|
|
|
|
case .bracket: |
|
|
|
|
|
|
|
return true |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var color: Color { |
|
|
|
|
|
|
|
switch self { |
|
|
|
|
|
|
|
case .groupStage: |
|
|
|
|
|
|
|
return .red |
|
|
|
|
|
|
|
case .bracket: |
|
|
|
|
|
|
|
return .green |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var hideColorVariation: Bool { |
|
|
|
|
|
|
|
switch self { |
|
|
|
|
|
|
|
case .groupStage: |
|
|
|
|
|
|
|
return true |
|
|
|
|
|
|
|
case .bracket: |
|
|
|
|
|
|
|
return true |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
enum SortingMode: Int, Identifiable, CaseIterable { |
|
|
|
enum SortingMode: Int, Identifiable, CaseIterable { |
|
|
|
var id: Int { self.rawValue } |
|
|
|
var id: Int { self.rawValue } |
|
|
|
case registrationDate |
|
|
|
case registrationDate |
|
|
|
@ -592,6 +668,8 @@ struct InscriptionManagerView: View { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let isImported = teams.anySatisfy({ $0.isImported() }) |
|
|
|
|
|
|
|
|
|
|
|
if teams.isEmpty == false { |
|
|
|
if teams.isEmpty == false { |
|
|
|
if compactMode { |
|
|
|
if compactMode { |
|
|
|
Section { |
|
|
|
Section { |
|
|
|
@ -602,13 +680,19 @@ struct InscriptionManagerView: View { |
|
|
|
.environment(tournament) |
|
|
|
.environment(tournament) |
|
|
|
} label: { |
|
|
|
} label: { |
|
|
|
TeamRowView(team: team) |
|
|
|
TeamRowView(team: team) |
|
|
|
|
|
|
|
if isImported && team.isImported() == false { |
|
|
|
|
|
|
|
Text("ne provient pas du fichier beach-padel").foregroundStyle(.red) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
.swipeActions(edge: .trailing, allowsFullSwipe: true) { |
|
|
|
.swipeActions(edge: .trailing, allowsFullSwipe: true) { |
|
|
|
if tournament.enableOnlineRegistration == false { |
|
|
|
if tournament.enableOnlineRegistration == false { |
|
|
|
_teamDeleteButtonView(team) |
|
|
|
_teamDeleteButtonView(team) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
.listRowView(isActive: true, color: team.initialRoundColor() ?? tournament.cutLabelColor(index: teamIndex, teamCount: filterMode == .waiting ? 0 : selectedSortedTeams.count), hideColorVariation: true) |
|
|
|
.listRowView(isActive: team.hasRegisteredOnline(), color: .master, hideColorVariation: true) |
|
|
|
|
|
|
|
.listRowView(isActive: team.unrankedOrUnknown(), color: .logoYellow, hideColorVariation: true) |
|
|
|
|
|
|
|
.listRowView(isActive: isImported && team.isImported() == false, color: .red, hideColorVariation: false) |
|
|
|
|
|
|
|
.listRowView(isActive: true, color: team.initialRoundColor() ?? tournament.cutLabelColor(index: teamIndex, teamCount: filterMode == .waiting ? 0 : selectedSortedTeams.count), hideColorVariation: true, alignment: .trailing) |
|
|
|
} |
|
|
|
} |
|
|
|
} header: { |
|
|
|
} header: { |
|
|
|
if filterMode == .all && walkoutTeams.isEmpty == false { |
|
|
|
if filterMode == .all && walkoutTeams.isEmpty == false { |
|
|
|
@ -616,8 +700,32 @@ struct InscriptionManagerView: View { |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
Text("\(teams.count.formatted()) équipe\(teams.count.pluralSuffix)") |
|
|
|
Text("\(teams.count.formatted()) équipe\(teams.count.pluralSuffix)") |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} footer: { |
|
|
|
|
|
|
|
FooterButtonView("Légende") { |
|
|
|
|
|
|
|
showLegendView = true |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
.headerProminence(.increased) |
|
|
|
.headerProminence(.increased) |
|
|
|
|
|
|
|
.sheet(isPresented: $showLegendView) { |
|
|
|
|
|
|
|
List { |
|
|
|
|
|
|
|
Section { |
|
|
|
|
|
|
|
ForEach(LegendInscriptionTip.allCases) { legend in |
|
|
|
|
|
|
|
Text(legend.legendDescriptionLabel()) |
|
|
|
|
|
|
|
.listRowView(isActive: legend.isActive, color: legend.color, hideColorVariation: legend.hideColorVariation) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} header: { |
|
|
|
|
|
|
|
Text("Statut de l'inscription") |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
Section { |
|
|
|
|
|
|
|
ForEach(LegendPositionTip.allCases) { legend in |
|
|
|
|
|
|
|
Text(legend.legendDescriptionLabel()) |
|
|
|
|
|
|
|
.listRowView(isActive: legend.isActive, color: legend.color, hideColorVariation: legend.hideColorVariation, alignment: .trailing) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} header: { |
|
|
|
|
|
|
|
Text("Statut de la position dans le tournoi") |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
ForEach(teams) { team in |
|
|
|
ForEach(teams) { team in |
|
|
|
let teamIndex = team.index(in: sortedTeams) |
|
|
|
let teamIndex = team.index(in: sortedTeams) |
|
|
|
|