diff --git a/app/controllers/employers_controller.rb b/app/controllers/employers_controller.rb index 34b18ab..8e43398 100644 --- a/app/controllers/employers_controller.rb +++ b/app/controllers/employers_controller.rb @@ -66,16 +66,19 @@ class EmployersController < ApplicationController # redirect_to resources_url, notice: 'Resource was successfully destroyed.' end + # API Methods def import word_doc = params[:employer][:import_from_word] if word_doc.present? && word_doc.is_a?(ActionDispatch::Http::UploadedFile) @employer = BenefitsWordDocProcessor.new(word_doc.tempfile).call + @employer.save + redirect_to employer_path(@employer.slug), notice: 'Employer Imported' else @employer = Employer.new + render :new end - render :new end private diff --git a/app/controllers/id_card/configuration_controller.rb b/app/controllers/id_card/configuration_controller.rb index 3337061..fe02d6b 100644 --- a/app/controllers/id_card/configuration_controller.rb +++ b/app/controllers/id_card/configuration_controller.rb @@ -6,20 +6,20 @@ module IdCard def edit @employer = Employer.find_by(slug: params[:employer_id]) if @employer.id_card_enabled? - @setup = @employer.id_card_configuration + @configuration = @employer.id_card_configuration else - @setup = @employer.create_id_card_configuration + @configuration = @employer.create_id_card_configuration end render :edit end def update setup_params = IdCard::Configuration.permitted_params(params) - @setup = IdCard::Configuration.find(params[:id]) + @configuration = IdCard::Configuration.find(params[:id]) - if @setup.update(setup_params) + if @configuration.update(setup_params) puts "sucess" - redirect_to employer_path(@setup.employer.slug), notice: 'ID Card Configuration was successfully updated.' + redirect_to employer_path(@configuration.employer.slug), notice: 'ID Card Configuration was successfully updated.' else puts "fail" render :edit, status: :unprocessable_entity @@ -30,8 +30,8 @@ module IdCard def general provider_defaults = IdCard::ProviderSection.defaults @provider_options = provider_defaults.map { |p| ["Default #{p.title}", p.id] }.concat(provider_defaults.map { |p| ["New #{p.title}", "new|#{p.id}"] }) - if @setup.provider_section_id.present? && provider_defaults.map(&:id).exclude?(@setup.provider_section_id) - @provider_options.insert(0, ["#{@employer.name} Custom", @setup.provider_section_id]) + if @configuration.provider_section_id.present? && provider_defaults.map(&:id).exclude?(@configuration.provider_section_id) + @provider_options.insert(0, ["#{@employer.name} Custom", @configuration.provider_section_id]) end @rx_options = IdCard::RxSection.all @fairos_rx_id = IdCard::RxSection.find_by(title: "FairosRx").id @@ -45,7 +45,7 @@ module IdCard params[:id_card_configuration]["provider_section_id"] = new_provider_section.id end general_params = IdCard::Configuration.permitted_params(params) - if @setup.update(general_params) + if @configuration.update(general_params) puts "sucess" redirect_to employer_path(@employer.slug), notice: 'ID Card Configuration was successfully updated.' else @@ -61,9 +61,9 @@ module IdCard def update_plans plans_params = IdCard::Plan.permitted_params(params) - if @setup.update(plans_params) + if @configuration.update(plans_params) puts "sucess" - redirect_to employer_path(@setup.employer.slug), notice: 'ID Card Plans successfully updated.' + redirect_to employer_path(@configuration.employer.slug), notice: 'ID Card Plans successfully updated.' else puts "fail" render :plans, status: :unprocessable_entity @@ -77,9 +77,9 @@ module IdCard def update_field_exceptions field_exceptions_params = IdCard::FieldException.permitted_params(params) - if @setup.update(field_exceptions_params) + if @configuration.update(field_exceptions_params) puts "sucess" - redirect_to employer_path(@setup.employer.slug), notice: 'ID Card Exceptions successfully updated.' + redirect_to employer_path(@configuration.employer.slug), notice: 'ID Card Exceptions successfully updated.' else puts "fail" render :field_exceptions, status: :unprocessable_entity @@ -100,9 +100,9 @@ module IdCard def set_employer_and_setup @employer = Employer.find_by(slug: params[:employer_id]) if @employer.id_card_configuration.present? - @setup = @employer.id_card_configuration + @configuration = @employer.id_card_configuration else - @setup = @employer.create_id_card_configuration + @configuration = @employer.create_id_card_configuration end end diff --git a/app/controllers/id_card/print_controller.rb b/app/controllers/id_card/print_controller.rb new file mode 100644 index 0000000..93819e1 --- /dev/null +++ b/app/controllers/id_card/print_controller.rb @@ -0,0 +1,110 @@ +module IdCard + class PrintController < ApplicationController + + # View Methods + def index + @employer_configs = IdCard::Configuration.active.to_a + @queue_counts = EmployerCards::GetQueuedCounts.new().call + add_queued_count_to_card_configuration + @queued = @employer_configs.select { |config| config.queued_card_count > 0 }.sort_by { |config| config.pl_plan_key.to_i } + @not_queued = @employer_configs.select { |config| config.queued_card_count == 0 }.sort_by { |config| config.pl_plan_key.to_i } + render :index + end + + # API Methods + + def print_all_queued + @queue_members = EmployerCards::GetQueuedCards.new().call + cards_pdf = IdCardPrinter::QueuedCardsGenerator.new(@queue_members).call + + if cards_pdf.is_a?(CombinePDF::PDF) + send_data cards_pdf.to_pdf, + filename: "queued_cards_#{Date.today}.pdf", + type: "application/pdf", + disposition: 'attachment' + else + cards_pdf.rewind + send_data cards_pdf.read, + filename: "queued_cards_#{Date.today}.zip", + type: 'application/zip', + disposition: 'attachment' + end + + end + + def print_queued_by_employer + pl_plan_key = params[:id].to_s + @employer = Employer.find_by(pl_plan_key: pl_plan_key) + @queue_members = EmployerCards::GetQueuedCards.new(pl_plan_key).call + cards_pdf = IdCardPrinter::QueuedCardsGenerator.new(@queue_members).call + + send_data cards_pdf.to_pdf, + filename: "#{@employer.name.parameterize(separator: "_")}_queued_cards_#{Date.today}.pdf", + type: "application/pdf", + disposition: 'attachment' + + end + + def generate_sample + pl_plan_key = params[:id].to_s + @employer = Employer.find_by(pl_plan_key: pl_plan_key) + sample_cards_pdf = IdCardPrinter::SampleCardsGenerator.new(@employer).call + + send_data sample_cards_pdf.to_pdf, + filename: "#{@employer.name.parameterize(separator: "_")}_sample_cards_#{Date.today}.pdf", + type: "application/pdf", + disposition: 'attachment' + + end + + def generate_print + pl_plan_key = params[:id].to_s + @employer = Employer.find_by(pl_plan_key: pl_plan_key) + cards_pdf = IdCardPrinter::EmployerCardsGenerator.new(@employer, "PrintCard").call + + send_data cards_pdf.to_pdf, + filename: "#{@employer.name.parameterize(separator: "_")}_print_cards_#{Date.today}.pdf", + type: "application/pdf", + disposition: 'attachment' + + end + + def generate_mobile_display + pl_plan_key = params[:id].to_s + @employer = Employer.find_by(pl_plan_key: pl_plan_key) + cards_pdf = IdCardPrinter::EmployerCardsGenerator.new(@employer, "MobileDisplayCard").call + + send_data cards_pdf.to_pdf, + filename: "#{@employer.name.parameterize(separator: "_")}_mobile_display_cards_#{Date.today}.pdf", + type: "application/pdf", + disposition: 'attachment' + + end + + def generate_full_page + pl_plan_key = params[:id].to_s + @employer = Employer.find_by(pl_plan_key: pl_plan_key) + cards_pdf = IdCardPrinter::EmployerCardsGenerator.new(@employer, "FullPageCard", true).call + + cards_pdf.rewind + send_data cards_pdf.sysread, + filename: "#{@employer.name.parameterize(separator: "_")}_full_page_cards_#{Date.today}.zip", + type: 'application/zip', + disposition: 'attachment' + + end + + private + + + def add_queued_count_to_card_configuration + @queue_counts.each do |qc| + match = @employer_configs.find { |config| config.pl_plan_key == qc["PLPlanKey"] } + if match.present? + match.queued_card_count = qc["QueuedCardsCount"] + end + end + end + + end +end \ No newline at end of file diff --git a/app/controllers/id_card/print_data_controller.rb b/app/controllers/id_card/print_data_controller.rb new file mode 100644 index 0000000..3f236ec --- /dev/null +++ b/app/controllers/id_card/print_data_controller.rb @@ -0,0 +1,49 @@ +module IdCard + class PrintDataController < ApplicationController + + def generate_sample + @employer = Employer.find_by(slug: params[:employer_slug]) + sample_cards_pdf = IdCardPrinter::SampleCardsGenerator.new(@employer).call + + send_data sample_cards_pdf.to_pdf, + filename: "#{@employer.name.parameterize(separator: "_")}_sample_cards_#{Date.today}.pdf", + type: "application/pdf", + disposition: 'attachment' + + end + + def generate_print + @employer = Employer.find_by(slug: params[:employer_slug]) + cards_pdf = IdCardPrinter::EmployerCardsGenerator.new(@employer, "PrintCard").call + + send_data cards_pdf.to_pdf, + filename: "#{@employer.name.parameterize(separator: "_")}_print_cards_#{Date.today}.pdf", + type: "application/pdf", + disposition: 'attachment' + + end + + def generate_mobile_display + @employer = Employer.find_by(slug: params[:employer_slug]) + cards_pdf = IdCardPrinter::EmployerCardsGenerator.new(@employer, "MobileDisplayCard").call + + send_data cards_pdf.to_pdf, + filename: "#{@employer.name.parameterize(separator: "_")}_mobile_display_cards_#{Date.today}.pdf", + type: "application/pdf", + disposition: 'attachment' + + end + + def generate_full_page + @employer = Employer.find_by(slug: params[:employer_slug]) + cards_pdf = IdCardPrinter::EmployerCardsGenerator.new(@employer, "FullPageCard", true).call + + cards_pdf.rewind + send_data cards_pdf.sysread, + filename: "#{@employer.name.parameterize(separator: "_")}_full_page_cards_#{Date.today}.zip", + type: 'application/zip', + disposition: 'attachment' + + end + end +end \ No newline at end of file diff --git a/app/controllers/id_card/printer_controller.rb b/app/controllers/id_card/printer_controller.rb deleted file mode 100644 index 51d7692..0000000 --- a/app/controllers/id_card/printer_controller.rb +++ /dev/null @@ -1,32 +0,0 @@ -module IdCard - class PrinterController < ApplicationController - - # View Methods - def index - @employer_configurations = IdCard::Configuration.active.to_a.sort_by { |config| config.pl_plan_key.to_i } - add_queued_count_to_card_configuration - render :index - end - - # API Methods - - def print_queued - @queue_counts = EmployerCards::GetQueuedCards.new().call - - end - - private - - - def add_queued_count_to_card_configuration - @queue_counts = EmployerCards::GetQueuedCounts.new().call - @queue_counts.each do |qc| - match = @employer_configurations.find { |configuration| configuration.pl_plan_key == qc["PLPlanKey"] } - if match.present? - match.queued_card_count = qc["QueuedCardsCount"] - end - end - end - - end -end \ No newline at end of file diff --git a/app/controllers/sample_id_cards_controller.rb b/app/controllers/sample_id_cards_controller.rb deleted file mode 100644 index caa8911..0000000 --- a/app/controllers/sample_id_cards_controller.rb +++ /dev/null @@ -1,48 +0,0 @@ -class SampleIdCardsController < ApplicationController - - - def generate_sample - @employer = Employer.find_by(slug: params[:employer_slug]) - sample_cards_pdf = SampleCardGenerator.new(@employer).call - - send_data sample_cards_pdf.to_pdf, - filename: "#{@employer.name.parameterize(separator: "_")}_sample_cards_#{Date.today}.pdf", - type: "application/pdf", - disposition: 'attachment' - - end - - def generate_print - @employer = Employer.find_by(slug: params[:employer_slug]) - sample_cards_pdf = EmployerCardsGenerator.new(@employer, "PrintCard").call - - send_data sample_cards_pdf.to_pdf, - filename: "#{@employer.name.parameterize(separator: "_")}_print_cards_#{Date.today}.pdf", - type: "application/pdf", - disposition: 'attachment' - - end - - def generate_mobile_display - @employer = Employer.find_by(slug: params[:employer_slug]) - sample_cards_pdf = EmployerCardsGenerator.new(@employer, "MobileDisplayCard").call - - send_data sample_cards_pdf.to_pdf, - filename: "#{@employer.name.parameterize(separator: "_")}_mobile_display_cards_#{Date.today}.pdf", - type: "application/pdf", - disposition: 'attachment' - - end - - def generate_full_page - @employer = Employer.find_by(slug: params[:employer_slug]) - sample_cards_pdf = EmployerCardsGenerator.new(@employer, "FullPageCard").call - - sample_cards_pdf.rewind - send_data sample_cards_pdf.sysread, - filename: "#{@employer.name.parameterize(separator: "_")}_full_page_cards_#{Date.today}.zip", - type: 'application/zip', - disposition: 'attachment' - - end -end \ No newline at end of file diff --git a/app/javascript/controllers/link_updater_controller.js b/app/javascript/controllers/link_updater_controller.js new file mode 100644 index 0000000..3009f15 --- /dev/null +++ b/app/javascript/controllers/link_updater_controller.js @@ -0,0 +1,16 @@ +import { Controller } from "@hotwired/stimulus" + +export default class extends Controller { + static targets = [ "selector", "link" ] + static values = { urlTemplate: String } // Pass template like "/users/:id/edit" + + update() { + console.log("## ## %%") + const selectedId = this.selectorTarget.value + // Replace placeholder with selected ID + const newUrl = this.urlTemplateValue.replace(":id", selectedId) + + // Update the link href + this.linkTarget.href = newUrl + } +} \ No newline at end of file diff --git a/app/models/concerns/employer_automation.rb b/app/models/concerns/employer_automation.rb new file mode 100644 index 0000000..d113441 --- /dev/null +++ b/app/models/concerns/employer_automation.rb @@ -0,0 +1,31 @@ +module EmployerAutomation + extend ActiveSupport::Concern + +# included do +# # Code in this block becomes instance methods or class macros (like scopes, validations, associations) in the including class. +# scope :visible, -> { where(visible: true) } +# scope :invisible, -> { where(visible: false) } +# validates :status, inclusion: { in: %w(visible invisible), message: "%{value} is not a valid status" } +# end + +# class_methods do +# # Methods in this block become class methods of the including class. +# def count_all_visible +# visible.count +# end +# end + + # Any other methods defined here become instance methods automatically. + def up_to_date? + self.pl_plan_key.present? && + self.company_pb_entity_key.present? && + self.plan_id.present? && + self.group_number.present? && + self.effect_date.present? + end + + def sync_with_vhcs + sql_query = "SELECT PLPlanKey, PlanId, ShortDesc FROM PLPlanHeader WHERE ActiveInactive = 'Active' And PLPlanKey = 57" + plan_header = VhcsRecord.connection.select_all(sql_query).first + end +end \ No newline at end of file diff --git a/app/models/employer.rb b/app/models/employer.rb index 3f6ec6f..45958bf 100644 --- a/app/models/employer.rb +++ b/app/models/employer.rb @@ -46,14 +46,15 @@ class Employer < ApplicationRecord false end - # def name_to_logo_filename(extension) - # self.employer_trim_name(self.name).titleize.gsub(/\s+/, '').concat('Logo').concat(extension.downcase) - # end + def name_to_logo_filename(extension) + self.employer_trim_name(self.name).titleize.gsub(/[^a-zA-Z]/, '').concat('Logo').concat(extension.downcase) + end - def employer_trim_name(name) - regex_source = Regexp.union(["health", "plan", "the", "inc", "llc"]).source + def employer_trim_name(name = nil) + employer_name = name.present? ? name : self.name + regex_source = Regexp.union(["health ", "plan", "the", "inc", "llc"]).source case_insensitive_regex = Regexp.new(regex_source, "i") - name.gsub(case_insensitive_regex, "").squish + employer_name.gsub(case_insensitive_regex, "").gsub(/[^[:alpha:][:space:]]/, "").squish end def self.permitted_params(params) diff --git a/app/models/id_card/employer_logo.rb b/app/models/id_card/employer_logo.rb index 1311d06..a60ee1b 100644 --- a/app/models/id_card/employer_logo.rb +++ b/app/models/id_card/employer_logo.rb @@ -1,15 +1,15 @@ module IdCard class EmployerLogo < ApplicationRecord - before_save :calculate_aspect_ratio, if: :image_data_changed? + before_validation :calculate_aspect_ratio, if: :image_data_changed? private def calculate_aspect_ratio - image_io = StringIO.new(image_data) + image_io = StringIO.new(self.image_data) width, height = FastImage.size(image_io) image_ratio = width.to_f / height if image_ratio - aspect_ratio = image_ratio.round(2) + self.aspect_ratio = image_ratio.round(2) end end end diff --git a/app/models/id_card/network_logo.rb b/app/models/id_card/network_logo.rb index 1f5905a..61ae8a7 100644 --- a/app/models/id_card/network_logo.rb +++ b/app/models/id_card/network_logo.rb @@ -7,7 +7,7 @@ module IdCard class << self def medcost - defaults.where("filename LIKE ?", "%Medcost%") + defaults.where("filename LIKE ?", "%MedCost%") end def cigna diff --git a/app/models/id_card/plan.rb b/app/models/id_card/plan.rb index 6caac56..78df748 100644 --- a/app/models/id_card/plan.rb +++ b/app/models/id_card/plan.rb @@ -47,6 +47,7 @@ module IdCard def permitted_params(params) params.require(:id_card_configuration).permit( plans_attributes: [ + :id, :title, :pb_product_key, :pl_plan_key, diff --git a/app/models/member.rb b/app/models/member.rb index 66839bf..ec21f22 100644 --- a/app/models/member.rb +++ b/app/models/member.rb @@ -1,5 +1,5 @@ class Member < ApplicationRecord - belongs_to :plan + belongs_to :id_card_plan, class_name: 'IdCard::Plan', optional: true belongs_to :employer diff --git a/app/services/benefits_word_doc/map_employer_information.rb b/app/services/benefits_word_doc/map_employer_information.rb index 261897d..ead1fb0 100644 --- a/app/services/benefits_word_doc/map_employer_information.rb +++ b/app/services/benefits_word_doc/map_employer_information.rb @@ -3,6 +3,7 @@ module BenefitsWordDoc def initialize(employer, word_doc_section) @employer = employer + @card_config = @employer.id_card_configuration @word_doc_section = word_doc_section end @@ -27,6 +28,7 @@ module BenefitsWordDoc end end end + @card_config.rx_group_number = @employer.group_number @employer end diff --git a/app/services/benefits_word_doc/map_employer_logo.rb b/app/services/benefits_word_doc/map_employer_logo.rb index 59ca9d7..8aaad21 100644 --- a/app/services/benefits_word_doc/map_employer_logo.rb +++ b/app/services/benefits_word_doc/map_employer_logo.rb @@ -3,6 +3,7 @@ module BenefitsWordDoc def initialize(employer, word_doc) @employer = employer + @card_config = @employer.id_card_configuration @word_doc = word_doc end @@ -40,7 +41,7 @@ module BenefitsWordDoc # @employer.single_card_template = "FairosRxIDCard" # end - @employer.id_card_configuration.employer_logo = logo + @card_config.employer_logo = logo end end @employer diff --git a/app/services/benefits_word_doc/map_network_information.rb b/app/services/benefits_word_doc/map_network_information.rb index a9c084c..7acadc2 100644 --- a/app/services/benefits_word_doc/map_network_information.rb +++ b/app/services/benefits_word_doc/map_network_information.rb @@ -3,6 +3,7 @@ module BenefitsWordDoc def initialize(employer, word_doc_section) @employer = employer + @card_config = @employer.id_card_configuration @word_doc_section = word_doc_section end @@ -19,7 +20,7 @@ module BenefitsWordDoc if line.match?(/cigna/i) break "Cigna" elsif line.match?(/medcost/i) - break "Medcost" + break "MedCost" end end @@ -28,11 +29,11 @@ module BenefitsWordDoc # 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") + @card_config.network_provider = network + logo_name = "#{network}Logo.png" + @card_config.network_logo = IdCard::NetworkLogo.find_by(filename: logo_name) + @card_config.provider_section = IdCard::ProviderSection.find_by(title: network) + @card_config.rx_section = IdCard::RxSection.find_by(title: "FairosRx") end diff --git a/app/services/benefits_word_doc/map_plans_information.rb b/app/services/benefits_word_doc/map_plans_information.rb index 3f9abc7..ee5a100 100644 --- a/app/services/benefits_word_doc/map_plans_information.rb +++ b/app/services/benefits_word_doc/map_plans_information.rb @@ -3,6 +3,7 @@ module BenefitsWordDoc def initialize(employer, word_doc_section) @employer = employer + @card_config = @employer.id_card_configuration @word_doc_section = word_doc_section end @@ -11,12 +12,12 @@ module BenefitsWordDoc plans_indexes = @word_doc_section.each_index.select { |index| @word_doc_section[index].match?(/\d*\.?\d+k/i) } plans_indexes.each do |plan_index| - new_plan = @employer.build_plan_with_default_benefits(title: @word_doc_section[plan_index]) + new_plan = @card_config.plans.build(title: @word_doc_section[plan_index]) plan_lines = @word_doc_section.slice(plan_index + 1, 14) plan_lines.each_with_index do |line, i| field_mapping = mapping_array[i] - if line.match(/:.*/) - field_value = line.match(/:.*/)[0].strip + if line.match(/(?<=:).+/) + field_value = line.match(/(?<=:).+/)[0].strip else field_regex = field_mapping[:doc_to_employer_regex] if line.match(field_regex) diff --git a/app/services/benefits_word_doc_processor.rb b/app/services/benefits_word_doc_processor.rb index 895e2b2..73d4506 100644 --- a/app/services/benefits_word_doc_processor.rb +++ b/app/services/benefits_word_doc_processor.rb @@ -6,6 +6,7 @@ class BenefitsWordDocProcessor @employer = employer else @employer = Employer.new + @employer.build_id_card_configuration end end diff --git a/app/services/employer_cards/data_formatter.rb b/app/services/employer_cards/employer_data_formatter.rb similarity index 100% rename from app/services/employer_cards/data_formatter.rb rename to app/services/employer_cards/employer_data_formatter.rb diff --git a/app/services/employer_cards/get_queued_cards.rb b/app/services/employer_cards/get_queued_cards.rb index 795c8b9..43f6fe3 100644 --- a/app/services/employer_cards/get_queued_cards.rb +++ b/app/services/employer_cards/get_queued_cards.rb @@ -1,7 +1,7 @@ module EmployerCards class GetQueuedCards - def initialize(pl_plan_keys) + def initialize(pl_plan_keys = nil) if pl_plan_keys @employer_pl_plan_keys = pl_plan_keys else diff --git a/app/services/id_card_printer/data_formatter.rb b/app/services/id_card_printer/data_formatter.rb deleted file mode 100644 index b6b6150..0000000 --- a/app/services/id_card_printer/data_formatter.rb +++ /dev/null @@ -1,93 +0,0 @@ -module IdCardPrinter - class DataFormatter - - def initialize(employer) - @employer = employer - end - - def call - @sample_card = SampleIdCard.new() - - set_employer_fields() - set_generic_fields() - set_rx_fields() - set_network_fields() - # set_dependent_fields() - sample_cards = set_plan_fields() - sample_cards.each(&:save!) - - end - - private - - def set_employer_fields - selected_attributes = { - employer_name: @employer.name, - group_number: @employer.group_number.present? ? @employer.group_number : "999999", - medical_eff_date: @employer.effective_date - } - - @sample_card.assign_attributes(selected_attributes) - end - - def set_plan_fields - plans_sample_cards = [] - @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 - plan.plan_benefits.each do |bene| - plan_sample_card["benefit_desc_#{bene.sequence}".to_sym] = bene.benefit_desc - plan_sample_card["benefit_#{bene.sequence}".to_sym] = bene.benefit - end - plans_sample_cards.push(plan_sample_card) - end - plans_sample_cards - end - - def set_generic_fields - selected_attributes = { - full_name: "JANE DOE", - primary_mb_member_key: "888888", - rx_group: @employer.group_number.present? ? @employer.group_number : "999999" - } - - @sample_card.assign_attributes(selected_attributes) - end - - def set_network_fields - 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, - :claim_to_7, :claim_to_8, :claim_to_9, :claim_to_10, :claim_to_11, :claim_to_12 - ) - if @employer.network_provider == "Cigna" - @sample_card.provider_code = "5" - end - - @sample_card.assign_attributes(selected_attributes) - end - - def set_rx_fields - # fairos_information = Vhcs::HlrxCrosRef.where(pl_plan_key: 52).first - selected_attributes = @employer.id_card_configuration.rx_section.attributes.with_indifferent_access.slice( - :customer_service, - :web_url - ) - - @sample_card.assign_attributes(selected_attributes) - end - - def set_dependent_fields - @sample_card.dependent_1 = "John Doe" - @sample_card.dependent_2 = "Molly Doe" - @sample_card.dependent_3 = "Jonathan Doe" - @sample_card.dependent_4 = "Calvin Doe" - @sample_card.dependent_5 = "Richard Doe" - @sample_card.dependent_6 = "Jannet Doe" - @sample_card.dependent_7 = "Longername Doe" - @sample_card.dependent_8 = "Robbert Doe" - end - end -end \ No newline at end of file diff --git a/app/services/id_card_printer/employer_cards_generator.rb b/app/services/id_card_printer/employer_cards_generator.rb index 20e4729..21cc330 100644 --- a/app/services/id_card_printer/employer_cards_generator.rb +++ b/app/services/id_card_printer/employer_cards_generator.rb @@ -1,17 +1,38 @@ module IdCardPrinter class EmployerCardsGenerator - def initialize(pl_plan_key, layout, zip=false) - @pl_plan_key = pl_plan_key + def initialize(employer, layout, zip=false) + @employer = employer @layout = layout @zip = zip end def call - IdCard::PrintData.where(pl_plan_key: @pl_plan_key).destroy_all - EmployerCards::DataFormatter.new(@pl_plan_key).call + IdCard::PrintData.where(pl_plan_key: @employer.pl_plan_key).destroy_all + IdCardPrinter::EmployerDataFormatter.new(@employer).call - IdCardPrinter::PdfProcessor.new(@pl_plan_key, @layout, @zip).call + pdf_array = IdCardPrinter::PdfProcessor.new(@employer, @layout, @zip).call + + group_pdfs = combine_pdfs(pdf_array) + group_pdfs + + end + + private + + def combine_pdfs(pdf_array) + if @zip + group_cards_pdf = Zip::OutputStream.write_buffer do |zio| + pdf_array.each do |file| + zio.put_next_entry(file[:name]) + zio.write(file[:data]) + end + end + else + group_cards_pdf = CombinePDF.new + pdf_array.each { |pdf| group_cards_pdf << pdf } + end + group_cards_pdf end end end diff --git a/app/services/id_card_printer/employer_data_formatter.rb b/app/services/id_card_printer/employer_data_formatter.rb new file mode 100644 index 0000000..f3f14d9 --- /dev/null +++ b/app/services/id_card_printer/employer_data_formatter.rb @@ -0,0 +1,169 @@ +module IdCardPrinter + class EmployerDataFormatter + + def initialize(employer, member_keys = nil) + @employer = employer + @card_config = @employer.id_card_configuration + + if member_keys + @members = @employer.members.where(pb_entity_key: member_keys).order(:name) + else + @members = @employer.members.order(:name) + end + end + + def call + @base_card = IdCard::PrintData.new() + @employer_cards = [] + + set_common_fields + set_member_fields + + + set_plan_fields + + @employer_cards.each(&:save!) + + end + + private + + def set_common_fields + employer_attributes = { + employer_name: @card_config.print_name, + pl_plan_key: @card_config.pl_plan_key, + group_number: @employer.group_number, + rx_group: @card_config.rx_group_number, + network_provider: @card_config.network_provider + } + + rx_attributes = @card_config.rx_section.attributes.with_indifferent_access.slice( + :customer_service, + :web_url + ) + + provider_attributes = @card_config.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, + :claim_to_7, :claim_to_8, :claim_to_9, :claim_to_10, :claim_to_11, :claim_to_12 + ) + + selected_attributes = employer_attributes.merge(rx_attributes).merge(provider_attributes) + @base_card.assign_attributes(selected_attributes) + end + + def set_common_fields_old + employer_attributes = { + employer_name: @card_config.print_name, + group_number: @employer.group_number, + rx_group: @card_config.rx_group_number + } + + rx_attributes = @card_config.rx_section.attributes.with_indifferent_access.slice( + :customer_service, + :web_url + ) + + provider_attributes = @card_config.provider_section.attributes.with_indifferent_access.slice( + :provider_code, :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, + :claim_to_7, :claim_to_8, :claim_to_9, :claim_to_10, :claim_to_11, :claim_to_12 + ) + + selected_attributes = employer_attributes.merge(rx_attributes).merge(provider_attributes) + @employer_cards.each do |card| + card.assign_attributes(selected_attributes) + end + end + + def set_plan_fields + @card_config.plans.each do |plan| + selected_attributes = {} + 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 + @employer_cards.find_all { |card| card.plan_id == plan.id.to_s }.each do |card| + card.assign_attributes(selected_attributes) + end + end + end + + def set_member_fields + @group_dependents = Vhcs::VwmbMember.where(pl_plan_key: @employer.pl_plan_key) + @members.each do |me| + effect_date = determine_eff_date(me) + if effect_date + member_card = @base_card.dup + member_attributes = { + full_name: me.id_card_display_name, + full_name_last_name_first: me.name, + primary_mb_member_key: me.pb_entity_key, + family_id: me.family_id, + plan_id: me.id_card_plan_id, + medical_eff_date: effect_date.strftime("%m/%d/%Y") + } + + dependent_attributes = get_dependent_fields(me) + if dependent_attributes.present? + selected_attributes = member_attributes.merge(dependent_attributes) + else + selected_attributes = member_attributes + end + + member_card.assign_attributes(selected_attributes) + @employer_cards.push(member_card) + end + end + end + + # def set_network_fields + # selected_attributes = @employer.card_provider.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, + # :claim_to_7, :claim_to_8, :claim_to_9, :claim_to_10, :claim_to_11, :claim_to_12 + # ) + # @employer_cards.all do |card| + # card.assign_attributes(selected_attributes) + # end + # end + + # def set_rx_fields + # # fairos_information = Vhcs::HlrxCrosRef.where(pl_plan_key: 52).first + # selected_attributes = @employer.card_rx.attributes.with_indifferent_access.slice( + # :customer_service, + # :web_url + # ) + # @employer_cards.all do |card| + # card.assign_attributes(selected_attributes) + # end + # end + + def determine_eff_date(member) + + participation = Vhcs::PbProductParticipation.joins('INNER JOIN "PBCoveredEntities" ON "PBProductParticipation"."PBProductParticipationKey" = "PBCoveredEntities"."PBProductParticipationKey"').where('"PBCoveredEntities"."PBEntityKey" = ?', member.pb_entity_key).last + in_effect = participation.in_effect + out_of_effect = participation.out_of_effect + + if in_effect <= (Date.today + 90.days) && (out_of_effect - 1.day) > Date.today && out_of_effect > in_effect + in_effect + else + false + end + + end + + def get_dependent_fields(member) + dependent_attributes = {} + dependents = @group_dependents.where(family_id: member.family_id).where.not(pb_entity_key: member.pb_entity_key) + dependents.each do |dep| + dependent_name = dep.first_name + ' ' + dep.last_name + dependent_attributes["dependent_#{dep.sequence_number - 1}".to_sym] = dependent_name + end + dependent_attributes + end + end +end \ No newline at end of file diff --git a/app/services/id_card_printer/jasper_url_generator.rb b/app/services/id_card_printer/jasper_url_generator.rb index e8687f7..d7fd5d5 100644 --- a/app/services/id_card_printer/jasper_url_generator.rb +++ b/app/services/id_card_printer/jasper_url_generator.rb @@ -3,9 +3,9 @@ module IdCardPrinter def initialize(pl_plan_key, family_id, layout) @pl_plan_key = pl_plan_key + @card_config = IdCard::Configuration.find_by(pl_plan_key: pl_plan_key) @family_id = family_id @layout = layout - @card_config = IdCard::Configuration.find_by(pl_plan_key: pl_plan_key) end def call diff --git a/app/services/id_card_printer/member_cards_generator.rb b/app/services/id_card_printer/member_cards_generator.rb new file mode 100644 index 0000000..187d14f --- /dev/null +++ b/app/services/id_card_printer/member_cards_generator.rb @@ -0,0 +1,38 @@ +module IdCardPrinter + class MemberCardsGenerator + + def initialize(member_keys, layout) + @member_keys = Array.wrap(member_keys) + @employer = employer + @layout = layout + @zip = zip + end + + def call + IdCard::PrintData.where(mb_member_key: @employer.pl_plan_key).destroy_all + IdCardPrinter::EmployerDataFormatter.new(@employer).call + + pdf_array = IdCardPrinter::PdfProcessor.new(@employer, @layout, @zip).call + + group_pdfs = combine_pdfs(pdf_array) + group_pdfs + + end + + private + + def combine_pdfs(pdf_array) + if @zip + group_cards_pdf = Zip::OutputStream.write_buffer do |zio| + pdf_array.each do |file| + zio.put_next_entry(file[:name]) + zio.write(file[:data]) + end + end + else + group_cards_pdf = CombinePDF.new + pdf_array.each { |pdf| group_cards_pdf << pdf } + end + end + end +end diff --git a/app/services/id_card_printer/pdf_processor.rb b/app/services/id_card_printer/pdf_processor.rb index 9da85ac..20f67be 100644 --- a/app/services/id_card_printer/pdf_processor.rb +++ b/app/services/id_card_printer/pdf_processor.rb @@ -1,40 +1,45 @@ module IdCardPrinter class PdfProcessor - def initialize(pl_plan_key, layout, zip) - @pl_plan_key = pl_plan_key - @employer_card_config = Employer.find_by(pl_plan_key: pl_plan_key).id_card_configuration + def initialize(employer, layout, zip = false) + @employer = employer + @card_config = @employer.id_card_configuration @layout = layout @zip = zip end def call + # if @zip + # group_cards_pdf_array = [] + # else + # group_cards_pdf = CombinePDF.new + # end group_cards_pdf_array = [] - IdCard::PrintData.where(pl_plan_key: @pl_plan_key).each do |card| - url = IdCardPrinter::JasperUrlGenerator.new(@pl_plan_key, card.family_id, @layout).call + IdCard::PrintData.where(pl_plan_key: @employer.pl_plan_key).each do |card| + url = IdCardPrinter::JasperUrlGenerator.new(@employer.pl_plan_key, card.family_id, @layout).call puts url card_pdf = IdCardPrinter::JasperPdfGenerator.new(url).call if @zip - card_filename = "#{card.name.gsub(", ", "_")}_digital_card_#{Date.today}.pdf" + card_filename = "#{card.full_name_last_name_first.gsub(", ", "_")}_digital_card_#{Date.today}.pdf" group_cards_pdf_array << { name: card_filename, data: card_pdf.to_pdf } else group_cards_pdf_array << card_pdf end end - if @zip - group_cards_pdf = Zip::OutputStream.write_buffer do |zio| - group_cards_pdf_array.each do |file| - zio.put_next_entry(file[:name]) - zio.write(file[:data]) - end - end - else - todays_date = DateTime.current.strftime('%Y%m%d%H%M%S') - group_cards_pdf.save("tmp/#{@employer.name}_print_cards_#{todays_date}.pdf") - end + # if @zip + # group_cards_pdf = Zip::OutputStream.write_buffer do |zio| + # group_cards_pdf_array.each do |file| + # zio.put_next_entry(file[:name]) + # zio.write(file[:data]) + # end + # end + # # else + # # todays_date = DateTime.current.strftime('%Y%m%d%H%M%S') + # # group_cards_pdf.save("tmp/#{@employer.name}_print_cards_#{todays_date}.pdf") + # end - group_cards_pdf + group_cards_pdf_array end end end \ No newline at end of file diff --git a/app/services/id_card_printer/queued_cards_generator.rb b/app/services/id_card_printer/queued_cards_generator.rb new file mode 100644 index 0000000..caa0475 --- /dev/null +++ b/app/services/id_card_printer/queued_cards_generator.rb @@ -0,0 +1,61 @@ +module IdCardPrinter + class QueuedCardsGenerator + + def initialize(employer_member_keys) + @employer_member_keys = Array.wrap(employer_member_keys) + @layout = 'PrintCard' + @pl_plan_keys = @employer_member_keys.map { |emk| emk["PlanKey"].to_s } + end + + def call + white_card_array = [] + blue_card_array = [] + IdCard::PrintData.where(pl_plan_key: @pl_plan_keys).destroy_all + @employer_member_keys.each do |emk| + employer = Employer.find_by(pl_plan_key: emk["PlanKey"]) + member_keys = emk["MemberKeys"].split(", ").map(&:to_i) + IdCardPrinter::EmployerDataFormatter.new(employer, member_keys).call + if emk["PlanKey"] == "3" + blue_card_array = IdCardPrinter::PdfProcessor.new(employer, @layout).call + else + white_card_array = IdCardPrinter::PdfProcessor.new(employer, @layout).call + end + end + + combine_pdfs(blue_card_array, white_card_array) + + end + + private + + def combine_pdfs(blue_cards, white_cards) + if blue_cards.present? && white_cards.present? + combined_pdfs = [] + blue_filename = "queued_blue_cards_#{Date.today}.pdf" + combined_pdfs << { name: blue_filename, data: blue_cards.to_pdf } + white_filename = "queued_white_cards_#{Date.today}.pdf" + combined_pdfs << { name: white_filename, data: white_cards.to_pdf } + + output_file = zip_cards(combined_pdfs) + elsif blue_cards.present? + output_file = CombinePDF.new + blue_cards.each { |pdf| output_file << pdf } + elsif white_cards.present? + output_file = CombinePDF.new + white_cards.each { |pdf| output_file << pdf } + end + + output_file + end + + def zip_cards(pdf_array) + Zip::OutputStream.write_buffer do |zio| + pdf_array.each do |file| + zio.put_next_entry(file[:name]) + zio.write(file[:data]) + end + end + end + + end +end diff --git a/app/services/id_card_printer/sample_cards_generator.rb b/app/services/id_card_printer/sample_cards_generator.rb new file mode 100644 index 0000000..3048b4c --- /dev/null +++ b/app/services/id_card_printer/sample_cards_generator.rb @@ -0,0 +1,15 @@ +module IdCardPrinter + class SampleCardsGenerator + + def initialize(employer) + @employer = employer + end + + def call + IdCard::PrintData.where(employer_name: @employer.name).destroy_all + IdCardPrinter::SampleDataFormatter.new(@employer).call + + IdCardPrinter::SamplePdfProcessor.new(@employer).call + end + end +end diff --git a/app/services/id_card_printer/sample_data_formatter.rb b/app/services/id_card_printer/sample_data_formatter.rb new file mode 100644 index 0000000..44caab8 --- /dev/null +++ b/app/services/id_card_printer/sample_data_formatter.rb @@ -0,0 +1,96 @@ +module IdCardPrinter + class SampleDataFormatter + + def initialize(employer) + @employer = employer + @card_config = @employer.id_card_configuration + end + + def call + @base_card = IdCard::PrintData.new(sample: true) + + set_employer_fields() + set_sample_fields() + set_rx_fields() + set_network_fields() + set_dependent_fields() + sample_cards = set_plan_fields() + sample_cards.each(&:save!) + + end + + private + + def set_employer_fields + selected_attributes = { + employer_name: @employer.name, + group_number: @employer.group_number.present? ? @employer.group_number : "999999", + medical_eff_date: @employer.effective_date + } + + @base_card.assign_attributes(selected_attributes) + end + + def set_plan_fields + plans_base_cards = [] + @card_config.plans.each do |plan| + @base_card.sample_key = @card_config.print_name.titleize.split.map(&:first).push(plan.id).join + plan_base_card = @base_card.dup + plan_name = plan.title.split(/(?<=\d[kK])/).first + plan.plan_benefits.each do |bene| + plan_base_card["benefit_desc_#{bene.sequence}".to_sym] = bene.benefit_desc + plan_base_card["benefit_#{bene.sequence}".to_sym] = bene.benefit + end + plan_base_card.sample_plan_title = plan_name + plans_base_cards.push(plan_base_card) + end + plans_base_cards + end + + def set_sample_fields + selected_attributes = { + full_name: "JANE DOE", + primary_mb_member_key: "888888", + rx_group: @employer.group_number.present? ? @employer.group_number : "999999" + } + + @base_card.assign_attributes(selected_attributes) + end + + def set_network_fields + selected_attributes = @card_config.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, + :claim_to_7, :claim_to_8, :claim_to_9, :claim_to_10, :claim_to_11, :claim_to_12 + ) + # if @card_config.network_provider == "Cigna" + # @base_card.provider_code = "5" + # end + @base_card.network_provider = @card_config.network_provider + + @base_card.assign_attributes(selected_attributes) + end + + def set_rx_fields + # fairos_information = Vhcs::HlrxCrosRef.where(pl_plan_key: 52).first + selected_attributes = @card_config.rx_section.attributes.with_indifferent_access.slice( + :customer_service, + :web_url + ) + + @base_card.assign_attributes(selected_attributes) + end + + def set_dependent_fields + @base_card.dependent_1 = "John Doe" + # @base_card.dependent_2 = "Molly Doe" + # @base_card.dependent_3 = "Jonathan Doe" + # @base_card.dependent_4 = "Calvin Doe" + # @base_card.dependent_5 = "Richard Doe" + # @base_card.dependent_6 = "Jannet Doe" + # @base_card.dependent_7 = "Longername Doe" + # @base_card.dependent_8 = "Robbert Doe" + end + end +end \ No newline at end of file diff --git a/app/services/sample_card/jasper_url_generator.rb b/app/services/id_card_printer/sample_jasper_url_generator.rb similarity index 55% rename from app/services/sample_card/jasper_url_generator.rb rename to app/services/id_card_printer/sample_jasper_url_generator.rb index 21fd304..6a68151 100644 --- a/app/services/sample_card/jasper_url_generator.rb +++ b/app/services/id_card_printer/sample_jasper_url_generator.rb @@ -1,9 +1,10 @@ -module SampleCard - class JasperUrlGenerator +module IdCardPrinter + class SampleJasperUrlGenerator - def initialize(employer, plan_name) - @plan_name = plan_name - @employer = employer + def initialize(employer, sample_key, sample_title) + @sample_key = sample_key + @sample_title = sample_title + @card_config = employer.id_card_configuration end def call @@ -14,23 +15,6 @@ module SampleCard private - def determine_card_template - # if @network_logos.length > 1 - # member_geographic_info = Vhcs::PbEntityAddress.joins("INNER JOIN vwMBMember ON PBEntityAddress.PBEntityKey = vwMBMember.PBEntityKey AND PBEntityAddress.AddressTypeID = 1137").where("vwMBMember.FamilyID = ?", @family_id).first - # @network_logos.where.not(default: true).each do |pnl| - # if member_geographic_info[pnl.exception_type] == pnl.exception_value - # return pnl.net_logo - # end - # end - # end - # @network_logos.find_by(default: true).net_logo - # if @employer.single_card_template.include?("Half") - # "FairosRxSampleIDCard-Half-Display" - # else - # "FairosRxSampleIDCard-Display" - # end - end - def determine_network_logo # if @network_logos.length > 1 # member_geographic_info = Vhcs::PbEntityAddress.joins("INNER JOIN vwMBMember ON PBEntityAddress.PBEntityKey = vwMBMember.PBEntityKey AND PBEntityAddress.AddressTypeID = 1137").where("vwMBMember.FamilyID = ?", @family_id).first @@ -41,7 +25,7 @@ module SampleCard # end # end # @network_logos.find_by(default: true).net_logo - @employer.default_network_logo + @card_config.network_logo.filename end # http://localhost:8080/trunk/PdfServlet?reportConn=BrittonConnect&id=&reportName=FairosRxSampleIDCard-Half&family_id=Classic%202K&employer_logo=BryanPestControl.jpeg&network_logo=CignaLogo.png&reportDir=secure/Documents&SUBREPORT_DIR=/&ImageDir=secure/Documents&netToken=3a4a8b03f4dfb0e6e3fc82dd369f70ef&FileType=PDF # http://localhost:8080/trunk/PdfServlet?reportConn=BrittonConnect&id=&reportName=FairosRxSampleIDCard-Half&family_id=Classic%202K&employer_logo=BryanPestControl.jpeg&network_logo=CignaLogo.png&reportDir=secure/Documents&SUBREPORT_DIR=/&ImageDir=secure/Documents&netToken=3a4a8b03f4dfb0e6e3fc82dd369f70ef&FileType=PDF @@ -50,7 +34,7 @@ module SampleCard host: '10.41.1.115', port: 8080, path: '/trunk/IdCardsServlet', - query: "reportConn=BrittonConnect&cardTemplate=FairosRxIDCard&printType=SampleCard&family_id=#{@plan_name}&employer_logo=#{@employer.employer_logo_filename}&network_logo=#{determine_network_logo}&FileType=PDF" + query: "reportConn=BrittonConnect&cardTemplate=#{@card_config.card_template}&printType=SampleCard&sample_key=#{@sample_key}&sample_plan_title=#{@sample_title}&employer_logo=#{@card_config.employer_logo.filename}&network_logo=#{determine_network_logo}&FileType=PDF" } end diff --git a/app/services/id_card_printer/sample_pdf_processor.rb b/app/services/id_card_printer/sample_pdf_processor.rb new file mode 100644 index 0000000..82e9075 --- /dev/null +++ b/app/services/id_card_printer/sample_pdf_processor.rb @@ -0,0 +1,25 @@ +module IdCardPrinter + class SamplePdfProcessor + + def initialize(employer) + @employer = employer + @card_config = @employer.id_card_configuration + end + + def call + group_cards_pdf = CombinePDF.new + IdCard::PrintData.where(employer_name: @employer.name).each do |card| + url = IdCardPrinter::SampleJasperUrlGenerator.new(@employer, card.sample_key, card.sample_plan_title).call + puts url + card_pdf = IdCardPrinter::JasperPdfGenerator.new(url).call + + group_cards_pdf << card_pdf + end + + # todays_date = DateTime.current.strftime('%Y%m%d%H%M%S') + # group_cards_pdf.save("tmp/#{@employer.name}_print_cards_#{todays_date}.pdf") + + group_cards_pdf + end + end +end \ No newline at end of file diff --git a/app/views/employers/index.html.erb b/app/views/employers/index.html.erb index ecf4281..6fba19d 100644 --- a/app/views/employers/index.html.erb +++ b/app/views/employers/index.html.erb @@ -23,7 +23,7 @@ <% @employers.active.each_with_index do |emp, index| %> <% item_color_index = @color_index == 0 ? 0 : @color_index % plan_colors.length %>