Restrict contribution fields to detailed mode only

AddSnapshotView: restore inputMode == .detailed guard for contribution section.
BatchUpdateView: show contribution field per row only when the source's
account is configured with inputMode == .detailed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
alexandrev-tibco
2026-02-20 22:33:02 +01:00
parent ce4bbd9676
commit 28b662e5a6
2 changed files with 28 additions and 23 deletions
@@ -990,6 +990,7 @@ struct BatchUpdateView: View {
?? AppSettings.getOrCreate(in: CoreDataStack.shared.viewContext).currency ?? AppSettings.getOrCreate(in: CoreDataStack.shared.viewContext).currency
let symbol = CurrencyFormatter.symbol(for: currencyCode) let symbol = CurrencyFormatter.symbol(for: currencyCode)
let previousValue = source.latestSnapshot?.decimalValue let previousValue = source.latestSnapshot?.decimalValue
let isDetailed = InputMode(rawValue: source.account?.inputMode ?? "") == .detailed
let valueBinding = Binding<String>( let valueBinding = Binding<String>(
get: { values[source.id] ?? "" }, get: { values[source.id] ?? "" },
set: { values[source.id] = $0 } set: { values[source.id] = $0 }
@@ -1024,6 +1025,7 @@ struct BatchUpdateView: View {
.background(Color.gray.opacity(0.08)) .background(Color.gray.opacity(0.08))
.cornerRadius(8) .cornerRadius(8)
if isDetailed {
HStack { HStack {
Image(systemName: "plus.circle") Image(systemName: "plus.circle")
.font(.caption) .font(.caption)
@@ -1037,6 +1039,7 @@ struct BatchUpdateView: View {
.background(Color.appSecondary.opacity(0.06)) .background(Color.appSecondary.opacity(0.06))
.cornerRadius(8) .cornerRadius(8)
} }
}
.padding(.vertical, 2) .padding(.vertical, 2)
} }
@@ -499,6 +499,7 @@ struct AddSnapshotView: View {
} }
} }
if viewModel.inputMode == .detailed {
Section { Section {
Toggle("Include Contribution", isOn: $viewModel.includeContribution) Toggle("Include Contribution", isOn: $viewModel.includeContribution)
@@ -516,6 +517,7 @@ struct AddSnapshotView: View {
} footer: { } footer: {
Text("Track new capital added to separate it from investment growth.") Text("Track new capital added to separate it from investment growth.")
} }
}
Section { Section {
TextField("Notes", text: $viewModel.notes, axis: .vertical) TextField("Notes", text: $viewModel.notes, axis: .vertical)