2026-01-15 11:37:50 -05:00
|
|
|
class EmployersController < ApplicationController
|
2026-03-06 10:56:20 -05:00
|
|
|
|
|
|
|
|
# View Methods
|
2026-01-15 11:37:50 -05:00
|
|
|
def index
|
2026-04-20 12:12:52 -04:00
|
|
|
@uninitialized = Employer.in_automation_initilization
|
|
|
|
|
@with_active_id_card_setup = Employer.with_active_id_card_setup
|
2026-05-06 13:28:16 -04:00
|
|
|
current_group_numbers = @with_active_id_card_setup.pluck(:group_number)
|
|
|
|
|
valid_group_numbers = ["62210","61986","42018","41283","0230643","43190","0230642","0230644","0230646","0233955","600102","0249127","0257902","0257947","600112","0260085","600114","0261611","600117","0261684","0261685","0261826","600121","0265450","600123","0267470","0268540","0268599"]
|
|
|
|
|
@beta_unassigned_group_numbers = valid_group_numbers - current_group_numbers
|
2026-04-17 15:35:10 -04:00
|
|
|
@deactivated = Employer.deactivated
|
2026-01-15 11:37:50 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def show
|
|
|
|
|
@employer = Employer.find_by(slug: params[:id])
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def new
|
|
|
|
|
@employer = Employer.new
|
2026-03-05 11:30:24 -05:00
|
|
|
render :new
|
2026-01-15 11:37:50 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def create
|
|
|
|
|
employer_params = Employer.permitted_params(params)
|
|
|
|
|
@employer = Employer.new(employer_params)
|
|
|
|
|
if @employer.save
|
|
|
|
|
redirect_to employer_path(@employer.slug), notice: 'Employer Saved'
|
|
|
|
|
else
|
2026-05-06 13:28:16 -04:00
|
|
|
render :new, status: :unprocessable_entity
|
2026-01-15 11:37:50 -05:00
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def edit
|
|
|
|
|
@employer = Employer.find_by(slug: params[:id])
|
|
|
|
|
render :edit
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def update
|
|
|
|
|
employer_params = Employer.permitted_params(params)
|
|
|
|
|
@employer = Employer.find(params[:id])
|
|
|
|
|
|
|
|
|
|
if @employer.update(employer_params)
|
|
|
|
|
puts "sucess"
|
|
|
|
|
redirect_to employer_path(@employer.slug), notice: 'Employer was successfully updated.'
|
|
|
|
|
else
|
|
|
|
|
puts "fail"
|
|
|
|
|
render :edit, status: :unprocessable_entity
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def destroy
|
2026-05-06 13:28:16 -04:00
|
|
|
@employer = Employer.find(params[:id])
|
|
|
|
|
@employer.destroy
|
|
|
|
|
redirect_to employers_path, notice: "#{@employer.name} was successfully deleted."
|
2026-01-15 11:37:50 -05:00
|
|
|
end
|
|
|
|
|
|
2026-03-19 00:42:27 -04:00
|
|
|
|
2026-03-06 10:56:20 -05:00
|
|
|
# API Methods
|
|
|
|
|
|
2026-04-15 08:12:47 -04:00
|
|
|
def refresh_employer_information
|
|
|
|
|
@employer = Employer.find(params[:id])
|
|
|
|
|
@employer.sync_with_vhcs
|
|
|
|
|
redirect_to employer_path(@employer.slug)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def refresh_employer_members_information
|
|
|
|
|
@employer = Employer.find(params[:id])
|
|
|
|
|
@employer.sync_members_with_vhcs
|
|
|
|
|
redirect_to employer_path(@employer.slug)
|
|
|
|
|
end
|
|
|
|
|
|
2026-05-06 13:28:16 -04:00
|
|
|
def beta_automation_simulation
|
|
|
|
|
BetaAutomationSimulationService.new().call
|
|
|
|
|
redirect_to employers_path
|
|
|
|
|
end
|
|
|
|
|
|
2026-03-06 10:56:20 -05:00
|
|
|
def import
|
|
|
|
|
word_doc = params[:employer][:import_from_word]
|
|
|
|
|
if word_doc.present? && word_doc.is_a?(ActionDispatch::Http::UploadedFile)
|
2026-03-27 08:04:37 -04:00
|
|
|
@employer = BenefitsWordDocService::WordDocProcessor.new(word_doc.tempfile).call
|
2026-03-19 00:42:27 -04:00
|
|
|
@employer.save
|
|
|
|
|
redirect_to employer_path(@employer.slug), notice: 'Employer Imported'
|
2026-03-06 10:56:20 -05:00
|
|
|
else
|
|
|
|
|
@employer = Employer.new
|
2026-03-19 00:42:27 -04:00
|
|
|
render :new
|
2026-03-06 10:56:20 -05:00
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2026-01-15 11:37:50 -05:00
|
|
|
private
|
|
|
|
|
|
|
|
|
|
end
|