Browse Source

Some additions to registrations page

development
Godwin 10 years ago
parent
commit
380d38d80e
  1. 49
      app/views/conferences/registrations.html.haml

49
app/views/conferences/registrations.html.haml

@ -4,7 +4,7 @@
- title @conference.title - title @conference.title
- description "#{@conference.title} conference in #{location_name} for DIY bicycle collectives, co-ops, and advocacy groups" - description "#{@conference.title} conference in #{location_name} for DIY bicycle collectives, co-ops, and advocacy groups"
= render 'header' = render 'header'
- stats = {confirmed: 0, completed: 0, total: 0, paid: 0, collected: 0} - stats = {confirmed: 0, completed: 0, total: 0, paid: 0, collected: 0, housing_total: 0, housing_beds: 0, housing_couches: 0, housing_campers: 0, bikes: 0, small_bikes: 0, large_bikes: 0}
%article.row %article.row
.columns.large-10 .columns.large-10
%h2=_'conference.registrations.title','Registrations' %h2=_'conference.registrations.title','Registrations'
@ -17,6 +17,8 @@
%th='Confirmed?' %th='Confirmed?'
%th='Completed?' %th='Completed?'
%th='Paid?' %th='Paid?'
%th='Housing'
%th='Bike'
- @registrations.each do |registration| - @registrations.each do |registration|
%tr %tr
- data = YAML.load(registration.data) - data = YAML.load(registration.data)
@ -26,25 +28,43 @@
- stats[:completed] += (registration.completed ? 1 : 0) - stats[:completed] += (registration.completed ? 1 : 0)
- stats[:paid] += (registration.registration_fees_paid ? 1 : 0) - stats[:paid] += (registration.registration_fees_paid ? 1 : 0)
- stats[:collected] += (registration.registration_fees_paid || 0) - stats[:collected] += (registration.registration_fees_paid || 0)
%td.user{rowspan: (user.present? ? 2 : nil), id: user ? "user-#{user.id}" : nil}=registration.email - stats[:housing_total] += (data[:questions][:housing] == 'none' ? 0 : 1)
- stats[:housing_beds] += (data[:questions][:housing] == 'bed' ? 1 : 0)
- stats[:housing_couches] += (data[:questions][:housing] == 'couch' ? 1 : 0)
- stats[:housing_campers] += (data[:questions][:housing] == 'camp' ? 1 : 0)
- stats[:bikes] += (data[:questions][:housing] == 'no' ? 0 : 1)
- stats[:small_bikes] += (data[:questions][:housing] == 'small' ? 1 : 0)
- stats[:large_bikes] += (data[:questions][:housing] == 'large' ? 1 : 0)
- rows = 1 + (user.present? ? 1 : 0) + (data[:questions][:housing_extra].present? ? 1 :0) + (data[:questions][:other].present? ? 1 :0)
%td.user{rowspan: (rows > 1 ? rows : nil), id: user ? "user-#{user.id}" : nil}=registration.email
%td=data[:user][:firstname] %td=data[:user][:firstname]
%td=data[:user][:lastname] %td=data[:user][:lastname]
%td=data[:user][:username] %td=data[:user][:username]
%td=registration.is_confirmed ? 'Yes' : 'No' %td=registration.is_confirmed ? 'Yes' : 'No'
%td=registration.completed ? 'Yes' : 'No' %td=registration.completed ? 'Yes' : 'No'
%td=registration.registration_fees_paid.nil? ? 'No' : 'Yes' %td=registration.registration_fees_paid.nil? ? 'No' : 'Yes'
%td=data[:questions][:housing]
%td=data[:questions][:loaner_bike]
- if user.present? - if user.present?
%tr %tr
%th='Organizations' %th='Organizations'
%td{colspan: 2} %td{colspan: 3}
- UserOrganizationRelationship.where(:user_id => user.id).each do |rel| - UserOrganizationRelationship.where(:user_id => user.id).each do |rel|
- org = Organization.find(rel.organization_id) - org = Organization.find(rel.organization_id)
- location_name = "#{org.locations[0].city}, #{org.locations[0].territory}" - location_name = "#{org.locations[0].city}, #{org.locations[0].territory}"
= link_to "#{org.name} (#{location_name})", org = link_to "#{org.name} (#{location_name})", org
%th='Workshops' %th='Workshops'
%td{colspan: 2} %td{colspan: 3}
- Workshop.where('workshop_facilitators.user_id' => user.id, :conference_id => @conference.id).joins(:workshop_facilitators).each do | workshop | - Workshop.where('workshop_facilitators.user_id' => user.id, :conference_id => @conference.id).joins(:workshop_facilitators).each do | workshop |
%a{href: "#workshop-#{workshop.slug}"}= workshop.title %a{href: "#workshop-#{workshop.slug}"}= workshop.title
- if data[:questions][:housing_extra].present?
%tr
%th='Housing Notes'
%td=data[:questions][:housing_extra]
- if data[:questions][:other].present?
%tr
%th='Other Notes'
%td=data[:questions][:other]
%h3=_'conference.registrations.workshops.title','Workshops' %h3=_'conference.registrations.workshops.title','Workshops'
%ul %ul
@ -79,3 +99,24 @@
%tr %tr
%th='Fees Collected:' %th='Fees Collected:'
%td=number_to_currency(stats[:collected], :unit => '$') %td=number_to_currency(stats[:collected], :unit => '$')
%tr
%th='Housing Total:'
%td=stats[:housing_total]
%tr
%th='Beds:'
%td=stats[:housing_beds]
%tr
%th='Couch / Floorspace:'
%td=stats[:housing_couches]
%tr
%th='Campers:'
%td=stats[:housing_campers]
%tr
%th='Bikes Required:'
%td=stats[:bikes]
%tr
%th='Small Bikes:'
%td=stats[:small_bikes]
%tr
%th='Large Bikes:'
%td=stats[:large_bikes]

Loading…
Cancel
Save