Major features finished

This commit is contained in:
Jason Jordan
2026-04-15 08:12:47 -04:00
parent 9f306d3150
commit 247a075c9c
112 changed files with 3700 additions and 379 deletions
+12
View File
@@ -69,6 +69,18 @@ class EmployersController < ApplicationController
# API Methods
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
def import
word_doc = params[:employer][:import_from_word]
if word_doc.present? && word_doc.is_a?(ActionDispatch::Http::UploadedFile)
+18 -25
View File
@@ -4,39 +4,31 @@ module IdCard
# View Methods
def index
@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 }
@queue_members = IdCardQueueService::GetQueuedMembers.new().call
add_queued_count_to_employer_setup(@queue_members)
@queued = @employer_setups.select { |setup| setup.queued_card_count > 0 }.sort_by { |setup| setup.print_name }
@not_queued = @employer_setups.select { |setup| setup.queued_card_count == 0 }.sort_by { |setup| setup.print_name }
render :index
end
# API Methods
def print_all_queued
@queue_members = IdCardQueueService::GetQueuedCards.new().call
cards_pdf = IdCardPrinterService::QueuedCardsGenerator.new(@queue_members).call
@queue_members = IdCardQueueService::GetQueuedMembers.new().call
cards_pdf = IdCardPrinterService::CardsGenerator.new(@queue_members, "PrintCard").call
if cards_pdf.is_a?(CombinePDF::PDF)
send_data cards_pdf.to_pdf,
filename: "queued_cards_#{Date.today}.pdf",
type: "application/pdf",
disposition: 'attachment'
else
cards_pdf.rewind
send_data cards_pdf.read,
filename: "queued_cards_#{Date.today}.zip",
type: 'application/zip',
disposition: 'attachment'
end
send_data cards_pdf.to_pdf,
filename: "all_queued_cards_#{Date.today}.pdf",
type: "application/pdf",
disposition: 'attachment'
end
def print_queued_by_employer
pl_plan_key = params[:id].to_s
@employer = Employer.find_by(pl_plan_key: pl_plan_key)
@queue_members = IdCardQueueService::GetQueuedCards.new(pl_plan_key).call
cards_pdf = IdCardPrinterService::QueuedCardsGenerator.new(@queue_members).call
@queue_members = IdCardQueueService::GetQueuedMembers.new(pl_plan_key).call
cards_pdf = IdCardPrinterService::CardsGenerator.new(@queue_members, "PrintCard").call
send_data cards_pdf.to_pdf,
filename: "#{@employer.name.parameterize(separator: "_")}_queued_cards_#{Date.today}.pdf",
@@ -104,7 +96,8 @@ module IdCard
slug = params[:id]
@employer = Employer.find_by(slug: slug)
end
cards_pdf = IdCardPrinterService::EmployerCardsGenerator.new(@employer, "FullPageCard", true).call
cards_pdf = IdCardPrinterService::CardsGenerator.new(@employer.employer_member_keys, "FullPageCard", true).call
# cards_pdf = IdCardPrinterService::EmployerCardsGenerator.new(@employer, "FullPageCard", true).call
cards_pdf.rewind
send_data cards_pdf.sysread,
@@ -117,11 +110,11 @@ module IdCard
private
def add_queued_count_to_card_setup
@queue_counts.each do |qc|
match = @employer_setups.find { |setup| setup.pl_plan_key == qc["PLPlanKey"] }
def add_queued_count_to_employer_setup(queued_employer_members)
queued_employer_members.each do |queued_employer|
match = @employer_setups.find { |setup| setup.pl_plan_key == queued_employer[:pl_plan_key] }
if match.present?
match.queued_card_count = qc["QueuedCardsCount"]
match.queued_card_count = queued_employer[:member_keys].length
end
end
end