Corrige le bug du préremplissage de la date de création

pull/816/head
Johan Girod 2020-01-08 16:53:09 +01:00
parent 5dc9f07db4
commit cde3a95308
3 changed files with 28 additions and 3 deletions

View File

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

View File

@ -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<RootState>(
mainReducer as any,
existingCompanyReducer as any,
storageRootReducer as any
) as Reducer<RootState>

View File

@ -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() {
<SubSection dottedName="situation personnelle . IJSS" />
<SubSection dottedName="dirigeant . indépendant . conjoint collaborateur" />
<SubSection dottedName="dirigeant . indépendant . cotisations et contributions . exonérations" />
<h3>Exonérations</h3>
<SimpleField dottedName="entreprise . ACRE" />
<SimpleField dottedName="établissement . ZFU" />
<SubSection
dottedName="dirigeant . indépendant . cotisations et contributions . exonérations"
sectionTitle={false}
/>
<h3>International</h3>
<SimpleField dottedName="situation personnelle . domiciliation fiscale à l'étranger" />
<SubSection
@ -139,6 +144,10 @@ function SimpleField({ dottedName, question }: SimpleFieldProps) {
})
setCurrentValue(value)
}
useEffect(() => {
setCurrentValue(value)
}, [value])
if (!analysis.isApplicable) {
return null
}