component all the champ
This commit is contained in:
parent
a98aa079e2
commit
a3e8c09e71
121 changed files with 554 additions and 292 deletions
7
app/components/editable_champ/address_component.rb
Normal file
7
app/components/editable_champ/address_component.rb
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
class EditableChamp::AddressComponent < ApplicationComponent
|
||||||
|
include ApplicationHelper
|
||||||
|
|
||||||
|
def initialize(form:, champ:)
|
||||||
|
@form, @champ = form, champ
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,6 @@
|
||||||
|
= @form.hidden_field :value
|
||||||
|
= @form.hidden_field :external_id
|
||||||
|
= react_component("ComboAdresseSearch",
|
||||||
|
required: @champ.mandatory?,
|
||||||
|
id: @champ.input_id,
|
||||||
|
describedby: @champ.describedby_id)
|
|
@ -0,0 +1,7 @@
|
||||||
|
class EditableChamp::AnnuaireEducationComponent < ApplicationComponent
|
||||||
|
include ApplicationHelper
|
||||||
|
|
||||||
|
def initialize(form:, champ:)
|
||||||
|
@form, @champ = form, champ
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,6 @@
|
||||||
|
= @form.hidden_field :value
|
||||||
|
= @form.hidden_field :external_id
|
||||||
|
= react_component("ComboAnnuaireEducationSearch",
|
||||||
|
required: @champ.mandatory?,
|
||||||
|
id: @champ.input_id,
|
||||||
|
describedby: @champ.describedby_id)
|
7
app/components/editable_champ/carte_component.rb
Normal file
7
app/components/editable_champ/carte_component.rb
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
class EditableChamp::CarteComponent < ApplicationComponent
|
||||||
|
include ApplicationHelper
|
||||||
|
|
||||||
|
def initialize(form:, champ:)
|
||||||
|
@form, @champ = form, champ
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,4 @@
|
||||||
|
= react_component("MapEditor", featureCollection: @champ.to_feature_collection, url: champs_carte_features_path(@champ), options: @champ.render_options)
|
||||||
|
|
||||||
|
.geo-areas{ id: dom_id(@champ, :geo_areas) }
|
||||||
|
= render partial: 'shared/champs/carte/geo_areas', locals: { champ: @champ, editing: true }
|
5
app/components/editable_champ/champ_label_component.rb
Normal file
5
app/components/editable_champ/champ_label_component.rb
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
class EditableChamp::ChampLabelComponent < ApplicationComponent
|
||||||
|
def initialize(form:, champ:)
|
||||||
|
@form, @champ = form, champ
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,10 @@
|
||||||
|
= # we do this trick because some html elements should use 'label' and some should be plain paragraphs
|
||||||
|
- if @champ.html_label?
|
||||||
|
= @form.label @champ.main_value_name, id: champ.labelledby_id, for: champ.input_id do
|
||||||
|
= render partial: 'shared/dossiers/editable_champs/champ_label_content', locals: { champ: champ, seen_at: seen_at }
|
||||||
|
- else
|
||||||
|
.@form-label.mb-4
|
||||||
|
= render partial: 'shared/dossiers/editable_champs/champ_label_content', locals: { champ: champ, seen_at: seen_at }
|
||||||
|
|
||||||
|
- if @champ.description.present?
|
||||||
|
.notice{ id: @champ.describedby_id }= string_to_html(champ.description)
|
|
@ -0,0 +1,5 @@
|
||||||
|
class EditableChamp::ChampLabelContentComponent < ApplicationComponent
|
||||||
|
def initialize(form:, champ:)
|
||||||
|
@form, @champ = form, champ
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,11 @@
|
||||||
|
#{@champ.libelle}
|
||||||
|
- if @champ.type_de_champ.mandatory?
|
||||||
|
%span.mandatory *
|
||||||
|
|
||||||
|
- if @champ.updated_at.present? && seen_at.present?
|
||||||
|
%span.updated-at{ class: highlight_if_unseen_class(seen_at, @champ.updated_at) }
|
||||||
|
= "modifié le #{try_format_datetime(@champ.updated_at)}"
|
||||||
|
|
||||||
|
- if @champ.rebased_at.present? && champ.rebased_at > (seen_at || champ.updated_at) && current_user.owns_or_invite?(champ.dossier)
|
||||||
|
%span.updated-at.highlighted
|
||||||
|
Le type de ce @champ où sa description a été modifiée par l'administration. Vérifier son contenu.
|
5
app/components/editable_champ/checkbox_component.rb
Normal file
5
app/components/editable_champ/checkbox_component.rb
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
class EditableChamp::CheckboxComponent < ApplicationComponent
|
||||||
|
def initialize(form:, champ:)
|
||||||
|
@form, @champ = form, champ
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,4 @@
|
||||||
|
= @form.check_box :value,
|
||||||
|
{ required: @champ.mandatory?, id: @champ.input_id, aria: { describedby: @champ.describedby_id } },
|
||||||
|
'on',
|
||||||
|
'off'
|
5
app/components/editable_champ/civilite_component.rb
Normal file
5
app/components/editable_champ/civilite_component.rb
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
class EditableChamp::CiviliteComponent < ApplicationComponent
|
||||||
|
def initialize(form:, champ:)
|
||||||
|
@form, @champ = form, champ
|
||||||
|
end
|
||||||
|
end
|
|
@ -2,9 +2,9 @@
|
||||||
%legend.mandatory-explanation
|
%legend.mandatory-explanation
|
||||||
Sélectionnez une des valeurs
|
Sélectionnez une des valeurs
|
||||||
%label
|
%label
|
||||||
= form.radio_button :value, Individual::GENDER_FEMALE
|
= @form.radio_button :value, Individual::GENDER_FEMALE
|
||||||
= Individual.human_attribute_name('gender.female')
|
= Individual.human_attribute_name('gender.female')
|
||||||
|
|
||||||
%label
|
%label
|
||||||
= form.radio_button :value, Individual::GENDER_MALE
|
= @form.radio_button :value, Individual::GENDER_MALE
|
||||||
= Individual.human_attribute_name('gender.male')
|
= Individual.human_attribute_name('gender.male')
|
5
app/components/editable_champ/cnaf_component.rb
Normal file
5
app/components/editable_champ/cnaf_component.rb
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
class EditableChamp::CnafComponent < ApplicationComponent
|
||||||
|
def initialize(form:, champ:)
|
||||||
|
@form, @champ = form, champ
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,16 @@
|
||||||
|
.cnaf-inputs
|
||||||
|
%div
|
||||||
|
= @form.label :numero_allocataire, t('.numero_allocataire_label')
|
||||||
|
%p.notice= t('.numero_allocataire_notice')
|
||||||
|
= @form.text_field :numero_allocataire,
|
||||||
|
required: @champ.mandatory?,
|
||||||
|
aria: { describedby: @champ.describedby_id },
|
||||||
|
class: "width-33-desktop"
|
||||||
|
|
||||||
|
%div
|
||||||
|
= @form.label :code_postal, t('.code_postal_label')
|
||||||
|
%p.notice= t('.code_postal_notice')
|
||||||
|
= @form.text_field :code_postal,
|
||||||
|
required: @champ.mandatory?,
|
||||||
|
aria: { describedby: @champ.describedby_id },
|
||||||
|
class: "width-33-desktop"
|
7
app/components/editable_champ/communes_component.rb
Normal file
7
app/components/editable_champ/communes_component.rb
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
class EditableChamp::CommunesComponent < ApplicationComponent
|
||||||
|
include ApplicationHelper
|
||||||
|
|
||||||
|
def initialize(form:, champ:)
|
||||||
|
@form, @champ = form, champ
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,10 @@
|
||||||
|
= @form.hidden_field :value
|
||||||
|
= @form.hidden_field :external_id
|
||||||
|
= @form.hidden_field :departement
|
||||||
|
= @form.hidden_field :code_departement
|
||||||
|
= react_component("ComboCommunesSearch",
|
||||||
|
required: @champ.mandatory?,
|
||||||
|
id: @champ.input_id,
|
||||||
|
classNameDepartement: "width-33-desktop width-100-mobile",
|
||||||
|
className: "width-66-desktop width-100-mobile",
|
||||||
|
describedby: @champ.describedby_id)
|
5
app/components/editable_champ/date_component.rb
Normal file
5
app/components/editable_champ/date_component.rb
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
class EditableChamp::DateComponent < ApplicationComponent
|
||||||
|
def initialize(form:, champ:)
|
||||||
|
@form, @champ = form, champ
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,7 @@
|
||||||
|
= @form.date_field :value,
|
||||||
|
id: @champ.input_id,
|
||||||
|
aria: { describedby: @champ.describedby_id },
|
||||||
|
value: @champ.value,
|
||||||
|
required: @champ.mandatory?,
|
||||||
|
placeholder: 'aaaa-mm-jj',
|
||||||
|
class: "width-33-desktop"
|
13
app/components/editable_champ/datetime_component.rb
Normal file
13
app/components/editable_champ/datetime_component.rb
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
class EditableChamp::DatetimeComponent < ApplicationComponent
|
||||||
|
def initialize(form:, champ:)
|
||||||
|
@form, @champ = form, champ
|
||||||
|
end
|
||||||
|
|
||||||
|
def datetime_start_year(date)
|
||||||
|
if date == nil || date.year == 0 || date.year >= Date.today.year - 1
|
||||||
|
Date.today.year - 1
|
||||||
|
else
|
||||||
|
date.year
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,4 @@
|
||||||
|
- parsed_value = @champ.value.present? ? Time.zone.parse(@champ.value) : nil
|
||||||
|
|
||||||
|
.datetime
|
||||||
|
= @form.datetime_select(:value, id: @champ.input_id, aria: { describedby: @champ.describedby_id }, selected: parsed_value, start_year: datetime_start_year(parsed_value), end_year: Date.today.year + 50, minute_step: 5, include_blank: true)
|
|
@ -0,0 +1,5 @@
|
||||||
|
class EditableChamp::DecimalNumberComponent < ApplicationComponent
|
||||||
|
def initialize(form:, champ:)
|
||||||
|
@form, @champ = form, champ
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,6 @@
|
||||||
|
= @form.number_field :value,
|
||||||
|
id: @champ.input_id,
|
||||||
|
aria: { describedby: @champ.describedby_id },
|
||||||
|
step: :any,
|
||||||
|
placeholder: "3.14",
|
||||||
|
required: @champ.mandatory?
|
7
app/components/editable_champ/departements_component.rb
Normal file
7
app/components/editable_champ/departements_component.rb
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
class EditableChamp::DepartementsComponent < ApplicationComponent
|
||||||
|
include ApplicationHelper
|
||||||
|
|
||||||
|
def initialize(form:, champ:)
|
||||||
|
@form, @champ = form, champ
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,7 @@
|
||||||
|
= @form.hidden_field :value
|
||||||
|
= @form.hidden_field :external_id
|
||||||
|
= react_component("ComboDepartementsSearch",
|
||||||
|
required: @champ.mandatory?,
|
||||||
|
id: @champ.input_id,
|
||||||
|
className: "width-33-desktop width-100-mobile",
|
||||||
|
describedby: @champ.describedby_id)
|
5
app/components/editable_champ/dgfip_component.rb
Normal file
5
app/components/editable_champ/dgfip_component.rb
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
class EditableChamp::DgfipComponent < ApplicationComponent
|
||||||
|
def initialize(form:, champ:)
|
||||||
|
@form, @champ = form, champ
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,16 @@
|
||||||
|
.dgfip-inputs
|
||||||
|
%div
|
||||||
|
= @form.label :numero_fiscal, t('.numero_fiscal_label')
|
||||||
|
%p.notice= t('.numero_fiscal_notice')
|
||||||
|
= @form.text_field :numero_fiscal,
|
||||||
|
required: @champ.mandatory?,
|
||||||
|
aria: { describedby: @champ.describedby_id },
|
||||||
|
class: "width-33-desktop"
|
||||||
|
|
||||||
|
%div
|
||||||
|
= @form.label :reference_avis, t('.reference_avis_label')
|
||||||
|
%p.notice= t('.reference_avis_notice')
|
||||||
|
= @form.text_field :reference_avis,
|
||||||
|
required: @champ.mandatory?,
|
||||||
|
aria: { describedby: @champ.describedby_id },
|
||||||
|
class: "width-33-desktop"
|
5
app/components/editable_champ/dossier_link_component.rb
Normal file
5
app/components/editable_champ/dossier_link_component.rb
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
class EditableChamp::DossierLinkComponent < ApplicationComponent
|
||||||
|
def initialize(form:, champ:)
|
||||||
|
@form, @champ = form, champ
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,12 @@
|
||||||
|
.dossier-link
|
||||||
|
= @form.number_field :value,
|
||||||
|
id: @champ.input_id,
|
||||||
|
aria: { describedby: @champ.describedby_id },
|
||||||
|
placeholder: "Numéro de dossier",
|
||||||
|
autocomplete: 'off',
|
||||||
|
required: @champ.mandatory?,
|
||||||
|
data: { controller: 'turbo-input', turbo_input_url_value: champs_dossier_link_path(@champ.id) },
|
||||||
|
class: "width-33-desktop"
|
||||||
|
|
||||||
|
.help-block{ id: dom_id(@champ, :help_block) }
|
||||||
|
= render partial: 'shared/champs/dossier_link/help_block', locals: { id: @champ.value }
|
|
@ -0,0 +1,5 @@
|
||||||
|
class EditableChamp::DropDownListComponent < ApplicationComponent
|
||||||
|
def initialize(form:, champ:)
|
||||||
|
@form, @champ = form, champ
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,22 @@
|
||||||
|
- if @champ.options?
|
||||||
|
- if @champ.render_as_radios?
|
||||||
|
%fieldset.radios
|
||||||
|
- @champ.enabled_non_empty_options.each do |option|
|
||||||
|
%label
|
||||||
|
= @form.radio_button :value, option
|
||||||
|
= option
|
||||||
|
|
||||||
|
- if !@champ.mandatory?
|
||||||
|
%label.blank-radio
|
||||||
|
= @form.radio_button :value, ''
|
||||||
|
Non renseigné
|
||||||
|
|
||||||
|
- if @champ.drop_down_other?
|
||||||
|
%label
|
||||||
|
= @form.radio_button :value, Champs::DropDownListChamp::OTHER, checked: @champ.other_value_present?
|
||||||
|
Autre
|
||||||
|
- else
|
||||||
|
= @form.select :value, @champ.options_without_empty_value_when_mandatory(@champ.options), { selected: @champ.selected }, required: @champ.mandatory?, id: @champ.input_id, aria: { describedby: @champ.describedby_id }
|
||||||
|
|
||||||
|
- if @champ.drop_down_other?
|
||||||
|
= render EditableChamp::DropDownOtherInputComponent.new(form: @form, champ: @champ)
|
|
@ -0,0 +1,5 @@
|
||||||
|
class EditableChamp::DropDownOtherInputComponent < ApplicationComponent
|
||||||
|
def initialize(form:, champ:)
|
||||||
|
@form, @champ = form, champ
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,4 @@
|
||||||
|
.drop_down_other{ class: @champ.other_value_present? ? '' : 'hidden' }
|
||||||
|
.notice
|
||||||
|
%p Veuillez saisir votre autre choix
|
||||||
|
= @form.text_field :value_other, maxlength: 200, size: nil, disabled: !@champ.other_value_present?
|
|
@ -0,0 +1,5 @@
|
||||||
|
class EditableChamp::EditableChampComponent < ApplicationComponent
|
||||||
|
def initialize(form:, champ:)
|
||||||
|
@form, @champ = form, champ
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,13 @@
|
||||||
|
.editable-@champ{ class: "editable-champ-#{champ.type_champ} #{champ.visible? ? '' : 'hidden'}", id: champ.input_group_id, data: editable_champ_controller(champ) }
|
||||||
|
- if @champ.repetition?
|
||||||
|
%h3.header-subsection= @champ.libelle
|
||||||
|
- if @champ.description.present?
|
||||||
|
%p.notice= string_to_html(@champ.description, false)
|
||||||
|
|
||||||
|
- elsif has_label?(@champ)
|
||||||
|
= render partial: 'shared/dossiers/editable_champs/champ_label', locals: { form: @form, champ: champ, seen_at: defined?(seen_at) ? seen_at : nil }
|
||||||
|
- if @champ.type_champ == "titre_identite"
|
||||||
|
%p.notice Carte nationale d’identité (uniquement le recto), passeport, titre de séjour ou autre justificatif d’identité. Formats acceptés : jpg/png
|
||||||
|
|
||||||
|
= @form.hidden_field :id, value: @champ.id, data: champ.repetition? ? { id: true } : {}
|
||||||
|
= render partial: "shared/dossiers/editable_champs/#{champ.type_champ}", locals: { form: @form, champ: champ }
|
5
app/components/editable_champ/email_component.rb
Normal file
5
app/components/editable_champ/email_component.rb
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
class EditableChamp::EmailComponent < ApplicationComponent
|
||||||
|
def initialize(form:, champ:)
|
||||||
|
@form, @champ = form, champ
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,5 @@
|
||||||
|
= @form.email_field :value,
|
||||||
|
id: @champ.input_id,
|
||||||
|
aria: { describedby: @champ.describedby_id },
|
||||||
|
placeholder: t(".placeholder"),
|
||||||
|
required: @champ.mandatory?
|
5
app/components/editable_champ/engagement_component.rb
Normal file
5
app/components/editable_champ/engagement_component.rb
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
class EditableChamp::EngagementComponent < ApplicationComponent
|
||||||
|
def initialize(form:, champ:)
|
||||||
|
@form, @champ = form, champ
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,4 @@
|
||||||
|
= @form.check_box :value,
|
||||||
|
{ required: @champ.mandatory?, id: @champ.input_id, aria: { describedby: @champ.describedby_id } },
|
||||||
|
'on',
|
||||||
|
'off'
|
|
@ -0,0 +1,7 @@
|
||||||
|
class EditableChamp::EtablissementTitreComponent < ApplicationComponent
|
||||||
|
include EtablissementHelper
|
||||||
|
|
||||||
|
def initialize(etablissement:)
|
||||||
|
@etablissement = etablissement
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,6 @@
|
||||||
|
.explication
|
||||||
|
= raison_sociale_or_name(@etablissement)
|
||||||
|
= @etablissement.entreprise_forme_juridique
|
||||||
|
- if @etablissement.entreprise_capital_social.present?
|
||||||
|
au capital social de
|
||||||
|
= pretty_currency(@etablissement.entreprise_capital_social)
|
7
app/components/editable_champ/explication_component.rb
Normal file
7
app/components/editable_champ/explication_component.rb
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
class EditableChamp::ExplicationComponent < ApplicationComponent
|
||||||
|
include StringToHtmlHelper
|
||||||
|
|
||||||
|
def initialize(form:, champ:)
|
||||||
|
@form, @champ = form, champ
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,3 @@
|
||||||
|
%h2.explication-libelle= @champ.libelle
|
||||||
|
.explication
|
||||||
|
= string_to_html(@champ.description)
|
|
@ -0,0 +1,5 @@
|
||||||
|
class EditableChamp::HeaderSectionComponent < ApplicationComponent
|
||||||
|
def initialize(form:, champ:)
|
||||||
|
@form, @champ = form, champ
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,2 @@
|
||||||
|
%h2.header-section
|
||||||
|
= @champ.libelle_with_section_index
|
5
app/components/editable_champ/iban_component.rb
Normal file
5
app/components/editable_champ/iban_component.rb
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
class EditableChamp::IbanComponent < ApplicationComponent
|
||||||
|
def initialize(form:, champ:)
|
||||||
|
@form, @champ = form, champ
|
||||||
|
end
|
||||||
|
end
|
|
@ -1,8 +1,8 @@
|
||||||
= form.text_field :value,
|
= @form.text_field :value,
|
||||||
id: champ.input_id,
|
id: @champ.input_id,
|
||||||
placeholder: t(".placeholder"),
|
placeholder: t(".placeholder"),
|
||||||
required: champ.mandatory?,
|
required: @champ.mandatory?,
|
||||||
aria: { describedby: champ.describedby_id },
|
aria: { describedby: @champ.describedby_id },
|
||||||
data: { controller: 'iban-input'},
|
data: { controller: 'iban-input'},
|
||||||
class: "width-66-desktop",
|
class: "width-66-desktop",
|
||||||
maxlength: 34 + 9 # count space separator of 4 digits-groups
|
maxlength: 34 + 9 # count space separator of 4 digits-groups
|
|
@ -0,0 +1,5 @@
|
||||||
|
class EditableChamp::IntegerNumberComponent < ApplicationComponent
|
||||||
|
def initialize(form:, champ:)
|
||||||
|
@form, @champ = form, champ
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,5 @@
|
||||||
|
= @form.number_field :value,
|
||||||
|
id: @champ.input_id,
|
||||||
|
aria: { describedby: @champ.describedby_id },
|
||||||
|
placeholder: 5,
|
||||||
|
required: @champ.mandatory?
|
|
@ -0,0 +1,5 @@
|
||||||
|
class EditableChamp::LinkedDropDownListComponent < ApplicationComponent
|
||||||
|
def initialize(form:, champ:)
|
||||||
|
@form, @champ = form, champ
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,18 @@
|
||||||
|
- if @champ.options?
|
||||||
|
= @form.select :primary_value,
|
||||||
|
@champ.primary_options,
|
||||||
|
{},
|
||||||
|
{ data: { secondary_options: @champ.secondary_options }, required: @champ.mandatory?, id: @champ.input_id, aria: { describedby: @champ.describedby_id } }
|
||||||
|
|
||||||
|
.secondary{ class: @champ.has_secondary_options_for_primary? ? '' : 'hidden' }
|
||||||
|
= @form.label :secondary_value, for: "#{@champ.input_id}-secondary" do
|
||||||
|
= @champ.drop_down_secondary_libelle.presence || "Valeur secondaire dépendant de la première"
|
||||||
|
- if @champ.type_de_champ.mandatory?
|
||||||
|
%span.mandatory *
|
||||||
|
- if @champ.drop_down_secondary_description.present?
|
||||||
|
.notice{ id: "#{@champ.describedby_id}-secondary" }= string_to_html(champ.drop_down_secondary_description)
|
||||||
|
= @form.select :secondary_value,
|
||||||
|
@champ.secondary_options[@champ.primary_value],
|
||||||
|
{},
|
||||||
|
{ data: { secondary: true }, disabled: !@champ.has_secondary_options_for_primary?, required: @champ.mandatory?, id: "#{@champ.input_id}-secondary", aria: { describedby: "#{@champ.describedby_id}-secondary" } }
|
||||||
|
= @form.hidden_field :secondary_value, value: '', disabled: @champ.has_secondary_options_for_primary?
|
5
app/components/editable_champ/mesri_component.rb
Normal file
5
app/components/editable_champ/mesri_component.rb
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
class EditableChamp::MesriComponent < ApplicationComponent
|
||||||
|
def initialize(form:, champ:)
|
||||||
|
@form, @champ = form, champ
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,9 @@
|
||||||
|
.mesri-inputs
|
||||||
|
%div
|
||||||
|
= @form.label :ine, t('.ine_label')
|
||||||
|
%p.notice= t('.ine_notice')
|
||||||
|
= @form.text_field :ine,
|
||||||
|
required: @champ.mandatory?,
|
||||||
|
aria: { describedby: @champ.describedby_id },
|
||||||
|
class: "width-33-desktop"
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
class EditableChamp::MultipleDropDownListComponent < ApplicationComponent
|
||||||
|
include ApplicationHelper
|
||||||
|
|
||||||
|
def initialize(form:, champ:)
|
||||||
|
@form, @champ = form, champ
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,17 @@
|
||||||
|
- if @champ.options?
|
||||||
|
- if @champ.render_as_checkboxes?
|
||||||
|
= @form.collection_check_boxes(:value, @champ.enabled_non_empty_options, :to_s, :to_s) do |b|
|
||||||
|
.editable-champ.editable-champ-checkbox
|
||||||
|
= b.label do
|
||||||
|
= b.check_box({ multiple: true, checked: @champ&.selected_options&.include?(b.value), aria: { describedby: @champ.describedby_id } })
|
||||||
|
= b.text
|
||||||
|
|
||||||
|
- else
|
||||||
|
= @form.hidden_field :value
|
||||||
|
= react_component("ComboMultipleDropdownList",
|
||||||
|
options: @champ.options,
|
||||||
|
selected: @champ.selected_options,
|
||||||
|
disabled: @champ.disabled_options,
|
||||||
|
id: @champ.input_id,
|
||||||
|
labelledby: @champ.labelledby_id,
|
||||||
|
describedby: @champ.describedby_id)
|
5
app/components/editable_champ/number_component.rb
Normal file
5
app/components/editable_champ/number_component.rb
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
class EditableChamp::NumberComponent < ApplicationComponent
|
||||||
|
def initialize(form:, champ:)
|
||||||
|
@form, @champ = form, champ
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,5 @@
|
||||||
|
= @form.number_field :value,
|
||||||
|
id: @champ.input_id,
|
||||||
|
aria: { describedby: @champ.describedby_id },
|
||||||
|
placeholder: @champ.libelle,
|
||||||
|
required: @champ.mandatory?
|
7
app/components/editable_champ/pays_component.rb
Normal file
7
app/components/editable_champ/pays_component.rb
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
class EditableChamp::PaysComponent < ApplicationComponent
|
||||||
|
include ApplicationHelper
|
||||||
|
|
||||||
|
def initialize(form:, champ:)
|
||||||
|
@form, @champ = form, champ
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,7 @@
|
||||||
|
= @form.hidden_field :value
|
||||||
|
= @form.hidden_field :external_id
|
||||||
|
= react_component("ComboPaysSearch",
|
||||||
|
required: @champ.mandatory?,
|
||||||
|
id: @champ.input_id,
|
||||||
|
className: "width-33-desktop width-100-mobile",
|
||||||
|
describedby: @champ.describedby_id)
|
5
app/components/editable_champ/phone_component.rb
Normal file
5
app/components/editable_champ/phone_component.rb
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
class EditableChamp::PhoneComponent < ApplicationComponent
|
||||||
|
def initialize(form:, champ:)
|
||||||
|
@form, @champ = form, champ
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,9 @@
|
||||||
|
-# Allowed @formats:
|
||||||
|
-# very light validation is made client-side
|
||||||
|
-# stronger validation is made server-side
|
||||||
|
= @form.phone_field :value,
|
||||||
|
id: @champ.input_id,
|
||||||
|
aria: { describedby: @champ.describedby_id },
|
||||||
|
placeholder: t(".placeholder"),
|
||||||
|
required: @champ.mandatory?,
|
||||||
|
pattern: "[^a-z^A-Z]+"
|
|
@ -0,0 +1,5 @@
|
||||||
|
class EditableChamp::PieceJustificativeComponent < ApplicationComponent
|
||||||
|
def initialize(form:, champ:)
|
||||||
|
@form, @champ = form, champ
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,2 @@
|
||||||
|
- user_can_destroy = !@champ.mandatory? || @champ.dossier.brouillon?
|
||||||
|
= render Attachment::EditComponent.new(form: @form, attached_file: @champ.piece_justificative_file, template: @champ.type_de_champ.piece_justificative_template, user_can_destroy: user_can_destroy)
|
5
app/components/editable_champ/pole_emploi_component.rb
Normal file
5
app/components/editable_champ/pole_emploi_component.rb
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
class EditableChamp::PoleEmploiComponent < ApplicationComponent
|
||||||
|
def initialize(form:, champ:)
|
||||||
|
@form, @champ = form, champ
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,8 @@
|
||||||
|
.pole-emploi-inputs
|
||||||
|
%div
|
||||||
|
= @form.label :identifiant, t('.identifiant_label')
|
||||||
|
%p.notice= t('.identifiant_notice')
|
||||||
|
= @form.text_field :identifiant,
|
||||||
|
required: @champ.mandatory?,
|
||||||
|
aria: { describedby: @champ.describedby_id },
|
||||||
|
class: "width-33-desktop"
|
7
app/components/editable_champ/regions_component.rb
Normal file
7
app/components/editable_champ/regions_component.rb
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
class EditableChamp::RegionsComponent < ApplicationComponent
|
||||||
|
include ApplicationHelper
|
||||||
|
|
||||||
|
def initialize(form:, champ:)
|
||||||
|
@form, @champ = form, champ
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,7 @@
|
||||||
|
= @form.hidden_field :value
|
||||||
|
= @form.hidden_field :external_id
|
||||||
|
= react_component("ComboRegionsSearch",
|
||||||
|
required: @champ.mandatory?,
|
||||||
|
id: @champ.input_id,
|
||||||
|
className: "width-33-desktop width-100-mobile",
|
||||||
|
describedby: @champ.describedby_id)
|
5
app/components/editable_champ/repetition_component.rb
Normal file
5
app/components/editable_champ/repetition_component.rb
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
class EditableChamp::RepetitionComponent < ApplicationComponent
|
||||||
|
def initialize(form:, champ:)
|
||||||
|
@form, @champ = form, champ
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,8 @@
|
||||||
|
.repetition{ id: dom_id(@champ, :rows) }
|
||||||
|
- @champ.rows.each do |champs|
|
||||||
|
= render EditableChamp::RepetitionRowComponent.new(form: @form, champ: @champ, row: champs)
|
||||||
|
|
||||||
|
.actions{ 'data-turbo': 'true' }
|
||||||
|
= link_to champs_repetition_path(@champ.id), data: { turbo_method: :post }, class: 'button add-row' do
|
||||||
|
%span.icon.add
|
||||||
|
Ajouter un élément pour « #{@champ.libelle} »
|
|
@ -0,0 +1,5 @@
|
||||||
|
class EditableChamp::RepetitionRowComponent < ApplicationComponent
|
||||||
|
def initialize(form:, champ:, row:)
|
||||||
|
@form, @champ, @row = form, champ, row
|
||||||
|
end
|
||||||
|
end
|
|
@ -1,9 +1,9 @@
|
||||||
- row_dom_id = "row-#{SecureRandom.hex(4)}"
|
- row_dom_id = "row-#{SecureRandom.hex(4)}"
|
||||||
.row{ id: row_dom_id }
|
.row{ id: row_dom_id }
|
||||||
- row.each do |champ|
|
- @row.each do |champ|
|
||||||
= fields_for champ.input_name, champ do |form|
|
= fields_for champ.input_name, champ do |form|
|
||||||
= render partial: 'shared/dossiers/editable_champs/editable_champ', locals: { form: form, champ: champ }
|
= render partial: 'shared/dossiers/editable_champs/editable_champ', locals: { form: form, champ: champ }
|
||||||
|
|
||||||
.flex.row-reverse{ 'data-turbo': 'true' }
|
.flex.row-reverse{ 'data-turbo': 'true' }
|
||||||
= link_to champs_repetition_path(champ.id, champ_ids: row.map(&:id), row_id: row_dom_id), data: { turbo_method: :delete }, class: 'button danger remove-row' do
|
= link_to champs_repetition_path(@champ.id, champ_ids: @row.map(&:id), row_id: row_dom_id), data: { turbo_method: :delete }, class: 'button danger remove-row' do
|
||||||
Supprimer l’élément
|
Supprimer l’élément
|
5
app/components/editable_champ/siret_component.rb
Normal file
5
app/components/editable_champ/siret_component.rb
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
class EditableChamp::SiretComponent < ApplicationComponent
|
||||||
|
def initialize(form:, champ:)
|
||||||
|
@form, @champ = form, champ
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,14 @@
|
||||||
|
= @form.text_field :value,
|
||||||
|
id: @champ.input_id,
|
||||||
|
aria: { describedby: @champ.describedby_id },
|
||||||
|
placeholder: t(".placeholder"),
|
||||||
|
data: { controller: 'turbo-input', turbo_input_url_value: champs_siret_path(@champ.id) },
|
||||||
|
required: @champ.mandatory?,
|
||||||
|
pattern: "[0-9]{14}",
|
||||||
|
title: t(".title"),
|
||||||
|
class: "width-33-desktop",
|
||||||
|
maxlength: 14
|
||||||
|
.spinner.right.hidden
|
||||||
|
.siret-info{ id: dom_id(@champ, :siret_info) }
|
||||||
|
- if @champ.etablissement.present?
|
||||||
|
= render partial: 'shared/dossiers/editable_champs/etablissement_titre', locals: { etablissement: @champ.etablissement }
|
5
app/components/editable_champ/text_component.rb
Normal file
5
app/components/editable_champ/text_component.rb
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
class EditableChamp::TextComponent < ApplicationComponent
|
||||||
|
def initialize(form:, champ:)
|
||||||
|
@form, @champ = form, champ
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,4 @@
|
||||||
|
= @form.text_field :value,
|
||||||
|
id: @champ.input_id,
|
||||||
|
required: @champ.mandatory?,
|
||||||
|
aria: { describedby: @champ.describedby_id }
|
7
app/components/editable_champ/textarea_component.rb
Normal file
7
app/components/editable_champ/textarea_component.rb
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
class EditableChamp::TextareaComponent < ApplicationComponent
|
||||||
|
include HtmlToStringHelper
|
||||||
|
|
||||||
|
def initialize(form:, champ:)
|
||||||
|
@form, @champ = form, champ
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,6 @@
|
||||||
|
~ @form.text_area :value,
|
||||||
|
id: @champ.input_id,
|
||||||
|
aria: { describedby: @champ.describedby_id },
|
||||||
|
rows: 6,
|
||||||
|
required: @champ.mandatory?,
|
||||||
|
value: html_to_string(@champ.value)
|
|
@ -0,0 +1,5 @@
|
||||||
|
class EditableChamp::TitreIdentiteComponent < ApplicationComponent
|
||||||
|
def initialize(form:, champ:)
|
||||||
|
@form, @champ = form, champ
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,2 @@
|
||||||
|
- user_can_destroy = !@champ.mandatory? || @champ.dossier.brouillon?
|
||||||
|
= render Attachment::EditComponent.new(form: @form, attached_file: @champ.piece_justificative_file, user_can_destroy: user_can_destroy)
|
5
app/components/editable_champ/yes_no_component.rb
Normal file
5
app/components/editable_champ/yes_no_component.rb
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
class EditableChamp::YesNoComponent < ApplicationComponent
|
||||||
|
def initialize(form:, champ:)
|
||||||
|
@form, @champ = form, champ
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,8 @@
|
||||||
|
%fieldset.radios
|
||||||
|
%label
|
||||||
|
= @form.radio_button :value, true
|
||||||
|
Oui
|
||||||
|
|
||||||
|
%label
|
||||||
|
= @form.radio_button :value, false
|
||||||
|
Non
|
|
@ -82,12 +82,4 @@ module ChampHelper
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def datetime_start_year(date)
|
|
||||||
if date == nil || date.year == 0 || date.year >= Date.today.year - 1
|
|
||||||
Date.today.year - 1
|
|
||||||
else
|
|
||||||
date.year
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,2 +1,3 @@
|
||||||
= fields_for @champ.input_name, @champ do |form|
|
= fields_for @champ.input_name, @champ do |form|
|
||||||
= turbo_stream.append dom_id(@champ, :rows), partial: 'shared/dossiers/editable_champs/repetition_row', locals: { form: form, champ: @champ, row: @champs }
|
= turbo_stream.append dom_id(@champ, :rows), render(EditableChamp::RepetitionRowComponent.new(form: form, champ: @champ, row: @champs))
|
||||||
|
|
||||||
|
|
|
@ -11,4 +11,4 @@
|
||||||
|
|
||||||
- else
|
- else
|
||||||
- if siret.present? && siret == etablissement&.siret
|
- if siret.present? && siret == etablissement&.siret
|
||||||
= render partial: 'shared/dossiers/editable_champs/etablissement_titre', locals: { etablissement: etablissement }
|
= render EditableChamp::EtablissementTitreComponent.new(etablissement: etablissement)
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
= form.hidden_field :value
|
|
||||||
= form.hidden_field :external_id
|
|
||||||
= react_component("ComboAdresseSearch",
|
|
||||||
required: champ.mandatory?,
|
|
||||||
id: champ.input_id,
|
|
||||||
describedby: champ.describedby_id)
|
|
|
@ -1,6 +0,0 @@
|
||||||
= form.hidden_field :value
|
|
||||||
= form.hidden_field :external_id
|
|
||||||
= react_component("ComboAnnuaireEducationSearch",
|
|
||||||
required: champ.mandatory?,
|
|
||||||
id: champ.input_id,
|
|
||||||
describedby: champ.describedby_id)
|
|
|
@ -1,4 +0,0 @@
|
||||||
= react_component("MapEditor", featureCollection: champ.to_feature_collection, url: champs_carte_features_path(champ), options: champ.render_options)
|
|
||||||
|
|
||||||
.geo-areas{ id: dom_id(champ, :geo_areas) }
|
|
||||||
= render partial: 'shared/champs/carte/geo_areas', locals: { champ: champ, editing: true }
|
|
|
@ -1,4 +0,0 @@
|
||||||
= form.check_box :value,
|
|
||||||
{ required: champ.mandatory?, id: champ.input_id, aria: { describedby: champ.describedby_id } },
|
|
||||||
'on',
|
|
||||||
'off'
|
|
|
@ -1,16 +0,0 @@
|
||||||
.cnaf-inputs
|
|
||||||
%div
|
|
||||||
= form.label :numero_allocataire, t('.numero_allocataire_label')
|
|
||||||
%p.notice= t('.numero_allocataire_notice')
|
|
||||||
= form.text_field :numero_allocataire,
|
|
||||||
required: champ.mandatory?,
|
|
||||||
aria: { describedby: champ.describedby_id },
|
|
||||||
class: "width-33-desktop"
|
|
||||||
|
|
||||||
%div
|
|
||||||
= form.label :code_postal, t('.code_postal_label')
|
|
||||||
%p.notice= t('.code_postal_notice')
|
|
||||||
= form.text_field :code_postal,
|
|
||||||
required: champ.mandatory?,
|
|
||||||
aria: { describedby: champ.describedby_id },
|
|
||||||
class: "width-33-desktop"
|
|
|
@ -1,10 +0,0 @@
|
||||||
= form.hidden_field :value
|
|
||||||
= form.hidden_field :external_id
|
|
||||||
= form.hidden_field :departement
|
|
||||||
= form.hidden_field :code_departement
|
|
||||||
= react_component("ComboCommunesSearch",
|
|
||||||
required: champ.mandatory?,
|
|
||||||
id: champ.input_id,
|
|
||||||
classNameDepartement: "width-33-desktop width-100-mobile",
|
|
||||||
className: "width-66-desktop width-100-mobile",
|
|
||||||
describedby: champ.describedby_id)
|
|
|
@ -1,7 +0,0 @@
|
||||||
= form.date_field :value,
|
|
||||||
id: champ.input_id,
|
|
||||||
aria: { describedby: champ.describedby_id },
|
|
||||||
value: champ.value,
|
|
||||||
required: champ.mandatory?,
|
|
||||||
placeholder: 'aaaa-mm-jj',
|
|
||||||
class: "width-33-desktop"
|
|
|
@ -1,4 +0,0 @@
|
||||||
- parsed_value = champ.value.present? ? Time.zone.parse(champ.value) : nil
|
|
||||||
|
|
||||||
.datetime
|
|
||||||
= form.datetime_select(:value, id: champ.input_id, aria: { describedby: champ.describedby_id }, selected: parsed_value, start_year: datetime_start_year(parsed_value), end_year: Date.today.year + 50, minute_step: 5, include_blank: true)
|
|
|
@ -1,6 +0,0 @@
|
||||||
= form.number_field :value,
|
|
||||||
id: champ.input_id,
|
|
||||||
aria: { describedby: champ.describedby_id },
|
|
||||||
step: :any,
|
|
||||||
placeholder: "3.14",
|
|
||||||
required: champ.mandatory?
|
|
|
@ -1,7 +0,0 @@
|
||||||
= form.hidden_field :value
|
|
||||||
= form.hidden_field :external_id
|
|
||||||
= react_component("ComboDepartementsSearch",
|
|
||||||
required: champ.mandatory?,
|
|
||||||
id: champ.input_id,
|
|
||||||
className: "width-33-desktop width-100-mobile",
|
|
||||||
describedby: champ.describedby_id)
|
|
|
@ -1,16 +0,0 @@
|
||||||
.dgfip-inputs
|
|
||||||
%div
|
|
||||||
= form.label :numero_fiscal, t('.numero_fiscal_label')
|
|
||||||
%p.notice= t('.numero_fiscal_notice')
|
|
||||||
= form.text_field :numero_fiscal,
|
|
||||||
required: champ.mandatory?,
|
|
||||||
aria: { describedby: champ.describedby_id },
|
|
||||||
class: "width-33-desktop"
|
|
||||||
|
|
||||||
%div
|
|
||||||
= form.label :reference_avis, t('.reference_avis_label')
|
|
||||||
%p.notice= t('.reference_avis_notice')
|
|
||||||
= form.text_field :reference_avis,
|
|
||||||
required: champ.mandatory?,
|
|
||||||
aria: { describedby: champ.describedby_id },
|
|
||||||
class: "width-33-desktop"
|
|
|
@ -1,12 +0,0 @@
|
||||||
.dossier-link
|
|
||||||
= form.number_field :value,
|
|
||||||
id: champ.input_id,
|
|
||||||
aria: { describedby: champ.describedby_id },
|
|
||||||
placeholder: "Numéro de dossier",
|
|
||||||
autocomplete: 'off',
|
|
||||||
required: champ.mandatory?,
|
|
||||||
data: { controller: 'turbo-input', turbo_input_url_value: champs_dossier_link_path(champ.id) },
|
|
||||||
class: "width-33-desktop"
|
|
||||||
|
|
||||||
.help-block{ id: dom_id(champ, :help_block) }
|
|
||||||
= render partial: 'shared/champs/dossier_link/help_block', locals: { id: champ.value }
|
|
|
@ -1,22 +0,0 @@
|
||||||
- if champ.options?
|
|
||||||
- if champ.render_as_radios?
|
|
||||||
%fieldset.radios
|
|
||||||
- champ.enabled_non_empty_options.each do |option|
|
|
||||||
%label
|
|
||||||
= form.radio_button :value, option
|
|
||||||
= option
|
|
||||||
|
|
||||||
- if !champ.mandatory?
|
|
||||||
%label.blank-radio
|
|
||||||
= form.radio_button :value, ''
|
|
||||||
Non renseigné
|
|
||||||
|
|
||||||
- if champ.drop_down_other?
|
|
||||||
%label
|
|
||||||
= form.radio_button :value, Champs::DropDownListChamp::OTHER, checked: champ.other_value_present?
|
|
||||||
Autre
|
|
||||||
- else
|
|
||||||
= form.select :value, champ.options_without_empty_value_when_mandatory(champ.options), { selected: champ.selected }, required: champ.mandatory?, id: champ.input_id, aria: { describedby: champ.describedby_id }
|
|
||||||
|
|
||||||
- if champ.drop_down_other?
|
|
||||||
= render partial: "shared/dossiers/editable_champs/drop_down_other_input", locals: { form: form, champ: champ }
|
|
|
@ -1,4 +0,0 @@
|
||||||
.drop_down_other{ class: champ.other_value_present? ? '' : 'hidden' }
|
|
||||||
.notice
|
|
||||||
%p Veuillez saisir votre autre choix
|
|
||||||
= form.text_field :value_other, maxlength: 200, size: nil, disabled: !champ.other_value_present?
|
|
|
@ -10,4 +10,4 @@
|
||||||
%p.notice Carte nationale d’identité (uniquement le recto), passeport, titre de séjour ou autre justificatif d’identité. Formats acceptés : jpg/png
|
%p.notice Carte nationale d’identité (uniquement le recto), passeport, titre de séjour ou autre justificatif d’identité. Formats acceptés : jpg/png
|
||||||
|
|
||||||
= form.hidden_field :id, value: champ.id, data: champ.repetition? ? { id: true } : {}
|
= form.hidden_field :id, value: champ.id, data: champ.repetition? ? { id: true } : {}
|
||||||
= render partial: "shared/dossiers/editable_champs/#{champ.type_champ}", locals: { form: form, champ: champ }
|
= render "EditableChamp::#{champ.type_champ.camelcase}Component".constantize.new(form: form, champ: champ)
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue