diff --git a/app/controllers/learning_hours_controller.rb b/app/controllers/learning_hours_controller.rb index 4aeb26bff7..eb2eec77c6 100644 --- a/app/controllers/learning_hours_controller.rb +++ b/app/controllers/learning_hours_controller.rb @@ -22,7 +22,7 @@ def create respond_to do |format| if @learning_hour.save format.html { redirect_to volunteer_learning_hours_path(volunteer_id: current_user.id), notice: "New entry was successfully created." } - LearningHoursMailer.with(user: @user, casa_org: @casa_org).learning_hours_report_email.deliver_later + LearningHoursMailer.with(user: @user, casa_org: @casa_org, csv_data: csv_data).learning_hours_report_email.deliver_later else format.html { render :new, status: 404 } end diff --git a/app/mailers/learning_hours_mailer.rb b/app/mailers/learning_hours_mailer.rb index cc3fe3d011..0e0e1d9159 100644 --- a/app/mailers/learning_hours_mailer.rb +++ b/app/mailers/learning_hours_mailer.rb @@ -1,8 +1,8 @@ class LearningHoursMailer < ApplicationMailer - def learning_hours_report_email(user) + def learning_hours_report_email(user, casa_org, csv_data) @user = user - @casa_org = user.casa_org - #attachments["learning_hours_report.csv"] = attachment + @casa_org = casa_org + attachments['learning_hours_report.csv'] = csv_data mail(to: @user.email, subject: "Learning Hours Report - #{last_day_of_month.strftime('%Y-%m-%d')}") end diff --git a/app/views/learning_hours_mailer/learning_hours_report_email.html.erb b/app/views/learning_hours_mailer/learning_hours_report_email.html.erb index 1d96d547ac..59a4defd0c 100644 --- a/app/views/learning_hours_mailer/learning_hours_report_email.html.erb +++ b/app/views/learning_hours_mailer/learning_hours_report_email.html.erb @@ -6,91 +6,75 @@ Actionable emails e.g. reset password - - - - + + +
- - - - +
- - - - - - -
-
Court - Appointed Special Advocate (CASA) / <%= @casa_organization&.name %> -
-
-
- - +
+ + + - - -
+ + - - - -
- + - -
+ - - - + + + + + +
- - -

Learning hours have been added this week!

-

Please see the attached full report or export the full report at https://casa-qa.herokuapp.com/reports.

-
+
Court + Appointed Special Advocate (CASA) / <%= @casa_organization&.name %> +
+
+
+

Learning hours have been added this week!

+

Please see the attached full report or export the full report at https://casa-qa.herokuapp.com/reports.

+
+ + + + + + + +
+ +
- - - - - - - -
- -
-
-
+
+
diff --git a/lib/mailers/previews/learning_hours_mailer_preview.rb b/lib/mailers/previews/learning_hours_mailer_preview.rb index 70114c7f4b..d36b7daff0 100644 --- a/lib/mailers/previews/learning_hours_mailer_preview.rb +++ b/lib/mailers/previews/learning_hours_mailer_preview.rb @@ -6,7 +6,7 @@ def learning_hours_report_email if user.nil? DebugPreviewMailer.invalid_user("user") else - LearningHoursMailer.learning_hours_report_email(user) + LearningHoursMailer.learning_hours_report_email(user, @casa_org, @csv_data) end end end