diff --git a/app/models/ticket_purchase.rb b/app/models/ticket_purchase.rb index 8b0cd555..d13f0b8c 100644 --- a/app/models/ticket_purchase.rb +++ b/app/models/ticket_purchase.rb @@ -16,6 +16,7 @@ class TicketPurchase < ActiveRecord::Base delegate :price, to: :ticket delegate :price_cents, to: :ticket delegate :price_currency, to: :ticket + delegate :payment_mode, to: :ticket def self.purchase(conference, user, purchases) errors = [] diff --git a/app/views/conference_registrations/show.html.haml b/app/views/conference_registrations/show.html.haml index dd73e70b..455c13d6 100644 --- a/app/views/conference_registrations/show.html.haml +++ b/app/views/conference_registrations/show.html.haml @@ -89,29 +89,48 @@ %span.fa-stack %i.fa.fa-square-o.fa-stack-2x %i.fa.fa-ticket.fa-stack-1x - Tickets + Booked Tickets -if @tickets.any? = "(#{@total_price} #{@tickets.first.price.symbol})" + Offline Payments %ul - @tickets.each do |ticket| - %li - = ticket.quantity - = ticket.title - = word_pluralize(ticket.quantity, 'Ticket') - for - = humanized_money ticket.price - = ticket.price.symbol - = link_to conference_ticket_purchase_path(@conference.short_title, ticket.id), method: :delete, + -if ticket.payment_mode == "Offline" + %li + = ticket.quantity + = ticket.title + = word_pluralize(ticket.quantity, 'Ticket') + for + = humanized_money ticket.price + = ticket.price.symbol + = link_to conference_ticket_purchase_path(@conference.short_title, ticket.id), method: :delete, id: "ticket-#{ticket.id}-delete", class: 'btn btn-danger btn-xs', data: { confirm: "Do you really want to delete the #{ticket.title} ticket for #{@conference.title}?" } do - %i.fa.fa-trash-o - %li - - if @tickets.any? - = link_to 'Buy more tickets', conference_tickets_path(@conference.short_title) - - else - You haven't bought any tickets. - = link_to 'Please buy some tickets to support us!', conference_tickets_path(@conference.short_title) + %i.fa.fa-trash-o + + Online Payments + %ul + - @tickets.each do |ticket| + -if ticket.payment_mode == "Online" + %li + = ticket.quantity + = ticket.title + = word_pluralize(ticket.quantity, 'Ticket') + for + = humanized_money ticket.price + = ticket.price.symbol + = link_to conference_ticket_purchase_path(@conference.short_title, ticket.id), method: :delete, + id: "ticket-#{ticket.id}-delete", + class: 'btn btn-danger btn-xs', + data: { confirm: "Do you really want to delete the #{ticket.title} ticket for #{@conference.title}?" } do + %i.fa.fa-trash-o + + - if @tickets.any? + = link_to 'Buy more tickets', conference_tickets_path(@conference.short_title) + - else + You haven't bought any tickets. + = link_to 'Please buy some tickets to support us!', conference_tickets_path(@conference.short_title) .row .col-md-12