Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: simulation indicator 1, 2 and 3 #1934

Merged
merged 2 commits into from
Dec 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ const augmentations = {
balanceText: "Nombre de points obtenus à l'indicateur écart de taux d'augmentations individuelles",
resultText: "Écart global de taux d'augmentations en valeur absolue",
noteText: "Nombre de points obtenus à l'indicateur écart de taux d'augmentations individuelles",
missingDataLegend: "Veuillez remplir le reste des taux d'augmentations individuelles pour avoir votre note",
missingDataLegend:
"Veuillez renseigner le pourcentage de salariés augmentés pour obtenir le nombre de points à l'indicateur",
};

const promotions = {
Expand All @@ -27,7 +28,8 @@ const promotions = {
balanceText: "Nombre de points obtenus à l'indicateur écart de taux de promotions",
resultText: "Écart global de taux de promotions en valeur absolue",
noteText: "Nombre de points obtenus à l'indicateur écart de taux de promotions",
missingDataLegend: "Veuillez remplir le reste des taux de promotions pour avoir votre note",
missingDataLegend:
"Veuillez renseigner le pourcentage de salariés promus pour obtenir le nombre de points à l'indicateur",
};

export const Indicateur2ou3Note = ({ computer, indicateur, isValid, simple, noBorder }: Props) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,35 @@
import { fr } from "@codegouvfr/react-dsfr";
import { cx } from "@codegouvfr/react-dsfr/tools/cx";
import { type ComputedResult } from "@common/core-domain/computers/AbstractComputer";
import { type TotalMetadata } from "@common/core-domain/computers/AbstractGroupComputer";
import { type IndicateurUnComputer } from "@common/core-domain/computers/IndicateurUnComputer";
import { percentFormat } from "@common/utils/number";
import { IndicatorNote } from "@design-system";
import { ClientAnimate } from "@design-system/utils/client/ClientAnimate";

import styles from "./IndicatorNote1.module.css";

interface Props {
computer: IndicateurUnComputer;
isValid: boolean;
noBorder?: boolean;
simple?: boolean;
}

function getNCText(metadata: TotalMetadata) {
const validPourcentageRounded = (metadata.totalGroupCount / metadata.totalEmployeeCount) * 100;
return (
<i>
Il faut avoir plus de 40% des effectifs valides (c’est-à-dire comptant au moins 3 femmes et 3 hommes) pour pouvoir
calculer l'indicateur écart de rémunération. <br />
<b className={cx(styles["text-orange"])}>
Vous n'avez que {metadata.totalGroupCount} effectifs valides sur un effectif total de{" "}
{metadata.totalEmployeeCount}, ce qui représente {validPourcentageRounded}%.
</b>
</i>
);
}

export const Indicateur1Note = ({ computer, isValid, simple, noBorder }: Props) => {
let computed: ComputedResult | null = null;
let isNC = false;
Expand All @@ -32,15 +50,17 @@ export const Indicateur1Note = ({ computer, isValid, simple, noBorder }: Props)
// noop
}

const isNCText = getNCText(computer.getTotalMetadata());

return (
<ClientAnimate>
{isNC ? (
{isNC && isValid ? (
<IndicatorNote
noBorder={noBorder}
note="NC"
size="small"
text="L'indicateur écart de rémunération n'est pas calculable"
legend="L’ensemble des groupes valides (c’est-à-dire comptant au moins 3 femmes et 3 hommes), représentent moins de 40% des effectifs"
legend={isNCText}
/>
) : (
<>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.text-orange {
color: var(--orange-terre-battue-main-645);
}
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ export const getCommonBodyColumns = ({
};
}
if (womenCount < 3 && menCount < 3) {
console.log("test");
return {
cols,
mergedLabel: "Non pris en compte car moins de 3 femmes / hommes",
Expand Down
Loading