From 2a3be412b8e6bdcf2a34672da6b12902187e8a2c Mon Sep 17 00:00:00 2001 From: Johan Girod Date: Mon, 13 Sep 2021 13:36:16 +0200 Subject: [PATCH] =?UTF-8?q?:bug:=20R=C3=A9pare=20le=20montant=20de=20l'imp?= =?UTF-8?q?=C3=B4t=20=C3=A0=200=E2=82=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit La règle a changé de nom. Par ailleurs, il a fallu ajouter la possibiliter de spécifier un nom différent que celui de la règle pour l'affichage d'une ligne dans la fiche de paie (sinon on aurait eu affiché "montant de l'impot sur le revenu") fix #1708 --- .../source/components/PaySlipSections.tsx | 18 ++++++++++--- .../IndépendantExplanation.tsx | 25 ++++++++++--------- .../SalaryExplanation.tsx | 2 +- .../pages/Simulateurs/AutoEntrepreneur.tsx | 2 +- 4 files changed, 29 insertions(+), 18 deletions(-) diff --git a/mon-entreprise/source/components/PaySlipSections.tsx b/mon-entreprise/source/components/PaySlipSections.tsx index 0b15baccd..7f5870db7 100644 --- a/mon-entreprise/source/components/PaySlipSections.tsx +++ b/mon-entreprise/source/components/PaySlipSections.tsx @@ -2,7 +2,7 @@ import Value, { Condition, ValueProps } from 'Components/EngineValue' import RuleLink from 'Components/RuleLink' import { DottedName } from 'modele-social' import { isNotApplicable, isNotYetDefined } from 'publicodes' -import { Trans } from 'react-i18next' +import { Trans, useTranslation } from 'react-i18next' import { useEngine } from './utils/EngineContext' export const SalaireBrutSection = () => { @@ -28,6 +28,7 @@ export const SalaireBrutSection = () => { } export const SalaireNetSection = () => { + const { t } = useTranslation() return (

@@ -56,8 +57,13 @@ export const SalaireNetSection = () => { rule="contrat salarié . rémunération . net" className="payslip__total" /> - - + + { type LineProps = { rule: DottedName + title?: string negative?: boolean } & Omit, 'expression'> @@ -76,6 +83,7 @@ export function Line({ rule, displayedUnit = '€', negative = false, + title, className, ...props }: LineProps) { @@ -92,7 +100,9 @@ export function Line({ return ( 0`}> - + + {title} + >> = { function Distribution() { const targetUnit = useSelector(targetUnitSelector) const engine = useEngine() - const distribution = ( - Object.entries(CotisationsSection).map(([section, cotisations]) => [ - section, - cotisations - .map((c) => engine.evaluate({ valeur: c, unité: targetUnit })) - .reduce( - (acc, evaluation) => acc + ((evaluation?.nodeValue as number) || 0), - 0 - ), - ]) as Array<[DottedName, number]> - ) + const distribution = (Object.entries( + CotisationsSection + ).map(([section, cotisations]) => [ + section, + cotisations + .map((c) => engine.evaluate({ valeur: c, unité: targetUnit })) + .reduce( + (acc, evaluation) => acc + ((evaluation?.nodeValue as number) || 0), + 0 + ), + ]) as Array<[DottedName, number]>) .filter(([, value]) => value > 0) .sort(([, a], [, b]) => b - a) diff --git a/mon-entreprise/source/components/simulationExplanation/SalaryExplanation.tsx b/mon-entreprise/source/components/simulationExplanation/SalaryExplanation.tsx index 35e25399d..40c360bbf 100644 --- a/mon-entreprise/source/components/simulationExplanation/SalaryExplanation.tsx +++ b/mon-entreprise/source/components/simulationExplanation/SalaryExplanation.tsx @@ -96,7 +96,7 @@ function RevenueRepartitionSection(props: { onSeePayslip: () => void }) { color: palettes[0][0], }, { - dottedName: 'impôt', + dottedName: 'impôt . montant', title: t('impôt'), color: palettes[1][0], }, diff --git a/mon-entreprise/source/pages/Simulateurs/AutoEntrepreneur.tsx b/mon-entreprise/source/pages/Simulateurs/AutoEntrepreneur.tsx index 916969bf3..a9b810d76 100644 --- a/mon-entreprise/source/pages/Simulateurs/AutoEntrepreneur.tsx +++ b/mon-entreprise/source/pages/Simulateurs/AutoEntrepreneur.tsx @@ -52,7 +52,7 @@ function Explanation() { color: palettes[0][0], }, { - dottedName: 'impôt', + dottedName: 'impôt . montant', title: t('impôt'), color: palettes[1][0], },