From 390c74ef5a7706fd5950adea76f1c38d8800668c Mon Sep 17 00:00:00 2001 From: maebeale Date: Mon, 22 Jun 2026 08:17:30 -0400 Subject: [PATCH] Clarify payment "Revert" as removing an allocation 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 --- app/views/payments/index.html.erb | 2 +- app/views/payments/payment_results.html.erb | 13 +++-- app/views/payments/show.html.erb | 58 +++++++++++++-------- 3 files changed, 45 insertions(+), 28 deletions(-) diff --git a/app/views/payments/index.html.erb b/app/views/payments/index.html.erb index 76596d4c54..3227c2ccb2 100644 --- a/app/views/payments/index.html.erb +++ b/app/views/payments/index.html.erb @@ -1,7 +1,7 @@

Payments

-
<%= link_to "Add Cash Payment", new_payment_path(type: "CashPayment"), class: "btn btn-secondary" %><%= link_to "Add Check Payment", new_payment_path(type: "CheckPayment"), class: "btn btn-secondary" %><%= link_to "Generate Stripe Link", new_checkout_link_payments_path, class: "btn btn-secondary" %>
+
<%= link_to "Add cash payment", new_payment_path(type: "CashPayment"), class: "btn btn-secondary" %><%= link_to "Add check payment", new_payment_path(type: "CheckPayment"), class: "btn btn-secondary" %><%= link_to "Generate Stripe link", new_checkout_link_payments_path, class: "btn btn-secondary" %>
<%= render 'search_boxes' %> diff --git a/app/views/payments/payment_results.html.erb b/app/views/payments/payment_results.html.erb index 93cc2c6c02..dadcaef3a4 100644 --- a/app/views/payments/payment_results.html.erb +++ b/app/views/payments/payment_results.html.erb @@ -1,6 +1,6 @@ <%= turbo_frame_tag :payment_results do %> <% if @payments.any? %> -
+
@@ -14,11 +14,11 @@ <% @payments.each do |payment| %> - + - + @@ -26,8 +26,11 @@
<%= payment.type.underscore.titleize.gsub(" Payment", "").gsub("External Processor", "Stripe") %> <%= payment.payer.name %> <%= dollars_from_cents(payment.amount_cents) %><%= dollars_from_cents(payment.amount_cents_remaining) %>"><%= dollars_from_cents(payment.amount_cents_remaining) %> <%= payment.created_at.strftime("%B %d, %Y at %I:%M %p") %> <%= link_to "View", payment_path(payment), class: "text-primary hover:text-primary-dark", data: { turbo_frame: "_top"} %>
+ <% else %> -

There are no payments that match your search. Please try again.

+
+ +

There are no payments that match your search. Please try again.

+
<% end %> - <% end %> diff --git a/app/views/payments/show.html.erb b/app/views/payments/show.html.erb index dabd0078f8..8435725a41 100644 --- a/app/views/payments/show.html.erb +++ b/app/views/payments/show.html.erb @@ -36,7 +36,7 @@
<% if @payment.check_number.present? %>
-
Check Number
+
Check number
<%= @payment.check_number %>
<% end %> @@ -48,7 +48,7 @@ <% end %> <% if @payment.pay_charge_id.present? %>
-
Pay Charge ID
+
Pay charge ID
<%= @payment.pay_charge_id %>
<% end %> @@ -92,43 +92,57 @@ <% if @allocations.any? %>
-

Allocations

+
+

Allocations

+
+

Removing an allocation returns its amount to this payment's unallocated balance.

- + - + <% @allocations.each do |allocation| %> - <% row_class = if allocation.amount.to_i < 0 - 'bg-red-50' - elsif allocation.reverted_id.present? - 'bg-gray-100 border border-gray-300 opacity-60' + <% is_reversal = allocation.amount.to_i < 0 %> + <% is_removed = allocation.reverted_id.present? %> + <% row_class = if is_reversal + "bg-amber-50" + elsif is_removed + "bg-gray-50 text-gray-400" end %> - - + @@ -149,7 +163,7 @@ - +
Allocated ToAllocated to AmountDate/TimeDate/time Actions
- <%= link_to allocations_path(allocatable_sgid: allocation.allocatable.to_sgid.to_s) do %> - <% if allocation.allocatable_type == "EventRegistration" && allocation.allocatable.present? %> - <%= allocation.allocatable.registrant.full_name %> - — - <%= allocation.allocatable.event.title %> - <% else %> - <%= allocation.allocatable_type.underscore.titleize %> + +
+ <%= link_to allocations_path(allocatable_sgid: allocation.allocatable.to_sgid.to_s), class: "#{'line-through' if is_removed}" do %> + <% if allocation.allocatable_type == "EventRegistration" && allocation.allocatable.present? %> + <%= allocation.allocatable.registrant.full_name %> + — + <%= allocation.allocatable.event.title %> + <% else %> + <%= allocation.allocatable_type.underscore.humanize %> + <% end %> <% end %> - <% end %> + <% if is_reversal %> + Reversal + <% elsif is_removed %> + Removed + <% end %> +
<%= dollars_from_cents(allocation.amount) %><%= dollars_from_cents(allocation.amount) %> <%= allocation.created_at.strftime("%B %d, %Y at %I:%M %p") %> - <% unless allocation.reverted? || allocation.amount.to_i < 0 %> - <%= button_to "revert", revert_allocation_path(allocation), method: :post, class: "cursor-pointer text-danger hover:text-danger-dark", data: { turbo_confirm: "are you sure you want to revert this allocation?" } %> + <% unless is_removed || is_reversal %> + <%= button_to revert_allocation_path(allocation), method: :post, class: "inline-flex items-center gap-1.5 cursor-pointer text-danger hover:text-danger-dark", data: { turbo_confirm: "Remove this allocation? The #{dollars_from_cents(allocation.amount)} will be returned to this payment's unallocated balance." } do %> + Remove + <% end %> <% end %>
Recipient Method AmountDate/TimeDate/time