diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index a4df865a..53658b32 100644 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -12,16 +12,15 @@ def index # event admin —> let them manage the event return redirect_to events_path(most_recent_event) - elsif (ticket_request = TicketRequest.where(user: current_user) - .where(event: most_recent_event).last) - - # This user already has a ticket request, so redirect there.s - return redirect_to event_ticket_request_path(event_id: most_recent_event.to_param, id: ticket_request.id) elsif current_user.site_admin? || current_user.event_admin? - # redirect event admins to the events listing return redirect_to events_path end + + # This user already has a ticket request, so redirect there + if (ticket_request = TicketRequest.where(user: current_user).where(event: most_recent_event).last) + return redirect_to event_ticket_request_path(event_id: most_recent_event.to_param, id: ticket_request.id) + end end elsif signed_in? && current_user && (current_user.site_admin? || current_user.event_admin?) diff --git a/app/controllers/ticket_requests_controller.rb b/app/controllers/ticket_requests_controller.rb index b1604cb3..93258f24 100644 --- a/app/controllers/ticket_requests_controller.rb +++ b/app/controllers/ticket_requests_controller.rb @@ -108,7 +108,6 @@ def create end tr_params = permitted_params[:ticket_request].to_h || {} - tr_params[:donation] = 0 unless tr_params[:donation].present? && tr_params[:donation] =~ /^[\d.]+$/ if tr_params.empty? flash.now[:error] = 'Please fill out the form below to request tickets.' return render_flash(flash) @@ -133,14 +132,15 @@ def create target: @ticket_request ).fire! - if @event.tickets_require_approval || @ticket_request.free? + if (@event.tickets_require_approval || @ticket_request.free?) && @ticket_request.total_tickets > 1 redirect_to event_ticket_request_path(@event, @ticket_request), notice: 'When you know your guest names, please return here and add them below.' - elsif @ticket_request.all_guests_specified? + elsif !@ticket_request.all_guests_specified? + # XXX there is a bug here that flashes this when only 1 ticket being purchased. redirect_to edit_event_ticket_request_path(@event, @ticket_request), notice: 'Please enter the guest names before you are able to pay for the ticket.' - else - redirect_to new_payment_path(ticket_request_id: @ticket_request.id), + elsif @ticket_request.approved? + redirect_to event_ticket_request_payments_path(@event, @ticket_request), notice: 'Please pay for your ticket(s).' end rescue StandardError => e @@ -160,8 +160,6 @@ def update .flatten.map(&:presence) .compact - ticket_request_params[:donation] = 0 unless ticket_request_params[:donation].present? && ticket_request_params[:donation] =~ /^[\d.]+$/ - ticket_request_params.delete(:guest_list) ticket_request_params[:guests] = guests @@ -188,7 +186,7 @@ def destroy @ticket_request.destroy! if @ticket_request&.persisted? - redirect_to new_event_ticket_request_path(@event), notice: "Ticket Request ID #{ticket_request_id} was deleted." + redirect_to new_event_ticket_request_path(@event), notice: 'Ticket Request was successfully cancelled.' end def approve diff --git a/app/models/ticket_request.rb b/app/models/ticket_request.rb index c41e467d..88f13d1c 100644 --- a/app/models/ticket_request.rb +++ b/app/models/ticket_request.rb @@ -119,7 +119,7 @@ def csv_columns ].freeze STATUS_NAMES = { - 'P' => 'Pending', + 'P' => 'Pending Approval', 'A' => 'Waiting for Payment', 'D' => 'Declined', 'C' => 'Completed', @@ -232,6 +232,10 @@ def approve update status: (free? ? STATUS_COMPLETED : STATUS_AWAITING_PAYMENT) end + def post_payment? + completed? || refunded? + end + def declined? status == STATUS_DECLINED end @@ -245,12 +249,7 @@ def mark_refunded end def payment_received? - payment&.received? - end - - # not able to purchase tickets in this state - def can_purchase? - !status.in? [STATUS_DECLINED, STATUS_PENDING] + payment&.received? || payment&.refunded? end def can_be_cancelled?(by_user:) diff --git a/app/views/payments/new.html.haml b/app/views/payments/new.html.haml index bf5f4790..57477634 100644 --- a/app/views/payments/new.html.haml +++ b/app/views/payments/new.html.haml @@ -100,7 +100,7 @@ and are responsible for sharing these documents with your guests. You further understand that you are responsible for the conduct of your guests while they attend an FnF event. By making clear the values that inform our - events and setting the expectation of conduct at our events, we hope to - continue to embrace radical self-expression while continuing to invite new - and diverse people into our community. + events and setting the expectation of conduct at our events, we continue + to embrace radical self-expression while continuing to invite new and + diverse people into our community. diff --git a/app/views/shared/_nav_main.html.haml b/app/views/shared/_nav_main.html.haml index 116b9268..46192288 100644 --- a/app/views/shared/_nav_main.html.haml +++ b/app/views/shared/_nav_main.html.haml @@ -14,7 +14,7 @@ - elsif current_user.event_admin? = button_to "Manage Events", events_path, method: :get, class: "#{button_class}", data: { turbo: false } - else - = button_to "Home", root_path, class: 'btn btn-primary m-1' + = button_to "Home", events_path, class: 'btn btn-primary m-1' - else - unless controller_name == 'sessions' && action_name == 'new' && request.path == '/users/sign_in' = button_to "Log In", new_user_session_path, method: :get, class: "#{button_class}", data: { turbo: false } diff --git a/app/views/ticket_requests/_form.html.haml b/app/views/ticket_requests/_form.html.haml index b49c59ea..48615b92 100644 --- a/app/views/ticket_requests/_form.html.haml +++ b/app/views/ticket_requests/_form.html.haml @@ -18,12 +18,17 @@ = "#{@user.name} <#{@user.email}>" - else = turbo_frame_tag :turbo_login do - = render partial: "devise/shared/login", layout: false, locals: { resource: devise_mapping.singular, resource_name: devise_mapping.name, redirect_to: new_event_ticket_request_url(@event) } + = render partial: "devise/shared/login", layout: false, locals: { resource: devise_mapping.singular, + resource_name: devise_mapping.name, + redirect_to: new_event_ticket_request_url(@event) } .vertical-20 %hr .vertical-20 = turbo_frame_tag :turbo_register do - = render partial: "devise/shared/register", layout: false, locals: { resource: User.new, resource_name: devise_mapping.name, existing: false, redirect_to: new_event_ticket_request_url(@event) } + = render partial: "devise/shared/register", layout: false, locals: { resource: User.new, + resource_name: devise_mapping.name, + existing: false, + redirect_to: new_event_ticket_request_url(@event) } #ticket-request-form{"data-controller": "popovers"} - if !(signed_in? && @user) @@ -36,7 +41,7 @@ %hr %h4 Guests %p - Please list everyone in your party including the kids. We do not (currently) send automated emails to any of the guests you specify. + Please list everyone in your party including any kids you are bringing. %p For adults — please list their full name, and an email address as shown in the below example. .content-fluid @@ -75,183 +80,172 @@ - kid_guests.times do |guest_id| = f.label "Kid Guest #{guest_id + 1}" = f.text_field :guest_list, readonly: list_finalized, multiple: true, value: Array(@ticket_request.guests[(adult_guests)..total_guests])[guest_id], style: 'width: 80%' + - else + -# on create, set user into guests list + = f.hidden_field :guests, value: @user.name_and_email - %hr - %h4 How are you contributing to the event? - .content-fluid - .row - .col-lg-6.col-xl-6.col-md-12.col-sm-12 - .input-group-large - %fieldset - %p - = f.label :role_volunteer do - = f.label :role_volunteer, class: 'radio inline' do - = f.radio_button :role, TicketRequest::ROLE_VOLUNTEER, - data: { 'max-tickets' => TicketRequest::TICKET_LIMITS[TicketRequest::ROLE_VOLUNTEER] } - = TicketRequest::ROLES[TicketRequest::ROLE_VOLUNTEER] - = f.label :role_contributor, class: 'radio inline' do - = f.radio_button :role, TicketRequest::ROLE_CONTRIBUTOR, - data: { 'max-tickets' => TicketRequest::TICKET_LIMITS[TicketRequest::ROLE_CONTRIBUTOR] } - = TicketRequest::ROLES[TicketRequest::ROLE_CONTRIBUTOR] - = f.label :role_coordinator, class: 'radio inline' do - = f.radio_button :role, TicketRequest::ROLE_COORDINATOR, - data: { 'max-tickets' => TicketRequest::TICKET_LIMITS[TicketRequest::ROLE_COORDINATOR] } - = TicketRequest::ROLES[TicketRequest::ROLE_COORDINATOR] - = f.label :role_uber_coordinator, class: 'radio inline' do - = f.radio_button :role, TicketRequest::ROLE_UBER_COORDINATOR, - data: { 'max-tickets' => TicketRequest::TICKET_LIMITS[TicketRequest::ROLE_UBER_COORDINATOR] } - = TicketRequest::ROLES[TicketRequest::ROLE_UBER_COORDINATOR] - = f.label :role_other, class: 'radio inline' do - = f.radio_button :role, TicketRequest::ROLE_OTHER, - data: { 'max-tickets' => TicketRequest::TICKET_LIMITS[TicketRequest::ROLE_OTHER] } - = TicketRequest::ROLES[TicketRequest::ROLE_OTHER] - - .col-lg-6.col-xl-6.col-md-12.col-sm-12.align-content-md-center - %p.muted.role-explanation{ class: TicketRequest::ROLE_VOLUNTEER } - You are working one or more shifts at the event - - %p.muted.role-explanation.hidden{ class: TicketRequest::ROLE_CONTRIBUTOR } - Working before and during or during and after; actively involved in - planning the campout e.g. a coordinator assistant or apprentice. Bringing - gear, driving trucks, art committee, etc. - - %p.muted.role-explanation.hidden{ class: TicketRequest::ROLE_COORDINATOR } - Listed on the Coordinator Sheet as someone who is leading a major area of - camp out planning; working before, during, and after the event including - things like resource coordination, significant gear prep, pre/post-site - visits, etc. - - %p.muted.role-explanation.hidden{ class: TicketRequest::ROLE_OTHER } - Art Grantee or DJ - - = f.text_area :role_explanation, - placeholder: 'Briefly describe your role', - rows: 4, width: 400, maxlength: 200, required: false, style: 'min-width: 100% !important; font-size: 11pt;' - - .row - .col-lg-6.col-xl-6.col-md-12.col-sm-12 - = f.label :previous_contribution, 'What was your role last year?' - = f.text_area :previous_contribution, style: 'min-width: 100%', - rows: 2, maxlength: 250, required: false + - unless @ticket_request.post_payment? + %hr + %h4 How are you contributing to the event? + .content-fluid + .row + .col-lg-6.col-xl-6.col-md-12.col-sm-12 + .input-group-large + %fieldset + %p + = f.label :role_volunteer do + = f.label :role_volunteer, class: 'radio inline' do + = f.radio_button :role, TicketRequest::ROLE_VOLUNTEER, + data: { 'max-tickets' => TicketRequest::TICKET_LIMITS[TicketRequest::ROLE_VOLUNTEER] } + = TicketRequest::ROLES[TicketRequest::ROLE_VOLUNTEER] + = f.label :role_contributor, class: 'radio inline' do + = f.radio_button :role, TicketRequest::ROLE_CONTRIBUTOR, + data: { 'max-tickets' => TicketRequest::TICKET_LIMITS[TicketRequest::ROLE_CONTRIBUTOR] } + = TicketRequest::ROLES[TicketRequest::ROLE_CONTRIBUTOR] + = f.label :role_coordinator, class: 'radio inline' do + = f.radio_button :role, TicketRequest::ROLE_COORDINATOR, + data: { 'max-tickets' => TicketRequest::TICKET_LIMITS[TicketRequest::ROLE_COORDINATOR] } + = TicketRequest::ROLES[TicketRequest::ROLE_COORDINATOR] + = f.label :role_uber_coordinator, class: 'radio inline' do + = f.radio_button :role, TicketRequest::ROLE_UBER_COORDINATOR, + data: { 'max-tickets' => TicketRequest::TICKET_LIMITS[TicketRequest::ROLE_UBER_COORDINATOR] } + = TicketRequest::ROLES[TicketRequest::ROLE_UBER_COORDINATOR] + = f.label :role_other, class: 'radio inline' do + = f.radio_button :role, TicketRequest::ROLE_OTHER, + data: { 'max-tickets' => TicketRequest::TICKET_LIMITS[TicketRequest::ROLE_OTHER] } + = TicketRequest::ROLES[TicketRequest::ROLE_OTHER] + + .col-lg-6.col-xl-6.col-md-12.col-sm-12.align-content-md-center + %p.muted.role-explanation{ class: TicketRequest::ROLE_VOLUNTEER } + You are working one or more shifts at the event + + %p.muted.role-explanation.hidden{ class: TicketRequest::ROLE_CONTRIBUTOR } + Working before and during or during and after; actively involved in + planning the campout e.g. a coordinator assistant or apprentice. Bringing + gear, driving trucks, art committee, etc. + + %p.muted.role-explanation.hidden{ class: TicketRequest::ROLE_COORDINATOR } + Listed on the Coordinator Sheet as someone who is leading a major area of + camp out planning; working before, during, and after the event including + things like resource coordination, significant gear prep, pre/post-site + visits, etc. + + %p.muted.role-explanation.hidden{ class: TicketRequest::ROLE_OTHER } + Art Grantee or DJ + + = f.text_area :role_explanation, + placeholder: 'Briefly describe your role', + rows: 4, width: 400, maxlength: 200, required: false, style: 'min-width: 100% !important; font-size: 11pt;' - - if signed_in? && @event.admin?(current_user) && form_action_name == :update - .well - = f.label :special_price, 'Total Special Price ($)' + .row + .col-lg-6.col-xl-6.col-md-12.col-sm-12 + = f.label :previous_contribution, 'What was your role last year?' + = f.text_area :previous_contribution, style: 'min-width: 100%', + rows: 2, maxlength: 250, required: false - %p.text-error - Editable by event admins only. Leave blank to use default price. - = f.number_field :special_price, class: 'input-small', min: 0 + - if signed_in? && @event.admin?(current_user) && form_action_name == :update + .well + = f.label :special_price, 'Total Special Price ($)' - = f.label :adults, 'Number of adult tickets' + " @ $#{@event.adult_ticket_price.to_i} each" - = f.number_field :adults, class: 'input-mini', min: 1, required: true, - max: @event.max_adult_tickets_per_request, - data: { default_price: @event.adult_ticket_price.to_i } + %p.text-error + Editable by event admins only. Leave blank to use default price. + = f.number_field :special_price, class: 'input-small', min: 0 - %br + = f.label :adults, 'Number of adult tickets' + " @ $#{@event.adult_ticket_price.to_i} each" + = f.number_field :adults, class: 'input-mini', min: 1, required: true, + max: @event.max_adult_tickets_per_request, + data: { default_price: @event.adult_ticket_price.to_i } - - if @event.kid_ticket_price - %table.w-100.m-0.p-0 - %tbody.m-0.p-0 - %tr.align-middle - %td.w-90.m-0.p-0.text-start - = f.label :kids do - Number of children (12 and under) you are bringing with you - (not transferable to adults; babes in arms are free) - = f.number_field :kids, class: 'input-mini', min: 0, - max: @event.max_kid_tickets_per_request, - data: { default_price: @event.kid_ticket_price.to_i, - custom_prices: price_rules_to_json(@event) } - - %td.w-10.text-end - = tooltip_box help_text_for(:kids), title: "Kid Tickets" - - - unless is_update - .card.bg-warning-subtle.mb-3{:style => "max-width: 100%;"} - .card-body.bg-success-subtle.text-dark.pt-1 - %h5.card-title Please Note: - %p.card-text - Once you submit this ticket request, and it's approved, you'll receive an email stating so. You can also bookmark this URL and return to it at a later date. - In order to pay for the ticket(s) you are required to fill out the list of guests (if any) and kids (if any) you are bringing and/or inviting. - - -# - if false @event.cabin_price - - = f.label :cabins do - How many cabins did you want? - = tooltip_box help_text_for(:cabins) - - = f.number_field :cabins, class: 'input-mini', min: 0, - max: @event.max_cabins_per_request, - data: { default_price: @event.cabin_price.to_i }, - disabled: !@event.cabins_available? - - %span.help-inline.inline-price - - unless @event.cabins_available? - Sorry, we are sold out of cabins at this point in time. - .col-lg-6.col-xl-6.col-md-12.col-sm-12 - .control-group - - - if @event.allow_financial_assistance - %table.w-100 - %tbody - %tr - %td.text-start - = f.label :needs_assistance, class: 'checkbox' do - = f.check_box :needs_assistance - I’m requesting financial assistance with purchasing my ticket(s) - %td.text-end - = tooltip_box help_text_for(:needs_assistance), title: "Financial Assistance" - - - .control-group - - - if @event.allow_donations - %table.w-100 - %tbody - %tr - %td - = f.label :donation, 'Your Optional Donation:' - = f.number_field :donation, class: 'input-mini', min: 0, required: false - %td.text-end - = tooltip_box "Your donation is optional to California Foundation for Advancement of Electronic Arts, but is greatly appreciated, and is indeed tax deductible!" - - .control-group - - - if @event.require_mailing_address - %fieldset - = f.label :address_line1, class: 'required-label' do - Address1 - = tooltip_box help_text_for(:address) - = f.text_field :address_line1, required: true, placeholder: 'Street address, P.O. box, etc.', maxlength: 200 - = f.label :address_line2 do - Address2 - = f.text_field :address_line2, placeholder: 'Apartment, suite, unit, building, floor, etc.', maxlength: 200 - = f.label :city, 'City', class: 'required-label' - = f.text_field :city, required: true, maxlength: 50 - = f.label :state, 'State/Province/Region', class: 'required-label' - = f.text_field :state, required: true, maxlength: 50 - = f.label :zip_code, 'Zip/Postal Code', class: 'required-label' - = f.text_field :zip_code, required: true, maxlength: 32 - = f.label :country_code, 'Country', class: 'required-label' - = f.country_select "country_code", iso_codes: true, default_value: 'US' - - .control-group - = f.label :notes do - Who did you hear about this event from? - Any special requests or things you want to mention? %br - = f.text_area :notes, - rows: 4, columns: 100, maxlength: 500, style: 'width: 100%' + - if @event.kid_ticket_price + %table.w-100.m-0.p-0 + %tbody.m-0.p-0 + %tr.align-middle + %td.w-90.m-0.p-0.text-start + = f.label :kids do + Number of children (12 and under) you are bringing with you + (not transferable to adults; babes in arms are free) + = f.number_field :kids, class: 'input-mini', min: 0, + max: @event.max_kid_tickets_per_request, + data: { default_price: @event.kid_ticket_price.to_i, + custom_prices: price_rules_to_json(@event) } + + %td.w-10.text-end + = tooltip_box help_text_for(:kids), title: "Kid Tickets" + + - unless is_update + .card.bg-warning-subtle.mb-3{:style => "max-width: 100%;"} + .card-body.bg-success-subtle.text-dark.pt-1 + %h5.card-title Please Note: + %p.card-text + Once you submit this ticket request, and it's approved, you'll receive an email stating so. You can also bookmark this URL and return to it at a later date. + In order to pay for the ticket(s) you are required to fill out the list of guests (if any) and kids (if any) you are bringing and/or inviting. - - if signed_in? && @event.admin?(current_user) && form_action_name == :update - .well - = f.label :admin_notes do - Additional Notes - %p.text-error - Visible by event admins only. - = f.text_area :admin_notes, rows: 5, columns: 800, maxlength: 512, style: 'width: 100%' - %br + .col-lg-6.col-xl-6.col-md-12.col-sm-12 + .control-group + + - if @event.allow_financial_assistance + %table.w-100 + %tbody + %tr + %td.text-start + = f.label :needs_assistance, class: 'checkbox' do + = f.check_box :needs_assistance + I’m requesting financial assistance with purchasing my ticket(s) + %td.text-end + = tooltip_box help_text_for(:needs_assistance), title: "Financial Assistance" + + + .control-group + + - if @event.allow_donations + %table.w-100 + %tbody + %tr + %td + = f.label :donation, 'Your Optional Donation:' + = f.number_field :donation, class: 'input-mini', min: 0, required: false + %td.text-end + = tooltip_box "Your option donation to The California Foundation for The Advancement of Electronic Arts, Non Profit 501(c)(3), is greatly appreciated and is tax deductible!" + + .control-group + + - if @event.require_mailing_address + %fieldset + = f.label :address_line1, class: 'required-label' do + Address1 + = tooltip_box help_text_for(:address) + = f.text_field :address_line1, required: true, placeholder: 'Street address, P.O. box, etc.', maxlength: 200 + = f.label :address_line2 do + Address2 + = f.text_field :address_line2, placeholder: 'Apartment, suite, unit, building, floor, etc.', maxlength: 200 + = f.label :city, 'City', class: 'required-label' + = f.text_field :city, required: true, maxlength: 50 + = f.label :state, 'State/Province/Region', class: 'required-label' + = f.text_field :state, required: true, maxlength: 50 + = f.label :zip_code, 'Zip/Postal Code', class: 'required-label' + = f.text_field :zip_code, required: true, maxlength: 32 + = f.label :country_code, 'Country', class: 'required-label' + = f.country_select "country_code", iso_codes: true, default_value: 'US' + + .control-group + = f.label :notes do + Who did you hear about this event from? + Any special requests or things you want to mention? + %br + + = f.text_area :notes, + rows: 4, columns: 100, maxlength: 500, style: 'width: 100%' + - if signed_in? && @event.admin?(current_user) && form_action_name == :update + .well + = f.label :admin_notes do + Additional Notes + %p.text-error + Visible by event admins only. + = f.text_area :admin_notes, rows: 5, columns: 800, maxlength: 512, style: 'width: 100%' + %br - unless is_update %p Every year, every attendee, no matter how long they've been coming, must @@ -266,14 +260,13 @@ and agree to follow the principles outlined therein %br - - .actions - - submit_btn_text = is_update ? 'Update Request' : 'Submit Request' - = f.submit submit_btn_text, class: 'btn btn-primary btn-large', disabled: !is_update, - id: 'submit-request', - data: { disable_with: 'Submitting...' } - - if @ticket_request && @ticket_request.id - = link_to event_ticket_request_path(event_id: @event.id, id: @ticket_request&.id), method: :get, class: 'btn btn-large btn-secondary' do - View Request + .actions + - submit_btn_text = is_update ? 'Update Request' : 'Submit Request' + = f.submit submit_btn_text, class: 'btn btn-primary btn-large', disabled: !is_update, + id: 'submit-request', + data: { disable_with: 'Submitting...' } + - if @ticket_request && @ticket_request.id + = link_to event_ticket_request_path(event_id: @event.id, id: @ticket_request&.id), method: :patch, class: 'btn btn-large btn-secondary' do + View Request diff --git a/app/views/ticket_requests/_ticket_request_show.html.haml b/app/views/ticket_requests/_ticket_request_show.html.haml index 4a74f2c0..c15c0825 100644 --- a/app/views/ticket_requests/_ticket_request_show.html.haml +++ b/app/views/ticket_requests/_ticket_request_show.html.haml @@ -16,13 +16,12 @@ %span.p-2.rounded{ class: text_class_for_status(ticket_request) } = ticket_request.status_name - - if ticket_request.can_purchase? - %tr - %td.text-end.small.p-2.px-4.text-nowrap= "Total Tickets Price:" - %td - %strong - %span{ class: ('label label-info' if ticket_request.special_price) } - = number_to_currency(ticket_request.price, precision: 0) + %tr + %td.text-end.small.p-2.px-4.text-nowrap= "Total Tickets Price:" + %td + %strong + %span{ class: ('label label-info' if ticket_request.special_price) } + = number_to_currency(ticket_request.price, precision: 0) - if ticket_request.donation&.positive? %tr @@ -30,29 +29,32 @@ %td %strong = number_to_currency(ticket_request.donation, precision: 0) + %tr + %td.text-end.small.p-2.px-4.text-nowrap= "Total Amount:" + %td + %strong + = number_to_currency(ticket_request.cost, precision: 0) %tr %td.text-end.small.p-2.px-4.text-nowrap= "Payment:" %td %strong - if ticket_request.payment_received? - - if ticket_request.refunded? - %span.bg-success Refunded - - else - .text-success - = link_to 'Received', event_ticket_request_payment_path(event, payment, ticket_request) + %strong.span.p-2.rounded{ class: text_class_for_status(ticket_request) } + = ticket_request.payment.status_name - elsif ticket_request.free? .text-success Free - else - if event.ticket_sales_open? - if ticket_request.payment.present? && ticket_request.payment.explanation.present? - %span.bg-warning Paying with #{ticket_request.payment.explanation} + %strong.span.bg-warning Paying with #{ticket_request.payment.explanation} - else - if ticket_request.all_guests_specified? - = link_to 'Purchase your ticket now', - new_event_ticket_request_payment_path(event, ticket_request), - class: 'btn btn-primary m-0' + - if ticket_request.awaiting_payment? + = link_to 'Pay Now', new_event_ticket_request_payment_path(event, ticket_request), class: 'btn btn-primary m-0' + - else + = "Waiting on ticket approval" - else .small You must register all of your guests before you can pay for your ticket. diff --git a/app/views/ticket_requests/show.html.haml b/app/views/ticket_requests/show.html.haml index e7d34934..c37ce30d 100644 --- a/app/views/ticket_requests/show.html.haml +++ b/app/views/ticket_requests/show.html.haml @@ -59,9 +59,12 @@ .row .col-8 .btn-group - - if @event.admin?(current_user) || @ticket_request.guest_count > 0 + - if @event.admin?(current_user) || !@ticket_request.post_payment? = link_to edit_event_ticket_request_path(@event, @ticket_request), class: 'btn btn-primary btn-round btn-sm mx-0 fs-6' do - = @event.admin?(current_user) ? 'Edit Ticket Request' : 'Edit Guests' + Edit Ticket Request + - else + = link_to edit_event_ticket_request_path(@event, @ticket_request), class: 'btn btn-primary btn-round btn-sm mx-0 fs-6' do + Edit Guests - if signed_in? && @ticket_request.can_be_cancelled?(by_user: current_user) = button_to " ✘ Cancel Ticket Request", event_ticket_request_path(@event, @ticket_request), class: 'btn btn-warning btn-mdsm', method: :delete, data: { "turbo-confirm": "Are you sure you want to delete this ticket request?" }