Skip to content

Commit

Permalink
feat(lodeom): ajout de codes adaptés au barème
Browse files Browse the repository at this point in the history
  • Loading branch information
liliced committed Dec 23, 2024
1 parent 41aadc3 commit 061f0c4
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 14 deletions.
21 changes: 21 additions & 0 deletions site/cypress/integration/mon-entreprise/lodeom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,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()
Expand Down
11 changes: 9 additions & 2 deletions site/source/hooks/useBaremeLodeom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
8 changes: 6 additions & 2 deletions site/source/locales/ui-en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1457,8 +1457,12 @@ pages:
caption: "Lodeom exemption month by month :"
recap:
code:
"462": code 462(€)
"684": code 684(€)
"462": code 462
"463": code 463
"473": code 473
"538": code 538
"684": code 684
"685": code 685
shortname: Lodeom exemption
tab:
month: Monthly exemption
Expand Down
8 changes: 6 additions & 2 deletions site/source/locales/ui-fr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1550,8 +1550,12 @@ pages:
caption: "Exonération Lodeom mois par mois :"
recap:
code:
"462": code 462(€)
"684": code 684(€)
"462": code 462
"463": code 463
"473": code 473
"538": code 538
"684": code 684
"685": code 685
shortname: Éxonération Lodeom
tab:
month: Exonération mensuelle
Expand Down
31 changes: 23 additions & 8 deletions site/source/pages/simulateurs/lodeom/Goals.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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(() => {
Expand Down Expand Up @@ -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.463', 'code 463'),
régularisation: t('pages.simulateurs.lodeom.recap.code.538', 'code 538'),
},
['barème innovation et croissance' as Barème]: {
réduction: t('pages.simulateurs.lodeom.recap.code.473', 'code 473'),
régularisation: t('pages.simulateurs.lodeom.recap.code.685', 'code 685'),
},
}

return (
<SimulationGoals toggles={toggles} legend={legend}>
{monthByMonth ? (
Expand All @@ -114,14 +131,12 @@ export default function LodeomSimulationGoals({
warnings={<Warnings />}
warningCondition={`${lodeomDottedName} = 0`}
warningTooltip={<WarningSalaireTrans />}
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
}
/>
) : (
<RéductionBasique
Expand Down

0 comments on commit 061f0c4

Please sign in to comment.