Skip to content

Commit

Permalink
[tra-15635]Lorsque je coche L'installation n'a pas de numéro SIRET ap…
Browse files Browse the repository at this point in the history
…rès avoir renseigné un SIRET, l'établissement sélectionné (Company Selector) ainsi que ses informations de contact devraient se vider (#3856)
  • Loading branch information
JulianaJM authored Jan 7, 2025
2 parents bc2050c + 92f9b4c commit 27a1506
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions front/src/Apps/Dashboard/Creation/bsvhu/steps/Emitter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,13 @@ const EmitterBsvhu = ({ errors }) => {
return null;
};

const onNoSiretClick = () => {
if (!!emitter.company) {
setValue("emitter.company", {});
setValue("emitter.agrementNumber", null);
}
};

return (
<>
{!!sealedFields.length && <DisabledParagraphStep />}
Expand Down Expand Up @@ -228,7 +235,8 @@ const EmitterBsvhu = ({ errors }) => {
{
label: "L'installation n'a pas de numéro SIRET",
nativeInputProps: {
...register("emitter.noSiret")
...register("emitter.noSiret"),
onClick: onNoSiretClick
}
}
]}
Expand All @@ -239,9 +247,9 @@ const EmitterBsvhu = ({ errors }) => {
<>
<DsfrfWorkSiteAddress
designation="du site d'enlèvement"
address={emitter.company.address}
postalCode={emitter.company.postalCode}
city={emitter.company.city}
address={emitter.company?.address}
postalCode={emitter.company?.postalCode}
city={emitter.company?.city}
placeholder="Rechercher"
onAddressSelection={details => {
// `address` is passed as `name` because of adresse api return fields
Expand Down

0 comments on commit 27a1506

Please sign in to comment.