add a way to show which team not contacted

sync2
Raz 1 year ago
parent fe737d2493
commit d422684df0
  1. 8
      PadelClub/Views/Calling/CallView.swift
  2. 8
      PadelClub/Views/Calling/GroupStageCallingView.swift
  3. 12
      PadelClub/Views/Calling/SeedsCallingView.swift
  4. 7
      PadelClub/Views/Calling/SendToAllView.swift
  5. 31
      PadelClub/Views/Calling/TeamsCallingView.swift
  6. 2
      PadelClub/Views/Tournament/Screen/TournamentCallView.swift

@ -124,6 +124,14 @@ struct CallView: View {
.alert("Un problème est survenu", isPresented: messageSentFailed) { .alert("Un problème est survenu", isPresented: messageSentFailed) {
Button("OK") { Button("OK") {
} }
if case .uncalledTeams(let uncalledTeams) = sentError {
NavigationLink("Voir les équipes non contactées") {
TeamsCallingView(teams: uncalledTeams)
.environment(tournament)
}
}
} message: { } message: {
Text(_networkErrorMessage) Text(_networkErrorMessage)
} }

@ -14,6 +14,14 @@ struct GroupStageCallingView: View {
var body: some View { var body: some View {
let groupStages = tournament.groupStages() let groupStages = tournament.groupStages()
List { List {
NavigationLink {
TeamsCallingView(teams: groupStages.flatMap({ $0.unsortedTeams() }).filter({ $0.callDate == nil }))
.environment(tournament)
} label: {
LabeledContent("Équipes non contactées", value: groupStages.flatMap({ $0.unsortedTeams() }).filter({ $0.callDate == nil }).count.formatted())
}
PlayersWithoutContactView(players: groupStages.flatMap({ $0.unsortedTeams() }).flatMap({ $0.unsortedPlayers() }).sorted(by: \.computedRank)) PlayersWithoutContactView(players: groupStages.flatMap({ $0.unsortedTeams() }).flatMap({ $0.unsortedPlayers() }).sorted(by: \.computedRank))
_sameTimeGroupStageView(groupStages: groupStages) _sameTimeGroupStageView(groupStages: groupStages)

@ -14,6 +14,14 @@ struct SeedsCallingView: View {
var body: some View { var body: some View {
List { List {
let tournamentRounds = tournament.rounds() let tournamentRounds = tournament.rounds()
NavigationLink {
TeamsCallingView(teams: tournament.seededTeams().filter({ $0.callDate == nil }))
.environment(tournament)
} label: {
LabeledContent("Équipes non contactées", value: tournament.seededTeams().filter({ $0.callDate == nil }).count.formatted())
}
PlayersWithoutContactView(players: tournament.seededTeams().flatMap({ $0.unsortedPlayers() }).sorted(by: \.computedRank)) PlayersWithoutContactView(players: tournament.seededTeams().flatMap({ $0.unsortedPlayers() }).sorted(by: \.computedRank))
ForEach(tournamentRounds) { round in ForEach(tournamentRounds) { round in
@ -55,6 +63,10 @@ struct SeedsCallingView: View {
} }
} }
NavigationLink("Équipes non contactées") {
TeamsCallingView(teams: round.teams().filter({ $0.callDate == nil }))
}
if displayByMatch == false { if displayByMatch == false {
ForEach(keys, id: \.self) { time in ForEach(keys, id: \.self) { time in

@ -121,6 +121,13 @@ struct SendToAllView: View {
.alert("Un problème est survenu", isPresented: messageSentFailed) { .alert("Un problème est survenu", isPresented: messageSentFailed) {
Button("OK") { Button("OK") {
} }
if case .uncalledTeams(let uncalledTeams) = sentError {
NavigationLink("Voir les équipes non contactées") {
TeamsCallingView(teams: uncalledTeams)
.environment(tournament)
}
}
} message: { } message: {
Text(_networkErrorMessage) Text(_networkErrorMessage)
} }

@ -10,10 +10,10 @@ import LeStorage
struct TeamsCallingView: View { struct TeamsCallingView: View {
@Environment(Tournament.self) var tournament: Tournament @Environment(Tournament.self) var tournament: Tournament
let teams : [TeamRegistration]
var body: some View { var body: some View {
List { List {
let teams = tournament.selectedSortedTeams()
Section { Section {
ForEach(teams) { team in ForEach(teams) { team in
Menu { Menu {
@ -21,13 +21,11 @@ struct TeamsCallingView: View {
} label: { } label: {
HStack { HStack {
TeamRowView(team: team, displayCallDate: true) TeamRowView(team: team, displayCallDate: true)
if team.called() { Spacer()
Spacer() Menu {
Menu { _menuOptions(team: team)
_menuOptions(team: team) } label: {
} label: { LabelOptions().labelStyle(.iconOnly)
LabelOptions().labelStyle(.iconOnly)
}
} }
} }
} }
@ -70,6 +68,21 @@ struct TeamsCallingView: View {
} label: { } label: {
Text("Effacer la date de convocation") Text("Effacer la date de convocation")
} }
Divider()
Button(role: .destructive) {
team.callDate = team.initialMatch()?.startDate ?? tournament.startDate
do {
try self.tournament.tournamentStore.teamRegistrations.addOrUpdate(instance: team)
} catch {
Logger.error(error)
}
} label: {
Text("Indiquer comme convoquée")
}
} }
} }

@ -106,7 +106,7 @@ struct TournamentCallView: View {
case .some(let selectedCall): case .some(let selectedCall):
switch selectedCall { switch selectedCall {
case .teams: case .teams:
TeamsCallingView() TeamsCallingView(teams: tournament.selectedSortedTeams())
case .groupStages: case .groupStages:
GroupStageCallingView() GroupStageCallingView()
case .seeds: case .seeds:

Loading…
Cancel
Save