You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
856 B
32 lines
856 B
//
|
|
// PlayerPayView.swift
|
|
// Padel Tournament
|
|
//
|
|
// Created by Razmig Sarkissian on 22/11/2023.
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
struct PlayerPayView: View {
|
|
@EnvironmentObject var dataStore: DataStore
|
|
@Bindable var player: PlayerRegistration
|
|
|
|
var body: some View {
|
|
Picker(selection: $player.paymentType) {
|
|
Text("Non réglé").tag(nil as PlayerRegistration.PlayerPaymentType?)
|
|
ForEach(PlayerRegistration.PlayerPaymentType.allCases) { type in
|
|
Text(type.localizedLabel()).tag(type as PlayerRegistration.PlayerPaymentType?)
|
|
}
|
|
} label: {
|
|
}
|
|
.pickerStyle(.menu)
|
|
.fixedSize()
|
|
.onChange(of: player.paymentType) {
|
|
_save()
|
|
}
|
|
}
|
|
|
|
private func _save() {
|
|
try? dataStore.playerRegistrations.addOrUpdate(instance: player)
|
|
}
|
|
}
|
|
|