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
|
?? 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,18 +1025,20 @@ struct BatchUpdateView: View {
|
|||||||
.background(Color.gray.opacity(0.08))
|
.background(Color.gray.opacity(0.08))
|
||||||
.cornerRadius(8)
|
.cornerRadius(8)
|
||||||
|
|
||||||
HStack {
|
if isDetailed {
|
||||||
Image(systemName: "plus.circle")
|
HStack {
|
||||||
.font(.caption)
|
Image(systemName: "plus.circle")
|
||||||
.foregroundColor(.secondary)
|
.font(.caption)
|
||||||
TextField("Contribution this period (optional)", text: contributionBinding)
|
.foregroundColor(.secondary)
|
||||||
.keyboardType(.decimalPad)
|
TextField("Contribution this period (optional)", text: contributionBinding)
|
||||||
.font(.subheadline)
|
.keyboardType(.decimalPad)
|
||||||
.foregroundColor(.secondary)
|
.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)
|
.padding(.vertical, 2)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -499,22 +499,24 @@ struct AddSnapshotView: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Section {
|
if viewModel.inputMode == .detailed {
|
||||||
Toggle("Include Contribution", isOn: $viewModel.includeContribution)
|
Section {
|
||||||
|
Toggle("Include Contribution", isOn: $viewModel.includeContribution)
|
||||||
|
|
||||||
if viewModel.includeContribution {
|
if viewModel.includeContribution {
|
||||||
HStack {
|
HStack {
|
||||||
Text(viewModel.currencySymbol)
|
Text(viewModel.currencySymbol)
|
||||||
.foregroundColor(.secondary)
|
.foregroundColor(.secondary)
|
||||||
|
|
||||||
TextField("New capital added", text: $viewModel.contributionString)
|
TextField("New capital added", text: $viewModel.contributionString)
|
||||||
.keyboardType(.decimalPad)
|
.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 {
|
Section {
|
||||||
|
|||||||
Reference in New Issue
Block a user