Class: Cats::Core::DispatchAuthorizationNotification

Inherits:
Noticed::Base
  • Object
show all
Defined in:
app/notifications/cats/core/dispatch_authorization_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
29
30
31
32
# File 'app/notifications/cats/core/dispatch_authorization_notification.rb', line 8

def message
  authorization = params[:dispatch_authorization]
  dispatch = authorization.dispatch
  plan_item_ref = dispatch.dispatch_plan_item.reference_no
  plan_ref = dispatch.dispatch_plan_item.dispatch_plan.reference_no
  commodity = dispatch.dispatch_plan_item.commodity
  title = "Dispatch Authorization Notification - #{commodity.name}"
  date = Date.today

  body = <<~BODY
    Commodity with the following details is ordered to be dispatched from your store:
        Authorization no. = #{dispatch.dispatch_plan_item.reference_no}
        Dispatch Ref. = #{dispatch.reference_no}
        Dispatch Plan Ref. = #{plan_ref}
        Dispatch Plan Item Ref. = #{plan_item_ref}
        Batch No. = #{commodity.batch_no}
        Commodity = #{commodity.name}
        Quantity = #{authorization.quantity}
        Unit = #{authorization.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