mirror of
https://github.com/betagouv/mon-entreprise
synced 2025-02-11 01:35:00 +00:00
feat(lodeom): suppression de la répartition pour la zone 2
This commit is contained in:
parent
d443cc8d59
commit
6a9c920072
7 changed files with 59 additions and 12 deletions
|
@ -96,6 +96,15 @@ describe('Simulateur lodeom', { testIsolation: false }, function () {
|
|||
).should('include.text', '644 €')
|
||||
})
|
||||
|
||||
it('should not include repartition for zone 2', function () {
|
||||
cy.get(
|
||||
'p[id="salarié___cotisations___exonérations___lodeom___montant___imputation_retraite_complémentaire-value"]'
|
||||
).should('not.exist')
|
||||
cy.get(
|
||||
'p[id="salarié___cotisations___exonérations___lodeom___montant___imputation_sécurité_sociale-value"]'
|
||||
).should('not.exist')
|
||||
})
|
||||
|
||||
it('should display a custom warning for a remuneration too high', function () {
|
||||
cy.get(inputSelector).first().type('{selectall}8500')
|
||||
|
||||
|
|
|
@ -25,9 +25,10 @@ type Props = {
|
|||
warningCondition?: PublicodesExpression
|
||||
warningTooltip?: ReactNode
|
||||
alignment?: 'center' | 'end'
|
||||
withRépartition?: boolean
|
||||
}
|
||||
|
||||
export default function MontantAvecRépartition({
|
||||
export default function Montant({
|
||||
id,
|
||||
dottedName,
|
||||
rémunérationBrute,
|
||||
|
@ -38,15 +39,31 @@ export default function MontantAvecRépartition({
|
|||
warningCondition,
|
||||
warningTooltip,
|
||||
alignment = 'end',
|
||||
withRépartition = true,
|
||||
}: Props) {
|
||||
const { t } = useTranslation()
|
||||
|
||||
const tooltip = (
|
||||
const tooltip = withRépartition && (
|
||||
<Répartition dottedName={dottedName} répartition={répartition} />
|
||||
)
|
||||
|
||||
return réduction ? (
|
||||
<StyledTooltip tooltip={tooltip}>
|
||||
tooltip ? (
|
||||
<StyledTooltip tooltip={tooltip}>
|
||||
<FlexDiv id={id} $alignment={alignment}>
|
||||
{formatValue(
|
||||
{
|
||||
nodeValue: réduction,
|
||||
},
|
||||
{
|
||||
displayedUnit,
|
||||
language,
|
||||
}
|
||||
)}
|
||||
<StyledSearchIcon />
|
||||
</FlexDiv>
|
||||
</StyledTooltip>
|
||||
) : (
|
||||
<FlexDiv id={id} $alignment={alignment}>
|
||||
{formatValue(
|
||||
{
|
||||
|
@ -57,9 +74,8 @@ export default function MontantAvecRépartition({
|
|||
language,
|
||||
}
|
||||
)}
|
||||
<StyledSearchIcon />
|
||||
</FlexDiv>
|
||||
</StyledTooltip>
|
||||
)
|
||||
) : (
|
||||
!!warningCondition && !!warningTooltip && (
|
||||
<FlexDiv id={id} $alignment={alignment}>
|
|
@ -2,7 +2,7 @@ import { sumAll } from 'effect/Number'
|
|||
import { useTranslation } from 'react-i18next'
|
||||
import { styled } from 'styled-components'
|
||||
|
||||
import MontantAvecRépartition from '@/components/RéductionDeCotisations/MontantAvecRépartition'
|
||||
import Montant from '@/components/RéductionDeCotisations/Montant'
|
||||
import { Grid } from '@/design-system/layout'
|
||||
import { Body } from '@/design-system/typography/paragraphs'
|
||||
import { MonthState, RéductionDottedName } from '@/utils/réductionDeCotisations'
|
||||
|
@ -13,6 +13,7 @@ type Props = {
|
|||
data: MonthState[]
|
||||
codeRéduction?: string
|
||||
codeRégularisation?: string
|
||||
withRépartition?: boolean
|
||||
mobileVersion?: boolean
|
||||
}
|
||||
|
||||
|
@ -27,6 +28,7 @@ export default function RécapitulatifTrimestre({
|
|||
data,
|
||||
codeRéduction,
|
||||
codeRégularisation,
|
||||
withRépartition = true,
|
||||
mobileVersion = false,
|
||||
}: Props) {
|
||||
const { t, i18n } = useTranslation()
|
||||
|
@ -73,7 +75,7 @@ export default function RécapitulatifTrimestre({
|
|||
|
||||
const MontantRéduction = () => {
|
||||
return (
|
||||
<MontantAvecRépartition
|
||||
<Montant
|
||||
id={`recap-${label.replace(/\s|\./g, '_')}-réduction`}
|
||||
dottedName={dottedName}
|
||||
rémunérationBrute={rémunération}
|
||||
|
@ -82,13 +84,14 @@ export default function RécapitulatifTrimestre({
|
|||
displayedUnit={displayedUnit}
|
||||
language={language}
|
||||
alignment="center"
|
||||
withRépartition={withRépartition}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
const MontantRégularisation = () => {
|
||||
return (
|
||||
<MontantAvecRépartition
|
||||
<Montant
|
||||
id={`recap-${label.replace(/\s|\./g, '_')}-régularisation`}
|
||||
dottedName={dottedName}
|
||||
rémunérationBrute={rémunération}
|
||||
|
@ -97,6 +100,7 @@ export default function RécapitulatifTrimestre({
|
|||
displayedUnit={displayedUnit}
|
||||
language={language}
|
||||
alignment="center"
|
||||
withRépartition={withRépartition}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ type Props = {
|
|||
warnings: ReactNode
|
||||
warningCondition: PublicodesExpression
|
||||
warningMessage: ReactNode
|
||||
withRépartition?: boolean
|
||||
}
|
||||
|
||||
export default function RéductionBasique({
|
||||
|
@ -32,6 +33,7 @@ export default function RéductionBasique({
|
|||
warnings,
|
||||
warningCondition,
|
||||
warningMessage,
|
||||
withRépartition = true,
|
||||
}: Props) {
|
||||
const engine = useEngine()
|
||||
const currentUnit = useSelector(targetUnitSelector)
|
||||
|
@ -63,7 +65,9 @@ export default function RéductionBasique({
|
|||
round={false}
|
||||
/>
|
||||
<Spacing md />
|
||||
<Répartition dottedName={dottedName} répartition={répartition} />
|
||||
{withRépartition && (
|
||||
<Répartition dottedName={dottedName} répartition={répartition} />
|
||||
)}
|
||||
</Condition>
|
||||
</>
|
||||
)
|
||||
|
|
|
@ -4,7 +4,7 @@ import { useTranslation } from 'react-i18next'
|
|||
import { styled } from 'styled-components'
|
||||
|
||||
import NumberInput from '@/components/conversation/NumberInput'
|
||||
import MontantAvecRépartition from '@/components/RéductionDeCotisations/MontantAvecRépartition'
|
||||
import Montant from '@/components/RéductionDeCotisations/Montant'
|
||||
import MonthOptions from '@/components/RéductionDeCotisations/MonthOptions'
|
||||
import RuleLink from '@/components/RuleLink'
|
||||
import { useEngine } from '@/components/utils/EngineContext'
|
||||
|
@ -31,6 +31,7 @@ type Props = {
|
|||
onOptionsChange: (monthIndex: number, options: Options) => void
|
||||
warningCondition: PublicodesExpression
|
||||
warningTooltip: ReactNode
|
||||
withRépartition?: boolean
|
||||
mobileVersion?: boolean
|
||||
}
|
||||
|
||||
|
@ -43,6 +44,7 @@ export default function RéductionMois({
|
|||
onOptionsChange,
|
||||
warningCondition,
|
||||
warningTooltip,
|
||||
withRépartition = true,
|
||||
mobileVersion = false,
|
||||
}: Props) {
|
||||
const { t, i18n } = useTranslation()
|
||||
|
@ -113,7 +115,7 @@ export default function RéductionMois({
|
|||
|
||||
const MontantRéduction = () => {
|
||||
return (
|
||||
<MontantAvecRépartition
|
||||
<Montant
|
||||
id={`${dottedName.replace(/\s|\./g, '_')}-${monthName}`}
|
||||
dottedName={dottedName}
|
||||
rémunérationBrute={data.rémunérationBrute}
|
||||
|
@ -123,13 +125,14 @@ export default function RéductionMois({
|
|||
language={language}
|
||||
warningCondition={warningCondition}
|
||||
warningTooltip={warningTooltip}
|
||||
withRépartition={withRépartition}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
const MontantRégularisation = () => {
|
||||
return (
|
||||
<MontantAvecRépartition
|
||||
<Montant
|
||||
id={`${dottedName.replace(/\s|\./g, '_')}__régularisation-${monthName}`}
|
||||
dottedName={dottedName}
|
||||
rémunérationBrute={data.rémunérationBrute}
|
||||
|
@ -137,6 +140,7 @@ export default function RéductionMois({
|
|||
répartition={data.régularisation.répartition}
|
||||
displayedUnit={displayedUnit}
|
||||
language={language}
|
||||
withRépartition={withRépartition}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ type Props = {
|
|||
warningTooltip: ReactNode
|
||||
codeRéduction?: string
|
||||
codeRégularisation?: string
|
||||
withRépartition?: boolean
|
||||
}
|
||||
|
||||
export default function RéductionMoisParMois({
|
||||
|
@ -42,6 +43,7 @@ export default function RéductionMoisParMois({
|
|||
warningTooltip,
|
||||
codeRéduction,
|
||||
codeRégularisation,
|
||||
withRépartition = true,
|
||||
}: Props) {
|
||||
const { t } = useTranslation()
|
||||
const isDesktop = useMediaQuery(
|
||||
|
@ -118,6 +120,7 @@ export default function RéductionMoisParMois({
|
|||
}}
|
||||
warningCondition={warningCondition}
|
||||
warningTooltip={warningTooltip}
|
||||
withRépartition={withRépartition}
|
||||
/>
|
||||
))}
|
||||
</tbody>
|
||||
|
@ -176,6 +179,7 @@ export default function RéductionMoisParMois({
|
|||
data={quarters[label]}
|
||||
codeRéduction={codeRéduction}
|
||||
codeRégularisation={codeRégularisation}
|
||||
withRépartition={withRépartition}
|
||||
/>
|
||||
))}
|
||||
</tbody>
|
||||
|
@ -203,6 +207,7 @@ export default function RéductionMoisParMois({
|
|||
}}
|
||||
warningCondition={warningCondition}
|
||||
warningTooltip={warningTooltip}
|
||||
withRépartition={withRépartition}
|
||||
mobileVersion={true}
|
||||
/>
|
||||
))}
|
||||
|
@ -223,6 +228,7 @@ export default function RéductionMoisParMois({
|
|||
data={quarters[label]}
|
||||
codeRéduction={codeRéduction}
|
||||
codeRégularisation={codeRégularisation}
|
||||
withRépartition={withRépartition}
|
||||
mobileVersion={true}
|
||||
/>
|
||||
))}
|
||||
|
|
|
@ -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 { useZoneLodeom } from '@/hooks/useZoneLodeom'
|
||||
import { situationSelector } from '@/store/selectors/simulationSelectors'
|
||||
import {
|
||||
getDataAfterOptionsChange,
|
||||
|
@ -40,6 +41,7 @@ export default function LodeomSimulationGoals({
|
|||
const year = useYear()
|
||||
const situation = useSelector(situationSelector) as SituationType
|
||||
const previousSituation = useRef(situation)
|
||||
const currentZone = useZoneLodeom()
|
||||
const { t } = useTranslation()
|
||||
|
||||
const codeRéduction = engine.evaluate(
|
||||
|
@ -133,6 +135,7 @@ export default function LodeomSimulationGoals({
|
|||
code: codeRégularisation,
|
||||
})
|
||||
}
|
||||
withRépartition={currentZone === 'zone un'}
|
||||
/>
|
||||
) : (
|
||||
<RéductionBasique
|
||||
|
@ -141,6 +144,7 @@ export default function LodeomSimulationGoals({
|
|||
warnings={<Warnings />}
|
||||
warningCondition={`${lodeomDottedName} = 0`}
|
||||
warningMessage={<WarningSalaireTrans />}
|
||||
withRépartition={currentZone === 'zone un'}
|
||||
/>
|
||||
)}
|
||||
</SimulationGoals>
|
||||
|
|
Loading…
Add table
Reference in a new issue