Merge pull request #2314 from betagouv/improve-siret-champ

Amélioration du champ "SIRET"
This commit is contained in:
Pierre de La Morinerie 2018-07-30 18:26:23 +02:00 committed by GitHub
commit ab8f564b1f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 8 additions and 9 deletions

View file

@ -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 {

View file

@ -14,7 +14,7 @@
.right-spinner {
display: none;
position: absolute;
bottom: 1.3em;
top: 3.7em;
right: 1.2em;
transform: scale(0.3);
}

View file

@ -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 navons pas trouvé détablissement correspondant à ce numéro de SIRET.']
message << helpers.link_to('Plus dinformations', "https://faq.demarches-simplifiees.fr/article/4-erreur-siret", target: '_blank')
@error = helpers.safe_join(message, ' ')
end
end
respond_to do |format|

View file

@ -6,6 +6,7 @@ addEventListener('turbolinks:load', () => {
switch (value.length) {
case 0:
input.removeAttr('data-invalid');
$.get(`${url}?siret=blank`);
break;
case 14:

View file

@ -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|

View file

@ -1,4 +1,4 @@
.etablissement-titre
.explication
= raison_sociale_or_name(etablissement)
= etablissement.entreprise_forme_juridique
- if etablissement.entreprise_capital_social.present?