add a forfait button in team group stage view

newoffer2025
Razmig Sarkissian 5 months ago
parent 6d7c6d35b2
commit e8d41853ff
  1. 27
      PadelClub/Views/GroupStage/Components/GroupStageTeamView.swift

@ -106,6 +106,29 @@ struct GroupStageTeamView: View {
groupStage._matches().forEach({ $0.updateTeamScores() })
}
}
if let groupStagePosition = team.groupStagePosition {
Section {
RowButtonView("Forfait", role: .destructive) {
team.walkOut = true
let matches = groupStage.matches(forGroupStagePosition: groupStagePosition)
.filter({
$0.hasStarted() == false && $0.hasEnded() == false
})
matches
.forEach({
if let teamPosition = $0.teamPosition(for: team) {
$0.setWalkOut(teamPosition)
}
})
tournamentStore?.matches.addOrUpdate(contentOfs: matches)
_save()
}
} footer: {
Text("En indiquant cette équipe forfaite, le résultat des matchs restant dans la poule seront mis à \(defaultScore) pour leur adversaire.")
}
}
}
}
}
@ -184,6 +207,10 @@ struct GroupStageTeamView: View {
.navigationTitle("Détail de l'équipe")
}
private var defaultScore: String {
groupStage.matchFormat.defaultWalkOutScore(false).compactMap({ String($0) + "/0" }).joined(separator: " ")
}
private var _networkErrorMessage: String {
ContactManagerError.getNetworkErrorMessage(sentError: sentError, networkMonitorConnected: networkMonitor.connected)
}

Loading…
Cancel
Save