dont show delete option if the item is missing
This commit is contained in:
@@ -63,18 +63,18 @@ struct ContentView: View {
|
|||||||
}).alert(String(localized: "content_view_fill_in_missing_entry"), isPresented: $showUpdateEntryAlert) {
|
}).alert(String(localized: "content_view_fill_in_missing_entry"), isPresented: $showUpdateEntryAlert) {
|
||||||
ForEach(Mood.allValues) { mood in
|
ForEach(Mood.allValues) { mood in
|
||||||
Button(mood.strValue, action: {
|
Button(mood.strValue, action: {
|
||||||
if let selectedMissingEntry = selectedEntry {
|
if let selectedEntry = selectedEntry {
|
||||||
viewModel.update(entry: selectedMissingEntry, toMood: mood)
|
viewModel.update(entry: selectedEntry, toMood: mood)
|
||||||
}
|
}
|
||||||
showUpdateEntryAlert = false
|
showUpdateEntryAlert = false
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
if deleteEnabled {
|
if let selectedEntry = selectedEntry,
|
||||||
|
deleteEnabled,
|
||||||
|
selectedEntry.mood != .missing {
|
||||||
Button(String(localized: "content_view_delete_entry"), action: {
|
Button(String(localized: "content_view_delete_entry"), action: {
|
||||||
if let selectedMissingEntry = selectedEntry {
|
viewModel.update(entry: selectedEntry, toMood: Mood.missing)
|
||||||
viewModel.update(entry: selectedMissingEntry, toMood: Mood.missing)
|
|
||||||
}
|
|
||||||
showUpdateEntryAlert = false
|
showUpdateEntryAlert = false
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user