Before adding workers
This commit is contained in:
@@ -18,7 +18,7 @@ class EmployerSetupController < ApplicationController
|
||||
word_doc = params[:employer_setup_process][:import_from_word]
|
||||
@plan_templates = IdCardBenefitsTemplate.where.not(title: "BLANK")
|
||||
if word_doc.present? && word_doc.is_a?(ActionDispatch::Http::UploadedFile)
|
||||
@employer_setup = BenefitsWordDocProcessor.new(word_doc.tempfile).call
|
||||
@employer_setup = WordDocProcessor.new(word_doc.tempfile).call
|
||||
render :edit
|
||||
else
|
||||
@employer_setup = EmployerSetupProcess.new
|
||||
|
||||
@@ -18,7 +18,7 @@ class EmployersController < ApplicationController
|
||||
# word_doc = params[:employer][:import_from_word]
|
||||
# @plan_templates = IdCardBenefitsTemplate.where.not(title: "BLANK")
|
||||
# if word_doc.present? && word_doc.is_a?(ActionDispatch::Http::UploadedFile)
|
||||
# @employer = BenefitsWordDocProcessor.new(word_doc.tempfile).call
|
||||
# @employer = WordDocProcessor.new(word_doc.tempfile).call
|
||||
# else
|
||||
# @employer = Employer.new
|
||||
# @employer.build_plan_with_default_benefits
|
||||
@@ -72,7 +72,7 @@ class EmployersController < ApplicationController
|
||||
def import
|
||||
word_doc = params[:employer][:import_from_word]
|
||||
if word_doc.present? && word_doc.is_a?(ActionDispatch::Http::UploadedFile)
|
||||
@employer = BenefitsWordDocProcessor.new(word_doc.tempfile).call
|
||||
@employer = WordDocProcessor.new(word_doc.tempfile).call
|
||||
@employer.save
|
||||
redirect_to employer_path(@employer.slug), notice: 'Employer Imported'
|
||||
else
|
||||
|
||||
@@ -3,19 +3,19 @@ module IdCard
|
||||
|
||||
# View Methods
|
||||
def index
|
||||
@employer_configs = IdCard::Configuration.active.to_a
|
||||
@queue_counts = EmployerCards::GetQueuedCounts.new().call
|
||||
add_queued_count_to_card_configuration
|
||||
@queued = @employer_configs.select { |config| config.queued_card_count > 0 }.sort_by { |config| config.pl_plan_key.to_i }
|
||||
@not_queued = @employer_configs.select { |config| config.queued_card_count == 0 }.sort_by { |config| config.pl_plan_key.to_i }
|
||||
@employer_setups = IdCard::Setup.active.to_a
|
||||
@queue_counts = IdCardQueueService::GetQueuedCounts.new().call
|
||||
add_queued_count_to_card_setup
|
||||
@queued = @employer_setups.select { |setup| setup.queued_card_count > 0 }.sort_by { |setup| setup.pl_plan_key.to_i }
|
||||
@not_queued = @employer_setups.select { |setup| setup.queued_card_count == 0 }.sort_by { |setup| setup.pl_plan_key.to_i }
|
||||
render :index
|
||||
end
|
||||
|
||||
# API Methods
|
||||
|
||||
def print_all_queued
|
||||
@queue_members = EmployerCards::GetQueuedCards.new().call
|
||||
cards_pdf = IdCardPrinter::QueuedCardsGenerator.new(@queue_members).call
|
||||
@queue_members = IdCardQueueService::GetQueuedCards.new().call
|
||||
cards_pdf = IdCardPrinterService::QueuedCardsGenerator.new(@queue_members).call
|
||||
|
||||
if cards_pdf.is_a?(CombinePDF::PDF)
|
||||
send_data cards_pdf.to_pdf,
|
||||
@@ -35,8 +35,8 @@ module IdCard
|
||||
def print_queued_by_employer
|
||||
pl_plan_key = params[:id].to_s
|
||||
@employer = Employer.find_by(pl_plan_key: pl_plan_key)
|
||||
@queue_members = EmployerCards::GetQueuedCards.new(pl_plan_key).call
|
||||
cards_pdf = IdCardPrinter::QueuedCardsGenerator.new(@queue_members).call
|
||||
@queue_members = IdCardQueueService::GetQueuedCards.new(pl_plan_key).call
|
||||
cards_pdf = IdCardPrinterService::QueuedCardsGenerator.new(@queue_members).call
|
||||
|
||||
send_data cards_pdf.to_pdf,
|
||||
filename: "#{@employer.name.parameterize(separator: "_")}_queued_cards_#{Date.today}.pdf",
|
||||
@@ -46,9 +46,14 @@ module IdCard
|
||||
end
|
||||
|
||||
def generate_sample
|
||||
pl_plan_key = params[:id].to_s
|
||||
@employer = Employer.find_by(pl_plan_key: pl_plan_key)
|
||||
sample_cards_pdf = IdCardPrinter::SampleCardsGenerator.new(@employer).call
|
||||
if Integer(params[:id], exception: false).is_a?(Integer)
|
||||
pl_plan_key = params[:id].to_s
|
||||
@employer = Employer.find_by(pl_plan_key: pl_plan_key)
|
||||
else
|
||||
slug = params[:id]
|
||||
@employer = Employer.find_by(slug: slug)
|
||||
end
|
||||
sample_cards_pdf = IdCardPrinterService::SampleCardsGenerator.new(@employer).call
|
||||
|
||||
send_data sample_cards_pdf.to_pdf,
|
||||
filename: "#{@employer.name.parameterize(separator: "_")}_sample_cards_#{Date.today}.pdf",
|
||||
@@ -58,9 +63,14 @@ module IdCard
|
||||
end
|
||||
|
||||
def generate_print
|
||||
pl_plan_key = params[:id].to_s
|
||||
@employer = Employer.find_by(pl_plan_key: pl_plan_key)
|
||||
cards_pdf = IdCardPrinter::EmployerCardsGenerator.new(@employer, "PrintCard").call
|
||||
if Integer(params[:id], exception: false).is_a?(Integer)
|
||||
pl_plan_key = params[:id].to_s
|
||||
@employer = Employer.find_by(pl_plan_key: pl_plan_key)
|
||||
else
|
||||
slug = params[:id]
|
||||
@employer = Employer.find_by(slug: slug)
|
||||
end
|
||||
cards_pdf = IdCardPrinterService::EmployerCardsGenerator.new(@employer, "PrintCard").call
|
||||
|
||||
send_data cards_pdf.to_pdf,
|
||||
filename: "#{@employer.name.parameterize(separator: "_")}_print_cards_#{Date.today}.pdf",
|
||||
@@ -70,9 +80,14 @@ module IdCard
|
||||
end
|
||||
|
||||
def generate_mobile_display
|
||||
pl_plan_key = params[:id].to_s
|
||||
@employer = Employer.find_by(pl_plan_key: pl_plan_key)
|
||||
cards_pdf = IdCardPrinter::EmployerCardsGenerator.new(@employer, "MobileDisplayCard").call
|
||||
if Integer(params[:id], exception: false).is_a?(Integer)
|
||||
pl_plan_key = params[:id].to_s
|
||||
@employer = Employer.find_by(pl_plan_key: pl_plan_key)
|
||||
else
|
||||
slug = params[:id]
|
||||
@employer = Employer.find_by(slug: slug)
|
||||
end
|
||||
cards_pdf = IdCardPrinterService::EmployerCardsGenerator.new(@employer, "MobileDisplayCard").call
|
||||
|
||||
send_data cards_pdf.to_pdf,
|
||||
filename: "#{@employer.name.parameterize(separator: "_")}_mobile_display_cards_#{Date.today}.pdf",
|
||||
@@ -82,9 +97,14 @@ module IdCard
|
||||
end
|
||||
|
||||
def generate_full_page
|
||||
pl_plan_key = params[:id].to_s
|
||||
@employer = Employer.find_by(pl_plan_key: pl_plan_key)
|
||||
cards_pdf = IdCardPrinter::EmployerCardsGenerator.new(@employer, "FullPageCard", true).call
|
||||
if Integer(params[:id], exception: false).is_a?(Integer)
|
||||
pl_plan_key = params[:id].to_s
|
||||
@employer = Employer.find_by(pl_plan_key: pl_plan_key)
|
||||
else
|
||||
slug = params[:id]
|
||||
@employer = Employer.find_by(slug: slug)
|
||||
end
|
||||
cards_pdf = IdCardPrinterService::EmployerCardsGenerator.new(@employer, "FullPageCard", true).call
|
||||
|
||||
cards_pdf.rewind
|
||||
send_data cards_pdf.sysread,
|
||||
@@ -97,9 +117,9 @@ module IdCard
|
||||
private
|
||||
|
||||
|
||||
def add_queued_count_to_card_configuration
|
||||
def add_queued_count_to_card_setup
|
||||
@queue_counts.each do |qc|
|
||||
match = @employer_configs.find { |config| config.pl_plan_key == qc["PLPlanKey"] }
|
||||
match = @employer_setups.find { |setup| setup.pl_plan_key == qc["PLPlanKey"] }
|
||||
if match.present?
|
||||
match.queued_card_count = qc["QueuedCardsCount"]
|
||||
end
|
||||
|
||||
@@ -3,7 +3,7 @@ module IdCard
|
||||
|
||||
def generate_sample
|
||||
@employer = Employer.find_by(slug: params[:employer_slug])
|
||||
sample_cards_pdf = IdCardPrinter::SampleCardsGenerator.new(@employer).call
|
||||
sample_cards_pdf = IdCardPrinterService::SampleCardsGenerator.new(@employer).call
|
||||
|
||||
send_data sample_cards_pdf.to_pdf,
|
||||
filename: "#{@employer.name.parameterize(separator: "_")}_sample_cards_#{Date.today}.pdf",
|
||||
@@ -14,7 +14,7 @@ module IdCard
|
||||
|
||||
def generate_print
|
||||
@employer = Employer.find_by(slug: params[:employer_slug])
|
||||
cards_pdf = IdCardPrinter::EmployerCardsGenerator.new(@employer, "PrintCard").call
|
||||
cards_pdf = IdCardPrinterService::EmployerCardsGenerator.new(@employer, "PrintCard").call
|
||||
|
||||
send_data cards_pdf.to_pdf,
|
||||
filename: "#{@employer.name.parameterize(separator: "_")}_print_cards_#{Date.today}.pdf",
|
||||
@@ -25,7 +25,7 @@ module IdCard
|
||||
|
||||
def generate_mobile_display
|
||||
@employer = Employer.find_by(slug: params[:employer_slug])
|
||||
cards_pdf = IdCardPrinter::EmployerCardsGenerator.new(@employer, "MobileDisplayCard").call
|
||||
cards_pdf = IdCardPrinterService::EmployerCardsGenerator.new(@employer, "MobileDisplayCard").call
|
||||
|
||||
send_data cards_pdf.to_pdf,
|
||||
filename: "#{@employer.name.parameterize(separator: "_")}_mobile_display_cards_#{Date.today}.pdf",
|
||||
@@ -36,7 +36,7 @@ module IdCard
|
||||
|
||||
def generate_full_page
|
||||
@employer = Employer.find_by(slug: params[:employer_slug])
|
||||
cards_pdf = IdCardPrinter::EmployerCardsGenerator.new(@employer, "FullPageCard", true).call
|
||||
cards_pdf = IdCardPrinterService::EmployerCardsGenerator.new(@employer, "FullPageCard", true).call
|
||||
|
||||
cards_pdf.rewind
|
||||
send_data cards_pdf.sysread,
|
||||
|
||||
+42
-42
@@ -1,56 +1,56 @@
|
||||
module IdCard
|
||||
class ConfigurationController < ApplicationController
|
||||
class SetupController < ApplicationController
|
||||
before_action :set_employer_and_setup
|
||||
|
||||
# View Methods
|
||||
def edit
|
||||
@employer = Employer.find_by(slug: params[:employer_id])
|
||||
if @employer.id_card_enabled?
|
||||
@configuration = @employer.id_card_configuration
|
||||
else
|
||||
@configuration = @employer.create_id_card_configuration
|
||||
end
|
||||
render :edit
|
||||
end
|
||||
# def edit
|
||||
# @employer = Employer.find_by(slug: params[:employer_id])
|
||||
# if @employer.id_card_enabled?
|
||||
# @setup = @employer.id_card_setup
|
||||
# else
|
||||
# @setup = @employer.create_id_card_setup
|
||||
# end
|
||||
# render :edit
|
||||
# end
|
||||
|
||||
def update
|
||||
setup_params = IdCard::Configuration.permitted_params(params)
|
||||
@configuration = IdCard::Configuration.find(params[:id])
|
||||
# def update
|
||||
# setup_params = IdCard::Setup.permitted_params(params)
|
||||
# @setup = IdCard::Setup.find(params[:id])
|
||||
|
||||
if @configuration.update(setup_params)
|
||||
puts "sucess"
|
||||
redirect_to employer_path(@configuration.employer.slug), notice: 'ID Card Configuration was successfully updated.'
|
||||
else
|
||||
puts "fail"
|
||||
render :edit, status: :unprocessable_entity
|
||||
end
|
||||
# if @setup.update(setup_params)
|
||||
# puts "sucess"
|
||||
# redirect_to employer_path(@setup.employer.slug), notice: 'ID Card Setup was successfully updated.'
|
||||
# else
|
||||
# puts "fail"
|
||||
# render :edit, status: :unprocessable_entity
|
||||
# end
|
||||
|
||||
end
|
||||
# end
|
||||
|
||||
def general
|
||||
def index
|
||||
provider_defaults = IdCard::ProviderSection.defaults
|
||||
@provider_options = provider_defaults.map { |p| ["Default #{p.title}", p.id] }.concat(provider_defaults.map { |p| ["New #{p.title}", "new|#{p.id}"] })
|
||||
if @configuration.provider_section_id.present? && provider_defaults.map(&:id).exclude?(@configuration.provider_section_id)
|
||||
@provider_options.insert(0, ["#{@employer.name} Custom", @configuration.provider_section_id])
|
||||
if @setup.provider_section_id.present? && provider_defaults.map(&:id).exclude?(@setup.provider_section_id)
|
||||
@provider_options.insert(0, ["#{@employer.name} Custom", @setup.provider_section_id])
|
||||
end
|
||||
@rx_options = IdCard::RxSection.all
|
||||
@fairos_rx_id = IdCard::RxSection.find_by(title: "FairosRx").id
|
||||
render :general
|
||||
render :index
|
||||
end
|
||||
|
||||
def update_general
|
||||
if params[:id_card_configuration]["provider_section_id"].include?("new|")
|
||||
def update
|
||||
if params[:id_card_setup]["provider_section_id"].include?("new|")
|
||||
new_provider_section_params = IdCard::ProviderSection.permitted_params(params)
|
||||
new_provider_section = IdCard::ProviderSection.create(new_provider_section_params)
|
||||
params[:id_card_configuration]["provider_section_id"] = new_provider_section.id
|
||||
params[:id_card_setup]["provider_section_id"] = new_provider_section.id
|
||||
end
|
||||
general_params = IdCard::Configuration.permitted_params(params)
|
||||
if @configuration.update(general_params)
|
||||
setup_params = IdCard::Setup.permitted_params(params)
|
||||
if @setup.update(setup_params)
|
||||
puts "sucess"
|
||||
redirect_to employer_path(@employer.slug), notice: 'ID Card Configuration was successfully updated.'
|
||||
redirect_to employer_path(@employer.slug), notice: 'ID Card Setup was successfully updated.'
|
||||
else
|
||||
puts "fail"
|
||||
render :general, status: :unprocessable_entity
|
||||
render :index, status: :unprocessable_entity
|
||||
end
|
||||
end
|
||||
|
||||
@@ -61,9 +61,9 @@ module IdCard
|
||||
|
||||
def update_plans
|
||||
plans_params = IdCard::Plan.permitted_params(params)
|
||||
if @configuration.update(plans_params)
|
||||
if @setup.update(plans_params)
|
||||
puts "sucess"
|
||||
redirect_to employer_path(@configuration.employer.slug), notice: 'ID Card Plans successfully updated.'
|
||||
redirect_to employer_path(@setup.employer.slug), notice: 'ID Card Plans successfully updated.'
|
||||
else
|
||||
puts "fail"
|
||||
render :plans, status: :unprocessable_entity
|
||||
@@ -77,9 +77,9 @@ module IdCard
|
||||
|
||||
def update_field_exceptions
|
||||
field_exceptions_params = IdCard::FieldException.permitted_params(params)
|
||||
if @configuration.update(field_exceptions_params)
|
||||
if @setup.update(field_exceptions_params)
|
||||
puts "sucess"
|
||||
redirect_to employer_path(@configuration.employer.slug), notice: 'ID Card Exceptions successfully updated.'
|
||||
redirect_to employer_path(@setup.employer.slug), notice: 'ID Card Exceptions successfully updated.'
|
||||
else
|
||||
puts "fail"
|
||||
render :field_exceptions, status: :unprocessable_entity
|
||||
@@ -99,10 +99,10 @@ module IdCard
|
||||
|
||||
def set_employer_and_setup
|
||||
@employer = Employer.find_by(slug: params[:employer_id])
|
||||
if @employer.id_card_configuration.present?
|
||||
@configuration = @employer.id_card_configuration
|
||||
if @employer.id_card_setup.present?
|
||||
@setup = @employer.id_card_setup
|
||||
else
|
||||
@configuration = @employer.create_id_card_configuration
|
||||
@setup = @employer.create_id_card_setup
|
||||
end
|
||||
end
|
||||
|
||||
@@ -190,7 +190,7 @@ module IdCard
|
||||
|
||||
# def form_for_step
|
||||
# step_name = @top_form.current_step
|
||||
# form_method = "EmployerConfiguration#{step_name.camelize}Form".constantize
|
||||
# form_method = "EmployerSetup#{step_name.camelize}Form".constantize
|
||||
# # puts "/////\\\\\\||||||"
|
||||
# # puts session[:employer_setup_data]
|
||||
# # puts session[:employer_setup_data]['employer_setup_process_id']
|
||||
@@ -199,7 +199,7 @@ module IdCard
|
||||
# end
|
||||
|
||||
# def process_step(step_name)
|
||||
# @form_method = "EmployerConfiguration#{step_name.camelize}Form".constantize
|
||||
# @form_method = "EmployerSetup#{step_name.camelize}Form".constantize
|
||||
# session_data_name = "#{step_name}_data"
|
||||
# # puts "1--------------params----"
|
||||
# # puts params
|
||||
@@ -233,7 +233,7 @@ module IdCard
|
||||
|
||||
# def global_params(step_name)
|
||||
# form_name_sym = "employer_setup_#{step_name}_form".to_sym
|
||||
# params.require(form_name_sym).permit(EmployerConfigurationForm.permitted_params)
|
||||
# params.require(form_name_sym).permit(EmployerSetupForm.permitted_params)
|
||||
# end
|
||||
|
||||
# def process_step(step_name)
|
||||
Reference in New Issue
Block a user