Filter Categories by Transaction Type in Forms #2082
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #2016
This PR fixes a bug where transaction forms were showing all categories regardless of transaction type (income or expense).
Changes
Account::TransactionsController
to filter categories appropriatelyImplementation Details
The implementation filters categories in the controller layer while maintaining a clean user interface for navigating between different transaction types. By moving the filtering logic to the controller and creating a shared navigation component, we've addressed the issue while also maintaining code quality.
Testing
I've manually tested the changes to verify:
separate-income-expense_proof.mp4
Note: There were some failing tests in the suite when running the tests on my dev container, but these failures are also present on the main branch before doing any changes; therefore I assume they are unrelated to the changes in this PR.
For Discussion: Potential UI Improvements
While working on this fix, I noticed some opportunities for further improving the transaction forms:
I'd be happy to implement these improvements in a follow-up PR if you think they'd be beneficial. Great work on the app by the way!