multistore
Razmig Sarkissian 2 years ago
parent 4fe9743a32
commit 83a2b2a565
  1. 6
      PadelClub.xcodeproj/project.pbxproj
  2. 6
      PadelClub/Data/GroupStage.swift
  3. 2
      PadelClub/Data/Tournament.swift
  4. 0
      PadelClub/Utils/CloudConvert.swift
  5. 0
      PadelClub/Utils/ContactManager.swift
  6. 0
      PadelClub/Utils/DisplayContext.swift
  7. 0
      PadelClub/Utils/FileImportManager.swift
  8. 0
      PadelClub/Utils/LocationManager.swift
  9. 0
      PadelClub/Utils/Network/NetworkFederalService.swift
  10. 0
      PadelClub/Utils/Network/NetworkManager.swift
  11. 0
      PadelClub/Utils/Network/NetworkManagerError.swift
  12. 0
      PadelClub/Utils/NetworkMonitor.swift
  13. 0
      PadelClub/Utils/PadelRule.swift
  14. 0
      PadelClub/Utils/SourceFileManager.swift
  15. 0
      PadelClub/Utils/SwiftParser.swift
  16. 0
      PadelClub/Utils/Tips.swift
  17. 0
      PadelClub/Utils/URLs.swift
  18. 2
      PadelClub/Views/Cashier/CashierDetailView.swift
  19. 6
      PadelClub/Views/Components/GenericDestinationPickerView.swift
  20. 2
      PadelClub/Views/Components/MatchListView.swift
  21. 4
      PadelClub/Views/Match/MatchDetailView.swift
  22. 23
      PadelClub/Views/Tournament/Screen/Components/TournamentGeneralSettingsView.swift
  23. 2
      PadelClub/Views/Tournament/TournamentView.swift

@ -613,7 +613,7 @@
C4A47D722B72881500ADC637 /* Views */, C4A47D722B72881500ADC637 /* Views */,
FF3F74FD2B91A087004CFE0E /* ViewModel */, FF3F74FD2B91A087004CFE0E /* ViewModel */,
C4A47D5F2B6D3B2D00ADC637 /* Data */, C4A47D5F2B6D3B2D00ADC637 /* Data */,
FFF8ACD02B9238A2008466FA /* Manager */, FFF8ACD02B9238A2008466FA /* Utils */,
FFF8ACD72B923F26008466FA /* Extensions */, FFF8ACD72B923F26008466FA /* Extensions */,
C425D4042B6D249E002A7B48 /* Assets.xcassets */, C425D4042B6D249E002A7B48 /* Assets.xcassets */,
FF0EC54D2BB195CA0056B6D1 /* CSV */, FF0EC54D2BB195CA0056B6D1 /* CSV */,
@ -1166,7 +1166,7 @@
path = Components; path = Components;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
FFF8ACD02B9238A2008466FA /* Manager */ = { FFF8ACD02B9238A2008466FA /* Utils */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
FFA6D7862BB0B7A2003A31F3 /* CloudConvert.swift */, FFA6D7862BB0B7A2003A31F3 /* CloudConvert.swift */,
@ -1182,7 +1182,7 @@
C49EF01A2BD6A1E80077B5AA /* URLs.swift */, C49EF01A2BD6A1E80077B5AA /* URLs.swift */,
FF6EC9072B947A1E00EA7F5A /* Network */, FF6EC9072B947A1E00EA7F5A /* Network */,
); );
path = Manager; path = Utils;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
FFF8ACD72B923F26008466FA /* Extensions */ = { FFF8ACD72B923F26008466FA /* Extensions */ = {

@ -95,7 +95,7 @@ class GroupStage: ModelObject, Storable {
} }
func scoreLabel(forGroupStagePosition groupStagePosition: Int) -> (wins: String, losses: String, setsDifference: String?, gamesDifference: String?)? { func scoreLabel(forGroupStagePosition groupStagePosition: Int) -> (wins: String, losses: String, setsDifference: String?, gamesDifference: String?)? {
if let scoreData = _score(forGroupStagePosition: groupStagePosition) { if let scoreData = _score(forGroupStagePosition: groupStagePosition, nilIfEmpty: true) {
let hideSetDifference = matchFormat.setsToWin == 1 let hideSetDifference = matchFormat.setsToWin == 1
let setDifference = scoreData.setDifference.formatted(.number.sign(strategy: .always(includingZero: false))) let setDifference = scoreData.setDifference.formatted(.number.sign(strategy: .always(includingZero: false)))
let gameDifference = scoreData.gameDifference.formatted(.number.sign(strategy: .always(includingZero: false))) let gameDifference = scoreData.gameDifference.formatted(.number.sign(strategy: .always(includingZero: false)))
@ -106,10 +106,10 @@ class GroupStage: ModelObject, Storable {
} }
} }
fileprivate func _score(forGroupStagePosition groupStagePosition: Int) -> TeamGroupStageScore? { fileprivate func _score(forGroupStagePosition groupStagePosition: Int, nilIfEmpty: Bool = false) -> TeamGroupStageScore? {
guard let team = teamAt(groupStagePosition: groupStagePosition) else { return nil } guard let team = teamAt(groupStagePosition: groupStagePosition) else { return nil }
let matches = matches(forGroupStagePosition: groupStagePosition).filter({ $0.hasEnded() }) let matches = matches(forGroupStagePosition: groupStagePosition).filter({ $0.hasEnded() })
if matches.isEmpty { return nil } if matches.isEmpty && nilIfEmpty { return nil }
let wins = matches.filter { $0.winningTeamId == team.id }.count let wins = matches.filter { $0.winningTeamId == team.id }.count
let loses = matches.filter { $0.losingTeamId == team.id }.count let loses = matches.filter { $0.losingTeamId == team.id }.count
let differences = matches.compactMap { $0.scoreDifference(groupStagePosition) } let differences = matches.compactMap { $0.scoreDifference(groupStagePosition) }

@ -550,7 +550,7 @@ class Tournament : ModelObject, Storable {
func registrationIssues() -> Int { func registrationIssues() -> Int {
let players : [PlayerRegistration] = unsortedPlayers() let players : [PlayerRegistration] = unsortedPlayers()
let selectedTeams : [TeamRegistration] = selectedSortedTeams() let selectedTeams : [TeamRegistration] = selectedSortedTeams()
let callDateIssue : [TeamRegistration] = selectedTeams.filter { isStartDateIsDifferentThanCallDate($0) } let callDateIssue : [TeamRegistration] = selectedTeams.filter { $0.callDate != nil && isStartDateIsDifferentThanCallDate($0) }
let duplicates : [PlayerRegistration] = duplicates(in: players) let duplicates : [PlayerRegistration] = duplicates(in: players)
let problematicPlayers : [PlayerRegistration] = players.filter({ $0.sex == -1 }) let problematicPlayers : [PlayerRegistration] = players.filter({ $0.sex == -1 })
let inadequatePlayers : [PlayerRegistration] = inadequatePlayers(in: players) let inadequatePlayers : [PlayerRegistration] = inadequatePlayers(in: players)

@ -54,7 +54,7 @@ struct CashierDetailView: View {
Text(count.formatted()) Text(count.formatted())
} }
} }
} label: { } label: {
Text("Voir le détail") Text("Voir le détail")
} }

@ -26,8 +26,7 @@ struct GenericDestinationPickerView<T: Identifiable & Selectable>: View {
.padding() .padding()
.background { .background {
Circle() Circle()
.fill(Color.master) .fill(selectedDestination == nil ? .master : .beige)
.opacity(selectedDestination == nil ? 1.0 : 0.2)
} }
.buttonStyle(.plain) .buttonStyle(.plain)
} }
@ -42,8 +41,7 @@ struct GenericDestinationPickerView<T: Identifiable & Selectable>: View {
.padding() .padding()
.background { .background {
Capsule() Capsule()
.fill(Color.master) .fill(selectedDestination?.id == destination.id ? .master : .beige)
.opacity(selectedDestination?.id == destination.id ? 1.0 : 0.2)
} }
.buttonStyle(.plain) .buttonStyle(.plain)
.overlay(alignment: .bottomTrailing) { .overlay(alignment: .bottomTrailing) {

@ -22,7 +22,7 @@ struct MatchListView: View {
DisclosureGroup(isExpanded: $isExpanded) { DisclosureGroup(isExpanded: $isExpanded) {
ForEach(matches) { match in ForEach(matches) { match in
MatchRowView(match: match, matchViewStyle: matchViewStyle) MatchRowView(match: match, matchViewStyle: matchViewStyle)
.listRowInsets(EdgeInsets()) .listRowInsets(EdgeInsets(top: 0, leading: -2, bottom: 0, trailing: 8))
} }
} label: { } label: {
LabeledContent { LabeledContent {

@ -382,9 +382,8 @@ struct MatchDetailView: View {
} }
} }
@ViewBuilder
var startingOptionView: some View { var startingOptionView: some View {
Section {
if match.hasEnded() == false { if match.hasEnded() == false {
let rotationDuration = match.getDuration() let rotationDuration = match.getDuration()
Picker(selection: $startDateSetup) { Picker(selection: $startDateSetup) {
@ -470,7 +469,6 @@ struct MatchDetailView: View {
} }
} }
} }
}
@ViewBuilder @ViewBuilder
var broadcastView: some View { var broadcastView: some View {

@ -18,6 +18,26 @@ struct TournamentGeneralSettingsView: View {
var body: some View { var body: some View {
@Bindable var tournament = tournament @Bindable var tournament = tournament
Form { Form {
Section {
if tournament.hasEnded() == false {
if tournament.isCanceled == false {
RowButtonView("Annuler le tournoi", role: .destructive) {
tournament.isCanceled.toggle()
}
} else {
RowButtonView("Reprendre le tournoi", role: .destructive) {
tournament.isCanceled.toggle()
}
}
}
Toggle(isOn: $tournament.isPrivate) {
Text("Tournoi privée")
}
} footer: {
Text("Le tournoi sera masqué sur le site padelclub.app")
}
Section { Section {
TournamentDatePickerView() TournamentDatePickerView()
TournamentDurationManagerView() TournamentDurationManagerView()
@ -101,6 +121,9 @@ struct TournamentGeneralSettingsView: View {
]) { ]) {
_save() _save()
} }
.onChange(of: [tournament.isDeleted, tournament.isCanceled, tournament.isPrivate]) {
_save()
}
} }
private func _save() { private func _save() {

@ -45,7 +45,7 @@ struct TournamentView: View {
} }
} }
} footer: { } footer: {
if tournament.inscriptionClosed() == false { if tournament.inscriptionClosed() == false && tournament.state() == .build && tournament.unsortedTeams().isEmpty == false {
Button { Button {
tournament.lockRegistration() tournament.lockRegistration()
_save() _save()

Loading…
Cancel
Save