diff --git a/source/reducers/inFranceAppReducer.ts b/source/reducers/inFranceAppReducer.ts index f41973d3a..f0b412463 100644 --- a/source/reducers/inFranceAppReducer.ts +++ b/source/reducers/inFranceAppReducer.ts @@ -152,6 +152,7 @@ function existingCompany(state: Company | null = null, action): Company | null { action.catégorieJuridique ) return { + ...state, siren: state.siren, statutJuridique, dateDeCréation: action.dateDeCréation diff --git a/source/reducers/rootReducer.ts b/source/reducers/rootReducer.ts index d33e61032..f48ffb007 100644 --- a/source/reducers/rootReducer.ts +++ b/source/reducers/rootReducer.ts @@ -248,7 +248,21 @@ function simulation( } return state } - +const existingCompanyReducer = (state, action: Action) => { + if (action.type.startsWith('EXISTING_COMPANY::') && state.simulation) { + return { + ...state, + simulation: { + ...state.simulation, + situation: { + ...state.simulation.situation, + ...getCompanySituation(state.inFranceApp.existingCompany) + } + } + } + } + return state +} const mainReducer = (state, action: Action) => combineReducers({ lang, @@ -271,6 +285,7 @@ const mainReducer = (state, action: Action) => export default reduceReducers( mainReducer as any, + existingCompanyReducer as any, storageRootReducer as any ) as Reducer diff --git a/source/sites/mon-entreprise.fr/pages/Simulateurs/dnrti.tsx b/source/sites/mon-entreprise.fr/pages/Simulateurs/dnrti.tsx index 33f260559..2ad0974dd 100644 --- a/source/sites/mon-entreprise.fr/pages/Simulateurs/dnrti.tsx +++ b/source/sites/mon-entreprise.fr/pages/Simulateurs/dnrti.tsx @@ -3,7 +3,7 @@ import RuleLink from 'Components/RuleLink' import 'Components/TargetSelection.css' import { formatValue } from 'Engine/format' import InputComponent from 'Engine/InputComponent' -import React, { useState } from 'react' +import React, { useEffect, useState } from 'react' import { useDispatch, useSelector } from 'react-redux' import { RootState } from 'Reducers/rootReducer' import { @@ -69,9 +69,14 @@ export default function DNRTI() { - +

Exonérations

+ +

International

{ + setCurrentValue(value) + }, [value]) + if (!analysis.isApplicable) { return null }