fix(salarié): Supprime une ligne en doublon dans la fiche de paie

pull/3059/head
Alice Dahan 2024-07-25 07:57:42 +02:00 committed by liliced
parent ca9b091bee
commit 2fb4a20fd9
2 changed files with 9 additions and 17 deletions

View File

@ -3,7 +3,6 @@ import { ASTNode, ParsedRules, reduceAST, Rule, RuleNode } from 'publicodes'
import { Fragment } from 'react'
import { Trans } from 'react-i18next'
import RuleLink from '@/components/RuleLink'
import { useEngine } from '@/components/utils/EngineContext'
import { Strong } from '@/design-system/typography'
import { H4, H5 } from '@/design-system/typography/heading'
@ -145,20 +144,6 @@ export default function PaySlip() {
</Fragment>
)
})}
{/* Réductions */}
<RuleLink dottedName={'salarié . cotisations . exonérations'} />
<Value
expression="- salarié . cotisations . exonérations . employeur"
unit="€/mois"
displayedUnit="€"
/>
<Value
expression="- salarié . cotisations . exonérations . salarié"
unit="€/mois"
displayedUnit="€"
/>
{/* Total cotisation */}
<Body className="payslip__total">
<Strong>

View File

@ -21,6 +21,7 @@ export default function Cotisation({ dottedName }: { dottedName: DottedName }) {
engine.getRule('salarié . cotisations . employeur')
) ?? '0'
)
const signePlusOuMoins = isExoneration(dottedName) ? '-' : ''
if (!partPatronale.nodeValue && !partSalariale.nodeValue) {
return null
@ -31,18 +32,24 @@ export default function Cotisation({ dottedName }: { dottedName: DottedName }) {
<RuleLink dottedName={dottedName} />
<span>
{partPatronale?.nodeValue
? formatValue(partPatronale, { displayedUnit: '€', language })
? signePlusOuMoins +
formatValue(partPatronale, { displayedUnit: '€', language })
: ''}
</span>
<span>
{partSalariale?.nodeValue
? formatValue(partSalariale, { displayedUnit: '€', language })
? signePlusOuMoins +
formatValue(partSalariale, { displayedUnit: '€', language })
: ''}
</span>
</>
)
}
function isExoneration(dottedName: DottedName): boolean {
return dottedName === 'salarié . cotisations . exonérations'
}
function findReferenceInNode(
dottedName: DottedName,
node: ASTNode