Merge pull request #2314 from betagouv/improve-siret-champ
Amélioration du champ "SIRET"
This commit is contained in:
commit
ab8f564b1f
6 changed files with 8 additions and 9 deletions
|
@ -64,10 +64,6 @@
|
|||
visibility: visible;
|
||||
}
|
||||
|
||||
.etablissement-titre {
|
||||
margin-bottom: 2 * $default-padding;
|
||||
}
|
||||
|
||||
// Align checkboxes on the top-left side of the label
|
||||
&.editable-champ-checkbox,
|
||||
&.editable-champ-engagement {
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
.right-spinner {
|
||||
display: none;
|
||||
position: absolute;
|
||||
bottom: 1.3em;
|
||||
top: 3.7em;
|
||||
right: 1.2em;
|
||||
transform: scale(0.3);
|
||||
}
|
||||
|
|
|
@ -12,14 +12,16 @@ class Champs::SiretController < ApplicationController
|
|||
if @etablissement
|
||||
@etablissement.mark_for_destruction
|
||||
end
|
||||
@error = "SIRET invalide"
|
||||
@error = "Le numéro de SIRET doit comporter exactement 14 chiffres."
|
||||
else
|
||||
etablissement_attributes = ApiEntrepriseService.get_etablissement_params_for_siret(siret, @champ.dossier.procedure_id)
|
||||
if etablissement_attributes.present?
|
||||
@etablissement = @champ.build_etablissement(etablissement_attributes)
|
||||
@etablissement.champ = @champ
|
||||
else
|
||||
@error = "SIRET invalide"
|
||||
message = ['Nous n’avons pas trouvé d’établissement correspondant à ce numéro de SIRET.']
|
||||
message << helpers.link_to('Plus d’informations', "https://faq.demarches-simplifiees.fr/article/4-erreur-siret", target: '_blank')
|
||||
@error = helpers.safe_join(message, ' ')
|
||||
end
|
||||
end
|
||||
respond_to do |format|
|
||||
|
|
|
@ -6,6 +6,7 @@ addEventListener('turbolinks:load', () => {
|
|||
|
||||
switch (value.length) {
|
||||
case 0:
|
||||
input.removeAttr('data-invalid');
|
||||
$.get(`${url}?siret=blank`);
|
||||
break;
|
||||
case 14:
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
= message
|
||||
.mandatory= message
|
||||
- if etablissement.present?
|
||||
- champ_attributes = etablissement.champ.private? ? 'champs_private_attributes' : 'champs_attributes'
|
||||
= fields_for "dossier[#{champ_attributes}][#{position}][etablissement_attributes]", etablissement do |form|
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
.etablissement-titre
|
||||
.explication
|
||||
= raison_sociale_or_name(etablissement)
|
||||
= etablissement.entreprise_forme_juridique
|
||||
- if etablissement.entreprise_capital_social.present?
|
||||
|
|
Loading…
Reference in a new issue