mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 19:54:02 +00:00
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() {
|
||||
update_price($(this));
|
||||
});
|
||||
$(function () {
|
||||
$('[data-toggle="tooltip"]').tooltip()
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -48,6 +48,14 @@ class Ticket < ActiveRecord::Base
|
|||
result ? result : Money.new(0, 'USD')
|
||||
end
|
||||
|
||||
def tickets_sold
|
||||
ticket_purchases.sum(:quantity)
|
||||
end
|
||||
|
||||
def tickets_turnover
|
||||
tickets_sold * price
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def tickets_of_conference_have_same_currency
|
||||
|
|
|
|||
|
|
@ -10,9 +10,9 @@
|
|||
%table.table.table-hover#tickets
|
||||
%thead
|
||||
%th Title
|
||||
%th Description
|
||||
%th Price
|
||||
%th Sold
|
||||
%th Turnover
|
||||
%th Actions
|
||||
%tbody
|
||||
- @conference.tickets.each do |ticket|
|
||||
|
|
@ -20,12 +20,12 @@
|
|||
%td
|
||||
= link_to(admin_conference_ticket_path(@conference.short_title, ticket.id)) do
|
||||
= ticket.title
|
||||
%td
|
||||
= truncate(ticket.description)
|
||||
%td
|
||||
= humanized_money_with_symbol ticket.price
|
||||
%td
|
||||
= ticket.buyers.count
|
||||
= ticket.tickets_sold
|
||||
%td
|
||||
= humanized_money_with_symbol ticket.tickets_turnover
|
||||
%td
|
||||
.btn-group
|
||||
= link_to 'Edit', edit_admin_conference_ticket_path(@conference.short_title, ticket.id),
|
||||
|
|
|
|||
|
|
@ -2,10 +2,11 @@
|
|||
.col-md-12
|
||||
.page-header
|
||||
%h1
|
||||
= @ticket.title
|
||||
Ticket
|
||||
%small
|
||||
= humanized_money_with_symbol @ticket.price
|
||||
%div{"data-placement" => "left", "data-toggle" => "tooltip", :title => @ticket.description}
|
||||
= @ticket.title
|
||||
Ticket
|
||||
%small
|
||||
= humanized_money_with_symbol @ticket.price
|
||||
%p.text-muted
|
||||
People who bought this ticket
|
||||
.row
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue