Merge pull request #1559 from siddhantbajaj/purchase-index
[WIP] Ticket Purchase Index Page
This commit is contained in:
commit
e25de318bd
5 changed files with 43 additions and 1 deletions
|
|
@ -6,6 +6,7 @@ class PhysicalTicketController < ApplicationController
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@physical_tickets = current_user.physical_tickets.by_conference(@conference)
|
@physical_tickets = current_user.physical_tickets.by_conference(@conference)
|
||||||
|
@unpaid_ticket_purchases = current_user.ticket_purchases.by_conference(@conference).unpaid
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,10 @@ class TicketPurchasesController < ApplicationController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def index
|
||||||
|
@unpaid_ticket_purchases = current_user.ticket_purchases.by_conference(@conference).unpaid
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def ticket_purchase_params
|
def ticket_purchase_params
|
||||||
|
|
|
||||||
|
|
@ -33,3 +33,10 @@
|
||||||
class: 'button btn btn-default btn-info'
|
class: 'button btn btn-default btn-info'
|
||||||
- else
|
- else
|
||||||
%h5 No Tickets found!
|
%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
|
||||||
|
|
|
||||||
30
app/views/ticket_purchases/index.html.haml
Normal file
30
app/views/ticket_purchases/index.html.haml
Normal 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!
|
||||||
|
|
@ -125,7 +125,7 @@ Osem::Application.routes.draw do
|
||||||
# TODO: change conference_registrations to singular resource
|
# TODO: change conference_registrations to singular resource
|
||||||
resource :conference_registration, path: 'register'
|
resource :conference_registration, path: 'register'
|
||||||
resources :tickets, only: [:index]
|
resources :tickets, only: [:index]
|
||||||
resources :ticket_purchases, only: [:create, :destroy]
|
resources :ticket_purchases, only: [:create, :destroy, :index]
|
||||||
resources :payments, only: [:index, :new, :create]
|
resources :payments, only: [:index, :new, :create]
|
||||||
resources :physical_ticket, only: [:index, :show]
|
resources :physical_ticket, only: [:index, :show]
|
||||||
resource :subscriptions, only: [:create, :destroy]
|
resource :subscriptions, only: [:create, :destroy]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue