fix table structure issue

fix call stuff
club_update
Raz 1 year ago
parent 6b02462b32
commit abb26832da
  1. 4
      PadelClub.xcodeproj/project.pbxproj
  2. 5
      PadelClub/Data/Tournament.swift
  3. 8
      PadelClub/Views/Calling/CallSettingsView.swift
  4. 28
      PadelClub/Views/Calling/TeamsCallingView.swift
  5. 8
      PadelClub/Views/Cashier/CashierView.swift
  6. 16
      PadelClub/Views/Team/EditingTeamView.swift
  7. 9
      PadelClub/Views/Team/TeamRowView.swift
  8. 2
      PadelClub/Views/Tournament/Screen/TableStructureView.swift
  9. 15
      PadelClub/Views/Tournament/Screen/TournamentCallView.swift

@ -227,6 +227,7 @@
FFC91AF92BD6A09100B29808 /* FortuneWheelView.swift in Sources */ = {isa = PBXBuildFile; fileRef = FFC91AF82BD6A09100B29808 /* FortuneWheelView.swift */; };
FFC91B012BD85C2F00B29808 /* Court.swift in Sources */ = {isa = PBXBuildFile; fileRef = FFC91B002BD85C2F00B29808 /* Court.swift */; };
FFC91B032BD85E2400B29808 /* CourtView.swift in Sources */ = {isa = PBXBuildFile; fileRef = FFC91B022BD85E2400B29808 /* CourtView.swift */; };
FFCD16B32C3E5E590092707B /* TeamsCallingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = FFCD16B22C3E5E590092707B /* TeamsCallingView.swift */; };
FFCEDA4C2C2C08EA00F8C0F2 /* PlayersWithoutContactView.swift in Sources */ = {isa = PBXBuildFile; fileRef = FFCEDA4B2C2C08EA00F8C0F2 /* PlayersWithoutContactView.swift */; };
FFCF76072C3BE9BC006C8C3D /* CloseDatePicker.swift in Sources */ = {isa = PBXBuildFile; fileRef = FFCF76062C3BE9BC006C8C3D /* CloseDatePicker.swift */; };
FFCFBFFE2BBBE86600B82851 /* Algorithms in Frameworks */ = {isa = PBXBuildFile; productRef = FFCFBFFD2BBBE86600B82851 /* Algorithms */; };
@ -562,6 +563,7 @@
FFC91AF82BD6A09100B29808 /* FortuneWheelView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FortuneWheelView.swift; sourceTree = "<group>"; };
FFC91B002BD85C2F00B29808 /* Court.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Court.swift; sourceTree = "<group>"; };
FFC91B022BD85E2400B29808 /* CourtView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CourtView.swift; sourceTree = "<group>"; };
FFCD16B22C3E5E590092707B /* TeamsCallingView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TeamsCallingView.swift; sourceTree = "<group>"; };
FFCEDA4B2C2C08EA00F8C0F2 /* PlayersWithoutContactView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlayersWithoutContactView.swift; sourceTree = "<group>"; };
FFCF76062C3BE9BC006C8C3D /* CloseDatePicker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CloseDatePicker.swift; sourceTree = "<group>"; };
FFCFC0012BBC39A600B82851 /* EditScoreView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EditScoreView.swift; sourceTree = "<group>"; };
@ -1143,6 +1145,7 @@
children = (
FF9267FE2BCE94830080F940 /* CallSettingsView.swift */,
FF9268002BCE94920080F940 /* SeedsCallingView.swift */,
FFCD16B22C3E5E590092707B /* TeamsCallingView.swift */,
FF9268022BCE94A30080F940 /* GroupStageCallingView.swift */,
FF9268082BCEDC2C0080F940 /* CallView.swift */,
FF1162792BCF8109000C4809 /* CallMessageCustomizationView.swift */,
@ -1537,6 +1540,7 @@
FFE103082C353B7600684FC9 /* EventClubSettingsView.swift in Sources */,
C4A47DB32B86387500ADC637 /* AccountView.swift in Sources */,
FFCEDA4C2C2C08EA00F8C0F2 /* PlayersWithoutContactView.swift in Sources */,
FFCD16B32C3E5E590092707B /* TeamsCallingView.swift in Sources */,
FF1CBC1D2BB53DC10036DAAB /* Calendar+Extensions.swift in Sources */,
FF967CF22BAECC0B00A9A3BD /* TeamScore.swift in Sources */,
FF1162832BCFBE4E000C4809 /* EditablePlayerView.swift in Sources */,

@ -1637,11 +1637,6 @@ defer {
func resetBracketPosition() {
unsortedTeams().forEach({ $0.bracketPosition = nil })
do {
try self.tournamentStore.teamRegistrations.addOrUpdate(contentOfs: unsortedTeams())
} catch {
Logger.error(error)
}
}
func deleteGroupStages() {

@ -58,7 +58,7 @@ struct CallSettingsView: View {
// #if DEBUG
Section {
RowButtonView("Annuler toutes les convocations", role: .destructive) {
RowButtonView("Retirer toutes les convocations", role: .destructive) {
let teams = tournament.unsortedTeams()
teams.forEach { team in
team.callDate = nil
@ -69,20 +69,26 @@ struct CallSettingsView: View {
Logger.error(error)
}
}
} footer: {
Text("Retire l'horaire de convocation enregistré pour toutes les équipes.")
}
Section {
RowButtonView("Tout le monde a été convoqué", role: .destructive) {
let teams = tournament.unsortedTeams()
teams.forEach { team in
if team.callDate == nil {
team.callDate = team.expectedSummonDate()
}
}
do {
try tournamentStore.teamRegistrations.addOrUpdate(contentOfs: teams)
} catch {
Logger.error(error)
}
}
} footer: {
Text("Pour toutes les équipes sans convocation, les indiquer comme ayant été convoquée.")
}
//#endif
}

@ -0,0 +1,28 @@
//
// TeamsCallingView.swift
// PadelClub
//
// Created by razmig on 10/07/2024.
//
import SwiftUI
struct TeamsCallingView: View {
@Environment(Tournament.self) var tournament: Tournament
var body: some View {
List {
let teams = tournament.selectedSortedTeams()
Section {
ForEach(teams) { team in
TeamRowView(team: team, displayCallDate: true)
}
}
}
.headerProminence(.increased)
.navigationTitle("Statut des équipes")
.navigationBarTitleDisplayMode(.inline)
.toolbarBackground(.visible, for: .navigationBar)
}
}

@ -315,7 +315,7 @@ struct CashierView: View {
}
} footer: {
if let callDate = team.callDate {
Text("convoqué") + Text(callDate.localizedDate())
Text("convocation : ") + Text(callDate.localizedDate())
}
}
}
@ -345,11 +345,13 @@ struct CashierView: View {
EditablePlayerView(player: player, editingOptions: [.licenceId, .name, .payment])
}
} header: {
Text(key.localizedDate())
} footer: {
if displayTournamentTitle, let tournamentTitle = team.tournamentObject()?.tournamentTitle() {
Text(tournamentTitle)
}
} footer: {
if let callDate = team.callDate {
Text("convocation : ") + Text(callDate.localizedDate())
}
}
}
}

@ -14,6 +14,7 @@ struct EditingTeamView: View {
var team: TeamRegistration
@State private var registrationDate : Date
@State private var callDate : Date
@State private var name: String
@Environment(Tournament.self) var tournament: Tournament
@ -25,6 +26,7 @@ struct EditingTeamView: View {
self.team = team
_name = .init(wrappedValue: team.name ?? "")
_registrationDate = State(wrappedValue: team.registrationDate ?? Date())
_callDate = State(wrappedValue: team.callDate ?? Date())
}
var body: some View {
@ -53,6 +55,20 @@ struct EditingTeamView: View {
Text("Date d'inscription")
}
Section {
if let callDate = team.callDate {
LabeledContent() {
Text(callDate.localizedDate())
} label: {
Text("OK")
}
} else {
Text("Cette équipe n'a pas été convoquée")
}
} header: {
Text("Statut de la convocation")
}
Section {
Toggle(isOn: hasArrived) {
Text("Équipe sur place")

@ -24,11 +24,18 @@ struct TeamRowView: View {
Text(player.playerLabel())
}
}
if let callDate = team.callDate, displayCallDate {
if displayCallDate {
if let callDate = team.callDate {
Text("Déjà convoquée \(callDate.localizedDate())")
.foregroundStyle(.logoRed)
.italic()
.font(.caption)
} else {
Text("Pas encore convoquée")
.foregroundStyle(.logoYellow)
.italic()
.font(.caption)
}
}
}
}

@ -276,7 +276,7 @@ struct TableStructureView: View {
tournament.qualifiedPerGroupStage = qualifiedPerGroupStage
tournament.groupStageAdditionalQualified = groupStageAdditionalQualified
if (rebuildEverything == false && requirements.contains(.all)) || rebuildEverything {
if rebuildEverything {
tournament.deleteAndBuildEverything()
} else if (rebuildEverything == false && requirements.contains(.groupStage)) {
tournament.deleteGroupStages()

@ -13,12 +13,14 @@ enum CallDestination: Identifiable, Selectable, Equatable {
return lhs.id == rhs.id
}
case teams(Tournament)
case seeds(Tournament)
case groupStages(Tournament)
var id: String {
switch self {
case .teams:
return "teams"
case .seeds:
return "seed"
case .groupStages:
@ -28,6 +30,8 @@ enum CallDestination: Identifiable, Selectable, Equatable {
func selectionLabel(index: Int) -> String {
switch self {
case .teams:
return "Statut"
case .seeds:
return "Têtes de série"
case .groupStages:
@ -37,6 +41,9 @@ enum CallDestination: Identifiable, Selectable, Equatable {
func badgeValue() -> Int? {
switch self {
case .teams(let tournament):
let allSeedCalled = tournament.selectedSortedTeams().filter({ tournament.isStartDateIsDifferentThanCallDate($0) || $0.callDate == nil })
return allSeedCalled.count
case .seeds(let tournament):
let allSeedCalled = tournament.seeds().filter({ tournament.isStartDateIsDifferentThanCallDate($0) || $0.callDate == nil })
return allSeedCalled.count
@ -52,6 +59,9 @@ enum CallDestination: Identifiable, Selectable, Equatable {
func badgeImage() -> Badge? {
switch self {
case .teams(let tournament):
let allSeedCalled = tournament.selectedSortedTeams().allSatisfy({ tournament.isStartDateIsDifferentThanCallDate($0) == false })
return allSeedCalled ? .checkmark : nil
case .seeds(let tournament):
let allSeedCalled = tournament.seeds().allSatisfy({ tournament.isStartDateIsDifferentThanCallDate($0) == false })
return allSeedCalled ? .checkmark : nil
@ -83,6 +93,7 @@ struct TournamentCallView: View {
self._selectedDestination = State(wrappedValue: .seeds(tournament))
}
}
destinations.append(.teams(tournament))
self.allDestinations = destinations
}
@ -94,6 +105,8 @@ struct TournamentCallView: View {
CallSettingsView()
case .some(let selectedCall):
switch selectedCall {
case .teams:
TeamsCallingView()
case .groupStages:
GroupStageCallingView()
case .seeds:

Loading…
Cancel
Save