2022-10-18 17:23:18 +02:00
|
|
|
module SendOrderPdf
|
2018-12-19 22:27:47 +01:00
|
|
|
extend ActiveSupport::Concern
|
|
|
|
|
|
|
|
protected
|
|
|
|
|
|
|
|
def send_order_pdf order, document
|
|
|
|
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
|