Skip to content

Commit

Permalink
Merge pull request #169 from fnf-org/156-payment-amounts
Browse files Browse the repository at this point in the history
fix delete button
  • Loading branch information
beingmattlevy authored May 13, 2024
2 parents 60335a7 + 53ae539 commit a43f319
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
7 changes: 6 additions & 1 deletion app/controllers/ticket_requests_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,12 @@ def update

def destroy
unless @event.admin?(current_user) || current_user == @ticket_request.user
flash.now[:error] = 'You do not have sufficient priviliges to delete this request.'
flash.now[:error] = 'You do not have sufficient privileges to delete this request.'
return render_flash(flash)
end

if @ticket_request.payment_received?
flash.now[:error] = 'Can not delete request when payment has been received.'
return render_flash(flash)
end

Expand Down
5 changes: 3 additions & 2 deletions app/views/ticket_requests/show.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,9 @@
= link_to edit_event_ticket_request_path(@event, @ticket_request), class: 'btn btn-primary btn-round mx-0' do
= @event.admin?(current_user) ? 'Edit Ticket Request' : 'Edit Guests'

- if @event.admin?(current_user) || @ticket_request.user == current_user
= button_to "Delete this Ticket Request ✘ ", event_ticket_request_path(@event, @ticket_request), class: 'btn btn-warning', method: :delete, data: { "turbo-confirm": "Are you sure?" }
- if !@ticket_request.payment_received?
- if @event.admin?(current_user) || @ticket_request.user == current_user
= button_to "Delete this Ticket Request ✘ ", event_ticket_request_path(@event, @ticket_request), class: 'btn btn-warning', method: :destroy, data: { "turbo-confirm": "Are you sure?" }



0 comments on commit a43f319

Please sign in to comment.