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" %>
-
-
+
+ <% module_color = IdCard::Configuration::MODULE_COLOR %>
+
- <%= 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? %>
+
+
+
+ <%= 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" %>
+
+
+
+
+
+ <%= 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" } %>
<%= f.fields_for :card_exceptions, CardException.new, child_index: 'NEW_RECORD' do |exception_fields| %>
diff --git a/app/views/employers_old/plans.html.erb b/app/views/employers_old/plans.html.erb
index 1bb1bf7..4c68935 100644
--- a/app/views/employers_old/plans.html.erb
+++ b/app/views/employers_old/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/id_card/printer/index.html.erb b/app/views/id_card/printer/index.html.erb
new file mode 100644
index 0000000..0567baf
--- /dev/null
+++ b/app/views/id_card/printer/index.html.erb
@@ -0,0 +1,34 @@
+
+
+
+ ID Card Printer
+
+
+
+
+
+ <% @employer_configurations.each do |es| %>
+
+
+ <%= es.pl_plan_key %> -
+ <%= es.employer.name %>
+ (
+
">
+ <%= es.queued_card_count %>
+
+ )
+
+
+
+ <%= link_to general_employer_id_card_configuration_index_path(employer_id: es.employer.slug), class: "flex h-7 w-14 transition duration-100 #{es.queued_card_count > 0 ? "" : "pointer-events-none opacity-50 cursor-not-allowed" }" do %>
+ <%= icon "printer", library: "lucide", class: "h-full w-full text-center text-platinum bg-atmosphere hover:bg-deepcove border-2 border-atmosphere rounded-md p-0.5" %>
+ <% end %>
+
+
+ <% end %>
+
+
+ <%= link_to "Print All Queued", id_card_printer_index_path, class: "flex justify-center items-center w-1/2 h-15 text-platinum bg-cobalt-vivid hover:bg-deepcove border-2 border-cobalt-vivid rounded-lg p-2" %>
+
+
+
\ No newline at end of file
diff --git a/app/views/id_card/setup/_alt_network_logo_fields.html.erb b/app/views/id_card/setup/_alt_network_logo_fields.html.erb
new file mode 100644
index 0000000..e42bda9
--- /dev/null
+++ b/app/views/id_card/setup/_alt_network_logo_fields.html.erb
@@ -0,0 +1,16 @@
+
+
+
+ <%= exception_item_fields.select :network_logo_id, options_for_select(IdCard::NetworkLogo.pluck(:filename, :id)), { include_blank: "Select/Add Network Logo", class: "rounded-r-none flex flex-col" }, data: { exceptions_toggle_target: "dependentField", parent_value: "network_logo", logo_upload_target: "logoIdField", action: "change->logo-upload#setSelectPreview" } %>
+
+
+
+ <%= icon "image-plus", library: "lucide" %>
+
+
+
+
+
+
+ <%= exception_item_fields.file_field :network_logo_file, class: "hidden", id: "network_logo_file", data: { logo_upload_target: "previewContainer", action: "change->logo-upload#uploadLogo" }, direct_upload: true %>
+
\ No newline at end of file
diff --git a/app/views/id_card/setup/_claim_fields.html.erb b/app/views/id_card/setup/_claim_fields.html.erb
new file mode 100644
index 0000000..a1ed5e5
--- /dev/null
+++ b/app/views/id_card/setup/_claim_fields.html.erb
@@ -0,0 +1,5 @@
+<% (1..12).each do |n| %>
+
+ <%= provider_fields.text_field "claim_to_#{n}".to_sym, label: { text: "Claim To Line #{n}" }, data: { general_form_target: "providerField"}, class: "w-full" %>
+
+<% end %>
\ No newline at end of file
diff --git a/app/views/id_card/setup/_plan_benefits_fields.html.erb b/app/views/id_card/setup/_plan_benefits_fields.html.erb
new file mode 100644
index 0000000..fcbe414
--- /dev/null
+++ b/app/views/id_card/setup/_plan_benefits_fields.html.erb
@@ -0,0 +1,5 @@
+
+ <%= plan_benefits_fields.text_field :benefit, label: { text: "#{plan_benefits_fields.object.benefit_desc}" }, data: { benefits_template_picker_target: "benefit", sequence: plan_benefits_fields.object.sequence}, class: "w-full" %>
+ <%= plan_benefits_fields.hidden_field :benefit_desc %>
+ <%= plan_benefits_fields.hidden_field :sequence %>
+
\ No newline at end of file
diff --git a/app/views/id_card/setup/_plan_fields.html.erb b/app/views/id_card/setup/_plan_fields.html.erb
new file mode 100644
index 0000000..78002ef
--- /dev/null
+++ b/app/views/id_card/setup/_plan_fields.html.erb
@@ -0,0 +1,13 @@
+
+ <%= plan_fields.text_field :title, label: { text: "Plan Title" }, class: "w-full", data: { add_plan_target: "plan" } %>
+
+<% if plan_fields.object.persisted? %>
+
+ <%= plan_fields.text_field :pb_product_key, label: { text: "Plan Product Key" }, class: "w-full" %>
+
+<% end %>
+
+ <%= f.select :template_id, options_from_collection_for_select(@plan_templates, :id, :title), { prompt: "Select Plan Template", class: "w-full" }, { data: { action: "benefits-template-picker#fetchData" }} %>
+
+
+
diff --git a/app/views/id_card/setup/_provider_fields.html.erb b/app/views/id_card/setup/_provider_fields.html.erb
new file mode 100644
index 0000000..a94fb4b
--- /dev/null
+++ b/app/views/id_card/setup/_provider_fields.html.erb
@@ -0,0 +1,5 @@
+<% (1..12).each do |n| %>
+
+ <%= provider_fields.text_field "provider_line_#{n}".to_sym, label: { text: "Provider Line #{n}" }, data: { general_form_target: "providerField"}, class: "w-full" %>
+
+<% end %>
\ No newline at end of file
diff --git a/app/views/id_card/setup/edit.html.erb b/app/views/id_card/setup/edit.html.erb
deleted file mode 100644
index 16ad5a3..0000000
--- a/app/views/id_card/setup/edit.html.erb
+++ /dev/null
@@ -1,34 +0,0 @@
-
-
Edit Employer
- <%= form_with model: @employer, local: true, multipart: true do |f| %>
-
-
-
-
-
- <%= f.text_field :name, label: { text: "Employer Name" }, class: "w-full" %>
-
-
- <%= f.text_field :slug, label: { text: "Slug" }, class: "w-full" %>
-
-
- <%= f.text_field :group_number, label: { text: "Group/Medical Number" }, class: "w-full" %>
-
-
-
-
- <%= f.text_field :pl_plan_key, label: { text: "Pl Plan Key" }, class: "w-full" %>
-
-
- <%= f.text_field :effective_date, label: { text: "Effective Date" }, class: "w-full" %>
-
-
-
-
-
- <%= f.submit "Save Employer" %>
- <%= link_to "Back", employer_path(@employer.slug), class: "flex justify-center items-center cursor-pointer bg-atmosphere hover:bg-deepcove border-2 border-atmosphere text-platinum font-bold px-3 rounded-sm h-10 transition duration-100" %>
-
-
- <% end %>
-
diff --git a/app/views/id_card/setup/field_exceptions.html.erb b/app/views/id_card/setup/field_exceptions.html.erb
new file mode 100644
index 0000000..6511c95
--- /dev/null
+++ b/app/views/id_card/setup/field_exceptions.html.erb
@@ -0,0 +1,119 @@
+
+
+
ID Card Exceptions:
+ (<%= @employer.name %>)
+
+ <%= form_with model: @configuration, url: update_field_exceptions_employer_id_card_configuration_index_path(@employer.slug), local: true, multipart: true do |f| %>
+
+
+
+ <% @configuration.field_exceptions.each_with_index do |exc, index| %>
+ <%= f.fields_for :field_exceptions, exc, child_index: index do |exception_fields| %>
+
+
+
+ <%= exception_fields.select :exception_type, options_for_select(IdCard::FieldException::VALID_TYPES.map { |type| [type.titleize(keep_id_suffix: true), type] }), { label: { text: "Exception Based On" }, prompt: "Select Type", class: "w-full" }, data: { add_exception_target: "exception" } %>
+
+
+ <%= exception_fields.text_field :exception_value, label: { text: "Exception Value" }, class: "w-full" %>
+
+
+
+ Field Exception Items
+
+
+
+ <%= exception_fields.fields_for :field_exception_items do |exception_item_fields| %>
+
+
+ <%= exception_item_fields.select :field_name, options_for_select(IdCard::FieldExceptionItem::VALID_FIELD_NAMES.map { |field_name| [field_name.titleize, field_name] }, exception_item_fields.object.field_name ), { label: { text: "Card Field" }, prompt: "Select Card Field", class: "w-full" }, { data: { action: "change->exceptions-toggle#toggleFields", add_exception_item_target: "exceptionItem", exceptions_toggle_target: "selectField" } } %>
+
+
+ <%= exception_item_fields.text_field :field_value, value: exception_item_fields.object.field_value, label: { text: "New Value" }, data: { exceptions_toggle_target: "dependentField", parent_value: "default" }, class: "w-full" %>
+
+ <%= render 'alt_network_logo_fields', exception_item_fields: exception_item_fields %>
+
+ <%= exception_item_fields.select :provider_section_id, options_for_select(IdCard::ProviderSection.where.not(title: nil).map { |provider| [provider.title, provider.id] }, exception_item_fields.object.provider_section_id), { prompt: "Select Provider Template", class: "w-full" }, { data: { exceptions_toggle_target: "dependentField", parent_value: "provider_section" } } %>
+
+
+ <%= exception_item_fields.hidden_field :_destroy %>
+ <%= button_tag "Remove", class: "cursor-pointer flex items-center justify-center bg-brightlava font-bold text-lg text-platinum py-[6px] px-1 font-semibold leading-tight rounded-lg border-3 border-brightlava w-full", data: { action: "add-exception-item#removeExemptionItem" } %>
+
+
+ <% end %>
+ <%= button_tag "Add Another Item To Exception", class: "cursor-pointer bg-NEXT_COLOR hover:bg-deepcove text-xl font-bold text-platinum my-3 py-1 font-semibold leading-tight rounded border-3 border-NEXT_COLOR w-full", data: { action: "add-exception-item#addExemptionItem", add_exception_item_target: "exceptionItemButton" } %>
+
+ <%= exception_fields.fields_for :field_exception_items, IdCard::FieldExceptionItem.new, child_index: 'NEW_ITEM_RECORD' do |exception_item_fields| %>
+
+
+ <%= exception_item_fields.select :field_name, options_for_select(IdCard::FieldExceptionItem::VALID_FIELD_NAMES.map { |field_name| [field_name.titleize, field_name] }), { label: { text: "Card Field" }, prompt: "Select Card Field", class: "w-full" }, { data: { action: "change->exceptions-toggle#toggleFields", add_exception_item_target: "exceptionItem", exceptions_toggle_target: "selectField" } } %>
+
+
+ <%= exception_item_fields.text_field :field_value, label: { text: "New Value" }, data: { exceptions_toggle_target: "dependentField", parent_value: "default" }, class: "w-full" %>
+
+ <%= render 'alt_network_logo_fields', exception_item_fields: exception_item_fields %>
+
+ <%= exception_item_fields.select :provider_section_id, options_for_select(IdCard::ProviderSection.where.not(title: nil).map { |provider| [provider.title, provider.id] }), { prompt: "Select Provider Template", class: "w-full" }, { data: { exceptions_toggle_target: "dependentField", parent_value: "provider_section" } } %>
+
+
+ <%= exception_item_fields.hidden_field :_destroy %>
+ <%= button_tag "Remove", class: "cursor-pointer flex items-center justify-center bg-brightlava font-bold text-lg text-platinum py-[6px] px-1 font-semibold leading-tight rounded-lg border-3 border-brightlava w-full", data: { action: "add-exception-item#removeExemptionItem" } %>
+
+
+ <% end %>
+
+
+
+
+ <% end %>
+ <% end %>
+ <%= button_tag "Add an Exception", class: "cursor-pointer text-lg font-medium py-2 px-4 rounded w-1/2 h-4/5 mt-3 text-[#E0E0E0] rounded-lg border border-[#C2C2C2] hover:shadow-[0_0_10px_3px_#93c5fd]", data: { action: "add-exception#addExemption", add_exception_target: "exceptionButton" } %>
+
+ <%= f.fields_for :field_exceptions, @configuration.field_exceptions.build, child_index: 'NEW_RECORD' do |exception_fields| %>
+
+
+
+ <%= exception_fields.select :exception_type, options_for_select(IdCard::FieldException::VALID_TYPES.map { |type| [type.titleize(keep_id_suffix: true), type] }), { label: { text: "Exception Based On" }, prompt: "Select Type", class: "w-full" }, data: { add_exception_target: "exception" } %>
+
+
+ <%= exception_fields.text_field :exception_value, label: { text: "Exception Value" }, class: "w-full" %>
+
+
+
+ Field Exception Items
+
+
+
+ <%= button_tag "Add Another Item To Exception", class: "cursor-pointer bg-NEXT_COLOR hover:bg-deepcove text-xl font-bold text-platinum my-3 py-1 font-semibold leading-tight rounded border-3 border-NEXT_COLOR w-full", data: { action: "add-exception-item#addExemptionItem", add_exception_item_target: "exceptionItemButton" } %>
+
+ <%= exception_fields.fields_for :field_exception_items, IdCard::FieldExceptionItem.new, child_index: 'NEW_ITEM_RECORD' do |exception_item_fields| %>
+
+
+ <%= exception_item_fields.select :field_name, options_for_select(IdCard::FieldExceptionItem::VALID_FIELD_NAMES.map { |field_name| [field_name.titleize, field_name] }), { label: { text: "Card Field" }, prompt: "Select Card Field", class: "w-full" }, { data: { action: "change->exceptions-toggle#toggleFields", add_exception_item_target: "exceptionItem", exceptions_toggle_target: "selectField" } } %>
+
+
+ <%= exception_item_fields.text_field :field_value, label: { text: "New Value" }, data: { exceptions_toggle_target: "dependentField", parent_value: "default" }, class: "w-full" %>
+
+ <%= render 'alt_network_logo_fields', exception_item_fields: exception_item_fields %>
+
+ <%= exception_item_fields.select :provider_section_id, options_for_select(IdCard::ProviderSection.where.not(title: nil).map { |provider| [provider.title, provider.id] }), { prompt: "Select Provider Template", class: "w-full" }, { data: { exceptions_toggle_target: "dependentField", parent_value: "provider_section" } } %>
+
+
+ <%= exception_item_fields.hidden_field :_destroy %>
+ <%= button_tag "Remove", class: "cursor-pointer flex items-center justify-center bg-brightlava font-bold text-lg text-platinum py-[6px] px-1 font-semibold leading-tight rounded-lg border-3 border-brightlava w-full", data: { action: "add-exception-item#removeExemptionItem" } %>
+
+
+ <% end %>
+
+
+
+ <% end %>
+
+
+
+
+ <%= f.submit "Submit Network" %>
+
+
+ <% end %>
+
diff --git a/app/views/id_card/setup/general.html.erb b/app/views/id_card/setup/general.html.erb
new file mode 100644
index 0000000..bcbf57b
--- /dev/null
+++ b/app/views/id_card/setup/general.html.erb
@@ -0,0 +1,93 @@
+
+
+
ID Card Setup:
+ (<%= @employer.name %>)
+
+ <%= form_with model: @configuration, url: update_general_employer_id_card_configuration_index_path(@employer.slug), local: true, multipart: true do |f| %>
+
+
+
+
+
+ <%= f.text_field :print_name, label: { text: "Print Name" }, class: "w-full" %>
+
+
+ <%= f.text_field :rx_group_number, label: { text: "Rx Group Number" }, class: "w-full" %>
+
+
+
+
+ <%= f.select :network_provider, options_for_select(["Cigna", "Medcost", "Other"], @configuration.network_provider), { label: { text: "Provider Network" }, include_blank: "Select", class: "w-full" }, data: { provider_update_target: "providerNetworkField", action: "change->provider-update#syncDefaults" } %>
+
+
+ <%= f.select :card_template, options_for_select([["FairosRx", "FairosRxIDCard"], ["Tandemloc", "TandemlocIDCard"], ["smART", "SmartIDCard"], ["QRCode (Healthbus)", "QRCodeIDCard"]], @configuration.card_template || "FairosRxIDCard" ), { label: { text: "Card Template" }, include_blank: "Select", class: "w-full" } %>
+
+
+
+
>
+
+
+ <%= f.text_field :employer_logo_filename, label: { text: "Employer Logo" }, default: "No logo added", data: { logo_upload_target: "logoNameField" }, class: "w-full rounded-r-none", readonly: true %>
+
+
+
+ <%= icon "image-plus", library: "lucide" %>
+
+
+
+
+
+
+ <%= f.hidden_field :employer_logo_id, label: { text: "Employer Logo" }, data: { logo_upload_target: "logoIdField" } %>
+ <%= f.file_field :employer_logo_file, class: "hidden", id: "employer_logo_file", data: { logo_upload_target: "previewContainer", action: "change->logo-upload#uploadLogo" }, direct_upload: true %>
+
+
+
+
+
+ <%= f.select :network_logo_id, options_for_select(IdCard::NetworkLogo.pluck(:filename, :id), @configuration.network_logo_id), { include_blank: "Select/Add Network Logo", class: "rounded-r-none flex flex-col" }, data: { provider_update_target: "networkLogoField", logo_upload_target: "logoIdField", action: "change->logo-upload#setSelectPreview" } %>
+
+
+
+ <%= icon "image-plus", library: "lucide" %>
+
+
+
+
+
+
+ <%= f.file_field :network_logo_file, class: "hidden", id: "network_logo_file", data: { logo_upload_target: "previewContainer", action: "change->logo-upload#uploadLogo" }, direct_upload: true %>
+
+
+
+
+ <%= f.select :rx_section_id, options_from_collection_for_select(@rx_options, :id, :title, @configuration.rx_section_id || @fairos_rx_id), { include_blank: "Select Rx", class: "flex-col w-full" } %>
+
+
+ <%= f.select :provider_section_id, options_for_select(@provider_options, @configuration.provider_section_id), { label: { text: "Claims Submission Section" }, include_blank: "Select/Add Claims Submission", class: "flex flex-col w-full" }, data: { provider_update_target: "providerSectionField", general_form_target: "selectField", action: "change->general-form#toggleNewFieldSection" } %>
+
+
+
+
+ New Claims Submission Section
+
+ <%= f.fields_for :provider_section do |provider_fields| %>
+
+
+ <%= render 'claim_fields', provider_fields: provider_fields %>
+
+
+ <%= render 'provider_fields', provider_fields: provider_fields %>
+
+
+ <% end %>
+
+
+
+
+
+ <%= f.submit "Create ID Card Setup" %>
+
+
+ <% end %>
+
diff --git a/app/views/id_card/setup/network.html.erb b/app/views/id_card/setup/network.html.erb
new file mode 100644
index 0000000..c269622
--- /dev/null
+++ b/app/views/id_card/setup/network.html.erb
@@ -0,0 +1,57 @@
+
+
+
ID Card Network:
+ (<%= @employer.name %>)
+
+ <%= form_with model: @configuration, url: update_network_employer_id_card_configuration_index_path(@employer.slug), local: true, multipart: true do |f| %>
+
+
+
+
+
+
+
+ <%= f.select :network_logo_id, options_for_select(IdCard::NetworkLogo.pluck(:filename)), { include_blank: "Select/Add Network Logo", class: "rounded-r-none flex flex-col" }, data: { logo_upload_target: "logoField" } %>
+
+
+
+ <%= icon "image-plus", library: "lucide" %>
+
+
+
+
+
+
+ <%= f.file_field :logo_file, class: "hidden", id: "employer_logo_file", data: { logo_upload_target: "previewContainer", parent_value: "network_logo", action: "change->logo-upload#uploadLogo" }, direct_upload: true %>
+
+
+
+
+
+ <%= f.select :provider_section_id, options_from_collection_for_select(@provider_sections, :id, :title), { include_blank: "Select/Add Network Provider Info", class: "rounded-r-none flex flex-col" }, data: { logo_upload_target: "logoField" } %>
+
+
+ <%= f.select :rx_section_id, options_from_collection_for_select(@rx_sections, :id, :title), { include_blank: "Select Rx Info", class: "rounded-r-none flex flex-col" } %>
+
+
+ Claims Submission Section
+
+
+
+ <%= render 'provider_fields', f: f %>
+
+
+ <%= render 'claim_fields', f: f %>
+
+
+
+
+
+
+
+
+ <%= f.submit "Submit Network" %>
+
+
+ <% end %>
+
diff --git a/app/views/id_card/setup/new.html.erb b/app/views/id_card/setup/new.html.erb
index 71fad9a..001d23b 100644
--- a/app/views/id_card/setup/new.html.erb
+++ b/app/views/id_card/setup/new.html.erb
@@ -1,10 +1,9 @@
New ID Card Setup:
- (<%= @employer.name %>)
+ (<%= @employer.name %>)
<%= form_with model: @setup, local: true, multipart: true do |f| %>
- <%= form_with model: @employer, url: import_employers_path, data: { turbo: false }, local: true, multipart: true do |form| %>
>
diff --git a/app/views/id_card/setup/plans.html.erb b/app/views/id_card/setup/plans.html.erb
new file mode 100644
index 0000000..6b1698d
--- /dev/null
+++ b/app/views/id_card/setup/plans.html.erb
@@ -0,0 +1,63 @@
+
+
+
ID Card Plans:
+ (<%= @employer.name %>)
+
+ <%= form_with model: @configuration, url: update_plans_employer_id_card_configuration_index_path(@employer.slug), local: true, multipart: true do |f| %>
+
+
+
+ <% @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">
+ <%= "Plan #{index + 1}" %>
+
+ <%= render 'plan_fields', plan_fields: plan_fields, f: f, index: index %>
+
">
+ Benefit Values
+
+
ml-[3px]">
+ <%= plan_fields.fields_for :plan_benefits do |plan_benefits_fields| %>
+ <%= render 'plan_benefits_fields', plan_benefits_fields: plan_benefits_fields %>
+ <% end %>
+
+ <%= plan_fields.hidden_field :_destroy %>
+ <%= button_tag "Remove Plan #{index + 1}", class: "cursor-pointer bg-deepcove hover:bg-brightlava text-xl font-bold text-copper hover:text-platinum py-2 px-4 font-semibold leading-tight rounded-lg border-3 border-copper w-full", data: { action: "add-plan#remove" } %>
+
+
+ <% end %>
+ <% end %>
+ <%= button_tag "Add a Plan", class: "cursor-pointer text-2xl font-bold py-2 pr-6 mt-10 w-[calc(24%-1rem)] w-1/4 min-h-[940px] text-[#E0E0E0] rounded-lg font-medium border border-[#E0E0E0] bg-[#173057] hover:bg-transparent hover:shadow-[0_0_10px_3px_#93c5fd] transition-colors duration-150", data: { action: "add-plan#add", add_plan_target: "button" } %>
+
+
+ <%= f.fields_for :plans, @configuration.plans.build, child_index: 'NEW_RECORD' do |plan_fields| %>
+
+
+
+ <%= "Plan NEW_PLAN" %>
+
+ <%= render 'plan_fields', plan_fields: plan_fields, f: f, index: "NEW_RECORD".to_i %>
+
+ Benefit Values
+
+
+ <%= plan_fields.fields_for :plan_benefits do |plan_benefits_fields| %>
+ <%= render 'plan_benefits_fields', plan_benefits_fields: plan_benefits_fields %>
+ <% end %>
+
+ <%= plan_fields.hidden_field :_destroy %>
+ <%= button_tag "Remove Plan NEW_PLAN", class: "cursor-pointer bg-deepcove hover:bg-brightlava text-xl font-bold text-NEXT_SECONDARY_COLOR hover:text-platinum py-2 px-4 font-semibold leading-tight rounded-lg border-3 border-NEXT_SECONDARY_COLOR w-full", data: { action: "add-plan#remove" } %>
+
+
+ <% end %>
+
+
+
+
+ <%= f.submit "Submit Plans" %>
+
+
+ <% end %>
+
diff --git a/app/views/welcome/tailwind_colors.html.erb b/app/views/welcome/tailwind_colors.html.erb
index 168ecc9..d082ed4 100644
--- a/app/views/welcome/tailwind_colors.html.erb
+++ b/app/views/welcome/tailwind_colors.html.erb
@@ -14,5 +14,7 @@
co
co
co
-
co
+
co
+
co
+
co
diff --git a/config/database.yml b/config/database.yml
index b2faefa..a79b61a 100644
--- a/config/database.yml
+++ b/config/database.yml
@@ -34,8 +34,8 @@ development:
# tds_version: 7.3
vhcs:
<<: *default
- host: 10.41.82.72 #Prod
- # host: 10.41.82.73 #Dev
+ # host: 10.41.82.72 #Prod
+ host: 10.41.82.73 #Dev
port: 1433
database: VHCS_HIPAA
username: BSTI
diff --git a/config/routes.rb b/config/routes.rb
index f05a4dc..3aeb98a 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -2,15 +2,17 @@
Rails.application.routes.draw do
namespace :id_card do
- resources :setup
resources :rx_sections
- resources :provider_sections
+ resources :provider_sections do
+ get 'get_section_data', on: :member
+ end
resources :employer_logos do
get 'image', on: :member
end
resources :network_logos do
- get 'image', on: :member, constraints: { id: /.*/ }
+ get 'image', on: :member
end
+ resources :printer, only: [:index]
resources :print_data do
collection do
get 'generate_sample'
@@ -19,15 +21,27 @@ Rails.application.routes.draw do
get 'generate_full_page'
end
end
+ get 'plans/:id/get_plan_benefits', to: 'plans#get_plan_benefits'
end
# resources :employer_setup
resources :employers do
collection do
post 'import'
end
+ namespace :id_card do
+ resources :setup, only: [:destroy] do
+ collection do
+ get 'general'
+ patch 'update_general'
+ get 'plans'
+ patch 'update_plans'
+ get 'field_exceptions'
+ patch 'update_field_exceptions'
+ end
+ end
+ end
end
- get 'id_card_benefits_templates/get_template_benefits/:id', to: 'id_card_benefits_templates#get_template_benefits'
# Reveal health status on /up that returns 200 if the app boots with no exceptions, otherwise 500.
# Can be used by load balancers and uptime monitors to verify that the app is live.
diff --git a/db/migrate/20251202144134_create_id_card_provider_sections.rb b/db/migrate/20251202144134_create_id_card_provider_sections.rb
index f03e3fe..af2f475 100644
--- a/db/migrate/20251202144134_create_id_card_provider_sections.rb
+++ b/db/migrate/20251202144134_create_id_card_provider_sections.rb
@@ -43,6 +43,7 @@ class CreateIdCardProviderSections < ActiveRecord::Migration[7.2]
t.string :precert_4
t.string :precert_5
t.string :precert_6
+ t.boolean :default, default: false
t.timestamps
end
diff --git a/db/migrate/20251202152220_create_id_card_rx_sections.rb b/db/migrate/20251202152220_create_id_card_rx_sections.rb
index 6f01e46..5ae99ca 100644
--- a/db/migrate/20251202152220_create_id_card_rx_sections.rb
+++ b/db/migrate/20251202152220_create_id_card_rx_sections.rb
@@ -1,6 +1,7 @@
class CreateIdCardRxSections < ActiveRecord::Migration[7.2]
def change
create_table :id_card_rx_sections do |t|
+ t.string :title
t.string :help_desk
t.string :customer_service
t.string :web_url
diff --git a/db/migrate/20251203091559_create_id_card_network_logos.rb b/db/migrate/20251203091559_create_id_card_network_logos.rb
index b6dbe5e..71bce74 100644
--- a/db/migrate/20251203091559_create_id_card_network_logos.rb
+++ b/db/migrate/20251203091559_create_id_card_network_logos.rb
@@ -5,6 +5,7 @@ class CreateIdCardNetworkLogos < ActiveRecord::Migration[7.2]
t.binary :image_data
t.string :content_type
t.float :aspect_ratio
+ t.boolean :default, default: false
t.boolean :active, default: false
t.timestamps
diff --git a/db/migrate/20251204041154_create_id_card_setups.rb b/db/migrate/20251204041154_create_id_card_configurations.rb
similarity index 82%
rename from db/migrate/20251204041154_create_id_card_setups.rb
rename to db/migrate/20251204041154_create_id_card_configurations.rb
index 3683d5f..b0bec5d 100644
--- a/db/migrate/20251204041154_create_id_card_setups.rb
+++ b/db/migrate/20251204041154_create_id_card_configurations.rb
@@ -1,10 +1,11 @@
-class CreateIdCardSetups < ActiveRecord::Migration[7.2]
+class CreateIdCardConfigurations < ActiveRecord::Migration[7.2]
def change
- create_table :id_card_setups do |t|
+ create_table :id_card_configurations do |t|
t.string :print_name
t.string :network_provider
t.string :card_template
t.string :rx_group_number
+ t.string :pl_plan_key
t.boolean :active, default: false
t.belongs_to :employer, null: false, foreign_key: true
t.belongs_to :employer_logo, null: true, foreign_key: { to_table: :id_card_employer_logos }
diff --git a/db/migrate/20251204142443_create_id_card_plans.rb b/db/migrate/20251204142443_create_id_card_plans.rb
index 79d10c1..486b02d 100644
--- a/db/migrate/20251204142443_create_id_card_plans.rb
+++ b/db/migrate/20251204142443_create_id_card_plans.rb
@@ -5,7 +5,7 @@ class CreateIdCardPlans < ActiveRecord::Migration[7.2]
t.integer :pb_product_key
t.string :pl_plan_key
t.boolean :template
- t.belongs_to :setup, null: true, foreign_key: { to_table: :id_card_setups }
+ t.belongs_to :configuration, null: true, foreign_key: { to_table: :id_card_configurations }
t.timestamps
end
diff --git a/db/migrate/20260116181849_create_id_card_exceptions.rb b/db/migrate/20260116181849_create_id_card_exceptions.rb
deleted file mode 100644
index 98d7540..0000000
--- a/db/migrate/20260116181849_create_id_card_exceptions.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-class CreateIdCardExceptions < ActiveRecord::Migration[7.2]
- def change
- create_table :id_card_exceptions do |t|
- t.string :type
- t.string :value
- t.belongs_to :setup, null: false, foreign_key: { to_table: :id_card_setups }
-
- t.timestamps
- end
- end
-end
diff --git a/db/migrate/20260116181849_create_id_card_field_exceptions.rb b/db/migrate/20260116181849_create_id_card_field_exceptions.rb
new file mode 100644
index 0000000..43b902e
--- /dev/null
+++ b/db/migrate/20260116181849_create_id_card_field_exceptions.rb
@@ -0,0 +1,11 @@
+class CreateIdCardFieldExceptions < ActiveRecord::Migration[7.2]
+ def change
+ create_table :id_card_field_exceptions do |t|
+ t.string :exception_type
+ t.string :exception_value
+ t.belongs_to :configuration, null: false, foreign_key: { to_table: :id_card_configurations }
+
+ t.timestamps
+ end
+ end
+end
diff --git a/db/migrate/20260116182836_create_id_card_exception_items.rb b/db/migrate/20260116182836_create_id_card_field_exception_items.rb
similarity index 57%
rename from db/migrate/20260116182836_create_id_card_exception_items.rb
rename to db/migrate/20260116182836_create_id_card_field_exception_items.rb
index ed71b2c..652130f 100644
--- a/db/migrate/20260116182836_create_id_card_exception_items.rb
+++ b/db/migrate/20260116182836_create_id_card_field_exception_items.rb
@@ -1,9 +1,9 @@
-class CreateIdCardExceptionItems < ActiveRecord::Migration[7.2]
+class CreateIdCardFieldExceptionItems < ActiveRecord::Migration[7.2]
def change
- create_table :id_card_exception_items do |t|
+ create_table :id_card_field_exception_items do |t|
t.string :field_name
t.string :field_value
- t.belongs_to :exception, null: false, foreign_key: { to_table: :id_card_exceptions }
+ t.belongs_to :field_exception, null: false, foreign_key: { to_table: :id_card_field_exceptions }
t.belongs_to :network_logo, null: true, foreign_key: { to_table: :id_card_network_logos }
t.belongs_to :provider_section, null: true, foreign_key: { to_table: :id_card_provider_sections }
diff --git a/db/schema.rb b/db/schema.rb
index b9ba7d8..16c2265 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -34,26 +34,26 @@ ActiveRecord::Schema[7.2].define(version: 2026_01_16_182836) do
t.datetime "updated_at", null: false
end
- create_table "id_card_exception_items", force: :cascade do |t|
+ create_table "id_card_field_exception_items", force: :cascade do |t|
t.string "field_name"
t.string "field_value"
- t.bigint "exception_id", null: false
+ t.bigint "field_exception_id", null: false
t.bigint "network_logo_id"
t.bigint "provider_section_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
- t.index ["exception_id"], name: "index_id_card_exception_items_on_exception_id"
- t.index ["network_logo_id"], name: "index_id_card_exception_items_on_network_logo_id"
- t.index ["provider_section_id"], name: "index_id_card_exception_items_on_provider_section_id"
+ t.index ["field_exception_id"], name: "index_id_card_field_exception_items_on_field_exception_id"
+ t.index ["network_logo_id"], name: "index_id_card_field_exception_items_on_network_logo_id"
+ t.index ["provider_section_id"], name: "index_id_card_field_exception_items_on_provider_section_id"
end
- create_table "id_card_exceptions", force: :cascade do |t|
- t.string "type"
- t.string "value"
+ create_table "id_card_field_exceptions", force: :cascade do |t|
+ t.string "exception_type"
+ t.string "exception_value"
t.bigint "setup_id", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
- t.index ["setup_id"], name: "index_id_card_exceptions_on_setup_id"
+ t.index ["setup_id"], name: "index_id_card_field_exceptions_on_setup_id"
end
create_table "id_card_network_logos", force: :cascade do |t|
@@ -61,6 +61,7 @@ ActiveRecord::Schema[7.2].define(version: 2026_01_16_182836) do
t.binary "image_data"
t.string "content_type"
t.float "aspect_ratio"
+ t.boolean "default", default: false
t.boolean "active", default: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
@@ -208,11 +209,13 @@ ActiveRecord::Schema[7.2].define(version: 2026_01_16_182836) do
t.string "precert_4"
t.string "precert_5"
t.string "precert_6"
+ t.boolean "default", default: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "id_card_rx_sections", force: :cascade do |t|
+ t.string "title"
t.string "help_desk"
t.string "customer_service"
t.string "web_url"
@@ -225,6 +228,7 @@ ActiveRecord::Schema[7.2].define(version: 2026_01_16_182836) do
t.string "network_provider"
t.string "card_template"
t.string "rx_group_number"
+ t.string "pl_plan_key"
t.boolean "active", default: false
t.bigint "employer_id", null: false
t.bigint "employer_logo_id"
@@ -255,10 +259,10 @@ ActiveRecord::Schema[7.2].define(version: 2026_01_16_182836) do
t.index ["id_card_plan_id"], name: "index_members_on_id_card_plan_id"
end
- add_foreign_key "id_card_exception_items", "id_card_exceptions", column: "exception_id"
- add_foreign_key "id_card_exception_items", "id_card_network_logos", column: "network_logo_id"
- add_foreign_key "id_card_exception_items", "id_card_provider_sections", column: "provider_section_id"
- add_foreign_key "id_card_exceptions", "id_card_setups", column: "setup_id"
+ add_foreign_key "id_card_field_exception_items", "id_card_field_exceptions", column: "field_exception_id"
+ add_foreign_key "id_card_field_exception_items", "id_card_network_logos", column: "network_logo_id"
+ add_foreign_key "id_card_field_exception_items", "id_card_provider_sections", column: "provider_section_id"
+ add_foreign_key "id_card_field_exceptions", "id_card_setups", column: "setup_id"
add_foreign_key "id_card_plan_benefits", "id_card_plans", column: "plan_id"
add_foreign_key "id_card_plans", "id_card_setups", column: "setup_id"
add_foreign_key "id_card_setups", "employers"
diff --git a/db/seeds.rb b/db/seeds.rb
index e8c50c8..9359658 100644
--- a/db/seeds.rb
+++ b/db/seeds.rb
@@ -103,9 +103,10 @@ end
# IdCardBenefit.create(sequence: i + 1, benefit_desc: bene, id_card_benefits_template: default)
# end
-# temp_2 = IdCardBenefitsTemplate.create(title: "Jason's Template")
-# (1..14).each do |seq|
-# IdCardBenefit.create(sequence: seq, benefit: "#{seq} hit wonder", id_card_benefits_template: temp_2)
+# temp_2 = IdCard::Plan.create(title: "Jason's Template", template: true)
+# temp_2.plan_benefits.each do |bene|
+# bene.benefit = "#{bene.sequence} hit wonder"
+# bene.save
# end
# temp_1 = IdCardBenefitsTemplate.create(title: "Rebekah's Template")
@@ -202,65 +203,77 @@ plan_headers.each do |ph|
end
end
-# Vhcs::HlidCardProvider.all.each do |vhcs|
-# CardProvider.find_or_create_by(provider_code: vhcs.provider_code) do |cp|
-# cp.provider_line_1 = vhcs.provider_line_1
-# cp.provider_line_2 = vhcs.provider_line_2
-# cp.provider_line_3 = vhcs.provider_line_3
-# cp.provider_line_4 = vhcs.provider_line_4
-# cp.provider_line_5 = vhcs.provider_line_5
-# cp.provider_line_6 = vhcs.provider_line_6
-# cp.provider_line_7 = vhcs.provider_line_7
-# cp.provider_line_8 = vhcs.provider_line_8
-# cp.provider_line_9 = vhcs.provider_line_9
-# cp.provider_line_10 = vhcs.provider_line_10
-# cp.provider_line_11 = vhcs.provider_line_11
-# cp.provider_line_12 = vhcs.provider_line_12
+base_cp_provider_codes = ["5", "2"]
+needed_codes = %w(M T A I 8 7 1 6 3 P C V Y Z)
+# provider_code_map = {}
+vhcs_cp = Vhcs::HlidCardProvider.where(provider_code: base_cp_provider_codes).to_a + Vhcs::HlidCardProvider.where(provider_code: needed_codes).order(:provider_code).to_a
+vhcs_cp.each do |vhcs|
+ attributes_hash = vhcs.attributes.except(:provider_code, :group_number)
+ attributes_hash.delete_if { |key, value| !key.to_s.include?("_") }
+ existing_cp = IdCard::ProviderSection.find_by(attributes_hash)
-# cp.claim_to_1 = vhcs.claim_to_1
-# cp.claim_to_2 = vhcs.claim_to_2
-# cp.claim_to_3 = vhcs.claim_to_3
-# cp.claim_to_4 = vhcs.claim_to_4
-# cp.claim_to_5 = vhcs.claim_to_5
-# cp.claim_to_6 = vhcs.claim_to_6
-# cp.claim_to_7 = vhcs.claim_to_7
-# cp.claim_to_8 = vhcs.claim_to_8
-# cp.claim_to_9 = vhcs.claim_to_9
-# cp.claim_to_10 = vhcs.claim_to_10
-# cp.claim_to_11 = vhcs.claim_to_11
-# cp.claim_to_12 = vhcs.claim_to_12
+ if existing_cp
+ existing_cp.title = existing_cp.title.concat(vhcs.provider_code)
+ existing_cp.save
+ else
+ title = case
+ when vhcs.provider_line_1 == "PO Box 188061"
+ "Cigna #{vhcs.provider_code}"
+ when vhcs.provider_line_1.present?
+ "#{vhcs.provider_line_1} #{vhcs.provider_code}"
+ else
+ "Medcost #{vhcs.provider_code}"
+ end
-# cp.mail_to = vhcs.mail_to
-# cp.mail_to_2 = vhcs.mail_to_2
+ if base_cp_provider_codes.include?(vhcs.provider_code)
+ attributes_hash[:default] = true
+ end
+ attributes_hash[:title] = title
+ attributes_hash[:provider_code] = vhcs.provider_code
-# cp.contact_line_1 = vhcs.contact_line_1
-# cp.contact_line_2 = vhcs.contact_line_2
-# cp.contact_line_3 = vhcs.contact_line_3
+ IdCard::ProviderSection.find_or_create_by(attributes_hash)
+ end
-# cp.group_number = vhcs.group_number
-# cp.rx_group_id = vhcs.rx_group_id
-# cp.rx_contact = vhcs.rx_contact
+end
-# cp.provider_lookup_1 = vhcs.provider_lookup_1
-# cp.provider_lookup_2 = vhcs.provider_lookup_2
+base_cp_provider_codes = ["5", "2"]
+needed_codes = %w(M T A I 8 7 1 6 3 P C V Y Z)
+# provider_code_map = {}
+vhcs_cp = Vhcs::HlidCardProvider.where(provider_code: base_cp_provider_codes).to_a + Vhcs::HlidCardProvider.where(provider_code: needed_codes).order(:provider_code).to_a
+vhcs_cp.each do |vhcs|
+ attributes_hash = vhcs.attributes.except(:provider_code)
+ attributes_hash.delete_if { |key, value| !key.to_s.include?("_") }
+ existing_cp = IdCard::ProviderSection.find_by(attributes_hash)
-# cp.precert_1 = vhcs.precert_1
-# cp.precert_2 = vhcs.precert_2
-# cp.precert_3 = vhcs.precert_3
-# cp.precert_4 = vhcs.precert_4
-# cp.precert_5 = vhcs.precert_5
-# cp.precert_6 = vhcs.precert_6
-
-# end
-# end
+ if existing_cp
+ existing_cp
+ # if provider_code_map[existing_cp.provider_code]
+ # provider_code_map[existing_cp.provider_code].push(vhcs.provider_code)
+ # else
+ # provider_code_map[existing_cp.provider_code] = [vhcs.provider_code]
+ # end
+ else
+ attributes_hash[:provider_code] = vhcs.provider_code
+ IdCard::ProviderSection.find_or_create_by(attributes_hash)
+ end
+end
Vhcs::HlrxCrosRef.all.each do |vhcs|
- rx = CardRx.find_or_create_by(help_desk: vhcs.help_desk, customer_service: vhcs.customer_service, web_url: vhcs.web_url)
- emp = Employer.find_by(pl_plan_key: vhcs.pl_plan_key)
- if emp.present?
- emp.card_rx = rx
- emp.save
+ rx = IdCard::RxSection.find_or_create_by(help_desk: vhcs.help_desk, customer_service: vhcs.customer_service, web_url: vhcs.web_url)
+ title = rx.web_url.gsub(/^www\./, '').gsub(/\.com\Z/, '')
+ unless title.match?(/\A[A-Z]/)
+ title = title.capitalize
end
+
+ rx.title = title
+ rx.save
+end
+
+["CignaLogo.png", "MedCostLogo.png"].each do |logo_upload|
+ new_logo = ImageProcessor.new("logo_files/network/#{logo_upload}", "Network").call
+ new_logo.default = true
+ new_logo.active = true
+ new_logo.save
end
diff --git a/lib/tasks/employer.rake b/lib/tasks/employer.rake
index 665d4fc..94ff8f9 100644
--- a/lib/tasks/employer.rake
+++ b/lib/tasks/employer.rake
@@ -3,7 +3,7 @@ namespace :employer do
desc "TODO"
# rake employer:vhcs_sync_all
task vhcs_sync_all: :environment do
- sql_query = "SELECT PLPlanKey, PlanId, ShortDesc FROM PLPlanHeader WHERE ActiveInactive = 'Active' AND PLPlanKey = 65"
+ sql_query = "SELECT PLPlanKey, PlanId, ShortDesc FROM PLPlanHeader WHERE ActiveInactive = 'Active'"
plan_headers = VhcsRecord.connection.select_all(sql_query)
plan_headers.each do |ph|
@@ -13,28 +13,32 @@ namespace :employer do
em.plan_id = ph['PlanId'].strip.to_i
- id_card_templates = determine_id_card_templates(em.pl_plan_key)
- em.single_card_template = id_card_templates[:single_card_template]
- em.multiple_card_template = id_card_templates[:multiple_card_template]
+ # id_card_templates = determine_id_card_templates(em.pl_plan_key)
+ # em.single_card_template = id_card_templates[:single_card_template]
+ # em.multiple_card_template = id_card_templates[:multiple_card_template]
+
+ id_card_setup = em.build_id_card_setup(pl_plan_key: em.pl_plan_key)
plan_code = Vhcs::HlPlanCode.find_by(plan_key: em.pl_plan_key)
em.group_number = plan_code.group_number
- em.rx_group_number = plan_code.medical_number
+ id_card_setup.rx_group_number = plan_code.medical_number
em.effective_date = plan_code.effect_date.strftime("%m/%d/%Y")
pb_company_plan = Vhcs::PbCompanyPlans.find_by(pl_plan_key: em.pl_plan_key)
em.company_pb_entity_key = pb_company_plan.company_pb_entity_key
- card_display_name = Vhcs::PbEntity.find_by(company_pb_entity_key: em.company_pb_entity_key).last_name
- em.id_card_display_name = em.employer_trim_name(card_display_name)
+ card_print_name = Vhcs::PbEntity.find_by(company_pb_entity_key: em.company_pb_entity_key).last_name
+ id_card_setup.print_name = em.employer_trim_name(card_print_name)
- em.default_network_logo = determine_network_logos(em.pl_plan_key)
+ id_card_setup.active = true
+
+ # em.default_network_logo = determine_network_logos(em.pl_plan_key)
end
vhcs_plans = Vhcs::PbProduct.where(company_pb_entity_key: import_employer.company_pb_entity_key)
vhcs_plans.each do |vp|
puts "~~ Importing #{vp.short_description}"
- import_plan = import_employer.plans.find_or_create_by!(pb_product_key: vp.pb_product_key) do |pl|
+ import_plan = import_employer.id_card_setup.plans.find_or_create_by!(pb_product_key: vp.pb_product_key) do |pl|
pl.title = vp.short_description
end
vhcs_plan_benefits = Vhcs::HlEgglestonCardBenefit.where(plan_id: import_plan.pb_product_key)
diff --git a/logo_files/employer/AqualisLogo.png b/logo_files/employer/AqualisLogo.png
new file mode 100644
index 0000000..70a1f15
Binary files /dev/null and b/logo_files/employer/AqualisLogo.png differ
diff --git a/logo_files/employer/BryanPestControlLogo.jpg b/logo_files/employer/BryanPestControlLogo.jpg
new file mode 100644
index 0000000..05dc63b
Binary files /dev/null and b/logo_files/employer/BryanPestControlLogo.jpg differ
diff --git a/logo_files/employer/ZndusLogo.jpg b/logo_files/employer/ZndusLogo.jpg
new file mode 100644
index 0000000..07c8273
Binary files /dev/null and b/logo_files/employer/ZndusLogo.jpg differ
diff --git a/logo_files/network/CignaLogo.png b/logo_files/network/CignaLogo.png
new file mode 100644
index 0000000..d7cccc7
Binary files /dev/null and b/logo_files/network/CignaLogo.png differ
diff --git a/logo_files/network/MedCostLogo.png b/logo_files/network/MedCostLogo.png
new file mode 100644
index 0000000..519c7e3
Binary files /dev/null and b/logo_files/network/MedCostLogo.png differ