|
@@ -80,37 +80,37 @@ extension Bolus {
|
|
|
else { state.amount = state.insulinRecommended }
|
|
else { state.amount = state.insulinRecommended }
|
|
|
}
|
|
}
|
|
|
}.contentShape(Rectangle())
|
|
}.contentShape(Rectangle())
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- HStack {
|
|
|
|
|
- Text("Amount")
|
|
|
|
|
- Spacer()
|
|
|
|
|
- DecimalTextField(
|
|
|
|
|
- "0",
|
|
|
|
|
- value: $state.amount,
|
|
|
|
|
- formatter: formatter,
|
|
|
|
|
- autofocus: true,
|
|
|
|
|
- cleanInput: true
|
|
|
|
|
- )
|
|
|
|
|
- Text(!(state.amount > state.maxBolus) ? "U" : "😵").foregroundColor(.secondary)
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ HStack {
|
|
|
|
|
+ Text("Amount")
|
|
|
|
|
+ Spacer()
|
|
|
|
|
+ DecimalTextField(
|
|
|
|
|
+ "0",
|
|
|
|
|
+ value: $state.amount,
|
|
|
|
|
+ formatter: formatter,
|
|
|
|
|
+ autofocus: true,
|
|
|
|
|
+ cleanInput: true
|
|
|
|
|
+ )
|
|
|
|
|
+ Text(!(state.amount > state.maxBolus) ? "U" : "😵").foregroundColor(.secondary)
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
} header: { Text("Bolus") }
|
|
} header: { Text("Bolus") }
|
|
|
|
|
|
|
|
- if !state.waitForSuggestion {
|
|
|
|
|
- if state.amount > 0 {
|
|
|
|
|
- Section {
|
|
|
|
|
- Button {
|
|
|
|
|
- keepForNextWiew = true
|
|
|
|
|
- state.add()
|
|
|
|
|
- }
|
|
|
|
|
- label: { Text(!(state.amount > state.maxBolus) ? "Enact bolus" : "Max Bolus exceeded!") }
|
|
|
|
|
- .frame(maxWidth: .infinity, alignment: .center)
|
|
|
|
|
- .disabled(disabled)
|
|
|
|
|
- .listRowBackground(!disabled ? Color(.systemBlue) : Color(.systemGray4))
|
|
|
|
|
- .tint(.white)
|
|
|
|
|
|
|
+ if state.amount > 0 {
|
|
|
|
|
+ Section {
|
|
|
|
|
+ Button {
|
|
|
|
|
+ keepForNextWiew = true
|
|
|
|
|
+ state.add()
|
|
|
}
|
|
}
|
|
|
|
|
+ label: { Text(!(state.amount > state.maxBolus) ? "Enact bolus" : "Max Bolus exceeded!") }
|
|
|
|
|
+ .frame(maxWidth: .infinity, alignment: .center)
|
|
|
|
|
+ .disabled(disabled)
|
|
|
|
|
+ .listRowBackground(!disabled ? Color(.systemBlue) : Color(.systemGray4))
|
|
|
|
|
+ .tint(.white)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
if state.amount <= 0 {
|
|
if state.amount <= 0 {
|
|
|
Section {
|
|
Section {
|
|
|
Button {
|
|
Button {
|
|
@@ -153,7 +153,7 @@ extension Bolus {
|
|
|
.navigationBarTitleDisplayMode(.inline)
|
|
.navigationBarTitleDisplayMode(.inline)
|
|
|
.navigationBarItems(
|
|
.navigationBarItems(
|
|
|
leading: Button {
|
|
leading: Button {
|
|
|
- carbssView()
|
|
|
|
|
|
|
+ carbsView()
|
|
|
}
|
|
}
|
|
|
label: { Text(fetch ? "Back" : "Meal") },
|
|
label: { Text(fetch ? "Back" : "Meal") },
|
|
|
|
|
|
|
@@ -185,13 +185,13 @@ extension Bolus {
|
|
|
((meal.first?.fat ?? 0) > 0) || ((meal.first?.protein ?? 0) > 0)
|
|
((meal.first?.fat ?? 0) > 0) || ((meal.first?.protein ?? 0) > 0)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- func carbssView() {
|
|
|
|
|
|
|
+ func carbsView() {
|
|
|
let id_ = meal.first?.id ?? ""
|
|
let id_ = meal.first?.id ?? ""
|
|
|
if fetch {
|
|
if fetch {
|
|
|
keepForNextWiew = true
|
|
keepForNextWiew = true
|
|
|
- state.backToCarbsView(complexEntry: fetch, id_)
|
|
|
|
|
|
|
+ state.backToCarbsView(complexEntry: fetch, id_, override: false)
|
|
|
} else {
|
|
} else {
|
|
|
- state.showModal(for: .addCarbs(editMode: false))
|
|
|
|
|
|
|
+ state.backToCarbsView(complexEntry: false, id_, override: true)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|