🐛 Répare le montant de l'impôt à 0€
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 #1708pull/1714/head
parent
abacd73382
commit
2a3be412b8
|
@ -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 (
|
||||
<div className="payslip__salarySection">
|
||||
<h4 className="payslip__salaryTitle">
|
||||
|
@ -56,8 +57,13 @@ export const SalaireNetSection = () => {
|
|||
rule="contrat salarié . rémunération . net"
|
||||
className="payslip__total"
|
||||
/>
|
||||
<Condition expression="impôt > 0">
|
||||
<Line negative rule="impôt" unit="€/mois" />
|
||||
<Condition expression="impôt . montant > 0">
|
||||
<Line
|
||||
negative
|
||||
rule="impôt . montant"
|
||||
title={t('impôt sur le revenu')}
|
||||
unit="€/mois"
|
||||
/>
|
||||
<Line
|
||||
className="payslip__total"
|
||||
rule="contrat salarié . rémunération . net après impôt"
|
||||
|
@ -69,6 +75,7 @@ export const SalaireNetSection = () => {
|
|||
|
||||
type LineProps = {
|
||||
rule: DottedName
|
||||
title?: string
|
||||
negative?: boolean
|
||||
} & Omit<ValueProps<DottedName>, 'expression'>
|
||||
|
||||
|
@ -76,6 +83,7 @@ export function Line({
|
|||
rule,
|
||||
displayedUnit = '€',
|
||||
negative = false,
|
||||
title,
|
||||
className,
|
||||
...props
|
||||
}: LineProps) {
|
||||
|
@ -92,7 +100,9 @@ export function Line({
|
|||
|
||||
return (
|
||||
<Condition expression={`${rule} > 0`}>
|
||||
<RuleLink dottedName={rule} className={className} />
|
||||
<RuleLink dottedName={rule} className={className}>
|
||||
{title}
|
||||
</RuleLink>
|
||||
<Value
|
||||
linkToRule={false}
|
||||
expression={(negative ? '- ' : '') + rule}
|
||||
|
|
|
@ -46,7 +46,8 @@ export default function IndépendantExplanation() {
|
|||
color: palettes[0][0],
|
||||
},
|
||||
{
|
||||
dottedName: 'impôt',
|
||||
dottedName: 'impôt . montant',
|
||||
title: t('impôt sur le revenu'),
|
||||
color: palettes[1][0],
|
||||
},
|
||||
{
|
||||
|
@ -96,17 +97,17 @@ const CotisationsSection: Partial<Record<DottedName, Array<string>>> = {
|
|||
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)
|
||||
|
||||
|
|
|
@ -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],
|
||||
},
|
||||
|
|
|
@ -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],
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue