Files
baclight/app/controllers/id_card/printer_controller.rb
T

32 lines
835 B
Ruby
Raw Normal View History

2026-03-13 08:47:13 -04:00
module IdCard
class PrinterController < ApplicationController
# View Methods
def index
@employer_configurations = IdCard::Configuration.active.to_a.sort_by { |config| config.pl_plan_key.to_i }
add_queued_count_to_card_configuration
render :index
end
# API Methods
2026-03-16 12:09:45 -04:00
def print_queued
@queue_counts = EmployerCards::GetQueuedCards.new().call
end
2026-03-13 08:47:13 -04:00
private
def add_queued_count_to_card_configuration
2026-03-16 12:09:45 -04:00
@queue_counts = EmployerCards::GetQueuedCounts.new().call
2026-03-13 08:47:13 -04:00
@queue_counts.each do |qc|
match = @employer_configurations.find { |configuration| configuration.pl_plan_key == qc["PLPlanKey"] }
if match.present?
match.queued_card_count = qc["QueuedCardsCount"]
end
end
end
end
end