From 2df944176e18d1f1d4b81c6f2d6618aa17d04ae4 Mon Sep 17 00:00:00 2001 From: Rishabh Saxena Date: Fri, 27 May 2016 14:25:53 +0530 Subject: [PATCH 1/2] add payment mode field to tickets for attendees --- app/views/tickets/_ticket.html.haml | 2 ++ app/views/tickets/index.html.haml | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/views/tickets/_ticket.html.haml b/app/views/tickets/_ticket.html.haml index c31703b3..712218fd 100644 --- a/app/views/tickets/_ticket.html.haml +++ b/app/views/tickets/_ticket.html.haml @@ -7,6 +7,8 @@ %h5.media-heading -if !ticket.description.blank? = markdown(ticket.description) + %td.col-sm-q.col-md-1 + = ticket.payment_mode %td.col-sm-1.col-md-1 - if ticket.bought?(current_user) = text_field_tag("tickets[][#{ticket.id}]", ticket.quantity_bought_by(current_user), diff --git a/app/views/tickets/index.html.haml b/app/views/tickets/index.html.haml index 542c2624..4ff678e4 100644 --- a/app/views/tickets/index.html.haml +++ b/app/views/tickets/index.html.haml @@ -14,6 +14,7 @@ %thead %tr %th Ticket + %th Payment %th Quantity %th Price %th Total @@ -21,6 +22,7 @@ - @conference.tickets.each do |ticket| = render partial: 'ticket', f: f, locals: {ticket: ticket} %tr + %td %td %td %td.col-sm-1.col-md-1.text-center @@ -43,4 +45,4 @@ .col-md-13 %p.text-muted.text-center %small - * Buying a ticket is not mandatory. Checkout will be at the conference registration. \ No newline at end of file + * Buying a ticket is not mandatory. Checkout will be at the conference registration. From 45154a8703f5cd75072d04763de5e351122484d7 Mon Sep 17 00:00:00 2001 From: Rishabh Saxena Date: Fri, 27 May 2016 20:37:59 +0530 Subject: [PATCH 2/2] categorise purchased tickets by payment mode for attendees --- app/models/ticket_purchase.rb | 1 + .../conference_registrations/show.html.haml | 51 +++++++++++++------ 2 files changed, 36 insertions(+), 16 deletions(-) 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