fix issue with planned date

newoffer2025
Razmig Sarkissian 5 months ago
parent 21289513cf
commit da31523ded
  1. 4
      PadelClub.xcodeproj/project.pbxproj
  2. 14
      PadelClub/Utils/Tips.swift
  3. 19
      PadelClub/Views/Planning/PlanningView.swift

@ -3129,7 +3129,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.2.35;
MARKETING_VERSION = 1.2.36;
PRODUCT_BUNDLE_IDENTIFIER = app.padelclub;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
@ -3175,7 +3175,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.2.35;
MARKETING_VERSION = 1.2.36;
PRODUCT_BUNDLE_IDENTIFIER = app.padelclub;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";

@ -646,6 +646,20 @@ struct ShouldTournamentBeOverTip: Tip {
}
}
struct UpdatePlannedDatesTip: Tip {
var title: Text {
Text("Mettre à jour la programmation des matchs")
}
var message: Text? {
Text("Tous les matchs dans le futur verront leur dates plannifiées mis à jour dans la section Programmation du site Padel Club.")
}
var image: Image? {
Image(systemName: "arrow.trianglehead.2.clockwise.rotate.90.circle")
}
}
struct TipStyleModifier: ViewModifier {
@Environment(\.colorScheme) var colorScheme
var tint: Color?

@ -19,7 +19,7 @@ struct PlanningView: View {
@State private var showFinishedMatches: Bool = false
@State private var enableMove: Bool = false
@Environment(\.editMode) private var editMode
let updatePlannedDatesTip = UpdatePlannedDatesTip()
let allMatches: [Match]
let timeSlotMoveOptionTip = TimeSlotMoveOptionTip()
@ -189,6 +189,23 @@ struct PlanningView: View {
filterOption == .byCourt || showFinishedMatches ? .fill : .none)
}
Button("Mettre à jour", systemImage: "arrow.trianglehead.2.clockwise.rotate.90.circle") {
let now = Date()
matches.forEach {
if let startDate = $0.startDate, startDate > now {
$0.plannedStartDate = $0.startDate
}
}
let groupByTournaments = matches.grouped { match in
match.currentTournament()
}
groupByTournaments.forEach { tournament, matches in
tournament?.tournamentStore?.matches.addOrUpdate(contentOfs: matches)
}
}
.popoverTip(updatePlannedDatesTip)
}
}
})

Loading…
Cancel
Save