Skip to content

Commit

Permalink
clean up the logic
Browse files Browse the repository at this point in the history
logic was funky around ticket requests list
simplified and unified
  • Loading branch information
beingmattlevy committed Aug 20, 2024
1 parent 368815d commit 8372536
Showing 1 changed file with 24 additions and 38 deletions.
62 changes: 24 additions & 38 deletions app/views/ticket_requests/_table_ticket_requests.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -78,51 +78,37 @@
= text_for_status ticket_request


%td.align-content-end.text-end
- if event.tickets_require_approval && ticket_request.pending?
.btn-group
= button_to approve_event_ticket_request_path(event, ticket_request),
method: :post,
class: 'btn btn-primary btn-sm text-nowrap' do
✔︎ Approve
= button_to decline_event_ticket_request_path(event, ticket_request),
method: :post,
class: 'btn btn-danger btn-sm text-nowrap',
data: { confirm: "Are you sure you want to decline #{ticket_request.user.name}'s request?" } do
✘ Decline
- elsif !ticket_request.payment
.btn-group
- if ticket_request.declined?
= button_to revert_to_pending_event_ticket_request_path(event, ticket_request),
method: :post,
class: 'btn btn-danger btn-sm text-nowrap' do
↩︎ Revert
- elsif !ticket_request.completed?
- if event.tickets_require_approval
= button_to resend_approval_event_ticket_request_path(event, ticket_request),
method: :post,
class: 'btn btn-primary btn-sm text-nowrap' do
↺ Re-Approve
= button_to manual_confirmation_event_ticket_request_payments_path(event, ticket_request),
%td.align-content-end.text-center
- if ticket_request.pending?
- if event.tickets_require_approval
.btn-group
= button_to approve_event_ticket_request_path(event, ticket_request),
method: :post,
class: 'btn btn-success btn-sm text-nowrap' do
$ Received
class: 'btn btn-primary btn-sm text-nowrap' do
✔︎ Approve
= button_to decline_event_ticket_request_path(event, ticket_request),
method: :post,
class: 'btn btn-danger btn-sm text-nowrap',
data: { confirm: "Are you sure you want to decline #{ticket_request.user.name}'s already approved request?" } do
data: { "turbo-confirm": "Are you sure you want to decline #{ticket_request.user.name}'s request?" } do
✘ Decline

- elsif ticket_request.payment.present? && ticket_request.awaiting_payment?
.btn-group.pull-right
.btn-group
- if ticket_request.awaiting_payment?
= button_to manual_confirmation_event_ticket_request_payments_path(event, ticket_request),
method: :post,
class: 'btn btn-primary btn-sm ' do
Mark as Received
%i.icon-ok

- elsif ticket_request.payment&.received?
.btn-group.pull-right
class: 'btn btn-success btn-sm text-nowrap' do
Mark Received
= button_to decline_event_ticket_request_path(event, ticket_request),
method: :post,
class: 'btn btn-danger btn-sm text-nowrap',
data: { "turbo-confirm": "Are you sure you want to decline #{ticket_request.user.name}'s already approved request?" } do
✘ Decline
- if ticket_request.declined?
- button_text = event.tickets_require_approval ? '↩︎ Re-Approve' : '↩︎ Revert'
= button_to revert_to_pending_event_ticket_request_path(event, ticket_request),
method: :post,
class: 'btn btn-danger btn-sm text-nowrap' do
= button_text
- if ticket_request.completed? && ticket_request.payment&.received?
= button_to refund_event_ticket_request_path(event, ticket_request),
method: :post,
class: 'btn btn-danger btn-sm text-nowrap',
Expand Down

0 comments on commit 8372536

Please sign in to comment.