online_payment
Raz 7 months ago
parent 8eca1f3d78
commit 339efee333
  1. 10
      PadelClub/Views/Player/PlayerDetailView.swift
  2. 32
      PadelClub/Views/Team/EditingTeamView.swift

@ -54,9 +54,11 @@ struct PlayerDetailView: View {
} }
} }
RegistrationStatusPicker(player: player) if tournament.enableTimeToConfirm {
.onChange(of: player.registrationStatus) { player.tournamentStore?.playerRegistrations.addOrUpdate(instance: player) RegistrationStatusPicker(player: player)
} .onChange(of: player.registrationStatus) { player.tournamentStore?.playerRegistrations.addOrUpdate(instance: player)
}
}
if let timeToConfirm = player.timeToConfirm { if let timeToConfirm = player.timeToConfirm {
LabeledContent { LabeledContent {
@ -68,6 +70,8 @@ struct PlayerDetailView: View {
} }
} }
} }
} header: {
Text("Statut de l'inscription en ligne")
} }
} }

@ -114,26 +114,29 @@ struct EditingTeamView: View {
Text("Inscrits en ligne") Text("Inscrits en ligne")
} }
LabeledContent { if tournament.enableOnlinePayment || team.hasPaidOnline() {
Text(team.hasPaidOnline() ? "Oui" : "Non") LabeledContent {
} label: { Text(team.hasPaidOnline() ? "Oui" : "Non")
Text("Payé en ligne") } label: {
Text("Payé en ligne")
}
} }
if let refundMessage, refundMessage.isEmpty == false { if let refundMessage, refundMessage.isEmpty == false {
Text(refundMessage).foregroundStyle(.logoRed) Text(refundMessage).foregroundStyle(.logoRed)
} }
if team.hasPaidOnline() { if team.hasPaidOnline() {
RowButtonView("Rembourser l'équipe", role: .destructive) { RowButtonView("Rembourser l'équipe", role: .destructive) {
await _processRefund() await _processRefund()
} }
} else if team.hasConfirmed() == false { } else if team.hasConfirmed() == false, tournament.enableTimeToConfirm {
RowButtonView("Confirmer l'inscription de l'équipe", role: .destructive) { RowButtonView("Confirmer l'inscription de l'équipe", role: .destructive) {
team.confirmRegistration() team.confirmRegistration()
} }
.disabled(team.walkOut) .disabled(team.walkOut)
} }
} header: {
Text("Statut de l'inscription en ligne")
} footer: { } footer: {
if team.hasPaidOnline() { if team.hasPaidOnline() {
Text("Le remboursement passe part le service de Stripe qui re-crédite le moyen de paiement utilisé du montant payé.") Text("Le remboursement passe part le service de Stripe qui re-crédite le moyen de paiement utilisé du montant payé.")
@ -274,6 +277,10 @@ struct EditingTeamView: View {
} }
.alert("Attention", isPresented: hasChanged, actions: { .alert("Attention", isPresented: hasChanged, actions: {
Button("Confirmer") { Button("Confirmer") {
if walkOut == false && team.walkOut == true {
registrationDateModified = Date()
registrationDate = registrationDateModified
}
_resetTeam() _resetTeam()
team.registrationDate = registrationDate team.registrationDate = registrationDate
team.wildCardBracket = wildCardBracket team.wildCardBracket = wildCardBracket
@ -378,12 +385,21 @@ struct EditingTeamView: View {
} }
.onChange(of: registrationDate) { .onChange(of: registrationDate) {
if canSaveWithoutWarning() { if canSaveWithoutWarning() {
team.registrationDate = registrationDate if let tr = team.registrationDate, tr == registrationDate {
_save()
} else {
team.registrationDate = registrationDate
_save()
}
} }
} }
.onChange(of: [walkOut, wildCardBracket, wildCardGroupStage]) { .onChange(of: [walkOut, wildCardBracket, wildCardGroupStage]) {
if canSaveWithoutWarning() { if canSaveWithoutWarning() {
if walkOut == false && team.walkOut == true {
registrationDateModified = Date()
team.registrationDate = registrationDateModified
registrationDate = registrationDateModified
}
_resetTeam() _resetTeam()
team.walkOut = walkOut team.walkOut = walkOut
team.wildCardBracket = wildCardBracket team.wildCardBracket = wildCardBracket

Loading…
Cancel
Save