Reset scheduler data when opening a new conf scheduling view

This commit is contained in:
QuentinArguillere 2024-04-22 11:32:55 +02:00
parent 4647b00b9e
commit 9bdd3c088e
2 changed files with 21 additions and 0 deletions

View file

@ -20,6 +20,7 @@ struct MeetingsView: View {
Button {
withAnimation {
scheduleMeetingViewModel.resetViewModelData()
isShowScheduleMeetingFragment.toggle()
}
} label: {

View file

@ -62,7 +62,27 @@ class ScheduleMeetingViewModel: ObservableObject {
init() {
fromDate = Calendar.current.date(byAdding: .hour, value: 1, to: Date.now)!
toDate = Calendar.current.date(byAdding: .hour, value: 2, to: Date.now)!
computeDateLabels()
computeTimeLabels()
updateTimezone()
}
func resetViewModelData() {
isBroadcastSelected = false
showBroadcastHelp = false
subject = ""
description = ""
allDayMeeting = false
timezone = ""
sendInvitations = true
participantsToAdd = []
participants = []
operationInProgress = false
conferenceCreatedEvent = false
searchField = ""
fromDate = Calendar.current.date(byAdding: .hour, value: 1, to: Date.now)!
toDate = Calendar.current.date(byAdding: .hour, value: 2, to: Date.now)!
computeDateLabels()
computeTimeLabels()
updateTimezone()