diff --git a/common/assets/styles/Charts.scss b/common/assets/styles/Charts.scss
new file mode 100644
index 000000000..560c995d8
--- /dev/null
+++ b/common/assets/styles/Charts.scss
@@ -0,0 +1,16 @@
+.alerts-chart {
+ .recharts-legend-item-text {
+ font-size: 0.75rem;
+ color: var(--background-flat-grey) !important;
+ font-weight: 700;
+ }
+ .inner-text {
+ font-weight: 400;
+ font-size: 2rem;
+ }
+}
+
+.fr-tile.alerts-chart {
+ padding-left: 0px;
+ padding-right: 0px;
+}
\ No newline at end of file
diff --git a/common/assets/styles/root.scss b/common/assets/styles/root.scss
index 8e538dea7..d8f062fc1 100644
--- a/common/assets/styles/root.scss
+++ b/common/assets/styles/root.scss
@@ -3,6 +3,8 @@
@use 'Notice.scss';
@use 'Accordion.scss';
@use 'Certificate.scss';
+@use 'Charts.scss';
+
.flex-column {
display: flex !important;
diff --git a/web/admin/panels/RegulatoryRespect/Chart.js b/web/admin/panels/RegulatoryRespect/Chart.js
new file mode 100644
index 000000000..1eeac9f85
--- /dev/null
+++ b/web/admin/panels/RegulatoryRespect/Chart.js
@@ -0,0 +1,74 @@
+import React from "react";
+import {
+ Legend,
+ Pie,
+ PieChart,
+ ResponsiveContainer,
+ Tooltip,
+ Sector
+} from "recharts";
+const renderActiveShape = ({
+ cx,
+ cy,
+ innerRadius,
+ outerRadius,
+ startAngle,
+ endAngle,
+ fill,
+ payload
+}) => {
+ return (
+
+
+ {payload.value}
+
+
+
+
+ );
+};
+
+export const Chart = ({ data }) => {
+ return (
+
+
+
+ null} />
+
+
+
+ );
+};
diff --git a/web/admin/panels/RegulatoryRespect/RegulatoryRespectChart.js b/web/admin/panels/RegulatoryRespect/RegulatoryRespectChart.js
index 2acf918ad..2d3dfe358 100644
--- a/web/admin/panels/RegulatoryRespect/RegulatoryRespectChart.js
+++ b/web/admin/panels/RegulatoryRespect/RegulatoryRespectChart.js
@@ -1,5 +1,97 @@
-import React from "react";
+import React, { useState } from "react";
+import { Box, Typography } from "@mui/material";
+import { useRegulatoryAlertsSummaryContext } from "../../utils/contextRegulatoryAlertsSummary";
+import { SegmentedControl } from "@codegouvfr/react-dsfr/SegmentedControl";
+import { Table } from "@codegouvfr/react-dsfr/Table";
+import { Chart } from "./Chart";
-export const Chart = () => {
- return null;
+const ALERTS_DATA = {
+ maximumWorkedDaysInWeek: {
+ label: "Repos hebdomadaire",
+ color: "#81EEF5"
+ },
+ maximumWorkInCalendarWeek: {
+ label: "Durée du travail hebdomadaire",
+ color: "#B478F1"
+ },
+ minimumDailyRest: {
+ label: "Repos journalier",
+ color: "#31A7AE"
+ },
+ not_enough_break: {
+ label: "Temps de pause",
+ color: "#5C68E5"
+ },
+ too_much_uninterrupted_work_time: {
+ label: "Durée maximale de travail ininterrompu",
+ color: "#29598F"
+ },
+ maximumWorkDayTime: {
+ label: "Durée du travail quotidien",
+ color: "#115ADF"
+ }
+};
+
+export const RegulatoryRespectChart = () => {
+ const { summary } = useRegulatoryAlertsSummaryContext();
+ const [selectedView, setSelectedView] = useState("chart");
+ const data = [...summary.dailyAlerts, ...summary.weeklyAlerts]
+ .filter((alert) => alert.alertsType in ALERTS_DATA)
+ .map((alert) => ({
+ name: ALERTS_DATA[alert.alertsType].label,
+ value: alert.nbAlerts,
+ fill: ALERTS_DATA[alert.alertsType].color
+ }))
+ .filter((d) => d.value > 0);
+
+ if (data.length === 0) {
+ return;
+ }
+ return (
+
+
+ Répartition des dépassements de seuils
+
+ {selectedView === "chart" ? (
+
+ ) : (
+
+ [d.name, d.value])}
+ headers={["Alerte", "#"]}
+ />
+
+ )}
+
+ setSelectedView("chart")
+ }
+ },
+ {
+ iconId: "fr-icon-table-line",
+ label: "Tableau",
+ nativeInputProps: {
+ value: "table",
+ onChange: () => setSelectedView("table")
+ }
+ }
+ ]}
+ />
+
+
+ );
};
diff --git a/web/admin/panels/RegulatoryRespect/RegulatoryRespectResults.js b/web/admin/panels/RegulatoryRespect/RegulatoryRespectResults.js
index 01049f8bb..12e4585a6 100644
--- a/web/admin/panels/RegulatoryRespect/RegulatoryRespectResults.js
+++ b/web/admin/panels/RegulatoryRespect/RegulatoryRespectResults.js
@@ -3,14 +3,14 @@ import { makeStyles } from "@mui/styles";
import { fr } from "@codegouvfr/react-dsfr";
import { Stack, Typography } from "@mui/material";
import { SummaryCard } from "./RegulatoryRespectSummaryCard";
-import { Chart } from "./RegulatoryRespectChart";
+import { RegulatoryRespectChart } from "./RegulatoryRespectChart";
import { AlertsRecap } from "./RegulatoryRespectAlertsRecap";
import { useRegulatoryAlertsSummaryContext } from "../../utils/contextRegulatoryAlertsSummary";
const useStyles = makeStyles((theme) => ({
text: {
- color: fr.colors.decisions.background.flat.grey.default,
- },
+ color: fr.colors.decisions.background.flat.grey.default
+ }
}));
export default function RegulatoryRespectResults() {
@@ -30,7 +30,7 @@ export default function RegulatoryRespectResults() {
-
+