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

Release 09/01/2025 #622

Merged
merged 26 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
2d4e446
Add files via upload
marievacherot Dec 18, 2024
501c885
feat(admin_subscription): mandatory way of heard field
gaspard-lonchampt Dec 18, 2024
05231db
feat(admin,subscribe): refacto wayHeardOfMobilic
tristan-gueguen Dec 23, 2024
447a6c1
feat(control_history): change control depth history
gaspard-lonchampt Dec 27, 2024
8a5cf13
Merge pull request #615 from MTES-MCT/feat/control_history_change_dep…
tristan-gueguen Jan 2, 2025
ce1dc43
Merge pull request #612 from MTES-MCT/feat/mandatory_way_of_heard_whe…
tristan-gueguen Jan 2, 2025
b14a562
Merge pull request #611 from MTES-MCT/marievacherot-patch-1
tristan-gueguen Jan 2, 2025
a96df51
fix(partners): chronodrive logo in interfaced-logos
tristan-gueguen Jan 2, 2025
5c0c1e4
fix(signup-admin): fixed error message empty how did you know
tristan-gueguen Jan 2, 2025
64f70d1
feat(signup): show webinars at end of account creation
tristan-gueguen Jan 2, 2025
c94ad82
fix(signup): fixed bug employee cannot create account - wayHeardOfMob…
tristan-gueguen Jan 2, 2025
c504338
refacto: one page container component
tristan-gueguen Jan 3, 2025
769e107
feat(homologation-securite): create page, responsive images
tristan-gueguen Jan 3, 2025
6943c30
fix(signin): same error message wayHeardOfMobilic
tristan-gueguen Jan 6, 2025
62d3fe5
feat(components): numeric input component
tristan-gueguen Jan 6, 2025
366a984
feat(company): collect and send nbWorkers when creating company/ies
tristan-gueguen Jan 6, 2025
85e79ab
Merge pull request #616 from MTES-MCT/feat/webinars-end-of-account-cr…
tristan-gueguen Jan 7, 2025
c48f65b
Merge pull request #618 from MTES-MCT/feat/homologation-securite
tristan-gueguen Jan 7, 2025
5779ebb
fix(nbWorkers): invert logic disable button
tristan-gueguen Jan 7, 2025
2d16457
Merge pull request #619 from MTES-MCT/feat/company-number-workers
tristan-gueguen Jan 7, 2025
6e1e8d3
fix(controls): rewording controller information sentence
tristan-gueguen Jan 8, 2025
cd4f5b5
fix(accreditation): fixed 2nd paragraph, add ovh link
tristan-gueguen Jan 8, 2025
811db6e
fix(footer): new name ministere
tristan-gueguen Jan 8, 2025
7b3beec
fix(accessibility): new name ministere
tristan-gueguen Jan 8, 2025
8f006cc
fix(privacy-policy): new name ministere
tristan-gueguen Jan 8, 2025
720534d
Merge pull request #620 from MTES-MCT/fix/ministere-new-name
sandrica89 Jan 9, 2025
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
50 changes: 50 additions & 0 deletions common/assets/images/interfaced-logos/Chronodrive.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions common/utils/apiQueries.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,13 +188,15 @@ export const COMPANY_SIGNUP_MUTATION = gql`
$usualName: String!
$phoneNumber: String
$businessType: String
$nbWorkers: Int
) {
signUp {
company(
siren: $siren
usualName: $usualName
phoneNumber: $phoneNumber
businessType: $businessType
nbWorkers: $nbWorkers
) {
employment {
id
Expand Down
2 changes: 1 addition & 1 deletion web/common/AlertEmailDelay.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const AlertEmailDelay = () => {
<Notice
sx={{ marginY: 2 }}
style={{ paddingBottom: 0 }}
type="warning"
type="info"
description={
<>
Il est possible que&nbsp;:
Expand Down
1 change: 1 addition & 0 deletions web/common/ButtonGoHome.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const ButtonGoHome = () => {
onClick={() => {
history.push("/home");
}}
style={{ margin: "auto" }}
>
Aller dans mon espace
</Button>
Expand Down
162 changes: 83 additions & 79 deletions web/common/WayHeardOfMobilic.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
import Box from "@mui/material/Box";
import Typography from "@mui/material/Typography";
import RadioGroup from "@mui/material/RadioGroup";
import Grid from "@mui/material/Grid";
import FormControlLabel from "@mui/material/FormControlLabel";
import Radio from "@mui/material/Radio";
import TextField from "@mui/material/TextField";
import React from "react";
import { makeStyles } from "@mui/styles";
import { RadioButtons } from "@codegouvfr/react-dsfr/RadioButtons";
import { Input } from "@codegouvfr/react-dsfr/Input";
import { MandatorySuffix } from "./forms/MandatorySuffix";

export const WAY_HEARD_OF_MOBILIC_CHOICES = [
{
Expand Down Expand Up @@ -41,81 +36,90 @@ export const WAY_HEARD_OF_MOBILIC_CHOICES = [

export const HEARD_OF_MOBILIC_OTHER_VALUE = "OTHER";

const useStyles = makeStyles(theme => ({
wayKnowingMobilicSection: {
textAlign: "left",
marginTop: theme.spacing(2),
marginBottom: theme.spacing(2),
color: theme.palette.grey[700]
},
wayKnowingMobilicTitle: {
marginBottom: theme.spacing(1)
}
}));
export function WayHeardOfMobilic({
setWayHeardOfMobilic,
touched = false,
required
}) {
const [selectValue, setSelectValue] = React.useState("");
const [otherValue, setOtherValue] = React.useState("");

export const WayHeardOfMobilic = ({ setWayHeardOfMobilicValue }) => {
const classes = useStyles();
const [wayHeardOfMobilicSelect, setWayHeardOfMobilicSelect] = React.useState(
""
const selectError = React.useMemo(() => touched && !selectValue, [
selectValue,
touched
]);

const otherError = React.useMemo(
() =>
touched && selectValue === HEARD_OF_MOBILIC_OTHER_VALUE && !otherValue,
[touched, selectValue, otherValue]
);

const handleChangeWayHeardOfMobilic = event => {
setWayHeardOfMobilicSelect(event.target.value);
setWayHeardOfMobilicValue(event.target.value);
React.useEffect(() => {
setWayHeardOfMobilic(
selectValue === HEARD_OF_MOBILIC_OTHER_VALUE ? otherValue : selectValue
);
}, [selectValue, otherValue]);

React.useEffect(() => {
if (selectValue !== HEARD_OF_MOBILIC_OTHER_VALUE) {
setOtherValue("");
}
}, [selectValue]);

const handleRadioChange = event => {
const newValue = event.target.value;
setSelectValue(newValue);
};

const handleOtherInputChange = event => {
const value = event.target.value.trimStart();
setOtherValue(value);
};

return (
<Box className={classes.wayKnowingMobilicSection}>
<Typography className={classes.wayKnowingMobilicTitle}>
Comment avez-vous connu Mobilic ?
</Typography>
<RadioGroup
aria-label="how-did-you-know-mobilic"
name="controlled-radio-buttons-group"
value={wayHeardOfMobilicSelect}
onChange={handleChangeWayHeardOfMobilic}
>
<Grid container rowSpacing={2}>
{WAY_HEARD_OF_MOBILIC_CHOICES.map(choice => (
<Grid item xs={12} sm={6} key={choice.value}>
<FormControlLabel
value={choice.value}
control={<Radio size={"small"} />}
label={choice.label}
/>
</Grid>
))}
<Grid item xs={12} sm={6}>
<FormControlLabel
key={HEARD_OF_MOBILIC_OTHER_VALUE}
control={
<Radio
size={"small"}
value={HEARD_OF_MOBILIC_OTHER_VALUE}
color="primary"
label="Autre"
/>
}
label={
wayHeardOfMobilicSelect === HEARD_OF_MOBILIC_OTHER_VALUE ? (
<TextField
label="Précisez"
variant="standard"
inputProps={{
maxLength: 250
}}
onChange={e => {
setWayHeardOfMobilicValue(e.target.value.trimStart());
}}
/>
) : (
"Autre"
)
}
/>
</Grid>
</Grid>
</RadioGroup>
</Box>
<>
<RadioButtons
legend={
<>
Comment avez-vous connu Mobilic ? <MandatorySuffix />
</>
}
options={[
...WAY_HEARD_OF_MOBILIC_CHOICES.map(choice => ({
value: choice.value,
label: choice.label,
nativeInputProps: { value: choice.value }
})),
{
value: HEARD_OF_MOBILIC_OTHER_VALUE,
label: "Autre",
nativeInputProps: { value: HEARD_OF_MOBILIC_OTHER_VALUE }
}
]}
value={selectValue}
required={required}
state={selectError ? "error" : "default"}
stateRelatedMessage={
selectError ? "Veuillez compléter ce champ" : undefined
}
onChange={handleRadioChange}
/>
{selectValue === HEARD_OF_MOBILIC_OTHER_VALUE && (
<Input
label="Précisez"
nativeInputProps={{
value: otherValue,
onChange: handleOtherInputChange,
maxLength: 250
}}
state={otherError ? "error" : "default"}
stateRelatedMessage={
otherError ? "Veuillez compléter ce champ" : undefined
}
required={required}
/>
)}
</>
);
};
}
63 changes: 63 additions & 0 deletions web/common/forms/NumericInput.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import React from "react";
import { Input } from "./Input";

export const NumericInput = ({
initialValue,
onChangeValue,
label,
required = false,
min = 0,
max
}) => {
const [value, setValue] = React.useState(initialValue);
const [touched, setTouched] = React.useState(false);
const state = React.useMemo(
() => (touched && (value < min || value > max) ? "error" : "default"),
[touched, min, max, value]
);
React.useEffect(() => {
onChangeValue(value);
}, [value]);
const errorMessage = React.useMemo(() => {
if (!touched) {
return "";
}
if (!max || isNaN(parseInt(max))) {
return `Veuillez entrer une valeur supérieure à ${min}`;
}
return `Veuillez entrer une valeur comprise entre ${min} et ${max}`;
}, [touched, min, max, value]);

const handleChange = event => {
const inputValue = event.target.value;
if (!inputValue) {
setValue(inputValue);
}

const parsedValue = parseInt(inputValue);

if (!isNaN(parsedValue)) {
setValue(parsedValue);
} else {
event.target.value = value;
}
};

return (
<Input
label={label}
required={required}
nativeInputProps={{
value: value,
onInput: handleChange,
inputMode: "numeric",
pattern: "[0-9]*",
type: "number",
onBlur: () => setTouched(true)
}}
type="number"
state={state}
stateRelatedMessage={errorMessage}
/>
);
};
8 changes: 8 additions & 0 deletions web/common/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import { FranceConnectCallback } from "../signup/FranceConnectCallback";
import { Invite } from "../signup/invite";
import Signup from "../signup/root";
import { SignupSelection } from "../signup/SignupSelection";
import { SecurityAccreditation } from "../landing/accreditation";

function UserReadRedirect() {
const { token } = useParams();
Expand Down Expand Up @@ -204,6 +205,13 @@ export const ROUTES = [
component: <Accessibility />,
menuItemFilter: () => false
},
{
path: "/security-accreditation",
label: "Sécurité",
accessible: () => true,
component: <SecurityAccreditation />,
menuItemFilter: () => false
},
{
path: "/legal-notices",
label: "Mentions légales",
Expand Down
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
Loading
Loading