demarches-normaliennes/app/components/editable_champ/repetition_row_component.rb
2024-03-04 10:59:11 +01:00

17 lines
630 B
Ruby

class EditableChamp::RepetitionRowComponent < ApplicationComponent
def initialize(form:, champ:, row_id:, seen_at: nil)
@form, @champ, @row_id, @seen_at = form, champ, row_id, seen_at
@types_de_champ = champ.dossier.revision.children_of(champ.type_de_champ)
@champs_by_stable_id_with_row = champ.dossier.champs_by_stable_id_with_row
@row_number = champ.row_ids.find_index(row_id)
end
attr_reader :row_id, :row_number
private
def section_component
EditableChamp::SectionComponent.new(types_de_champ: @types_de_champ, champs_by_stable_id_with_row: @champs_by_stable_id_with_row, row_id:)
end
end