From d6eee293ce46c76e968e48fe4202e21f0607f840 Mon Sep 17 00:00:00 2001 From: Maxime Golfier <25312957+maxgfr@users.noreply.github.com> Date: Tue, 10 Sep 2024 16:06:39 +0200 Subject: [PATCH] fix(preavis-retraite): correction de petits bugs sur le resultat (#6098) * fix: retours preavis * Update packages/code-du-travail-frontend/src/outils/PreavisRetraite/steps/Result/components/DecryptedResult.tsx Co-authored-by: Caroline <4971715+carolineBda@users.noreply.github.com> --------- Co-authored-by: Caroline <4971715+carolineBda@users.noreply.github.com> --- .../depart-avec-handicap-sans-cc.spec.tsx | 2 +- .../__tests__/depart-sans-cc.spec.tsx | 2 +- .../__tests__/mise-avec-handicap-sans-cc.spec.tsx | 2 +- .../__tests__/mise-sans-cc.spec.tsx | 2 +- .../steps/Result/components/DecryptedResult.tsx | 10 ++++++++-- .../steps/Result/components/ShowResult.tsx | 15 ++++++++++----- .../outils/PreavisRetraite/steps/Result/index.tsx | 3 +++ 7 files changed, 25 insertions(+), 11 deletions(-) diff --git a/packages/code-du-travail-frontend/src/outils/PreavisRetraite/__tests__/depart-avec-handicap-sans-cc.spec.tsx b/packages/code-du-travail-frontend/src/outils/PreavisRetraite/__tests__/depart-avec-handicap-sans-cc.spec.tsx index 16ca44bfce..6fc4345b65 100644 --- a/packages/code-du-travail-frontend/src/outils/PreavisRetraite/__tests__/depart-avec-handicap-sans-cc.spec.tsx +++ b/packages/code-du-travail-frontend/src/outils/PreavisRetraite/__tests__/depart-avec-handicap-sans-cc.spec.tsx @@ -37,7 +37,7 @@ test(`Départ à la retraite sans sélection de CC avec handicap expect(ui.result.noticeHandicap2.get()).toBeInTheDocument(); expect(ui.result.resultatLegal.get()).toHaveTextContent("3 mois"); expect(ui.result.resultatAgreement.get()).toHaveTextContent( - "convention collective non traitée" + "convention collective non renseignée" ); expect(ui.result.decryptedDescription.get()).toHaveTextContent( "La convention collective n’ayant pas été renseignée, la durée de préavis affichée correspond à la durée légale." diff --git a/packages/code-du-travail-frontend/src/outils/PreavisRetraite/__tests__/depart-sans-cc.spec.tsx b/packages/code-du-travail-frontend/src/outils/PreavisRetraite/__tests__/depart-sans-cc.spec.tsx index 5657bf2595..8c11c54ed5 100644 --- a/packages/code-du-travail-frontend/src/outils/PreavisRetraite/__tests__/depart-sans-cc.spec.tsx +++ b/packages/code-du-travail-frontend/src/outils/PreavisRetraite/__tests__/depart-sans-cc.spec.tsx @@ -37,7 +37,7 @@ test(`Départ à la retraite sans sélection de CC expect(ui.result.travailleurHandicape.get()).toHaveTextContent("Non"); expect(ui.result.resultatLegal.get()).toHaveTextContent("2 mois"); expect(ui.result.resultatAgreement.get()).toHaveTextContent( - "convention collective non traitée" + "convention collective non renseignée" ); expect(ui.result.decryptedDescription.get()).toHaveTextContent( "La convention collective n’ayant pas été renseignée, la durée de préavis affichée correspond à la durée légale." diff --git a/packages/code-du-travail-frontend/src/outils/PreavisRetraite/__tests__/mise-avec-handicap-sans-cc.spec.tsx b/packages/code-du-travail-frontend/src/outils/PreavisRetraite/__tests__/mise-avec-handicap-sans-cc.spec.tsx index e370c05a35..667b30d8f2 100644 --- a/packages/code-du-travail-frontend/src/outils/PreavisRetraite/__tests__/mise-avec-handicap-sans-cc.spec.tsx +++ b/packages/code-du-travail-frontend/src/outils/PreavisRetraite/__tests__/mise-avec-handicap-sans-cc.spec.tsx @@ -36,7 +36,7 @@ test(`Mise à la retraite sans sélection de CC avec handicap expect(ui.result.noticeHandicap2.get()).toBeInTheDocument(); expect(ui.result.resultatLegal.get()).toHaveTextContent("3 mois"); expect(ui.result.resultatAgreement.get()).toHaveTextContent( - "convention collective non traitée" + "convention collective non renseignée" ); expect(ui.result.decryptedDescription.get()).toHaveTextContent( "La convention collective n’ayant pas été renseignée, la durée de préavis affichée correspond à la durée légale." diff --git a/packages/code-du-travail-frontend/src/outils/PreavisRetraite/__tests__/mise-sans-cc.spec.tsx b/packages/code-du-travail-frontend/src/outils/PreavisRetraite/__tests__/mise-sans-cc.spec.tsx index 1e1a948d98..1ccd86973d 100644 --- a/packages/code-du-travail-frontend/src/outils/PreavisRetraite/__tests__/mise-sans-cc.spec.tsx +++ b/packages/code-du-travail-frontend/src/outils/PreavisRetraite/__tests__/mise-sans-cc.spec.tsx @@ -35,7 +35,7 @@ test(`Mise à la retraite sans sélection de CC expect(ui.result.travailleurHandicape.get()).toHaveTextContent("Non"); expect(ui.result.resultatLegal.get()).toHaveTextContent("2 mois"); expect(ui.result.resultatAgreement.get()).toHaveTextContent( - "convention collective non traitée" + "convention collective non renseignée" ); expect(ui.result.decryptedDescription.get()).toHaveTextContent( "La convention collective n’ayant pas été renseignée, la durée de préavis affichée correspond à la durée légale." diff --git a/packages/code-du-travail-frontend/src/outils/PreavisRetraite/steps/Result/components/DecryptedResult.tsx b/packages/code-du-travail-frontend/src/outils/PreavisRetraite/steps/Result/components/DecryptedResult.tsx index 94f5db8e64..9b50399bb1 100644 --- a/packages/code-du-travail-frontend/src/outils/PreavisRetraite/steps/Result/components/DecryptedResult.tsx +++ b/packages/code-du-travail-frontend/src/outils/PreavisRetraite/steps/Result/components/DecryptedResult.tsx @@ -5,6 +5,7 @@ import { SectionTitle } from "../../../../common/stepStyles"; import { getDescription } from "../utils/getDescription"; import { DepartOuMiseRetraite } from "../../OriginStep/store"; import { NoticeUsed } from "../utils/types"; +import { AgreementRoute } from "../../../../common/type/WizardType"; type Props = { legalResult?: PublicodesPreavisRetraiteResult; @@ -16,6 +17,7 @@ type Props = { isSeniorityLessThan6Months: boolean; hasAgreement: boolean; isAgreementSupported: boolean; + agreementRoute?: AgreementRoute; }; const DecryptedResult: React.FC = ({ @@ -28,6 +30,7 @@ const DecryptedResult: React.FC = ({ hasAgreement, isAgreementSupported, agreementResult, + agreementRoute, }) => { const description = getDescription( typeDeDepart, @@ -54,6 +57,7 @@ const DecryptedResult: React.FC = ({ result={agreementResult} isAgreementSupported={isAgreementSupported} agreementMaximumResult={agreementMaximumResult} + agreementRoute={agreementRoute} /> {description && ( @@ -102,17 +106,19 @@ const ShowResult: React.FC = ({ type ShowResultAgreementProps = ShowResultProps & { isAgreementSupported?: boolean; + agreementRoute?: AgreementRoute; }; const ShowResultAgreement: React.FC = ({ result, isAgreementSupported, agreementMaximumResult, + agreementRoute, }) => { - if (!result) { + if (agreementRoute === "not-selected") { return convention collective non renseignée; } - if (result?.value > 0 && agreementMaximumResult) { + if (result && result.value > 0 && agreementMaximumResult) { return ( = ({ {result.unit} et  {agreementMaximumResult?.value}  {agreementMaximumResult?.unit} + ) : result.value > 0 ? ( <> {result.value}   {result.unit} + ) : ( <>il n’y a pas de préavis à effectuer )} -

{result.value !== 0 && ( diff --git a/packages/code-du-travail-frontend/src/outils/PreavisRetraite/steps/Result/index.tsx b/packages/code-du-travail-frontend/src/outils/PreavisRetraite/steps/Result/index.tsx index 708d0e3e05..eca20cfd64 100644 --- a/packages/code-du-travail-frontend/src/outils/PreavisRetraite/steps/Result/index.tsx +++ b/packages/code-du-travail-frontend/src/outils/PreavisRetraite/steps/Result/index.tsx @@ -31,6 +31,7 @@ const StepResult = (): JSX.Element => { moreThanXYears, errorPublicodes, result, + agreementRoute, } = usePreavisRetraiteStore(store, (state) => ({ originDepart: state.originDepartData.input.originDepart, agreement: state.agreementData.input.agreement, @@ -50,6 +51,7 @@ const StepResult = (): JSX.Element => { moreThanXYears: state.seniorityData.input.moreThanXYears, errorPublicodes: state.resultData.error.errorPublicodes, result: state.resultData.input.result, + agreementRoute: state.agreementData.input.route, })); useEffect(() => { @@ -89,6 +91,7 @@ const StepResult = (): JSX.Element => { noticeUsed={noticeUsed!} typeDeDepart={originDepart!} isSeniorityLessThan6Months={!!isSeniorityLessThan6Months} + agreementRoute={agreementRoute} />