Class: Cats::Core::DispatchNotification

Inherits:
Noticed::Base
  • Object
show all
Defined in:
app/notifications/cats/core/dispatch_notification.rb

Instance Method Summary collapse

Instance Method Details

#messageObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'app/notifications/cats/core/dispatch_notification.rb', line 8

def message
  dispatch = params[:dispatch]
  commodity = dispatch.dispatch_plan_item.commodity
  title = "Dispatch Notification - #{commodity.name}"
  date = Date.today
  body = <<~BODY
    Commodity with the following details has been dispatched to you:
        Authorization no. = #{dispatch.dispatch_plan_item.reference_no}
        Dispatch Ref. = #{dispatch.reference_no}
        Shipping Ref. = #{commodity.shipping_reference}
        Batch No. = #{commodity.batch_no}
        Commodity = #{commodity.name}
        Allocated Quantity = #{dispatch.dispatch_plan_item.quantity}
        Quantity = #{dispatch.quantity}
        Unit = #{dispatch.unit.abbreviation}
        Truck Plate No. = #{dispatch.plate_no}
        Driver Name = #{dispatch.driver_name}
        Driver Phone = #{dispatch.driver_phone}
  BODY
  {title: title, date: date, body: body}
end