diff --git a/app/mailers/producer_mailer.rb b/app/mailers/producer_mailer.rb index d479a20d5a..6a8265f279 100644 --- a/app/mailers/producer_mailer.rb +++ b/app/mailers/producer_mailer.rb @@ -1,12 +1,17 @@ -require 'devise/mailers/helpers' -class ProducerMailer < ActionMailer::Base Spree::BaseMailer - include Devise::Mailers::Helpers + +class ProducerMailer < Spree::BaseMailer def order_cycle_report(producer, order_cycle) @producer = producer @coordinator = order_cycle.coordinator @order_cycle = order_cycle - subject = "[Open Food Network] Order cycle report for " + + # TODO: consider what happens if there is more than one distributor + first_producer = @order_cycle.distributors[0] + @distribution_date = @order_cycle.pickup_time_for first_producer + # puts @distribution_date + + subject = "[Open Food Network] Order cycle report for #{@distribution_date}" mail(to: @producer.email, from: from_address, subject: subject) end diff --git a/app/views/producer_mailer/order_cycle_report.html.haml b/app/views/producer_mailer/order_cycle_report.html.haml index 0f67acf075..3f19e7eb5f 100644 --- a/app/views/producer_mailer/order_cycle_report.html.haml +++ b/app/views/producer_mailer/order_cycle_report.html.haml @@ -1,7 +1,7 @@ Dear #{@producer.name}, -We now have all the consumer orders for the food drop on #{}. -Please deliver to #{coordinator.address} between 9:30am and 10:30am. If this is not convenient then please call #{@coordinator.phone}. +We now have all the consumer orders for the food drop on #{@distribution_date}. +Please deliver to #{@coordinator.address.address1}, #{@coordinator.address.city}, #{@coordinator.address.zipcode} during the regular delivery time. If this is not convenient then please call #{@coordinator.phone}. NB If you have to arrange a different delivery day and time, the school has requested that you do not come on site during drop off/pick up times (8:45-9:15 and 15:00-15:30) @@ -10,7 +10,7 @@ Orders summary Here is a summary of the orders for your products: -- @order_cycle.exchange_for_distributor.each do |exchange| +/ - @order_cycle.exchange_for_distributor.each do |exchange| Detailed orders breakdown