-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat(outil-idl): exclude some CCNS, fix #886 * feat: ajout IDL IDCC 3043 fix #883 * fix: move ccn 3043 to dedicated folder
- Loading branch information
Showing
9 changed files
with
462 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
108 changes: 108 additions & 0 deletions
108
packages/code-du-travail-frontend/src/outils/indemniteLicenciement/ccn/3043/Result.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
import React from "react"; | ||
import MathJax from "react-mathjax-preview"; | ||
import { Container, Button } from "@cdt/ui"; | ||
|
||
import { ErrorBoundary } from "../../../../common/ErrorBoundary"; | ||
|
||
import { | ||
getIndemnite as getIndemniteConventionnelle, | ||
getSalaireRef as getSalaireRefConventionnel | ||
} from "./indemnite"; | ||
|
||
import { branches } from "../../branches"; | ||
import { getIndemnite, getSalaireRef } from "../../indemnite"; | ||
import { SectionTitle, Highlight, SmallText } from "../../stepStyles"; | ||
|
||
function ResultProprete({ form }) { | ||
const state = form.getState(); | ||
|
||
const { | ||
hasTempsPartiel = false, | ||
hasSameSalaire = false, | ||
inaptitude = false, | ||
salairePeriods = [], | ||
salaires = [], | ||
primes = [], | ||
salaire, | ||
anciennete, | ||
dateNotification, | ||
branche, | ||
isEco, | ||
hasOpe, | ||
age, | ||
groupe | ||
} = state.values; | ||
|
||
const selectedBranche = branches.find(br => br.value === branche); | ||
|
||
const salaireRefLegal = getSalaireRef({ | ||
hasTempsPartiel, | ||
hasSameSalaire, | ||
salaire, | ||
salairePeriods, | ||
salaires, | ||
anciennete, | ||
primes | ||
}); | ||
|
||
const { indemnite } = getIndemnite({ | ||
salaireRef: salaireRefLegal, | ||
anciennete, | ||
inaptitude, | ||
dateNotification | ||
}); | ||
|
||
const salaireRef = getSalaireRefConventionnel({ | ||
salaireRefLegal, | ||
groupe, | ||
salaires, | ||
salaire, | ||
dateNotification | ||
}); | ||
const { | ||
indemniteConventionnelle, | ||
formula, | ||
error | ||
} = getIndemniteConventionnelle({ | ||
salaireRef, | ||
indemnite, | ||
anciennete, | ||
isEco, | ||
hasOpe, | ||
age, | ||
groupe | ||
}); | ||
|
||
return ( | ||
<Container> | ||
<SectionTitle>{selectedBranche.label}</SectionTitle> | ||
{error ? ( | ||
<p>{error}</p> | ||
) : ( | ||
<React.Fragment> | ||
<p> | ||
Le montant de l’indemnité est{" "} | ||
<Highlight>{indemniteConventionnelle} €</Highlight>{" "} | ||
<SmallText> | ||
{indemniteConventionnelle > indemnite | ||
? "sur la base du calcul de l'indemnité conventionelle" | ||
: "sur la base du calcul de l’indemnité légale"} | ||
</SmallText> | ||
</p> | ||
<br /> | ||
<details> | ||
<summary>Voir le detail du calcul</summary> | ||
<ErrorBoundary> | ||
<MathJax math={"`" + formula + "`"} /> | ||
</ErrorBoundary> | ||
</details> | ||
</React.Fragment> | ||
)} | ||
<br /> | ||
<br /> | ||
<Button> Recommencer une simulation </Button> | ||
</Container> | ||
); | ||
} | ||
|
||
export default ResultProprete; |
34 changes: 34 additions & 0 deletions
34
...de-du-travail-frontend/src/outils/indemniteLicenciement/ccn/3043/__tests__/Result.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import React from "react"; | ||
import { render } from "react-testing-library"; | ||
import Result from "../Result"; | ||
import { Form } from "react-final-form"; | ||
|
||
const form = { | ||
getState: () => ({ | ||
values: { | ||
contrat: "cdi", | ||
fauteGrave: false, | ||
inaptitude: false, | ||
hasAbsenceProlonge: false, | ||
hasTempsPartiel: false, | ||
hasSameSalaire: true, | ||
salaire: 2000, | ||
dataEntree: "2016-06-01", | ||
dateSortie: "2019-01-02", | ||
dateNotification: "2018-12-01", | ||
anciennete: 2.5, | ||
groupe: "I", | ||
branche: "3043" | ||
} | ||
}) | ||
}; | ||
|
||
describe("<Result />", () => { | ||
it("should render", () => { | ||
const onSubmit = jest.fn(); | ||
const { container } = render( | ||
<Form onSubmit={onSubmit} render={() => <Result form={form} />} /> | ||
); | ||
expect(container).toMatchSnapshot(); | ||
}); | ||
}); |
148 changes: 148 additions & 0 deletions
148
...end/src/outils/indemniteLicenciement/ccn/3043/__tests__/__snapshots__/Result.test.js.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,148 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`<Result /> should render 1`] = ` | ||
.c0 { | ||
max-width: 1200px; | ||
margin: 0 auto; | ||
padding: 0 1.25rem; | ||
} | ||
.c0 > *:last-child { | ||
margin-top: 0; | ||
margin-bottom: 0; | ||
} | ||
.c4 { | ||
padding: 0.625rem 1rem; | ||
-webkit-appearance: none; | ||
-moz-appearance: none; | ||
appearance: none; | ||
text-align: center; | ||
line-height: inherit; | ||
font-size: 1rem; | ||
font-weight: 600; | ||
vertical-align: middle; | ||
border-style: solid; | ||
border-width: 1px 1px 2px 1px; | ||
border-radius: 0.25rem; | ||
cursor: pointer; | ||
-webkit-transition: background-color 250ms ease; | ||
transition: background-color 250ms ease; | ||
color: #fff; | ||
background: #006be6; | ||
border-color: #006be6; | ||
border-bottom-color: #0053b3; | ||
} | ||
.c4:not([disabled]):hover, | ||
.c4:not([disabled]):focus { | ||
background: #07f; | ||
color: #fff; | ||
} | ||
.c4:not([disabled]):active { | ||
color: #fff; | ||
background: #1a85ff; | ||
border-width: 2px 1px 1px 1px; | ||
border-color: #006be6; | ||
outline: none; | ||
} | ||
.c4[aria-pressed="true"] { | ||
color: #fff; | ||
background: #07f; | ||
border-width: 2px 1px 1px 1px; | ||
border-color: #006be6; | ||
border-top-color: #0053b3; | ||
box-shadow: inset 0 1px 2px 0 #0053b3; | ||
} | ||
.c4[aria-pressed="true"]:not([disabled]):hover, | ||
.c4[aria-pressed="true"]:not([disabled]):focus { | ||
background-color: #006be6; | ||
} | ||
.c4[aria-pressed="true"]:not([disabled]):active { | ||
border-top-color: #0053b3; | ||
} | ||
.c4[disabled] { | ||
cursor: not-allowed; | ||
color: rgba(255,255,255,0.4); | ||
} | ||
.c1 { | ||
font-size: 1.4rem; | ||
margin-top: 2rem; | ||
margin-bottom: 1.25rem; | ||
} | ||
.c2 { | ||
font-size: 1.4rem; | ||
font-weight: 700; | ||
color: #0053b3; | ||
} | ||
.c3 { | ||
color: #434956; | ||
font-style: italic; | ||
} | ||
@media print { | ||
.c0 { | ||
max-width: 100%; | ||
padding: 0; | ||
} | ||
} | ||
<div> | ||
<div | ||
class="c0" | ||
> | ||
<h2 | ||
class="c1" | ||
> | ||
Propreté : entreprises et services associés | ||
</h2> | ||
<p> | ||
Le montant de l’indemnité est | ||
<strong | ||
class="c2" | ||
> | ||
500 | ||
€ | ||
</strong> | ||
<span | ||
class="c3" | ||
> | ||
sur la base du calcul de l’indemnité légale | ||
</span> | ||
</p> | ||
<br /> | ||
<details> | ||
<summary> | ||
Voir le detail du calcul | ||
</summary> | ||
<div | ||
id="react-mathjax-preview" | ||
> | ||
<div | ||
id="react-mathjax-preview-result" | ||
> | ||
\`( + 1/10 * 2000 * 2.5 )\` | ||
</div> | ||
</div> | ||
</details> | ||
<br /> | ||
<br /> | ||
<button | ||
aria-pressed="false" | ||
class="c4" | ||
> | ||
Recommencer une simulation | ||
</button> | ||
</div> | ||
</div> | ||
`; |
15 changes: 15 additions & 0 deletions
15
.../src/outils/indemniteLicenciement/ccn/3043/__tests__/__snapshots__/indemnite.test.js.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`getIndemnite 2k, 5ans d'ancienneté, 51ans 1`] = `1000`; | ||
|
||
exports[`getIndemnite 2k, 5ans d'ancienneté, 51ans, licenciement eco, OPE 1`] = `1000`; | ||
|
||
exports[`getIndemnite 2k, 5ans d'ancienneté, 55ans 1`] = `1000`; | ||
|
||
exports[`getIndemnite 2k, 12mois d'ancienneté 1`] = `0`; | ||
|
||
exports[`getIndemnite 2k, 12mois d'ancienneté, OPE + licenciement eco 1`] = `0`; | ||
|
||
exports[`getIndemnite 2k, 30mois d'ancienneté 1`] = `500`; | ||
|
||
exports[`getIndemnite 2k, 41ans d'ancienneté, 55ans 1`] = `1000`; |
Oops, something went wrong.