mirror of
https://github.com/betagouv/mon-entreprise
synced 2025-03-12 17:25:04 +00:00
feat(pam): stylise le résultat statut
This commit is contained in:
parent
89886ea537
commit
993a080b9e
6 changed files with 138 additions and 60 deletions
|
@ -946,13 +946,16 @@ pages:
|
|||
title: PAMC tax return
|
||||
resultats:
|
||||
"1": Amounts to report on your tax return
|
||||
"2": Replacement income
|
||||
"3": Deductions and exemptions
|
||||
"4": Compulsory social security contributions
|
||||
"5": Breakdown of net income
|
||||
"6": "Net income from contract activity :"
|
||||
"7": "Net income from other self-employed activities :"
|
||||
"8": Data provided by Assurance Maladie
|
||||
"10": "Net income from other self-employed activities :"
|
||||
"11": Data provided by Assurance Maladie
|
||||
"2": Situation on January 1 or on the date of commencement of activity
|
||||
"3": You are a holder
|
||||
"4": You are a replacement
|
||||
"5": Replacement income
|
||||
"6": Deductions and exemptions
|
||||
"7": Compulsory social security contributions
|
||||
"8": Breakdown of net income
|
||||
"9": "Net income from contract activity :"
|
||||
shortname: PAMC tax return assistant
|
||||
title: PAMC tax return assistant
|
||||
pour-mon-entreprise:
|
||||
|
|
|
@ -1005,13 +1005,16 @@ pages:
|
|||
title: Déclaration de revenus des PAMC
|
||||
resultats:
|
||||
"1": Montants à reporter dans votre déclaration de revenus
|
||||
"2": Montant des revenus de remplacement
|
||||
"3": Déductions et exonérations
|
||||
"4": Cotisations sociales obligatoires
|
||||
"5": Répartition des revenus nets
|
||||
"6": "Revenus nets de l’activité conventionnée :"
|
||||
"7": "Revenus nets tirés des autres activités non salariées :"
|
||||
"8": Données transmises par l’Assurance Maladie
|
||||
"10": "Revenus nets tirés des autres activités non salariées :"
|
||||
"11": Données transmises par l’Assurance Maladie
|
||||
"2": Situation au 1er janvier ou à la date du début d’activité
|
||||
"3": Vous êtes titulaire
|
||||
"4": Vous êtes remplaçant
|
||||
"5": Montant des revenus de remplacement
|
||||
"6": Déductions et exonérations
|
||||
"7": Cotisations sociales obligatoires
|
||||
"8": Répartition des revenus nets
|
||||
"9": "Revenus nets de l’activité conventionnée :"
|
||||
shortname: Assistant à la déclaration de revenus des PAMC
|
||||
title: Assistant à la déclaration de revenus pour les PAMC
|
||||
pour-mon-entreprise:
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
import { PublicodesExpression } from 'publicodes'
|
||||
import { styled } from 'styled-components'
|
||||
|
||||
import { useEngine } from '@/components/utils/EngineContext'
|
||||
|
||||
type Props = {
|
||||
expression: PublicodesExpression
|
||||
idPrefix: string
|
||||
}
|
||||
|
||||
export default function CheckboxImpôts({ expression, idPrefix }: Props) {
|
||||
const engine = useEngine()
|
||||
const nodeValue = engine.evaluate({
|
||||
'!=': [expression, 'non'],
|
||||
}).nodeValue
|
||||
const checked = !!nodeValue
|
||||
|
||||
return (
|
||||
<StyledInput
|
||||
id={`${idPrefix}-value`}
|
||||
type="checkbox"
|
||||
readOnly
|
||||
checked={checked}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
const StyledInput = styled.input`
|
||||
margin: ${({ theme }) => `${theme.spacings.xs} ${theme.spacings.sm} 0 0`};
|
||||
`
|
|
@ -1,7 +1,5 @@
|
|||
import { DottedName } from 'modele-social'
|
||||
import { formatValue } from 'publicodes'
|
||||
import React from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { PublicodesExpression } from 'publicodes'
|
||||
import { useSelector } from 'react-redux'
|
||||
import { styled } from 'styled-components'
|
||||
|
||||
|
@ -11,67 +9,60 @@ import { FlexCenter } from '@/design-system/global-style'
|
|||
import { Grid } from '@/design-system/layout'
|
||||
import { Strong } from '@/design-system/typography'
|
||||
import { Body } from '@/design-system/typography/paragraphs'
|
||||
import { Contexte } from '@/domaine/Contexte'
|
||||
import { targetUnitSelector } from '@/store/selectors/simulationSelectors'
|
||||
|
||||
import CheckboxImpôts from './CheckboxImpôts'
|
||||
import MontantImpôts from './MontantImpôts'
|
||||
|
||||
type SimulationValueProps = {
|
||||
dottedName: DottedName
|
||||
code: string
|
||||
label?: React.ReactNode
|
||||
round?: boolean
|
||||
contexte?: Contexte
|
||||
label?: string
|
||||
expression?: PublicodesExpression
|
||||
}
|
||||
|
||||
export function LigneImpôts({
|
||||
dottedName,
|
||||
code,
|
||||
label,
|
||||
round = true,
|
||||
contexte = {},
|
||||
expression,
|
||||
}: SimulationValueProps) {
|
||||
const engine = useEngine()
|
||||
const currentUnit = useSelector(targetUnitSelector)
|
||||
const language = useTranslation().i18n.language
|
||||
|
||||
const evaluation = engine.evaluate({
|
||||
valeur: dottedName,
|
||||
arrondi: round ? 'oui' : 'non',
|
||||
arrondi: 'oui',
|
||||
unité: currentUnit,
|
||||
contexte,
|
||||
})
|
||||
|
||||
const noValue =
|
||||
evaluation.nodeValue === null || evaluation.nodeValue === undefined
|
||||
|
||||
if (noValue) {
|
||||
return null
|
||||
}
|
||||
|
||||
const rule = engine.getRule(dottedName)
|
||||
const elementIdPrefix = dottedName.replace(/\s|\./g, '_')
|
||||
const idPrefix = ((expression || dottedName) as string).replace(/\s|\./g, '_')
|
||||
|
||||
return (
|
||||
<StyledGridContainer container spacing={2}>
|
||||
<Grid item md="auto" sm={8} xs={12}>
|
||||
<StyledBody id={`${elementIdPrefix}-label`}>
|
||||
{label || rule.title}
|
||||
</StyledBody>
|
||||
<StyledBody id={`${idPrefix}-label`}>{label || rule.title}</StyledBody>
|
||||
</Grid>
|
||||
|
||||
<LectureGuide />
|
||||
|
||||
<Grid item style={{ display: 'flex', alignItems: 'center' }}>
|
||||
<StyledGridItem item>
|
||||
<StyledBody>
|
||||
<Strong>{code}</Strong>
|
||||
</StyledBody>
|
||||
<StyledBody>
|
||||
<Value id={`${elementIdPrefix}-value`}>
|
||||
{formatValue(evaluation, {
|
||||
precision: round ? 0 : 2,
|
||||
language,
|
||||
displayedUnit: '',
|
||||
})}
|
||||
</Value>
|
||||
</StyledBody>
|
||||
</Grid>
|
||||
{expression ? (
|
||||
<CheckboxImpôts expression={expression} idPrefix={idPrefix} />
|
||||
) : (
|
||||
<MontantImpôts evaluation={evaluation} idPrefix={idPrefix} />
|
||||
)}
|
||||
</StyledGridItem>
|
||||
</StyledGridContainer>
|
||||
)
|
||||
}
|
||||
|
@ -86,16 +77,9 @@ const StyledGridContainer = styled(Grid)`
|
|||
align-items: center;
|
||||
}
|
||||
`
|
||||
const StyledBody = styled(Body)`
|
||||
margin: 0;
|
||||
padding: ${({ theme }) => `${theme.spacings.xs} ${theme.spacings.sm} 0 0`};
|
||||
`
|
||||
const Value = styled.div`
|
||||
width: 100px;
|
||||
min-height: ${({ theme }) => theme.spacings.xl};
|
||||
padding: ${({ theme }) => `${theme.spacings.xxs} ${theme.spacings.xs}`};
|
||||
background-color: ${({ theme }) => theme.colors.extended.grey[100]};
|
||||
border-radius: ${({ theme }) => theme.spacings.xxs};
|
||||
color: ${({ theme }) => theme.colors.extended.dark[800]};
|
||||
const StyledGridItem = styled(Grid)`
|
||||
${FlexCenter}
|
||||
`
|
||||
const StyledBody = styled(Body)`
|
||||
margin: ${({ theme }) => `${theme.spacings.xs} ${theme.spacings.sm} 0 0`};
|
||||
`
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
import { EvaluatedNode, formatValue } from 'publicodes'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { styled } from 'styled-components'
|
||||
|
||||
import { Body } from '@/design-system/typography/paragraphs'
|
||||
|
||||
type Props = {
|
||||
evaluation: EvaluatedNode
|
||||
idPrefix: string
|
||||
}
|
||||
|
||||
export default function MontantImpôts({ evaluation, idPrefix }: Props) {
|
||||
const language = useTranslation().i18n.language
|
||||
|
||||
return (
|
||||
<Value id={`${idPrefix}-value`}>
|
||||
{formatValue(evaluation, {
|
||||
language,
|
||||
displayedUnit: '',
|
||||
})}
|
||||
</Value>
|
||||
)
|
||||
}
|
||||
|
||||
const Value = styled(Body)`
|
||||
margin: ${({ theme }) => `${theme.spacings.xs} ${theme.spacings.sm} 0 0`};
|
||||
width: 100px;
|
||||
min-height: ${({ theme }) => theme.spacings.xl};
|
||||
padding: ${({ theme }) => `${theme.spacings.xxs} ${theme.spacings.xs}`};
|
||||
background-color: ${({ theme }) => theme.colors.extended.grey[100]};
|
||||
border-radius: ${({ theme }) => theme.spacings.xxs};
|
||||
color: ${({ theme }) => theme.colors.extended.dark[800]} !important;
|
||||
`
|
|
@ -28,6 +28,31 @@ export default function Résultats() {
|
|||
)}
|
||||
</H2>
|
||||
|
||||
<StyledBody>
|
||||
{t(
|
||||
'pages.assistants.declaration-revenus-pamc.resultats.2',
|
||||
'Situation au 1er janvier ou à la date du début d’activité'
|
||||
)}
|
||||
</StyledBody>
|
||||
<LigneImpôts
|
||||
dottedName="déclaration revenus PAMC . statut"
|
||||
code="DSAP"
|
||||
expression="déclaration revenus PAMC . statut = 'titulaire'"
|
||||
label={t(
|
||||
'pages.assistants.declaration-revenus-pamc.resultats.3',
|
||||
'Vous êtes titulaire'
|
||||
)}
|
||||
/>
|
||||
<LigneImpôts
|
||||
dottedName="déclaration revenus PAMC . statut"
|
||||
code="DSAQ"
|
||||
expression="déclaration revenus PAMC . statut = 'remplaçant'"
|
||||
label={t(
|
||||
'pages.assistants.declaration-revenus-pamc.resultats.4',
|
||||
'Vous êtes remplaçant'
|
||||
)}
|
||||
/>
|
||||
|
||||
<SimulationValue
|
||||
dottedName="déclaration revenus PAMC . statut"
|
||||
label="Situation au 1er janvier ou à la date du début d’activité"
|
||||
|
@ -42,7 +67,7 @@ export default function Résultats() {
|
|||
<Condition expression="déclaration revenus PAMC . revenus de remplacement . total">
|
||||
<H4 as="h3">
|
||||
{t(
|
||||
'pages.assistants.declaration-revenus-pamc.resultats.2',
|
||||
'pages.assistants.declaration-revenus-pamc.resultats.5',
|
||||
'Montant des revenus de remplacement'
|
||||
)}
|
||||
</H4>
|
||||
|
@ -56,7 +81,7 @@ export default function Résultats() {
|
|||
<Condition expression="déclaration revenus PAMC . déductions et exonérations . total déductible">
|
||||
<H4 as="h3">
|
||||
{t(
|
||||
'pages.assistants.declaration-revenus-pamc.resultats.3',
|
||||
'pages.assistants.declaration-revenus-pamc.resultats.6',
|
||||
'Déductions et exonérations'
|
||||
)}
|
||||
</H4>
|
||||
|
@ -74,7 +99,7 @@ export default function Résultats() {
|
|||
|
||||
<H4 as="h3">
|
||||
{t(
|
||||
'pages.assistants.declaration-revenus-pamc.resultats.4',
|
||||
'pages.assistants.declaration-revenus-pamc.resultats.7',
|
||||
'Cotisations sociales obligatoires'
|
||||
)}
|
||||
</H4>
|
||||
|
@ -86,13 +111,13 @@ export default function Résultats() {
|
|||
|
||||
<H4 as="h3">
|
||||
{t(
|
||||
'pages.assistants.declaration-revenus-pamc.resultats.5',
|
||||
'pages.assistants.declaration-revenus-pamc.resultats.8',
|
||||
'Répartition des revenus nets'
|
||||
)}
|
||||
</H4>
|
||||
<StyledBody>
|
||||
{t(
|
||||
'pages.assistants.declaration-revenus-pamc.resultats.6',
|
||||
'pages.assistants.declaration-revenus-pamc.resultats.9',
|
||||
'Revenus nets de l’activité conventionnée :'
|
||||
)}
|
||||
</StyledBody>
|
||||
|
@ -103,7 +128,7 @@ export default function Résultats() {
|
|||
/>
|
||||
<StyledBody>
|
||||
{t(
|
||||
'pages.assistants.declaration-revenus-pamc.resultats.7',
|
||||
'pages.assistants.declaration-revenus-pamc.resultats.10',
|
||||
'Revenus nets tirés des autres activités non salariées :'
|
||||
)}
|
||||
</StyledBody>
|
||||
|
@ -120,7 +145,7 @@ export default function Résultats() {
|
|||
|
||||
<H4 as="h3">
|
||||
{t(
|
||||
'pages.assistants.declaration-revenus-pamc.resultats.8',
|
||||
'pages.assistants.declaration-revenus-pamc.resultats.11',
|
||||
'Données transmises par l’Assurance Maladie'
|
||||
)}
|
||||
</H4>
|
||||
|
|
Loading…
Add table
Reference in a new issue