2018-12-19 22:27:47 +01:00
|
|
|
module Concerns::SendOrderPdf
|
|
|
|
extend ActiveSupport::Concern
|
|
|
|
|
|
|
|
protected
|
|
|
|
|
2023-05-12 13:01:12 +02:00
|
|
|
def send_order_pdf(order, document)
|
2018-12-19 22:27:47 +01:00
|
|
|
klass = case document
|
|
|
|
when 'groups' then OrderByGroups
|
|
|
|
when 'articles' then OrderByArticles
|
|
|
|
when 'fax' then OrderFax
|
|
|
|
when 'matrix' then OrderMatrix
|
2021-03-01 15:27:26 +01:00
|
|
|
end
|
2018-12-19 22:27:47 +01:00
|
|
|
pdf = klass.new order
|
|
|
|
send_data pdf.to_pdf, filename: pdf.filename, type: 'application/pdf'
|
|
|
|
end
|
|
|
|
end
|