129 lines
4.1 KiB
Ruby
129 lines
4.1 KiB
Ruby
ActiveAdmin.register JamRuby::LessonSession, :as => 'LessonSessions' do
|
|
|
|
menu :label => 'LessonSession', :parent => 'JamClass'
|
|
|
|
config.sort_order = 'created_at desc'
|
|
config.batch_actions = false
|
|
config.per_page = 100
|
|
config.paginate = true
|
|
config.filters = false
|
|
|
|
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("Missed") { |scope| scope.unscoped.missed.order('created_at desc') }
|
|
scope("Completed") { |scope| scope.unscoped.completed.order('created_at desc') }
|
|
|
|
index do
|
|
column "User Link" do |lesson_session|
|
|
lesson_booking = lesson_session.lesson_booking
|
|
span do
|
|
link_to "Web URL", "#{Rails.application.config.external_root_url}/client#/jamclass/lesson-booking/#{lesson_booking.id}"
|
|
end
|
|
end
|
|
column "Status" do |lesson_session|
|
|
link_to lesson_session.status, admin_lesson_session_path(lesson_session.id)
|
|
end
|
|
column "Start Time" do |lesson_session|
|
|
span do
|
|
if lesson_session.music_session.nil?
|
|
raise "Lessonsesison with no id #{lesson_session.id}"
|
|
else
|
|
lesson_session.music_session.pretty_scheduled_start(true)
|
|
end
|
|
end
|
|
br
|
|
span do
|
|
lesson_session.music_session.scheduled_start
|
|
end
|
|
end
|
|
column "Duration" do |lesson_session|
|
|
lesson_session.duration
|
|
end
|
|
column "Teacher" do |lesson_session|
|
|
teacher = lesson_session.teacher
|
|
span do
|
|
link_to "#{teacher.name} (#{teacher.email})", "#{Rails.application.config.external_root_url}/client#/profile/teacher/#{teacher.id}"
|
|
end
|
|
end
|
|
column "Student" do |lesson_session|
|
|
student = lesson_session.student
|
|
span do
|
|
link_to "#{student.name} (#{student.email})", "#{Rails.application.config.external_root_url}/client#/profile/#{student.id}"
|
|
end
|
|
end
|
|
end
|
|
|
|
show do
|
|
attributes_table do
|
|
row "User Link" do |lesson_session|
|
|
lesson_booking = lesson_session.lesson_booking
|
|
span do
|
|
link_to "Web URL", "#{Rails.application.config.external_root_url}/client#/jamclass/lesson-booking/#{lesson_booking.id}"
|
|
end
|
|
end
|
|
row "Status" do |lesson_session|
|
|
lesson_session.status
|
|
end
|
|
row "Start Time" do |lesson_session|
|
|
span do
|
|
lesson_session.music_session.pretty_scheduled_start(true)
|
|
end
|
|
br
|
|
span do
|
|
lesson_session.music_session.scheduled_start
|
|
end
|
|
end
|
|
row "Duration" do |lesson_session|
|
|
lesson_session.duration
|
|
end
|
|
row "Teacher" do |lesson_session|
|
|
teacher = lesson_session.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_session|
|
|
student = lesson_session.student
|
|
span do
|
|
link_to "#{student.name} (#{student.email})", "#{Rails.application.config.external_root_url}/client#/profile/#{student.id}"
|
|
end
|
|
end
|
|
row "Followup Emails Sent" do |lesson_session|
|
|
span do
|
|
lesson_session.sent_notices
|
|
end
|
|
end
|
|
row "Success" do |lesson_session|
|
|
span do
|
|
lesson_session.success
|
|
end
|
|
end
|
|
row "Billed" do |lesson_session|
|
|
span do
|
|
lesson_session.billed
|
|
end
|
|
end
|
|
row "Description" do |lesson_session|
|
|
span do
|
|
lesson_session.timed_description
|
|
end
|
|
end
|
|
row "Analysis" do |lesson_session|
|
|
if lesson_session.analysed
|
|
span style: "white-space: pre;" do
|
|
begin
|
|
JSON.pretty_generate(lesson_session.analysis_json)
|
|
rescue
|
|
"barf"
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
end
|
|
|
|
end |