2024-04-29 00:17:15 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2023-01-30 17:03:30 +01:00
|
|
|
class Dossiers::BatchSelectMoreComponent < ApplicationComponent
|
2023-01-25 11:01:44 +01:00
|
|
|
def initialize(dossiers_count:, filtered_sorted_ids:)
|
|
|
|
@dossiers_count = dossiers_count
|
|
|
|
@filtered_sorted_ids = filtered_sorted_ids
|
|
|
|
end
|
2023-02-03 14:30:31 +01:00
|
|
|
|
|
|
|
def not_selected_button_data
|
|
|
|
{
|
|
|
|
action: "batch-operation#onSelectMore",
|
|
|
|
dossiers: @filtered_sorted_ids.first(Instructeurs::ProceduresController::BATCH_SELECTION_LIMIT).join(',')
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
def selected_button_data
|
|
|
|
{
|
|
|
|
action: "batch-operation#onDeleteSelection"
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
def not_selected_text
|
|
|
|
if @dossiers_count <= Instructeurs::ProceduresController::BATCH_SELECTION_LIMIT
|
|
|
|
t(".select_all", dossiers_count: @dossiers_count)
|
|
|
|
else
|
|
|
|
t(".select_all_limit", dossiers_count: @dossiers_count, limit: Instructeurs::ProceduresController::BATCH_SELECTION_LIMIT)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def selected_text
|
|
|
|
if @dossiers_count <= Instructeurs::ProceduresController::BATCH_SELECTION_LIMIT
|
|
|
|
t(".selected_all", dossiers_count: @dossiers_count)
|
|
|
|
else
|
|
|
|
t(".selected_all_limit", limit: Instructeurs::ProceduresController::BATCH_SELECTION_LIMIT)
|
|
|
|
end
|
|
|
|
end
|
2023-01-25 11:01:44 +01:00
|
|
|
end
|