@movalib/movalib-commons 1.1.35 → 1.1.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/devIndex.tsx CHANGED
@@ -12,7 +12,7 @@ import { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFns';
12
12
  import DatePicker from '@mui/lab/DatePicker';
13
13
  import frLocale from 'date-fns/locale/fr';
14
14
  import QRCode from './src/QRCode';
15
- import { Box, Button, Container, Typography } from '@mui/material';
15
+ import { Alert, Box, Button, Container, Typography } from '@mui/material';
16
16
  import GarageService from './src/services/GarageService';
17
17
  import AuthenticationService from './src/services/AuthenticationService';
18
18
  import Logger from './src/helpers/Logger';
@@ -116,6 +116,8 @@ const App = () => {
116
116
 
117
117
 
118
118
  <MovaLogin
119
+ headerText={<><Alert severity='warning' icon={<></>} style={flexCenter} sx={{width:'100%', textTransform: 'none', textAlign: 'center'}}><b>INSCRIPTION GARAGE</b>
120
+ <br /><Typography variant="body2" style={flexCenter} sx={{mt: 1}}>Connexion obligatoire</Typography></Alert></>}
119
121
  darkMode={false}
120
122
  movaAppType={MovaAppType.GARAGE}
121
123
  version="0.1.3"
@@ -126,6 +128,8 @@ const App = () => {
126
128
  } } />
127
129
 
128
130
  <MovaSignUp
131
+ headerText={<><Alert severity='success' icon={<></>} style={flexCenter} sx={{width:'100%', textTransform: 'none', textAlign: 'center'}}>
132
+ <b>NOUVEAU COMPTE UTILISATEUR</b></Alert></>}
129
133
  darkMode={false}
130
134
  movaAppType={MovaAppType.INDIVIDUAL} onSubmit={function (form: MovaLoginForm): void {
131
135
  alert('Form Submitted !');
package/dist/devIndex.js CHANGED
@@ -122,11 +122,11 @@ var App = function () {
122
122
  };
123
123
  return ((0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(LocalizationProvider_1.LocalizationProvider, __assign({ dateAdapter: AdapterDateFns_1.AdapterDateFns, adapterLocale: fr_1.default }, { children: (0, jsx_runtime_1.jsxs)(styles_1.ThemeProvider, __assign({ theme: theme_1.default }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Box, __assign({ sx: { mb: 4 } }, { children: [(0, jsx_runtime_1.jsx)(material_1.Container, __assign({ style: Tools_1.flexCenter, sx: { width: '400px', mt: 2 } }, { children: (0, jsx_runtime_1.jsx)(VehiclePlateField_1.default, { onValidVehiclePlate: function (vehiclePlate) {
124
124
  alert('plaque valide');
125
- } }) })), (0, jsx_runtime_1.jsx)(MovaLogin_1.default, { darkMode: false, movaAppType: Enums_1.MovaAppType.GARAGE, version: "0.1.3", onSubmit: function (form) {
125
+ } }) })), (0, jsx_runtime_1.jsx)(MovaLogin_1.default, { headerText: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsxs)(material_1.Alert, __assign({ severity: 'warning', icon: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {}), style: Tools_1.flexCenter, sx: { width: '100%', textTransform: 'none', textAlign: 'center' } }, { children: [(0, jsx_runtime_1.jsx)("b", { children: "INSCRIPTION GARAGE" }), (0, jsx_runtime_1.jsx)("br", {}), (0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ variant: "body2", style: Tools_1.flexCenter, sx: { mt: 1 } }, { children: "Connexion obligatoire" }))] })) }), darkMode: false, movaAppType: Enums_1.MovaAppType.GARAGE, version: "0.1.3", onSubmit: function (form) {
126
126
  alert('Form Submitted !');
127
127
  }, onSubmitForgotPassword: function (email) {
128
128
  throw new Error('Function not implemented.');
129
- } }), (0, jsx_runtime_1.jsx)(MovaSignUp_1.default, { darkMode: false, movaAppType: Enums_1.MovaAppType.INDIVIDUAL, onSubmit: function (form) {
129
+ } }), (0, jsx_runtime_1.jsx)(MovaSignUp_1.default, { headerText: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(material_1.Alert, __assign({ severity: 'success', icon: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {}), style: Tools_1.flexCenter, sx: { width: '100%', textTransform: 'none', textAlign: 'center' } }, { children: (0, jsx_runtime_1.jsx)("b", { children: "NOUVEAU COMPTE UTILISATEUR" }) })) }), darkMode: false, movaAppType: Enums_1.MovaAppType.INDIVIDUAL, onSubmit: function (form) {
130
130
  alert('Form Submitted !');
131
131
  } }), (0, jsx_runtime_1.jsx)(GaragePLV_1.default, { url: getQRCodeData() }), (0, jsx_runtime_1.jsx)(QRCode_1.default, { data: getQRCodeData(), showDownload: true, size: 400 }), (0, jsx_runtime_1.jsx)("div", { style: { marginTop: '40px' } }), (0, jsx_runtime_1.jsx)("div", __assign({ style: Tools_1.flexCenter }, { children: (0, jsx_runtime_1.jsx)(ScheduleFields_1.default, { schedules: garage === null || garage === void 0 ? void 0 : garage.schedules, size: "small", timePickerStep: 30, onChange: handleScheduleChange }) }))] })), (0, jsx_runtime_1.jsx)(material_1.Box, __assign({ style: Tools_1.flexCenter }, { children: (0, jsx_runtime_1.jsx)(material_1.Button, __assign({ onClick: function () { return setOpenAccountValidation(!openAccountValidation); } }, { children: "Validation de compte" })) })), openAccountValidation && (0, jsx_runtime_1.jsx)(AccountValidation_1.default, { movaAppType: Enums_1.MovaAppType.GARAGE, onSubmit: function (success, message) {
132
132
  throw new Error('Function not implemented.');
@@ -1,4 +1,4 @@
1
- import { FunctionComponent } from "react";
1
+ import { FunctionComponent, ReactNode } from "react";
2
2
  import { AlertColor } from "@mui/material";
3
3
  import { MovaLoginForm } from "./helpers/Types";
4
4
  import { MovaAppType } from "./helpers/Enums";
@@ -19,6 +19,7 @@ interface MovaLoginProps {
19
19
  alertSeverity?: AlertColor;
20
20
  loading?: boolean;
21
21
  version?: string;
22
+ headerText?: ReactNode;
22
23
  }
23
24
  /**
24
25
  * Formulaire d'authentification Movalib (Garage / Utilisateur)
@@ -85,7 +85,7 @@ var initialFormState = {
85
85
  * ATTENTION : la page attendue pour le bouton "Créer mon compte" doit pointer vers "/signup"
86
86
  */
87
87
  var MovaLogin = function (_a) {
88
- var loading = _a.loading, movaAppType = _a.movaAppType, onSubmit = _a.onSubmit, onSubmitForgotPassword = _a.onSubmitForgotPassword, _b = _a.darkMode, darkMode = _b === void 0 ? false : _b, alertMessage = _a.alertMessage, alertSeverity = _a.alertSeverity, version = _a.version;
88
+ var loading = _a.loading, movaAppType = _a.movaAppType, onSubmit = _a.onSubmit, onSubmitForgotPassword = _a.onSubmitForgotPassword, _b = _a.darkMode, darkMode = _b === void 0 ? false : _b, alertMessage = _a.alertMessage, alertSeverity = _a.alertSeverity, version = _a.version, headerText = _a.headerText;
89
89
  var _c = (0, react_1.useState)(initialFormState), form = _c[0], setForm = _c[1];
90
90
  var _d = (0, react_1.useState)(""), message = _d[0], setMessage = _d[1];
91
91
  var theme = (0, material_1.useTheme)();
@@ -179,7 +179,7 @@ var MovaLogin = function (_a) {
179
179
  display: 'flex',
180
180
  flexDirection: 'column',
181
181
  alignItems: 'center',
182
- } }, { children: [(0, jsx_runtime_1.jsx)("img", { src: getMovaLogo(), style: { width: '80%' } }), (0, jsx_runtime_1.jsx)("br", {})] })), (0, jsx_runtime_1.jsxs)(material_1.Box, __assign({ component: "form", onSubmit: handleSubmit, noValidate: true, sx: { mt: 1 } }, { children: [(0, jsx_runtime_1.jsx)(material_1.TextField, { margin: "normal", required: true, fullWidth: true, id: "email", label: "Adresse email", name: "email", autoComplete: "email", autoFocus: true, onChange: function (e) { return handleInputChange(e); }, value: form.email.value, error: !form.email.isValid, helperText: form.email.error, sx: {
182
+ } }, { children: [(0, jsx_runtime_1.jsx)("img", { src: getMovaLogo(), style: { width: '80%' } }), headerText && (0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ variant: "button", sx: { pt: 3, width: '100%' } }, { children: headerText })), (0, jsx_runtime_1.jsx)("br", {})] })), (0, jsx_runtime_1.jsxs)(material_1.Box, __assign({ component: "form", onSubmit: handleSubmit, noValidate: true, sx: { mt: 1 } }, { children: [(0, jsx_runtime_1.jsx)(material_1.TextField, { margin: "normal", required: true, fullWidth: true, id: "email", label: "Adresse email", name: "email", autoComplete: "email", autoFocus: true, onChange: function (e) { return handleInputChange(e); }, value: form.email.value, error: !form.email.isValid, helperText: form.email.error, sx: {
183
183
  '& .MuiOutlinedInput-notchedOutline': {
184
184
  borderColor: darkMode ? 'white' : 'default', // Couleur de la bordure
185
185
  }
@@ -1,4 +1,4 @@
1
- import { FunctionComponent } from "react";
1
+ import { FunctionComponent, ReactNode } from "react";
2
2
  import { AlertColor } from "@mui/material";
3
3
  import { MovaUserSignUpForm } from "./helpers/Types";
4
4
  import { MovaAppType } from "./helpers/Enums";
@@ -17,6 +17,7 @@ interface MovaSignUpProps {
17
17
  alertMessage?: string;
18
18
  alertSeverity?: AlertColor;
19
19
  loading?: boolean;
20
+ headerText?: ReactNode;
20
21
  }
21
22
  /**
22
23
  * Formulaire de création d'un compte Movalib (Garage / Utilisateur)
@@ -70,6 +70,7 @@ var react_router_dom_1 = require("react-router-dom");
70
70
  var InputAdornment_1 = __importDefault(require("@mui/material/InputAdornment"));
71
71
  var Visibility_1 = __importDefault(require("@mui/icons-material/Visibility"));
72
72
  var VisibilityOff_1 = __importDefault(require("@mui/icons-material/VisibilityOff"));
73
+ var Info_1 = __importDefault(require("@mui/icons-material/Info"));
73
74
  var isValid_1 = __importDefault(require("date-fns/isValid"));
74
75
  // Permet de centrer le contenu de l'application
75
76
  var styles = {
@@ -93,12 +94,14 @@ var initialUserFormState = {
93
94
  */
94
95
  var MovaLogin = function (_a) {
95
96
  var _b, _c, _d;
96
- var loading = _a.loading, movaAppType = _a.movaAppType, onSubmit = _a.onSubmit, _e = _a.darkMode, darkMode = _e === void 0 ? false : _e, alertMessage = _a.alertMessage, alertSeverity = _a.alertSeverity;
97
+ var loading = _a.loading, movaAppType = _a.movaAppType, onSubmit = _a.onSubmit, _e = _a.darkMode, darkMode = _e === void 0 ? false : _e, alertMessage = _a.alertMessage, alertSeverity = _a.alertSeverity, headerText = _a.headerText;
97
98
  var _f = (0, react_1.useState)(initialUserFormState), userForm = _f[0], setUserForm = _f[1];
98
99
  var history = (0, react_router_dom_1.useHistory)();
99
100
  var _g = (0, react_1.useState)(""), message = _g[0], setMessage = _g[1];
100
101
  var theme = (0, material_1.useTheme)();
101
102
  var _h = (0, react_1.useState)(false), showPassword = _h[0], setShowPassword = _h[1];
103
+ var _j = (0, react_1.useState)(false), openEmailInfo = _j[0], setOpenEmailInfo = _j[1];
104
+ var _k = (0, react_1.useState)(false), openPhoneNumberInfo = _k[0], setOpenPhoneNumberInfo = _k[1];
102
105
  var handleDateChange = function (name, date) {
103
106
  var _a;
104
107
  if (name && date) {
@@ -218,7 +221,7 @@ var MovaLogin = function (_a) {
218
221
  display: 'flex',
219
222
  flexDirection: 'column',
220
223
  alignItems: 'center',
221
- } }, { children: [(0, jsx_runtime_1.jsx)("img", { src: getMovaLogo(), style: { width: '60%' } }), (0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ variant: "button", sx: { pt: 2 } }, { children: "Nouveau compte utilisateur" }))] })), (0, jsx_runtime_1.jsxs)(material_1.Box, __assign({ component: "form", onSubmit: handleSubmit, noValidate: true, sx: { mt: 1 } }, { children: [(0, jsx_runtime_1.jsx)(material_1.TextField, { margin: "normal", required: true, autoFocus: true, fullWidth: true, id: "firstname", label: "Pr\u00E9nom", name: "firstname", autoComplete: "given-name", onChange: function (e) { return handleInputChange(e); }, value: userForm.firstname.value, error: Boolean(userForm.firstname.error), helperText: userForm.firstname.error, sx: {
224
+ } }, { children: [(0, jsx_runtime_1.jsx)("img", { src: getMovaLogo(), style: { width: '60%' } }), headerText && (0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ variant: "button", sx: { pt: 3, width: '100%' } }, { children: headerText }))] })), (0, jsx_runtime_1.jsxs)(material_1.Box, __assign({ component: "form", onSubmit: handleSubmit, noValidate: true, sx: { mt: 2 } }, { children: [(0, jsx_runtime_1.jsx)(material_1.TextField, { margin: "normal", required: true, autoFocus: true, fullWidth: true, id: "firstname", label: "Pr\u00E9nom", name: "firstname", autoComplete: "given-name", onChange: function (e) { return handleInputChange(e); }, value: userForm.firstname.value, error: Boolean(userForm.firstname.error), helperText: userForm.firstname.error, sx: {
222
225
  '& .MuiOutlinedInput-notchedOutline': {
223
226
  borderColor: darkMode ? 'white' : 'default', // Couleur de la bordure
224
227
  }
@@ -226,11 +229,15 @@ var MovaLogin = function (_a) {
226
229
  '& .MuiOutlinedInput-notchedOutline': {
227
230
  borderColor: darkMode ? 'white' : 'default', // Couleur de la bordure
228
231
  }
229
- } }), (0, jsx_runtime_1.jsx)(material_1.TextField, { type: "tel", margin: "normal", required: true, fullWidth: true, id: "phoneNumber", label: "N\u00B0 de t\u00E9l\u00E9phone", name: "phoneNumber", autoComplete: "tel", onChange: function (e) { return handleInputChange(e); }, value: (_b = userForm.phoneNumber) === null || _b === void 0 ? void 0 : _b.value, error: Boolean((_c = userForm.phoneNumber) === null || _c === void 0 ? void 0 : _c.error), helperText: (_d = userForm.phoneNumber) === null || _d === void 0 ? void 0 : _d.error }), (0, jsx_runtime_1.jsx)(material_1.TextField, { margin: "normal", required: true, fullWidth: true, id: "email", label: "Adresse email", name: "email", autoComplete: "email", onChange: function (e) { return handleInputChange(e); }, value: userForm.email.value, error: !userForm.email.isValid, helperText: userForm.email.error, sx: {
232
+ } }), (0, jsx_runtime_1.jsx)(material_1.TextField, { type: "tel", margin: "normal", required: true, fullWidth: true, id: "phoneNumber", label: "N\u00B0 de t\u00E9l\u00E9phone", name: "phoneNumber", autoComplete: "tel", onChange: function (e) { return handleInputChange(e); }, value: (_b = userForm.phoneNumber) === null || _b === void 0 ? void 0 : _b.value, error: Boolean((_c = userForm.phoneNumber) === null || _c === void 0 ? void 0 : _c.error), helperText: (_d = userForm.phoneNumber) === null || _d === void 0 ? void 0 : _d.error, InputProps: {
233
+ endAdornment: ((0, jsx_runtime_1.jsx)(InputAdornment_1.default, __assign({ position: "end" }, { children: (0, jsx_runtime_1.jsx)(material_1.IconButton, __assign({ edge: "end", onClick: function () { return setOpenPhoneNumberInfo(!openPhoneNumberInfo); } }, { children: (0, jsx_runtime_1.jsx)(Info_1.default, {}) })) }))),
234
+ } }), openPhoneNumberInfo && (0, jsx_runtime_1.jsx)(material_1.Alert, __assign({ severity: "info", variant: 'standard' }, { children: "Indispensable pour votre garagiste, il doit pouvoir vous appeler en cas d'impr\u00E9vu avec votre v\u00E9hicule." })), (0, jsx_runtime_1.jsx)(material_1.TextField, { margin: "normal", required: true, fullWidth: true, id: "email", label: "Adresse email", name: "email", autoComplete: "email", onChange: function (e) { return handleInputChange(e); }, value: userForm.email.value, error: !userForm.email.isValid, helperText: userForm.email.error, sx: {
230
235
  '& .MuiOutlinedInput-notchedOutline': {
231
236
  borderColor: darkMode ? 'white' : 'default', // Couleur de la bordure
232
237
  }
233
- } }), (0, jsx_runtime_1.jsx)(material_1.TextField, { margin: "normal", required: true, fullWidth: true, name: "password", label: "Mot de passe", type: showPassword ? 'text' : 'password', id: "password", autoComplete: "current-password", onChange: function (e) { return handleInputChange(e); }, value: userForm.password.value, error: !userForm.password.isValid, helperText: Boolean(userForm.password.error) ? userForm.password.error : "10 caractères minimum, 1 majuscule, 1 minuscule", InputProps: {
238
+ }, InputProps: {
239
+ endAdornment: ((0, jsx_runtime_1.jsx)(InputAdornment_1.default, __assign({ position: "end" }, { children: (0, jsx_runtime_1.jsx)(material_1.IconButton, __assign({ edge: "end", onClick: function () { return setOpenEmailInfo(!openEmailInfo); } }, { children: (0, jsx_runtime_1.jsx)(Info_1.default, {}) })) }))),
240
+ } }), openEmailInfo && (0, jsx_runtime_1.jsx)(material_1.Alert, __assign({ severity: "info", variant: 'standard' }, { children: "Et si on arr\u00EAtait le papier ? En plus de pouvoir vous notifier, l'email vous permet de recevoir tous vos documents au format num\u00E9rique \uD83D\uDE0A\uD83C\uDF3F" })), (0, jsx_runtime_1.jsx)(material_1.TextField, { margin: "normal", required: true, fullWidth: true, name: "password", label: "Mot de passe", type: showPassword ? 'text' : 'password', id: "password", autoComplete: "current-password", onChange: function (e) { return handleInputChange(e); }, value: userForm.password.value, error: !userForm.password.isValid, helperText: Boolean(userForm.password.error) ? userForm.password.error : "10 caractères minimum, 1 majuscule, 1 minuscule", InputProps: {
234
241
  endAdornment: ((0, jsx_runtime_1.jsx)(InputAdornment_1.default, __assign({ position: "end" }, { children: (0, jsx_runtime_1.jsx)(material_1.IconButton, __assign({ edge: "end", onClick: handleClickShowPassword }, { children: showPassword ? (0, jsx_runtime_1.jsx)(VisibilityOff_1.default, {}) : (0, jsx_runtime_1.jsx)(Visibility_1.default, {}) })) }))),
235
242
  }, sx: {
236
243
  '& .MuiOutlinedInput-notchedOutline': {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@movalib/movalib-commons",
3
- "version": "1.1.35",
3
+ "version": "1.1.36",
4
4
  "description": "Bibliothèque d'objets communs à l'ensemble des projets React de Movalib",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/MovaLogin.tsx CHANGED
@@ -1,4 +1,4 @@
1
- import { CSSProperties, FormEvent, FunctionComponent, useState } from "react";
1
+ import { CSSProperties, FormEvent, FunctionComponent, ReactNode, useState } from "react";
2
2
  import { LoadingButton } from '@mui/lab';
3
3
  import LogoLarge from './assets/images/logo/logo_large_border.png';
4
4
  import LogoProLarge from './assets/images/logo/logo_pro_large_border.png';
@@ -12,7 +12,7 @@ import MovaCopyright from "./MovaCopyright";
12
12
  import { MovaLoginForm, MovaFormField } from "./helpers/Types";
13
13
  import { MovaAppType } from "./helpers/Enums";
14
14
  import { validateEmail } from "./helpers/Validator";
15
- import { validateField } from "./helpers/Tools";
15
+ import { flexCenter, validateField } from "./helpers/Tools";
16
16
  import { useHistory } from "react-router-dom";
17
17
  import InputAdornment from '@mui/material/InputAdornment';
18
18
  import Visibility from '@mui/icons-material/Visibility';
@@ -48,6 +48,7 @@ interface MovaLoginProps {
48
48
  alertSeverity?: AlertColor,
49
49
  loading?: boolean,
50
50
  version?: string
51
+ headerText?: ReactNode
51
52
  }
52
53
 
53
54
  /**
@@ -55,7 +56,8 @@ interface MovaLoginProps {
55
56
  * ATTENTION : la page attendue pour le bouton "Mot de passe oublié" doit pointer vers "/forgot-password"
56
57
  * ATTENTION : la page attendue pour le bouton "Créer mon compte" doit pointer vers "/signup"
57
58
  */
58
- const MovaLogin: FunctionComponent<MovaLoginProps> = ({ loading, movaAppType, onSubmit, onSubmitForgotPassword, darkMode = false, alertMessage, alertSeverity, version }) => {
59
+ const MovaLogin: FunctionComponent<MovaLoginProps> = ({ loading, movaAppType, onSubmit, onSubmitForgotPassword, darkMode = false, alertMessage,
60
+ alertSeverity, version, headerText }) => {
59
61
 
60
62
  const [form, setForm] = useState<MovaLoginForm>(initialFormState);
61
63
  const [message, setMessage] = useState<string>("");
@@ -213,6 +215,7 @@ const MovaLogin: FunctionComponent<MovaLoginProps> = ({ loading, movaAppType, on
213
215
  }}
214
216
  >
215
217
  <img src={getMovaLogo()} style={{width:'80%'}}/>
218
+ {headerText && <Typography variant="button" sx={{ pt: 3, width:'100%' }}>{headerText}</Typography>}
216
219
  <br />
217
220
  </Box>
218
221
 
@@ -1,4 +1,4 @@
1
- import { CSSProperties, ChangeEvent, FormEvent, FunctionComponent, useState } from "react";
1
+ import { CSSProperties, ChangeEvent, FormEvent, FunctionComponent, ReactNode, useState } from "react";
2
2
  import { LoadingButton } from '@mui/lab';
3
3
  import { DatePicker } from '@mui/x-date-pickers/DatePicker';
4
4
  import LogoLarge from './assets/images/logo/logo_large_border.png';
@@ -19,6 +19,7 @@ import { useHistory } from "react-router-dom";
19
19
  import InputAdornment from '@mui/material/InputAdornment';
20
20
  import Visibility from '@mui/icons-material/Visibility';
21
21
  import VisibilityOff from '@mui/icons-material/VisibilityOff';
22
+ import InfoIcon from '@mui/icons-material/Info';
22
23
  import isValid from 'date-fns/isValid';
23
24
 
24
25
  // Permet de centrer le contenu de l'application
@@ -53,20 +54,23 @@ interface MovaSignUpProps {
53
54
  darkMode?: boolean,
54
55
  alertMessage?: string,
55
56
  alertSeverity?: AlertColor,
56
- loading?: boolean
57
+ loading?: boolean,
58
+ headerText?: ReactNode
57
59
  }
58
60
 
59
61
  /**
60
62
  * Formulaire de création d'un compte Movalib (Garage / Utilisateur)
61
63
  * ATTENTION : le lien de consultation des CGU doit pointer vers "/terms-and-conditions"
62
64
  */
63
- const MovaLogin: FunctionComponent<MovaSignUpProps> = ({ loading, movaAppType, onSubmit, darkMode = false, alertMessage, alertSeverity }) => {
65
+ const MovaLogin: FunctionComponent<MovaSignUpProps> = ({ loading, movaAppType, onSubmit, darkMode = false, alertMessage, alertSeverity, headerText }) => {
64
66
 
65
67
  const [userForm, setUserForm] = useState<MovaUserSignUpForm>(initialUserFormState);
66
68
  const history = useHistory();
67
69
  const [message, setMessage] = useState<string>("");
68
70
  const theme = useTheme();
69
71
  const [showPassword, setShowPassword] = useState(false);
72
+ const [openEmailInfo, setOpenEmailInfo] = useState(false);
73
+ const [openPhoneNumberInfo, setOpenPhoneNumberInfo] = useState(false);
70
74
 
71
75
  const handleDateChange = (name: string, date: Date | null) => {
72
76
 
@@ -217,10 +221,10 @@ const MovaLogin: FunctionComponent<MovaSignUpProps> = ({ loading, movaAppType, o
217
221
  }}
218
222
  >
219
223
  <img src={getMovaLogo()} style={{width:'60%'}}/>
220
- <Typography variant="button" sx={{ pt: 2 }}>Nouveau compte utilisateur</Typography>
224
+ {headerText && <Typography variant="button" sx={{ pt: 3, width:'100%' }}>{headerText}</Typography>}
221
225
  </Box>
222
226
 
223
- <Box component="form" onSubmit={handleSubmit} noValidate sx={{ mt: 1 }}>
227
+ <Box component="form" onSubmit={handleSubmit} noValidate sx={{ mt: 2 }}>
224
228
  <TextField
225
229
  margin="normal"
226
230
  required
@@ -271,7 +275,19 @@ const MovaLogin: FunctionComponent<MovaSignUpProps> = ({ loading, movaAppType, o
271
275
  value={userForm.phoneNumber?.value}
272
276
  error={Boolean(userForm.phoneNumber?.error)}
273
277
  helperText={userForm.phoneNumber?.error}
278
+ InputProps={{
279
+ endAdornment: (
280
+ <InputAdornment position="end">
281
+ <IconButton
282
+ edge="end"
283
+ onClick={() => setOpenPhoneNumberInfo(!openPhoneNumberInfo)}
284
+ ><InfoIcon />
285
+ </IconButton>
286
+ </InputAdornment>
287
+ ),
288
+ }}
274
289
  />
290
+ {openPhoneNumberInfo && <Alert severity="info" variant='standard'>Indispensable pour votre garagiste, il doit pouvoir vous appeler en cas d'imprévu avec votre véhicule.</Alert>}
275
291
  <TextField
276
292
  margin="normal"
277
293
  required
@@ -289,7 +305,18 @@ const MovaLogin: FunctionComponent<MovaSignUpProps> = ({ loading, movaAppType, o
289
305
  borderColor: darkMode ? 'white' : 'default', // Couleur de la bordure
290
306
  }
291
307
  }}
292
- />
308
+ InputProps={{
309
+ endAdornment: (
310
+ <InputAdornment position="end">
311
+ <IconButton
312
+ edge="end"
313
+ onClick={() => setOpenEmailInfo(!openEmailInfo)}
314
+ ><InfoIcon />
315
+ </IconButton>
316
+ </InputAdornment>
317
+ ),
318
+ }}
319
+ />{openEmailInfo && <Alert severity="info" variant='standard'>Et si on arrêtait le papier ? En plus de pouvoir vous notifier, l'email vous permet de recevoir tous vos documents au format numérique 😊🌿</Alert>}
293
320
  <TextField
294
321
  margin="normal"
295
322
  required