@movalib/movalib-commons 1.0.66 → 1.0.68
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/.env.development +6 -0
- package/.env.production +4 -0
- package/devIndex.tsx +127 -12
- package/dist/devIndex.js +104 -8
- package/dist/index.d.ts +3 -1
- package/dist/index.js +5 -1
- package/dist/src/MovaLogin.js +11 -2
- package/dist/src/MovaSignUp.d.ts +1 -1
- package/dist/src/MovaSignUp.js +42 -10
- package/dist/src/QRCode.d.ts +1 -0
- package/dist/src/QRCode.js +13 -12
- package/dist/src/ScheduleFields.d.ts +24 -0
- package/dist/src/ScheduleFields.js +202 -0
- package/dist/src/helpers/ApiHelper.d.ts +20 -0
- package/dist/src/helpers/ApiHelper.js +74 -0
- package/dist/src/helpers/CookieUtils.d.ts +6 -0
- package/dist/src/helpers/CookieUtils.js +28 -0
- package/dist/src/helpers/Enums.d.ts +8 -1
- package/dist/src/helpers/Enums.js +10 -2
- package/dist/src/helpers/Tools.d.ts +6 -2
- package/dist/src/helpers/Tools.js +20 -7
- package/dist/src/services/AuthenticationService.d.ts +6 -0
- package/dist/src/services/AuthenticationService.js +106 -0
- package/dist/src/services/GarageService.d.ts +5 -0
- package/dist/src/services/GarageService.js +16 -0
- package/dist/src/services/UserService.d.ts +10 -0
- package/dist/src/services/UserService.js +76 -0
- package/index.ts +3 -1
- package/package.json +9 -7
- package/public/index.html +1 -1
- package/src/MovaLogin.tsx +24 -5
- package/src/MovaSignUp.tsx +71 -15
- package/src/QRCode.css +4 -0
- package/src/QRCode.tsx +12 -13
- package/src/ScheduleFields.tsx +301 -0
- package/src/helpers/ApiHelper.ts +95 -0
- package/src/helpers/CookieUtils.ts +23 -0
- package/src/helpers/Enums.ts +8 -1
- package/src/helpers/Tools.ts +20 -2
- package/src/services/AuthenticationService.ts +68 -0
- package/src/services/GarageService.ts +14 -0
- package/src/services/UserService.ts +25 -0
- package/tsconfig.json +1 -1
- package/webpack.config.js +9 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
|
+
};
|
|
41
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
+
var ApiHelper_1 = require("../helpers/ApiHelper");
|
|
43
|
+
var Enums_1 = require("../helpers/Enums");
|
|
44
|
+
var Logger_1 = __importDefault(require("../helpers/Logger"));
|
|
45
|
+
var UserService = /** @class */ (function () {
|
|
46
|
+
function UserService() {
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* @param email
|
|
50
|
+
* @param password
|
|
51
|
+
* @returns
|
|
52
|
+
*/
|
|
53
|
+
UserService.getCurrentUser = function () {
|
|
54
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
55
|
+
var error_1;
|
|
56
|
+
return __generator(this, function (_a) {
|
|
57
|
+
switch (_a.label) {
|
|
58
|
+
case 0:
|
|
59
|
+
_a.trys.push([0, 2, , 3]);
|
|
60
|
+
return [4 /*yield*/, (0, ApiHelper_1.request)({
|
|
61
|
+
url: "".concat(ApiHelper_1.API_BASE_URL, "/user/me"),
|
|
62
|
+
method: Enums_1.APIMethod.GET
|
|
63
|
+
})];
|
|
64
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
65
|
+
case 2:
|
|
66
|
+
error_1 = _a.sent();
|
|
67
|
+
Logger_1.default.error('Error occurred during getting user:', error_1);
|
|
68
|
+
return [2 /*return*/, Promise.reject(error_1)];
|
|
69
|
+
case 3: return [2 /*return*/];
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
return UserService;
|
|
75
|
+
}());
|
|
76
|
+
exports.default = UserService;
|
package/index.ts
CHANGED
|
@@ -30,11 +30,13 @@ export { default as Event } from './src/models/Event';
|
|
|
30
30
|
export { default as VehicleTire } from './src/models/VehicleTire';
|
|
31
31
|
|
|
32
32
|
// Export des types
|
|
33
|
+
export type { APIRequest, APIResponse } from './src/helpers/ApiHelper';
|
|
33
34
|
export type { MovaFormField, MovaLoginForm, MovaUserSignUpForm, MovaInterval, OriginReference,
|
|
34
35
|
MovaVehicleForm } from './src/helpers/Types';
|
|
35
36
|
|
|
36
37
|
// Export des méthodes utilitaires
|
|
37
|
-
export {
|
|
38
|
+
export { readCookie, deleteCookie } from './src/helpers/CookieUtils';
|
|
39
|
+
export { validateField, formatVehicleTire, formatFrenchVehiclePlate, isEmpty } from './src/helpers/Tools';
|
|
38
40
|
export { validatePhoneNumber, validateText, validateEmail } from './src/helpers/Validator';
|
|
39
41
|
export { formatDateByCountryCode, getLongFormattedDateTime, capitalizeFirstLetter } from './src/helpers/DateUtils';
|
|
40
42
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@movalib/movalib-commons",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.68",
|
|
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",
|
|
@@ -21,19 +21,20 @@
|
|
|
21
21
|
"@mui/icons-material": "^5.11.16",
|
|
22
22
|
"@mui/lab": "^5.0.0-alpha.134",
|
|
23
23
|
"@mui/material": "^5.13.5",
|
|
24
|
+
"@mui/x-date-pickers": "^6.9.1",
|
|
24
25
|
"@types/react": "^18.2.22",
|
|
25
26
|
"@types/react-dom": "^18.2.7",
|
|
26
|
-
"file-loader": "^6.2.0",
|
|
27
|
-
"@types/node": "^16.18.53",
|
|
28
27
|
"@types/react-router-dom": "^5.3.0",
|
|
28
|
+
"date-fns": "^2.29.3",
|
|
29
|
+
"date-fns-tz": "^2.0.0",
|
|
30
|
+
"file-loader": "^6.2.0",
|
|
31
|
+
"js-cookie": "^3.0.5",
|
|
32
|
+
"qr-code-styling": "^1.4.4",
|
|
29
33
|
"react": "^18.2.0",
|
|
30
34
|
"react-dom": "^18.2.0",
|
|
31
35
|
"react-router-dom": "^5.1.2",
|
|
32
36
|
"react-scripts": "5.0.1",
|
|
33
|
-
"
|
|
34
|
-
"typescript": "^4.9.5",
|
|
35
|
-
"date-fns": "^2.29.3",
|
|
36
|
-
"date-fns-tz": "^2.0.0"
|
|
37
|
+
"typescript": "^4.9.5"
|
|
37
38
|
},
|
|
38
39
|
"eslintConfig": {
|
|
39
40
|
"extends": [
|
|
@@ -41,6 +42,7 @@
|
|
|
41
42
|
]
|
|
42
43
|
},
|
|
43
44
|
"devDependencies": {
|
|
45
|
+
"@types/js-cookie": "^3.0.4",
|
|
44
46
|
"html-webpack-plugin": "^5.5.3",
|
|
45
47
|
"ts-loader": "^9.4.4",
|
|
46
48
|
"webpack-cli": "^5.1.4"
|
package/public/index.html
CHANGED
package/src/MovaLogin.tsx
CHANGED
|
@@ -5,13 +5,16 @@ import LogoProLarge from './assets/images/logo/logo_pro_large.png';
|
|
|
5
5
|
import GreenLeafImage from "./assets/images/leaf_green_large.png";
|
|
6
6
|
import PinkLeafImage from "./assets/images/leaf_pink_large.png";
|
|
7
7
|
import { Alert, AlertColor, Box, Button, Checkbox, Container, CssBaseline, Dialog, DialogActions, DialogContent, DialogContentText,
|
|
8
|
-
DialogTitle, FormControlLabel, Grid, Link, TextField } from "@mui/material";
|
|
8
|
+
DialogTitle, FormControlLabel, Grid, IconButton, Link, TextField } from "@mui/material";
|
|
9
9
|
import MovaCopyright from "./MovaCopyright";
|
|
10
10
|
import { MovaLoginForm, MovaFormField } from "./helpers/Types";
|
|
11
11
|
import { MovaAppType } from "./helpers/Enums";
|
|
12
12
|
import { validateEmail } from "./helpers/Validator";
|
|
13
13
|
import { validateField } from "./helpers/Tools";
|
|
14
14
|
import { useHistory } from "react-router-dom";
|
|
15
|
+
import InputAdornment from '@mui/material/InputAdornment';
|
|
16
|
+
import Visibility from '@mui/icons-material/Visibility';
|
|
17
|
+
import VisibilityOff from '@mui/icons-material/VisibilityOff';
|
|
15
18
|
|
|
16
19
|
// Permet de centrer le contenu de l'application
|
|
17
20
|
const styles: CSSProperties = {
|
|
@@ -54,6 +57,7 @@ const MovaLogin: FunctionComponent<MovaLoginProps> = ({ loading, movaAppType, on
|
|
|
54
57
|
const [message, setMessage] = useState<string>("");
|
|
55
58
|
const history = useHistory();
|
|
56
59
|
const [openForgotPassword, setOpenForgotPassword] = useState(false);
|
|
60
|
+
const [showPassword, setShowPassword] = useState(false);
|
|
57
61
|
|
|
58
62
|
const handleInputChange = (e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>): void => {
|
|
59
63
|
const fieldName: string = e.target.name;
|
|
@@ -99,7 +103,7 @@ const MovaLogin: FunctionComponent<MovaLoginProps> = ({ loading, movaAppType, on
|
|
|
99
103
|
const getMovaLogo = () => {
|
|
100
104
|
|
|
101
105
|
return movaAppType === MovaAppType.GARAGE ? LogoProLarge :
|
|
102
|
-
movaAppType === MovaAppType.
|
|
106
|
+
movaAppType === MovaAppType.INDIVIDUAL ? LogoLarge :
|
|
103
107
|
movaAppType === MovaAppType.ADMIN ? LogoLarge : LogoLarge;
|
|
104
108
|
}
|
|
105
109
|
|
|
@@ -126,6 +130,9 @@ const MovaLogin: FunctionComponent<MovaLoginProps> = ({ loading, movaAppType, on
|
|
|
126
130
|
}
|
|
127
131
|
}
|
|
128
132
|
|
|
133
|
+
const handleClickShowPassword = () => {
|
|
134
|
+
setShowPassword((prev) => !prev);
|
|
135
|
+
};
|
|
129
136
|
|
|
130
137
|
/**
|
|
131
138
|
* Boite de diaogue pour la perte du mot de passe
|
|
@@ -219,13 +226,25 @@ const MovaLogin: FunctionComponent<MovaLoginProps> = ({ loading, movaAppType, on
|
|
|
219
226
|
fullWidth
|
|
220
227
|
name="password"
|
|
221
228
|
label="Mot de passe"
|
|
222
|
-
type=
|
|
229
|
+
type={showPassword ? 'text' : 'password'}
|
|
223
230
|
id="password"
|
|
224
231
|
autoComplete="current-password"
|
|
225
232
|
onChange={e => handleInputChange(e)}
|
|
226
233
|
value={form.password.value}
|
|
227
234
|
error={!form.password.isValid}
|
|
228
|
-
helperText={form.password.error}
|
|
235
|
+
helperText={form.password.error}
|
|
236
|
+
InputProps={{
|
|
237
|
+
endAdornment: (
|
|
238
|
+
<InputAdornment position="end">
|
|
239
|
+
<IconButton
|
|
240
|
+
edge="end"
|
|
241
|
+
onClick={handleClickShowPassword}
|
|
242
|
+
>
|
|
243
|
+
{showPassword ? <VisibilityOff /> : <Visibility />}
|
|
244
|
+
</IconButton>
|
|
245
|
+
</InputAdornment>
|
|
246
|
+
),
|
|
247
|
+
}}
|
|
229
248
|
/>
|
|
230
249
|
<FormControlLabel control={<Checkbox value="remember" color="primary" />}
|
|
231
250
|
label="Se souvenir de moi"
|
|
@@ -248,7 +267,7 @@ const MovaLogin: FunctionComponent<MovaLoginProps> = ({ loading, movaAppType, on
|
|
|
248
267
|
Mot de passe oublié ?
|
|
249
268
|
</Link>
|
|
250
269
|
</Grid>
|
|
251
|
-
{movaAppType === MovaAppType.
|
|
270
|
+
{movaAppType === MovaAppType.INDIVIDUAL && <Grid item>
|
|
252
271
|
<Link variant="body2" color="text.secondary" onClick={(e) => handleOnClickSignUp(e)}>
|
|
253
272
|
Créer mon compte
|
|
254
273
|
</Link>
|
package/src/MovaSignUp.tsx
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { CSSProperties, FormEvent, FunctionComponent, useState } from "react";
|
|
2
2
|
import { LoadingButton } from '@mui/lab';
|
|
3
|
+
import { DatePicker } from '@mui/x-date-pickers/DatePicker';
|
|
3
4
|
import LogoLarge from './assets/images/logo/logo_large.png';
|
|
4
5
|
import LogoProLarge from './assets/images/logo/logo_pro_large.png';
|
|
5
6
|
import GreenLeafImage from "./assets/images/leaf_green_large.png";
|
|
6
7
|
import PinkLeafImage from "./assets/images/leaf_pink_large.png";
|
|
7
|
-
import { Alert, AlertColor, Box, Checkbox, Container, CssBaseline, FormControl, FormControlLabel, FormHelperText, Grid,
|
|
8
|
+
import { Alert, AlertColor, Box, Checkbox, Container, CssBaseline, FormControl, FormControlLabel, FormHelperText, Grid,
|
|
9
|
+
IconButton, Link, SelectChangeEvent, TextField, Typography, TextFieldProps } from "@mui/material";
|
|
8
10
|
import MovaCopyright from "./MovaCopyright";
|
|
9
11
|
import { MovaFormField, MovaUserSignUpForm } from "./helpers/Types";
|
|
10
12
|
import { MovaAppType } from "./helpers/Enums";
|
|
@@ -12,6 +14,10 @@ import { validateEmail } from "./helpers/Validator";
|
|
|
12
14
|
import GenderSelector from "./GenderSelector";
|
|
13
15
|
import { validateField } from "./helpers/Tools";
|
|
14
16
|
import { useHistory } from "react-router-dom";
|
|
17
|
+
import InputAdornment from '@mui/material/InputAdornment';
|
|
18
|
+
import Visibility from '@mui/icons-material/Visibility';
|
|
19
|
+
import VisibilityOff from '@mui/icons-material/VisibilityOff';
|
|
20
|
+
import isValid from 'date-fns/isValid';
|
|
15
21
|
|
|
16
22
|
// Permet de centrer le contenu de l'application
|
|
17
23
|
const styles: CSSProperties = {
|
|
@@ -26,14 +32,14 @@ const initialUserFormState = {
|
|
|
26
32
|
email: { value: '', isValid: true },
|
|
27
33
|
password: { value: '', isValid: true },
|
|
28
34
|
gender: { value: '', isValid: true },
|
|
29
|
-
birthDate: { value:
|
|
35
|
+
birthDate: { value: null, isValid: true },
|
|
30
36
|
acceptsTerms: { value: false, isValid: true },
|
|
31
37
|
};
|
|
32
38
|
|
|
33
39
|
/**
|
|
34
40
|
* Propriétés du composant
|
|
35
41
|
* movaAppType : type d'application Movalib au sein de laquelle le composant est injectée
|
|
36
|
-
* onSubmit :
|
|
42
|
+
* onSubmit : callback invoquée en cas de formulaire valide
|
|
37
43
|
* alertMessage : éventuel message à afficher
|
|
38
44
|
* alertSeverity : niveau d'alerte pour le message à afficher
|
|
39
45
|
* loading : permet de mettre éventuellement le bouton de soumission en état de chargement
|
|
@@ -55,14 +61,27 @@ const MovaLogin: FunctionComponent<MovaSignUpProps> = ({ loading, movaAppType, o
|
|
|
55
61
|
const [userForm, setUserForm] = useState<MovaUserSignUpForm>(initialUserFormState);
|
|
56
62
|
const history = useHistory();
|
|
57
63
|
const [message, setMessage] = useState<string>("");
|
|
64
|
+
const [showPassword, setShowPassword] = useState(false);
|
|
65
|
+
|
|
66
|
+
const handleDateChange = (name: string, date: Date | null) => {
|
|
67
|
+
console.log(date)
|
|
68
|
+
if(name && date){
|
|
69
|
+
const fieldName: string = name;
|
|
70
|
+
const fieldValue: Date = date;
|
|
71
|
+
const newField: MovaFormField = { [fieldName]: { value: fieldValue, isValid: true } };
|
|
72
|
+
|
|
73
|
+
setUserForm({ ...userForm, ...newField});
|
|
74
|
+
}
|
|
75
|
+
}
|
|
58
76
|
|
|
59
|
-
const handleInputChange = (e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>): void => {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
77
|
+
const handleInputChange = (e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement> | null): void => {
|
|
78
|
+
if(e){
|
|
79
|
+
const fieldName: string = e.target.name;
|
|
80
|
+
const fieldValue: string = e.target.value;
|
|
81
|
+
const newField: MovaFormField = { [fieldName]: { value: fieldValue, isValid: true } };
|
|
82
|
+
|
|
83
|
+
setUserForm({ ...userForm, ...newField});
|
|
84
|
+
}
|
|
66
85
|
}
|
|
67
86
|
|
|
68
87
|
const handleCheckboxChange = (e: SelectChangeEvent<string>, checked: boolean): void => {
|
|
@@ -104,7 +123,7 @@ const MovaLogin: FunctionComponent<MovaSignUpProps> = ({ loading, movaAppType, o
|
|
|
104
123
|
newForm.email = validateField(userForm.email, value => !!value, 'Champ obligatoire');
|
|
105
124
|
newForm.password = validateField(userForm.password, value => !!value, 'Champ obligatoire');
|
|
106
125
|
newForm.gender = validateField(userForm.gender, value => !!value, 'Champ obligatoire');
|
|
107
|
-
newForm.birthDate = validateField(userForm.birthDate, value => !!value, 'Champ obligatoire');
|
|
126
|
+
newForm.birthDate = validateField(userForm.birthDate, value => !!value && isValid(value), 'Champ obligatoire');
|
|
108
127
|
|
|
109
128
|
// Validator pour l'email
|
|
110
129
|
newForm.email = validateField(userForm.email, validateEmail, 'Adresse email invalide');
|
|
@@ -126,7 +145,7 @@ const MovaLogin: FunctionComponent<MovaSignUpProps> = ({ loading, movaAppType, o
|
|
|
126
145
|
const getMovaLogo = () => {
|
|
127
146
|
|
|
128
147
|
return movaAppType === MovaAppType.GARAGE ? LogoProLarge :
|
|
129
|
-
movaAppType === MovaAppType.
|
|
148
|
+
movaAppType === MovaAppType.INDIVIDUAL ? LogoLarge :
|
|
130
149
|
movaAppType === MovaAppType.ADMIN ? LogoLarge : LogoLarge;
|
|
131
150
|
}
|
|
132
151
|
|
|
@@ -138,6 +157,10 @@ const MovaLogin: FunctionComponent<MovaSignUpProps> = ({ loading, movaAppType, o
|
|
|
138
157
|
}
|
|
139
158
|
}
|
|
140
159
|
|
|
160
|
+
const handleClickShowPassword = () => {
|
|
161
|
+
setShowPassword((prev) => !prev);
|
|
162
|
+
};
|
|
163
|
+
|
|
141
164
|
return (
|
|
142
165
|
<div style={styles}>
|
|
143
166
|
<img src={GreenLeafImage} style={{position: 'fixed',
|
|
@@ -211,18 +234,30 @@ const MovaLogin: FunctionComponent<MovaSignUpProps> = ({ loading, movaAppType, o
|
|
|
211
234
|
fullWidth
|
|
212
235
|
name="password"
|
|
213
236
|
label="Mot de passe"
|
|
214
|
-
type=
|
|
237
|
+
type={showPassword ? 'text' : 'password'}
|
|
215
238
|
id="password"
|
|
216
239
|
autoComplete="current-password"
|
|
217
240
|
onChange={e => handleInputChange(e)}
|
|
218
241
|
value={userForm.password.value}
|
|
219
242
|
error={!userForm.password.isValid}
|
|
220
|
-
helperText={Boolean(userForm.password.error) ? userForm.password.error : "
|
|
243
|
+
helperText={Boolean(userForm.password.error) ? userForm.password.error : "10 caractères minimum, 1 majuscule, 1 minuscule"}
|
|
244
|
+
InputProps={{
|
|
245
|
+
endAdornment: (
|
|
246
|
+
<InputAdornment position="end">
|
|
247
|
+
<IconButton
|
|
248
|
+
edge="end"
|
|
249
|
+
onClick={handleClickShowPassword}
|
|
250
|
+
>
|
|
251
|
+
{showPassword ? <VisibilityOff /> : <Visibility />}
|
|
252
|
+
</IconButton>
|
|
253
|
+
</InputAdornment>
|
|
254
|
+
),
|
|
255
|
+
}}
|
|
221
256
|
/>
|
|
222
257
|
|
|
223
258
|
<GenderSelector handleSelectChange={handleSelectChange} form={userForm} required sx={{ width:'40%', mr: 2}} />
|
|
224
259
|
|
|
225
|
-
<TextField
|
|
260
|
+
{/* <TextField
|
|
226
261
|
margin="normal"
|
|
227
262
|
required
|
|
228
263
|
name="birthDate"
|
|
@@ -237,7 +272,28 @@ const MovaLogin: FunctionComponent<MovaSignUpProps> = ({ loading, movaAppType, o
|
|
|
237
272
|
helperText={userForm.birthDate.error}
|
|
238
273
|
onChange={(e) => handleInputChange(e)}
|
|
239
274
|
sx={{ width:'50%', float: 'right'}}
|
|
275
|
+
/> */}
|
|
276
|
+
|
|
277
|
+
<DatePicker
|
|
278
|
+
label="Date de naissance"
|
|
279
|
+
value={userForm.birthDate.value}
|
|
280
|
+
format='dd / MM / yyyy'
|
|
281
|
+
formatDensity='dense'
|
|
282
|
+
//views={['day']}
|
|
283
|
+
displayWeekNumber
|
|
284
|
+
onChange={(newValue) => handleDateChange('birthDate', newValue)}
|
|
285
|
+
slotProps={{
|
|
286
|
+
textField: {
|
|
287
|
+
required: true,
|
|
288
|
+
error:!userForm.birthDate.isValid,
|
|
289
|
+
sx: {
|
|
290
|
+
width:'50%', mt: 2, float: 'right',
|
|
291
|
+
padding: 0,
|
|
292
|
+
},
|
|
293
|
+
},
|
|
294
|
+
}}
|
|
240
295
|
/>
|
|
296
|
+
|
|
241
297
|
<FormControl error={!userForm.acceptsTerms.isValid}>
|
|
242
298
|
<FormControlLabel
|
|
243
299
|
control={
|
package/src/QRCode.css
ADDED
package/src/QRCode.tsx
CHANGED
|
@@ -12,6 +12,7 @@ import QRCodeStyling, {
|
|
|
12
12
|
Extension,
|
|
13
13
|
Options
|
|
14
14
|
} from "qr-code-styling";
|
|
15
|
+
import './QRCode.css';
|
|
15
16
|
|
|
16
17
|
|
|
17
18
|
interface QRCodeProps {
|
|
@@ -19,18 +20,14 @@ interface QRCodeProps {
|
|
|
19
20
|
showDownload?:boolean
|
|
20
21
|
}
|
|
21
22
|
|
|
22
|
-
|
|
23
23
|
const styles = {
|
|
24
24
|
inputWrapper: {
|
|
25
25
|
margin: "20px 0",
|
|
26
26
|
display: "flex",
|
|
27
27
|
alignItems: 'center',
|
|
28
28
|
justifyContent: "center",
|
|
29
|
-
width: '
|
|
30
|
-
|
|
31
|
-
inputBox: {
|
|
32
|
-
flexGrow: 1,
|
|
33
|
-
marginRight: 20
|
|
29
|
+
width: '300px',
|
|
30
|
+
height: '300px'
|
|
34
31
|
}
|
|
35
32
|
};
|
|
36
33
|
|
|
@@ -42,9 +39,9 @@ const QRCode: FC<QRCodeProps> = ({ data, showDownload=false }) => {
|
|
|
42
39
|
const defaultData:string = 'https://movalib.com';
|
|
43
40
|
|
|
44
41
|
const [options, setOptions] = useState<Options>({
|
|
45
|
-
width:
|
|
46
|
-
height:
|
|
47
|
-
type: '
|
|
42
|
+
width: 600,
|
|
43
|
+
height: 600,
|
|
44
|
+
type: 'canvas' as DrawType,
|
|
48
45
|
data: data ?? defaultData,
|
|
49
46
|
image: QRCodeImage,
|
|
50
47
|
margin: 10,
|
|
@@ -56,8 +53,7 @@ const QRCode: FC<QRCodeProps> = ({ data, showDownload=false }) => {
|
|
|
56
53
|
imageOptions: {
|
|
57
54
|
hideBackgroundDots: true,
|
|
58
55
|
imageSize: 0.4,
|
|
59
|
-
margin: 15
|
|
60
|
-
crossOrigin: 'anonymous',
|
|
56
|
+
margin: 15
|
|
61
57
|
},
|
|
62
58
|
dotsOptions: {
|
|
63
59
|
color: darken(theme.palette.primary.main, 0.3),
|
|
@@ -126,8 +122,11 @@ const QRCode: FC<QRCodeProps> = ({ data, showDownload=false }) => {
|
|
|
126
122
|
};
|
|
127
123
|
|
|
128
124
|
return (
|
|
129
|
-
<Box
|
|
130
|
-
|
|
125
|
+
<Box sx={{
|
|
126
|
+
display: 'flex',
|
|
127
|
+
flexDirection: 'column',
|
|
128
|
+
alignItems: 'center' }} >
|
|
129
|
+
<div ref={ref} style={styles.inputWrapper} className='qr-code' />
|
|
131
130
|
{/* <select onChange={onExtensionChange} value={fileExt}>
|
|
132
131
|
<option value="svg">SVG</option>
|
|
133
132
|
<option value="png">PNG</option>
|