diff --git a/app/assets/tailwind/application.css b/app/assets/tailwind/application.css index 87fa021..7b9bd11 100644 --- a/app/assets/tailwind/application.css +++ b/app/assets/tailwind/application.css @@ -19,6 +19,8 @@ --color-cobalt: #0047AB; /* cobalt blue */ --color-cobalt-tinted: #003B8F; + /* cobalt blue */ + --color-cobalt-vivid: #005DE0; /* platinum */ --color-platinum: #E0E0E0; /* copper */ @@ -33,6 +35,8 @@ --color-verdigris: #588288; /* oxidized copper/bronze green-blue */ --color-verdigris-tinted: #496A6F; + /* oxidized copper/bronze green-blue */ + --color-verdigris-vivid: #618D94; /* alert red */ --color-brightlava: #f80800; /* alert green */ diff --git a/app/controllers/id_card/network_logos_controller.rb b/app/controllers/id_card/network_logos_controller.rb new file mode 100644 index 0000000..70279ff --- /dev/null +++ b/app/controllers/id_card/network_logos_controller.rb @@ -0,0 +1,61 @@ +module IdCard + class NetworkLogosController < ApplicationController + + # View Methods + def index + end + + def show + end + + def new + end + + def create + file = logo_params["logo_file"] + if file.present? && file.is_a?(ActionDispatch::Http::UploadedFile) + filename = file.original_filename + # binary_data = file.read + binary_data = File.binread(file) + meme_type = Marcel::MimeType.for(file) + + networklogo = IdCard::NetworkLogo.create( + filename: filename, + image_data: binary_data, + content_type: meme_type + ) + + render json: networklogo, only: [:id], status: :ok + end + end + + def edit + end + + def update + end + + def destroy + end + + # API Methods + + def image + logo_file = IdCard::NetworkLogo.find(params[:id]) + puts params[:id] + logo_binary = logo_file.image_data + logo_filename = logo_file.filename + + send_data logo_binary, + filename: logo_filename, + disposition: 'inline' + end + + private + + def logo_params + params.require(:id_card_network_logo).permit(:logo_file) + end + + end +end \ No newline at end of file diff --git a/app/controllers/id_card/plans_controller.rb b/app/controllers/id_card/plans_controller.rb new file mode 100644 index 0000000..0611a89 --- /dev/null +++ b/app/controllers/id_card/plans_controller.rb @@ -0,0 +1,35 @@ +module IdCard + class PlansController < ApplicationController + + # View Methods + def new + + end + + def create + + end + + def edit + + end + + def update + + end + + def destroy + + end + + # API Methods + + def get_plan_benefits + @plan_benefits = IdCard::Plan.find(params[:id]).plan_benefits + render json: @plan_benefits.as_json + end + + private + + 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 new file mode 100644 index 0000000..7eae725 --- /dev/null +++ b/app/controllers/id_card/printer_controller.rb @@ -0,0 +1,27 @@ +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 + + private + + + def add_queued_count_to_card_configuration + @queue_counts = EmployerCards::QueueCounter.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/id_card/provider_sections_controller.rb b/app/controllers/id_card/provider_sections_controller.rb new file mode 100644 index 0000000..5af0b6d --- /dev/null +++ b/app/controllers/id_card/provider_sections_controller.rb @@ -0,0 +1,40 @@ +module IdCard + class ProviderSectionsController < ApplicationController + + # View Methods + def index + end + + def show + end + + def new + end + + def create + end + + def edit + end + + def update + end + + def destroy + end + + # API Methods + + def get_section_data + @provider_section = IdCard::ProviderSection.find(params[:id]) + render json: @provider_section.as_json + end + + private + + def logo_params + params.require(:id_card_network_logo).permit(:logo_file) + end + + end +end \ No newline at end of file diff --git a/app/controllers/id_card/setup_controller.rb b/app/controllers/id_card/setup_controller.rb index c462e23..6656160 100644 --- a/app/controllers/id_card/setup_controller.rb +++ b/app/controllers/id_card/setup_controller.rb @@ -1,41 +1,25 @@ module IdCard - class SetupController < ApplicationController + class ConfigurationController < ApplicationController + before_action :set_employer_and_setup # View Methods - def new - @employer = Employer.find_by(slug: params[:employer]) - @setup = @employer.create_id_card_setup - render :new - end - - def create - xyz - employer_params = Employer.permitted_params(params) - puts "---Params---" - puts employer_params - # post_image_processing_params = process_logos(employer_setup_process_params) - @employer = Employer.new(employer_params) - if @employer.save - # update_logos_with_employer_setup_information() - redirect_to employer_path(@employer.slug), notice: 'Employer Saved' - else - render :new - end - end - def edit - @employer = Employer.find_by(slug: params[:id]) + @employer = Employer.find_by(slug: params[:employer_id]) + if @employer.id_card_enabled? + @setup = @employer.id_card_setup + else + @setup = @employer.create_id_card_setup + end render :edit end def update - puts "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" - employer_params = Employer.permitted_params(params) - @employer = Employer.find(params[:id]) + setup_params = IdCard::Configuration.permitted_params(params) + @setup = IdCard::Configuration.find(params[:id]) - if @employer.update(employer_params) + if @setup.update(setup_params) puts "sucess" - redirect_to employer_path(@employer.slug), notice: 'Employer was successfully updated.' + redirect_to employer_path(@setup.employer.slug), notice: 'ID Card Configuration was successfully updated.' else puts "fail" render :edit, status: :unprocessable_entity @@ -43,6 +27,66 @@ module IdCard end + 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]) + end + @rx_options = IdCard::RxSection.all + @fairos_rx_id = IdCard::RxSection.find_by(title: "FairosRx").id + render :general + end + + def update_general + if params[:id_card_setup]["provider_section_id"].include?("new|") + new_provider_section_params = IdCard::ProviderSection.permitted_params(params) + new_provider_section = IdCard::ProviderSection.create(new_provider_section_params) + params[:id_card_setup]["provider_section_id"] = new_provider_section.id + end + general_params = IdCard::Configuration.permitted_params(params) + if @setup.update(general_params) + puts "sucess" + redirect_to employer_path(@employer.slug), notice: 'ID Card Configuration was successfully updated.' + else + puts "fail" + render :general, status: :unprocessable_entity + end + end + + def plans + @plan_templates = IdCard::Plan.templates + render :plans + end + + def update_plans + plans_params = IdCard::Plan.permitted_params(params) + if @setup.update(plans_params) + puts "sucess" + redirect_to employer_path(@setup.employer.slug), notice: 'ID Card Plans successfully updated.' + else + puts "fail" + render :plans, status: :unprocessable_entity + end + + end + + def field_exceptions + render :field_exceptions + end + + def update_field_exceptions + field_exceptions_params = IdCard::FieldException.permitted_params(params) + if @setup.update(field_exceptions_params) + puts "sucess" + redirect_to employer_path(@setup.employer.slug), notice: 'ID Card Exceptions successfully updated.' + else + puts "fail" + render :field_exceptions, status: :unprocessable_entity + end + + end + def destroy # @resource = Resource.find(params[:id]) # @resource.destroy @@ -53,6 +97,15 @@ module IdCard private + def set_employer_and_setup + @employer = Employer.find_by(slug: params[:employer_id]) + if @employer.id_card_setup.present? + @setup = @employer.id_card_setup + else + @setup = @employer.create_id_card_setup + end + end + # def process_logos(employer_setup_process_params) # @uploaded_logos = [] # employer_logo = employer_setup_process_params["employer_logo"] @@ -129,15 +182,15 @@ module IdCard # ) # end - # def network_exceptions_params - # params.require(:employer_setup_network_exceptions_form).permit( - # network_exceptions: [:network_logo, exceptions: [:type, :value]], + # def network_field_exceptions_params + # params.require(:employer_setup_network_field_exceptions_form).permit( + # network_field_exceptions: [:network_logo, field_exceptions: [:type, :value]], # ) # end # def form_for_step # step_name = @top_form.current_step - # form_method = "EmployerSetup#{step_name.camelize}Form".constantize + # form_method = "EmployerConfiguration#{step_name.camelize}Form".constantize # # puts "/////\\\\\\||||||" # # puts session[:employer_setup_data] # # puts session[:employer_setup_data]['employer_setup_process_id'] @@ -146,7 +199,7 @@ module IdCard # end # def process_step(step_name) - # @form_method = "EmployerSetup#{step_name.camelize}Form".constantize + # @form_method = "EmployerConfiguration#{step_name.camelize}Form".constantize # session_data_name = "#{step_name}_data" # # puts "1--------------params----" # # puts params @@ -180,13 +233,13 @@ module IdCard # def global_params(step_name) # form_name_sym = "employer_setup_#{step_name}_form".to_sym - # params.require(form_name_sym).permit(EmployerSetupForm.permitted_params) + # params.require(form_name_sym).permit(EmployerConfigurationForm.permitted_params) # end # def process_step(step_name) # form_name = "employer_setup_#{step_name}_form".camelize.constantize # form_params_name = "#{step_name}_params".to_sym - # allowed_params = [:general_information_params, :plans_params, :network_exceptions_params] + # allowed_params = [:general_information_params, :plans_params, :network_field_exceptions_params] # if allowed_params.include?(form_params_name) # form_params = send(form_params_name) # @form = form_name.new(form_params) @@ -211,7 +264,7 @@ module IdCard # :number_of_plans, # :network, # :number_of_additional_network_logos, - # network_exceptions: [:network_logo, exceptions: [:type, :value]], + # network_field_exceptions: [:network_logo, field_exceptions: [:type, :value]], # plans: permited_plans_keys, # benefit_descs: benefit_sequence_keys # ) diff --git a/app/javascript/controllers/add_exception_item_controller.js b/app/javascript/controllers/add_exception_item_controller.js index 5d1e090..06e71e2 100644 --- a/app/javascript/controllers/add_exception_item_controller.js +++ b/app/javascript/controllers/add_exception_item_controller.js @@ -4,9 +4,10 @@ export default class extends Controller { static targets = ["exceptionItemTemplate", "exceptionItemContainer", "exceptionItem", "exceptionItemButton"] connect() { - const content = this.#newExemptionItem() - - this.exceptionItemButtonTarget.insertAdjacentHTML('beforebegin', content); + if (this.exceptionItemTargets.length > 0) { + const content = this.#newExemptionItem() + this.exceptionItemButtonTarget.insertAdjacentHTML('beforebegin', content); + } } addExemptionItem(event) { @@ -36,6 +37,7 @@ export default class extends Controller { #newExemptionItem() { const nextIndex = this.exceptionItemTargets.length + console.log(nextIndex) const buttonElement = this.exceptionItemButtonTarget; // Get the computed style (returns rgb/rgba value) diff --git a/app/javascript/controllers/add_plan_controller.js b/app/javascript/controllers/add_plan_controller.js index 86e94bd..74c5ba1 100644 --- a/app/javascript/controllers/add_plan_controller.js +++ b/app/javascript/controllers/add_plan_controller.js @@ -33,6 +33,7 @@ export default class extends Controller { #updateTemplatePlan() { const nextIndex = this.planTargets.length + console.log(nextIndex) const num_of_colors = this.formColorValue.length let colorIndex = 0 let newSecondaryColor = "copper" diff --git a/app/javascript/controllers/benefits_template_picker_controller.js b/app/javascript/controllers/benefits_template_picker_controller.js index dc3f861..67c435f 100644 --- a/app/javascript/controllers/benefits_template_picker_controller.js +++ b/app/javascript/controllers/benefits_template_picker_controller.js @@ -14,7 +14,7 @@ export default class extends Controller { return; } - const url = `/id_card_benefits_templates/get_template_benefits/${templateId}` + const url = `/id_card/plans/${templateId}/get_plan_benefits` const response = await fetch(url); const templateBenefitsData = await response.json(); diff --git a/app/javascript/controllers/exceptions_toggle_controller.js b/app/javascript/controllers/exceptions_toggle_controller.js new file mode 100644 index 0000000..42b62da --- /dev/null +++ b/app/javascript/controllers/exceptions_toggle_controller.js @@ -0,0 +1,57 @@ +import { Controller } from "@hotwired/stimulus" + +export default class extends Controller { + static targets = ["dependentField", "providerField", "selectField"] + + connect() { + console.log("--- in toggle connect --- ") + const selector = this.selectFieldTarget; + if (selector.value) { + const selectedValue = selector.value + this.dependentFieldTargets.forEach((field) => { + if (field.value) { + if (selectedValue == "network_logo") { + field.parentElement.parentElement.parentElement.classList.remove("hidden"); + } else { + field.parentElement.classList.remove("hidden"); + } + } + }) + } + } + + toggleFields() { + console.log("--- in toggle --- ") + const selector = this.selectFieldTarget; + if (selector.value) { + const selectedValue = selector.value + this.field_match = false; + this.dependentFieldTargets.forEach((field) => { + // console.log("- ", selectedValue) + // console.log("-- ", this.field_match) + // Check a data attribute on the field to see if it matches the selected value + if (field.dataset.parentValue === selectedValue) { + if (selectedValue == "network_logo") { + field.parentElement.parentElement.parentElement.classList.remove("hidden"); + } else { + field.parentElement.classList.remove("hidden"); + } + this.field_match = true; + } else { + if (field.dataset.parentValue == "network_logo") { + field.parentElement.parentElement.parentElement.classList.add("hidden"); + } else { + field.parentElement.classList.add("hidden"); + } + } + }); + if (!this.field_match) { + console.log("--- ", this.field_match) + const defaultOption = this.dependentFieldTargets.find(target => { + return target.dataset.parentValue === 'default'; + }); + defaultOption.parentElement.classList.remove("hidden"); + } + } + } +} \ No newline at end of file diff --git a/app/javascript/controllers/general_form_controller.js b/app/javascript/controllers/general_form_controller.js index 28be673..2bdecbd 100644 --- a/app/javascript/controllers/general_form_controller.js +++ b/app/javascript/controllers/general_form_controller.js @@ -1,9 +1,78 @@ import { Controller } from "@hotwired/stimulus" export default class extends Controller { - static targets = ["dependentField"] + static targets = ["dependentField", "providerField", "selectField"] connect() { + if (this.selectFieldTarget.value) { + this.toggleNewFieldSection(); + } + } + + async initNewFieldSection() { + console.log("--- in init async --- ") + const selector = this.selectFieldTarget + console.log(selector.textContent) + console.log(selector.value) + if (selector && selector.value && !selector.textContent.includes("Default")) { + const sectionId = selector.value + + const response = await fetch(`/id_card/provider_sections/${sectionId}/get_section_data`); + const templateSectionData = await response.json(); + + this.#updateFields(templateSectionData) + + this.dependentFieldTarget.classList.remove("hidden"); + } + } + + async toggleNewFieldSection() { + console.log("--- in new field toggle --- ") + const selector = this.selectFieldTarget + const selectedOption = selector.options[selector.selectedIndex] + const selectedValue = selectedOption.value + const selectedLabel = selectedOption.textContent + + if (selectedValue && selectedLabel.includes("Default")) { + this.dependentFieldTarget.classList.add("hidden"); + } else if (selectedValue) { + let sectionId = selectedValue + if (selectedValue.includes("new")) { + sectionId = selectedValue.split('|')[1] + } + const response = await fetch(`/id_card/provider_sections/${sectionId}/get_section_data`); + const sectionData = await response.json(); + + this.#updateFields(sectionData) + + this.dependentFieldTarget.classList.remove("hidden"); + } + + } + + async #updateFields(templateSectionData) { + const providerFieldTargetsList = this.providerFieldTargets + console.log(templateSectionData) + providerFieldTargetsList.forEach(function(formField) { + const dbField = formField.id.replace('id_card_configuration_provider_section_', '') + const dbValue = templateSectionData[dbField] + formField.value = dbValue; + + }) + + + + + // templateSectionData.forEach(function(data) { + // const targetElement = providerFieldTargetsList.find( + // (element) => element.dataset.sequence == data.sequence + // ); + // if (targetElement) { + // targetElement.value = data.benefit; + // } else { + // console.error(`Target not found for sequence: ${data.sequence}`); + // } + // }); } toggleFields() { diff --git a/app/javascript/controllers/logo_upload_controller.js b/app/javascript/controllers/logo_upload_controller.js index 10220c7..cdeb740 100644 --- a/app/javascript/controllers/logo_upload_controller.js +++ b/app/javascript/controllers/logo_upload_controller.js @@ -5,21 +5,38 @@ export default class extends Controller { logoType: String, employerName: String } - static targets = ["preview", "previewContainer", "logoSelect", "logoField", "initialLogoFile"]; + static targets = ["preview", "previewContainer", "logoSelect", "logoIdField", "logoNameField", "initialLogoFile"]; async connect() { console.log('in connect'); - const initValue = this.logoFieldTarget.value + this.setPreviewImage() + // Remember to revoke the URL when the controller is disconnected if necessary + // this.disconnect = () => URL.revokeObjectURL(objectUrl); + } + + async setPreviewImage() { + const initValue = this.logoIdFieldTarget.value console.log(initValue) + console.log(this.logoTypeValue) if (initValue) { const response = await fetch(`/id_card/${this.logoTypeValue}_logos/${initValue}/image`); // Fetch the binary data + const logoType = this.logoTypeValue + if (logoType == "employer") { + const contentDisposition = response.headers.get('Content-Disposition'); + const filename = contentDisposition.match(/filename="?([^"]+)"?/)[1]; + this.logoNameFieldTarget.value = filename; + } const blob = await response.blob(); const objectUrl = URL.createObjectURL(blob); this.previewTarget.src = objectUrl; this.previewContainerTarget.classList.remove("hidden"); + } else { + this.previewContainerTarget.classList.add("hidden"); } - // Remember to revoke the URL when the controller is disconnected if necessary - // this.disconnect = () => URL.revokeObjectURL(objectUrl); + } + + setSelectPreview(event) { + this.setPreviewImage() } uploadLogo(event) { @@ -34,19 +51,25 @@ export default class extends Controller { if (logoType == "network") { console.log("n " + newFileName); newFileName = this.determineNetworkFilename(logoFile) - this.addOptionToSelect(newFileName) - logoFile = new File([logoFile], newFileName) } else if (logoType == "employer") { newFileName = this.determineEmployerFilename(logoFile) - logoFile = new File([logoFile], newFileName) } + logoFile = new File([logoFile], newFileName) this.uploadLogoToServer(logoFile) .then((result) => { console.log(result); const logoId = result.id this.previewFile(logoFile); - this.logoFieldTarget.value = logoId; + if (logoType == "network") { + this.addOptionToSelect(newFileName, logoId) + } else { + this.logoNameFieldTarget.value = newFileName; + } + + this.logoIdFieldTarget.value = logoId; + + }) .catch((error) => { // Handle any errors that occurred @@ -93,23 +116,22 @@ export default class extends Controller { } } - addOptionToSelect(name) { + addOptionToSelect(name, id) { const blankOptionIndex = 0; - const newOption = new Option(name, name, true, true) + const newOption = new Option(name, id, true, true) - if (this.logoFieldTarget.options.length > blankOptionIndex + 1) { - this.logoFieldTarget.insertBefore(newOption, this.logoFieldTarget.options[blankOptionIndex + 1]); + if (this.logoIdFieldTarget.options.length > blankOptionIndex + 1) { + this.logoIdFieldTarget.insertBefore(newOption, this.logoIdFieldTarget.options[blankOptionIndex + 1]); } else { - this.logoFieldTarget.appendChild(newOption); + this.logoIdFieldTarget.appendChild(newOption); } - this.logoFieldTarget.value = name; } determineNetworkFilename(logoFile) { const fileExtension = logoFile.name.split('.').pop(); const primaryNetworkName = prompt("Enter the name for the primary network (Usually 'Cigna' or 'MedCost':"); - const secondaryNetworkName = prompt("Enter the name for the primary network (ex: Health Partners):"); + const secondaryNetworkName = prompt("Enter the name for the partner network (ex: Health Partners):"); const logoFilename = this.titleizeText(primaryNetworkName).concat(this.titleizeText(secondaryNetworkName)).concat("Logo.").concat(fileExtension).replaceAll(' ', ''); return logoFilename diff --git a/app/javascript/controllers/provider_update_controller.js b/app/javascript/controllers/provider_update_controller.js new file mode 100644 index 0000000..722513d --- /dev/null +++ b/app/javascript/controllers/provider_update_controller.js @@ -0,0 +1,25 @@ +import { Controller } from "@hotwired/stimulus" + +export default class extends Controller { + static targets = ["providerNetworkField", "networkLogoField", "providerSectionField"] + + connect() { + console.log("---provider update---") + } + + syncDefaults() { + const pnValue = this.providerNetworkFieldTarget.value + if (pnValue == "Cigna") { + this.networkLogoFieldTarget.value = 1 + this.providerSectionFieldTarget.value = 30 + } else if (pnValue == "Medcost") { + this.networkLogoFieldTarget.value = 2 + this.providerSectionFieldTarget.value = 26 + } else { + this.networkLogoFieldTarget.value = "" + this.providerSectionFieldTarget.value = "" + } + const event = new Event('change', { bubbles: true }); + this.networkLogoFieldTarget.dispatchEvent(event); + } +} \ No newline at end of file diff --git a/app/models/employer.rb b/app/models/employer.rb index 31f3eda..3f6ec6f 100644 --- a/app/models/employer.rb +++ b/app/models/employer.rb @@ -1,6 +1,6 @@ class Employer < ApplicationRecord has_many :members - has_one :id_card_setup, class_name: 'IdCard::Setup', dependent: :destroy + has_one :id_card_configuration, class_name: 'IdCard::Configuration', dependent: :destroy scope :active, -> { where(active: true) } scope :inactive, -> { where(active: false) } @@ -38,6 +38,14 @@ class Employer < ApplicationRecord self.slug = employer_trim_name(self.name).parameterize end + def id_card_enabled? + self.id_card_configuration.present? + end + + def claims_check_enabled? + false + end + # def name_to_logo_filename(extension) # self.employer_trim_name(self.name).titleize.gsub(/\s+/, '').concat('Logo').concat(extension.downcase) # end diff --git a/app/models/id_card/employer_logo.rb b/app/models/id_card/employer_logo.rb index 586d2c1..1311d06 100644 --- a/app/models/id_card/employer_logo.rb +++ b/app/models/id_card/employer_logo.rb @@ -5,11 +5,11 @@ module IdCard private def calculate_aspect_ratio - image_io = StringIO.new(self.image_data) + image_io = StringIO.new(image_data) width, height = FastImage.size(image_io) image_ratio = width.to_f / height if image_ratio - self.aspect_ratio = image_ratio.round(2) + aspect_ratio = image_ratio.round(2) end end end diff --git a/app/models/id_card/exception.rb b/app/models/id_card/exception.rb deleted file mode 100644 index cfa76d0..0000000 --- a/app/models/id_card/exception.rb +++ /dev/null @@ -1,12 +0,0 @@ -module IdCard - class Exception < ApplicationRecord - belongs_to :setup - has_many :exception_items - accepts_nested_attributes_for :exception_items, allow_destroy: true, reject_if: :all_blank - - VALID_TYPES = ['zipcode', 'state', 'family_id'] - - validates :type, inclusion: { in: VALID_TYPES, - message: "%{value} is not a valid exception type" } - end -end diff --git a/app/models/id_card/field_exception.rb b/app/models/id_card/field_exception.rb new file mode 100644 index 0000000..14e8d4e --- /dev/null +++ b/app/models/id_card/field_exception.rb @@ -0,0 +1,35 @@ +module IdCard + class FieldException < ApplicationRecord + belongs_to :configuration + has_many :field_exception_items, dependent: :destroy + accepts_nested_attributes_for :field_exception_items, allow_destroy: true, reject_if: :all_blank + + VALID_TYPES = ['zipcode', 'state', 'family_id'] + + validates :exception_type, inclusion: { in: VALID_TYPES, + message: "%{value} is not a valid exception type" } + + + class << self + + def permitted_params(params) + params.require(:id_card_configuration).permit( + field_exceptions_attributes: [ + :exception_type, + :exception_value, + :_destroy, + field_exception_items_attributes: [ + :field_name, + :field_value, + :network_logo_id, + :provider_section_id, + :_destroy + ] + ] + ) + end + + end + + end +end diff --git a/app/models/id_card/exception_item.rb b/app/models/id_card/field_exception_item.rb similarity index 100% rename from app/models/id_card/exception_item.rb rename to app/models/id_card/field_exception_item.rb diff --git a/app/models/id_card/network_logo.rb b/app/models/id_card/network_logo.rb index be4c67c..1f5905a 100644 --- a/app/models/id_card/network_logo.rb +++ b/app/models/id_card/network_logo.rb @@ -1,13 +1,31 @@ module IdCard class NetworkLogo < ApplicationRecord - before_save :round_aspect_ratio + before_validation :calculate_aspect_ratio, if: :image_data_changed? + + scope :defaults, -> { where(default: true) } + + class << self + + def medcost + defaults.where("filename LIKE ?", "%Medcost%") + end + + def cigna + defaults.where("filename LIKE ?", "%Cigna%") + end + + end private - def round_aspect_ratio - if self.aspect_ratio.present? - self.aspect_ratio = self.aspect_ratio.round(2) + def calculate_aspect_ratio + image_io = StringIO.new(image_data) + width, height = FastImage.size(image_io) + image_ratio = width.to_f / height + if image_ratio + self.aspect_ratio = image_ratio.round(2) end end + end end diff --git a/app/models/id_card/plan.rb b/app/models/id_card/plan.rb index fea15b3..6caac56 100644 --- a/app/models/id_card/plan.rb +++ b/app/models/id_card/plan.rb @@ -1,27 +1,68 @@ module IdCard class Plan < ApplicationRecord - belongs_to :setup + belongs_to :configuration, optional: true has_many :plan_benefits, dependent: :destroy accepts_nested_attributes_for :plan_benefits, allow_destroy: true, reject_if: :all_blank - # after_initialize :create_default_benefits, if: :new_record? + scope :templates, -> { where(template: true) } + BENEFIT_FIELDS = ["Primary Visit", + "Specialist Visit", + "Urgent Care", + "INN-Ind Ded", + "INN-Family Ded", + "OON-Ind Ded", + "OON-Family Ded", + "Co-Insurance", + "INN-Ind OOP", + "INN-Family OOP", + "OON-Ind OOP", + "OON-Family OOP", + "Emergency Room", + "Preventive Care"].freeze - def self.permitted_params(params) - params.require(:id_card_plan).permit( - :title, - :pb_product_key, - :pl_plan_key, - :_destroy, - id_card_plan_benefits_attributes: [ - :id, - :benefit_desc, - :benefit, - :sequence, - :_destroy, - ] - ) + after_initialize :build_plan_benefits, if: :new_record? + + def build_plan_benefits + BENEFIT_FIELDS.each_with_index do |bene, i| + self.plan_benefits.build(benefit_desc: bene, sequence: (i + 1)) end + end + + def format_template + formatted_title = title + if pl_plan_key.present? + employer_name = Employer.find_by(pl_plan_key: pl_plan_key).pluck(:name) + formatted_title.concat( " (#{employer_name})" ) + end + { id: id, title: formatted_title } + end + + class << self + + # def templates + # active_templates.map(&:format_template) + # end + + def permitted_params(params) + params.require(:id_card_configuration).permit( + plans_attributes: [ + :title, + :pb_product_key, + :pl_plan_key, + :_destroy, + plan_benefits_attributes: [ + :id, + :benefit_desc, + :benefit, + :sequence, + :_destroy, + ] + ] + ) + end + + end private diff --git a/app/models/id_card/provider_section.rb b/app/models/id_card/provider_section.rb index 21ebc7d..af11423 100644 --- a/app/models/id_card/provider_section.rb +++ b/app/models/id_card/provider_section.rb @@ -1,5 +1,36 @@ module IdCard class ProviderSection < ApplicationRecord + scope :defaults, -> { where(default: true) } + + def self.permitted_params(params) + params.require(:id_card_configuration).require(:provider_section).permit( + :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 + ) + end + end end \ No newline at end of file diff --git a/app/models/id_card/setup.rb b/app/models/id_card/setup.rb index fdf76dc..cd4a779 100644 --- a/app/models/id_card/setup.rb +++ b/app/models/id_card/setup.rb @@ -1,5 +1,5 @@ module IdCard - class Setup < ApplicationRecord + class Configuration < ApplicationRecord belongs_to :employer, class_name: 'Employer' belongs_to :employer_logo, optional: true belongs_to :network_logo, optional: true @@ -7,8 +7,17 @@ module IdCard belongs_to :rx_section, optional: true has_many :plans, dependent: :destroy + has_many :field_exceptions, dependent: :destroy - has_many :exceptions, dependent: :destroy + accepts_nested_attributes_for :plans, allow_destroy: true, reject_if: :all_blank + accepts_nested_attributes_for :field_exceptions, allow_destroy: true, reject_if: :all_blank + + attribute :queued_card_count, :integer, default: 0 + + scope :active, -> { where(active: true) } + + FORM_COLORS = ['atmosphere', 'verdigris', 'bluemana', 'cobalt'] + MODULE_COLOR = 'atmosphere' # def employer_logo_filename # self.employer_logo.filename @@ -18,13 +27,25 @@ module IdCard # self.network_logo.filename # end + def build_plan_with_default_benefits(attributes = {}) + plan = plans.new(attributes) + benefits = IdCardBenefitsTemplate.find_by(title: "BLANK").id_card_benefits.sort_by(&:sequence) + benefits.each do |ben| + plan.plan_benefits.new(benefit_desc: ben.benefit_desc, sequence: ben.sequence) + end + plan + end + def self.permitted_params(params) - params.require(:id_card_setup).permit( + params.require(:id_card_configuration).permit( :print_name, :network_provider, :card_template, :rx_group_number, - :id_card_employer_logo_id + :employer_logo_id, + :network_logo_id, + :rx_section_id, + :provider_section_id ) end end diff --git a/app/services/benefits_word_doc/map_employer_logo.rb b/app/services/benefits_word_doc/map_employer_logo.rb index 2ed07cb..59ca9d7 100644 --- a/app/services/benefits_word_doc/map_employer_logo.rb +++ b/app/services/benefits_word_doc/map_employer_logo.rb @@ -19,10 +19,9 @@ module BenefitsWordDoc filename = @employer.name_to_logo_filename(file_extension) - logo = CardLogoFile.find_or_create_by(filename: filename) do |clf| + logo = IdCard::EmployerLogo.find_or_create_by(filename: filename) do |clf| clf.image_data = image_binary clf.content_type = meme_type - clf.logo_type = "employer" end # new_logo = CardLogoFile.create!( @@ -32,16 +31,16 @@ module BenefitsWordDoc # logo_type: "employer" # ) - image_io = StringIO.new(image_binary) - width, height = FastImage.size(image_io) - image_ratio = width.to_f / height - if (0.8..1.2).cover?(image_ratio) - @employer.single_card_template = "FairosRxIDCard-Half" - else - @employer.single_card_template = "FairosRxIDCard" - end + # image_io = StringIO.new(image_binary) + # width, height = FastImage.size(image_io) + # image_ratio = width.to_f / height + # if (0.8..1.2).cover?(image_ratio) + # @employer.single_card_template = "FairosRxIDCard-Half" + # else + # @employer.single_card_template = "FairosRxIDCard" + # end - @employer.employer_logo_filename = logo.filename + @employer.id_card_configuration.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 7c49443..a9c084c 100644 --- a/app/services/benefits_word_doc/map_network_information.rb +++ b/app/services/benefits_word_doc/map_network_information.rb @@ -7,19 +7,29 @@ module BenefitsWordDoc end def call - network_matches = [] - @word_doc_section.each do |line| - if network_matches.exclude?("Cigna") && line.match?(/cigna/i) - network_matches.push("Cigna") - elsif network_matches.exclude?("Medcost") && line.match?(/medcost/i) - network_matches.push("Medcost") + # network = @word_doc_section.each do |line| + # if line.match?(/cigna/i) + # return "Cigna" + # elsif line.match?(/medcost/i) + # return "Medcost" + # end + # end + + network = @word_doc_section.find do |line| + if line.match?(/cigna/i) + break "Cigna" + elsif line.match?(/medcost/i) + break "Medcost" end end - if network_matches.length == 1 - network_provider = network_matches.first - @employer.network_provider = network_provider - @employer.default_network_logo = "#{network_provider}Logo.png" + # yellow_fruit_names_filtered = @word_doc_section.filter_map do |line| + # item[:name] if item[:color] == 'yellow' + # 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") diff --git a/app/services/employer_cards/queue_counter.rb b/app/services/employer_cards/queue_counter.rb new file mode 100644 index 0000000..bfe84b7 --- /dev/null +++ b/app/services/employer_cards/queue_counter.rb @@ -0,0 +1,13 @@ +module EmployerCards + class QueueCounter + + def initialize() + @employer_pl_plan_keys = IdCard::Configuration.active.pluck(:pl_plan_key).join(',') + end + + def call + CallStoredProc.new('HLGetQueuedIdCardsTPANewCount', { PLPlanKeys: @employer_pl_plan_keys }).call.to_ary + end + + end +end \ No newline at end of file diff --git a/app/services/image_processor.rb b/app/services/image_processor.rb index 2eff15f..fc8365e 100644 --- a/app/services/image_processor.rb +++ b/app/services/image_processor.rb @@ -1,8 +1,14 @@ class ImageProcessor + ALLOWED_LOGO_TYPES = ['Network', 'Employer'].freeze - def initialize(image_path, new_filename = nil) + def initialize(image_path, logo_type, new_filename = nil) @image_path = image_path + @logo_type = logo_type.capitalize @new_filename = new_filename + + unless ALLOWED_LOGO_TYPES.include?(@logo_type) + raise ArgumentError, "Invalid logo type: #{@logo_type}. Must be one of: #{ALLOWED_LOGO_TYPES.join(', ')}" + end end def call @@ -17,11 +23,11 @@ class ImageProcessor # binary_data = File.open(@image_path, 'rb').read meme_type = Marcel::MimeType.for Pathname.new(@image_path) - CardLogoFile.create( - filename: filename, - image_data: binary_data, - content_type: meme_type, - logo_type: "employer" - ) + logo_model = "IdCard::#{@logo_type}Logo".constantize + + logo_model.find_or_create_by(filename: filename) do |logo| + logo.image_data = binary_data + logo.content_type = meme_type + end end end \ No newline at end of file diff --git a/app/services/sample_card/data_formatter.rb b/app/services/sample_card/data_formatter.rb index b16754f..56112b3 100644 --- a/app/services/sample_card/data_formatter.rb +++ b/app/services/sample_card/data_formatter.rb @@ -32,7 +32,7 @@ module SampleCard def set_plan_fields plans_sample_cards = [] - @employer.plans.each do |plan| + @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 @@ -56,7 +56,7 @@ module SampleCard end def set_network_fields - selected_attributes = @employer.card_provider.attributes.with_indifferent_access.slice( + 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, @@ -71,7 +71,7 @@ module SampleCard def set_rx_fields # fairos_information = Vhcs::HlrxCrosRef.where(pl_plan_key: 52).first - selected_attributes = @employer.card_rx.attributes.with_indifferent_access.slice( + selected_attributes = @employer.id_card_configuration.rx_section.attributes.with_indifferent_access.slice( :customer_service, :web_url ) diff --git a/app/views/employer_setup/_first_plan_fields.html.erb b/app/views/employer_setup/_first_plan_fields.html.erb index 5c36417..5e3eb78 100644 --- a/app/views/employer_setup/_first_plan_fields.html.erb +++ b/app/views/employer_setup/_first_plan_fields.html.erb @@ -4,8 +4,8 @@ <% end %>
-
rounded-bl-lg">
-
-ml-[6px] z-2 w-full"> +
rounded-bl-lg">
+
-ml-[6px] z-2 w-full"> <%= "Plan #{i + 1}" %>
diff --git a/app/views/employer_setup/edit.html.erb b/app/views/employer_setup/edit.html.erb index 40d73c5..09c8d7e 100644 --- a/app/views/employer_setup/edit.html.erb +++ b/app/views/employer_setup/edit.html.erb @@ -1,6 +1,6 @@

Edit Employer

- <%= form_with model: @employer_setup, url: employer_setup_index_path, local: true, multipart: true do |f| %> + <%= form_with model: @employer_configuration, url: employer_configuration_index_path, local: true, multipart: true do |f| %>

General Information

@@ -51,17 +51,17 @@

Plans Information

-
+
- <% @employer_setup.plans.each_with_index do |plan, index| %> + <% @employer_configuration.plans.each_with_index do |plan, index| %> <%= f.fields_for :plans, plan, child_index: index do |plan_fields| %>
-
">
-
-ml-[6px] z-2 w-full"> +
">
+
-ml-[6px] z-2 w-full"> <%= "Plan #{index + 1}" %>
<%= render 'plan_fields', plan_fields: plan_fields, f: f, index: index %> -
"> +
"> Benefit Values
ml-[3px]">
@@ -106,7 +106,7 @@

Alternative Network Information

-
+
<%= button_tag "Add a Regional Logo", class: "cursor-pointer text-lg font-medium py-2 px-4 rounded w-1/7 h-75 my-8 text-[#E0E0E0] rounded-lg border border-[#C2C2C2] hover:shadow-[0_0_10px_3px_#93c5fd]", data: { action: "add-alt-network-logo#add", add_alt_network_logo_target: "button" } %>
diff --git a/app/views/employer_setup/index.html.erb b/app/views/employer_setup/index.html.erb index 5dbbcfb..a14b1d2 100644 --- a/app/views/employer_setup/index.html.erb +++ b/app/views/employer_setup/index.html.erb @@ -1,6 +1,6 @@

Employer Setups

- <% plan_colors = EmployerSetupPlansForm::PLAN_COLORS.push('copper', 'bronze').shuffle %> + <% plan_colors = IdCard::Configuration::FORM_COLORS.push('copper', 'bronze').shuffle %> <% @employer_setups.each_with_index do |es, index| %> <% item_color_index = index == 0 ? 0 : index % plan_colors.length %>
"> diff --git a/app/views/employer_setup/network_exceptions.html.erb b/app/views/employer_setup/network_exceptions.html.erb index f577c56..478dc55 100644 --- a/app/views/employer_setup/network_exceptions.html.erb +++ b/app/views/employer_setup/network_exceptions.html.erb @@ -1,4 +1,4 @@ -
+

New Employer Setup

Provider Network

<%= form_with model: @form, url: employer_setup_index_path, local: true do |f| %> diff --git a/app/views/employer_setup/new.html.erb b/app/views/employer_setup/new.html.erb index 7fabfb4..b624e2f 100644 --- a/app/views/employer_setup/new.html.erb +++ b/app/views/employer_setup/new.html.erb @@ -57,16 +57,16 @@

Plans Information

-
+
<%= f.fields_for :plans, @employer_setup.plans.first, child_index: 0 do |plan_fields| %>
-
">
-
-ml-[6px] z-2 w-full"> +
">
+
-ml-[6px] z-2 w-full"> <%= "Plan 1" %>
<%= render 'plan_fields', plan_fields: plan_fields, f: f, index: 0 %> -
"> +
"> Benefit Values
@@ -110,7 +110,7 @@

Alternative Network Information

-
+
<%= button_tag "Add a Regional Logo", class: "cursor-pointer text-lg font-medium py-2 px-4 rounded w-1/7 h-55 my-8 text-[#E0E0E0] rounded-lg border border-[#C2C2C2] hover:shadow-[0_0_10px_3px_#93c5fd]", data: { action: "add-alt-network-logo#add", add_alt_network_logo_target: "button" } %>
diff --git a/app/views/employer_setup/plans.html.erb b/app/views/employer_setup/plans.html.erb index 1bb1bf7..4c68935 100644 --- a/app/views/employer_setup/plans.html.erb +++ b/app/views/employer_setup/plans.html.erb @@ -1,4 +1,4 @@ -
+

New Employer Setup

Medical Plans

@@ -17,8 +17,8 @@
<% @form.plans.each_with_index do |plan, i| %>
-
rounded-bl-lg">
-
-ml-[6px] z-2 w-full"> +
rounded-bl-lg">
+
-ml-[6px] z-2 w-full"> <%= "Plan #{i + 1}" %>
<%= f.fields_for :plans, index: i do |plan_fields| %> diff --git a/app/views/employers/index.html.erb b/app/views/employers/index.html.erb index e1e1f55..ecf4281 100644 --- a/app/views/employers/index.html.erb +++ b/app/views/employers/index.html.erb @@ -6,7 +6,7 @@ <% end %>
- <% plan_colors = EmployerSetupPlansForm::PLAN_COLORS.push('copper', 'bronze').shuffle %> + <% plan_colors = IdCard::Configuration::FORM_COLORS.push('copper', 'bronze').shuffle %> <% @color_index = 0 %>

In Process:

<% @employers.inactive.each_with_index do |emp, index| %> diff --git a/app/views/employers/show.html.erb b/app/views/employers/show.html.erb index 8e25f44..32fc768 100644 --- a/app/views/employers/show.html.erb +++ b/app/views/employers/show.html.erb @@ -1,17 +1,20 @@
+ <%= link_to employers_path, class: "flex h-10 w-10 text-xl transition duration-100" do %> + <%= icon "arrow-big-left-dash", library: "lucide", class: "h-full w-full text-center text-bluemana hover:text-bronze" %> + <% end %>

<%= @employer.name %>

- <% if @employer&.id_card_setup&.id_card_employer_logo&.filename %> - <%= image_tag image_id_card_employer_logo_path(@employer.id_card_setup.id_card_employer_logo.filename), class: "max-h-[50px] object-contain shadow-[0_0_10px_3px_#93c5fd]" %> + <% if @employer&.id_card_configuration&.employer_logo&.filename %> + <%= image_tag image_id_card_employer_logo_path(@employer.id_card_configuration.employer_logo.id), class: "max-h-[50px] object-contain shadow-[0_0_10px_3px_#93c5fd]" %> <% end %>
-
+
-

Employer Information

-
+

Employer Information

+

"> @@ -23,7 +26,7 @@ <%= @employer.effective_date %>

- └── Key Chain + └── Key Chain
<% @employer.attributes.with_indifferent_access.slice(:pl_plan_key, :company_pb_entity_key, :group_number).each do |attribute_name, attribute_value| %>

"> @@ -31,11 +34,11 @@ <%= attribute_value.present? ? attribute_value.to_s : "waiting" %>

<% end %> - <% if @employer&.id_card_setup&.id_card_plans %> + <% if @employer&.id_card_configuration&.plans.present? %>
└── Plans
- <% @employer.id_card_setup.id_card_plans.pluck(:title, :pb_product_key).each do |plan| %> + <% @employer.id_card_configuration.plans.pluck(:title, :pb_product_key).each do |plan| %>
├── <%= plan.first %>
@@ -45,24 +48,76 @@

<% end %> <% end %> -
-
- <%= link_to 'Edit', edit_employer_path(@employer.slug), class: "hover:text-atmosphere" %> -

|

- <%= link_to 'Back', employers_path, class: "hover:text-atmosphere" %> +
+ <%= link_to 'Edit Employer', edit_employer_path(@employer.slug), data: { turbo: false }, class: "flex justify-center items-center w-full cursor-pointer bg-brightlava hover:bg-deepcove border-2 border-brightlava text-platinum text-lg font-bold px-3 rounded-lg h-10 transition duration-100" %>
-
-
-

ID Card Actions

-
+
+
+ <% module_color = IdCard::Configuration::MODULE_COLOR %> +
+

ID Card Module

+
- <%= link_to "Setup", new_id_card_setup_path(employer: @employer.slug), data: { turbo: false }, class: "flex justify-center items-center w-2/3 cursor-pointer bg-atmosphere hover:bg-deepcove border-2 border-atmosphere text-platinum font-bold px-3 rounded-lg h-10 transition duration-100" %> +
+ <% if @employer.id_card_enabled? %> +
+
+
+ Setup +
+ +
+
+ <%= link_to "General", general_employer_id_card_configuration_index_path(employer_id: @employer.slug), data: { turbo: false }, class: "flex justify-center items-center w-full cursor-pointer bg-#{module_color} hover:bg-deepcove border-2 border-#{module_color} text-platinum font-bold px-3 rounded-lg h-10 transition duration-100" %> + <%= link_to "Plans", plans_employer_id_card_configuration_index_path(employer_id: @employer.slug), data: { turbo: false }, class: "flex justify-center items-center w-full cursor-pointer bg-#{module_color} hover:bg-deepcove border-2 border-#{module_color} text-platinum font-bold px-3 rounded-lg h-10 transition duration-100" %> + <%= link_to 'Exceptions (Optional)', field_exceptions_employer_id_card_configuration_index_path(employer_id: @employer.slug ), data: { turbo: false }, class: "flex justify-center items-center w-full cursor-pointer bg-#{module_color} hover:bg-deepcove border-2 border-#{module_color} text-platinum font-bold px-3 rounded-lg h-10 transition duration-100" %> +
+
+
+
+
+ Actions +
+ +
+
+ <%= link_to 'Generate Sample Cards', generate_sample_id_card_print_data_path(employer_slug: @employer.slug ), data: { turbo: false }, class: "flex justify-center items-center w-full cursor-pointer bg-#{module_color} hover:bg-deepcove border-2 border-#{module_color} text-platinum font-bold px-3 rounded-lg h-10 transition duration-100" %> + <%= link_to 'Generate Group Cards (for print)', generate_print_id_card_print_data_path(employer_slug: @employer.slug ),data: { turbo: false }, class: "flex justify-center items-center w-full #{@employer.active ? "" : "pointer-events-none opacity-50 cursor-not-allowed"} bg-#{module_color} hover:bg-deepcove border-2 border-#{module_color} text-platinum font-bold px-3 rounded-lg h-10 transition duration-100" %> + <%= link_to 'Generate Group Cards (for display)', generate_mobile_display_id_card_print_data_path(employer_slug: @employer.slug ), data: { turbo: false }, class: "flex justify-center items-center w-full #{@employer.active ? "" : "pointer-events-none opacity-50 cursor-not-allowed"} bg-#{module_color} hover:bg-deepcove border-2 border-#{module_color} text-platinum font-bold px-3 rounded-lg h-10 transition duration-100" %> + <%= link_to 'Generate Group Cards (for download)', generate_full_page_id_card_print_data_path(employer_slug: @employer.slug ), data: { turbo: false }, class: "flex justify-center items-center w-full #{@employer.active ? "" : "pointer-events-none opacity-50 cursor-not-allowed"} bg-#{module_color} hover:bg-deepcove border-2 border-#{module_color} text-platinum font-bold px-3 rounded-lg h-10 transition duration-100" %> +
+
+ <% else %> + <%= link_to "Enable ID Card", general_employer_id_card_configuration_index_path(employer_id: @employer.slug), data: { turbo: false }, class: "flex justify-center items-center w-full h-full cursor-pointer bg-#{module_color} hover:bg-deepcove border-4 border-atmosphere text-platinum text-xl font-bold px-3 rounded-md mt-3 transition duration-100" %> + <% end %> +
+
+
+
+

Claims Check Module

+
+
+
+ <% if @employer.claims_check_enabled? %> - <%= link_to 'Generate Sample Cards', generate_sample_id_card_print_data_path(employer_slug: @employer.slug ), data: { turbo: false }, class: "flex justify-center items-center w-2/3 cursor-pointer bg-atmosphere hover:bg-deepcove border-2 border-atmosphere text-platinum font-bold px-3 rounded-lg h-10 transition duration-100" %> - <%= link_to 'Generate Group Cards (for print)', generate_print_id_card_print_data_path(employer_slug: @employer.slug ),data: { turbo: false }, class: "flex justify-center items-center w-2/3 #{@employer.active ? "" : "pointer-events-none opacity-50 cursor-not-allowed"} bg-atmosphere hover:bg-deepcove border-2 border-atmosphere text-platinum font-bold px-3 rounded-lg h-10 transition duration-100" %> - <%= link_to 'Generate Group Cards (for display)', generate_mobile_display_id_card_print_data_path(employer_slug: @employer.slug ), data: { turbo: false }, class: "flex justify-center items-center w-2/3 #{@employer.active ? "" : "pointer-events-none opacity-50 cursor-not-allowed"} bg-atmosphere hover:bg-deepcove border-2 border-atmosphere text-platinum font-bold px-3 rounded-lg h-10 transition duration-100" %> - <%= link_to 'Generate Group Cards (for download)', generate_full_page_id_card_print_data_path(employer_slug: @employer.slug ), data: { turbo: false }, class: "flex justify-center items-center w-2/3 #{@employer.active ? "" : "pointer-events-none opacity-50 cursor-not-allowed"} bg-atmosphere hover:bg-deepcove border-2 border-atmosphere text-platinum font-bold px-3 rounded-lg h-10 transition duration-100" %> + <% else %> + <%= link_to "Enable Claims Check", general_employer_id_card_configuration_index_path(employer_id: @employer.slug), data: { turbo: false }, class: "flex justify-center items-center w-full h-full cursor-pointer bg-cobalt-vivid hover:bg-deepcove border-4 border-cobalt-vivid text-platinum text-xl font-bold px-3 rounded-md mt-3 transition duration-100" %> + <% end %> +
+
+
+
+

FairosRx Eligibility Module

+
+
+
+ <% if @employer.claims_check_enabled? %> + + <% else %> + <%= link_to "Enable FairosRx Eligibility", general_employer_id_card_configuration_index_path(employer_id: @employer.slug), data: { turbo: false }, class: "flex justify-center items-center w-full h-full cursor-pointer bg-verdigris-vivid hover:bg-deepcove border-4 border-verdigris-vivid text-platinum text-xl font-bold px-3 rounded-md mt-3 transition duration-100" %> + <% end %> +
\ No newline at end of file diff --git a/app/views/employers_old/_first_plan_fields.html.erb b/app/views/employers_old/_first_plan_fields.html.erb index 5c36417..5e3eb78 100644 --- a/app/views/employers_old/_first_plan_fields.html.erb +++ b/app/views/employers_old/_first_plan_fields.html.erb @@ -4,8 +4,8 @@ <% end %>
-
rounded-bl-lg">
-
-ml-[6px] z-2 w-full"> +
rounded-bl-lg">
+
-ml-[6px] z-2 w-full"> <%= "Plan #{i + 1}" %>
diff --git a/app/views/employers_old/edit.html.erb b/app/views/employers_old/edit.html.erb index 29d520b..eec77ac 100644 --- a/app/views/employers_old/edit.html.erb +++ b/app/views/employers_old/edit.html.erb @@ -51,17 +51,17 @@

Plans Information

-
+
<% @employer.plans.each_with_index do |plan, index| %> <%= f.fields_for :plans, plan, child_index: index do |plan_fields| %>
-
">
-
-ml-[6px] z-2 w-full"> +
">
+
-ml-[6px] z-2 w-full"> <%= "Plan #{index + 1}" %>
<%= render 'plan_fields', plan_fields: plan_fields, f: f, index: index %> -
"> +
"> Benefit Values
ml-[3px]">
@@ -106,7 +106,7 @@

Alternative Network Information

-
+
<%= button_tag "Add a Regional Logo", class: "cursor-pointer text-lg font-medium py-2 px-4 rounded w-1/7 h-75 my-8 text-[#E0E0E0] rounded-lg border border-[#C2C2C2] hover:shadow-[0_0_10px_3px_#93c5fd]", data: { action: "add-alt-network-logo#add", add_alt_network_logo_target: "button" } %>
diff --git a/app/views/employers_old/index.html.erb b/app/views/employers_old/index.html.erb index e1e1f55..ecf4281 100644 --- a/app/views/employers_old/index.html.erb +++ b/app/views/employers_old/index.html.erb @@ -6,7 +6,7 @@ <% end %>
- <% plan_colors = EmployerSetupPlansForm::PLAN_COLORS.push('copper', 'bronze').shuffle %> + <% plan_colors = IdCard::Configuration::FORM_COLORS.push('copper', 'bronze').shuffle %> <% @color_index = 0 %>

In Process:

<% @employers.inactive.each_with_index do |emp, index| %> diff --git a/app/views/employers_old/network_exceptions.html.erb b/app/views/employers_old/network_exceptions.html.erb index f577c56..478dc55 100644 --- a/app/views/employers_old/network_exceptions.html.erb +++ b/app/views/employers_old/network_exceptions.html.erb @@ -1,4 +1,4 @@ -
+

New Employer Setup

Provider Network

<%= form_with model: @form, url: employer_setup_index_path, local: true do |f| %> diff --git a/app/views/employers_old/new.html.erb b/app/views/employers_old/new.html.erb index 3412b07..da0ba82 100644 --- a/app/views/employers_old/new.html.erb +++ b/app/views/employers_old/new.html.erb @@ -61,17 +61,17 @@

Plans Information

-
+
<% @employer.plans.each_with_index do |plan, index| %> <%= f.fields_for :plans, plan, child_index: index do |plan_fields| %>
-
">
-
-ml-[6px] z-2 w-full"> +
">
+
-ml-[6px] z-2 w-full"> <%= "Plan #{index + 1}" %>
<%= render 'plan_fields', plan_fields: plan_fields, f: f, index: index %> -
"> +
"> Benefit Values
ml-[3px]">
@@ -116,7 +116,7 @@

Alternative Network Information

-
+
<%= button_tag "Add a Regional Logo", class: "cursor-pointer text-lg font-medium py-2 px-4 rounded w-1/7 h-55 my-8 text-[#E0E0E0] rounded-lg border border-[#C2C2C2] hover:shadow-[0_0_10px_3px_#93c5fd]", data: { action: "add-alt-network-logo#add", add_alt_network_logo_target: "button" } %>
diff --git a/app/views/employers_old/new_new.html.erb b/app/views/employers_old/new_new.html.erb index f15a818..5707c34 100644 --- a/app/views/employers_old/new_new.html.erb +++ b/app/views/employers_old/new_new.html.erb @@ -61,17 +61,17 @@

Plans Information

-
+
<% @employer.plans.each_with_index do |plan, index| %> <%= f.fields_for :plans, plan, child_index: index do |plan_fields| %>
-
">
-
-ml-[6px] z-2 w-full"> +
">
+
-ml-[6px] z-2 w-full"> <%= "Plan #{index + 1}" %>
<%= render 'plan_fields', plan_fields: plan_fields, f: f, index: index %> -
"> +
"> Benefit Values
ml-[3px]">
@@ -116,7 +116,7 @@

ID Card Exceptions Information

-
+
<%= button_tag "Add an Exception", class: "cursor-pointer text-lg font-medium py-2 px-4 rounded w-1/7 h-35 my-8 text-[#E0E0E0] rounded-lg border border-[#C2C2C2] hover:shadow-[0_0_10px_3px_#93c5fd]", data: { action: "add-exception#addExemption", add_exception_target: "exceptionButton" } %>