Jul 27 - Update for scheduled task instruction
This commit is contained in:
@@ -22,7 +22,7 @@ struct MyInspectionsView: View {
|
||||
@Environment(\.modelContext) private var context
|
||||
|
||||
@State private var showNewInspection = false
|
||||
@State private var scheduledStartTarget: LocalScheduledInspection?
|
||||
@State private var scheduledStartTarget: ScheduledStartTarget?
|
||||
|
||||
// Deletion confirmation state
|
||||
@State private var pendingDelete: LocalInspection?
|
||||
@@ -42,7 +42,7 @@ struct MyInspectionsView: View {
|
||||
if !scheduledAll.isEmpty {
|
||||
Section("Scheduled") {
|
||||
ForEach(scheduledAll) { s in
|
||||
Button { scheduledStartTarget = s } label: {
|
||||
Button { scheduledStartTarget = ScheduledStartTarget(s) } label: {
|
||||
ScheduledRow(schedule: s)
|
||||
}
|
||||
.buttonStyle(.plain)
|
||||
@@ -71,16 +71,21 @@ struct MyInspectionsView: View {
|
||||
}
|
||||
}
|
||||
}
|
||||
// Cover attached to the stable List, not a Section.
|
||||
.fullScreenCover(item: $scheduledStartTarget) { s in
|
||||
StartInspectionView(
|
||||
preFillTemplateId: s.templateServerId,
|
||||
preFillFacilityId: s.facilityServerId,
|
||||
preFillScheduleId: s.serverId
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
// Cover attached to the enclosing Group, not the List and never a
|
||||
// Section (rule 64). The List itself is conditional: submitting the last
|
||||
// scheduled inspection can flip this view to ContentUnavailableView while
|
||||
// the cover is still presented, which would tear the form down mid-submit.
|
||||
// The Group is always present.
|
||||
.fullScreenCover(item: $scheduledStartTarget) { t in
|
||||
StartInspectionView(
|
||||
preFillTemplateId: t.templateServerId,
|
||||
preFillFacilityId: t.facilityServerId,
|
||||
preFillScheduleId: t.id,
|
||||
preFillScheduleInstructions: t.instructions
|
||||
)
|
||||
}
|
||||
.navigationTitle("My Inspections")
|
||||
// Confirmation before deletion — destructive action cannot be undone
|
||||
.alert("Delete Draft?", isPresented: $showDeleteAlert, presenting: pendingDelete) { inspection in
|
||||
|
||||
Reference in New Issue
Block a user