Its been a while
This commit is contained in:
@@ -57,22 +57,24 @@ module IdCardPrinterService
|
||||
)
|
||||
|
||||
selected_attributes = employer_attributes.merge(rx_attributes).merge(provider_attributes)
|
||||
IdCard::PrintData.new(selected_attributes)
|
||||
IdCard::PrintData.create(selected_attributes)
|
||||
end
|
||||
|
||||
def create_plan_base_cards(common_fields_card)
|
||||
needed_plans_ids = @employer.members.where(pb_entity_key: @member_keys).distinct.pluck(:id_card_plan_id)
|
||||
needed_plans = @card_setup.plans.where(id: needed_plans_ids)
|
||||
needed_plans.each do |plan|
|
||||
selected_attributes = { plan_id: plan.id }
|
||||
plan.plan_benefits.each do |bene|
|
||||
selected_attributes["benefit_desc_#{bene.sequence}".to_sym] = bene.benefit_desc
|
||||
selected_attributes["benefit_#{bene.sequence}".to_sym] = bene.benefit
|
||||
end
|
||||
if needed_plans_ids.present?
|
||||
needed_plans = @card_setup.plans.where(id: needed_plans_ids)
|
||||
needed_plans.each do |plan|
|
||||
selected_attributes = { plan_id: plan.id }
|
||||
plan.plan_benefits.each do |bene|
|
||||
selected_attributes["benefit_desc_#{bene.sequence}".to_sym] = bene.benefit_desc
|
||||
selected_attributes["benefit_#{bene.sequence}".to_sym] = bene.benefit
|
||||
end
|
||||
|
||||
plan_base_card = common_fields_card.dup
|
||||
plan_base_card.assign_attributes(selected_attributes)
|
||||
plan_base_card.save
|
||||
plan_base_card = common_fields_card.dup
|
||||
plan_base_card.assign_attributes(selected_attributes)
|
||||
plan_base_card.save
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user