|
|
|
@ -87,11 +87,12 @@ struct RoundView: View { |
|
|
|
.tipStyle(tint: .master, asSection: true) |
|
|
|
.tipStyle(tint: .master, asSection: true) |
|
|
|
|
|
|
|
|
|
|
|
if upperRound.loserRounds.isEmpty == false { |
|
|
|
if upperRound.loserRounds.isEmpty == false { |
|
|
|
|
|
|
|
let correspondingLoserRoundTitle = upperRound.round.correspondingLoserRoundTitle() |
|
|
|
Section { |
|
|
|
Section { |
|
|
|
NavigationLink { |
|
|
|
NavigationLink { |
|
|
|
LoserRoundsView(upperBracketRound: upperRound) |
|
|
|
LoserRoundsView(upperBracketRound: upperRound) |
|
|
|
.environment(tournament) |
|
|
|
.environment(tournament) |
|
|
|
.navigationTitle(upperRound.correspondingLoserRoundTitle) |
|
|
|
.navigationTitle(correspondingLoserRoundTitle) |
|
|
|
} label: { |
|
|
|
} label: { |
|
|
|
LabeledContent { |
|
|
|
LabeledContent { |
|
|
|
let status = upperRound.status() |
|
|
|
let status = upperRound.status() |
|
|
|
@ -101,7 +102,7 @@ struct RoundView: View { |
|
|
|
Text("\(status.0) terminé\(status.0.pluralSuffix) sur \(status.1)") |
|
|
|
Text("\(status.0) terminé\(status.0.pluralSuffix) sur \(status.1)") |
|
|
|
} |
|
|
|
} |
|
|
|
} label: { |
|
|
|
} label: { |
|
|
|
Text(upperRound.correspondingLoserRoundTitle) |
|
|
|
Text(correspondingLoserRoundTitle) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
@ -129,12 +130,14 @@ struct RoundView: View { |
|
|
|
if availableSeeds.isEmpty == false, let availableSeedGroup { |
|
|
|
if availableSeeds.isEmpty == false, let availableSeedGroup { |
|
|
|
Section { |
|
|
|
Section { |
|
|
|
RowButtonView("Placer \(availableSeedGroup.localizedLabel())" + ((availableSeedGroup.isFixed() == false) ? " au hasard" : "")) { |
|
|
|
RowButtonView("Placer \(availableSeedGroup.localizedLabel())" + ((availableSeedGroup.isFixed() == false) ? " au hasard" : "")) { |
|
|
|
tournament.setSeeds(inRoundIndex: upperRound.round.index, inSeedGroup: availableSeedGroup) |
|
|
|
Task { |
|
|
|
_save() |
|
|
|
tournament.setSeeds(inRoundIndex: upperRound.round.index, inSeedGroup: availableSeedGroup) |
|
|
|
if tournament.availableSeeds().isEmpty && tournament.availableQualifiedTeams().isEmpty { |
|
|
|
_save() |
|
|
|
self.isEditingTournamentSeed.wrappedValue = false |
|
|
|
if tournament.availableSeeds().isEmpty && tournament.availableQualifiedTeams().isEmpty { |
|
|
|
|
|
|
|
self.isEditingTournamentSeed.wrappedValue = false |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
_prepareRound() |
|
|
|
} |
|
|
|
} |
|
|
|
_prepareRound() |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} footer: { |
|
|
|
} footer: { |
|
|
|
if availableSeedGroup.isFixed() == false { |
|
|
|
if availableSeedGroup.isFixed() == false { |
|
|
|
@ -160,14 +163,16 @@ struct RoundView: View { |
|
|
|
ForEach(availableQualifiedTeams) { team in |
|
|
|
ForEach(availableQualifiedTeams) { team in |
|
|
|
NavigationLink { |
|
|
|
NavigationLink { |
|
|
|
SpinDrawView(drawees: [team], segments: spaceLeft) { results in |
|
|
|
SpinDrawView(drawees: [team], segments: spaceLeft) { results in |
|
|
|
results.forEach { drawResult in |
|
|
|
Task { |
|
|
|
team.setSeedPosition(inSpot: spaceLeft[drawResult.drawIndex], slot: nil, opposingSeeding: true) |
|
|
|
results.forEach { drawResult in |
|
|
|
|
|
|
|
team.setSeedPosition(inSpot: spaceLeft[drawResult.drawIndex], slot: nil, opposingSeeding: true) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
_save() |
|
|
|
|
|
|
|
if tournament.availableSeeds().isEmpty && tournament.availableQualifiedTeams().isEmpty { |
|
|
|
|
|
|
|
self.isEditingTournamentSeed.wrappedValue = false |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
_prepareRound() |
|
|
|
} |
|
|
|
} |
|
|
|
_save() |
|
|
|
|
|
|
|
if tournament.availableSeeds().isEmpty && tournament.availableQualifiedTeams().isEmpty { |
|
|
|
|
|
|
|
self.isEditingTournamentSeed.wrappedValue = false |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
_prepareRound() |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} label: { |
|
|
|
} label: { |
|
|
|
TeamRowView(team: team, displayCallDate: false) |
|
|
|
TeamRowView(team: team, displayCallDate: false) |
|
|
|
@ -189,14 +194,16 @@ struct RoundView: View { |
|
|
|
ForEach(availableSeeds) { team in |
|
|
|
ForEach(availableSeeds) { team in |
|
|
|
NavigationLink { |
|
|
|
NavigationLink { |
|
|
|
SpinDrawView(drawees: [team], segments: seedSpaceLeft) { results in |
|
|
|
SpinDrawView(drawees: [team], segments: seedSpaceLeft) { results in |
|
|
|
results.forEach { drawResult in |
|
|
|
Task { |
|
|
|
team.setSeedPosition(inSpot: seedSpaceLeft[drawResult.drawIndex], slot: nil, opposingSeeding: false) |
|
|
|
results.forEach { drawResult in |
|
|
|
} |
|
|
|
team.setSeedPosition(inSpot: seedSpaceLeft[drawResult.drawIndex], slot: nil, opposingSeeding: false) |
|
|
|
_save() |
|
|
|
} |
|
|
|
if tournament.availableSeeds().isEmpty && tournament.availableQualifiedTeams().isEmpty { |
|
|
|
_save() |
|
|
|
self.isEditingTournamentSeed.wrappedValue = false |
|
|
|
if tournament.availableSeeds().isEmpty && tournament.availableQualifiedTeams().isEmpty { |
|
|
|
|
|
|
|
self.isEditingTournamentSeed.wrappedValue = false |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
_prepareRound() |
|
|
|
} |
|
|
|
} |
|
|
|
_prepareRound() |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} label: { |
|
|
|
} label: { |
|
|
|
TeamRowView(team: team, displayCallDate: false) |
|
|
|
TeamRowView(team: team, displayCallDate: false) |
|
|
|
@ -214,14 +221,16 @@ struct RoundView: View { |
|
|
|
ForEach(availableSeeds) { team in |
|
|
|
ForEach(availableSeeds) { team in |
|
|
|
NavigationLink { |
|
|
|
NavigationLink { |
|
|
|
SpinDrawView(drawees: [team], segments: spaceLeft) { results in |
|
|
|
SpinDrawView(drawees: [team], segments: spaceLeft) { results in |
|
|
|
results.forEach { drawResult in |
|
|
|
Task { |
|
|
|
team.setSeedPosition(inSpot: spaceLeft[drawResult.drawIndex], slot: nil, opposingSeeding: true) |
|
|
|
results.forEach { drawResult in |
|
|
|
|
|
|
|
team.setSeedPosition(inSpot: spaceLeft[drawResult.drawIndex], slot: nil, opposingSeeding: true) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
_save() |
|
|
|
|
|
|
|
if tournament.availableSeeds().isEmpty && tournament.availableQualifiedTeams().isEmpty { |
|
|
|
|
|
|
|
self.isEditingTournamentSeed.wrappedValue = false |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
_prepareRound() |
|
|
|
} |
|
|
|
} |
|
|
|
_save() |
|
|
|
|
|
|
|
if tournament.availableSeeds().isEmpty && tournament.availableQualifiedTeams().isEmpty { |
|
|
|
|
|
|
|
self.isEditingTournamentSeed.wrappedValue = false |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
_prepareRound() |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} label: { |
|
|
|
} label: { |
|
|
|
TeamRowView(team: team, displayCallDate: false) |
|
|
|
TeamRowView(team: team, displayCallDate: false) |
|
|
|
@ -286,15 +295,17 @@ struct RoundView: View { |
|
|
|
let availableSeedSpot = opposingSeeding ? spaceLeft : seedSpaceLeft |
|
|
|
let availableSeedSpot = opposingSeeding ? spaceLeft : seedSpaceLeft |
|
|
|
NavigationStack { |
|
|
|
NavigationStack { |
|
|
|
SpinDrawView(drawees: seeds, segments: availableSeedSpot, autoMode: true) { draws in |
|
|
|
SpinDrawView(drawees: seeds, segments: availableSeedSpot, autoMode: true) { draws in |
|
|
|
draws.forEach { drawResult in |
|
|
|
Task { |
|
|
|
seeds[drawResult.drawee].setSeedPosition(inSpot: availableSeedSpot[drawResult.drawIndex], slot: nil, opposingSeeding: opposingSeeding) |
|
|
|
draws.forEach { drawResult in |
|
|
|
} |
|
|
|
seeds[drawResult.drawee].setSeedPosition(inSpot: availableSeedSpot[drawResult.drawIndex], slot: nil, opposingSeeding: opposingSeeding) |
|
|
|
|
|
|
|
} |
|
|
|
_save() |
|
|
|
|
|
|
|
_prepareRound() |
|
|
|
_save() |
|
|
|
|
|
|
|
_prepareRound() |
|
|
|
if tournament.availableSeeds().isEmpty && tournament.availableQualifiedTeams().isEmpty { |
|
|
|
|
|
|
|
self.isEditingTournamentSeed.wrappedValue = false |
|
|
|
if tournament.availableSeeds().isEmpty && tournament.availableQualifiedTeams().isEmpty { |
|
|
|
|
|
|
|
self.isEditingTournamentSeed.wrappedValue = false |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|