club_update
Razmig Sarkissian 1 year ago
parent efe43894a8
commit 686df2250b
  1. 4
      PadelClub.xcodeproj/project.pbxproj
  2. 10
      PadelClub/Assets.xcassets/PadelClub_logo_fondclair_transparent.imageset/Contents.json
  3. BIN
      PadelClub/Assets.xcassets/PadelClub_logo_fondclair_transparent.imageset/PadelClub_logo_fondfonce_transparent.png
  4. 6
      PadelClub/Assets.xcassets/logoBackground.colorset/Contents.json
  5. 6
      PadelClub/Assets.xcassets/logoYellow.colorset/Contents.json
  6. 1
      PadelClub/Views/Calling/CallView.swift
  7. 1
      PadelClub/Views/Calling/Components/MenuWarningView.swift
  8. 1
      PadelClub/Views/Calling/SendToAllView.swift
  9. 7
      PadelClub/Views/Cashier/CashierDetailView.swift
  10. 4
      PadelClub/Views/Cashier/Event/EventLinksView.swift
  11. 43
      PadelClub/Views/Cashier/Event/EventSettingsView.swift
  12. 21
      PadelClub/Views/Cashier/Event/EventView.swift
  13. 1
      PadelClub/Views/Match/MatchDetailView.swift
  14. 3
      PadelClub/Views/Navigation/Organizer/TournamentButtonView.swift
  15. 1
      PadelClub/Views/Navigation/Umpire/UmpireView.swift
  16. 1
      PadelClub/Views/Planning/CourtAvailabilitySettingsView.swift
  17. 4
      PadelClub/Views/Planning/PlanningSettingsView.swift
  18. 64
      PadelClub/Views/Tournament/Screen/Components/EventClubSettingsView.swift
  19. 72
      PadelClub/Views/Tournament/Screen/Components/TournamentClubSettingsView.swift
  20. 4
      PadelClub/Views/Tournament/Screen/InscriptionManagerView.swift
  21. 22
      PadelClub/Views/Tournament/Screen/TournamentSettingsView.swift
  22. 2
      PadelClub/Views/Tournament/TournamentInitView.swift
  23. 2
      PadelClub/Views/ViewModifiers/DeferredViewModifier.swift

@ -241,6 +241,7 @@
FFDB1C6D2BB2A02000F1E467 /* AppSettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = FFDB1C6C2BB2A02000F1E467 /* AppSettings.swift */; };
FFDB1C732BB2CFE900F1E467 /* MySortDescriptor.swift in Sources */ = {isa = PBXBuildFile; fileRef = FFDB1C722BB2CFE900F1E467 /* MySortDescriptor.swift */; };
FFDDD40C2B93B2BB00C91A49 /* DeferredViewModifier.swift in Sources */ = {isa = PBXBuildFile; fileRef = FFDDD40B2B93B2BB00C91A49 /* DeferredViewModifier.swift */; };
FFE103082C353B7600684FC9 /* EventClubSettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = FFE103072C353B7600684FC9 /* EventClubSettingsView.swift */; };
FFE2D2E22C231BEE00D0C7BE /* SupportButtonView.swift in Sources */ = {isa = PBXBuildFile; fileRef = FFE2D2E12C231BEE00D0C7BE /* SupportButtonView.swift */; };
FFEF7F4E2BDE69130033D0F0 /* MenuWarningView.swift in Sources */ = {isa = PBXBuildFile; fileRef = FFEF7F4D2BDE69130033D0F0 /* MenuWarningView.swift */; };
FFF0241E2BF48B15001F14B4 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = FFF0241D2BF48B15001F14B4 /* Localizable.strings */; };
@ -572,6 +573,7 @@
FFDB1C6C2BB2A02000F1E467 /* AppSettings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppSettings.swift; sourceTree = "<group>"; };
FFDB1C722BB2CFE900F1E467 /* MySortDescriptor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MySortDescriptor.swift; sourceTree = "<group>"; };
FFDDD40B2B93B2BB00C91A49 /* DeferredViewModifier.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeferredViewModifier.swift; sourceTree = "<group>"; };
FFE103072C353B7600684FC9 /* EventClubSettingsView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = EventClubSettingsView.swift; path = PadelClub/Views/Tournament/Screen/Components/EventClubSettingsView.swift; sourceTree = SOURCE_ROOT; };
FFE2D2E12C231BEE00D0C7BE /* SupportButtonView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SupportButtonView.swift; sourceTree = "<group>"; };
FFEF7F4D2BDE69130033D0F0 /* MenuWarningView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MenuWarningView.swift; sourceTree = "<group>"; };
FFF0241C2BF48B15001F14B4 /* fr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fr; path = fr.lproj/Localizable.strings; sourceTree = "<group>"; };
@ -1203,6 +1205,7 @@
FFBF41832BF75ED7001B24CB /* EventTournamentsView.swift */,
FFBF41852BF75FDA001B24CB /* EventSettingsView.swift */,
FF8F263A2BAD528600650388 /* EventCreationView.swift */,
FFE103072C353B7600684FC9 /* EventClubSettingsView.swift */,
FF8F263C2BAD627A00650388 /* TournamentConfiguratorView.swift */,
);
name = Event;
@ -1520,6 +1523,7 @@
FF7091682B90F79F00AB08DA /* TournamentCellView.swift in Sources */,
FF6EC9042B9479F500EA7F5A /* Sequence+Extensions.swift in Sources */,
FF9267FA2BCE78EC0080F940 /* CashierDetailView.swift in Sources */,
FFE103082C353B7600684FC9 /* EventClubSettingsView.swift in Sources */,
C4A47DB32B86387500ADC637 /* AccountView.swift in Sources */,
FFCEDA4C2C2C08EA00F8C0F2 /* PlayersWithoutContactView.swift in Sources */,
FF1CBC1D2BB53DC10036DAAB /* Calendar+Extensions.swift in Sources */,

@ -3,6 +3,16 @@
{
"filename" : "PadelClub_logo_fondclair_transparent.png",
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"filename" : "PadelClub_logo_fondfonce_transparent.png",
"idiom" : "universal"
}
],
"info" : {

@ -23,9 +23,9 @@
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "58",
"green" : "35",
"red" : "25"
"blue" : "0.808",
"green" : "0.906",
"red" : "0.980"
}
},
"idiom" : "universal"

@ -23,9 +23,9 @@
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "1.000",
"green" : "1.000",
"red" : "1.000"
"blue" : "0.808",
"green" : "0.906",
"red" : "0.980"
}
},
"idiom" : "universal"

@ -173,6 +173,7 @@ struct CallView: View {
.sheet(isPresented: self.$showSubscriptionView, content: {
NavigationStack {
SubscriptionView(isPresented: self.$showSubscriptionView, showLackOfPlanMessage: true)
.environment(\.colorScheme, .light)
}
})
.sheet(isPresented: self.$showUserCreationView, content: {

@ -52,6 +52,7 @@ struct MenuWarningView: View {
.sheet(isPresented: self.$showSubscriptionView, content: {
NavigationStack {
SubscriptionView(isPresented: self.$showSubscriptionView, showLackOfPlanMessage: true)
.environment(\.colorScheme, .light)
}
})
.sheet(isPresented: self.$showUserCreationView, content: {

@ -167,6 +167,7 @@ struct SendToAllView: View {
.sheet(isPresented: self.$showSubscriptionView, content: {
NavigationStack {
SubscriptionView(isPresented: self.$showSubscriptionView, showLackOfPlanMessage: true)
.environment(\.colorScheme, .light)
}
})
.sheet(isPresented: self.$showUserCreationView, content: {

@ -67,8 +67,11 @@ struct CashierDetailView: View {
private func _getPaidCompletion() {
let selectedPlayers = tournaments.flatMap { $0.selectedPlayers() }
if selectedPlayers.isEmpty { paidCompletion = 0 }
paidCompletion = Double(selectedPlayers.filter { $0.hasPaid() }.count) / Double(selectedPlayers.count)
if selectedPlayers.isEmpty {
paidCompletion = 0
} else {
paidCompletion = Double(selectedPlayers.filter { $0.hasPaid() }.count) / Double(selectedPlayers.count)
}
}
private func _tournamentsCashierDetailView(_ tournaments: [Tournament]) -> some View {

@ -37,7 +37,7 @@ struct EventLinksView: View {
Text(pageLink.localizedLabel()).tag(pageLink)
}
} label: {
Text("Choisir une page du tournoi en particulier")
Text("Choisir une page en particulier")
}
.pickerStyle(.menu)
}
@ -49,7 +49,7 @@ struct EventLinksView: View {
.multilineTextAlignment(.leading)
ShareLink("Partagez ce lien", item: eventLinksPasteData)
ShareLink("Partagez ce message", item: eventLinksPasteData)
}
}
}

@ -13,6 +13,28 @@ struct EventSettingsView: View {
@Bindable var event: Event
@State private var eventName: String = ""
@FocusState private var textFieldIsFocus: Bool
@State private var pageLink: PageLink = .teams
func eventLinksPasteData() -> String {
let tournaments = event.tournaments
var link = [String]()
link.append(event.eventTitle())
link.append("\n\n")
link.append("Retrouvez toutes les infos en suivant le\(tournaments.count.pluralSuffix) lien\(tournaments.count.pluralSuffix) ci-dessous")
link.append("\n\n")
tournaments.forEach({ tournament in
if let url = tournament.shareURL(pageLink) {
var tournamentLink = [String]()
tournamentLink.append(tournament.tournamentTitle())
tournamentLink.append(url.absoluteString)
link.append(tournamentLink.joined(separator: "\n"))
}
})
return link.joined(separator: "\n\n")
}
init(event: Event) {
self.event = event
@ -37,6 +59,27 @@ struct EventSettingsView: View {
}
}
}
let eventLinksPasteData = eventLinksPasteData()
Section {
Text(eventLinksPasteData)
.italic()
.multilineTextAlignment(.leading)
let links : [PageLink] = [.teams, .summons, .groupStages, .matches, .rankings]
Picker(selection: $pageLink) {
ForEach(links) { pageLink in
Text(pageLink.localizedLabel()).tag(pageLink)
}
} label: {
Text("Choisir une page en particulier")
}
.pickerStyle(.menu)
ShareLink("Partagez ce message", item: eventLinksPasteData)
} header: {
Text("Liens à partager")
}
}
.toolbar {
if textFieldIsFocus {

@ -13,6 +13,7 @@ enum EventDestination: Identifiable, Selectable, Equatable {
return lhs.id == rhs.id
}
case club(Event)
case links
case tournaments(Event)
case cashier
@ -23,6 +24,8 @@ enum EventDestination: Identifiable, Selectable, Equatable {
func selectionLabel(index: Int) -> String {
switch self {
case .club:
return "Club"
case .links:
return "Liens"
case .tournaments:
@ -34,7 +37,7 @@ enum EventDestination: Identifiable, Selectable, Equatable {
func badgeValue() -> Int? {
switch self {
case .links:
case .links, .club:
return nil
case .tournaments(let event):
return event.tournaments.count
@ -48,7 +51,17 @@ enum EventDestination: Identifiable, Selectable, Equatable {
}
func badgeImage() -> Badge? {
return nil
switch self {
case .club(let event):
if event.club != nil {
return .checkmark
} else {
return .xmark
}
default:
return nil
}
}
}
@ -58,7 +71,7 @@ struct EventView: View {
@State private var selectedDestination: EventDestination?
func allDestinations() -> [EventDestination] {
[.links, .tournaments(event), .cashier]
[.club(event), .tournaments(event), .cashier]
}
var body: some View {
@ -69,6 +82,8 @@ struct EventView: View {
EventSettingsView(event: event)
case .some(let selectedEventDestination):
switch selectedEventDestination {
case .club(let event):
EventClubSettingsView(event: event)
case .links:
EventLinksView(event: event)
case .tournaments(let event):

@ -137,6 +137,7 @@ struct MatchDetailView: View {
.sheet(isPresented: self.$showSubscriptionView, content: {
NavigationStack {
SubscriptionView(isPresented: self.$showSubscriptionView, showLackOfPlanMessage: true)
.environment(\.colorScheme, .light)
}
})
.sheet(isPresented: self.$showUserCreationView, content: {

@ -8,6 +8,7 @@
import SwiftUI
struct TournamentButtonView: View {
@Environment(\.colorScheme) var colorScheme
@Environment(NavigationViewModel.self) private var navigation
let tournament: Tournament
@ -23,7 +24,7 @@ struct TournamentButtonView: View {
.padding(8)
.overlay(
RoundedRectangle(cornerRadius: 20)
.stroke(Color.black, lineWidth: 2)
.stroke(colorScheme == .light ? Color.black : Color.white, lineWidth: 2)
)
.fixedSize(horizontal: false, vertical: true)
}

@ -183,6 +183,7 @@ struct UmpireView: View {
.sheet(isPresented: self.$showSubscriptions, content: {
NavigationStack {
SubscriptionView(isPresented: self.$showSubscriptions)
.environment(\.colorScheme, .light)
}
})
.sheet(isPresented: $presentSearchView) {

@ -87,6 +87,7 @@ struct CourtAvailabilitySettingsView: View {
LabelDelete()
}
}
.buttonStyle(.plain)
}
} header: {
HStack {

@ -64,7 +64,7 @@ struct PlanningSettingsView: View {
CourtAvailabilitySettingsView(event: event)
.environment(tournament)
} label: {
Text("Préciser la disponibilité des terrains")
Text("Préciser les indisponibilités des terrains")
}
}
} footer: {
@ -72,7 +72,7 @@ struct PlanningSettingsView: View {
if tournament.courtCount < club.courtCount {
let plural = tournament.courtCount.pluralSuffix
let verb = tournament.courtCount > 1 ? "seront" : "sera"
Text("En réduisant les terrains maximum, seul\(plural) le\(plural) \(tournament.courtCount) premier\(plural) terrain\(plural) \(verb) utilisé\(plural)") + Text(", par contre, si vous augmentez le nombre de terrains, vous pourrez plutôt préciser quel terrain n'est pas disponible.")
Text("En réduisant les terrains maximum, seul\(plural) le\(plural) \(tournament.courtCount) premier\(plural) terrain\(plural) \(verb) utilisé\(plural)") + Text(", par contre, si vous gardez le nombre de terrains du club, vous pourrez plutôt préciser quel terrain n'est pas disponible.")
} else if tournament.courtCount > club.courtCount {
let isCreatedByUser = club.hasBeenCreated(by: StoreCenter.main.userId)
Button {

@ -0,0 +1,64 @@
//
// EventClubSettingsView.swift
// PadelClub
//
// Created by Razmig Sarkissian on 18/04/2024.
//
import SwiftUI
import LeStorage
struct EventClubSettingsView: View {
@EnvironmentObject var dataStore: DataStore
@State private var selectedCourt: Court?
@State private var showClubDetail: Club?
var event: Event
var body: some View {
List {
let selectedClub = event.clubObject()
Section {
NavigationLink {
ClubsView() { club in
event.club = club.id
do {
try dataStore.events.addOrUpdate(instance: event)
} catch {
Logger.error(error)
}
}
} label: {
if let selectedClub = event.clubObject() {
ClubRowView(club: selectedClub)
} else {
Text("Choisir un club")
}
}
} header: {
Text("Lieu de l'événement")
} footer: {
HStack {
Spacer()
FooterButtonView("détails du club") {
showClubDetail = selectedClub
}
}
}
if let selectedClub {
ClubCourtSetupView(club: selectedClub, displayContext: selectedClub.hasBeenCreated(by: StoreCenter.main.userId) ? .edition : .lockedForEditing, selectedCourt: $selectedCourt)
}
}
.navigationDestination(item: $showClubDetail) { club in
ClubDetailView(club: club, displayContext: club.hasBeenCreated(by: StoreCenter.main.userId) ? .edition : .lockedForEditing)
}
.navigationDestination(item: $selectedCourt) { court in
CourtView(court: court)
}
}
}
//#Preview {
// TournamentClubSettingsView()
//}

@ -19,36 +19,6 @@ struct TournamentClubSettingsView: View {
List {
let event = tournament.eventObject()
let selectedClub = event?.clubObject()
Section {
NavigationLink {
ClubsView() { club in
if let event {
event.club = club.id
do {
try dataStore.events.addOrUpdate(instance: event)
} catch {
Logger.error(error)
}
}
}
} label: {
if let selectedClub {
ClubRowView(club: selectedClub)
} else {
Text("Choisir un club")
}
}
} header: {
Text("Lieu du tournoi")
} footer: {
HStack {
Spacer()
FooterButtonView("détails du club") {
showClubDetail = selectedClub
}
}
}
Section {
TournamentFieldsManagerView(localizedStringKey: "Terrains pour le tournoi", count: $tournament.courtCount)
@ -65,7 +35,7 @@ struct TournamentClubSettingsView: View {
CourtAvailabilitySettingsView(event: event)
.environment(tournament)
} label: {
Text("Préciser la disponibilité des terrains")
Text("Préciser les indisponibilités des terrains")
}
}
} footer: {
@ -73,7 +43,7 @@ struct TournamentClubSettingsView: View {
if tournament.courtCount < club.courtCount {
let plural = tournament.courtCount.pluralSuffix
let verb = tournament.courtCount > 1 ? "seront" : "sera"
Text("En réduisant les terrains maximum, seul\(plural) le\(plural) \(tournament.courtCount) premier\(plural) terrain\(plural) \(verb) utilisé\(plural)") + Text(", par contre, si vous augmentez le nombre de terrains, vous pourrez plutôt préciser quel terrain n'est pas disponible.")
Text("En réduisant les terrains maximum, seul\(plural) le\(plural) \(tournament.courtCount) premier\(plural) terrain\(plural) \(verb) utilisé\(plural)") + Text(", par contre, si vous gardez le nombre de terrains du club, vous pourrez plutôt préciser quel terrain n'est pas disponible.")
} else if tournament.courtCount > club.courtCount {
let isCreatedByUser = club.hasBeenCreated(by: StoreCenter.main.userId)
Button {
@ -97,18 +67,38 @@ struct TournamentClubSettingsView: View {
}
}
Section {
NavigationLink {
ClubsView() { club in
if let event {
event.club = club.id
do {
try dataStore.events.addOrUpdate(instance: event)
} catch {
Logger.error(error)
}
}
}
} label: {
if let selectedClub {
ClubRowView(club: selectedClub)
} else {
Text("Choisir un club")
}
}
} header: {
Text("Lieu du tournoi")
} footer: {
HStack {
Spacer()
FooterButtonView("détails du club") {
showClubDetail = selectedClub
}
}
}
if let selectedClub {
ClubCourtSetupView(club: selectedClub, displayContext: selectedClub.hasBeenCreated(by: StoreCenter.main.userId) ? .edition : .lockedForEditing, selectedCourt: $selectedCourt)
.onChange(of: selectedClub.courtCount) {
tournament.courtCount = max(tournament.courtCount, selectedClub.courtCount)
do {
try dataStore.tournaments.addOrUpdate(instance: tournament)
} catch {
Logger.error(error)
}
}
}
}
.navigationDestination(item: $showClubDetail) { club in

@ -242,6 +242,7 @@ struct InscriptionManagerView: View {
}
} else {
SubscriptionView(isPresented: self.$showSubscriptionView, showLackOfPlanMessage: true)
.environment(\.colorScheme, .light)
}
case .mail(_, let recipients, let bccRecipients, let body, let subject, _):
if Guard.main.paymentForNewTournament() != nil {
@ -263,6 +264,7 @@ struct InscriptionManagerView: View {
}
} else {
SubscriptionView(isPresented: self.$showSubscriptionView, showLackOfPlanMessage: true)
.environment(\.colorScheme, .light)
}
}
}
@ -606,7 +608,7 @@ struct InscriptionManagerView: View {
}
}
.buttonStyle(.borderedProminent)
.tint(.logoBackground)
.tint(.master)
.fixedSize(horizontal: false, vertical: true)
.padding(16)
}

@ -28,29 +28,25 @@ enum TournamentSettings: Identifiable, Selectable, Equatable {
case .general:
return "Général"
case .club:
return "Club"
return "Terrains"
}
}
func badgeValue() -> Int? {
nil
switch self {
case .club(let tournament):
return tournament.courtCount
default:
return nil
}
}
func badgeValueColor() -> Color? {
return nil
return .logoBackground
}
func badgeImage() -> Badge? {
switch self {
case .club(let tournament):
if tournament.club() != nil {
return .checkmark
} else {
return .xmark
}
default:
return nil
}
return nil
}
}

@ -44,7 +44,7 @@ struct TournamentInitView: View {
Text(tournament.localizedTournamentType())
} label: {
LabelSettings()
Text("Formats, club, prix et plus")
Text("Formats, terrains, prix et plus")
}
}

@ -24,11 +24,13 @@ import SwiftUI
/// Stack Overflow, see https://stackoverflow.com/a/74765430/1558022
///
private struct DeferredViewModifier: ViewModifier {
@Environment(\.colorScheme) var colorScheme
let delay: DispatchTimeInterval
func body(content: Content) -> some View {
_content(content)
.foregroundStyle(colorScheme == .light ? .white : .black)
.onAppear {
DispatchQueue.main.asyncAfter(deadline: .now() + delay) {
self.shouldHide = true

Loading…
Cancel
Save