|
|
|
|
@ -77,21 +77,10 @@ struct EditingTeamView: View { |
|
|
|
|
Text("Convocation") |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Button { |
|
|
|
|
team.toggleSummonConfirmation() |
|
|
|
|
do { |
|
|
|
|
try self.tournament.tournamentStore.teamRegistrations.addOrUpdate(instance: team) |
|
|
|
|
} catch { |
|
|
|
|
Logger.error(error) |
|
|
|
|
} |
|
|
|
|
} label: { |
|
|
|
|
if team.didConfirmSummon() { |
|
|
|
|
Label("Confirmation reçue", systemImage: "checkmark.circle.fill").foregroundStyle(.green) |
|
|
|
|
} else { |
|
|
|
|
Label("Confirmation reçue", systemImage: "circle").foregroundStyle(.logoRed) |
|
|
|
|
} |
|
|
|
|
Toggle(isOn: confirmationReceived) { |
|
|
|
|
Text("Confirmation reçue") |
|
|
|
|
Text("L'équipe vous a confirmé leur convocation") |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
Text("Cette équipe n'a pas été convoquée") |
|
|
|
|
} |
|
|
|
|
@ -273,6 +262,19 @@ struct EditingTeamView: View { |
|
|
|
|
.navigationBarTitleDisplayMode(.inline) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private var confirmationReceived: Binding<Bool> { |
|
|
|
|
Binding { |
|
|
|
|
team.confirmed() |
|
|
|
|
} set: { confirmed in |
|
|
|
|
team.confirmationDate = confirmed ? Date() : nil |
|
|
|
|
do { |
|
|
|
|
try tournamentStore.teamRegistrations.addOrUpdate(instance: team) |
|
|
|
|
} catch { |
|
|
|
|
Logger.error(error) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private var hasArrived: Binding<Bool> { |
|
|
|
|
Binding { |
|
|
|
|
team.unsortedPlayers().allSatisfy({ $0.hasArrived }) |
|
|
|
|
|