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

feat(control_history): change control depth history #615

Merged
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
5 changes: 4 additions & 1 deletion web/control/components/Alerts/InfractionDay.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ import { useControl } from "../../../controller/utils/contextControl";
import { capitalizeFirstLetter } from "common/utils/string";
import classNames from "classnames";

const controlHistoryDepth =
parseInt(process.env.REACT_APP_USER_CONTROL_HISTORY_DEPTH) || 28;

const gregorian_fr = {
name: "gregorian_fr",
months: [
Expand Down Expand Up @@ -74,7 +77,7 @@ export const InfractionDay = ({ alerts, sanction }) => {
]);

const maxDate = new Date(unixToJSTimestamp(controlData.creationTime));
const minDate = addDaysToDate(new Date(maxDate), -28);
const minDate = addDaysToDate(new Date(maxDate), -controlHistoryDepth);

const onSelectedDatesChange = values => {
const selectedTimestamps = values
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@ import { formatDateTime, formatDay } from "common/utils/time";
import { Description } from "../../../common/typography/Description";
import { Stack } from "@mui/material";

const controlHistoryDepth =
process.env.REACT_APP_USER_CONTROL_HISTORY_DEPTH || 28;

export function ControllerControlHistory({ controlTime, tokenInfo }) {
return (
<Stack rowGap={1}>
<>
<Typography variant="h6" component="h2" sx={{ lineHeight: "0.5rem" }}>
Historique récent (28 jours)
Historique récent ({controlHistoryDepth} jours)
</Typography>
<Description noMargin>
Du{" "}
Expand Down
7 changes: 5 additions & 2 deletions web/controller/components/scanQRCode/ControllerScanQRCode.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,9 @@ export function ControllerScanQRCode() {
});
};

const controlHistoryDepth =
process.env.REACT_APP_USER_CONTROL_HISTORY_DEPTH || 28;

return (
<>
<Header />
Expand All @@ -135,8 +138,8 @@ export function ControllerScanQRCode() {
<ControllerBackButton label="Accueil" route="/home" />
<h3 className={classes.titleScan}>Scannez un QR Code Mobilic</h3>
<Typography>
Afin d'accéder à l'historique de 28 jours du salarié, positionnez son
QR Code dans le cadre.
Afin d'accéder à l'historique de {controlHistoryDepth} jours du
salarié, positionnez son QR Code dans le cadre.
</Typography>
<Grid
container
Expand Down
Loading