Employer form mostly working with persist to db

This commit is contained in:
Jason Jordan
2025-12-10 13:22:33 -05:00
parent 78ce415b94
commit 0464ba8929
68 changed files with 3071 additions and 365 deletions
@@ -0,0 +1,28 @@
module BenefitsWordDoc
class MapEmployerLogo
def initialize(process, word_doc)
@process = process
@word_doc = word_doc
end
def call
extracted_images = []
Zip::File.open(@word_doc) do |zip_file|
zip_file.each do |entry|
if entry.name.start_with?('word/media/') && !entry.directory?
filename = @process.employer_name.titleize.gsub(/\s+/, '').concat("Logo.png")
image_data = entry.get_input_stream.read
extracted_images << { filename: filename, data: image_data }
end
end
end
if extracted_images.length > 1
employer_logo = extracted_images.last
@process.employer_logo = employer_logo[:filename]
# same file logic
end
@process.save
end
end
end