@ -166,7 +166,7 @@ struct InscriptionManagerView: View {
self . tournament . shouldVerifyBracket = true
self . tournament . shouldVerifyGroupStage = true
let waitingList = self . tournament . waitingListTeams ( in : selectedSortedTeams )
let waitingList = self . tournament . waitingListTeams ( in : selectedSortedTeams , includingWalkOuts : true )
waitingList . forEach { team in
if team . bracketPosition != nil || team . groupStagePosition != nil {
team . resetPositions ( )
@ -185,7 +185,6 @@ struct InscriptionManagerView: View {
var body : some View {
VStack ( spacing : 0 ) {
_managementView ( )
if _isEditingTeam ( ) {
_buildingTeamView ( )
} else if sortedTeams . isEmpty {
@ -574,7 +573,7 @@ struct InscriptionManagerView: View {
Section {
TeamDetailView ( team : team )
} header : {
TeamHeaderView ( team : team , teamIndex : teamIndex , tournament : tournament , teamCount : filterMode = = . waiting ? 0 : selectedSortedTeams . count )
TeamHeaderView ( team : team , teamIndex : filterMode = = . waiting ? nil : teamIndex , tournament : tournament , teamCount : filterMode = = . waiting ? 0 : selectedSortedTeams . count )
} footer : {
_teamFooterView ( team )
}
@ -586,21 +585,18 @@ struct InscriptionManagerView: View {
. autocorrectionDisabled ( )
}
@ MainActo r
@ ViewBuilde r
private func _managementView ( ) -> some View {
HStack {
Button {
presentPlayerCreation = true
presentPlayerSearch = true
} label : {
HStack ( spacing : 4 ) {
Image ( systemName : " person.fill.badge.plus " )
. resizable ( )
. scaledToFit ( )
. frame ( width : 20 )
Text ( " Créer " )
. font ( . headline )
Text ( " Rechercher dans la base fédérale " )
}
. frame ( maxWidth : . infinity )
Button {
presentPlayerCreation = true
} label : {
Text ( " Créer un non classé / non licencié " )
}
PasteButton ( payloadType : String . self ) { strings in
@ -614,25 +610,6 @@ struct InscriptionManagerView: View {
}
}
}
Button {
presentPlayerSearch = true
} label : {
HStack ( spacing : 4 ) {
Image ( systemName : " person.fill.viewfinder " )
. resizable ( )
. scaledToFit ( )
. frame ( width : 20 )
Text ( " FFT " )
. font ( . headline )
}
. frame ( maxWidth : . infinity )
}
}
. buttonStyle ( . borderedProminent )
. tint ( . master )
. fixedSize ( horizontal : false , vertical : true )
. padding ( 16 )
}
@ -690,6 +667,8 @@ struct InscriptionManagerView: View {
}
}
_informationView ( )
Section {
TipView ( fileTip ) { action in
@ -758,25 +737,36 @@ struct InscriptionManagerView: View {
}
}
@ ViewBuilder
private func _informationView ( ) -> some View {
Section {
Button {
filterMode = . all
} label : {
LabeledContent {
Text ( unsortedTeamsWithoutWO . count . formatted ( ) + " / " + tournament . teamCount . formatted ( ) ) . font ( . largeTitle )
Text ( unsortedTeamsWithoutWO . count . formatted ( ) + " / " + tournament . teamCount . formatted ( ) )
} label : {
Text ( " Paire \( unsortedTeamsWithoutWO . count . pluralSuffix ) inscrite \( unsortedTeamsWithoutWO . count . pluralSuffix ) " )
}
}
. buttonStyle ( . plain )
LabeledContent {
Text ( walkoutTeams . count . formatted ( ) ) . font ( . largeTitle )
} label : {
Text ( " Forfait \( walkoutTeams . count . pluralSuffix ) " )
HStack {
let waiting : Int = max ( 0 , unsortedTeamsWithoutWO . count - tournament . teamCount )
FooterButtonView ( " \( waiting . formatted ( ) ) équipes en attente \( waiting . pluralSuffix ) " ) {
filterMode = . waiting
}
. disabled ( filterMode = = . waiting )
LabeledContent {
Text ( max ( 0 , unsortedTeamsWithoutWO . count - tournament . teamCount ) . formatted ( ) ) . font ( . largeTitle )
} label : {
Text ( " Attente " )
Divider ( )
let wo = walkoutTeams . count
FooterButtonView ( " \( wo . formatted ( ) ) équipes forfait \( wo . pluralSuffix ) " ) {
filterMode = . walkOut
}
. disabled ( filterMode = = . walkOut )
}
. fixedSize ( horizontal : true , vertical : true )
NavigationLink {
InscriptionInfoView ( )
@ -784,7 +774,7 @@ struct InscriptionManagerView: View {
} label : {
LabeledContent {
if let registrationIssues {
Text ( registrationIssues . formatted ( ) ) . font ( . largeTitle )
Text ( registrationIssues . formatted ( ) )
} else {
ProgressView ( )
}
@ -792,7 +782,28 @@ struct InscriptionManagerView: View {
Text ( " Problèmes détéctés " )
}
}
} header : {
Text ( " Statut des inscriptions " )
} footer : {
HStack {
Menu {
_managementView ( )
} label : {
Text ( " Complétez votre liste " )
}
Text ( " ou " )
FooterButtonView ( " Importez un fichier " ) {
presentImportView = true
}
}
// i f f i l t e r M o d e ! = . a l l {
// F o o t e r B u t t o n V i e w ( " t o u t a f f i c h e r " ) {
// f i l t e r M o d e = . a l l
// }
// }
}
. headerProminence ( . increased )
}
@ ViewBuilder
@ -1016,6 +1027,31 @@ struct InscriptionManagerView: View {
}
}
}
} header : {
let _currentSelection = _currentSelection ( )
let selectedSortedTeams = tournament . selectedSortedTeams ( )
let rank = _currentSelection . map {
$0 . computedRank
} . reduce ( 0 , + )
let teamIndex = selectedSortedTeams . firstIndex ( where : { $0 . weight >= rank } ) ? ? selectedSortedTeams . count
if _currentSelection . isEmpty = = false , tournament . hideWeight ( ) = = false , rank > 0 {
HStack ( spacing : 16.0 ) {
VStack ( alignment : . leading , spacing : 0 ) {
Text ( " Rang " ) . font ( . caption )
Text ( " # " + ( teamIndex + 1 ) . formatted ( ) )
}
VStack ( alignment : . leading , spacing : 0 ) {
Text ( " Poids " ) . font ( . caption )
Text ( rank . formatted ( ) )
}
Spacer ( )
VStack ( alignment : . trailing , spacing : 0 ) {
Text ( " " ) . font ( . caption )
Text ( tournament . cutLabel ( index : teamIndex , teamCount : selectedSortedTeams . count ) )
}
}
}
}
if editedTeam = = nil {
@ -1163,6 +1199,12 @@ struct InscriptionManagerView: View {
private func _teamMenuOptionView ( _ team : TeamRegistration ) -> some View {
Menu {
Section {
NavigationLink {
GroupStageTeamReplacementView ( team : team )
} label : {
Text ( " Chercher à remplacer " )
}
MenuWarningView ( tournament : tournament , teams : [ team ] , contactType : $ contactType )
// D i v i d e r ( )
Button ( " Copier " ) {