Skip to content

Commit 74e8d28

Browse files
committed
feat(indépendant): ajoute le simulateur cessation d’activité
1 parent 57e72f2 commit 74e8d28

File tree

36 files changed

+577
-221
lines changed

36 files changed

+577
-221
lines changed

modele-social/règles/entreprise/entreprise.publicodes

+6
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,12 @@ entreprise . durée d'activité . années civiles:
6868
depuis: date de création
6969
unité: année civile
7070

71+
entreprise . date de radiation:
72+
question: À quelle date comptez-vous déclarer la cessation d’activité ?
73+
par défaut: période . fin d'année
74+
description: La date de radiation est la date à laquelle l’entreprise cessera son activité.
75+
type: date
76+
7177
entreprise . chiffre d'affaires:
7278
question: Quel est votre chiffre d'affaires envisagé ?
7379
identifiant court: CA

site/source/components/Feedback/FeedbackForm.tsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ import { Strong } from '@/design-system/typography'
1212
import { H1, H4 } from '@/design-system/typography/heading'
1313
import { Link } from '@/design-system/typography/link'
1414
import { Body } from '@/design-system/typography/paragraphs'
15-
16-
import { useUrl } from '../ShareSimulationBanner'
15+
import { useUrl } from '@/hooks/useUrl'
1716

1817
type SubmitError = {
1918
message?: string

site/source/components/ShareSimulationBanner/index.tsx

+16-29
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,36 @@
11
import { useContext } from 'react'
22
import { Trans, useTranslation } from 'react-i18next'
3-
import { useSelector } from 'react-redux'
43
import { styled } from 'styled-components'
54

65
import { PopoverWithTrigger } from '@/design-system'
76
import { Button } from '@/design-system/buttons'
87
import { Emoji } from '@/design-system/emoji'
98
import { Grid, Spacing } from '@/design-system/layout'
10-
import { useCurrentSimulatorData } from '@/hooks/useCurrentSimulatorData'
11-
import {
12-
companySituationSelector,
13-
situationSelector,
14-
targetUnitSelector,
15-
} from '@/store/selectors/simulationSelectors'
9+
import { useUrl } from '@/hooks/useUrl'
1610

1711
import { TrackingContext } from '../ATInternetTracking'
1812
import { ConseillersEntreprisesButton } from '../ConseillersEntreprisesButton'
19-
import { useParamsFromSituation } from '../utils/useSearchParamsSimulationSharing'
2013
import { ShareSimulationPopup } from './ShareSimulationPopup'
2114

22-
export function useUrl() {
23-
const language = useTranslation().i18n.language
24-
const situation = {
25-
...useSelector(situationSelector),
26-
...useSelector(companySituationSelector),
27-
}
28-
29-
const targetUnit = useSelector(targetUnitSelector)
30-
31-
const searchParams = useParamsFromSituation(situation, targetUnit)
32-
const { currentSimulatorData } = useCurrentSimulatorData()
33-
34-
const { path = '' } = currentSimulatorData ?? {}
35-
const siteUrl =
36-
language === 'fr'
37-
? import.meta.env.VITE_FR_BASE_URL
38-
: import.meta.env.VITE_EN_BASE_URL
39-
40-
return siteUrl + path + '?' + searchParams.toString()
41-
}
42-
4315
const ButtonLabel = styled.span`
4416
margin-left: 1rem;
4517
`
4618

19+
export interface CustomSimulationButton {
20+
href: string
21+
title: string
22+
}
23+
4724
export default function ShareOrSaveSimulationBanner({
4825
share,
4926
print,
5027
conseillersEntreprises,
28+
customSimulationbutton,
5129
}: {
5230
share?: boolean
5331
print?: boolean
5432
conseillersEntreprises?: boolean
33+
customSimulationbutton?: CustomSimulationButton
5534
}) {
5635
const { t } = useTranslation()
5736
const tracker = useContext(TrackingContext)
@@ -92,6 +71,14 @@ export default function ShareOrSaveSimulationBanner({
9271
justifyContent: 'center',
9372
}}
9473
>
74+
{customSimulationbutton && (
75+
<Grid item xs={12} sm="auto">
76+
<Button light size="XS" href={customSimulationbutton.href}>
77+
{customSimulationbutton.title}
78+
</Button>
79+
</Grid>
80+
)}
81+
9582
{share && (
9683
<Grid item xs={12} sm="auto">
9784
<PopoverWithTrigger

site/source/components/SimulateurWarning.tsx

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useContext } from 'react'
1+
import React, { ReactNode, useContext } from 'react'
22
import { Trans } from 'react-i18next'
33
import { styled } from 'styled-components'
44

@@ -13,10 +13,12 @@ import { EngineContext } from './utils/EngineContext'
1313

1414
type SimulateurWarningProps = {
1515
simulateur: Exclude<keyof AbsoluteSitePaths['simulateurs'], 'index'>
16+
informationsComplémentaires?: ReactNode
1617
}
1718

1819
export default function SimulateurWarning({
1920
simulateur,
21+
informationsComplémentaires,
2022
}: SimulateurWarningProps) {
2123
const year = useContext(EngineContext)
2224
.evaluate('date')
@@ -57,6 +59,11 @@ export default function SimulateurWarning({
5759
</StyledLi>
5860
</Ul>
5961
)}
62+
{informationsComplémentaires && (
63+
<Ul>
64+
<StyledLi>{informationsComplémentaires}</StyledLi>
65+
</Ul>
66+
)}
6067
{simulateur === 'profession-libérale' && (
6168
<Ul>
6269
<StyledLi>

site/source/components/Simulation/index.tsx

+32-11
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,13 @@ import { useLocation } from 'react-router-dom'
55
import { styled } from 'styled-components'
66

77
import { ConversationProps } from '@/components/conversation/Conversation'
8-
import ShareOrSaveSimulationBanner from '@/components/ShareSimulationBanner'
8+
import ShareOrSaveSimulationBanner, {
9+
CustomSimulationButton,
10+
} from '@/components/ShareSimulationBanner'
911
import { PopoverWithTrigger } from '@/design-system'
12+
import { Button } from '@/design-system/buttons'
1013
import { Grid, Spacing } from '@/design-system/layout'
14+
import { H3 } from '@/design-system/typography/heading'
1115
import { Link } from '@/design-system/typography/link'
1216
import {
1317
companySituationSelector,
@@ -27,6 +31,16 @@ export { Questions } from './Questions'
2731
export { SimulationGoal } from './SimulationGoal'
2832
export { SimulationGoals } from './SimulationGoals'
2933

34+
const StyledGrid = styled(Grid)`
35+
width: 100%;
36+
@media print {
37+
max-width: initial;
38+
flex-basis: initial;
39+
flex-grow: 1;
40+
margin: 0 1rem;
41+
}
42+
`
43+
3044
type SimulationProps = {
3145
explanations?: React.ReactNode
3246
results?: React.ReactNode
@@ -37,18 +51,9 @@ type SimulationProps = {
3751
customEndMessages?: ConversationProps['customEndMessages']
3852
fullWidth?: boolean
3953
id?: string
54+
customSimulationbutton?: CustomSimulationButton
4055
}
4156

42-
const StyledGrid = styled(Grid)`
43-
width: 100%;
44-
@media print {
45-
max-width: initial;
46-
flex-basis: initial;
47-
flex-grow: 1;
48-
margin: 0 1rem;
49-
}
50-
`
51-
5257
export default function Simulation({
5358
explanations,
5459
results,
@@ -59,6 +64,7 @@ export default function Simulation({
5964
hideDetails = false,
6065
fullWidth,
6166
id,
67+
customSimulationbutton,
6268
}: SimulationProps) {
6369
const firstStepCompleted = useSelector(firstStepCompletedSelector)
6470
const existingCompany = !!useSelector(companySituationSelector)[
@@ -115,6 +121,21 @@ export default function Simulation({
115121
)}
116122
{firstStepCompleted && !hideDetails && (
117123
<>
124+
{customSimulationbutton && (
125+
<>
126+
<div>
127+
<H3>
128+
Avez-vous besoin de calculer les cotisations de l'année
129+
précédente ?
130+
</H3>
131+
<Button size="MD" href={customSimulationbutton.href}>
132+
{customSimulationbutton.title}
133+
</Button>
134+
</div>
135+
<Spacing lg />
136+
</>
137+
)}
138+
118139
<ShareOrSaveSimulationBanner share print conseillersEntreprises />
119140
<Spacing lg />
120141
</>

site/source/components/simulationExplanation/PrintExportRecover.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { Trans } from 'react-i18next'
22

3-
import { useUrl } from '@/components/ShareSimulationBanner'
43
import { Message } from '@/design-system'
54
import { Link } from '@/design-system/typography/link'
65
import { Body } from '@/design-system/typography/paragraphs'
6+
import { useUrl } from '@/hooks/useUrl'
77

88
export default function PrintExportRecover() {
99
return (
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import { useSelector } from 'react-redux'
2+
3+
import { useParamsFromSituation } from '@/components/utils/useSearchParamsSimulationSharing'
4+
import {
5+
companySituationSelector,
6+
situationSelector,
7+
targetUnitSelector,
8+
} from '@/store/selectors/simulationSelectors'
9+
10+
export const useSearchParamsForCurrentSituation = <
11+
T extends boolean | undefined,
12+
>(
13+
asString: T
14+
): T extends true ? string : object => {
15+
const situation = {
16+
...useSelector(situationSelector),
17+
...useSelector(companySituationSelector),
18+
}
19+
20+
const targetUnit = useSelector(targetUnitSelector)
21+
22+
const searchParams = useParamsFromSituation(situation, targetUnit)
23+
24+
return (asString ? searchParams.toString() : searchParams) as T extends true
25+
? string
26+
: object
27+
}

site/source/hooks/useSiteUrl.tsx

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { useTranslation } from 'react-i18next'
2+
3+
export const useSiteUrl = () => {
4+
const language = useTranslation().i18n.language
5+
6+
return language === 'fr'
7+
? import.meta.env.VITE_FR_BASE_URL
8+
: import.meta.env.VITE_EN_BASE_URL
9+
}

site/source/hooks/useUrl.tsx

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { useCurrentSimulatorData } from '@/hooks/useCurrentSimulatorData'
2+
import { useSearchParamsForCurrentSituation } from '@/hooks/useSearchParamsForCurrentSituation'
3+
import { useSiteUrl } from '@/hooks/useSiteUrl'
4+
5+
export function useUrl() {
6+
const { currentSimulatorData } = useCurrentSimulatorData()
7+
8+
const { path = '' } = currentSimulatorData ?? {}
9+
10+
return useSiteUrl() + path + '?' + useSearchParamsForCurrentSituation(true)
11+
}

site/source/locales/rules-en.yaml

+12
Original file line numberDiff line numberDiff line change
@@ -5789,6 +5789,18 @@ entreprise . date de création . contrôle date passée:
57895789
pas vous être trompé dans la saisie ?
57905790
titre.en: '[automatic] past date check'
57915791
titre.fr: contrôle date passée
5792+
entreprise . date de radiation:
5793+
description.en: '[automatic] The deregistration date is the date on which the
5794+
company ceases trading.'
5795+
description.fr:
5796+
La date de radiation est la date à laquelle l’entreprise cessera
5797+
son activité.
5798+
question.en: '[automatic] When do you plan to declare your cessation of activity?'
5799+
question.fr: À quelle date comptez-vous déclarer la cessation d’activité ?
5800+
suggestions.Fin de cette année.en: '[automatic] End of this year'
5801+
suggestions.Fin de cette année.fr: Fin de cette année
5802+
titre.en: '[automatic] deregistration date'
5803+
titre.fr: date de radiation
57925804
entreprise . dividendes:
57935805
titre.en: '[automatic] dividends'
57945806
titre.fr: dividendes

site/source/locales/ui-en.yaml

+12
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ Bonjour, je suis boulanger et je n'ai pas trouvé en cherchant "pain" ou "vienno
6161
Hello, I'm a baker and I couldn't find "bread" or "viennoiserie" when I
6262
searched.
6363
Budget: Budget
64+
Calculer vos cotisations pour l’année précédente: Calculate your contributions for the previous year
6465
Calculer vos revenus: Calculate your income
6566
Ce simulateur a été prérempli avec la situation de votre entreprise.: This simulator has been pre-filled with your company's situation.
6667
Cette commune n'existe pas: This commune does not exist
@@ -1238,6 +1239,17 @@ pages:
12381239
title: "Lawyer: income simulator"
12391240
shortname: Lawyer
12401241
title: Income simulator for self-employed lawyers
1242+
cessation-activité:
1243+
meta:
1244+
description: Calculate your contributions to be paid when you cease
1245+
self-employed activity
1246+
ogDescription: Calculate your contributions to be paid when you cease
1247+
self-employed activity
1248+
ogTitle: Calculate your contributions to be paid when you cease self-employed
1249+
activity
1250+
titre: "Self-employed : Estimates of contributions payable after termination"
1251+
shortname: Cessation of activity
1252+
title: Estimated contributions payable after termination
12411253
chirurgien-dentiste:
12421254
meta:
12431255
description: Calculation of net income after contributions based on total income.

site/source/locales/ui-fr.yaml

+12
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ Bonjour, je suis boulanger et je n'ai pas trouvé en cherchant "pain" ou "vienno
6666
Bonjour, je suis boulanger et je n'ai pas trouvé en cherchant "pain" ou
6767
"viennoiserie".
6868
Budget: Budget
69+
Calculer vos cotisations pour l’année précédente: Calculer vos cotisations pour l’année précédente
6970
Calculer vos revenus: Calculer vos revenus
7071
Ce simulateur a été prérempli avec la situation de votre entreprise.: Ce simulateur a été prérempli avec la situation de votre entreprise.
7172
Cette commune n'existe pas: Cette commune n'existe pas
@@ -1314,6 +1315,17 @@ pages:
13141315
title: "Avocat : simulateur de revenus"
13151316
shortname: Avocat
13161317
title: Simulateur de revenus pour avocat en libéral
1318+
cessation-activité:
1319+
meta:
1320+
description: Calculez vos cotisations à payer lors de la cessation de votre
1321+
activité en tant qu’indépendant
1322+
ogDescription: Calculez vos cotisations à payer lors de la cessation de votre
1323+
activité en tant qu’indépendant
1324+
ogTitle: Calculez vos cotisations à payer lors de la cessation de votre activité
1325+
en tant qu’indépendant
1326+
titre: "Indépendants : Estimations de cotisations à devoir après cessation"
1327+
shortname: Cessation d’activité
1328+
title: Estimations de cotisations à devoir après cessation
13171329
chirurgien-dentiste:
13181330
meta:
13191331
description: Calcul du revenu net après cotisations à partir du total des recettes.

site/source/pages/simulateurs-et-assistants/index.tsx

+6-1
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,6 @@ export default function SimulateursEtAssistants() {
160160
<SimulateurCard {...simulators.is} role="listitem" />
161161
<SimulateurCard {...simulators.dividendes} role="listitem" />
162162

163-
<SimulateurCard {...simulators['demande-mobilité']} role="listitem" />
164163
<SimulateurCard
165164
{...simulators['coût-création-entreprise']}
166165
role="listitem"
@@ -169,6 +168,12 @@ export default function SimulateursEtAssistants() {
169168
{...simulators['recherche-code-ape']}
170169
role="listitem"
171170
/>
171+
<SimulateurCard
172+
{...simulators['cessation-activité']}
173+
role="listitem"
174+
/>
175+
176+
<SimulateurCard {...simulators['demande-mobilité']} role="listitem" />
172177
</Grid>
173178
</section>
174179
<section>

site/source/pages/simulateurs-et-assistants/metadata-src.ts

+2
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import { réductionGénéraleConfig } from '../simulateurs/reduction-generale/co
3030
import { sageFemmeConfig } from '../simulateurs/sage-femme/config'
3131
import { salariéConfig } from '../simulateurs/salarié/config'
3232
import { sasuConfig } from '../simulateurs/sasu/config'
33+
import { cessationActivitéConfig } from '@/pages/simulateurs/cessation-activité/config'
3334

3435
/**
3536
* Contient l'intégralité des données concernant les différents simulateurs et assistants
@@ -63,6 +64,7 @@ const getMetadataSrc = (params: SimulatorsDataParams) => {
6364
...impôtSociétéConfig(params),
6465
...cipavConfig(params),
6566
...réductionGénéraleConfig(params),
67+
...cessationActivitéConfig(params),
6668

6769
// assistants:
6870
...choixStatutJuridiqueConfig(params),

0 commit comments

Comments
 (0)