setOpen(true)}
onClose={() => setOpen(false)}
/>
- {props.banAddress && !isBanEligible(props.banAddress) && (
-
-
- Amélioration possible
-
-
- L’adresse issue de la Base Adresse Nationale, indiquée dans
- le champ Adresse ci-dessus, semble différente de l’adresse issue de
- la DGFIP : {props.rawAddress.join(' ')}
-
-
- Modifier le champ Adresse à partir de l’adresse DGFIP ?
-
- {
- if (props.banAddress) {
- setPreviousAddress({
- ...props.banAddress,
- banId: props.banAddress.banId ?? '',
- latitude: props.banAddress.latitude ?? 0,
- longitude: props.banAddress.longitude ?? 0,
- score: props.banAddress.score ?? Number.NaN
- });
- }
- setInputValue(props.rawAddress.join(' '));
- setSearchAddressFromLovac(true);
- setOpen(true);
- }
- },
- {
- children: 'Non',
- priority: 'secondary',
- onClick: () => {
- if (props.banAddress) {
- props.onSelectAddress({
- ...props.banAddress,
- banId: props.banAddress.banId ?? '',
- latitude: props.banAddress.latitude ?? 0,
- longitude: props.banAddress.longitude ?? 0,
- // Consider that the user has validated the address
- score: 1
- });
- }
- }
- }
- ]}
- alignment="left"
- inlineLayoutWhen="sm and up"
- >
-
+ {props.warningVisible && !isBanEligible(props.banAddress) && (
+ {props.setWarningVisible(false);},
+ }}>
+ L’adresse de la Base Adresse Nationale diffère de celle de la DGFIP. Veuillez vérifier attentivement ces informations ou ignorez l’alerte.
+
)}
>
);
diff --git a/frontend/src/components/OwnerCard/OwnerCard.tsx b/frontend/src/components/OwnerCard/OwnerCard.tsx
index c7aa2adc8..31eb35ad6 100644
--- a/frontend/src/components/OwnerCard/OwnerCard.tsx
+++ b/frontend/src/components/OwnerCard/OwnerCard.tsx
@@ -29,12 +29,6 @@ function OwnerCard(props: OwnerCardProps) {
const archivedOwners =
props.coOwners?.filter((owner) => owner.rank <= 0) ?? [];
- const address: ReadonlyArray = (
- props.owner.banAddress
- ? formatAddress(props.owner.banAddress)
- : props.owner.rawAddress
- ).map((line: string) => {line});
-
return (
@@ -64,6 +58,22 @@ function OwnerCard(props: OwnerCardProps) {
) : null}
+
+
+
+ Adresse fiscale (source: DGFIP)
+
+ {props.owner.rawAddress ? props.owner.rawAddress.join(' ') : 'Inconnue'}
+
+
+
- Adresse postale
+ Adresse postale (source: Base Adresse Nationale)
- {address}
+ {props.owner.banAddress ? formatAddress(props.owner.banAddress).join(' ') : 'Inconnue'}
+
{!isBanEligible(props.owner.banAddress) && (
- Cette adresse issue de la BAN est différente de l’adresse
- fiscale.
+ L’adresse Base Adresse Nationale ne correspond pas à celle de la DGFIP.
- Cliquez sur “Modifier” pour valider l’adresse que vous
- souhaitez utiliser.
+ Nous vous recommandons de vérifier en cliquant sur "Modifier".
>
}
diff --git a/frontend/src/components/OwnerEditionSideMenu/OwnerEditionSideMenu.tsx b/frontend/src/components/OwnerEditionSideMenu/OwnerEditionSideMenu.tsx
index 6bfa4cb97..1d508152b 100644
--- a/frontend/src/components/OwnerEditionSideMenu/OwnerEditionSideMenu.tsx
+++ b/frontend/src/components/OwnerEditionSideMenu/OwnerEditionSideMenu.tsx
@@ -1,3 +1,4 @@
+import { fr } from '@codegouvfr/react-dsfr';
import Button from '@codegouvfr/react-dsfr/Button';
import { FormEvent, useState } from 'react';
import { object, string } from 'yup';
@@ -10,6 +11,7 @@ import { Owner } from '../../models/Owner';
import { banAddressValidator, useForm } from '../../hooks/useForm';
import { useUpdateOwnerMutation } from '../../services/owner.service';
import { useNotification } from '../../hooks/useNotification';
+import { Grid, Typography } from '@mui/material';
interface Props {
className?: string;
@@ -19,15 +21,16 @@ interface Props {
function OwnerEditionSideMenu(props: Props) {
const { active, setActive, toggle } = useToggle();
+ const storedWarningVisible = localStorage.getItem('OwnerEdition.warningVisible');
+ const [warningVisible, setWarningVisible] = useState(storedWarningVisible === null || storedWarningVisible === 'true');
+
const shape = {
- fullName: string().optional(),
address: banAddressValidator.optional(),
additionalAddress: string().optional().nullable()
};
type FormShape = typeof shape;
const schema = object(shape);
- const [fullName, setFullName] = useState(props.owner.fullName);
const [address, setAddress] = useState(props.owner.banAddress);
const [additionalAddress, setAdditionalAddress] = useState(
props.owner.additionalAddress ?? ''
@@ -35,8 +38,7 @@ function OwnerEditionSideMenu(props: Props) {
const formId = 'owner-edition-form';
const form = useForm(schema, {
address,
- additionalAddress,
- fullName
+ additionalAddress
});
function open(): void {
@@ -50,11 +52,11 @@ function OwnerEditionSideMenu(props: Props) {
const [updateOwner, mutation] = useUpdateOwnerMutation();
async function save(event: FormEvent): Promise {
+ localStorage.setItem('OwnerEdition.warningVisible', warningVisible.toString());
event.preventDefault();
await form.validate(async () => {
await updateOwner({
...props.owner,
- fullName,
banAddress: address,
additionalAddress
}).unwrap();
@@ -97,20 +99,43 @@ function OwnerEditionSideMenu(props: Props) {
title="Modifier les informations du propriétaire"
content={