paca_championship
Raz 1 year ago
parent 87758354c6
commit 6791aed10a
  1. 4
      PadelClub.xcodeproj/project.pbxproj
  2. 43
      PadelClub/Views/Calling/TeamsCallingView.swift
  3. 7
      PadelClub/Views/Club/ClubDetailView.swift
  4. 8
      PadelClub/Views/GroupStage/Components/GroupStageTeamView.swift
  5. 9
      PadelClub/Views/Match/Components/MatchDateView.swift
  6. 13
      PadelClub/Views/Match/Components/MatchTeamDetailView.swift
  7. 3
      PadelClub/Views/Match/MatchDetailView.swift
  8. 8
      PadelClub/Views/Score/EditScoreView.swift
  9. 11
      PadelClub/Views/Team/CoachListView.swift
  10. 9
      PadelClub/Views/Team/EditingTeamView.swift

@ -3166,7 +3166,7 @@
CODE_SIGN_ENTITLEMENTS = PadelClub/PadelClub.entitlements; CODE_SIGN_ENTITLEMENTS = PadelClub/PadelClub.entitlements;
CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1; CURRENT_PROJECT_VERSION = 2;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEFINES_MODULE = YES; DEFINES_MODULE = YES;
DEVELOPMENT_ASSET_PATHS = "\"PadelClub/Preview Content\""; DEVELOPMENT_ASSET_PATHS = "\"PadelClub/Preview Content\"";
@ -3211,7 +3211,7 @@
CODE_SIGN_ENTITLEMENTS = PadelClub/PadelClub.entitlements; CODE_SIGN_ENTITLEMENTS = PadelClub/PadelClub.entitlements;
CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1; CURRENT_PROJECT_VERSION = 2;
DEFINES_MODULE = YES; DEFINES_MODULE = YES;
DEVELOPMENT_ASSET_PATHS = "\"PadelClub/Preview Content\""; DEVELOPMENT_ASSET_PATHS = "\"PadelClub/Preview Content\"";
DEVELOPMENT_TEAM = BQ3Y44M3Q6; DEVELOPMENT_TEAM = BQ3Y44M3Q6;

@ -12,24 +12,45 @@ struct TeamsCallingView: View {
@Environment(Tournament.self) var tournament: Tournament @Environment(Tournament.self) var tournament: Tournament
let teams : [TeamRegistration] let teams : [TeamRegistration]
var filteredTeams: [TeamRegistration] {
teams.filter({ searchText.isEmpty || $0.contains(searchText) })
}
@State private var searchText: String = ""
var body: some View { var body: some View {
List { List {
PlayersWithoutContactView(players: teams.flatMap({ $0.unsortedPlayers() }).sorted(by: \.computedRank)) PlayersWithoutContactView(players: teams.flatMap({ $0.unsortedPlayers() }).sorted(by: \.computedRank))
let called = teams.filter { tournament.isStartDateIsDifferentThanCallDate($0) == false } let called = teams.filter { tournament.isStartDateIsDifferentThanCallDate($0) == false }
let confirmed = teams.filter { $0.confirmed() }
let justCalled = teams.filter { $0.called() } let justCalled = teams.filter { $0.called() }
let label = "\(justCalled.count.formatted()) / \(teams.count.formatted()) convoquées (dont \(called.count.formatted()) au bon horaire)" let label = "\(justCalled.count.formatted()) / \(teams.count.formatted())"
let subtitle = "dont \(called.count.formatted()) au bon horaire"
let confirmedLabel = "\(confirmed.count.formatted()) / \(teams.count.formatted())"
if teams.isEmpty == false { if teams.isEmpty == false, searchText.isEmpty {
Section { Section {
Text(label) LabeledContent {
Text(label).font(.title3)
} label: {
Text("Paire\(justCalled.count.pluralSuffix) convoquée\(justCalled.count.pluralSuffix)")
Text(subtitle)
}
LabeledContent {
Text(confirmedLabel).font(.title3)
} label: {
Text("Paire\(confirmed.count.pluralSuffix) confirmée\(confirmed.count.pluralSuffix)")
}
} footer: { } footer: {
Text("Vous pouvez indiquer si une équipe vous a confirmé sa convocation en appuyant sur ") + Text(Image(systemName: "ellipsis.circle")) Text("Vous pouvez indiquer si une équipe vous a confirmé sa convocation en appuyant sur ") + Text(Image(systemName: "ellipsis.circle"))
} }
}
if teams.isEmpty == false {
Section { Section {
ForEach(teams) { team in ForEach(filteredTeams) { team in
Menu { Menu {
_menuOptions(team: team) _menuOptions(team: team)
} label: { } label: {
@ -51,6 +72,7 @@ struct TeamsCallingView: View {
ContentUnavailableView("Aucune équipe", systemImage: "person.2.slash") ContentUnavailableView("Aucune équipe", systemImage: "person.2.slash")
} }
} }
.searchable(text: $searchText, placement: .navigationBarDrawer(displayMode: .always))
.headerProminence(.increased) .headerProminence(.increased)
.navigationTitle("Statut des équipes") .navigationTitle("Statut des équipes")
.navigationBarTitleDisplayMode(.inline) .navigationBarTitleDisplayMode(.inline)
@ -66,6 +88,7 @@ struct TeamsCallingView: View {
} catch { } catch {
Logger.error(error) Logger.error(error)
} }
searchText = ""
} label: { } label: {
if team.confirmed() { if team.confirmed() {
Label("Confirmation reçue", systemImage: "checkmark.circle.fill").foregroundStyle(.green) Label("Confirmation reçue", systemImage: "checkmark.circle.fill").foregroundStyle(.green)
@ -73,6 +96,16 @@ struct TeamsCallingView: View {
Label("Confirmation reçue", systemImage: "circle").foregroundStyle(.logoRed) Label("Confirmation reçue", systemImage: "circle").foregroundStyle(.logoRed)
} }
} }
Divider()
NavigationLink {
EditingTeamView(team: team)
.environment(tournament)
} label: {
Text("Détails de l'équipe")
}
Divider() Divider()
Button(role: .destructive) { Button(role: .destructive) {
@ -82,6 +115,7 @@ struct TeamsCallingView: View {
} catch { } catch {
Logger.error(error) Logger.error(error)
} }
searchText = ""
} label: { } label: {
Text("Effacer la date de convocation") Text("Effacer la date de convocation")
} }
@ -96,6 +130,7 @@ struct TeamsCallingView: View {
} catch { } catch {
Logger.error(error) Logger.error(error)
} }
searchText = ""
} label: { } label: {
Text("Indiquer comme convoquée") Text("Indiquer comme convoquée")
} }

@ -216,10 +216,13 @@ struct ClubDetailView: View {
.navigationBarBackButtonHidden(focusedField != nil) .navigationBarBackButtonHidden(focusedField != nil)
.toolbar(content: { .toolbar(content: {
if focusedField != nil { if focusedField != nil {
ToolbarItem(placement: .topBarLeading) { ToolbarItem(placement: .keyboard) {
Button("Annuler", role: .cancel) { HStack {
Button("Fermer", role: .cancel) {
focusedField = nil focusedField = nil
} }
Spacer()
}
} }
} }
}) })

@ -54,6 +54,14 @@ struct GroupStageTeamView: View {
ForEach(team.players()) { player in ForEach(team.players()) { player in
EditablePlayerView(player: player, editingOptions: _editingOptions()) EditablePlayerView(player: player, editingOptions: _editingOptions())
} }
} footer: {
NavigationLink {
EditingTeamView(team: team)
.environment(tournament)
} label: {
Text("détails de l'équipe")
.underline()
}
} }
if groupStage.tournamentObject()?.hasEnded() == false { if groupStage.tournamentObject()?.hasEnded() == false {

@ -11,7 +11,8 @@ import LeStorage
struct MatchDateView: View { struct MatchDateView: View {
@EnvironmentObject var dataStore: DataStore @EnvironmentObject var dataStore: DataStore
@State private var showScoreEditView: Bool = false
@State private var confirmScoreEdition: Bool = false
var match: Match var match: Match
var showPrefix: Bool = false var showPrefix: Bool = false
private var isReady: Bool private var isReady: Bool
@ -84,7 +85,7 @@ struct MatchDateView: View {
} }
} }
Button("Indiquer un score") { Button("Indiquer un score") {
showScoreEditView = true
} }
Divider() Divider()
Button("Retirer l'horaire") { Button("Retirer l'horaire") {
@ -165,6 +166,10 @@ struct MatchDateView: View {
} }
} }
} }
.sheet(isPresented: $showScoreEditView) {
EditScoreView(match: match, confirmScoreEdition: $confirmScoreEdition)
.tint(.master)
}
} }
private func _save() { private func _save() {

@ -25,7 +25,6 @@ struct MatchTeamDetailView: View {
.headerProminence(.increased) .headerProminence(.increased)
.tint(.master) .tint(.master)
} }
.presentationDetents([.fraction(0.66)])
} }
@ViewBuilder @ViewBuilder
@ -41,7 +40,17 @@ struct MatchTeamDetailView: View {
Text("Coachs : " + coachList).foregroundStyle(.secondary).font(.footnote) Text("Coachs : " + coachList).foregroundStyle(.secondary).font(.footnote)
} }
} header: { } header: {
TeamHeaderView(team: team, teamIndex: tournament?.indexOf(team: team)) TeamHeaderView(team: team, teamIndex: tournament?.indexOf(team: team), tournament: tournament)
} footer: {
if let tournament {
NavigationLink {
EditingTeamView(team: team)
.environment(tournament)
} label: {
Text("détails de l'équipe")
.underline()
}
}
} }
} }

@ -194,8 +194,7 @@ struct MatchDetailView: View {
} }
} }
}) { scoreType in }) { scoreType in
let matchDescriptor = MatchDescriptor(match: match) EditScoreView(match: match, confirmScoreEdition: $confirmScoreEdition)
EditScoreView(matchDescriptor: matchDescriptor, confirmScoreEdition: $confirmScoreEdition)
.tint(.master) .tint(.master)
// switch scoreType { // switch scoreType {

@ -43,7 +43,7 @@ struct EditScoreView: View {
@EnvironmentObject var dataStore: DataStore @EnvironmentObject var dataStore: DataStore
@ObservedObject var matchDescriptor: MatchDescriptor @StateObject var matchDescriptor: MatchDescriptor
@Binding var confirmScoreEdition: Bool @Binding var confirmScoreEdition: Bool
@Environment(\.dismiss) private var dismiss @Environment(\.dismiss) private var dismiss
@State private var showSetInputView: Bool = true @State private var showSetInputView: Bool = true
@ -52,6 +52,12 @@ struct EditScoreView: View {
let colorTeamOne: Color = .teal let colorTeamOne: Color = .teal
let colorTeamTwo: Color = .indigo let colorTeamTwo: Color = .indigo
init(match: Match, confirmScoreEdition: Binding<Bool>) {
let matchDescriptor = MatchDescriptor(match: match)
_matchDescriptor = .init(wrappedValue: matchDescriptor)
_confirmScoreEdition = confirmScoreEdition
}
func walkout(_ team: TeamPosition) { func walkout(_ team: TeamPosition) {
self.matchDescriptor.match?.setWalkOut(team) self.matchDescriptor.match?.setWalkOut(team)
save() save()

@ -20,6 +20,7 @@ struct CoachListView: View {
var body: some View { var body: some View {
Section { Section {
HStack {
TextField("Coach", text: $coachNames) TextField("Coach", text: $coachNames)
.autocorrectionDisabled() .autocorrectionDisabled()
.keyboardType(.alphabet) .keyboardType(.alphabet)
@ -34,16 +35,18 @@ struct CoachListView: View {
} }
_save() _save()
} }
} header: { if coachNames.isEmpty == false {
Text("Coachs") FooterButtonView("effacer", role: .destructive) {
} footer: {
FooterButtonView("effacer") {
coachNames = "" coachNames = ""
team.comment = nil team.comment = nil
_save() _save()
} }
} }
} }
} header: {
Text("Coachs")
}
}
private func _save() { private func _save() {
do { do {

@ -144,6 +144,7 @@ struct EditingTeamView: View {
} }
Section { Section {
HStack {
TextField("Nom de l'équipe", text: $name) TextField("Nom de l'équipe", text: $name)
.autocorrectionDisabled() .autocorrectionDisabled()
.focused($focusedField, equals: ._name) .focused($focusedField, equals: ._name)
@ -160,6 +161,14 @@ struct EditingTeamView: View {
_save() _save()
} }
if name.isEmpty == false {
FooterButtonView("effacer", role: .destructive) {
name = ""
team.name = nil
_save()
}
}
}
} header: { } header: {
Text("Nom de l'équipe") Text("Nom de l'équipe")
} }

Loading…
Cancel
Save