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
+16
View File
@@ -0,0 +1,16 @@
class AlternativeNetworkLogo < ApplicationRecord
belongs_to :employer_setup_process
before_save :process_network_logo
def process_network_logo
unless self.network_logo.is_a?(String)
self.employer_setup_process.card_logo_files.new(
filename: self.network_logo.filename,
logo_type: 'network',
image: self.network_logo.data,
pl_plan_key: self.employer_setup_process.pl_plan_key || ""
)
end
end
end
+83
View File
@@ -0,0 +1,83 @@
module BrittonWeb
class SampleIdCards < BrittonWebRecord
self.table_name = 'sample_id_cards'
alias_attribute :id, :id
alias_attribute :full_name, :full_name
alias_attribute :family_id, :family_id
alias_attribute :primary_mb_member_key, :primary_mb_member_key
alias_attribute :employer_name, :employer_name
alias_attribute :pl_plan_key, :pl_plan_key -moved to esp/not used in template
alias_attribute :group_number, :group_number
alias_attribute :rx_group, :rx_group
alias_attribute :network_image, :network_image -moved to esp/not used in template
alias_attribute :medical_eff_date, :medical_eff_date
alias_attribute :provider_code, :provider_code
alias_attribute :provider_line_1, :provider_line_1
alias_attribute :provider_line_2, :provider_line_2
alias_attribute :provider_line_3, :provider_line_3
alias_attribute :provider_line_4, :provider_line_4
alias_attribute :provider_line_5, :provider_line_5
alias_attribute :provider_line_6, :provider_line_6
alias_attribute :provider_line_7, :provider_line_7
alias_attribute :provider_line_8, :provider_line_8
alias_attribute :provider_line_9, :provider_line_9
alias_attribute :provider_line_10, :provider_line_10
alias_attribute :provider_line_11, :provider_line_11
alias_attribute :mail_to, :mail_to - dont need/not used in template
alias_attribute :claim_to_1, :claim_to_1
alias_attribute :claim_to_2, :claim_to_2
alias_attribute :claim_to_3, :claim_to_3
alias_attribute :claim_to_4, :claim_to_4
alias_attribute :claim_to_5, :claim_to_5
alias_attribute :claim_to_6, :claim_to_6
alias_attribute :claim_to_7, :claim_to_7
alias_attribute :claim_to_8, :claim_to_8
alias_attribute :claim_to_9, :claim_to_9
alias_attribute :claim_to_10, :claim_to_10
alias_attribute :claim_to_11, :claim_to_11
alias_attribute :customer_service, :customer_service
alias_attribute :web_url, :web_url
alias_attribute :dependent_1, :dependent_1 - keep for now
alias_attribute :dependent_2, :dependent_2
alias_attribute :dependent_3, :dependent_3
alias_attribute :dependent_4, :dependent_4
alias_attribute :dependent_5, :dependent_5
alias_attribute :dependent_6, :dependent_6
alias_attribute :dependent_7, :dependent_7
alias_attribute :dependent_8, :dependent_8
alias_attribute :benefit_desc_1, :benefit_desc_1
alias_attribute :benefit_1, :benefit_1
alias_attribute :benefit_desc_2, :benefit_desc_2
alias_attribute :benefit_2, :benefit_2
alias_attribute :benefit_desc_3, :benefit_desc_3
alias_attribute :benefit_3, :benefit_3
alias_attribute :benefit_desc_4, :benefit_desc_4
alias_attribute :benefit_4, :benefit_4
alias_attribute :benefit_desc_5, :benefit_desc_5
alias_attribute :benefit_5, :benefit_5
alias_attribute :benefit_desc_6, :benefit_desc_6
alias_attribute :benefit_6, :benefit_6
alias_attribute :benefit_desc_7, :benefit_desc_7
alias_attribute :benefit_7, :benefit_7
alias_attribute :benefit_desc_8, :benefit_desc_8
alias_attribute :benefit_8, :benefit_8
alias_attribute :benefit_desc_9, :benefit_desc_9
alias_attribute :benefit_9, :benefit_9
alias_attribute :benefit_desc_10, :benefit_desc_10
alias_attribute :benefit_10, :benefit_10
alias_attribute :benefit_desc_11, :benefit_desc_11
alias_attribute :benefit_11, :benefit_11
alias_attribute :benefit_desc_12, :benefit_desc_12
alias_attribute :benefit_12, :benefit_12
alias_attribute :benefit_desc_13, :benefit_desc_13
alias_attribute :benefit_13, :benefit_13
alias_attribute :benefit_desc_14, :benefit_desc_14
alias_attribute :benefit_14, :benefit_14
alias_attribute :created_at, :created_at
alias_attribute :updated_at, :updated_at
end
end
+3
View File
@@ -0,0 +1,3 @@
class CardLogoFile < ApplicationRecord
belongs_to :employer_setup_process, optional: true
end
+52 -1
View File
@@ -1,3 +1,54 @@
class EmployerSetupProcess < ApplicationRecord
has_many :plans
has_many :plans, dependent: :destroy
accepts_nested_attributes_for :plans, allow_destroy: true, reject_if: :all_blank
has_many :alternative_network_logos, dependent: :destroy
accepts_nested_attributes_for :alternative_network_logos, allow_destroy: true, reject_if: :all_blank
has_many :card_logo_files
before_save :process_employer_logo
def process_employer_logo
unless self.employer_logo.is_a?(String)
self.card_logo_files.new(
filename: self.employer_logo.filename,
logo_type: 'employer',
image: self.employer_logo.data,
pl_plan_key: self.pl_plan_key || ""
)
end
end
def self.permitted_params(params)
params.require(:employer_setup_process).permit(
:employer_name,
:group_number,
:pl_plan_key,
:effective_date,
:employer_logo,
:network_provider,
plans_attributes: [
:id,
:title,
:plan_id,
:_destroy,
plan_benefits_attributes: [
:id,
:benefit_desc,
:benefit,
:sequence,
:_destroy,
]
],
alternative_network_logos_attributes: [
:id,
:network_logo,
:exception_type,
:exception_value,
:_destroy
]
)
end
end
+1 -1
View File
@@ -1,5 +1,5 @@
class IdCardBenefitsTemplate < ApplicationRecord
has_many :id_card_benefits
has_many :id_card_benefits, dependent: :destroy
end
+5 -4
View File
@@ -1,17 +1,18 @@
class Plan < ApplicationRecord
belongs_to :employer_setup_process
has_many :plan_benefits
has_many :plan_benefits, dependent: :destroy
accepts_nested_attributes_for :plan_benefits, allow_destroy: true, reject_if: :all_blank
after_create :create_default_benefits
after_initialize :create_default_benefits, if: :new_record?
private
def create_default_benefits
benefits = IdCardBenefitsTemplate.find_by(title: "BLANK").id_card_benefits.sort_by(&:sequence)
benefits.each do |ben|
plan_benefits.create(benefit_desc: ben.benefit_desc, sequence: ben.sequence)
plan_benefits.new(benefit_desc: ben.benefit_desc, sequence: ben.sequence)
end
end
end
@@ -0,0 +1,13 @@
module Vhcs
class HLEggIdCardDependent < VhcsRecord
self.table_name = 'HLEggIdCardDependent'
alias_attribute :id, :Id
alias_attribute :family_id, :FamilyId
alias_attribute :dependent_name, :DependentName
alias_attribute :sequence_number, :SequenceNumber
end
end
+48
View File
@@ -0,0 +1,48 @@
module Vhcs
class HLIDCardProvider < VhcsRecord
self.table_name = 'HLIDCardProvider'
alias_attribute :provider_code, :ProviderCode
alias_attribute :provider_line_1, :ProviderLine1
alias_attribute :provider_line_2, :ProviderLine2
alias_attribute :provider_line_3, :ProviderLine3
alias_attribute :provider_line_4, :ProviderLine4
alias_attribute :provider_line_5, :ProviderLine5
alias_attribute :mail_to, :MailTo
alias_attribute :mail_to_2, :MailTo2
alias_attribute :contact_line_1, :ContactLine1
alias_attribute :contact_line_2, :ContactLine2
alias_attribute :contact_line_3, :ContactLine3
alias_attribute :group_number, :GroupNumber
alias_attribute :claim_to_1, :ClaimTo1
alias_attribute :claim_to_2, :ClaimTo2
alias_attribute :claim_to_3, :ClaimTo3
alias_attribute :claim_to_4, :ClaimTo4
alias_attribute :claim_to_5, :ClaimTo5
alias_attribute :claim_to_6, :ClaimTo6
alias_attribute :claim_to_7, :ClaimTo7
alias_attribute :claim_to_8, :ClaimTo8
alias_attribute :claim_to_9, :ClaimTo9
alias_attribute :claim_to_10, :ClaimTo10
alias_attribute :claim_to_11, :ClaimTo11
alias_attribute :provider_line_6, :ProviderLine6
alias_attribute :provider_line_7, :ProviderLine7
alias_attribute :provider_line_8, :ProviderLine8
alias_attribute :provider_line_9, :ProviderLine9
alias_attribute :provider_line_10, :ProviderLine10
alias_attribute :provider_line_11, :ProviderLine11
alias_attribute :rx_group_id, :RXGroupId
alias_attribute :rx_contact, :RXContact
alias_attribute :provider_lookup_1, :ProviderLookup1
alias_attribute :provider_lookup_2, :ProviderLookup2
alias_attribute :precert1, :Precert1
alias_attribute :precert2, :Precert2
alias_attribute :precert3, :Precert3
alias_attribute :precert4, :Precert4
alias_attribute :precert5, :Precert5
alias_attribute :precert6, :Precert6
end
end
+25
View File
@@ -0,0 +1,25 @@
module Vhcs
class HLIDCardsEgg < VhcsRecord
self.table_name = 'HLIDCardsEgg'
alias_attribute :facility, :Facility
alias_attribute :division, :Division
alias_attribute :full_name, :FullName
alias_attribute :ssn, :SSN
alias_attribute :medical_coverage, :MedicalCoverage
alias_attribute :medical_eff_date, :MedicalEffDate
alias_attribute :medical_group_num, :MedicalGroupNum
alias_attribute :dental_coverage, :DentalCoverage
alias_attribute :dental_eff_date, :DentalEffDate
alias_attribute :dental_group_num, :DentalGroupNum
alias_attribute :card_type, :CardType
alias_attribute :group_number, :GroupNumber
alias_attribute :pb_product_key, :PBProductKey
alias_attribute :id, :Id
alias_attribute :pl_plan_key, :PLPlanKey
alias_attribute :mb_member_key, :MBMemberKey
end
end