Ticket Purchase Index Page

List all the unpaid ticket purchases of the user for that conference and allow user to pay for them.
This commit is contained in:
siddhantbajaj 2017-06-26 06:07:52 +05:30
parent 2cc97a92f5
commit a327d2cbd2
5 changed files with 43 additions and 1 deletions

View file

@ -6,6 +6,7 @@ class PhysicalTicketController < ApplicationController
def index
@physical_tickets = current_user.physical_tickets.by_conference(@conference)
@unpaid_ticket_purchases = current_user.ticket_purchases.by_conference(@conference).unpaid
end
def show; end

View file

@ -23,6 +23,10 @@ class TicketPurchasesController < ApplicationController
end
end
def index
@unpaid_ticket_purchases = current_user.ticket_purchases.by_conference(@conference).unpaid
end
private
def ticket_purchase_params

View file

@ -33,3 +33,10 @@
class: 'button btn btn-default btn-info'
- else
%h5 No Tickets found!
.row
.col-md-12
- if @unpaid_ticket_purchases.any?
.h3
You have unpaid tickets!
%small
= link_to "Pay them here", conference_ticket_purchases_path

View file

@ -0,0 +1,30 @@
.container
.row
.col-md-12.page-header
%h2
Ticket Purchases
.text-muted
Your unpaid ticket purchases for the conference
.col-md-12
- if @unpaid_ticket_purchases.present?
%table.table.table-bordered.table-striped.table-hover#roles
%thead
%th ID
%th Type
%th Quantity
%th Date
%th Actions
%tbody
- @unpaid_ticket_purchases.each do |ticket_purchase|
%tr
%td= ticket_purchase.id
%td= ticket_purchase.ticket.title
%td= ticket_purchase.quantity
%td= ticket_purchase.created_at.strftime('%B %d, %Y')
%td
.btn-group
= link_to 'Pay', new_conference_payment_path,
class: 'btn btn-primary'
- else
%h5 You don't have any unpaid ticket purchase!

View file

@ -125,7 +125,7 @@ Osem::Application.routes.draw do
# TODO: change conference_registrations to singular resource
resource :conference_registration, path: 'register'
resources :tickets, only: [:index]
resources :ticket_purchases, only: [:create, :destroy]
resources :ticket_purchases, only: [:create, :destroy, :index]
resources :payments, only: [:index, :new, :create]
resources :physical_ticket, only: [:index, :show]
resource :subscriptions, only: [:create, :destroy]