@ -28,6 +28,7 @@ struct RoundView: View {
List {
let loserRounds = round . loserRounds ( )
let availableSeeds = tournament . availableSeeds ( )
let availableQualifiedTeams = tournament . availableQualifiedTeams ( )
let displayableMatches = round . displayableMatches ( ) . sorted ( by : \ . index )
let spaceLeft = displayableMatches . filter ( { $0 . hasSpaceLeft ( ) } )
@ -76,6 +77,7 @@ struct RoundView: View {
if availableQualifiedTeams . isEmpty = = false && spaceLeft . isEmpty = = false {
Section {
DisclosureGroup {
ForEach ( availableQualifiedTeams ) { team in
NavigationLink {
SpinDrawView ( drawees : [ team ] , segments : spaceLeft ) { results in
@ -93,14 +95,18 @@ struct RoundView: View {
TeamRowView ( team : team , displayCallDate : false )
}
}
} header : {
} label : {
Text ( " Qualifié \( availableQualifiedTeams . count . pluralSuffix ) à placer " ) . badge ( availableQualifiedTeams . count )
}
} header : {
Text ( " Tirage au sort visuel d'un qualifié " ) . font ( . subheadline )
}
}
if tournament . availableSeeds ( ) . isEmpty = = false && seedSpaceLeft . isEmpty = = false {
if availableSeeds . isEmpty = = false && seedSpaceLeft . isEmpty = = false {
Section {
ForEach ( tournament . availableSeeds ( ) ) { team in
DisclosureGroup {
ForEach ( availableSeeds ) { team in
NavigationLink {
SpinDrawView ( drawees : [ team ] , segments : seedSpaceLeft ) { results in
Task {
@ -108,7 +114,33 @@ struct RoundView: View {
team . setSeedPosition ( inSpot : seedSpaceLeft [ drawResult . drawIndex ] , slot : nil , opposingSeeding : false )
}
_save ( )
if tournament . availableSeeds ( ) . isEmpty && tournament . availableQualifiedTeams ( ) . isEmpty {
if availableSeeds . isEmpty && tournament . availableQualifiedTeams ( ) . isEmpty {
self . isEditingTournamentSeed . wrappedValue = false
}
}
}
} label : {
TeamRowView ( team : team , displayCallDate : false )
}
}
} label : {
Text ( " Tête \( availableSeeds . count . pluralSuffix ) de série à placer " ) . badge ( availableSeeds . count )
}
} header : {
Text ( " Tirage au sort visuel d'une tête de série " ) . font ( . subheadline )
}
} else if availableSeeds . isEmpty = = false && spaceLeft . isEmpty = = false {
Section {
DisclosureGroup {
ForEach ( availableSeeds ) { team in
NavigationLink {
SpinDrawView ( drawees : [ team ] , segments : spaceLeft ) { results in
Task {
results . forEach { drawResult in
team . setSeedPosition ( inSpot : spaceLeft [ drawResult . drawIndex ] , slot : nil , opposingSeeding : false )
}
_save ( )
if availableSeeds . isEmpty && tournament . availableQualifiedTeams ( ) . isEmpty {
self . isEditingTournamentSeed . wrappedValue = false
}
}
@ -117,6 +149,9 @@ struct RoundView: View {
TeamRowView ( team : team , displayCallDate : false )
}
}
} label : {
Text ( " Tête \( availableSeeds . count . pluralSuffix ) de série à placer " ) . badge ( availableSeeds . count )
}
} header : {
Text ( " Tirage au sort visuel d'une tête de série " ) . font ( . subheadline )
}