@ -22,51 +22,58 @@ struct TournamentView: View {
}
var body : some View {
List {
VStack ( spacing : 0.0 ) {
// i f t o u r n a m e n t . m i s s i n g U n r a n k e d V a l u e ( ) {
// B u t t o n ( " u p d a t e N C " ) {
// t o u r n a m e n t . f e m a l e U n r a n k e d V a l u e = S o u r c e F i l e M a n a g e r . s h a r e d . g e t U n r a n k V a l u e ( f o r M a l e : f a l s e , r a n k S o u r c e D a t e : t o u r n a m e n t . r a n k S o u r c e D a t e )
// t o u r n a m e n t . m a l e U n r a n k e d V a l u e = S o u r c e F i l e M a n a g e r . s h a r e d . g e t U n r a n k V a l u e ( f o r M a l e : t r u e , r a n k S o u r c e D a t e : t o u r n a m e n t . r a n k S o u r c e D a t e )
// t r y ? d a t a S t o r e . t o u r n a m e n t s . a d d O r U p d a t e ( i n s t a n c e : t o u r n a m e n t )
// }
// }
//
//
Section {
NavigationLink ( value : Screen . inscription ) {
LabeledContent {
Text ( tournament . unsortedTeams ( ) . count . formatted ( ) + " / " + tournament . teamCount . formatted ( ) )
. foregroundStyle ( . master )
} label : {
Text ( " Gestion des inscriptions " )
if let closedRegistrationDate = tournament . closedRegistrationDate {
Text ( " clôturé le " + closedRegistrationDate . formatted ( date : . abbreviated , time : . shortened ) )
OffersHeaderView ( )
List {
// i f t o u r n a m e n t . m i s s i n g U n r a n k e d V a l u e ( ) {
// B u t t o n ( " u p d a t e N C " ) {
// t o u r n a m e n t . f e m a l e U n r a n k e d V a l u e = S o u r c e F i l e M a n a g e r . s h a r e d . g e t U n r a n k V a l u e ( f o r M a l e : f a l s e , r a n k S o u r c e D a t e : t o u r n a m e n t . r a n k S o u r c e D a t e )
// t o u r n a m e n t . m a l e U n r a n k e d V a l u e = S o u r c e F i l e M a n a g e r . s h a r e d . g e t U n r a n k V a l u e ( f o r M a l e : t r u e , r a n k S o u r c e D a t e : t o u r n a m e n t . r a n k S o u r c e D a t e )
// t r y ? d a t a S t o r e . t o u r n a m e n t s . a d d O r U p d a t e ( i n s t a n c e : t o u r n a m e n t )
// }
// }
//
//
Section {
NavigationLink ( value : Screen . inscription ) {
LabeledContent {
Text ( tournament . unsortedTeams ( ) . count . formatted ( ) + " / " + tournament . teamCount . formatted ( ) )
. foregroundStyle ( . master )
} label : {
Text ( " Gestion des inscriptions " )
if let closedRegistrationDate = tournament . closedRegistrationDate {
Text ( " clôturé le " + closedRegistrationDate . formatted ( date : . abbreviated , time : . shortened ) )
}
}
}
}
if let endOfInscriptionDate = tournament . mandatoryRegistrationCloseDate ( ) , tournament . inscriptionClosed ( ) = = false && tournament . hasStarted ( ) = = false {
LabeledContent {
Text ( endOfInscriptionDate . formatted ( date : . abbreviated , time : . shortened ) )
. foregroundStyle ( . master )
} label : {
Text ( " Date limite " )
}
if endOfInscriptionDate < Date ( ) {
RowButtonView ( " Clôturer les inscriptions " ) {
tournament . lockRegistration ( )
_save ( )
if let endOfInscriptionDate = tournament . mandatoryRegistrationCloseDate ( ) , tournament . inscriptionClosed ( ) = = false && tournament . hasStarted ( ) = = false {
LabeledContent {
Text ( endOfInscriptionDate . formatted ( date : . abbreviated , time : . shortened ) )
. foregroundStyle ( . master )
} label : {
Text ( " Date limite " )
}
if endOfInscriptionDate < Date ( ) {
RowButtonView ( " Clôturer les inscriptions " ) {
tournament . lockRegistration ( )
_save ( )
}
}
}
}
}
switch tournament . state ( ) {
case . initial :
TournamentInitView ( )
case . build :
TournamentRunningView ( tournament : tournament )
switch tournament . state ( ) {
case . initial :
TournamentInitView ( )
case . build :
TournamentRunningView ( tournament : tournament )
}
}
}
. toolbarBackground ( . visible , for : . navigationBar )