<% content_for :content_title, 'Workshop Dashboard' %> <% content_for :content_title_extra do %> <%= page_header_buttons do %> <%= link_to('Outstanding Balances', admin_workshop_user_outstanding_balances_path, title: 'Outstanding Balances', class: "btn btn-xs btn-default") if can?(:manage_events, :all) %> <%= link_to(icon_label(:new, 'New'), new_admin_workshop_path, title: 'New Workshop', class: "btn btn-xs btn-default") if can?(:manage_events, :all) %> <% end %> <% end %> <% @workshops.in_groups_of(2, false) do |workshop_row| %>
<% for workshop in workshop_row %> <% panel_class = workshop.registration_closed? ? 'panel-default' : 'panel-success' %>
<%= panel title: link_to(workshop.title, [:admin, workshop]), subtitle: present(workshop).start_end_date, class: panel_class do %> <% if can? :manage_event_finances, workshop %> <% financials = workshop.financial_details(:summary) %> <% end %> <% if can?(:manage_event_finances, workshop) || can?(:manage_event_registrations, workshop) %>
<% num_registrations = workshop.registrations.count %>
<% num = workshop.registrations.number_of(:attending) %> <%= slim_progress_bar(label: 'Attending', value: "#{num} / #{num.percent_of(num_registrations).to_s}%", color: 'success', percentage: num.percent_of(num_registrations)) %>
<% num = workshop.registrations.number_of(:accepted) %> <%= slim_progress_bar(label: 'Accepted', value: "#{num}", color: 'accepted', percentage: num.percent_of(num_registrations)) %> <% num = workshop.registrations.number_of(:paid) %>
<%= slim_progress_bar(label: 'Paid', value: "#{num}", color: 'paid', percentage: num.percent_of(num_registrations)) %>
<% num = workshop.registrations.number_of(:pending) %>
<%= slim_progress_bar(label: 'Pending', value: "#{num}", color: 'pending', percentage: num.percent_of(num_registrations)) %>
<% num = workshop.registrations.number_of(:waitlisted) %> <%= slim_progress_bar(label: 'Waitlisted', value: "#{num}", color: 'waitlisted', percentage: num.percent_of(num_registrations)) %> <% num = workshop.registrations.number_of(:reviewing) %>
<%= slim_progress_bar(label: 'Reviewing', value: "#{num}", color: 'reviewing', percentage: num.percent_of(num_registrations)) %>
<% end %> <% end %>
<% end %>
<% end %> <% unless @workshops_past.empty? %> <%= panel body: false, title: 'Past Workshops' do %> <% @workshops_past.each do |workshop| %> <% # TODO very ineffecient to do for each workshop. look at caching values %> <% financials = workshop.financial_details(:summary) if can?(:manage_event_finances, workshop) %> <% present workshop do |workshop_presenter| %> <% end %> <% end %>
Title Projected Paid Unpaid Date
<%= link_to workshop.title, [:admin, workshop] %> <%= can?(:manage_event_finances, workshop) ? financials[:summary][:total_possible].format(no_cents_if_whole: true) : 'n/a' %> <%= can?(:manage_event_finances, workshop) ? financials[:summary][:total_paid].format(no_cents_if_whole: true) : 'n/a' %> <% if can?(:manage_event_finances, workshop) %> <%= ''.html_safe if financials[:summary][:total_outstanding].positive? %> <%= financials[:summary][:total_outstanding].format(no_cents_if_whole: true) %> <%= ''.html_safe if financials[:summary][:total_outstanding].positive? %> <% else %> n/a <% end %> <%= workshop_presenter.start_end_date %>
<% end %> <% end %>