diff --git a/site/cypress/integration/mon-entreprise/lodeom.ts b/site/cypress/integration/mon-entreprise/lodeom.ts index 7d29f7901e..24953229cc 100755 --- a/site/cypress/integration/mon-entreprise/lodeom.ts +++ b/site/cypress/integration/mon-entreprise/lodeom.ts @@ -258,6 +258,27 @@ describe('Simulateur lodeom', { testIsolation: false }, function () { ) }) + it('should display code in recap table based on scale', function () { + cy.contains('Récapitulatif trimestriel').next().as('recapTable') + + cy.get('@recapTable').should('include.text', 'code 462') + cy.get('@recapTable').should('include.text', 'code 684') + + cy.get('div[aria-label="Barème à appliquer"]') + .contains('Barème de compétitivité renforcée') + .click() + + cy.get('@recapTable').should('include.text', 'code 463') + cy.get('@recapTable').should('include.text', 'code 538') + + cy.get('div[aria-label="Barème à appliquer"]') + .contains("Barème d'innovation et croissance") + .click() + + cy.get('@recapTable').should('include.text', 'code 473') + cy.get('@recapTable').should('include.text', 'code 685') + }) + it('should be RGAA compliant', function () { cy.contains('Exonération mensuelle').click() checkA11Y() diff --git a/site/source/hooks/useBaremeLodeom.ts b/site/source/hooks/useBaremeLodeom.ts index 57dfc1e8f4..d3c3a764fe 100644 --- a/site/source/hooks/useBaremeLodeom.ts +++ b/site/source/hooks/useBaremeLodeom.ts @@ -9,9 +9,16 @@ const barèmesPossibles = [ 'barème compétitivité renforcée', 'barème innovation et croissance', ] -type Barème = (typeof barèmesPossibles)[number] -export const useBaremeLodeom = () => { +export type Barème = (typeof barèmesPossibles)[number] + +type ReturnType = { + barèmesPossibles: Barème[] + currentBarème?: Barème + updateBarème: (barème: Barème) => void +} + +export const useBaremeLodeom = (): ReturnType => { const dottedName = 'salarié . cotisations . exonérations . lodeom . zone un' const engine = useEngine() const dispatch = useDispatch() diff --git a/site/source/pages/simulateurs/lodeom/Goals.tsx b/site/source/pages/simulateurs/lodeom/Goals.tsx index 779f67cf95..d8f7c9d1d2 100644 --- a/site/source/pages/simulateurs/lodeom/Goals.tsx +++ b/site/source/pages/simulateurs/lodeom/Goals.tsx @@ -7,6 +7,7 @@ import RéductionMoisParMois from '@/components/RéductionDeCotisations/Réducti import { SimulationGoals } from '@/components/Simulation' import { useEngine } from '@/components/utils/EngineContext' import useYear from '@/components/utils/useYear' +import { Barème, useBaremeLodeom } from '@/hooks/useBaremeLodeom' import { situationSelector } from '@/store/selectors/simulationSelectors' import { getDataAfterOptionsChange, @@ -40,6 +41,7 @@ export default function LodeomSimulationGoals({ const year = useYear() const situation = useSelector(situationSelector) as SituationType const previousSituation = useRef(situation) + const { currentBarème } = useBaremeLodeom() const { t } = useTranslation() const initializeLodeomMoisParMoisData = useCallback(() => { @@ -99,6 +101,21 @@ export default function LodeomSimulationGoals({ }) } + const codesByBareme = { + ['barème compétitivité' as Barème]: { + réduction: t('pages.simulateurs.lodeom.recap.code.462', 'code 462'), + régularisation: t('pages.simulateurs.lodeom.recap.code.684', 'code 684'), + }, + ['barème compétitivité renforcée' as Barème]: { + réduction: t('pages.simulateurs.lodeom.recap.code.462', 'code 463'), + régularisation: t('pages.simulateurs.lodeom.recap.code.684', 'code 538'), + }, + ['barème innovation et croissance' as Barème]: { + réduction: t('pages.simulateurs.lodeom.recap.code.462', 'code 473'), + régularisation: t('pages.simulateurs.lodeom.recap.code.684', 'code 685'), + }, + } + return ( {monthByMonth ? ( @@ -114,14 +131,12 @@ export default function LodeomSimulationGoals({ warnings={} warningCondition={`${lodeomDottedName} = 0`} warningTooltip={} - codeRéduction={t( - 'pages.simulateurs.lodeom.recap.code.462', - 'code 462(€)' - )} - codeRégularisation={t( - 'pages.simulateurs.lodeom.recap.code.684', - 'code 684(€)' - )} + codeRéduction={ + currentBarème && codesByBareme[currentBarème].réduction + } + codeRégularisation={ + currentBarème && codesByBareme[currentBarème].régularisation + } /> ) : (