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. 29
      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) {
Button("OK") {
}
if case .uncalledTeams(let uncalledTeams) = sentError {
NavigationLink("Voir les équipes non contactées") {
TeamsCallingView(teams: uncalledTeams)
.environment(tournament)
}
}
} message: {
Text(_networkErrorMessage)
}

@ -14,6 +14,14 @@ struct GroupStageCallingView: View {
var body: some View {
let groupStages = tournament.groupStages()
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))
_sameTimeGroupStageView(groupStages: groupStages)

@ -14,6 +14,14 @@ struct SeedsCallingView: View {
var body: some View {
List {
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))
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 {
ForEach(keys, id: \.self) { time in

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

@ -10,10 +10,10 @@ import LeStorage
struct TeamsCallingView: View {
@Environment(Tournament.self) var tournament: Tournament
let teams : [TeamRegistration]
var body: some View {
List {
let teams = tournament.selectedSortedTeams()
Section {
ForEach(teams) { team in
Menu {
@ -21,13 +21,11 @@ struct TeamsCallingView: View {
} label: {
HStack {
TeamRowView(team: team, displayCallDate: true)
if team.called() {
Spacer()
Menu {
_menuOptions(team: team)
} label: {
LabelOptions().labelStyle(.iconOnly)
}
Spacer()
Menu {
_menuOptions(team: team)
} label: {
LabelOptions().labelStyle(.iconOnly)
}
}
}
@ -71,5 +69,20 @@ struct TeamsCallingView: View {
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):
switch selectedCall {
case .teams:
TeamsCallingView()
TeamsCallingView(teams: tournament.selectedSortedTeams())
case .groupStages:
GroupStageCallingView()
case .seeds:

Loading…
Cancel
Save