From 8372536fd62efaf35e6f89bfa6639a07925bec58 Mon Sep 17 00:00:00 2001 From: Matt Levy Date: Tue, 20 Aug 2024 14:24:39 -0700 Subject: [PATCH] clean up the logic logic was funky around ticket requests list simplified and unified --- .../_table_ticket_requests.html.haml | 62 +++++++------------ 1 file changed, 24 insertions(+), 38 deletions(-) diff --git a/app/views/ticket_requests/_table_ticket_requests.html.haml b/app/views/ticket_requests/_table_ticket_requests.html.haml index 4134e594..3247a675 100644 --- a/app/views/ticket_requests/_table_ticket_requests.html.haml +++ b/app/views/ticket_requests/_table_ticket_requests.html.haml @@ -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',