Skip to content

HOLD: Clarify payment Revert as removing an allocation#1857

Draft
maebeale wants to merge 1 commit into
mainfrom
maebeale/style-payments-revert-label
Draft

HOLD: Clarify payment Revert as removing an allocation#1857
maebeale wants to merge 1 commit into
mainfrom
maebeale/style-payments-revert-label

Conversation

@maebeale

Copy link
Copy Markdown
Collaborator

What is the goal of this PR and why is this important?

  • The payment "Revert" action only offsets an allocation and returns its amount to the payment's unallocated balance, but the bare "revert" label and a silently greyed-out row left admins guessing what it actually did.
  • This reframes the action around what it does — removing an allocation — so the payments admin screens read clearly.

How did you approach the change?

  • Renamed the action to Remove (trash icon) with a consequence-stating confirm that names the dollar amount returned, plus an explainer line under the Allocations heading.
  • Added explicit Removed / Reversal badges so reverted originals and their offsetting rows are self-describing instead of just dimmed.
  • Polished the payments index and detail views: results in a card with row hover, amber highlight on unallocated balances, an icon empty state, and sentence-case labels.

UI Testing Checklist

  • Payments index: results render in a card, rows highlight on hover, unallocated amounts show amber, empty search shows the icon state.
  • Payment detail: an active allocation shows a Remove button; confirming returns the amount to the unallocated balance.
  • After removing, the original row shows a Removed badge and the offsetting row shows a Reversal badge with a negative amount.

Anything else to add?

  • HOLD — not ready to merge yet; opening as draft for early visibility.
  • View-only change; no controller, route, or revert behavior was modified. Rebased onto latest main (adopts the dollars_from_cents helper); Rubocop and Brakeman pass.

The revert action only offsets an allocation and returns its amount to
the payment's unallocated balance, but the bare "revert" label and a
silent greyed-out row left users guessing what it did. Reframe it as
"Remove" with a consequence-stating confirm, explicit Removed/Reversal
badges, and a one-line explainer, plus light polish on the payments
index and detail views.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
'bg-red-50'
elsif allocation.reverted_id.present?
'bg-gray-100 border border-gray-300 opacity-60'
<% is_reversal = allocation.amount.to_i < 0 %>

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 From Claude: The two badges map to the revert mechanism: is_removed is the original allocation (reverted_id set), is_reversal is the auto-created negative offset row. Both hide the Remove action so a removal can't be removed again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant