Skip to content

Commit

Permalink
IDL propreté Issue 883 (#940)
Browse files Browse the repository at this point in the history
* 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
Julien Bouquillon authored and lionelB committed Jun 18, 2019
1 parent 328e631 commit 54d3d68
Show file tree
Hide file tree
Showing 9 changed files with 462 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,9 @@ export const branches = [
{
value: "1597",
label: "Ouvriers du bâtiment (entreprises de plus 10 salariés)"
},
{
value: "3043",
label: "Propreté : entreprises et services associés"
}
];
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;
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();
});
});
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>
`;
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`;
Loading

0 comments on commit 54d3d68

Please sign in to comment.