Employer form mostly working with persist to db
This commit is contained in:
@@ -33,4 +33,6 @@
|
||||
--color-verdigris: #588288;
|
||||
/* oxidized copper/bronze green-blue */
|
||||
--color-verdigris-tinted: #496A6F;
|
||||
/* alert red */
|
||||
--color-brightlava: #f80800;
|
||||
}
|
||||
|
||||
@@ -1,90 +1,22 @@
|
||||
class EmployerSetupController < ApplicationController
|
||||
def new
|
||||
# session.delete(:employer_setup_data)
|
||||
session.clear()
|
||||
# puts "Start"
|
||||
# puts session[:employer_setup_data]
|
||||
if session[:employer_setup_data].blank?
|
||||
session[:employer_setup_data] = {}
|
||||
end
|
||||
session[:employer_setup_data]['current_step'] = 'network_exceptions'
|
||||
session[:employer_setup_data]['pl_plan_key'] = 82
|
||||
@top_form = EmployerSetupForm.new(session[:employer_setup_data])
|
||||
if @top_form.current_step != 'summary'
|
||||
@form = form_for_step
|
||||
else
|
||||
@form = @top_form
|
||||
end
|
||||
|
||||
# case @top_form.current_step
|
||||
# when 'general_information'
|
||||
# @form = EmployerSetupGeneralInformationForm.new(session[:employer_setup_data]&.dig('general_information_data'))
|
||||
# when 'plans'
|
||||
# @form = EmployerSetupPlansForm.new(session[:employer_setup_data]&.dig('plans_data'))
|
||||
# when 'network_exceptions'
|
||||
# @form = EmployerSetupNetworkExceptionsForm.new(session[:employer_setup_data]&.dig('network_exceptions_data'))
|
||||
# when 'summary'
|
||||
# @form = @top_form
|
||||
# end
|
||||
render @top_form.current_step_view
|
||||
@employer_setup = EmployerSetupProcess.new
|
||||
@employer_setup.plans.build
|
||||
@plan_templates = IdCardBenefitsTemplate.where.not(title: "BLANK")
|
||||
render 'employer_setup/employer_information'
|
||||
end
|
||||
|
||||
def create
|
||||
# puts session[:employer_setup_data]
|
||||
@top_form = EmployerSetupForm.new(session[:employer_setup_data])
|
||||
if @top_form.current_step != 'summary'
|
||||
if process_step(@top_form.current_step)
|
||||
session[:employer_setup_data]['current_step'] = @top_form.next_step
|
||||
redirect_to new_employer_setup_path
|
||||
else
|
||||
render @top_form.current_step_view
|
||||
end
|
||||
employer_setup_process_params = EmployerSetupProcess.permitted_params(params)
|
||||
puts "---Params---"
|
||||
puts employer_setup_process_params
|
||||
@employer_setup = EmployerSetupProcess.new(employer_setup_process_params)
|
||||
if @employer_setup.save
|
||||
redirect_to @employer_setup, notice: 'Employer Setup Process initiated'
|
||||
else
|
||||
if @top_form.save
|
||||
session.delete(:employer_setup_data)
|
||||
redirect_to root_path, notice: "Employer setup successfully!"
|
||||
else
|
||||
render @top_form.current_step_view
|
||||
end
|
||||
@plan_templates = IdCardBenefitsTemplate.where.not(title: "BLANK")
|
||||
render 'employer_setup/employer_information'
|
||||
end
|
||||
|
||||
# case @top_form.current_step
|
||||
# when 'general_information'
|
||||
# @form = EmployerSetupGeneralInformationForm.new(general_information_params)
|
||||
# if @form.valid?
|
||||
# session[:employer_setup_data]['general_information_data'] = general_information_params
|
||||
# session[:employer_setup_data]['current_step'] = @top_form.next_step
|
||||
# redirect_to new_employer_setup_path
|
||||
# else
|
||||
# render @top_form.current_step_view
|
||||
# end
|
||||
# when 'plans'
|
||||
# @form = EmployerSetupPlansForm.new(plans_params)
|
||||
# if @form.valid?
|
||||
# session[:employer_setup_data]['plans_data'] = plans_params
|
||||
# session[:employer_setup_data]['current_step'] = @top_form.next_step
|
||||
# redirect_to new_employer_setup_path
|
||||
# else
|
||||
# render @top_form.current_step_view
|
||||
# end
|
||||
# when 'network_exceptions'
|
||||
# @form = EmployerSetupNetworkExceptionsForm.new(network_exceptions_params)
|
||||
# if @form.valid?
|
||||
# session[:employer_setup_data]['network_exceptions_data'] = network_exceptions_params
|
||||
# session[:employer_setup_data]['current_step'] = @top_form.next_step
|
||||
# redirect_to new_employer_setup_path
|
||||
# else
|
||||
# render @top_form.current_step_view
|
||||
# end
|
||||
# when 'summary'
|
||||
# @form = EmployerSetupForm.new(session[:employer_setup_data])
|
||||
# if @form.save
|
||||
# session.delete(:employer_setup_data)
|
||||
# redirect_to root_path, notice: "Employer setup successfully!"
|
||||
# else
|
||||
# render @top_form.current_step_view
|
||||
# end
|
||||
# end
|
||||
end
|
||||
|
||||
def update
|
||||
@@ -131,23 +63,31 @@ class EmployerSetupController < ApplicationController
|
||||
def form_for_step
|
||||
step_name = @top_form.current_step
|
||||
form_method = "EmployerSetup#{step_name.camelize}Form".constantize
|
||||
form_method.new()
|
||||
# puts "/////\\\\\\||||||"
|
||||
# puts session[:employer_setup_data]
|
||||
# puts session[:employer_setup_data]['employer_setup_process_id']
|
||||
puts form_method
|
||||
form_method.new(session[:employer_setup_data]['employer_setup_process_id'])
|
||||
end
|
||||
|
||||
def process_step(step_name)
|
||||
@form_method = "EmployerSetup#{step_name.camelize}Form".constantize
|
||||
session_data_name = "#{step_name}_data"
|
||||
puts "1--------------params----"
|
||||
# puts "1--------------params----"
|
||||
# puts params
|
||||
# puts "8--------------session----"
|
||||
# puts session[:employer_setup_data]
|
||||
employer_setup_process_id = session[:employer_setup_data]['employer_setup_process_id']
|
||||
# puts session[:employer_setup_data]
|
||||
puts "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
|
||||
puts params
|
||||
puts "8--------------session----"
|
||||
puts session[:employer_setup_data]
|
||||
@form = @form_method.new(params)
|
||||
@form = @form_method.new(employer_setup_process_id, params)
|
||||
if @form.pl_plan_key.blank?
|
||||
@form.pl_plan_key = session[:employer_setup_data]['pl_plan_key']
|
||||
end
|
||||
if @form.valid? && @form.save
|
||||
pl_plan_key = @top_form.pl_plan_key || @form.pl_plan_key
|
||||
session[:employer_setup_data] = {current_step: step_name, pl_plan_key: pl_plan_key}
|
||||
# session[:employer_setup_data].merge!({current_step: step_name, pl_plan_key: pl_plan_key})
|
||||
# form_fields = @form.attributes.merge!(global_params(step_name))
|
||||
# session[:employer_setup_data][session_data_name] = form_fields
|
||||
# session[:employer_setup_data].merge!(global_params(step_name))
|
||||
|
||||
@@ -0,0 +1,244 @@
|
||||
class EmployerSetupController < ApplicationController
|
||||
def new
|
||||
# session.delete(:employer_setup_data)
|
||||
# session.clear()
|
||||
# puts "Start"
|
||||
# puts session[:employer_setup_data]
|
||||
if session[:employer_setup_data].blank?
|
||||
@process = EmployerSetupProcess.create(status: "form")
|
||||
session[:employer_setup_data] = { "employer_setup_process_id" => @process.id }
|
||||
|
||||
end
|
||||
puts "-S--------------------------------------"
|
||||
puts session[:employer_setup_data]
|
||||
# session[:employer_setup_data]['current_step'] = 'plans'
|
||||
|
||||
@top_form = EmployerSetupForm.new(session[:employer_setup_data])
|
||||
if @top_form.current_step != 'summary'
|
||||
@form = form_for_step
|
||||
else
|
||||
@form = @top_form
|
||||
end
|
||||
|
||||
# case @top_form.current_step
|
||||
# when 'general_information'
|
||||
# @form = EmployerSetupGeneralInformationForm.new(session[:employer_setup_data]&.dig('general_information_data'))
|
||||
# when 'plans'
|
||||
# @form = EmployerSetupPlansForm.new(session[:employer_setup_data]&.dig('plans_data'))
|
||||
# when 'network_exceptions'
|
||||
# @form = EmployerSetupNetworkExceptionsForm.new(session[:employer_setup_data]&.dig('network_exceptions_data'))
|
||||
# when 'summary'
|
||||
# @form = @top_form
|
||||
# end
|
||||
render @top_form.current_step_view
|
||||
end
|
||||
|
||||
def create
|
||||
# puts session[:employer_setup_data]
|
||||
@top_form = EmployerSetupForm.new(session[:employer_setup_data])
|
||||
if @top_form.current_step != 'summary'
|
||||
if process_step(@top_form.current_step)
|
||||
session[:employer_setup_data]['current_step'] = @top_form.next_step
|
||||
puts "---------------------------------------"
|
||||
puts "pass"
|
||||
puts "next - #{@top_form.next_step}"
|
||||
puts session[:employer_setup_data]
|
||||
puts "---------------------------------------"
|
||||
redirect_to new_employer_setup_path
|
||||
else
|
||||
puts "fail"
|
||||
render @top_form.current_step_view
|
||||
end
|
||||
else
|
||||
if @top_form.save
|
||||
session.delete(:employer_setup_data)
|
||||
redirect_to root_path, notice: "Employer setup successfully!"
|
||||
else
|
||||
render @top_form.current_step_view
|
||||
end
|
||||
end
|
||||
|
||||
# case @top_form.current_step
|
||||
# when 'general_information'
|
||||
# @form = EmployerSetupGeneralInformationForm.new(general_information_params)
|
||||
# if @form.valid?
|
||||
# session[:employer_setup_data]['general_information_data'] = general_information_params
|
||||
# session[:employer_setup_data]['current_step'] = @top_form.next_step
|
||||
# redirect_to new_employer_setup_path
|
||||
# else
|
||||
# render @top_form.current_step_view
|
||||
# end
|
||||
# when 'plans'
|
||||
# @form = EmployerSetupPlansForm.new(plans_params)
|
||||
# if @form.valid?
|
||||
# session[:employer_setup_data]['plans_data'] = plans_params
|
||||
# session[:employer_setup_data]['current_step'] = @top_form.next_step
|
||||
# redirect_to new_employer_setup_path
|
||||
# else
|
||||
# render @top_form.current_step_view
|
||||
# end
|
||||
# when 'network_exceptions'
|
||||
# @form = EmployerSetupNetworkExceptionsForm.new(network_exceptions_params)
|
||||
# if @form.valid?
|
||||
# session[:employer_setup_data]['network_exceptions_data'] = network_exceptions_params
|
||||
# session[:employer_setup_data]['current_step'] = @top_form.next_step
|
||||
# redirect_to new_employer_setup_path
|
||||
# else
|
||||
# render @top_form.current_step_view
|
||||
# end
|
||||
# when 'summary'
|
||||
# @form = EmployerSetupForm.new(session[:employer_setup_data])
|
||||
# if @form.save
|
||||
# session.delete(:employer_setup_data)
|
||||
# redirect_to root_path, notice: "Employer setup successfully!"
|
||||
# else
|
||||
# render @top_form.current_step_view
|
||||
# end
|
||||
# end
|
||||
end
|
||||
|
||||
def update
|
||||
@form = RegistrationForm.new(registration_params)
|
||||
|
||||
if params[:back_button]
|
||||
@form.current_step = @form.previous_step
|
||||
elsif params[:skip_newsletter]
|
||||
@form.current_step = @form.next_step # Skip newsletter step
|
||||
end
|
||||
|
||||
render :new
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
# def general_information_params
|
||||
# params.require(:employer_setup_general_information_form).permit(
|
||||
# :name,
|
||||
# :employer_logo,
|
||||
# :group_number,
|
||||
# :dental,
|
||||
# :pl_plan_key,
|
||||
# :effect_date,
|
||||
# :number_of_plans,
|
||||
# :network,
|
||||
# :number_of_additional_network_logos
|
||||
# )
|
||||
# end
|
||||
|
||||
# def plans_params
|
||||
# params.require(:employer_setup_plans_form).permit(
|
||||
# plans: permited_plans_keys,
|
||||
# benefit_descs: benefit_sequence_keys
|
||||
# )
|
||||
# end
|
||||
|
||||
# def network_exceptions_params
|
||||
# params.require(:employer_setup_network_exceptions_form).permit(
|
||||
# network_exceptions: [:network_logo, exceptions: [:type, :value]],
|
||||
# )
|
||||
# end
|
||||
|
||||
def form_for_step
|
||||
step_name = @top_form.current_step
|
||||
form_method = "EmployerSetup#{step_name.camelize}Form".constantize
|
||||
# puts "/////\\\\\\||||||"
|
||||
# puts session[:employer_setup_data]
|
||||
# puts session[:employer_setup_data]['employer_setup_process_id']
|
||||
puts form_method
|
||||
form_method.new(session[:employer_setup_data]['employer_setup_process_id'])
|
||||
end
|
||||
|
||||
def process_step(step_name)
|
||||
@form_method = "EmployerSetup#{step_name.camelize}Form".constantize
|
||||
session_data_name = "#{step_name}_data"
|
||||
# puts "1--------------params----"
|
||||
# puts params
|
||||
# puts "8--------------session----"
|
||||
# puts session[:employer_setup_data]
|
||||
employer_setup_process_id = session[:employer_setup_data]['employer_setup_process_id']
|
||||
# puts session[:employer_setup_data]
|
||||
puts "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
|
||||
puts params
|
||||
@form = @form_method.new(employer_setup_process_id, params)
|
||||
if @form.pl_plan_key.blank?
|
||||
@form.pl_plan_key = session[:employer_setup_data]['pl_plan_key']
|
||||
end
|
||||
if @form.valid? && @form.save
|
||||
pl_plan_key = @top_form.pl_plan_key || @form.pl_plan_key
|
||||
# session[:employer_setup_data].merge!({current_step: step_name, pl_plan_key: pl_plan_key})
|
||||
# form_fields = @form.attributes.merge!(global_params(step_name))
|
||||
# session[:employer_setup_data][session_data_name] = form_fields
|
||||
# session[:employer_setup_data].merge!(global_params(step_name))
|
||||
# puts session[:employer_setup_data][session_data_name]
|
||||
true
|
||||
else
|
||||
false
|
||||
end
|
||||
end
|
||||
|
||||
def step_params(step_name)
|
||||
form_name_sym = "employer_setup_#{step_name}_form".to_sym
|
||||
params.require(form_name_sym).permit(@form_method.permitted_params)
|
||||
end
|
||||
|
||||
def global_params(step_name)
|
||||
form_name_sym = "employer_setup_#{step_name}_form".to_sym
|
||||
params.require(form_name_sym).permit(EmployerSetupForm.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]
|
||||
# if allowed_params.include?(form_params_name)
|
||||
# form_params = send(form_params_name)
|
||||
# @form = form_name.new(form_params)
|
||||
# if @form.valid?
|
||||
# session[:employer_setup_data]["#{step_name}_data"] = form_params
|
||||
# true
|
||||
# else
|
||||
# false
|
||||
# end
|
||||
# end
|
||||
# false
|
||||
# end
|
||||
|
||||
# def employer_setup_params
|
||||
# params.require(:employer_setup_form).permit(
|
||||
# :current_step,
|
||||
# :name,
|
||||
# :employer_logo,
|
||||
# :group_number,
|
||||
# :pl_plan_key,
|
||||
# :effect_date,
|
||||
# :number_of_plans,
|
||||
# :network,
|
||||
# :number_of_additional_network_logos,
|
||||
# network_exceptions: [:network_logo, exceptions: [:type, :value]],
|
||||
# plans: permited_plans_keys,
|
||||
# benefit_descs: benefit_sequence_keys
|
||||
# )
|
||||
# end
|
||||
|
||||
# def benefit_sequence_keys
|
||||
# (1..14).map { |i| i.to_s.to_sym }
|
||||
# end
|
||||
|
||||
# def permited_plans_keys
|
||||
# benefit_sequence_keys.push(:plan_id)
|
||||
# end
|
||||
|
||||
# def plans_params
|
||||
# plans_keys = params[:plans]&.keys || []
|
||||
|
||||
# plans_keys.each_with_object({}) do |key, hash|
|
||||
# if key == 'benefit_descs' || key.match?(/^plan_\d$/)
|
||||
# hash[key.to_sym] = permited_plan_param_list
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
|
||||
# def permited_plan_param_list
|
||||
# (1..14).map { |i| i.to_s.to_sym }.push(:plan_id)
|
||||
# end
|
||||
end
|
||||
@@ -11,7 +11,7 @@ class EmployerSetupController < ApplicationController
|
||||
:name,
|
||||
:group_number,
|
||||
:pl_plan_key,
|
||||
:effect_date
|
||||
:effective_date
|
||||
))
|
||||
@employer_data[:employer].merge!(params.permit(:number_of_plans))
|
||||
|
||||
@@ -54,7 +54,7 @@ class EmployerSetupController < ApplicationController
|
||||
# medical_number: @final_data['employer']['group_number'],
|
||||
# dental_number: ' ',
|
||||
# plan_key: @final_data['employer']['pl_plan_key'],
|
||||
# effect_date: @final_data['employer']['effect_date']
|
||||
# effective_date: @final_data['employer']['effective_date']
|
||||
# )
|
||||
|
||||
# default = Vhcs::HLRXCrosRef.find_by(pl_plan_key: 52)
|
||||
|
||||
@@ -5,7 +5,7 @@ class TailwindFormBuilder < ActionView::Helpers::FormBuilder
|
||||
|
||||
TEXT_FIELD_STYLE = "bg-gray-200 rounded py-2 px-4 text-bluetang font-semibold leading-tight focus:outline-none focus:bg-white".freeze
|
||||
SELECT_FIELD_STYLE = "block bg-gray-200 text-gray-700 py-2 px-4 rounded leading-tight focus:outline-none focus:bg-white".freeze
|
||||
SUBMIT_BUTTON_STYLE = "shadow bg-bronze focus:shadow-outline focus:outline-none text-white font-bold py-2 px-4 rounded hover:bg-copper".freeze
|
||||
SUBMIT_BUTTON_STYLE = "cursor-pointer shadow bg-bronze focus:shadow-outline focus:outline-none text-white font-bold py-2 px-4 rounded hover:bg-copper".freeze
|
||||
|
||||
text_field_helpers.each do |field_method|
|
||||
class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1
|
||||
|
||||
@@ -6,12 +6,16 @@ class EmployerSetupForm
|
||||
|
||||
attribute :current_step, :string, default: FIRST_STEP
|
||||
attribute :pl_plan_key, :string
|
||||
attribute :employer_setup_process_id, :integer
|
||||
|
||||
def initialize(params = {})
|
||||
# if params.present?
|
||||
# params = permitted_params(params)
|
||||
# end
|
||||
# @current_step = params["current_step"]
|
||||
# @employer_setup_process_id = params["employer_setup_process_id"]
|
||||
super(params)
|
||||
|
||||
unless self.steps.first == FIRST_STEP
|
||||
raise StepMisalignmentError, "FIRST_STEP does not match first entry in steps"
|
||||
end
|
||||
@@ -53,7 +57,7 @@ class EmployerSetupForm
|
||||
end
|
||||
|
||||
def permitted_params(params)
|
||||
params.require(:employer_setup_data).permit(
|
||||
params.permit(
|
||||
:pl_plan_key,
|
||||
:current_step
|
||||
)
|
||||
@@ -66,15 +70,16 @@ class EmployerSetupForm
|
||||
]
|
||||
end
|
||||
|
||||
# def save
|
||||
# if valid?
|
||||
# EmployerSetupGeneralInformationForm.new(attributes[:general_information_data]).save
|
||||
# EmployerSetupPlansForm.new(attributes[:plans_data]).save
|
||||
# EmployerSetupNetworkExceptionsForm.new(attributes[:network_exceptions_data]).save
|
||||
# true
|
||||
# else
|
||||
# false
|
||||
# end
|
||||
# end
|
||||
def save
|
||||
if valid?
|
||||
process = EmployerSetupProcess.find(@employer_setup_process_id)
|
||||
process.update(
|
||||
status: "entered"
|
||||
)
|
||||
true
|
||||
else
|
||||
false
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -7,16 +7,17 @@ class EmployerSetupGeneralInformationForm
|
||||
attribute :group_number, :string
|
||||
attribute :dental, :boolean, default: false
|
||||
attribute :pl_plan_key, :string
|
||||
attribute :effect_date, :string
|
||||
attribute :effective_date, :string
|
||||
# attribute :number_of_plans, :integer
|
||||
attribute :network, :string
|
||||
# attribute :number_of_additional_network_logos, :integer
|
||||
|
||||
attr_accessor :employer_setup_process_id
|
||||
|
||||
validates :name, presence: true
|
||||
validates :employer_logo, presence: true
|
||||
validates :group_number, presence: true
|
||||
validates :pl_plan_key, presence: true
|
||||
validates :effect_date, presence: true
|
||||
validates :effective_date, presence: true
|
||||
# validates :number_of_plans, presence: true
|
||||
validates :network, presence: true
|
||||
# validates :number_of_additional_network_logos, presence: true if network = "cigna+"
|
||||
@@ -27,11 +28,27 @@ class EmployerSetupGeneralInformationForm
|
||||
# super(permitted_attributes)
|
||||
# end
|
||||
|
||||
def initialize(params = {})
|
||||
def initialize(employer_setup_process_id, params = {})
|
||||
@employer_setup_process_id = employer_setup_process_id
|
||||
if params.present?
|
||||
params = permitted_params(params)
|
||||
form_params = permitted_params(params)
|
||||
super(form_params)
|
||||
else
|
||||
super(params)
|
||||
load_from_process
|
||||
end
|
||||
super(params)
|
||||
end
|
||||
|
||||
def load_from_process
|
||||
process = EmployerSetupProcess.find(@employer_setup_process_id)
|
||||
|
||||
self.name = process.employer_name
|
||||
# self.employer_logo = process.
|
||||
self.group_number = process.group_number
|
||||
self.dental = false
|
||||
self.pl_plan_key = process.pl_plan_key
|
||||
self.effective_date = process.effective_date
|
||||
self.network = process.network_provider
|
||||
end
|
||||
|
||||
def permitted_params(params)
|
||||
@@ -41,7 +58,7 @@ class EmployerSetupGeneralInformationForm
|
||||
:group_number,
|
||||
:dental,
|
||||
:pl_plan_key,
|
||||
:effect_date,
|
||||
:effective_date,
|
||||
:number_of_plans,
|
||||
:network,
|
||||
:number_of_additional_network_logos
|
||||
@@ -52,48 +69,57 @@ class EmployerSetupGeneralInformationForm
|
||||
# Implement logic to save data to models after all steps are complete
|
||||
# For example, create a User record with the collected data
|
||||
if valid?
|
||||
hl_plan_code = Vhcs::HlPlanCode.create!(
|
||||
process = EmployerSetupProcess.find(@employer_setup_process_id)
|
||||
process.update(
|
||||
employer_name: name,
|
||||
group_number: group_number,
|
||||
medical_number: group_number,
|
||||
dental_number: '',
|
||||
plan_key: pl_plan_key,
|
||||
effect_date: effect_date
|
||||
)
|
||||
|
||||
# Replace fairos_info with template like for benefits
|
||||
fairos_info = Vhcs::HlrxCrosRef.where(pl_plan_key: 52).first
|
||||
hlrx_cros_ref = Vhcs::HlrxCrosRef.create!(
|
||||
group_no: group_number,
|
||||
rx_group_id: group_number,
|
||||
help_desk: fairos_info.help_desk,
|
||||
customer_service: fairos_info.customer_service,
|
||||
web_url: fairos_info.web_url,
|
||||
pl_plan_key: pl_plan_key
|
||||
)
|
||||
|
||||
web_employer = BrittonWeb::Employers.create!(
|
||||
name: name,
|
||||
pl_plan_key: pl_plan_key,
|
||||
dental_plan: dental,
|
||||
single_card_template: 'FairosRxIDCard',
|
||||
logo: employer_logo.original_filename
|
||||
effective_date: effective_date,
|
||||
network_provider: network
|
||||
)
|
||||
|
||||
default_network_logo =
|
||||
case
|
||||
when network.include?("cig")
|
||||
"CignaLogo.png"
|
||||
when network.include?("med")
|
||||
"Logo_MC_PMS.png"
|
||||
else
|
||||
"CignaLogo.png"
|
||||
end
|
||||
# hl_plan_code = Vhcs::HlPlanCode.create!(
|
||||
# group_number: group_number,
|
||||
# medical_number: group_number,
|
||||
# dental_number: '',
|
||||
# plan_key: pl_plan_key,
|
||||
# effect_date: effective_date
|
||||
# )
|
||||
|
||||
BrittonWeb::NetworkLogos.create!(
|
||||
employer_id: web_employer.id,
|
||||
net_logo: default_network_logo,
|
||||
default: true
|
||||
)
|
||||
# # Replace fairos_info with template like for benefits
|
||||
# fairos_info = Vhcs::HlrxCrosRef.where(pl_plan_key: 52).first
|
||||
# hlrx_cros_ref = Vhcs::HlrxCrosRef.create!(
|
||||
# group_no: group_number,
|
||||
# rx_group_id: group_number,
|
||||
# help_desk: fairos_info.help_desk,
|
||||
# customer_service: fairos_info.customer_service,
|
||||
# web_url: fairos_info.web_url,
|
||||
# pl_plan_key: pl_plan_key
|
||||
# )
|
||||
|
||||
# web_employer = BrittonWeb::Employers.create!(
|
||||
# name: name,
|
||||
# pl_plan_key: pl_plan_key,
|
||||
# dental_plan: dental,
|
||||
# single_card_template: 'FairosRxIDCard',
|
||||
# logo: employer_logo.original_filename
|
||||
# )
|
||||
|
||||
# default_network_logo =
|
||||
# case
|
||||
# when network.include?("cig")
|
||||
# "CignaLogo.png"
|
||||
# when network.include?("med")
|
||||
# "Logo_MC_PMS.png"
|
||||
# else
|
||||
# "CignaLogo.png"
|
||||
# end
|
||||
|
||||
# BrittonWeb::NetworkLogos.create!(
|
||||
# employer_id: web_employer.id,
|
||||
# net_logo: default_network_logo,
|
||||
# default: true
|
||||
# )
|
||||
|
||||
true
|
||||
else
|
||||
|
||||
@@ -5,15 +5,20 @@ class EmployerSetupNetworkExceptionsForm
|
||||
Network_exception = Struct.new(:network_logo, :exceptions)
|
||||
attribute :network_exceptions, :array_of_items, default: -> { [] }
|
||||
attribute :pl_plan_key, :string
|
||||
attribute :number_of_additional_network_logos, :integer
|
||||
|
||||
attr_accessor :employer_setup_process_id
|
||||
|
||||
# validates :network_exceptions, presence: true if number_of_additional_network_logos > 0
|
||||
|
||||
def initialize(params = {})
|
||||
if params.present? && params[:employer_setup_network_exceptions_form].is_a?(ActionController::Parameters)
|
||||
params = permitted_params(params)
|
||||
def initialize(employer_setup_process_id, params = {})
|
||||
@employer_setup_process_id = employer_setup_process_id
|
||||
if params.present?
|
||||
form_params = permitted_params(params)
|
||||
super(form_params)
|
||||
else
|
||||
super(params)
|
||||
end
|
||||
super(params)
|
||||
|
||||
end
|
||||
|
||||
def permitted_params(params)
|
||||
@@ -67,20 +72,23 @@ class EmployerSetupNetworkExceptionsForm
|
||||
# Implement logic to save data to models after all steps are complete
|
||||
# For example, create a User record with the collected data
|
||||
if valid?
|
||||
employer = BrittonWeb::Employers.find_by(pl_plan_key: pl_plan_key)
|
||||
|
||||
network_exceptions_data = process_for_save(network_exceptions)
|
||||
network_exceptions_data.each do |ne|
|
||||
ne['exceptions'].each do |ex|
|
||||
BrittonWeb::NetworkLogos.create!(
|
||||
employer_id: employer.id,
|
||||
net_logo: ne['network_logo'].original_filename,
|
||||
exception_type: ex['type'].downcase,
|
||||
exception_value: ex['value'],
|
||||
default: false
|
||||
)
|
||||
end
|
||||
process = EmployerSetupProcess.find(@employer_setup_process_id)
|
||||
# employer = BrittonWeb::Employers.find_by(pl_plan_key: pl_plan_key)
|
||||
if network_exceptions
|
||||
network_exceptions_data = process_for_save(network_exceptions)
|
||||
end
|
||||
# network_exceptions_data.each do |ne|
|
||||
# ne['exceptions'].each do |ex|
|
||||
# BrittonWeb::NetworkLogos.create!(
|
||||
# employer_id: employer.id,
|
||||
# net_logo: ne['network_logo'].original_filename,
|
||||
# exception_type: ex['type'].downcase,
|
||||
# exception_value: ex['value'],
|
||||
# default: false
|
||||
# )
|
||||
# end
|
||||
# end
|
||||
|
||||
true
|
||||
else
|
||||
false
|
||||
|
||||
@@ -2,25 +2,31 @@ class EmployerSetupPlansForm
|
||||
include ActiveModel::Model
|
||||
include ActiveModel::Attributes
|
||||
|
||||
PLAN_COLORS = ['atmosphere', 'copper', 'bluemana', 'bronze', 'cobalt', 'verdigris']
|
||||
PLAN_COLORS = ['atmosphere', 'verdigris', 'cobalt', 'bluemana']
|
||||
|
||||
# attribute :plans, array: true, default: []
|
||||
attribute :plans, array: true, default: -> { [new_plan] }
|
||||
attribute :plans, array: true, default: -> { [Plan.new] }
|
||||
attribute :pl_plan_key, :string
|
||||
attribute :number_of_plans, :integer
|
||||
attribute :benefit_descs, hash: true, default: -> { new_plan }
|
||||
attribute :benefit_descs, hash: true, default: -> { Plan.new }
|
||||
|
||||
attr_accessor :plan_templates
|
||||
attr_accessor :benefits_template
|
||||
attr_accessor :employer_setup_process_id
|
||||
|
||||
validates :plans, presence: true
|
||||
validates :benefit_descs, presence: true
|
||||
|
||||
def initialize(params = {})
|
||||
def initialize(employer_setup_process_id, params = {})
|
||||
@employer_setup_process_id = employer_setup_process_id
|
||||
if params.present?
|
||||
params = permitted_params(params)
|
||||
form_params = permitted_params(params)
|
||||
super(form_params)
|
||||
else
|
||||
super(params)
|
||||
process_plans = EmployerSetupProcess.find(@employer_setup_process_id).plans
|
||||
if process_plans.present?
|
||||
self.plans = process_plans
|
||||
end
|
||||
end
|
||||
super(params)
|
||||
|
||||
@plan_templates = IdCardBenefitsTemplate.where.not(title: "BLANK")
|
||||
@benefits_template = IdCardBenefitsTemplate.find_by(title: "BLANK").id_card_benefits.sort_by(&:sequence)
|
||||
@@ -61,6 +67,11 @@ class EmployerSetupPlansForm
|
||||
plan
|
||||
end
|
||||
|
||||
def process_params(employer_setup_process_id)
|
||||
process = EmployerSetupProcess.find(employer_setup_process_id)
|
||||
process.plans
|
||||
end
|
||||
|
||||
def permitted_params(params)
|
||||
params.require(:employer_setup_plans_form).permit(
|
||||
:pl_plan_key,
|
||||
@@ -90,27 +101,54 @@ class EmployerSetupPlansForm
|
||||
end
|
||||
|
||||
def permited_plans_keys
|
||||
(1..14).map { |i| "benefit_#{i}".to_sym }.push(:plan_id)
|
||||
(1..14).map { |i| "benefit_#{i}".to_sym }.push(:plan_id, :id)
|
||||
end
|
||||
|
||||
def save
|
||||
# Implement logic to save data to models after all steps are complete
|
||||
# For example, create a User record with the collected data
|
||||
if valid?
|
||||
plans.each do |plan|
|
||||
process = EmployerSetupProcess.find(@employer_setup_process_id)
|
||||
# process.plans.update(plans: plans)
|
||||
|
||||
planss = Array.wrap(plans)
|
||||
|
||||
plans.each_with_index do |plan, i|
|
||||
plan_info = plan.last
|
||||
plan_id = plan_info.delete(:plan_id).to_i
|
||||
plan_id = plan_info[:plan_id].present? ? plan_info[:plan_id].to_i : "temp #{i}"
|
||||
plan_info.delete(:plan_id)
|
||||
new_plan = process.plans.create(plan_id: plan_id)
|
||||
plan_info.each do |key, value|
|
||||
sequence = key.delete_prefix("benefit_").to_i
|
||||
Vhcs::HlEgglestonCardBenefit.create(
|
||||
plan_id: plan_id,
|
||||
benefit_desc: benefit_descs["#{key}"],
|
||||
benefit: value,
|
||||
sequence: sequence,
|
||||
plan_key: pl_plan_key
|
||||
benefit = new_plan.plan_benefits.find_by(sequence: sequence)
|
||||
benefit.update(
|
||||
benefit: value
|
||||
)
|
||||
# Vhcs::HlEgglestonCardBenefit.create(
|
||||
# plan_id: plan_id,
|
||||
# benefit_desc: benefit_descs["#{key}"],
|
||||
# benefit: value,
|
||||
# sequence: sequence,
|
||||
# plan_key: pl_plan_key
|
||||
# )
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
# plans.each do |plan|
|
||||
# plan_info = plan.last
|
||||
# plan_id = plan_info.delete(:plan_id).to_i
|
||||
# plan_info.each do |key, value|
|
||||
# sequence = key.delete_prefix("benefit_").to_i
|
||||
# Vhcs::HlEgglestonCardBenefit.create(
|
||||
# plan_id: plan_id,
|
||||
# benefit_desc: benefit_descs["#{key}"],
|
||||
# benefit: value,
|
||||
# sequence: sequence,
|
||||
# plan_key: pl_plan_key
|
||||
# )
|
||||
# end
|
||||
# end
|
||||
true
|
||||
else
|
||||
false
|
||||
|
||||
@@ -20,13 +20,18 @@ export default class extends Controller {
|
||||
const nextIndex = this.networkLogoTargets.length
|
||||
const num_of_colors = this.formColorValue.length
|
||||
let colorIndex = 0
|
||||
let newSecondaryColor = "copper"
|
||||
if (nextIndex != 0) {
|
||||
colorIndex = nextIndex % num_of_colors
|
||||
if (nextIndex % 2 == 1) {
|
||||
newSecondaryColor = "bronze"
|
||||
}
|
||||
}
|
||||
const newColor = this.formColorValue[colorIndex]
|
||||
return this.templateTarget.innerHTML
|
||||
.replace(/NEW_RECORD/g, nextIndex)
|
||||
.replace(/NEXT_COLOR/g, newColor)
|
||||
.replace(/NEXT_SECONDARY_COLOR/g, newSecondaryColor)
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,20 +1,30 @@
|
||||
import { Controller } from "@hotwired/stimulus"
|
||||
|
||||
export default class extends Controller {
|
||||
static targets = ["template", "container"]
|
||||
|
||||
connect() {
|
||||
console.log("connect")
|
||||
static values = {
|
||||
parentColor: String
|
||||
}
|
||||
|
||||
static targets = ["template", "container"]
|
||||
|
||||
add(event) {
|
||||
console.log("start")
|
||||
event.preventDefault()
|
||||
event.stopPropagation()
|
||||
|
||||
const content = this.templateTarget.innerHTML.replace(/NEW_EXC_RECORD/g, new Date().getTime())
|
||||
const content = this.#updateTemplateException()
|
||||
|
||||
this.containerTarget.insertAdjacentHTML("beforeend", content)
|
||||
console.log("end")
|
||||
|
||||
}
|
||||
|
||||
#updateTemplateException() {
|
||||
const nextIndex = new Date().getTime()
|
||||
console.log("~~ " + this.parentColorValue)
|
||||
return this.templateTarget.innerHTML
|
||||
.replace(/NEW_EXC_RECORD/g, nextIndex)
|
||||
.replace(/PARENT_SECONDARY_COLOR/g, this.parentColorValue)
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,7 @@ export default class extends Controller {
|
||||
static targets = ["template", "container", "plan", "button"]
|
||||
|
||||
add(event) {
|
||||
console.log("start")
|
||||
event.preventDefault()
|
||||
event.stopPropagation()
|
||||
|
||||
@@ -20,14 +21,19 @@ export default class extends Controller {
|
||||
const nextIndex = this.planTargets.length
|
||||
const num_of_colors = this.formColorValue.length
|
||||
let colorIndex = 0
|
||||
let newSecondaryColor = "copper"
|
||||
if (nextIndex != 0) {
|
||||
colorIndex = nextIndex % num_of_colors
|
||||
if (nextIndex % 2 == 1) {
|
||||
newSecondaryColor = "bronze"
|
||||
}
|
||||
}
|
||||
const newColor = this.formColorValue[colorIndex]
|
||||
return this.templateTarget.innerHTML
|
||||
.replace(/NEW_RECORD/g, nextIndex)
|
||||
.replace(/NEW_PLAN/g, nextIndex + 1)
|
||||
.replace(/NEXT_COLOR/g, newColor)
|
||||
.replace(/NEXT_SECONDARY_COLOR/g, newSecondaryColor)
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
class AlternativeNetworkLogo < ApplicationRecord
|
||||
belongs_to :employer_setup_process
|
||||
|
||||
before_save :process_network_logo
|
||||
|
||||
def process_network_logo
|
||||
unless self.network_logo.is_a?(String)
|
||||
self.employer_setup_process.card_logo_files.new(
|
||||
filename: self.network_logo.filename,
|
||||
logo_type: 'network',
|
||||
image: self.network_logo.data,
|
||||
pl_plan_key: self.employer_setup_process.pl_plan_key || ""
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,83 @@
|
||||
module BrittonWeb
|
||||
class SampleIdCards < BrittonWebRecord
|
||||
|
||||
self.table_name = 'sample_id_cards'
|
||||
|
||||
alias_attribute :id, :id
|
||||
alias_attribute :full_name, :full_name
|
||||
alias_attribute :family_id, :family_id
|
||||
alias_attribute :primary_mb_member_key, :primary_mb_member_key
|
||||
alias_attribute :employer_name, :employer_name
|
||||
alias_attribute :pl_plan_key, :pl_plan_key -moved to esp/not used in template
|
||||
alias_attribute :group_number, :group_number
|
||||
alias_attribute :rx_group, :rx_group
|
||||
alias_attribute :network_image, :network_image -moved to esp/not used in template
|
||||
alias_attribute :medical_eff_date, :medical_eff_date
|
||||
alias_attribute :provider_code, :provider_code
|
||||
alias_attribute :provider_line_1, :provider_line_1
|
||||
alias_attribute :provider_line_2, :provider_line_2
|
||||
alias_attribute :provider_line_3, :provider_line_3
|
||||
alias_attribute :provider_line_4, :provider_line_4
|
||||
alias_attribute :provider_line_5, :provider_line_5
|
||||
alias_attribute :provider_line_6, :provider_line_6
|
||||
alias_attribute :provider_line_7, :provider_line_7
|
||||
alias_attribute :provider_line_8, :provider_line_8
|
||||
alias_attribute :provider_line_9, :provider_line_9
|
||||
alias_attribute :provider_line_10, :provider_line_10
|
||||
alias_attribute :provider_line_11, :provider_line_11
|
||||
alias_attribute :mail_to, :mail_to - dont need/not used in template
|
||||
alias_attribute :claim_to_1, :claim_to_1
|
||||
alias_attribute :claim_to_2, :claim_to_2
|
||||
alias_attribute :claim_to_3, :claim_to_3
|
||||
alias_attribute :claim_to_4, :claim_to_4
|
||||
alias_attribute :claim_to_5, :claim_to_5
|
||||
alias_attribute :claim_to_6, :claim_to_6
|
||||
alias_attribute :claim_to_7, :claim_to_7
|
||||
alias_attribute :claim_to_8, :claim_to_8
|
||||
alias_attribute :claim_to_9, :claim_to_9
|
||||
alias_attribute :claim_to_10, :claim_to_10
|
||||
alias_attribute :claim_to_11, :claim_to_11
|
||||
alias_attribute :customer_service, :customer_service
|
||||
alias_attribute :web_url, :web_url
|
||||
alias_attribute :dependent_1, :dependent_1 - keep for now
|
||||
alias_attribute :dependent_2, :dependent_2
|
||||
alias_attribute :dependent_3, :dependent_3
|
||||
alias_attribute :dependent_4, :dependent_4
|
||||
alias_attribute :dependent_5, :dependent_5
|
||||
alias_attribute :dependent_6, :dependent_6
|
||||
alias_attribute :dependent_7, :dependent_7
|
||||
alias_attribute :dependent_8, :dependent_8
|
||||
alias_attribute :benefit_desc_1, :benefit_desc_1
|
||||
alias_attribute :benefit_1, :benefit_1
|
||||
alias_attribute :benefit_desc_2, :benefit_desc_2
|
||||
alias_attribute :benefit_2, :benefit_2
|
||||
alias_attribute :benefit_desc_3, :benefit_desc_3
|
||||
alias_attribute :benefit_3, :benefit_3
|
||||
alias_attribute :benefit_desc_4, :benefit_desc_4
|
||||
alias_attribute :benefit_4, :benefit_4
|
||||
alias_attribute :benefit_desc_5, :benefit_desc_5
|
||||
alias_attribute :benefit_5, :benefit_5
|
||||
alias_attribute :benefit_desc_6, :benefit_desc_6
|
||||
alias_attribute :benefit_6, :benefit_6
|
||||
alias_attribute :benefit_desc_7, :benefit_desc_7
|
||||
alias_attribute :benefit_7, :benefit_7
|
||||
alias_attribute :benefit_desc_8, :benefit_desc_8
|
||||
alias_attribute :benefit_8, :benefit_8
|
||||
alias_attribute :benefit_desc_9, :benefit_desc_9
|
||||
alias_attribute :benefit_9, :benefit_9
|
||||
alias_attribute :benefit_desc_10, :benefit_desc_10
|
||||
alias_attribute :benefit_10, :benefit_10
|
||||
alias_attribute :benefit_desc_11, :benefit_desc_11
|
||||
alias_attribute :benefit_11, :benefit_11
|
||||
alias_attribute :benefit_desc_12, :benefit_desc_12
|
||||
alias_attribute :benefit_12, :benefit_12
|
||||
alias_attribute :benefit_desc_13, :benefit_desc_13
|
||||
alias_attribute :benefit_13, :benefit_13
|
||||
alias_attribute :benefit_desc_14, :benefit_desc_14
|
||||
alias_attribute :benefit_14, :benefit_14
|
||||
alias_attribute :created_at, :created_at
|
||||
alias_attribute :updated_at, :updated_at
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,3 @@
|
||||
class CardLogoFile < ApplicationRecord
|
||||
belongs_to :employer_setup_process, optional: true
|
||||
end
|
||||
@@ -1,3 +1,54 @@
|
||||
class EmployerSetupProcess < ApplicationRecord
|
||||
has_many :plans
|
||||
has_many :plans, dependent: :destroy
|
||||
accepts_nested_attributes_for :plans, allow_destroy: true, reject_if: :all_blank
|
||||
|
||||
has_many :alternative_network_logos, dependent: :destroy
|
||||
accepts_nested_attributes_for :alternative_network_logos, allow_destroy: true, reject_if: :all_blank
|
||||
|
||||
has_many :card_logo_files
|
||||
|
||||
before_save :process_employer_logo
|
||||
|
||||
def process_employer_logo
|
||||
unless self.employer_logo.is_a?(String)
|
||||
self.card_logo_files.new(
|
||||
filename: self.employer_logo.filename,
|
||||
logo_type: 'employer',
|
||||
image: self.employer_logo.data,
|
||||
pl_plan_key: self.pl_plan_key || ""
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
def self.permitted_params(params)
|
||||
params.require(:employer_setup_process).permit(
|
||||
:employer_name,
|
||||
:group_number,
|
||||
:pl_plan_key,
|
||||
:effective_date,
|
||||
:employer_logo,
|
||||
:network_provider,
|
||||
plans_attributes: [
|
||||
:id,
|
||||
:title,
|
||||
:plan_id,
|
||||
:_destroy,
|
||||
plan_benefits_attributes: [
|
||||
:id,
|
||||
:benefit_desc,
|
||||
:benefit,
|
||||
:sequence,
|
||||
:_destroy,
|
||||
]
|
||||
],
|
||||
alternative_network_logos_attributes: [
|
||||
:id,
|
||||
:network_logo,
|
||||
:exception_type,
|
||||
:exception_value,
|
||||
:_destroy
|
||||
]
|
||||
)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class IdCardBenefitsTemplate < ApplicationRecord
|
||||
|
||||
has_many :id_card_benefits
|
||||
has_many :id_card_benefits, dependent: :destroy
|
||||
|
||||
end
|
||||
|
||||
+5
-4
@@ -1,17 +1,18 @@
|
||||
class Plan < ApplicationRecord
|
||||
belongs_to :employer_setup_process
|
||||
has_many :plan_benefits
|
||||
has_many :plan_benefits, dependent: :destroy
|
||||
accepts_nested_attributes_for :plan_benefits, allow_destroy: true, reject_if: :all_blank
|
||||
|
||||
after_create :create_default_benefits
|
||||
after_initialize :create_default_benefits, if: :new_record?
|
||||
|
||||
|
||||
|
||||
private
|
||||
|
||||
|
||||
def create_default_benefits
|
||||
benefits = IdCardBenefitsTemplate.find_by(title: "BLANK").id_card_benefits.sort_by(&:sequence)
|
||||
benefits.each do |ben|
|
||||
plan_benefits.create(benefit_desc: ben.benefit_desc, sequence: ben.sequence)
|
||||
plan_benefits.new(benefit_desc: ben.benefit_desc, sequence: ben.sequence)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,13 @@
|
||||
module Vhcs
|
||||
class HLEggIdCardDependent < VhcsRecord
|
||||
|
||||
self.table_name = 'HLEggIdCardDependent'
|
||||
|
||||
alias_attribute :id, :Id
|
||||
alias_attribute :family_id, :FamilyId
|
||||
alias_attribute :dependent_name, :DependentName
|
||||
alias_attribute :sequence_number, :SequenceNumber
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,48 @@
|
||||
module Vhcs
|
||||
class HLIDCardProvider < VhcsRecord
|
||||
|
||||
self.table_name = 'HLIDCardProvider'
|
||||
|
||||
alias_attribute :provider_code, :ProviderCode
|
||||
alias_attribute :provider_line_1, :ProviderLine1
|
||||
alias_attribute :provider_line_2, :ProviderLine2
|
||||
alias_attribute :provider_line_3, :ProviderLine3
|
||||
alias_attribute :provider_line_4, :ProviderLine4
|
||||
alias_attribute :provider_line_5, :ProviderLine5
|
||||
alias_attribute :mail_to, :MailTo
|
||||
alias_attribute :mail_to_2, :MailTo2
|
||||
alias_attribute :contact_line_1, :ContactLine1
|
||||
alias_attribute :contact_line_2, :ContactLine2
|
||||
alias_attribute :contact_line_3, :ContactLine3
|
||||
alias_attribute :group_number, :GroupNumber
|
||||
alias_attribute :claim_to_1, :ClaimTo1
|
||||
alias_attribute :claim_to_2, :ClaimTo2
|
||||
alias_attribute :claim_to_3, :ClaimTo3
|
||||
alias_attribute :claim_to_4, :ClaimTo4
|
||||
alias_attribute :claim_to_5, :ClaimTo5
|
||||
alias_attribute :claim_to_6, :ClaimTo6
|
||||
alias_attribute :claim_to_7, :ClaimTo7
|
||||
alias_attribute :claim_to_8, :ClaimTo8
|
||||
alias_attribute :claim_to_9, :ClaimTo9
|
||||
alias_attribute :claim_to_10, :ClaimTo10
|
||||
alias_attribute :claim_to_11, :ClaimTo11
|
||||
alias_attribute :provider_line_6, :ProviderLine6
|
||||
alias_attribute :provider_line_7, :ProviderLine7
|
||||
alias_attribute :provider_line_8, :ProviderLine8
|
||||
alias_attribute :provider_line_9, :ProviderLine9
|
||||
alias_attribute :provider_line_10, :ProviderLine10
|
||||
alias_attribute :provider_line_11, :ProviderLine11
|
||||
alias_attribute :rx_group_id, :RXGroupId
|
||||
alias_attribute :rx_contact, :RXContact
|
||||
alias_attribute :provider_lookup_1, :ProviderLookup1
|
||||
alias_attribute :provider_lookup_2, :ProviderLookup2
|
||||
alias_attribute :precert1, :Precert1
|
||||
alias_attribute :precert2, :Precert2
|
||||
alias_attribute :precert3, :Precert3
|
||||
alias_attribute :precert4, :Precert4
|
||||
alias_attribute :precert5, :Precert5
|
||||
alias_attribute :precert6, :Precert6
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,25 @@
|
||||
module Vhcs
|
||||
class HLIDCardsEgg < VhcsRecord
|
||||
|
||||
self.table_name = 'HLIDCardsEgg'
|
||||
|
||||
alias_attribute :facility, :Facility
|
||||
alias_attribute :division, :Division
|
||||
alias_attribute :full_name, :FullName
|
||||
alias_attribute :ssn, :SSN
|
||||
alias_attribute :medical_coverage, :MedicalCoverage
|
||||
alias_attribute :medical_eff_date, :MedicalEffDate
|
||||
alias_attribute :medical_group_num, :MedicalGroupNum
|
||||
alias_attribute :dental_coverage, :DentalCoverage
|
||||
alias_attribute :dental_eff_date, :DentalEffDate
|
||||
alias_attribute :dental_group_num, :DentalGroupNum
|
||||
alias_attribute :card_type, :CardType
|
||||
alias_attribute :group_number, :GroupNumber
|
||||
alias_attribute :pb_product_key, :PBProductKey
|
||||
alias_attribute :id, :Id
|
||||
alias_attribute :pl_plan_key, :PLPlanKey
|
||||
alias_attribute :mb_member_key, :MBMemberKey
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,72 @@
|
||||
module BenefitsWordDoc
|
||||
class MapEmployerInformation
|
||||
|
||||
def initialize(process, word_doc_section)
|
||||
@process = process
|
||||
@word_doc_section = word_doc_section
|
||||
end
|
||||
|
||||
def call
|
||||
search_fields = mapping_hash.keys.to_set
|
||||
|
||||
@word_doc_section.each do |line|
|
||||
matching_field = search_fields.detect { |field| line.include?(field) }
|
||||
if matching_field
|
||||
field_mapping = mapping_hash[matching_field]
|
||||
field_regex = field_mapping[:doc_to_process_regex]
|
||||
field_value = line.match(field_regex)[1].strip
|
||||
process_field = field_mapping[:process_field]
|
||||
|
||||
if field_mapping[:validation].present?
|
||||
validation_type = field_mapping[:validation]
|
||||
if send("is_#{validation_type}?".to_sym, field_value)
|
||||
@process[process_field] = field_value
|
||||
end
|
||||
else
|
||||
@process[process_field] = field_value
|
||||
end
|
||||
end
|
||||
end
|
||||
@process.save
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def mapping_hash
|
||||
{
|
||||
'Employer Name' => {
|
||||
process_field: :employer_name,
|
||||
doc_field: 'Employer Name',
|
||||
doc_field_desc: 'Follows pattern - Employer Name:New Employer',
|
||||
doc_to_process_regex: /.*:(.*)/,
|
||||
regex_desc: 'Grabs everything after colon'
|
||||
},
|
||||
'Group Number' => {
|
||||
process_field: :group_number,
|
||||
doc_field: 'Group Number',
|
||||
doc_field_desc: 'Follows pattern - Group Number:099999',
|
||||
doc_to_process_regex: /.*:(.*)/,
|
||||
regex_desc: 'Grabs everything after colon',
|
||||
validation: 'number'
|
||||
},
|
||||
'Group Effective Date' => {
|
||||
process_field: :effective_date,
|
||||
doc_field: 'Group Effective Date',
|
||||
doc_field_desc: 'Follows pattern - Group Effective Date:12/1/2025',
|
||||
doc_to_process_regex: /.*:(.*)/,
|
||||
regex_desc: 'Grabs everything after colon',
|
||||
validation: 'date'
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
def is_number?(string)
|
||||
true if Float(string) rescue false
|
||||
end
|
||||
|
||||
def is_date?(string)
|
||||
true if Date.parse rescue false
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,28 @@
|
||||
module BenefitsWordDoc
|
||||
class MapEmployerLogo
|
||||
|
||||
def initialize(process, word_doc)
|
||||
@process = process
|
||||
@word_doc = word_doc
|
||||
end
|
||||
|
||||
def call
|
||||
extracted_images = []
|
||||
Zip::File.open(@word_doc) do |zip_file|
|
||||
zip_file.each do |entry|
|
||||
if entry.name.start_with?('word/media/') && !entry.directory?
|
||||
filename = @process.employer_name.titleize.gsub(/\s+/, '').concat("Logo.png")
|
||||
image_data = entry.get_input_stream.read
|
||||
extracted_images << { filename: filename, data: image_data }
|
||||
end
|
||||
end
|
||||
end
|
||||
if extracted_images.length > 1
|
||||
employer_logo = extracted_images.last
|
||||
@process.employer_logo = employer_logo[:filename]
|
||||
# same file logic
|
||||
end
|
||||
@process.save
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,149 @@
|
||||
module BenefitsWordDoc
|
||||
class MapPlansInformation
|
||||
|
||||
def initialize(process, word_doc_section)
|
||||
@process = process
|
||||
@word_doc_section = word_doc_section
|
||||
end
|
||||
|
||||
def call
|
||||
search_fields = mapping_hash.keys.to_set
|
||||
plans_indexes = @word_doc_section.each_index.select { |index| @word_doc_section[index].match?(/\d*\.?\d+k/i) }
|
||||
|
||||
plans_indexes.each do |plan_index|
|
||||
new_plan = @process.plans.create(title: @word_doc_section[plan_index])
|
||||
plan_lines = @word_doc_section.slice(plan_index + 1, 14)
|
||||
plan_lines.each_with_index do |line, i|
|
||||
matching_field = search_fields.detect { |field| line.include?(field) }
|
||||
if matching_field
|
||||
puts matching_field
|
||||
field_mapping = mapping_hash[matching_field]
|
||||
field_regex = field_mapping[:doc_to_process_regex]
|
||||
field_value = line.match(field_regex)[1].strip
|
||||
process_benefit_desc_field = field_mapping[:process_benefit_desc_field]
|
||||
puts process_benefit_desc_field
|
||||
puts new_plan.plan_benefits.map { |b| b.benefit_desc}
|
||||
new_benefit = new_plan.plan_benefits.find_by(benefit_desc: process_benefit_desc_field)
|
||||
new_benefit.benefit = field_value
|
||||
new_benefit.save
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def mapping_hash
|
||||
{
|
||||
'Physician Visit' => {
|
||||
process_field: :benefit,
|
||||
process_benefit_desc_field: 'Primary Visit',
|
||||
doc_field_desc: 'Follows pattern - Physician Visit$x,xxx',
|
||||
doc_to_process_regex: /\$(.*)/,
|
||||
regex_desc: 'Grabs everything after dollar sign'
|
||||
},
|
||||
'Specialist Visit' => {
|
||||
process_field: :benefit,
|
||||
process_benefit_desc_field: 'Specialist Visit',
|
||||
doc_field_desc: 'Follows pattern - Specialist Visit$x,xxx',
|
||||
doc_to_process_regex: /\$(.*)/,
|
||||
regex_desc: 'Grabs everything after dollar sign'
|
||||
},
|
||||
'Urgent Care' => {
|
||||
process_field: :benefit,
|
||||
process_benefit_desc_field: 'Urgent Care',
|
||||
doc_field_desc: 'Follows pattern - Urgent Care$x,xxx',
|
||||
doc_to_process_regex: /\$(.*)/,
|
||||
regex_desc: 'Grabs everything after dollar sign'
|
||||
},
|
||||
'Individual Deductible (in network )' => {
|
||||
process_field: :benefit,
|
||||
process_benefit_desc_field: 'INN–Ind Ded',
|
||||
doc_field_desc: 'Follows pattern - Individual Deductible (in network )$x,xxx',
|
||||
doc_to_process_regex: /\$(.*)/,
|
||||
regex_desc: 'Grabs everything after dollar sign'
|
||||
},
|
||||
'Family Deductible(in network )' => {
|
||||
process_field: :benefit,
|
||||
process_benefit_desc_field: 'INN–Family Ded',
|
||||
doc_field_desc: 'Follows pattern - Family Deductible(in network )$x,xxx',
|
||||
doc_to_process_regex: /\$(.*)/,
|
||||
regex_desc: 'Grabs everything after dollar sign'
|
||||
},
|
||||
'Individual Deductible (out of network)' => {
|
||||
process_field: :benefit,
|
||||
process_benefit_desc_field: 'OON–Ind Ded',
|
||||
doc_field_desc: 'Follows pattern - Individual Deductible (out of network)$x,xxx',
|
||||
doc_to_process_regex: /\$(.*)/,
|
||||
regex_desc: 'Grabs everything after dollar sign'
|
||||
},
|
||||
'Family Deductible (out of network)' => {
|
||||
process_field: :benefit,
|
||||
process_benefit_desc_field: 'OON–Family Ded',
|
||||
doc_field_desc: 'Follows pattern - Family Deductible (out of network)$x,xxx',
|
||||
doc_to_process_regex: /\$(.*)/,
|
||||
regex_desc: 'Grabs everything after dollar sign'
|
||||
},
|
||||
'Co-Insurance' => {
|
||||
process_field: :benefit,
|
||||
process_benefit_desc_field: 'Co-Insurance',
|
||||
doc_field_desc: 'Follows pattern - Co-Insurance70%/30%',
|
||||
doc_to_process_regex: /Co-Insurance(.*)/,
|
||||
regex_desc: 'Grabs everything after field name'
|
||||
},
|
||||
'Out-of-Pocket(in network)' => {
|
||||
process_field: :benefit,
|
||||
process_benefit_desc_field: 'INN–Ind OOP',
|
||||
doc_field_desc: 'Follows pattern - Out-of-Pocket(in network)$x,xxx',
|
||||
doc_to_process_regex: /\$(.*)/,
|
||||
regex_desc: 'Grabs everything after dollar sign'
|
||||
},
|
||||
'Out-of-Pocket Family(in network)' => {
|
||||
process_field: :benefit,
|
||||
process_benefit_desc_field: 'INN–Family OOP',
|
||||
doc_field_desc: 'Follows pattern - Out-of-Pocket Family(in network)$x,xxx',
|
||||
doc_to_process_regex: /\$(.*)/,
|
||||
regex_desc: 'Grabs everything after dollar sign'
|
||||
},
|
||||
'Out-of-Pocket(out of network)' => {
|
||||
process_field: :benefit,
|
||||
process_benefit_desc_field: 'OON–Ind OOP',
|
||||
doc_field_desc: 'Follows pattern - Out-of-Pocket(out of network)$x,xxx',
|
||||
doc_to_process_regex: /\$(.*)/,
|
||||
regex_desc: 'Grabs everything after dollar sign'
|
||||
},
|
||||
'Out-of-Pocket Family (out of network)' => {
|
||||
process_field: :benefit,
|
||||
process_benefit_desc_field: 'OON–Family OOP',
|
||||
doc_field_desc: 'Follows pattern - Out-of-Pocket Family (out of network)$x,xxx',
|
||||
doc_to_process_regex: /\$(.*)/,
|
||||
regex_desc: 'Grabs everything after dollar sign'
|
||||
},
|
||||
'Emergency Room' => {
|
||||
process_field: :benefit,
|
||||
process_benefit_desc_field: 'Emergency Room',
|
||||
doc_field_desc: 'Follows pattern - Emergency RoomXxxxx',
|
||||
doc_to_process_regex: /Emergency Room(.*)/,
|
||||
regex_desc: 'Grabs everything after field name'
|
||||
},
|
||||
'Preventive Care' => {
|
||||
process_field: :benefit,
|
||||
process_benefit_desc_field: 'Preventive Care',
|
||||
doc_field_desc: 'Follows pattern - Preventive Care100%',
|
||||
doc_to_process_regex: /Preventive Care(.*)/,
|
||||
regex_desc: 'Grabs everything after field name'
|
||||
},
|
||||
}
|
||||
end
|
||||
|
||||
def is_number?(string)
|
||||
true if Float(string) rescue false
|
||||
end
|
||||
|
||||
def is_date?(string)
|
||||
true if Date.parse rescue false
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
@@ -11,146 +11,20 @@ class BenefitsWordDocProcessor
|
||||
|
||||
def call
|
||||
doc = Docx::Document.open(@word_doc)
|
||||
data_lines = doc.paragraphs.map { |p| p.to_s.squish }.reject!(&:empty?)
|
||||
|
||||
index = 40
|
||||
start_of_plans_index = data_lines.index { |s| s == 'Medical Plan'}
|
||||
|
||||
general_information = doc.paragraphs.slice(0, index)
|
||||
plan_information = doc.paragraphs.slice(index + 1..)
|
||||
employer_information = data_lines.slice(0, start_of_plans_index)
|
||||
plan_information = data_lines.slice(start_of_plans_index + 1..)
|
||||
|
||||
BenefitsWordDoc::MapEmployerInformation.new(@process, employer_information).call
|
||||
BenefitsWordDoc::MapEmployerLogo.new(@process, @word_doc).call
|
||||
BenefitsWordDoc::MapPlansInformation.new(@process, plan_information).call
|
||||
|
||||
general_fields(general_information)
|
||||
plans(plan_information)
|
||||
logo
|
||||
|
||||
@process
|
||||
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def general_fields(general_information)
|
||||
fields = ['Group Number:', 'Employer Name:', 'Group Effective Date:']
|
||||
general_information.each do |gi|
|
||||
field_string = gi.to_s
|
||||
if field_string.include?('Group Number:')
|
||||
value = field_string.delete_prefix('Group Number:').strip
|
||||
@process.group_number = value
|
||||
elsif field_string.include?('Employer Name:')
|
||||
value = field_string.delete_prefix('Employer Name:').strip
|
||||
@process.employer_name = value
|
||||
elsif field_string.include?('Group Effective Date:')
|
||||
value = field_string.delete_prefix('Group Effective Date:').strip
|
||||
@process.effect_date = value
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def logo
|
||||
extracted_images = []
|
||||
Zip::File.open(@word_doc) do |zip_file|
|
||||
zip_file.each do |entry|
|
||||
if entry.name.start_with?('word/media/') && !entry.directory?
|
||||
filename = File.basename(entry.name)
|
||||
image_data = entry.get_input_stream.read
|
||||
extracted_images << { filename: filename, data: image_data }
|
||||
end
|
||||
end
|
||||
end
|
||||
if extracted_images.length > 1
|
||||
@process.logo_filename = extracted_images.last[:filename]
|
||||
end
|
||||
end
|
||||
|
||||
def plans(plan_information)
|
||||
plans_array = []
|
||||
plan_information.each_with_index do |pin, i|
|
||||
if pin.to_s.match?(/\d*\.?\d+k/i)
|
||||
new_plan = {title: pin.to_s.strip, start_index: i, benefits: []}
|
||||
plans_array.push(new_plan)
|
||||
end
|
||||
end
|
||||
|
||||
plans_array.each do |pl|
|
||||
new_plan = Plan.create(title: pl[:title], employer_setup_process: @process)
|
||||
plan_fields = plan_information.slice(pl[:start_index] + 1, 14)
|
||||
plan_fields.each_with_index do |pf, i|
|
||||
field_string = pf.to_s
|
||||
if field_string.strip.length > 1
|
||||
case field_string
|
||||
when ->(string) { string.include?("Physician Visit") }
|
||||
value = field_string.delete_prefix("Physician Visit")
|
||||
new_benefit = new_plan.plan_benefits.find_by(benefit_desc: "Primary Visit")
|
||||
new_benefit.benefit = value
|
||||
new_benefit.save
|
||||
when ->(string) { string.include?("Specialist Visit") }
|
||||
value = field_string.delete_prefix("Specialist Visit")
|
||||
new_benefit = new_plan.plan_benefits.find_by(benefit_desc: "Specialist Visit")
|
||||
new_benefit.benefit = value
|
||||
new_benefit.save
|
||||
when ->(string) { string.include?("Urgent Care") }
|
||||
value = field_string.delete_prefix("Urgent Care")
|
||||
new_benefit = new_plan.plan_benefits.find_by(benefit_desc: "Urgent Care")
|
||||
new_benefit.benefit = value
|
||||
new_benefit.save
|
||||
when ->(string) { string.include?("Individual Deductible (in network )") }
|
||||
value = field_string.delete_prefix("Individual Deductible (in network )")
|
||||
new_benefit = new_plan.plan_benefits.find_by(benefit_desc: "INN–Ind Ded")
|
||||
new_benefit.benefit = value
|
||||
new_benefit.save
|
||||
when ->(string) { string.include?("Family Deductible(in network )") }
|
||||
value = field_string.delete_prefix("Family Deductible(in network )")
|
||||
new_benefit = new_plan.plan_benefits.find_by(benefit_desc: "INN–Family Ded")
|
||||
new_benefit.benefit = value
|
||||
new_benefit.save
|
||||
when ->(string) { string.include?("Individual Deductible (out of network)") }
|
||||
value = field_string.delete_prefix("Individual Deductible (out of network)")
|
||||
new_benefit = new_plan.plan_benefits.find_by(benefit_desc: "OON–Ind Ded")
|
||||
new_benefit.benefit = value
|
||||
new_benefit.save
|
||||
when ->(string) { string.include?("Family Deductible (out of network) ") }
|
||||
value = field_string.delete_prefix("Family Deductible (out of network) ")
|
||||
new_benefit = new_plan.plan_benefits.find_by(benefit_desc: "OON–Family Ded")
|
||||
new_benefit.benefit = value
|
||||
new_benefit.save
|
||||
when ->(string) { string.include?("Co-Insurance") }
|
||||
value = field_string.delete_prefix("Co-Insurance")
|
||||
new_benefit = new_plan.plan_benefits.find_by(benefit_desc: "Co-Insurance")
|
||||
new_benefit.benefit = value
|
||||
new_benefit.save
|
||||
when ->(string) { string.include?("Out-of-Pocket(in network) ") }
|
||||
value = field_string.delete_prefix("Out-of-Pocket(in network) ")
|
||||
new_benefit = new_plan.plan_benefits.find_by(benefit_desc: "INN–Ind OOP")
|
||||
new_benefit.benefit = value
|
||||
new_benefit.save
|
||||
when ->(string) { string.include?("Out-of-Pocket Family(in network) ") }
|
||||
value = field_string.delete_prefix("Out-of-Pocket Family(in network) ")
|
||||
new_benefit = new_plan.plan_benefits.find_by(benefit_desc: "INN–Family OOP")
|
||||
new_benefit.benefit = value
|
||||
new_benefit.save
|
||||
when ->(string) { string.include?("Out-of-Pocket(out of network) ") }
|
||||
value = field_string.delete_prefix("Out-of-Pocket(out of network) ")
|
||||
new_benefit = new_plan.plan_benefits.find_by(benefit_desc: "OON–Ind OOP")
|
||||
new_benefit.benefit = value
|
||||
new_benefit.save
|
||||
when ->(string) { string.include?("Out-of-Pocket Family (out of network) ") }
|
||||
value = field_string.delete_prefix("Out-of-Pocket Family (out of network) ")
|
||||
new_benefit = new_plan.plan_benefits.find_by(benefit_desc: "OON–Family OOP")
|
||||
new_benefit.benefit = value
|
||||
new_benefit.save
|
||||
when ->(string) { string.include?("Emergency Room ") }
|
||||
value = field_string.delete_prefix("Emergency Room ")
|
||||
new_benefit = new_plan.plan_benefits.find_by(benefit_desc: "Emergency Room")
|
||||
new_benefit.benefit = value
|
||||
new_benefit.save
|
||||
when ->(string) { string.include?("Preventive Care") }
|
||||
value = field_string.delete_prefix("Preventive Care")
|
||||
new_benefit = new_plan.plan_benefits.find_by(benefit_desc: "Preventive Care")
|
||||
new_benefit.benefit = value
|
||||
new_benefit.save
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -0,0 +1,163 @@
|
||||
class BenefitsWordDocProcessorOld
|
||||
|
||||
def initialize(word_doc, process=nil)
|
||||
@word_doc = word_doc
|
||||
if process
|
||||
@process = process
|
||||
else
|
||||
@process = EmployerSetupProcess.new
|
||||
end
|
||||
end
|
||||
|
||||
def call
|
||||
doc = Docx::Document.open(@word_doc)
|
||||
|
||||
index = 40
|
||||
|
||||
general_information = doc.paragraphs.slice(0, index)
|
||||
plan_information = doc.paragraphs.slice(index + 1..)
|
||||
|
||||
|
||||
general_fields(general_information)
|
||||
plans(plan_information)
|
||||
employer_logo()
|
||||
|
||||
@process
|
||||
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def general_fields(general_information)
|
||||
fields = ['Group Number:', 'Employer Name:', 'Group Effective Date:']
|
||||
general_information.each do |gi|
|
||||
field_string = gi.to_s
|
||||
if field_string.include?('Group Number:')
|
||||
value = field_string.delete_prefix('Group Number:').strip
|
||||
if is_number?(value)
|
||||
@process.group_number = value
|
||||
end
|
||||
elsif field_string.include?('Employer Name:')
|
||||
value = field_string.delete_prefix('Employer Name:').strip
|
||||
@process.employer_name = value
|
||||
elsif field_string.include?('Group Effective Date:')
|
||||
value = field_string.delete_prefix('Group Effective Date:').strip
|
||||
@process.effective_date = value
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def employer_logo
|
||||
extracted_images = []
|
||||
Zip::File.open(@word_doc) do |zip_file|
|
||||
zip_file.each do |entry|
|
||||
if entry.name.start_with?('word/media/') && !entry.directory?
|
||||
filename = File.basename(entry.name)
|
||||
image_data = entry.get_input_stream.read
|
||||
extracted_images << { filename: filename, data: image_data }
|
||||
end
|
||||
end
|
||||
end
|
||||
if extracted_images.length > 1
|
||||
@process.employer_logo = @process.employer_name.titleize.gsub(/\s+/, '').concat("Logo.png")
|
||||
# same file logic
|
||||
end
|
||||
end
|
||||
|
||||
def plans(plan_information)
|
||||
plans_array = []
|
||||
plan_information.each_with_index do |pin, i|
|
||||
if pin.to_s.match?(/\d*\.?\d+k/i)
|
||||
new_plan = {title: pin.to_s.strip, start_index: i, benefits: []}
|
||||
plans_array.push(new_plan)
|
||||
end
|
||||
end
|
||||
|
||||
plans_array.each do |pl|
|
||||
new_plan = Plan.create(title: pl[:title], employer_setup_process: @process)
|
||||
plan_fields = plan_information.slice(pl[:start_index] + 1, 14)
|
||||
plan_fields.each_with_index do |pf, i|
|
||||
field_string = pf.to_s
|
||||
if field_string.strip.length > 1
|
||||
case field_string
|
||||
when ->(string) { string.include?("Physician Visit") }
|
||||
value = field_string.delete_prefix("Physician Visit")
|
||||
new_benefit = new_plan.plan_benefits.find_by(benefit_desc: "Primary Visit")
|
||||
new_benefit.benefit = value
|
||||
new_benefit.save
|
||||
when ->(string) { string.include?("Specialist Visit") }
|
||||
value = field_string.delete_prefix("Specialist Visit")
|
||||
new_benefit = new_plan.plan_benefits.find_by(benefit_desc: "Specialist Visit")
|
||||
new_benefit.benefit = value
|
||||
new_benefit.save
|
||||
when ->(string) { string.include?("Urgent Care") }
|
||||
value = field_string.delete_prefix("Urgent Care")
|
||||
new_benefit = new_plan.plan_benefits.find_by(benefit_desc: "Urgent Care")
|
||||
new_benefit.benefit = value
|
||||
new_benefit.save
|
||||
when ->(string) { string.include?("Individual Deductible (in network )") }
|
||||
value = field_string.delete_prefix("Individual Deductible (in network )")
|
||||
new_benefit = new_plan.plan_benefits.find_by(benefit_desc: "INN–Ind Ded")
|
||||
new_benefit.benefit = value
|
||||
new_benefit.save
|
||||
when ->(string) { string.include?("Family Deductible(in network )") }
|
||||
value = field_string.delete_prefix("Family Deductible(in network )")
|
||||
new_benefit = new_plan.plan_benefits.find_by(benefit_desc: "INN–Family Ded")
|
||||
new_benefit.benefit = value
|
||||
new_benefit.save
|
||||
when ->(string) { string.include?("Individual Deductible (out of network)") }
|
||||
value = field_string.delete_prefix("Individual Deductible (out of network)")
|
||||
new_benefit = new_plan.plan_benefits.find_by(benefit_desc: "OON–Ind Ded")
|
||||
new_benefit.benefit = value
|
||||
new_benefit.save
|
||||
when ->(string) { string.include?("Family Deductible (out of network) ") }
|
||||
value = field_string.delete_prefix("Family Deductible (out of network) ")
|
||||
new_benefit = new_plan.plan_benefits.find_by(benefit_desc: "OON–Family Ded")
|
||||
new_benefit.benefit = value
|
||||
new_benefit.save
|
||||
when ->(string) { string.include?("Co-Insurance") }
|
||||
value = field_string.delete_prefix("Co-Insurance")
|
||||
new_benefit = new_plan.plan_benefits.find_by(benefit_desc: "Co-Insurance")
|
||||
new_benefit.benefit = value
|
||||
new_benefit.save
|
||||
when ->(string) { string.include?("Out-of-Pocket(in network) ") }
|
||||
value = field_string.delete_prefix("Out-of-Pocket(in network) ")
|
||||
new_benefit = new_plan.plan_benefits.find_by(benefit_desc: "INN–Ind OOP")
|
||||
new_benefit.benefit = value
|
||||
new_benefit.save
|
||||
when ->(string) { string.include?("Out-of-Pocket Family(in network) ") }
|
||||
value = field_string.delete_prefix("Out-of-Pocket Family(in network) ")
|
||||
new_benefit = new_plan.plan_benefits.find_by(benefit_desc: "INN–Family OOP")
|
||||
new_benefit.benefit = value
|
||||
new_benefit.save
|
||||
when ->(string) { string.include?("Out-of-Pocket(out of network) ") }
|
||||
value = field_string.delete_prefix("Out-of-Pocket(out of network) ")
|
||||
new_benefit = new_plan.plan_benefits.find_by(benefit_desc: "OON–Ind OOP")
|
||||
new_benefit.benefit = value
|
||||
new_benefit.save
|
||||
when ->(string) { string.include?("Out-of-Pocket Family (out of network) ") }
|
||||
value = field_string.delete_prefix("Out-of-Pocket Family (out of network) ")
|
||||
new_benefit = new_plan.plan_benefits.find_by(benefit_desc: "OON–Family OOP")
|
||||
new_benefit.benefit = value
|
||||
new_benefit.save
|
||||
when ->(string) { string.include?("Emergency Room ") }
|
||||
value = field_string.delete_prefix("Emergency Room ")
|
||||
new_benefit = new_plan.plan_benefits.find_by(benefit_desc: "Emergency Room")
|
||||
new_benefit.benefit = value
|
||||
new_benefit.save
|
||||
when ->(string) { string.include?("Preventive Care") }
|
||||
value = field_string.delete_prefix("Preventive Care")
|
||||
new_benefit = new_plan.plan_benefits.find_by(benefit_desc: "Preventive Care")
|
||||
new_benefit.benefit = value
|
||||
new_benefit.save
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def is_number?(string)
|
||||
true if Float(string) rescue false
|
||||
end
|
||||
|
||||
end
|
||||
@@ -0,0 +1,81 @@
|
||||
module SampleCard
|
||||
class DataFormatter
|
||||
|
||||
def initialize(process)
|
||||
@process = process
|
||||
end
|
||||
|
||||
def call
|
||||
@sample_card = BrittonWeb::SampleIdCard.new()
|
||||
|
||||
set_process_fields()
|
||||
set_generic_fields()
|
||||
set_network_fields()
|
||||
sample_cards = set_plan_fields()
|
||||
sample_cards.each(&:save!)
|
||||
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def set_process_fields
|
||||
selected_attributes = {
|
||||
employer_name: @process.employer_name,
|
||||
group_number: @process.group_number,
|
||||
medical_eff_date: @process.effective_date,
|
||||
network_image: @process.logo_filename,
|
||||
status: "imported"
|
||||
}
|
||||
|
||||
@sample_card.assign_attributes(selected_attributes)
|
||||
end
|
||||
|
||||
def set_plan_fields
|
||||
plans_sample_cards = []
|
||||
@process.plans.each do |plan|
|
||||
plan_sample_card = @sample_card.dup
|
||||
plan_sample_card.family_id = plan.title
|
||||
plan.plan_benefits.each do |bene|
|
||||
plan_sample_card["benefit_desc_#{bene.sequence}".to_sym] = bene.benefit_desc
|
||||
plan_sample_card["benefit_#{bene.sequence}".to_sym] = bene.benefit
|
||||
end
|
||||
plans_sample_cards.push(plan_sample_card)
|
||||
end
|
||||
plans_sample_cards
|
||||
end
|
||||
|
||||
def set_generic_fields
|
||||
selected_attributes = {
|
||||
full_name: "JANE DOE",
|
||||
primary_mb_member_key: "99999",
|
||||
rx_group: "99999"
|
||||
}
|
||||
|
||||
@sample_card.assign_attributes(selected_attributes)
|
||||
end
|
||||
|
||||
def set_network_fields
|
||||
provider_code = @process.network_provider.includes?("Cigna") ? "5" : "2"
|
||||
# if @process.network_provider.includes?("Cigna")
|
||||
# provider_code = "5"
|
||||
# network_image = "CignaLogo.png"
|
||||
# else
|
||||
# provider_code = "2"
|
||||
# network_image = "Logo_MC_PMS.png"
|
||||
# end
|
||||
provider_information = Vhcs::HLIDCardProvider.find_by(provider_code: provider_code)
|
||||
selected_attributes = provider_information.attributes.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,
|
||||
: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
|
||||
)
|
||||
|
||||
@sample_card.assign_attributes(selected_attributes)
|
||||
end
|
||||
|
||||
def set_dependent_fields
|
||||
# Not needed for sample card
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,21 @@
|
||||
module SampleCard
|
||||
class JasperPdfGenerator
|
||||
|
||||
def initialize(jasper_url)
|
||||
@jasper_url = jasper_url
|
||||
end
|
||||
|
||||
def call
|
||||
|
||||
response = HTTParty.get(@jasper_url)
|
||||
card_pdf = CombinePDF.parse(response.body)
|
||||
|
||||
# todays_date = Date.today.strftime("%m-%d-%Y")
|
||||
# card_pdf.save("tmp/service_test_member_id_card_#{todays_date}.pdf")
|
||||
|
||||
card_pdf
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,39 @@
|
||||
module SampleCard
|
||||
class JasperUrlGenerator
|
||||
|
||||
def initialize(process, family_id)
|
||||
@family_id = family_id
|
||||
@process = process
|
||||
end
|
||||
|
||||
def call
|
||||
@net_logo = determine_network_logo
|
||||
|
||||
URI::HTTPS.build(url_components)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def determine_network_logo
|
||||
# if @network_logos.length > 1
|
||||
# member_geographic_info = Vhcs::PbEntityAddress.joins("INNER JOIN vwMBMember ON PBEntityAddress.PBEntityKey = vwMBMember.PBEntityKey AND PBEntityAddress.AddressTypeID = 1137").where("vwMBMember.FamilyID = ?", @family_id).first
|
||||
# @network_logos.where.not(default: true).each do |pnl|
|
||||
# if member_geographic_info[pnl.exception_type] == pnl.exception_value
|
||||
# return pnl.net_logo
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
# @network_logos.find_by(default: true).net_logo
|
||||
@process.network_logo
|
||||
end
|
||||
|
||||
def url_components
|
||||
{
|
||||
host: 'www.dicins.com',
|
||||
path: '/ReportServerDEV/PdfServlet',
|
||||
query: "reportConn=BrittonWeb&id=&reportName=#{@process.card_template}&FamilyId=#{@family_id}&BackImage=c:/images/#{@net_logo}&reportDir=secure/Documents&SUBREPORT_DIR=/&ImageDir=secure/Documents&netToken=3a4a8b03f4dfb0e6e3fc82dd369f70ef&FileType=PDF"
|
||||
}
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,27 @@
|
||||
module SampleCard
|
||||
class PdfPrinter
|
||||
|
||||
def initialize(process, sample_cards)
|
||||
@process = process
|
||||
@sample_cards = sample_cards
|
||||
end
|
||||
|
||||
def call
|
||||
group_cards_pdf = CombinePDF.new
|
||||
@sample_cards.each do |sample_card|
|
||||
url = SampleCard::JasperUrlGenerator.new(@process, sample_card.family_id).call
|
||||
puts url
|
||||
sample_card_pdf = SampleCard::JasperPdfGenerator.new(url).call
|
||||
|
||||
group_cards_pdf << sample_card_pdf
|
||||
end
|
||||
|
||||
employer_name = @process.employer_name.downcase.tr(" ", "_")
|
||||
todays_date = Date.today.strftime("%m-%d-%Y")
|
||||
group_cards_pdf.save("tmp/#{employer_name}_sample_cards_#{todays_date}.pdf")
|
||||
|
||||
group_cards_pdf
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,37 @@
|
||||
<div class="flex space-x-5 items-center mt-4">
|
||||
<label for="file_upload_input_NEW_RECORD" class="cursor-pointer bg-NEXT_COLOR hover:bg-NEXT_COLOR-tinted text-platinum font-bold py-2 px-4 rounded border border-platinum">
|
||||
Choose Network Logo File
|
||||
</label>
|
||||
<span id="file_name_display_NEW_RECORD" class="ml-2 text-NEXT_COLOR font-semibold">No file chosen</span>
|
||||
<%= network_fields.file_field :network_logo, class: "hidden", id: "file_upload_input_NEW_RECORD", data: { add_alt_network_logo_target: "networkLogo" } %>
|
||||
</div>
|
||||
<div class="flex items-end space-x-6 w-full">
|
||||
<div class="w-full">
|
||||
<%= network_fields.select :exception_type, options_for_select(["Zip","State"]), label: { text: "Exception Type" }, prompt: "Select Type", class: "w-full" %>
|
||||
</div>
|
||||
<div class="w-full">
|
||||
<%= network_fields.text_field :exception_value, label: { text: "Exception Value" }, class: "w-full" %>
|
||||
</div>
|
||||
<div class="w-1/5">
|
||||
<%= network_fields.hidden_field :_destroy %>
|
||||
<%= button_tag "Remove", class: "cursor-pointer bg-deepcove hover:bg-brightlava text-xl font-bold text-NEXT_SECONDARY_COLOR hover:text-platinum py-1 px-2 font-semibold leading-tight rounded-lg border-3 border-NEXT_SECONDARY_COLOR w-full", data: { action: "add-alt-network-logo#remove" } %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-col w-full space-y-6" data-add-network-exception-target="container"></div>
|
||||
<%= button_tag "Add an exception rule", class: "cursor-pointer bg-NEXT_COLOR hover:bg-NEXT_COLOR-tinted text-platinum text-lg font-bold py-2 px-4 rounded border border-platinum w-full", data: { action: "add-network-exception#add" } %>
|
||||
<template data-add-network-exception-target="template">
|
||||
<%= network_fields.fields_for :alternative_network_logos, AlternativeNetworkLogo.new(network_logo: network_fields.object.network_logo), child_index: 'NEW_EXC_RECORD' do |network_fields| %>
|
||||
<div class="flex items-end space-x-6 w-full">
|
||||
<div class="w-full">
|
||||
<%= network_fields.select :exception_type, options_for_select(["Zip","State"]), label: { text: "Exception Type" }, prompt: "Select Type", class: "w-full" %>
|
||||
</div>
|
||||
<div class="w-full">
|
||||
<%= network_fields.text_field :exception_value, label: { text: "Exception Value" }, class: "w-full" %>
|
||||
</div>
|
||||
<div class="w-1/5">
|
||||
<%= network_fields.hidden_field :_destroy %>
|
||||
<%= button_tag "Remove", class: "cursor-pointer bg-deepcove hover:bg-brightlava text-xl font-bold text-PARENT_SECONDARY_COLOR hover:text-platinum py-1 px-2 font-semibold leading-tight rounded-lg border-3 border-PARENT_SECONDARY_COLOR w-full", data: { action: "add-alt-network-logo#remove" } %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</template>
|
||||
@@ -0,0 +1,23 @@
|
||||
<div class="flex flex-col items-stretch justify-end pr-6 pl-1 w-1/4">
|
||||
<%= plan_fields.fields_for :plan_benefits do |plan_benefits_fields| %>
|
||||
<%= render 'plan_benefits_desc_fields', plan_benefits_fields: plan_benefits_fields %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="inline-flex flex-col justify-end pr-6 pl-1 mt-10 relative w-1/4" data-controller="benefits-template-picker">
|
||||
<div class="absolute left-0 top-[2%] h-[98%] border-l-4 <%= "border-#{EmployerSetupPlansForm::PLAN_COLORS[i]}" %> rounded-bl-lg"></div>
|
||||
<div class="font-bold text-2xl <%= "text-#{EmployerSetupPlansForm::PLAN_COLORS[i]}" %> -ml-[6px] z-2 w-full">
|
||||
<%= "Plan #{i + 1}" %>
|
||||
</div>
|
||||
<div class="pl-1 w-full">
|
||||
<%= plan_fields.text_field :title, label: { text: "Plan Title" }, class: "w-full", data: { add_plan_target: "plan" } %>
|
||||
</div>
|
||||
<div class="pl-1 w-full">
|
||||
<%= plan_fields.text_field :plan_id, label: { text: "Plan Id" }, class: "w-full" %>
|
||||
</div>
|
||||
<div class="pl-1">
|
||||
<%= f.select :template_id, options_from_collection_for_select(@form.plan_templates, :id, :title), { prompt: "Select Plan Template" }, { data: { action: "benefits-template-picker#fetchData" }} %>
|
||||
</div>
|
||||
<%= plan_fields.fields_for :plan_benefits do |plan_benefits_fields| %>
|
||||
<%= render 'plan_benefits_fields', plan_benefits_fields: plan_benefits_fields %>
|
||||
<% end %>
|
||||
</div>
|
||||
@@ -0,0 +1,4 @@
|
||||
<div class="pl-1 w-full">
|
||||
<%= plan_benefits_fields.text_field :benefit, label: { text: "Benefit Value #{plan_benefits_fields.object.sequence}" }, data: { benefits_template_picker_target: "benefit", sequence: plan_benefits_fields.object.sequence}, class: "w-full" %>
|
||||
<%= plan_benefits_fields.hidden_field :sequence %>
|
||||
</div>
|
||||
@@ -0,0 +1,3 @@
|
||||
<div class="pl-1 w-full">
|
||||
<%= plan_benefits_fields.text_field :benefit_desc, label: { text: "Benefit Description #{plan_benefits_fields.object.sequence}" }, class: "w-full" %>
|
||||
</div>
|
||||
@@ -0,0 +1,5 @@
|
||||
<div class="pl-1 w-full">
|
||||
<%= plan_benefits_fields.text_field :benefit, label: { text: "Benefit Value #{plan_benefits_fields.object.sequence}" }, 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 %>
|
||||
</div>
|
||||
@@ -0,0 +1,11 @@
|
||||
<div class="pl-1 w-full">
|
||||
<%= plan_fields.text_field :title, label: { text: "Plan Title" }, class: "w-full", data: { add_plan_target: "plan" } %>
|
||||
</div>
|
||||
<div class="pl-1 w-full">
|
||||
<%= plan_fields.text_field :plan_id, label: { text: "Plan Id" }, class: "w-full" %>
|
||||
</div>
|
||||
<div class="pl-1">
|
||||
<%= f.select :template_id, options_from_collection_for_select(@plan_templates, :id, :title), { prompt: "Select Plan Template" }, { data: { action: "benefits-template-picker#fetchData" }} %>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -0,0 +1,136 @@
|
||||
<div class="bg-deepcove h-full w-full flex flex-col">
|
||||
<h1 class="font-bold text-4xl text-platinum my-5">New Employer Setup</h1>
|
||||
<%= form_with model: @employer_setup, url: employer_setup_index_path, local: true do |f| %>
|
||||
<div class="flex flex-col space-y-6">
|
||||
<div class="w-full flex items-center">
|
||||
<h3 class="font-bold text-2xl text-bluemana">General Information</h3>
|
||||
<div class="h-[1px] w-1/2 mt-2 bg-bluemana"></div>
|
||||
</div>
|
||||
<div class="flex space-x-10">
|
||||
<div class="w-1/5">
|
||||
<%= f.text_field :employer_name, label: { text: "Employer Name" }, class: "w-full" %>
|
||||
</div>
|
||||
<div class="w-1/5">
|
||||
<%= f.text_field :group_number, label: { text: "Group/Medical Number" }, class: "w-full" %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex space-x-10">
|
||||
<div class="w-1/5">
|
||||
<%= f.text_field :pl_plan_key, label: { text: "Pl Plan Key" }, class: "w-full" %>
|
||||
</div>
|
||||
<div class="w-1/5">
|
||||
<%= f.text_field :effective_date, label: { text: "Effective Date" }, class: "w-full" %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex space-x-10">
|
||||
<div class="w-1/5">
|
||||
<%= f.select :network_provider, options_for_select(["Cigna", "Medcost"]), label: { text: "Provider Network" }, class: "w-full" %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex space-x-5 items-center mt-4">
|
||||
<label for="file_upload_input" class="cursor-pointer bg-atmosphere hover:bg-bluetang text-platinum font-bold py-2 px-4 rounded border border-platinum">
|
||||
Choose Employer Logo File
|
||||
</label>
|
||||
<span id="file_name_display" class="ml-2 text-bluemana font-semibold">No file chosen</span>
|
||||
<%= f.file_field :employer_logo, class: "hidden", id: "file_upload_input" %>
|
||||
</div>
|
||||
|
||||
<div class="w-full flex items-center">
|
||||
<h3 class="font-bold text-2xl text-bluemana">Plans Information</h3>
|
||||
<div class="h-[1px] w-1/2 mt-2 bg-bluemana"></div>
|
||||
</div>
|
||||
<div class="w-full flex my-8" data-controller="add-plan" data-add-plan-form-color-value="<%= EmployerSetupPlansForm::PLAN_COLORS.to_json %>" >
|
||||
<div class="flex flex-wrap w-full" data-add-plan-target="container">
|
||||
<% @employer_setup.plans.each_with_index do |plan, index| %>
|
||||
<%= f.fields_for :plans, plan, child_index: index do |plan_fields| %>
|
||||
|
||||
<% if index == 0 %>
|
||||
<div class="flex flex-col w-1/2 relative items-end" data-controller="benefits-template-picker">
|
||||
<div class="absolute left-[50%] top-[2%] h-[98%] border-l-4 <%= "border-#{EmployerSetupPlansForm::PLAN_COLORS[index]}" %> "></div>
|
||||
<div class="inline-flex flex-col pl-1 pr-6 w-1/2">
|
||||
<div class="font-bold text-2xl <%= "text-#{EmployerSetupPlansForm::PLAN_COLORS[index]}" %> -ml-[6px] z-2 w-full">
|
||||
<%= "Plan 1" %>
|
||||
</div>
|
||||
<%= render 'plan_fields', plan_fields: plan_fields, f: f, index: index %>
|
||||
</div>
|
||||
<div class="flex flex-col items-end w-full">
|
||||
<%= plan_fields.fields_for :plan_benefits do |plan_benefits_fields| %>
|
||||
<div class="flex w-full">
|
||||
<div class="flex flex-col items-stretch justify-end pr-6 w-1/2">
|
||||
<%= render 'plan_benefits_desc_fields', plan_benefits_fields: plan_benefits_fields %>
|
||||
</div>
|
||||
<div class="flex flex-col items-stretch justify-end pl-1 pr-6 w-1/2">
|
||||
<%= render 'plan_benefit_only_fields', plan_benefits_fields: plan_benefits_fields %>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="mt-4 pl-2 pr-6 w-1/2">
|
||||
<%= plan_fields.hidden_field :_destroy %>
|
||||
<%= button_tag "Remove Plan 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" } %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="inline-flex flex-col justify-end pr-6 mt-10 w-1/4 relative pl-1" data-controller="benefits-template-picker">
|
||||
<div class="absolute left-0 top-[2%] h-[98%] border-l-4 <%= "border-#{EmployerSetupPlansForm::PLAN_COLORS[index]}" %>"></div>
|
||||
<div class="font-bold text-2xl <%= "text-#{EmployerSetupPlansForm::PLAN_COLORS[index]}" %> -ml-[6px] z-2 w-full">
|
||||
<%= "Plan #{index + 1}" %>
|
||||
</div>
|
||||
<%= render 'plan_fields', plan_fields: plan_fields, f: f, index: index %>
|
||||
<%= plan_fields.fields_for :plan_benefits do |plan_benefits_fields| %>
|
||||
<%= render 'plan_benefits_fields', plan_benefits_fields: plan_benefits_fields %>
|
||||
<% end %>
|
||||
<div class="mt-4 pl-1">
|
||||
<%= plan_fields.hidden_field :_destroy %>
|
||||
<%= button_tag "Remove Plan #{index + 1}", class: "cursor-pointer bg-deepcove text-brightlava py-2 px-4 font-semibold leading-tight rounded border-3 border-#{EmployerSetupPlansForm::PLAN_COLORS[index]} w-full", data: { action: "add-plan#remove" } %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<% 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" } %>
|
||||
<template data-add-plan-target="template">
|
||||
<%= f.fields_for :plans, Plan.new, child_index: 'NEW_RECORD' do |plan_fields| %>
|
||||
<div class="inline-flex flex-col justify-end pr-6 w-1/4 relative pl-1" data-controller="benefits-template-picker">
|
||||
<div class="absolute left-0 top-[2%] h-[98%] border-l-4 border-NEXT_COLOR"></div>
|
||||
<div class="font-bold text-2xl text-NEXT_COLOR -ml-[6px] z-2 w-full">
|
||||
<%= "Plan NEW_PLAN" %>
|
||||
</div>
|
||||
<%= render 'plan_fields', plan_fields: plan_fields, f: f, index: "NEW_RECORD".to_i %>
|
||||
<%= plan_fields.fields_for :plan_benefits do |plan_benefits_fields| %>
|
||||
<%= render 'plan_benefits_fields', plan_benefits_fields: plan_benefits_fields %>
|
||||
<% end %>
|
||||
<div class="mt-4 pl-1">
|
||||
<%= 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" } %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="w-full flex items-center">
|
||||
<h3 class="font-bold text-2xl text-bluemana">Alternative Network Information</h3>
|
||||
<div class="h-[1px] w-1/2 mt-2 bg-bluemana"></div>
|
||||
</div>
|
||||
<div class="flex w-full justify-start" data-controller="add-alt-network-logo" data-add-alt-network-logo-form-color-value="<%= EmployerSetupPlansForm::PLAN_COLORS.to_json %>">
|
||||
<div class="flex flex-wrap w-full" data-add-alt-network-logo-target="container">
|
||||
<%= 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" } %>
|
||||
</div>
|
||||
<template data-add-alt-network-logo-target="template">
|
||||
<%= f.fields_for :alternative_network_logos, AlternativeNetworkLogo.new, child_index: 'NEW_RECORD' do |network_fields| %>
|
||||
<div class="flex flex-col my-8 mr-3 space-y-6 px-3" data-controller="add-network-exception" data-add-network-exception-parent-color-value="NEXT_SECONDARY_COLOR">
|
||||
<%= render 'alt_network_logo_fields', network_fields: network_fields %>
|
||||
</div>
|
||||
<% end %>
|
||||
</template>
|
||||
</div>
|
||||
<div class="pt-8">
|
||||
<%= f.submit "Submit" %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
@@ -1,8 +1,8 @@
|
||||
<div class="bg-deepcove min-h-screen w-full flex flex-col">
|
||||
<div class="bg-deepcove h-full w-full flex flex-col">
|
||||
<h1 class="font-bold text-4xl text-platinum">New Employer Setup</h1>
|
||||
<h3 class="font-bold text-2xl text-bluemana">General Information</h3>
|
||||
<%= form_with model: @form, url: employer_setup_index_path, local: true do |f| %>
|
||||
<div class="flex flex-col my-8 space-y-6">
|
||||
<div class="flex flex-col space-y-6">
|
||||
<div class="flex space-x-10">
|
||||
<div class="w-1/5">
|
||||
<%= f.text_field :name, label: { text: "Employer Name" }, class: "w-full" %>
|
||||
@@ -16,12 +16,12 @@
|
||||
<%= f.text_field :pl_plan_key, label: { text: "Pl Plan Key" }, class: "w-full" %>
|
||||
</div>
|
||||
<div class="w-1/5">
|
||||
<%= f.text_field :effect_date, label: { text: "Effective Date" }, class: "w-full" %>
|
||||
<%= f.text_field :effective_date, label: { text: "Effective Date" }, class: "w-full" %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex space-x-10">
|
||||
<div class="w-1/5">
|
||||
<%= f.select :network, options_for_select([["Cigna", "cig"], ["Cigna+Regional", "cig+"], ["Medcost", "med"]]), label: { text: "Provider Network" }, data: { controller: "form-toggle", action: "change->form-toggle#toggleDivs" }, class: "w-full" %>
|
||||
<%= f.select :network, options_for_select(["Cigna", "Cigna+Regional", "Medcost"]), label: { text: "Provider Network" }, data: { controller: "form-toggle", action: "change->form-toggle#toggleDivs" }, class: "w-full" %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex space-x-5 items-center mt-4">
|
||||
|
||||
@@ -2,12 +2,14 @@
|
||||
<h1 class="font-bold text-4xl text-platinum">New Employer Setup</h1>
|
||||
<h3 class="font-bold text-2xl text-bluemana">Provider Network</h3>
|
||||
<%= form_with model: @form, url: employer_setup_index_path, local: true do |f| %>
|
||||
<div class="flex w-full justify-start">
|
||||
<div class="flex flex-wrap w-full" data-add-alt-network-logo-target="container">
|
||||
<%= 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" } %>
|
||||
|
||||
<div class="flex w-full justify-start">
|
||||
<div class="flex flex-wrap w-full" data-add-alt-network-logo-target="container">
|
||||
<%= 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" } %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="py-10">
|
||||
<%= f.hidden_field :pl_plan_key, value: "fake" %>
|
||||
<%= f.submit "Continue to Summary" %>
|
||||
</div>
|
||||
<template data-add-alt-network-logo-target="template">
|
||||
@@ -47,6 +49,8 @@
|
||||
</div>
|
||||
<% end %>
|
||||
</template>
|
||||
|
||||
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -3,12 +3,11 @@
|
||||
<h3 class="font-bold text-2xl text-bluemana">Medical Plans</h3>
|
||||
<div class="flex flex-col pl-6">
|
||||
<%= form_with model: @form, url: employer_setup_index_path, local: true do |f| %>
|
||||
<%= f.text_field :pl_plan_key, label: { text: "Employer PL Plan Key" }, class: "justify-self-start" %>
|
||||
<div class="w-full flex my-8">
|
||||
<div class="flex flex-wrap w-full" data-add-plan-target="container">
|
||||
<div class="flex flex-col items-stretch justify-end pr-6 pl-1 w-1/4">
|
||||
<%= f.fields_for :benefit_descs do |plan_benefit_fields| %>
|
||||
<%= plan_benefit_fields.text_field :plan_id, class: "hidden", value: "descriptions" %>
|
||||
<%= plan_benefit_fields.hidden_field :plan_id, value: "descriptions" %>
|
||||
<% @form.benefits_template.each do |bene| %>
|
||||
<div>
|
||||
<%= plan_benefit_fields.text_field "benefit_#{bene.sequence}", label: { text: "Benefit Description #{bene.sequence}" }, value: "#{bene.benefit_desc}", class: "w-full" %>
|
||||
|
||||
@@ -13,9 +13,9 @@
|
||||
|
||||
<body>
|
||||
<main>
|
||||
<div class="w-full h-screen flex bg-black justify-center items-center">
|
||||
<div class="h-[98%] w-[calc(100%-1rem)] mt-1 mb-2 flex justify-center items-center shadow-[0_0_10px_3px_#93c5fd] rounded-xl bg-[#04153E]">
|
||||
<div class="w-11/12 mt-8 px-5 flex">
|
||||
<div class="w-full min-h-screen flex flex-col bg-black justify-center items-center">
|
||||
<div class="min-h-full w-[calc(100%-1rem)] mt-1 mb-2 flex flex-grow justify-center items-center shadow-[0_0_10px_3px_#93c5fd] rounded-xl bg-[#04153E]">
|
||||
<div class="min-h-full w-11/12 mt-8 px-5 flex flex-grow justify-center items-center">
|
||||
<%= yield %>
|
||||
</div>
|
||||
</div>
|
||||
@@ -23,3 +23,4 @@
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
<div class="flex items-center justify-center h-full w-full">
|
||||
<div class="flex items-center justify-center min-h-full w-full">
|
||||
<div class="flex flex-col text-7xl font-bold text-[#2A4B6F] space-y-30">
|
||||
<div>
|
||||
<span class="[text-shadow:0_0_20px_#fff,0_0_50px_#0090D9,0_0_80px_#0ff] text-[#04153E]">B</span>acl<span class="text-[#CD7F32]">i</span>ght
|
||||
</div>
|
||||
<div>
|
||||
<span class="[text-shadow:0_0_20px_#fff,0_0_50px_#0090D9,0_0_80px_#0ff] text-[#04153E]">B</span>acl<span class="relative inline-block">i<span class="absolute top-0 right-0 h-3 w-3 rounded-full bg-[#CD7F32] translate-y-[7px] -translate-x-[3px]"></span></span>ght
|
||||
<span class="[text-shadow:0_0_20px_#fff,0_0_50px_#0090D9,0_0_80px_#0ff] text-[#04153E]">B</span>acl<span class="relative inline-block">i<span class="absolute top-0 right-0 h-3 w-3 rounded-full bg-[#CD7F32] translate-y-[12px] -translate-x-[4px]"></span></span>ght
|
||||
</div>
|
||||
<div>
|
||||
<span class="justify-self-end [text-shadow:0_0_20px_#fff,0_0_50px_#0090D9,0_0_80px_#0ff] text-[#04153E]">B</span>acl<span class="relative inline-block">i<span class="absolute top-0 right-0 h-3 w-3 rounded-full bg-[#CD7F32] translate-y-[7px] -translate-x-[3px] shadow-[0_0_7px_2px_#93c5fd]"></span></span>ght
|
||||
<span class="justify-self-end [text-shadow:0_0_20px_#fff,0_0_50px_#0090D9,0_0_80px_#0ff] text-[#04153E]">B</span>acl<span class="relative inline-block">i<span class="absolute top-0 right-0 h-3 w-3 rounded-full bg-[#CD7F32] translate-y-[13px] -translate-x-[4px] shadow-[0_0_7px_2px_#93c5fd]"></span></span>ght
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
<div class="text-deepcove bg-deepcove border border-deepcove">co</div>
|
||||
<div class="text-bluetang bg-bluetang border border-bluetang">co</div>
|
||||
<div class="text-bluetang-tinted bg-bluetang-tinted border border-bluetang-tinted">co</div>
|
||||
<div class="text-atmosphere bg-atmosphere border border-atmosphere">co</div>
|
||||
<div class="text-atmosphere-tinted bg-atmosphere-tinted border border-atmosphere-tinted">co</div>
|
||||
<div class="text-bluemana bg-bluemana border border-bluemana">co</div>
|
||||
<div class="text-bluemana-tinted bg-bluemana-tinted border border-bluemana-tinted">co</div>
|
||||
<div class="text-cobalt bg-cobalt border border-cobalt">co</div>
|
||||
<div class="text-cobalt-tinted bg-cobalt-tinted border border-cobalt-tinted">co</div>
|
||||
<div class="text-copper bg-copper border border-copper">co</div>
|
||||
<div class="text-copper-tinted bg-copper-tinted border border-copper-tinted">co</div>
|
||||
<div class="text-bronze bg-bronze border border-bronze">co</div>
|
||||
<div class="text-bronze-tinted bg-bronze-tinted border border-bronze-tinted">co</div>
|
||||
<div class="text-verdigris bg-verdigris border border-verdigris">co</div>
|
||||
<div class="text-verdigris-tinted bg-verdigris-tinted border border-verdigris-tinted">co</div>
|
||||
<div class="text-brightlava bg-brightlava border border-brightlava">co</div>
|
||||
|
||||
Reference in New Issue
Block a user