osem-fcy/app/views/admin/tickets/show.html.haml
2020-06-09 02:51:05 -07:00

70 lines
2.1 KiB
Text

.row
.col-md-12
.page-header
%h1
%div{"data-placement" => "left", "data-toggle" => "tooltip", title: @ticket.description}
= @ticket.title
Ticket
%small
= humanized_money_with_symbol @ticket.price
= link_to 'Edit Ticket', edit_admin_conference_ticket_path, class: 'btn btn-primary pull-right'
- if can? :give, Ticket
.pull-right
= link_to 'Give a Ticket', '#',
data: { toggle: 'modal', target: "#modal-give-ticket-#{@ticket.id}" },
class: 'button btn btn-default btn-info'
%p.text-muted
People who bought this ticket
.row
.col-md-12
%table.datatable
%thead
%th #
%th Name
%th Quantity
%th E-Mail
%th Affiliation
%th Paid
%th Date
%tbody
- @ticket.buyers.each_with_index do |buyer, index|
- purchases = buyer.ticket_purchases.where(ticket_id: @ticket.id)
%tr
%td
= index + 1
%td
= buyer.name
%td
= purchases.sum('quantity')
%td
= buyer.email
%td
= buyer.affiliation
%td
= @ticket.tickets_paid(buyer)
%td
= purchases.first.created_at
- content_for :modals do
.modal.fade{ id: "modal-give-ticket-#{@ticket.id}" }
.modal-dialog
.modal-content
= semantic_form_for(@ticket.ticket_purchases.new,
url: give_admin_conference_ticket_path(@conference, @ticket)) do |f|
.modal-header
%button.close{ data: { dismiss: 'modal' } }
%i.fa.fa-close
%h3.modal-title
Give a
= @ticket.title
Ticket
.modal-body
= user_selector_input(:user, f, '', false)
.modal-footer
= f.action :submit, as: :button, button_html: { class: 'btn btn-primary' }
:javascript
$(document).ready(function() {
$('#ticket_purchase_user_id').selectize({})
});