correcting ticket's details view and its related models.
This commit is contained in:
parent
835236ed7f
commit
99afc456cd
4 changed files with 20 additions and 8 deletions
|
|
@ -22,4 +22,7 @@ $( document ).ready(function() {
|
||||||
$('.quantity').change(function() {
|
$('.quantity').change(function() {
|
||||||
update_price($(this));
|
update_price($(this));
|
||||||
});
|
});
|
||||||
|
$(function () {
|
||||||
|
$('[data-toggle="tooltip"]').tooltip()
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,14 @@ class Ticket < ActiveRecord::Base
|
||||||
result ? result : Money.new(0, 'USD')
|
result ? result : Money.new(0, 'USD')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def tickets_sold
|
||||||
|
ticket_purchases.sum(:quantity)
|
||||||
|
end
|
||||||
|
|
||||||
|
def tickets_turnover
|
||||||
|
tickets_sold * price
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def tickets_of_conference_have_same_currency
|
def tickets_of_conference_have_same_currency
|
||||||
|
|
|
||||||
|
|
@ -10,9 +10,9 @@
|
||||||
%table.table.table-hover#tickets
|
%table.table.table-hover#tickets
|
||||||
%thead
|
%thead
|
||||||
%th Title
|
%th Title
|
||||||
%th Description
|
|
||||||
%th Price
|
%th Price
|
||||||
%th Sold
|
%th Sold
|
||||||
|
%th Turnover
|
||||||
%th Actions
|
%th Actions
|
||||||
%tbody
|
%tbody
|
||||||
- @conference.tickets.each do |ticket|
|
- @conference.tickets.each do |ticket|
|
||||||
|
|
@ -20,12 +20,12 @@
|
||||||
%td
|
%td
|
||||||
= link_to(admin_conference_ticket_path(@conference.short_title, ticket.id)) do
|
= link_to(admin_conference_ticket_path(@conference.short_title, ticket.id)) do
|
||||||
= ticket.title
|
= ticket.title
|
||||||
%td
|
|
||||||
= truncate(ticket.description)
|
|
||||||
%td
|
%td
|
||||||
= humanized_money_with_symbol ticket.price
|
= humanized_money_with_symbol ticket.price
|
||||||
%td
|
%td
|
||||||
= ticket.buyers.count
|
= ticket.tickets_sold
|
||||||
|
%td
|
||||||
|
= humanized_money_with_symbol ticket.tickets_turnover
|
||||||
%td
|
%td
|
||||||
.btn-group
|
.btn-group
|
||||||
= link_to 'Edit', edit_admin_conference_ticket_path(@conference.short_title, ticket.id),
|
= link_to 'Edit', edit_admin_conference_ticket_path(@conference.short_title, ticket.id),
|
||||||
|
|
|
||||||
|
|
@ -2,10 +2,11 @@
|
||||||
.col-md-12
|
.col-md-12
|
||||||
.page-header
|
.page-header
|
||||||
%h1
|
%h1
|
||||||
= @ticket.title
|
%div{"data-placement" => "left", "data-toggle" => "tooltip", :title => @ticket.description}
|
||||||
Ticket
|
= @ticket.title
|
||||||
%small
|
Ticket
|
||||||
= humanized_money_with_symbol @ticket.price
|
%small
|
||||||
|
= humanized_money_with_symbol @ticket.price
|
||||||
%p.text-muted
|
%p.text-muted
|
||||||
People who bought this ticket
|
People who bought this ticket
|
||||||
.row
|
.row
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue