DB restructure, print page

This commit is contained in:
Jason Jordan
2026-03-13 08:47:13 -04:00
parent 6a068243f4
commit 8c885b3e76
73 changed files with 1362 additions and 325 deletions
@@ -19,10 +19,9 @@ module BenefitsWordDoc
filename = @employer.name_to_logo_filename(file_extension)
logo = CardLogoFile.find_or_create_by(filename: filename) do |clf|
logo = IdCard::EmployerLogo.find_or_create_by(filename: filename) do |clf|
clf.image_data = image_binary
clf.content_type = meme_type
clf.logo_type = "employer"
end
# new_logo = CardLogoFile.create!(
@@ -32,16 +31,16 @@ module BenefitsWordDoc
# logo_type: "employer"
# )
image_io = StringIO.new(image_binary)
width, height = FastImage.size(image_io)
image_ratio = width.to_f / height
if (0.8..1.2).cover?(image_ratio)
@employer.single_card_template = "FairosRxIDCard-Half"
else
@employer.single_card_template = "FairosRxIDCard"
end
# image_io = StringIO.new(image_binary)
# width, height = FastImage.size(image_io)
# image_ratio = width.to_f / height
# if (0.8..1.2).cover?(image_ratio)
# @employer.single_card_template = "FairosRxIDCard-Half"
# else
# @employer.single_card_template = "FairosRxIDCard"
# end
@employer.employer_logo_filename = logo.filename
@employer.id_card_configuration.employer_logo = logo
end
end
@employer
@@ -7,19 +7,29 @@ module BenefitsWordDoc
end
def call
network_matches = []
@word_doc_section.each do |line|
if network_matches.exclude?("Cigna") && line.match?(/cigna/i)
network_matches.push("Cigna")
elsif network_matches.exclude?("Medcost") && line.match?(/medcost/i)
network_matches.push("Medcost")
# network = @word_doc_section.each do |line|
# if line.match?(/cigna/i)
# return "Cigna"
# elsif line.match?(/medcost/i)
# return "Medcost"
# end
# end
network = @word_doc_section.find do |line|
if line.match?(/cigna/i)
break "Cigna"
elsif line.match?(/medcost/i)
break "Medcost"
end
end
if network_matches.length == 1
network_provider = network_matches.first
@employer.network_provider = network_provider
@employer.default_network_logo = "#{network_provider}Logo.png"
# yellow_fruit_names_filtered = @word_doc_section.filter_map do |line|
# item[:name] if item[:color] == 'yellow'
# end
if network
@employer.id_card_configuration.network_provider = network
@employer.id_card_configuration.network_logo = IdCard::NetworkLogo
provider_code = network_provider == "Cigna" ? "5" : "2"
@employer.card_provider = CardProvider.find_by(provider_code: provider_code)
@employer.card_rx = CardRx.find_by(web_url: "www.FairosRx.com")
@@ -0,0 +1,13 @@
module EmployerCards
class QueueCounter
def initialize()
@employer_pl_plan_keys = IdCard::Configuration.active.pluck(:pl_plan_key).join(',')
end
def call
CallStoredProc.new('HLGetQueuedIdCardsTPANewCount', { PLPlanKeys: @employer_pl_plan_keys }).call.to_ary
end
end
end
+13 -7
View File
@@ -1,8 +1,14 @@
class ImageProcessor
ALLOWED_LOGO_TYPES = ['Network', 'Employer'].freeze
def initialize(image_path, new_filename = nil)
def initialize(image_path, logo_type, new_filename = nil)
@image_path = image_path
@logo_type = logo_type.capitalize
@new_filename = new_filename
unless ALLOWED_LOGO_TYPES.include?(@logo_type)
raise ArgumentError, "Invalid logo type: #{@logo_type}. Must be one of: #{ALLOWED_LOGO_TYPES.join(', ')}"
end
end
def call
@@ -17,11 +23,11 @@ class ImageProcessor
# binary_data = File.open(@image_path, 'rb').read
meme_type = Marcel::MimeType.for Pathname.new(@image_path)
CardLogoFile.create(
filename: filename,
image_data: binary_data,
content_type: meme_type,
logo_type: "employer"
)
logo_model = "IdCard::#{@logo_type}Logo".constantize
logo_model.find_or_create_by(filename: filename) do |logo|
logo.image_data = binary_data
logo.content_type = meme_type
end
end
end
+3 -3
View File
@@ -32,7 +32,7 @@ module SampleCard
def set_plan_fields
plans_sample_cards = []
@employer.plans.each do |plan|
@employer.id_card_configuration.plans.each do |plan|
plan_sample_card = @sample_card.dup
plan_name = plan.title.split(/(?<=\d[kK])/).first
plan_sample_card.family_id = plan_name
@@ -56,7 +56,7 @@ module SampleCard
end
def set_network_fields
selected_attributes = @employer.card_provider.attributes.with_indifferent_access.slice(
selected_attributes = @employer.id_card_configuration.provider_section.attributes.with_indifferent_access.slice(
:provider_line_1, :provider_line_2, :provider_line_3, :provider_line_4, :provider_line_5, :provider_line_6,
:provider_line_7, :provider_line_8, :provider_line_9, :provider_line_10, :provider_line_11, :provider_line_12,
:claim_to_1, :claim_to_2, :claim_to_3, :claim_to_4, :claim_to_5, :claim_to_6,
@@ -71,7 +71,7 @@ module SampleCard
def set_rx_fields
# fairos_information = Vhcs::HlrxCrosRef.where(pl_plan_key: 52).first
selected_attributes = @employer.card_rx.attributes.with_indifferent_access.slice(
selected_attributes = @employer.id_card_configuration.rx_section.attributes.with_indifferent_access.slice(
:customer_service,
:web_url
)