Before a few renames

This commit is contained in:
Jason Jordan
2026-03-19 00:42:27 -04:00
parent 011ee91707
commit 3300819ed5
46 changed files with 994 additions and 467 deletions
@@ -1,17 +1,38 @@
module IdCardPrinter
class EmployerCardsGenerator
def initialize(pl_plan_key, layout, zip=false)
@pl_plan_key = pl_plan_key
def initialize(employer, layout, zip=false)
@employer = employer
@layout = layout
@zip = zip
end
def call
IdCard::PrintData.where(pl_plan_key: @pl_plan_key).destroy_all
EmployerCards::DataFormatter.new(@pl_plan_key).call
IdCard::PrintData.where(pl_plan_key: @employer.pl_plan_key).destroy_all
IdCardPrinter::EmployerDataFormatter.new(@employer).call
IdCardPrinter::PdfProcessor.new(@pl_plan_key, @layout, @zip).call
pdf_array = IdCardPrinter::PdfProcessor.new(@employer, @layout, @zip).call
group_pdfs = combine_pdfs(pdf_array)
group_pdfs
end
private
def combine_pdfs(pdf_array)
if @zip
group_cards_pdf = Zip::OutputStream.write_buffer do |zio|
pdf_array.each do |file|
zio.put_next_entry(file[:name])
zio.write(file[:data])
end
end
else
group_cards_pdf = CombinePDF.new
pdf_array.each { |pdf| group_cards_pdf << pdf }
end
group_cards_pdf
end
end
end