Major features finished

This commit is contained in:
Jason Jordan
2026-04-15 08:12:47 -04:00
parent 9f306d3150
commit 247a075c9c
112 changed files with 3700 additions and 379 deletions
+39
View File
@@ -40,6 +40,45 @@ module IdCard
self.field_exceptions.present?
end
def field_exceptions_card_attributes_by_member_id(member_array = nil)
unless member_array.present?
member_array = self.employer.members.pluck(:pb_entity_key)
end
card_fes = self.field_exceptions.includes(:field_exception_items).in_order_of(:exception_type, IdCard::FieldException::VALID_TYPES)
# fe_by_value = card_fes.in_order_of(:exception_type, IdCard::FieldException::VALID_TYPES).group_by(&:exception_type)
# .transform_values { |fes| fes.map { |fe| [fe.id, fe.exception_values] }.to_h }
# .compact_blank
# field_exception_types = card_fes.pluck(:exception_type).uniq
# if field_exception_types.include?("family_id")
# members = Member.where(pb_entity_key: member_array)
# end
# if field_exception_types.intersect?(["state", "zipcode"])
# member_addresses = Vhcs::PbEntityAddress.where(pb_entity_key: member_array)
# end
card_exceptions_map = {}
card_fes.each do |fe|
if fe.exception_type == "family_id"
matches = Member.where(pb_entity_key: member_array, family_id: fe.exception_values).pluck(:pb_entity_key)
elsif fe.exception_type == "zipcode"
matches = Vhcs::PbEntityAddress.where(pb_entity_key: member_array, zip: fe.exception_values).pluck(:pb_entity_key)
elsif fe.exception_type == "state"
matches = Vhcs::PbEntityAddress.where(pb_entity_key: member_array, state: fe.exception_values).pluck(:pb_entity_key)
end
if matches.present?
card_exceptions_map[fe.id] = fe.to_card_attrs
matches.each do |match|
unless card_exceptions_map[match].present?
card_exceptions_map[match] = fe.id
end
end
end
end
card_exceptions_map
end
def self.permitted_params(params)
params.require(:id_card_setup).permit(
:print_name,