|
|
|
@ -9,8 +9,8 @@ import SwiftUI |
|
|
|
|
|
|
|
|
|
|
|
struct TournamentBuildView: View { |
|
|
|
struct TournamentBuildView: View { |
|
|
|
var tournament: Tournament |
|
|
|
var tournament: Tournament |
|
|
|
@State private var bracketStatus: String? |
|
|
|
@State private var bracketStatus: (status: String, cut: TeamRegistration.TeamRange?)? |
|
|
|
@State private var groupStageStatus: String? |
|
|
|
@State private var groupStageStatus: (String, TeamRegistration.TeamRange?)? |
|
|
|
@State private var callStatus: Tournament.TournamentStatus? |
|
|
|
@State private var callStatus: Tournament.TournamentStatus? |
|
|
|
@State private var scheduleStatus: Tournament.TournamentStatus? |
|
|
|
@State private var scheduleStatus: Tournament.TournamentStatus? |
|
|
|
@State private var cashierStatus: Tournament.TournamentStatus? |
|
|
|
@State private var cashierStatus: Tournament.TournamentStatus? |
|
|
|
@ -18,7 +18,74 @@ struct TournamentBuildView: View { |
|
|
|
@ViewBuilder |
|
|
|
@ViewBuilder |
|
|
|
var body: some View { |
|
|
|
var body: some View { |
|
|
|
let state = tournament.state() |
|
|
|
let state = tournament.state() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Section { |
|
|
|
|
|
|
|
if tournament.groupStageCount > 0 { |
|
|
|
|
|
|
|
NavigationLink(value: Screen.groupStage) { |
|
|
|
|
|
|
|
LabeledContent { |
|
|
|
|
|
|
|
if let groupStageStatus { |
|
|
|
|
|
|
|
Text(groupStageStatus.0).lineLimit(1) |
|
|
|
|
|
|
|
.multilineTextAlignment(.trailing) |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
ProgressView() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} label: { |
|
|
|
|
|
|
|
Text("Poules") |
|
|
|
|
|
|
|
if tournament.shouldVerifyGroupStage { |
|
|
|
|
|
|
|
Text("Vérifier les poules").foregroundStyle(.logoRed) |
|
|
|
|
|
|
|
} else if let range = groupStageStatus?.1 { |
|
|
|
|
|
|
|
HStack { |
|
|
|
|
|
|
|
if let left = range.left { |
|
|
|
|
|
|
|
Text(left.weight.formatted()) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if let right = range.right { |
|
|
|
|
|
|
|
Image(systemName: "arrowshape.forward.fill") |
|
|
|
|
|
|
|
Text(right.weight.formatted()) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
.task { |
|
|
|
|
|
|
|
groupStageStatus = await tournament.groupStageStatus() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if tournament.rounds().isEmpty == false { |
|
|
|
|
|
|
|
NavigationLink(value: Screen.round) { |
|
|
|
|
|
|
|
LabeledContent { |
|
|
|
|
|
|
|
if let bracketStatus { |
|
|
|
|
|
|
|
Text(bracketStatus.0).lineLimit(1) |
|
|
|
|
|
|
|
.multilineTextAlignment(.trailing) |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
ProgressView() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} label: { |
|
|
|
|
|
|
|
Text("Tableau") |
|
|
|
|
|
|
|
if tournament.shouldVerifyBracket { |
|
|
|
|
|
|
|
Text("Vérifier la tableau").foregroundStyle(.logoRed) |
|
|
|
|
|
|
|
} else if let range = bracketStatus?.1 { |
|
|
|
|
|
|
|
HStack { |
|
|
|
|
|
|
|
if let left = range.left { |
|
|
|
|
|
|
|
Text(left.weight.formatted()) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if let right = range.right { |
|
|
|
|
|
|
|
Image(systemName: "arrowshape.forward.fill") |
|
|
|
|
|
|
|
Text(right.weight.formatted()) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
.task { |
|
|
|
|
|
|
|
bracketStatus = await tournament.bracketStatus() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Section { |
|
|
|
Section { |
|
|
|
if tournament.hasEnded() { |
|
|
|
if tournament.hasEnded() { |
|
|
|
NavigationLink(value: Screen.rankings) { |
|
|
|
NavigationLink(value: Screen.rankings) { |
|
|
|
@ -31,27 +98,6 @@ struct TournamentBuildView: View { |
|
|
|
TournamentBroadcastRowView(tournament: tournament) |
|
|
|
TournamentBroadcastRowView(tournament: tournament) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
NavigationLink(value: Screen.cashier) { |
|
|
|
|
|
|
|
let tournamentStatus = cashierStatus |
|
|
|
|
|
|
|
LabeledContent { |
|
|
|
|
|
|
|
if let tournamentStatus { |
|
|
|
|
|
|
|
Text(tournamentStatus.completion) |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
ProgressView() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} label: { |
|
|
|
|
|
|
|
Text("Encaissement") |
|
|
|
|
|
|
|
if let tournamentStatus { |
|
|
|
|
|
|
|
Text(tournamentStatus.label).lineLimit(1) |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
Text(" ") |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
.task { |
|
|
|
|
|
|
|
cashierStatus = await tournament.cashierStatus() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if state != .finished { |
|
|
|
if state != .finished { |
|
|
|
NavigationLink(value: Screen.schedule) { |
|
|
|
NavigationLink(value: Screen.schedule) { |
|
|
|
let tournamentStatus = scheduleStatus |
|
|
|
let tournamentStatus = scheduleStatus |
|
|
|
@ -95,49 +141,26 @@ struct TournamentBuildView: View { |
|
|
|
callStatus = await tournament.callStatus() |
|
|
|
callStatus = await tournament.callStatus() |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Section { |
|
|
|
|
|
|
|
if tournament.groupStageCount > 0 { |
|
|
|
|
|
|
|
NavigationLink(value: Screen.groupStage) { |
|
|
|
|
|
|
|
LabeledContent { |
|
|
|
|
|
|
|
if let groupStageStatus { |
|
|
|
|
|
|
|
Text(groupStageStatus).lineLimit(1) |
|
|
|
|
|
|
|
.multilineTextAlignment(.trailing) |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
ProgressView() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} label: { |
|
|
|
|
|
|
|
Text("Poules") |
|
|
|
|
|
|
|
if tournament.shouldVerifyGroupStage { |
|
|
|
|
|
|
|
Text("Vérifier les poules").foregroundStyle(.logoRed) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
.task { |
|
|
|
|
|
|
|
groupStageStatus = await tournament.groupStageStatus() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if tournament.rounds().isEmpty == false { |
|
|
|
NavigationLink(value: Screen.cashier) { |
|
|
|
NavigationLink(value: Screen.round) { |
|
|
|
let tournamentStatus = cashierStatus |
|
|
|
LabeledContent { |
|
|
|
LabeledContent { |
|
|
|
if let bracketStatus { |
|
|
|
if let tournamentStatus { |
|
|
|
Text(bracketStatus).lineLimit(1) |
|
|
|
Text(tournamentStatus.completion) |
|
|
|
.multilineTextAlignment(.trailing) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
ProgressView() |
|
|
|
ProgressView() |
|
|
|
} |
|
|
|
} |
|
|
|
} label: { |
|
|
|
} label: { |
|
|
|
Text("Encaissement") |
|
|
|
Text("Tableau") |
|
|
|
if let tournamentStatus { |
|
|
|
if tournament.shouldVerifyBracket { |
|
|
|
Text(tournamentStatus.label).lineLimit(1) |
|
|
|
Text("Vérifier la tableau").foregroundStyle(.logoRed) |
|
|
|
} else { |
|
|
|
} |
|
|
|
Text(" ") |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
.task { |
|
|
|
} |
|
|
|
bracketStatus = await tournament.bracketStatus() |
|
|
|
.task { |
|
|
|
} |
|
|
|
cashierStatus = await tournament.cashierStatus() |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|