beta build
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
class Broker < ApplicationRecord
|
||||
belongs_to :carrier
|
||||
has_many :employers
|
||||
end
|
||||
@@ -0,0 +1,3 @@
|
||||
class Carrier < ApplicationRecord
|
||||
has_many :brokers
|
||||
end
|
||||
@@ -1,5 +1,6 @@
|
||||
class Employer < ApplicationRecord
|
||||
include EmployerAutomation
|
||||
belongs_to :broker, optional: true
|
||||
has_many :members, dependent: :destroy
|
||||
accepts_nested_attributes_for :members, allow_destroy: true, reject_if: :all_blank
|
||||
has_one :id_card_setup, class_name: 'IdCard::Setup', dependent: :destroy
|
||||
@@ -46,6 +47,13 @@ class Employer < ApplicationRecord
|
||||
}
|
||||
end
|
||||
|
||||
def employer_member_keys_by_plan(pb_product_key)
|
||||
{
|
||||
pl_plan_key: self.pl_plan_key,
|
||||
member_keys: self.plans.find_by(pb_product_key: pb_product_key).members.pluck(:pb_entity_key)
|
||||
}
|
||||
end
|
||||
|
||||
def name_to_logo_filename(extension)
|
||||
Employer.employer_trim_name(self.name).titleize.gsub(/[^a-zA-Z]/, '').concat('Logo').concat(extension.downcase)
|
||||
end
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
module HebWeb
|
||||
class BrokerXRef < HebWebRecord
|
||||
|
||||
self.table_name = 'BrokerXRef'
|
||||
|
||||
alias_attribute :id, :Id
|
||||
alias_attribute :pl_plan_key, :PLPlanKey
|
||||
alias_attribute :pb_entity_key, :PBEntityKey
|
||||
alias_attribute :plan_name, :PlanName
|
||||
alias_attribute :employer_pl_plan_key, :EmployerPLPlanKey
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,4 @@
|
||||
class HebWebRecord < ActiveRecord::Base
|
||||
self.abstract_class = true
|
||||
connects_to database: { writing: :heb_web, reading: :heb_web }
|
||||
end
|
||||
@@ -3,6 +3,7 @@ module IdCard
|
||||
belongs_to :setup, optional: true
|
||||
has_many :plan_benefits, dependent: :destroy
|
||||
accepts_nested_attributes_for :plan_benefits, allow_destroy: true, reject_if: :all_blank
|
||||
has_many :members, class_name: 'Member', foreign_key: :id_card_plan_id
|
||||
|
||||
validates :title, presence: true
|
||||
validates :pb_product_key, :pl_plan_key, presence: true, if: -> { setup&.active }
|
||||
|
||||
@@ -9,8 +9,9 @@ class Member < ApplicationRecord
|
||||
validates :name, :family_id, :mb_member_key, :pl_plan_key,
|
||||
:id_card_display_name, presence: true, unless: :new_record?
|
||||
validates :division, presence: true, if: -> { employer.id_card_setup.has_divisions }
|
||||
validates :coverage_class, :dental_plan_key, presence: true, if: -> { employer.id_card_setup.has_dental }
|
||||
validates :name, :mb_member_key, :pb_entity_key, uniqueness: true
|
||||
# validates :coverage_class, :dental_plan_key, presence: true, if: -> { employer.id_card_setup.has_dental }
|
||||
validates :mb_member_key, :pb_entity_key, uniqueness: true
|
||||
validates :name, uniqueness: { scope: :employer_id }
|
||||
|
||||
before_validation :format_dependents, if: :dependents_changed?
|
||||
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
class Provider < ApplicationRecord
|
||||
end
|
||||
@@ -0,0 +1,2 @@
|
||||
class ProviderGroup < ApplicationRecord
|
||||
end
|
||||
Reference in New Issue
Block a user