diff --git a/PadelClub.xcodeproj/project.pbxproj b/PadelClub.xcodeproj/project.pbxproj index 51913ad..fc7c7c7 100644 --- a/PadelClub.xcodeproj/project.pbxproj +++ b/PadelClub.xcodeproj/project.pbxproj @@ -1882,7 +1882,7 @@ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_ENTITLEMENTS = PadelClub/PadelClub.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 73; + CURRENT_PROJECT_VERSION = 74; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEFINES_MODULE = YES; DEVELOPMENT_ASSET_PATHS = "\"PadelClub/Preview Content\""; @@ -1922,7 +1922,7 @@ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_ENTITLEMENTS = PadelClub/PadelClub.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 73; + CURRENT_PROJECT_VERSION = 74; DEFINES_MODULE = YES; DEVELOPMENT_ASSET_PATHS = "\"PadelClub/Preview Content\""; DEVELOPMENT_TEAM = BQ3Y44M3Q6; diff --git a/PadelClub/Data/PlayerRegistration.swift b/PadelClub/Data/PlayerRegistration.swift index a4a6c1f..fbb07ca 100644 --- a/PadelClub/Data/PlayerRegistration.swift +++ b/PadelClub/Data/PlayerRegistration.swift @@ -80,8 +80,15 @@ class PlayerRegistration: ModelObject, Storable { licenceId = federalData[3] clubName = federalData[4] rank = Int(federalData[5]) - email = federalData[6] - phoneNumber = federalData[7] + let _email = federalData[6] + if _email.isEmpty == false { + self.email = _email + } + let _phoneNumber = federalData[7] + if _phoneNumber.isEmpty == false { + self.phoneNumber = _phoneNumber + } + source = .beachPadel if sexUnknown { if sex == 1 && FileImportManager.shared.foundInWomenData(license: federalData[3]) { diff --git a/PadelClub/Views/Calling/SeedsCallingView.swift b/PadelClub/Views/Calling/SeedsCallingView.swift index 8ab7110..d4716dd 100644 --- a/PadelClub/Views/Calling/SeedsCallingView.swift +++ b/PadelClub/Views/Calling/SeedsCallingView.swift @@ -9,7 +9,7 @@ import SwiftUI struct SeedsCallingView: View { @Environment(Tournament.self) var tournament: Tournament - @State private var displayByMatch: Bool = false + @State private var displayByMatch: Bool = true var body: some View { List { @@ -48,6 +48,14 @@ struct SeedsCallingView: View { } let keys = times.keys.compactMap { $0 }.sorted() List { + + Section { + RowButtonView(displayByMatch ? "Regrouper par horaire" : "Lister par match") { + displayByMatch.toggle() + } + } + + if displayByMatch == false { ForEach(keys, id: \.self) { time in if let matches = times[time] { @@ -109,14 +117,6 @@ struct SeedsCallingView: View { .navigationTitle(round.roundTitle()) .navigationBarTitleDisplayMode(.inline) .toolbarBackground(.visible, for: .navigationBar) - .toolbar { - ToolbarItem(placement: .topBarTrailing) { - Button(displayByMatch ? "par horaire" : "par match") { - displayByMatch.toggle() - } - .buttonBorderShape(.capsule) - } - } } } diff --git a/PadelClub/Views/Calling/SendToAllView.swift b/PadelClub/Views/Calling/SendToAllView.swift index 2ee2938..0a449c6 100644 --- a/PadelClub/Views/Calling/SendToAllView.swift +++ b/PadelClub/Views/Calling/SendToAllView.swift @@ -20,7 +20,7 @@ struct SendToAllView: View { @State private var sentError: ContactManagerError? = nil let addLink: Bool // @State var cannotPayForTournament: Bool = false - @State private var pageLink: PageLink = .teams + @State private var pageLink: PageLink = .matches @State var showSubscriptionView: Bool = false @State var showUserCreationView: Bool = false @@ -75,6 +75,8 @@ struct SendToAllView: View { .tag(round.id) } } + } footer: { + Text("Si vous ne souhaitez pas contacter toutes les équipes, choisissez un ou plusieurs groupes d'équipes manuellement.") } if addLink { diff --git a/PadelClub/Views/GroupStage/Shared/GroupStageTeamReplacementView.swift b/PadelClub/Views/GroupStage/Shared/GroupStageTeamReplacementView.swift index 5c1b8f2..6a89cd0 100644 --- a/PadelClub/Views/GroupStage/Shared/GroupStageTeamReplacementView.swift +++ b/PadelClub/Views/GroupStage/Shared/GroupStageTeamReplacementView.swift @@ -39,7 +39,7 @@ struct GroupStageTeamReplacementView: View { private func _searchableRange(_ teamRange: TeamRegistration.TeamRange) -> String { let left = teamRange.left?.weight let right = teamRange.right?.weight - let sides = [left, right].compactMap({ $0 }).map { $0 - _getWeight() } + let sides = [left, right].compactMap({ $0 }).map { max($0 - _getWeight(), 1) } return sides.map({ String($0) }).joined(separator: ",") } @@ -73,9 +73,11 @@ struct GroupStageTeamReplacementView: View { .labelsHidden() .pickerStyle(.inline) } header: { - Text("Remplacer") - } footer: { - Text("Remplacement de l'équipe ou d'un joueur particulier") + if let selectedPlayer { + Text("Remplacer \(selectedPlayer.playerLabel())") + } else { + Text("Remplacer toute l'équipe") + } } if let teamRange { @@ -147,7 +149,7 @@ struct GroupStageTeamReplacementView: View { @ViewBuilder var body: some View { - if let team { + if let team, team.weight + playerWeight > 0 { Text((team.weight + playerWeight).formatted()).font(.largeTitle) } else { Text("Aucune limite") diff --git a/PadelClub/Views/Player/Components/EditablePlayerView.swift b/PadelClub/Views/Player/Components/EditablePlayerView.swift index 4eb3b75..46c5ea3 100644 --- a/PadelClub/Views/Player/Components/EditablePlayerView.swift +++ b/PadelClub/Views/Player/Components/EditablePlayerView.swift @@ -96,8 +96,8 @@ struct EditablePlayerView: View { } if let mail = player.email, let url = URL(string: "mailto:\(mail)") { Link(destination: url) { - Label("SMS", systemImage: "message") - Text(mail) + Label("Mail", systemImage: "envelope") + Text(mail).lineLimit(1) } } diff --git a/PadelClub/Views/Tournament/FileImportView.swift b/PadelClub/Views/Tournament/FileImportView.swift index 0641b19..df1ca0f 100644 --- a/PadelClub/Views/Tournament/FileImportView.swift +++ b/PadelClub/Views/Tournament/FileImportView.swift @@ -142,7 +142,7 @@ struct FileImportView: View { } } - if let tournaments = tournament.eventObject()?.tournaments, tournaments.count > 1, fileProvider == .frenchFederation { + if let event = tournament.eventObject(), event.tenupId != nil, event.tournaments.count > 1, fileProvider == .frenchFederation { Section { RowButtonView("Importer pour tous les tournois") { multiImport = true @@ -443,10 +443,20 @@ struct FileImportView: View { await MonthData.calculateCurrentUnrankedValues(mostRecentDateAvailable: rankSourceDate) } - let tournaments = tournament.eventObject()?.tournaments ?? [tournament] - for tournament in tournaments { - let _teams = try await FileImportManager.shared.createTeams(from: fileContent, tournament: tournament, fileProvider: fileProvider) - self.teams += _teams + let event: Event? = tournament.eventObject() + if let event, event.tenupId != nil { + var categoriesDone: [TournamentCategory] = [] + for someTournament in event.tournaments { + if categoriesDone.contains(someTournament.tournamentCategory) == false { + let _teams = try await FileImportManager.shared.createTeams(from: fileContent, tournament: someTournament, fileProvider: fileProvider) + self.teams += _teams + categoriesDone.append(someTournament.tournamentCategory) + } else { + errorMessage = "Attention, l'événement possède plusieurs tournois d'une même catégorie (homme, femme, mixte), Padel Club ne peut savoir quelle équipe appartient à quel tournoi." + } + } + } else { + self.teams = try await FileImportManager.shared.createTeams(from: fileContent, tournament: tournament, fileProvider: fileProvider) } await MainActor.run { diff --git a/PadelClub/Views/Tournament/Screen/BroadcastView.swift b/PadelClub/Views/Tournament/Screen/BroadcastView.swift index 252be48..6ee3edc 100644 --- a/PadelClub/Views/Tournament/Screen/BroadcastView.swift +++ b/PadelClub/Views/Tournament/Screen/BroadcastView.swift @@ -23,7 +23,7 @@ struct BroadcastView: View { let filter = CIFilter.qrCodeGenerator() @State private var urlToShow: String? @State private var tvMode: Bool = false - @State private var pageLink: PageLink = .teams + @State private var pageLink: PageLink = .matches let createAccountTip = CreateAccountTip() let tournamentPublishingTip = TournamentPublishingTip() diff --git a/PadelClub/Views/Tournament/TournamentBuildView.swift b/PadelClub/Views/Tournament/TournamentBuildView.swift index 9852f12..b443928 100644 --- a/PadelClub/Views/Tournament/TournamentBuildView.swift +++ b/PadelClub/Views/Tournament/TournamentBuildView.swift @@ -64,7 +64,7 @@ struct TournamentBuildView: View { } label: { Text("Tableau") if tournament.shouldVerifyBracket { - Text("Vérifier la tableau").foregroundStyle(.logoRed) + Text("Vérifier le tableau").foregroundStyle(.logoRed) } else if let description = bracketStatus?.1 { Text(description) } else if let range = bracketStatus?.2 {