From 2af35748d2b7f99c9c78112c704f8ba377a9ca6a Mon Sep 17 00:00:00 2001 From: Alice Dahan Date: Tue, 20 Aug 2024 17:08:17 +0200 Subject: [PATCH] =?UTF-8?q?refactor(salari=C3=A9):=20Distingue=20la=20r?= =?UTF-8?q?=C3=A9partition=20des=20cotisations=20des=20cat=C3=A9gories=20d?= =?UTF-8?q?e=20la=20fiche=20de=20paie?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SalaryExplanation.tsx | 50 ++++++++++++++++--- 1 file changed, 43 insertions(+), 7 deletions(-) diff --git a/site/source/components/simulationExplanation/SalaryExplanation.tsx b/site/source/components/simulationExplanation/SalaryExplanation.tsx index 2dee29cac..8dd5b2ce2 100644 --- a/site/source/components/simulationExplanation/SalaryExplanation.tsx +++ b/site/source/components/simulationExplanation/SalaryExplanation.tsx @@ -1,3 +1,4 @@ +import { DottedName } from 'modele-social' import { useRef } from 'react' import { Trans, useTranslation } from 'react-i18next' import { useTheme } from 'styled-components' @@ -5,7 +6,7 @@ import { useTheme } from 'styled-components' import { ÀQuoiServentMesCotisationsSection } from '@/components/simulationExplanation/ÀQuoiServentMesCotisationsSection' import StackedBarChart from '@/components/StackedBarChart' import { FromTop } from '@/components/ui/animate' -import { useEngine, useInversionFail } from '@/components/utils/EngineContext' +import { useInversionFail } from '@/components/utils/EngineContext' import { Emoji } from '@/design-system/emoji' import { Container, Grid, Spacing } from '@/design-system/layout' import { H2 } from '@/design-system/typography/heading' @@ -13,16 +14,11 @@ import { Link } from '@/design-system/typography/link' import { SmallBody } from '@/design-system/typography/paragraphs' import { useCurrentSimulatorData } from '@/hooks/useCurrentSimulatorData' -import { getCotisationsBySection } from '../FicheDePaie/Cotisations' import FicheDePaie from '../FicheDePaie/FicheDePaie' export default function SalaryExplanation() { const payslipRef = useRef(null) - const regroupement = Object.fromEntries( - getCotisationsBySection(useEngine().getParsedRules()) - ) - if (useInversionFail()) { return null } @@ -39,7 +35,7 @@ export default function SalaryExplanation() { /> - <ÀQuoiServentMesCotisationsSection regroupement={regroupement} /> + <ÀQuoiServentMesCotisationsSection regroupement={CotisationsSection} /> @@ -160,3 +156,43 @@ function RevenueRepartitionSection(props: { onSeePayslip: () => void }) { ) } + +const CotisationsSection: Partial>> = { + 'protection sociale . maladie': [ + 'salarié . cotisations . maladie', + 'salarié . cotisations . prévoyances', + 'salarié . cotisations . prévoyances . santé', + 'salarié . cotisations . ATMP', + ], + 'protection sociale . retraite': [ + 'salarié . cotisations . vieillesse', + 'salarié . cotisations . retraite complémentaire', + 'salarié . cotisations . CEG', + 'salarié . cotisations . CET', + // 'salarié . cotisations . retraite supplémentaire', + ], + 'protection sociale . famille': [ + 'salarié . cotisations . allocations familiales', + ], + 'protection sociale . assurance chômage': [ + 'salarié . cotisations . AGS', + 'salarié . cotisations . chômage', + ], + 'protection sociale . formation': [ + "salarié . cotisations . taxe d'apprentissage", + 'salarié . cotisations . formation professionnelle', + 'salarié . cotisations . CPF CDD', + ], + 'protection sociale . transport': [ + 'salarié . cotisations . versement mobilité', + ], + 'protection sociale . autres': [ + 'salarié . cotisations . CSG-CRDS', + 'salarié . cotisations . APEC', + 'salarié . cotisations . FNAL', + 'salarié . cotisations . CSA', + 'salarié . cotisations . forfait social', + 'salarié . cotisations . PEEC', + 'salarié . cotisations . contribution au dialogue social', + ], +}