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:
@@ -990,6 +990,7 @@ struct BatchUpdateView: View {
|
||||
?? AppSettings.getOrCreate(in: CoreDataStack.shared.viewContext).currency
|
||||
let symbol = CurrencyFormatter.symbol(for: currencyCode)
|
||||
let previousValue = source.latestSnapshot?.decimalValue
|
||||
let isDetailed = InputMode(rawValue: source.account?.inputMode ?? "") == .detailed
|
||||
let valueBinding = Binding<String>(
|
||||
get: { values[source.id] ?? "" },
|
||||
set: { values[source.id] = $0 }
|
||||
@@ -1024,18 +1025,20 @@ struct BatchUpdateView: View {
|
||||
.background(Color.gray.opacity(0.08))
|
||||
.cornerRadius(8)
|
||||
|
||||
HStack {
|
||||
Image(systemName: "plus.circle")
|
||||
.font(.caption)
|
||||
.foregroundColor(.secondary)
|
||||
TextField("Contribution this period (optional)", text: contributionBinding)
|
||||
.keyboardType(.decimalPad)
|
||||
.font(.subheadline)
|
||||
.foregroundColor(.secondary)
|
||||
if isDetailed {
|
||||
HStack {
|
||||
Image(systemName: "plus.circle")
|
||||
.font(.caption)
|
||||
.foregroundColor(.secondary)
|
||||
TextField("Contribution this period (optional)", text: contributionBinding)
|
||||
.keyboardType(.decimalPad)
|
||||
.font(.subheadline)
|
||||
.foregroundColor(.secondary)
|
||||
}
|
||||
.padding(8)
|
||||
.background(Color.appSecondary.opacity(0.06))
|
||||
.cornerRadius(8)
|
||||
}
|
||||
.padding(8)
|
||||
.background(Color.appSecondary.opacity(0.06))
|
||||
.cornerRadius(8)
|
||||
}
|
||||
.padding(.vertical, 2)
|
||||
}
|
||||
|
||||
@@ -499,22 +499,24 @@ struct AddSnapshotView: View {
|
||||
}
|
||||
}
|
||||
|
||||
Section {
|
||||
Toggle("Include Contribution", isOn: $viewModel.includeContribution)
|
||||
if viewModel.inputMode == .detailed {
|
||||
Section {
|
||||
Toggle("Include Contribution", isOn: $viewModel.includeContribution)
|
||||
|
||||
if viewModel.includeContribution {
|
||||
HStack {
|
||||
Text(viewModel.currencySymbol)
|
||||
.foregroundColor(.secondary)
|
||||
if viewModel.includeContribution {
|
||||
HStack {
|
||||
Text(viewModel.currencySymbol)
|
||||
.foregroundColor(.secondary)
|
||||
|
||||
TextField("New capital added", text: $viewModel.contributionString)
|
||||
.keyboardType(.decimalPad)
|
||||
TextField("New capital added", text: $viewModel.contributionString)
|
||||
.keyboardType(.decimalPad)
|
||||
}
|
||||
}
|
||||
} header: {
|
||||
Text("Contribution (Optional)")
|
||||
} footer: {
|
||||
Text("Track new capital added to separate it from investment growth.")
|
||||
}
|
||||
} header: {
|
||||
Text("Contribution (Optional)")
|
||||
} footer: {
|
||||
Text("Track new capital added to separate it from investment growth.")
|
||||
}
|
||||
|
||||
Section {
|
||||
|
||||
Reference in New Issue
Block a user