Problem
The Invoice Dashboard: Invoice View and Single Invoice components contain messy state logic with many booleans. This makes the state logic very difficult to reason about and maintain. There is a strong suspicion that it doesn't handle errors or deviations from the happy path in the approval and payment workflow.
Proposed Solution
Refactor the state logic to use a State Machine - where all states are defined in a single enumeration. This will simplify reasoning and maintenance - it makes it obvious what code will need to update when adding new states or changing existing ones.