pin back hamlrails

This commit is contained in:
Seth Call 2017-07-19 07:38:39 -05:00
parent f44783efdd
commit 37c7550a08
5 changed files with 86 additions and 4 deletions

View File

@ -0,0 +1,26 @@
ActiveAdmin.register_page "Monthly Roll Forward", as: "JamClass Monthly Roll Forward" do
menu :parent => 'JamClass'
content :title => "JamClass Monthly Roll Forwards" do
para do
table_for JamClassReport.roll_forward_bookings do
column "Student" do |r|
r.student.admin_name
end
column "Teacher" do |r|
r.teacher.admin_name
end
column "Booking Active?" do |r|
r.active ? 'Y' : 'N'
end
column "Booking Status" do |r|
link_to r.status, admin_lesson_booking_path(r.id)
end
end
end
end
end

View File

@ -8,11 +8,11 @@ ActiveAdmin.register JamRuby::LessonBooking, :as => 'LessonBookings' do
config.paginate = true
config.filters = false
scope("All", default: true ) { |scope| scope.unscoped.order('created_at desc') }
scope("All", default: true) { |scope| scope.unscoped.order('created_at desc') }
scope("Requested") { |scope| scope.unscoped.where(status: LessonBooking::STATUS_REQUESTED).order('created_at desc') }
scope("Approved") { |scope| scope.unscoped.approved.order('created_at desc') }
scope("Suspended" ) { |scope| scope.unscoped.suspended.order('created_at desc') }
scope("Canceled" ) { |scope| scope.unscoped.canceled.order('created_at desc') }
scope("Suspended") { |scope| scope.unscoped.suspended.order('created_at desc') }
scope("Canceled") { |scope| scope.unscoped.canceled.order('created_at desc') }
index do
column "User Link" do |lesson_booking|
@ -41,6 +41,37 @@ ActiveAdmin.register JamRuby::LessonBooking, :as => 'LessonBookings' do
end
show do
attributes_table do
row "User Link" do |lesson_booking|
span do
link_to "Web URL", "#{Rails.application.config.external_root_url}/client#/jamclass/lesson-booking/#{lesson_booking.id}"
end
end
row "Type" do |lesson_booking|
lesson_booking.display_type
end
row "Status" do |lesson_booking|
lesson_booking.status
end
row "Teacher" do |lesson_booking|
teacher = lesson_booking.teacher
span do
link_to "#{teacher.name} (#{teacher.email})", "#{Rails.application.config.external_root_url}/client#/profile/teacher/#{teacher.id}"
end
end
row "Student" do |lesson_booking|
student = lesson_booking.student
span do
link_to "#{student.name} (#{student.email})", "#{Rails.application.config.external_root_url}/client#/profile/#{student.id}"
end
end
row "Created At" do |lesson_booking|
lesson_booking.created_at
end
row "Booked Price" do |lesson_booking|
lesson_booking.booked_price
end
end
end

View File

@ -100,5 +100,9 @@ module JamRuby
end
end
def self.roll_forward_bookings
LessonBooking.where('remaining_roll_forward_amount_in_cents > 0')
end
end
end

View File

@ -77,7 +77,7 @@ gem 'carrierwave', '0.11.2' #, '0.9.0'
gem 'carrierwave_direct'
gem 'fog'
#gem 'jquery-payment-rails', github: 'sethcall/jquery-payment-rails'
gem 'haml-rails'
gem 'haml-rails', '0.9.0'
gem 'unf' #optional fog dependency
gem 'devise', '3.3.0' #3.4.0 causes uninitialized constant ActionController::Metal (NameError)
gem 'postgres-copy'

View File

@ -63,4 +63,25 @@ def amazon_gift_cards
end
def sample_amazon_gift_cards
CSV.open("test-posa-cards-amazon-test-drive-paid-4.csv", "wb") do |csv|
for i in 1..20
csv << [generate(), 'amazon-test-drive-paid-4', true, true]
end
end
CSV.open("test-posa-cards-amazon-test-drive-free-4.csv", "wb") do |csv|
for i in 1..20
csv << [generate(), 'amazon-test-drive-free-4',true, false]
end
end
CSV.open("test-posa-cards-amazon-test-drive-free-2.csv", "wb") do |csv|
for i in 1..20
csv << [generate(), 'amazon-test-drive-free-2',true, false]
end
end
end