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.
41 lines
1.2 KiB
41 lines
1.2 KiB
//
|
|
// CashierDetailView.swift
|
|
// Padel Tournament
|
|
//
|
|
// Created by Razmig Sarkissian on 31/03/2024.
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
struct CashierDetailView: View {
|
|
var tournaments : [Tournament]
|
|
|
|
var body: some View {
|
|
List {
|
|
ForEach(tournaments) { tournament in
|
|
_tournamentCashierDetailView(tournament)
|
|
}
|
|
}
|
|
.headerProminence(.increased)
|
|
.navigationTitle("Résumé")
|
|
}
|
|
|
|
private func _tournamentCashierDetailView(_ tournament: Tournament) -> some View {
|
|
Section {
|
|
ForEach(PlayerRegistration.PaymentType.allCases) { type in
|
|
let count = tournament.selectedPlayers().filter({ $0.registrationType == type }).count
|
|
LabeledContent {
|
|
if let entryFee = tournament.entryFee {
|
|
let sum = Double(count) * entryFee
|
|
Text(sum.formatted(.currency(code: "EUR")))
|
|
}
|
|
} label: {
|
|
Text(type.localizedLabel())
|
|
Text(count.formatted())
|
|
}
|
|
}
|
|
} header: {
|
|
Text(tournament.tournamentTitle())
|
|
}
|
|
}
|
|
}
|
|
|