|
|
|
@ -19,30 +19,43 @@ struct SendToAllView: View { |
|
|
|
List(selection: $contactRecipients) { |
|
|
|
List(selection: $contactRecipients) { |
|
|
|
Section { |
|
|
|
Section { |
|
|
|
Picker(selection: $contactMethod) { |
|
|
|
Picker(selection: $contactMethod) { |
|
|
|
Text("par sms").tag(0) |
|
|
|
Text("Contacter par sms").tag(0) |
|
|
|
Text("par mail").tag(1) |
|
|
|
Text("Contacter par mail").tag(1) |
|
|
|
} label: { |
|
|
|
} label: { |
|
|
|
Text("méthode") |
|
|
|
Text("méthode") |
|
|
|
} |
|
|
|
} |
|
|
|
.labelsHidden() |
|
|
|
.labelsHidden() |
|
|
|
.pickerStyle(.inline) |
|
|
|
.pickerStyle(.inline) |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Section { |
|
|
|
Section { |
|
|
|
|
|
|
|
ForEach(tournament.groupStages()) { groupStage in |
|
|
|
|
|
|
|
let teams = groupStage.teams() |
|
|
|
|
|
|
|
if teams.isEmpty == false { |
|
|
|
|
|
|
|
LabeledContent { |
|
|
|
|
|
|
|
Text(teams.count.formatted() + " équipe" + teams.count.pluralSuffix) |
|
|
|
|
|
|
|
} label: { |
|
|
|
|
|
|
|
Text(groupStage.groupStageTitle()) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
.tag(groupStage.id) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
ForEach(tournament.rounds()) { round in |
|
|
|
ForEach(tournament.rounds()) { round in |
|
|
|
|
|
|
|
let teams = round.teams() |
|
|
|
|
|
|
|
if teams.isEmpty == false { |
|
|
|
LabeledContent { |
|
|
|
LabeledContent { |
|
|
|
let seeds = round.seeds() |
|
|
|
Text(teams.count.formatted() + " équipe" + teams.count.pluralSuffix) |
|
|
|
Text(round.seeds().count + " tête" + seeds.count.pluralSuffix + " de série") |
|
|
|
|
|
|
|
} label: { |
|
|
|
} label: { |
|
|
|
Text(round.roundTitle()) |
|
|
|
Text(round.roundTitle()) |
|
|
|
} |
|
|
|
} |
|
|
|
.tag(round.id) |
|
|
|
.tag(round.id) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Section { |
|
|
|
Section { |
|
|
|
RowButtonView("Contacter \(totalString)") { |
|
|
|
RowButtonView("Contacter \(_totalString())") { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
@ -56,15 +69,21 @@ struct SendToAllView: View { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func _teams() -> [TeamRegistration] { |
|
|
|
func _teams() -> [TeamRegistration] { |
|
|
|
let rounds : [Round] = contactRecipients.map { Store.main.findById($0) } |
|
|
|
let rounds : [Round] = contactRecipients.compactMap { Store.main.findById($0) } |
|
|
|
return rounds.flatMap({ $0.teams() }) |
|
|
|
return rounds.flatMap({ $0.teams() }) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _groupStagesTeams() -> [TeamRegistration] { |
|
|
|
|
|
|
|
let groupStages : [GroupStage] = contactRecipients.compactMap { Store.main.findById($0) } |
|
|
|
|
|
|
|
return groupStages.flatMap({ $0.teams() }) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func _totalString() -> String { |
|
|
|
func _totalString() -> String { |
|
|
|
if contactRecipients.isEmpty { |
|
|
|
if contactRecipients.isEmpty { |
|
|
|
return "toutes les équipes" |
|
|
|
return "toutes les équipes" |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
return |
|
|
|
let teams = _teams() + _groupStagesTeams() |
|
|
|
|
|
|
|
return teams.count.formatted() + " équipe" + teams.count.pluralSuffix |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|