|
|
|
@ -123,3 +123,89 @@ struct MatchFormatPickingView: View { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct GroupStageDatePickingView: View { |
|
|
|
|
|
|
|
let title: String |
|
|
|
|
|
|
|
@Binding var startDate: Date |
|
|
|
|
|
|
|
@Binding var currentDate: Date? |
|
|
|
|
|
|
|
var duration: Int? |
|
|
|
|
|
|
|
var validateAction: (() async -> ()) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@State private var confirmFollowingScheduleUpdate: Bool = false |
|
|
|
|
|
|
|
@State private var updatingInProgress: Bool = false |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var body: some View { |
|
|
|
|
|
|
|
Section { |
|
|
|
|
|
|
|
DatePicker(selection: $startDate) { |
|
|
|
|
|
|
|
Text(startDate.formatted(.dateTime.weekday(.wide))).font(.headline) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if confirmFollowingScheduleUpdate { |
|
|
|
|
|
|
|
RowButtonView("Confirmer et modifier les matchs") { |
|
|
|
|
|
|
|
updatingInProgress = true |
|
|
|
|
|
|
|
await validateAction() |
|
|
|
|
|
|
|
updatingInProgress = false |
|
|
|
|
|
|
|
confirmFollowingScheduleUpdate = false |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} header: { |
|
|
|
|
|
|
|
Text(title) |
|
|
|
|
|
|
|
} footer: { |
|
|
|
|
|
|
|
if confirmFollowingScheduleUpdate && updatingInProgress == false { |
|
|
|
|
|
|
|
FooterButtonView("Modifier juste l'horaire de la poule") { |
|
|
|
|
|
|
|
currentDate = startDate |
|
|
|
|
|
|
|
confirmFollowingScheduleUpdate = false |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
HStack { |
|
|
|
|
|
|
|
Menu { |
|
|
|
|
|
|
|
Button("de 30 minutes") { |
|
|
|
|
|
|
|
startDate = startDate.addingTimeInterval(1800) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Button("d'une heure") { |
|
|
|
|
|
|
|
startDate = startDate.addingTimeInterval(3600) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Button("à 9h") { |
|
|
|
|
|
|
|
startDate = startDate.atNine() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Button("à demain 9h") { |
|
|
|
|
|
|
|
startDate = startDate.tomorrowAtNine |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if let duration { |
|
|
|
|
|
|
|
Button("à la prochaine rotation") { |
|
|
|
|
|
|
|
startDate = startDate.addingTimeInterval(Double(duration) * 60) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
Button("à la précédente rotation") { |
|
|
|
|
|
|
|
startDate = startDate.addingTimeInterval(Double(duration) * -60) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} label: { |
|
|
|
|
|
|
|
Text("décaler") |
|
|
|
|
|
|
|
.underline() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
.buttonStyle(.borderless) |
|
|
|
|
|
|
|
Spacer() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if currentDate != nil { |
|
|
|
|
|
|
|
FooterButtonView("retirer l'horaire bloqué") { |
|
|
|
|
|
|
|
currentDate = nil |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
FooterButtonView("bloquer l'horaire") { |
|
|
|
|
|
|
|
currentDate = startDate |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
.buttonStyle(.borderless) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
.onChange(of: startDate) { |
|
|
|
|
|
|
|
confirmFollowingScheduleUpdate = true |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
.headerProminence(.increased) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|