Employers working - onboarding to card print
CI / scan_ruby (push) Failing after 10m41s
CI / lint (push) Failing after 7m31s
CI / test (push) Failing after 8m29s
Docker / build-and-test-image (push) Failing after 11m32s

This commit is contained in:
Jason Jordan
2026-01-15 11:37:50 -05:00
parent 0464ba8929
commit 4fac3b1036
108 changed files with 4113 additions and 431 deletions
+93 -2
View File
@@ -1,24 +1,54 @@
class EmployerSetupController < ApplicationController
def index
@employer_setups = EmployerSetupProcess.all
end
def show
end
def new
@employer_setup = EmployerSetupProcess.new
@employer_setup.plans.build
@plan_templates = IdCardBenefitsTemplate.where.not(title: "BLANK")
render 'employer_setup/employer_information'
render :new
end
def import
word_doc = params[:employer_setup_process][:import_from_word]
@plan_templates = IdCardBenefitsTemplate.where.not(title: "BLANK")
if word_doc.present? && word_doc.is_a?(ActionDispatch::Http::UploadedFile)
@employer_setup = BenefitsWordDocProcessor.new(word_doc.tempfile).call
render :edit
else
@employer_setup = EmployerSetupProcess.new
@employer_setup.plans.build
render :new
end
end
def create
employer_setup_process_params = EmployerSetupProcess.permitted_params(params)
puts "---Params---"
puts employer_setup_process_params
# post_image_processing_params = process_logos(employer_setup_process_params)
@employer_setup = EmployerSetupProcess.new(employer_setup_process_params)
if @employer_setup.save
# update_logos_with_employer_setup_information()
redirect_to @employer_setup, notice: 'Employer Setup Process initiated'
else
@plan_templates = IdCardBenefitsTemplate.where.not(title: "BLANK")
render 'employer_setup/employer_information'
render :new
end
end
def edit
@employer_setup = EmployerSetupProcess.find_by(slug: params[:id])
@plan_templates = IdCardBenefitsTemplate.where.not(title: "BLANK")
render :edit
# @resource = Resource.find(params[:id])
end
def update
@form = RegistrationForm.new(registration_params)
@@ -31,8 +61,69 @@ class EmployerSetupController < ApplicationController
render :new
end
def destroy
# @resource = Resource.find(params[:id])
# @resource.destroy
# redirect_to resources_url, notice: 'Resource was successfully destroyed.'
end
private
def process_logos(employer_setup_process_params)
@uploaded_logos = []
employer_logo = employer_setup_process_params["employer_logo"]
if employer_logo.present? && employer_logo.is_a?(ActionDispatch::Http::UploadedFile)
filename = employer_logo.original_filename
binary_data = employer_logo.read
meme_type = Marcel::MimeType.for(employer_logo)
CardLogoFile.create(
filename: filename,
image_data: binary_data,
content_type: meme_type,
logo_type: "employer"
)
@uploaded_logos.push(filename)
employer_setup_process_params["employer_logo"] = filename
end
network_logos = employer_setup_process_params["alternate_network_logos_attributes"]
if network_logos.present?
network_logos.each do |alt|
network_logo = alt.last["network_logo"]
if network_logo.present? && network_logo.is_a?(ActionDispatch::Http::UploadedFile)
filename = network_logo.original_filename
binary_data = network_logo.read
meme_type = Marcel::MimeType.for(network_logo)
CardLogoFile.create(
filename: filename,
image_data: binary_data,
content_type: meme_type,
logo_type: "network"
)
@uploaded_logos.push(filename)
end
alt.last["network_logo"] = @uploaded_logos.last
end
end
employer_setup_process_params
end
def update_logos_with_employer_setup_information()
@uploaded_logos.each do |logo|
logo_file = CardLogoFile.find_by(filename: logo)
if logo_file.present? && @employer_setup.present?
logo_file.employer_setup_process = @employer_setup
logo_file.save
end
end
end
# def general_information_params
# params.require(:employer_setup_general_information_form).permit(
# :name,