|
|
|
@ -27,50 +27,54 @@ struct MatchDateView: View { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var body: some View { |
|
|
|
var body: some View { |
|
|
|
Menu { |
|
|
|
if match.endDate != nil { |
|
|
|
let estimatedDuration = match.getDuration() |
|
|
|
label |
|
|
|
if match.startDate == nil && isReady { |
|
|
|
} else { |
|
|
|
Button("Démarrer") { |
|
|
|
Menu { |
|
|
|
match.startDate = Date() |
|
|
|
let estimatedDuration = match.getDuration() |
|
|
|
match.confirmed = true |
|
|
|
if match.startDate == nil && isReady { |
|
|
|
_save() |
|
|
|
Button("Démarrer") { |
|
|
|
} |
|
|
|
|
|
|
|
Button("Démarrer dans 5 minutes") { |
|
|
|
|
|
|
|
match.startDate = Calendar.current.date(byAdding: .minute, value: 5, to: Date()) |
|
|
|
|
|
|
|
match.confirmed = true |
|
|
|
|
|
|
|
_save() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
Button("Démarrer dans 15 minutes") { |
|
|
|
|
|
|
|
match.startDate = Calendar.current.date(byAdding: .minute, value: 15, to: Date()) |
|
|
|
|
|
|
|
match.confirmed = true |
|
|
|
|
|
|
|
_save() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
Button("Démarrer dans \(estimatedDuration.formatted()) minutes") { |
|
|
|
|
|
|
|
match.startDate = Calendar.current.date(byAdding: .minute, value: estimatedDuration, to: Date()) |
|
|
|
|
|
|
|
match.confirmed = true |
|
|
|
|
|
|
|
_save() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
if isReady { |
|
|
|
|
|
|
|
Button("Démarrer maintenant") { |
|
|
|
|
|
|
|
match.startDate = Date() |
|
|
|
match.startDate = Date() |
|
|
|
match.endDate = nil |
|
|
|
match.confirmed = true |
|
|
|
|
|
|
|
_save() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
Button("Démarrer dans 5 minutes") { |
|
|
|
|
|
|
|
match.startDate = Calendar.current.date(byAdding: .minute, value: 5, to: Date()) |
|
|
|
|
|
|
|
match.confirmed = true |
|
|
|
|
|
|
|
_save() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
Button("Démarrer dans 15 minutes") { |
|
|
|
|
|
|
|
match.startDate = Calendar.current.date(byAdding: .minute, value: 15, to: Date()) |
|
|
|
|
|
|
|
match.confirmed = true |
|
|
|
|
|
|
|
_save() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
Button("Démarrer dans \(estimatedDuration.formatted()) minutes") { |
|
|
|
|
|
|
|
match.startDate = Calendar.current.date(byAdding: .minute, value: estimatedDuration, to: Date()) |
|
|
|
match.confirmed = true |
|
|
|
match.confirmed = true |
|
|
|
_save() |
|
|
|
_save() |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
Button("Décaler de \(estimatedDuration) minutes") { |
|
|
|
if isReady { |
|
|
|
match.cleanScheduleAndSave(match.startDate?.addingTimeInterval(Double(estimatedDuration) * 60.0)) |
|
|
|
Button("Démarrer maintenant") { |
|
|
|
|
|
|
|
match.startDate = Date() |
|
|
|
|
|
|
|
match.endDate = nil |
|
|
|
|
|
|
|
match.confirmed = true |
|
|
|
|
|
|
|
_save() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
Button("Décaler de \(estimatedDuration) minutes") { |
|
|
|
|
|
|
|
match.cleanScheduleAndSave(match.startDate?.addingTimeInterval(Double(estimatedDuration) * 60.0)) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
Button("Retirer l'horaire") { |
|
|
|
|
|
|
|
match.cleanScheduleAndSave() |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
Button("Retirer l'horaire") { |
|
|
|
} label: { |
|
|
|
match.cleanScheduleAndSave() |
|
|
|
label |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} label: { |
|
|
|
.buttonStyle(.plain) |
|
|
|
label |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
.buttonStyle(.plain) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ViewBuilder |
|
|
|
@ViewBuilder |
|
|
|
|