@movalib/movalib-commons 1.59.36 → 1.59.38

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.
Files changed (33) hide show
  1. package/dist/src/MovaLogin.js +6 -5
  2. package/dist/src/assets/images/logo/header_logo_admin.png +0 -0
  3. package/dist/src/assets/images/logo/logo_admin_large.png +0 -0
  4. package/dist/src/components/vehicle/VehicleFullCard.d.ts +5 -5
  5. package/dist/src/components/vehicle/VehicleFullCard.js +101 -82
  6. package/dist/src/helpers/ApiHelper.js +5 -0
  7. package/dist/src/helpers/CookieUtils.d.ts +1 -0
  8. package/dist/src/helpers/CookieUtils.js +2 -1
  9. package/dist/src/helpers/Enums.d.ts +7 -6
  10. package/dist/src/helpers/Enums.js +6 -5
  11. package/dist/src/models/Document.d.ts +2 -1
  12. package/dist/src/models/Document.js +3 -5
  13. package/dist/src/models/Event.d.ts +12 -1
  14. package/dist/src/models/Event.js +2 -1
  15. package/dist/src/models/Product.d.ts +2 -1
  16. package/dist/src/models/Product.js +2 -1
  17. package/dist/src/services/AuthenticationService.d.ts +1 -1
  18. package/dist/src/services/AuthenticationService.js +38 -9
  19. package/dist/src/services/GarageService.d.ts +3 -1
  20. package/dist/src/services/GarageService.js +18 -4
  21. package/package.json +1 -1
  22. package/src/MovaLogin.tsx +6 -5
  23. package/src/assets/images/logo/header_logo_admin.png +0 -0
  24. package/src/assets/images/logo/logo_admin_large.png +0 -0
  25. package/src/components/vehicle/VehicleFullCard.tsx +847 -559
  26. package/src/helpers/ApiHelper.ts +6 -1
  27. package/src/helpers/CookieUtils.ts +1 -0
  28. package/src/helpers/Enums.ts +216 -217
  29. package/src/models/Document.ts +42 -37
  30. package/src/models/Event.ts +13 -1
  31. package/src/models/Product.ts +40 -26
  32. package/src/services/AuthenticationService.ts +31 -6
  33. package/src/services/GarageService.ts +667 -621
@@ -55,6 +55,7 @@ var react_1 = require("react");
55
55
  var lab_1 = require("@mui/lab");
56
56
  var logo_large_border_png_1 = __importDefault(require("./assets/images/logo/logo_large_border.png"));
57
57
  var logo_pro_large_border_png_1 = __importDefault(require("./assets/images/logo/logo_pro_large_border.png"));
58
+ var logo_admin_large_png_1 = __importDefault(require("./assets/images/logo/logo_admin_large.png"));
58
59
  var logo_large_dm_png_1 = __importDefault(require("./assets/images/logo/logo_large_dm.png"));
59
60
  var logo_pro_large_dm_png_1 = __importDefault(require("./assets/images/logo/logo_pro_large_dm.png"));
60
61
  var leaf_green_large_png_1 = __importDefault(require("./assets/images/leaf_green_large.png"));
@@ -119,7 +120,7 @@ var MovaLogin = function (_a) {
119
120
  var validateForm = function () {
120
121
  var newForm = __assign({}, form);
121
122
  // Validator pour les champs obligatoires
122
- if (movaAppType === Enums_1.MovaAppType.GARAGE) {
123
+ if (movaAppType === Enums_1.MovaAppType.GARAGE || movaAppType === Enums_1.MovaAppType.ADMIN) {
123
124
  newForm.email = (0, Tools_1.validateField)(form.email, function (value) { return !!value; }, 'Champ obligatoire');
124
125
  // Validator pour l'email
125
126
  newForm.email = (0, Tools_1.validateField)(form.email, Validator_1.validateEmail, 'Adresse email invalide');
@@ -131,7 +132,7 @@ var MovaLogin = function (_a) {
131
132
  // Validator pour le mot de passe
132
133
  newForm.password = (0, Tools_1.validateField)(form.password, function (value) { return value.length >= 10 && /[a-z]/.test(value) && /[A-Z]/.test(value); }, 'Mot de passe invalide');
133
134
  setForm(newForm);
134
- return newForm.password.isValid && (movaAppType === Enums_1.MovaAppType.GARAGE ? newForm.email.isValid : true)
135
+ return newForm.password.isValid && ((movaAppType === Enums_1.MovaAppType.GARAGE || movaAppType === Enums_1.MovaAppType.ADMIN) ? newForm.email.isValid : true)
135
136
  && (movaAppType === Enums_1.MovaAppType.INDIVIDUAL ? newForm.phoneNumberEmail.isValid : true);
136
137
  };
137
138
  var getMovaLogo = function () {
@@ -143,7 +144,7 @@ var MovaLogin = function (_a) {
143
144
  else {
144
145
  return movaAppType === Enums_1.MovaAppType.GARAGE ? logo_pro_large_border_png_1.default :
145
146
  movaAppType === Enums_1.MovaAppType.INDIVIDUAL ? logo_large_border_png_1.default :
146
- movaAppType === Enums_1.MovaAppType.ADMIN ? logo_large_border_png_1.default : logo_large_border_png_1.default;
147
+ movaAppType === Enums_1.MovaAppType.ADMIN ? logo_admin_large_png_1.default : logo_large_border_png_1.default;
147
148
  }
148
149
  };
149
150
  var handleOnClickSignUp = function () {
@@ -161,7 +162,7 @@ var MovaLogin = function (_a) {
161
162
  setOpenForgotPassword(false);
162
163
  // On appel de callback de soumission de la demande de réinitialisation du mot de passe
163
164
  if (onSubmitForgotPassword) {
164
- onSubmitForgotPassword(movaAppType === Enums_1.MovaAppType.GARAGE ? form.email.value : form.phoneNumberEmail.value);
165
+ onSubmitForgotPassword((movaAppType === Enums_1.MovaAppType.GARAGE || movaAppType === Enums_1.MovaAppType.ADMIN) ? form.email.value : form.phoneNumberEmail.value);
165
166
  }
166
167
  };
167
168
  var handleClickShowPassword = function () {
@@ -233,7 +234,7 @@ var MovaLogin = function (_a) {
233
234
  '& .MuiOutlinedInput-notchedOutline': {
234
235
  borderColor: darkMode ? 'white' : 'default', // Couleur de la bordure
235
236
  }
236
- } }), movaAppType === Enums_1.MovaAppType.GARAGE &&
237
+ } }), (movaAppType === Enums_1.MovaAppType.GARAGE || movaAppType === Enums_1.MovaAppType.ADMIN) &&
237
238
  (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: {
238
239
  '& .MuiOutlinedInput-notchedOutline': {
239
240
  borderColor: darkMode ? 'white' : 'default', // Couleur de la bordure
@@ -1,8 +1,8 @@
1
- import { type FC } from 'react';
2
- import { MovaVehicleForm } from '../../helpers/Types';
3
- import Vehicle from '../../models/Vehicle';
4
- import { MovaAppType } from '../../helpers/Enums';
5
- import User from '../../models/User';
1
+ import { type FC } from "react";
2
+ import { MovaAppType } from "../../helpers/Enums";
3
+ import { MovaVehicleForm } from "../../helpers/Types";
4
+ import User from "../../models/User";
5
+ import Vehicle from "../../models/Vehicle";
6
6
  interface VehicleFullCardProps {
7
7
  currentUser: User;
8
8
  vehicle: Vehicle;
@@ -15,31 +15,30 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  var jsx_runtime_1 = require("react/jsx-runtime");
18
+ var icons_material_1 = require("@mui/icons-material");
19
+ var CloseRounded_1 = __importDefault(require("@mui/icons-material/CloseRounded"));
20
+ var EditRounded_1 = __importDefault(require("@mui/icons-material/EditRounded"));
18
21
  var material_1 = require("@mui/material");
22
+ var x_date_pickers_1 = require("@mui/x-date-pickers");
19
23
  var react_1 = require("react");
20
- var MovaVehicleTireField_1 = __importDefault(require("../../MovaVehicleTireField"));
24
+ var car_plate_bg_png_1 = __importDefault(require("../../assets/images/car_plate_bg.png"));
21
25
  var ConfirmationDialog_1 = __importDefault(require("../../ConfirmationDialog"));
22
- var Enums_1 = require("../../helpers/Enums");
23
- var Tools_1 = require("../../helpers/Tools");
24
26
  var DateUtils_1 = require("../../helpers/DateUtils");
25
- var CloseRounded_1 = __importDefault(require("@mui/icons-material/CloseRounded"));
26
- var EditRounded_1 = __importDefault(require("@mui/icons-material/EditRounded"));
27
- var CloseRounded_2 = __importDefault(require("@mui/icons-material/CloseRounded"));
27
+ var Enums_1 = require("../../helpers/Enums");
28
28
  var Logger_1 = __importDefault(require("../../helpers/Logger"));
29
- var icons_material_1 = require("@mui/icons-material");
29
+ var Tools_1 = require("../../helpers/Tools");
30
+ var MovaVehicleTireField_1 = __importDefault(require("../../MovaVehicleTireField"));
30
31
  var LinkedDocumentDialog_1 = require("../LinkedDocumentDialog");
31
- var car_plate_bg_png_1 = __importDefault(require("../../assets/images/car_plate_bg.png"));
32
- var x_date_pickers_1 = require("@mui/x-date-pickers");
33
32
  var initialUserFormState = {
34
33
  currentMileage: { value: null, isValid: true },
35
34
  averageMileagePerYear: { value: null, isValid: true },
36
35
  tireSize: { value: null, isValid: true },
37
- tireWidth: { value: '', isValid: true },
38
- tireHeight: { value: '', isValid: true },
39
- tireDiameter: { value: '', isValid: true },
40
- tireSpeedIndex: { value: '', isValid: true },
36
+ tireWidth: { value: "", isValid: true },
37
+ tireHeight: { value: "", isValid: true },
38
+ tireDiameter: { value: "", isValid: true },
39
+ tireSpeedIndex: { value: "", isValid: true },
41
40
  lastInspectionDate: { value: null, isValid: true },
42
- lastMaintenanceDate: { value: null, isValid: true }
41
+ lastMaintenanceDate: { value: null, isValid: true },
43
42
  };
44
43
  var VehicleFullCard = function (_a) {
45
44
  var _b;
@@ -48,7 +47,7 @@ var VehicleFullCard = function (_a) {
48
47
  var _e = (0, react_1.useState)(editMode), localEditMode = _e[0], setLocalEditMode = _e[1];
49
48
  var _f = (0, react_1.useState)(false), openConfirmDocumentDelete = _f[0], setOpenConfirmDocumentDelete = _f[1];
50
49
  var _g = (0, react_1.useState)(false), openConfirmVehicleDelete = _g[0], setOpenConfirmVehicleDelete = _g[1];
51
- var _h = (0, react_1.useState)(''), documentToDelete = _h[0], setDocumentToDelete = _h[1];
50
+ var _h = (0, react_1.useState)(""), documentToDelete = _h[0], setDocumentToDelete = _h[1];
52
51
  var _j = (0, react_1.useState)(false), sizeLimit = _j[0], setSizeLimit = _j[1];
53
52
  // Formulaire utilisé pour les modifications d'informations sur le véhicule
54
53
  var _k = (0, react_1.useState)(initialUserFormState), form = _k[0], setForm = _k[1];
@@ -57,7 +56,7 @@ var VehicleFullCard = function (_a) {
57
56
  var tirePictureInputRef = (0, react_1.useRef)(null);
58
57
  var _l = (0, react_1.useState)(false), isShowLinkedDocument = _l[0], setShowLinkedDocument = _l[1];
59
58
  var docTypeCurrent = (0, react_1.useRef)();
60
- var messageRGPD = appType === Enums_1.MovaAppType.INDIVIDUAL ? (0, jsx_runtime_1.jsx)(material_1.Box, {}) : (0, jsx_runtime_1.jsx)(material_1.Box, __assign({ sx: { mt: 2 } }, { children: (0, jsx_runtime_1.jsx)(material_1.Alert, __assign({ severity: 'warning' }, { children: "Vous \u00EAtes responsable des documents que vous importez, en ajoutant un document vous reconnaissez disposer du consentement explicite du client pour le stockage de ses donn\u00E9es conform\u00E9ment \u00E0 la r\u00E9glementation RGPD." })) }));
59
+ var messageRGPD = appType === Enums_1.MovaAppType.INDIVIDUAL ? ((0, jsx_runtime_1.jsx)(material_1.Box, {})) : ((0, jsx_runtime_1.jsx)(material_1.Box, __assign({ sx: { mt: 2 } }, { children: (0, jsx_runtime_1.jsx)(material_1.Alert, __assign({ severity: "warning" }, { children: "Vous \u00EAtes responsable des documents que vous importez, en ajoutant un document vous reconnaissez disposer du consentement explicite du client pour le stockage de ses donn\u00E9es conform\u00E9ment \u00E0 la r\u00E9glementation RGPD." })) })));
61
60
  (0, react_1.useEffect)(function () {
62
61
  setLocalEditMode(editMode);
63
62
  }, [editMode]);
@@ -66,43 +65,20 @@ var VehicleFullCard = function (_a) {
66
65
  }, [vehicle]);
67
66
  var initForm = function () {
68
67
  if (vehicle) {
69
- setForm(function (prevForm) {
70
- var _a;
71
- return (__assign(__assign({}, prevForm), (_a = {}, _a['currentMileage'] = __assign(__assign({}, prevForm['currentMileage']), { value: vehicle.currentMileage }), _a)));
72
- });
73
- setForm(function (prevForm) {
74
- var _a;
75
- return (__assign(__assign({}, prevForm), (_a = {}, _a['averageMileagePerYear'] = __assign(__assign({}, prevForm['averageMileagePerYear']), { value: vehicle.averageMileagePerYear }), _a)));
76
- });
77
- setForm(function (prevForm) {
78
- var _a;
79
- return (__assign(__assign({}, prevForm), (_a = {}, _a['tireWidth'] = __assign(__assign({}, prevForm['tireWidth']), { value: vehicle.tireWidth }), _a)));
80
- });
81
- setForm(function (prevForm) {
82
- var _a;
83
- return (__assign(__assign({}, prevForm), (_a = {}, _a['tireHeight'] = __assign(__assign({}, prevForm['tireHeight']), { value: vehicle.tireHeight }), _a)));
84
- });
85
- setForm(function (prevForm) {
86
- var _a;
87
- return (__assign(__assign({}, prevForm), (_a = {}, _a['tireDiameter'] = __assign(__assign({}, prevForm['tireDiameter']), { value: vehicle.tireDiameter }), _a)));
88
- });
89
- setForm(function (prevForm) {
90
- var _a;
91
- return (__assign(__assign({}, prevForm), (_a = {}, _a['tireSpeedIndex'] = __assign(__assign({}, prevForm['tireSpeedIndex']), { value: vehicle.tireSpeedIndex }), _a)));
92
- });
93
- setForm(function (prevForm) {
94
- var _a;
95
- return (__assign(__assign({}, prevForm), (_a = {}, _a['lastInspectionDate'] = __assign(__assign({}, prevForm['lastInspectionDate']), { value: vehicle.lastInspectionDate ? new Date(vehicle.lastInspectionDate) : null }), _a)));
96
- });
97
- setForm(function (prevForm) {
98
- var _a;
99
- return (__assign(__assign({}, prevForm), (_a = {}, _a['lastMaintenanceDate'] = __assign(__assign({}, prevForm['lastMaintenanceDate']), { value: vehicle.lastMaintenanceDate ? new Date(vehicle.lastMaintenanceDate) : null }), _a)));
100
- });
68
+ setForm(function (prevForm) { return (__assign(__assign({}, prevForm), { currentMileage: __assign(__assign({}, prevForm["currentMileage"]), { value: vehicle.currentMileage }) })); });
69
+ setForm(function (prevForm) { return (__assign(__assign({}, prevForm), { averageMileagePerYear: __assign(__assign({}, prevForm["averageMileagePerYear"]), { value: vehicle.averageMileagePerYear }) })); });
70
+ setForm(function (prevForm) { return (__assign(__assign({}, prevForm), { tireWidth: __assign(__assign({}, prevForm["tireWidth"]), { value: vehicle.tireWidth }) })); });
71
+ setForm(function (prevForm) { return (__assign(__assign({}, prevForm), { tireHeight: __assign(__assign({}, prevForm["tireHeight"]), { value: vehicle.tireHeight }) })); });
72
+ setForm(function (prevForm) { return (__assign(__assign({}, prevForm), { tireDiameter: __assign(__assign({}, prevForm["tireDiameter"]), { value: vehicle.tireDiameter }) })); });
73
+ setForm(function (prevForm) { return (__assign(__assign({}, prevForm), { tireSpeedIndex: __assign(__assign({}, prevForm["tireSpeedIndex"]), { value: vehicle.tireSpeedIndex }) })); });
74
+ setForm(function (prevForm) { return (__assign(__assign({}, prevForm), { lastInspectionDate: __assign(__assign({}, prevForm["lastInspectionDate"]), { value: vehicle.lastInspectionDate
75
+ ? new Date(vehicle.lastInspectionDate)
76
+ : null }) })); });
77
+ setForm(function (prevForm) { return (__assign(__assign({}, prevForm), { lastMaintenanceDate: __assign(__assign({}, prevForm["lastMaintenanceDate"]), { value: vehicle.lastMaintenanceDate
78
+ ? new Date(vehicle.lastMaintenanceDate)
79
+ : null }) })); });
101
80
  if (isVehicleTireSizeDefined(vehicle)) {
102
- setForm(function (prevForm) {
103
- var _a;
104
- return (__assign(__assign({}, prevForm), (_a = {}, _a['tireSize'] = __assign(__assign({}, prevForm['tireSize']), { value: vehicle.tireSize }), _a)));
105
- });
81
+ setForm(function (prevForm) { return (__assign(__assign({}, prevForm), { tireSize: __assign(__assign({}, prevForm["tireSize"]), { value: vehicle.tireSize }) })); });
106
82
  }
107
83
  Logger_1.default.info(form);
108
84
  }
@@ -118,16 +94,22 @@ var VehicleFullCard = function (_a) {
118
94
  }
119
95
  };
120
96
  var isVehicleTireSizeDefined = function (vehicle) {
121
- return vehicle.tireSize && vehicle.tireSize.diameter && vehicle.tireSize.height && vehicle.tireSize.speedIndex && vehicle.tireSize.width;
97
+ return (vehicle.tireSize &&
98
+ vehicle.tireSize.diameter &&
99
+ vehicle.tireSize.height &&
100
+ vehicle.tireSize.speedIndex &&
101
+ vehicle.tireSize.width);
122
102
  };
123
103
  var validateForm = function () {
124
104
  var newForm = __assign({}, form);
125
105
  // Validator pour les champs obligatoires
126
- newForm.currentMileage = (0, Tools_1.validateField)(form.currentMileage, function (value) { return !!value; }, 'Champ obligatoire');
127
- newForm.averageMileagePerYear = (0, Tools_1.validateField)(form.averageMileagePerYear, function (value) { return !!value; }, 'Champ obligatoire');
106
+ // newForm.currentMileage = validateField(form.currentMileage, value => !!value, 'Champ obligatoire');
107
+ // newForm.averageMileagePerYear = validateField(form.averageMileagePerYear, value => !!value, 'Champ obligatoire');
128
108
  // La validation de la saisie des pneumatiques se fait dans le composant "MovaVehicleTireField", traitée dans le callback "handleOnChangeVehicleTire"
129
109
  setForm(newForm);
130
- return newForm.currentMileage.isValid && newForm.averageMileagePerYear.isValid && newForm.tireSize.isValid;
110
+ return (newForm.currentMileage.isValid &&
111
+ newForm.averageMileagePerYear.isValid &&
112
+ newForm.tireSize.isValid);
131
113
  };
132
114
  var handleInputChange = function (e) {
133
115
  handleChange(e.target.name, e.target.value);
@@ -138,7 +120,9 @@ var VehicleFullCard = function (_a) {
138
120
  var handleChange = function (fieldName, fieldValue) {
139
121
  var _a;
140
122
  console.log(fieldName, fieldValue);
141
- var newField = (_a = {}, _a[fieldName] = { value: fieldValue, isValid: true }, _a);
123
+ var newField = (_a = {},
124
+ _a[fieldName] = { value: fieldValue, isValid: true },
125
+ _a);
142
126
  setForm(__assign(__assign({}, form), newField));
143
127
  };
144
128
  var uploadVehicleDocument = function (document, documentType) {
@@ -151,7 +135,7 @@ var VehicleFullCard = function (_a) {
151
135
  var formData = new FormData();
152
136
  formData.append("documentType", documentType);
153
137
  // Ajouter la facture à FormData
154
- formData.append('file', document);
138
+ formData.append("file", document);
155
139
  // Appel du callback correspondant
156
140
  if (onUploadDocument)
157
141
  onUploadDocument(formData);
@@ -164,7 +148,10 @@ var VehicleFullCard = function (_a) {
164
148
  */
165
149
  var handleFileChange = function (event, docType) {
166
150
  event.preventDefault();
167
- if (event && event.target.files && event.target.files.length > 0 && docType) {
151
+ if (event &&
152
+ event.target.files &&
153
+ event.target.files.length > 0 &&
154
+ docType) {
168
155
  uploadVehicleDocument(event.target.files[0], docType);
169
156
  }
170
157
  };
@@ -173,10 +160,7 @@ var VehicleFullCard = function (_a) {
173
160
  setLocalEditMode(true);
174
161
  };
175
162
  var handleOnChangeVehicleTire = function (vehicleTire, isValid) {
176
- setForm(function (prevForm) {
177
- var _a;
178
- return (__assign(__assign({}, prevForm), (_a = {}, _a['tireSize'] = __assign(__assign({}, prevForm['tireSize']), { value: vehicleTire, isValid: isValid }), _a)));
179
- });
163
+ setForm(function (prevForm) { return (__assign(__assign({}, prevForm), { tireSize: __assign(__assign({}, prevForm["tireSize"]), { value: vehicleTire, isValid: isValid }) })); });
180
164
  };
181
165
  var handleOnClickDeleteVehicle = function (e) {
182
166
  e.preventDefault();
@@ -193,10 +177,18 @@ var VehicleFullCard = function (_a) {
193
177
  var query = {
194
178
  currentMileage: form.currentMileage.value,
195
179
  averageMileagePerYear: form.averageMileagePerYear.value,
196
- tireWidth: form.tireSize.isValid && form.tireSize.value ? form.tireSize.value.width : undefined,
197
- tireHeight: form.tireSize.isValid && form.tireSize.value ? form.tireSize.value.height : undefined,
198
- tireDiameter: form.tireSize.isValid && form.tireSize.value ? form.tireSize.value.diameter : undefined,
199
- tireSpeedIndex: form.tireSize.isValid && form.tireSize.value ? form.tireSize.value.speedIndex : undefined,
180
+ tireWidth: form.tireSize.isValid && form.tireSize.value
181
+ ? form.tireSize.value.width
182
+ : undefined,
183
+ tireHeight: form.tireSize.isValid && form.tireSize.value
184
+ ? form.tireSize.value.height
185
+ : undefined,
186
+ tireDiameter: form.tireSize.isValid && form.tireSize.value
187
+ ? form.tireSize.value.diameter
188
+ : undefined,
189
+ tireSpeedIndex: form.tireSize.isValid && form.tireSize.value
190
+ ? form.tireSize.value.speedIndex
191
+ : undefined,
200
192
  lastInspectionDate: form.lastInspectionDate.value,
201
193
  lastMaintenanceDate: form.lastMaintenanceDate.value,
202
194
  };
@@ -212,7 +204,7 @@ var VehicleFullCard = function (_a) {
212
204
  };
213
205
  var handleCloseConfirmDocumentDelete = function () {
214
206
  setOpenConfirmDocumentDelete(false);
215
- setDocumentToDelete('');
207
+ setDocumentToDelete("");
216
208
  };
217
209
  var handleCloseConfirmVehicleDelete = function () {
218
210
  setOpenConfirmVehicleDelete(false);
@@ -235,19 +227,46 @@ var VehicleFullCard = function (_a) {
235
227
  onDelete();
236
228
  }
237
229
  };
238
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [vehicle &&
239
- (0, jsx_runtime_1.jsxs)(material_1.Card, __assign({ variant: 'outlined', sx: {
240
- maxWidth: fullwidth ? '80%' : 500,
241
- backgroundColor: focused ? theme.palette.primary.light : 'white',
242
- overflow: 'visible', mt: 4, pb: 1
243
- } }, { children: [(0, jsx_runtime_1.jsxs)(material_1.CardContent, __assign({ sx: { pt: 0, pb: 0 } }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Typography, __assign({ variant: "h6", component: "div", align: "center", sx: { mb: 1 }, color: (0, material_1.darken)(theme.palette.primary.main, 0.2) }, { children: [vehicle.brand && "".concat(vehicle.brand, " "), vehicle.model && "".concat(vehicle.model, " "), vehicle.version && "".concat(vehicle.version)] })), (0, jsx_runtime_1.jsxs)(material_1.Grid, __assign({ container: true, justifyContent: "space-between" }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Grid, __assign({ container: true, sx: { mb: 1, alignItems: 'center', justifyContent: 'center' } }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Grid, __assign({ item: true, xs: 6, sx: { position: 'relative', minWidth: '234px' } }, { children: [(0, jsx_runtime_1.jsx)("img", { src: car_plate_bg_png_1.default, alt: "Plaque d'immatriculation", style: { height: '50px', position: 'relative', } }), (0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ variant: 'h6', color: theme.palette.text.primary, sx: { position: 'absolute', top: '8px', left: '76px' } }, { children: (0, jsx_runtime_1.jsx)("b", { children: (0, Tools_1.formatFrenchVehiclePlate)(vehicle.plate) }) }))] })), onDelete && (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 6, style: { display: 'flex', alignItems: 'center', justifyContent: 'center' } }, { children: (0, jsx_runtime_1.jsx)(material_1.Button, __assign({ variant: 'contained', color: 'error', onClick: function (e) { return handleOnClickDeleteVehicle(e); } }, { children: "Supprimer" })) }))] })), !localEditMode && (0, jsx_runtime_1.jsxs)(material_1.Grid, __assign({ container: true, textAlign: 'justify', sx: { pt: 2 } }, { children: [(0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 8 }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ variant: "body1", color: "text.secondary" }, { children: "Km actuel :" })) })), (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 4, sx: { textAlign: 'right' } }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ variant: "body1", color: "text.secondary" }, { children: (0, jsx_runtime_1.jsxs)("b", { children: [vehicle.currentMileage, " km"] }) })) }))] })), localEditMode && (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 12 }, { children: (0, jsx_runtime_1.jsx)(material_1.TextField, { label: "Kilom\u00E9trage actuel", name: "currentMileage", variant: "outlined", type: "number", required: true, value: form.currentMileage.value, onChange: function (e) { return handleInputChange(e); }, error: (Boolean(form.currentMileage.error)), sx: {
244
- width: '100%',
245
- mt: 2,
246
- '& input': { textTransform: 'uppercase' } // CSS pour forcer les majuscules dans l'input
247
- }, helperText: Boolean(form.currentMileage.error && form.currentMileage.value > 0)
248
- ? form.currentMileage.error : "Sur votre tableau de bord 😉" }) })), !localEditMode && (0, jsx_runtime_1.jsxs)(material_1.Grid, __assign({ container: true, textAlign: 'justify', sx: { pt: 2 } }, { children: [(0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 8 }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ variant: "body1", color: "text.secondary" }, { children: "Km moyen annuel :" })) })), (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 4, sx: { textAlign: 'right' } }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ variant: "body1", color: "text.secondary" }, { children: (0, jsx_runtime_1.jsxs)("b", { children: [vehicle.averageMileagePerYear, " km"] }) })) }))] })), localEditMode && (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 12 }, { children: (0, jsx_runtime_1.jsxs)(material_1.FormControl, __assign({ fullWidth: true, margin: "normal", error: Boolean(form.averageMileagePerYear.error) }, { children: [(0, jsx_runtime_1.jsx)(material_1.InputLabel, __assign({ id: "averageMileagePerYear-label" }, { children: "Kilom\u00E9trage moyen annuel" })), (0, jsx_runtime_1.jsxs)(material_1.Select, __assign({ labelId: "averageMileagePerYear-label", id: "averageMileagePerYear", name: "averageMileagePerYear", value: form.averageMileagePerYear.value ?
249
- String(form.averageMileagePerYear.value) : '', onChange: function (e) { return handleSelectChange(e); }, label: "Kilom\u00E9trage moyen annuel" }, { children: [(0, jsx_runtime_1.jsx)(material_1.MenuItem, __assign({ value: 5000 }, { children: "5 000" })), (0, jsx_runtime_1.jsx)(material_1.MenuItem, __assign({ value: 10000 }, { children: "10 000" })), (0, jsx_runtime_1.jsx)(material_1.MenuItem, __assign({ value: 15000 }, { children: "15 000" })), (0, jsx_runtime_1.jsx)(material_1.MenuItem, __assign({ value: 20000 }, { children: "20 000" })), (0, jsx_runtime_1.jsx)(material_1.MenuItem, __assign({ value: 25000 }, { children: "25 000" })), (0, jsx_runtime_1.jsx)(material_1.MenuItem, __assign({ value: 30000 }, { children: "30 000" })), (0, jsx_runtime_1.jsx)(material_1.MenuItem, __assign({ value: 50000 }, { children: "50 000" })), (0, jsx_runtime_1.jsx)(material_1.MenuItem, __assign({ value: 75000 }, { children: "75 000" })), (0, jsx_runtime_1.jsx)(material_1.MenuItem, __assign({ value: 100000 }, { children: "100 000" })), (0, jsx_runtime_1.jsx)(material_1.MenuItem, __assign({ value: 999999 }, { children: "+100 000" }))] })), (0, jsx_runtime_1.jsx)(material_1.FormHelperText, { children: form.averageMileagePerYear.error })] })) })), !localEditMode && (0, jsx_runtime_1.jsxs)(material_1.Grid, __assign({ container: true, textAlign: 'justify', sx: { pt: 2 } }, { children: [(0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 6 }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ variant: "body1", color: "text.secondary" }, { children: "Pneumatiques :" })) })), (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 6, sx: { textAlign: 'right' } }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ variant: "body1", color: "text.secondary" }, { children: isVehicleTireSizeDefined(vehicle) ? (0, jsx_runtime_1.jsx)("b", { children: (0, Tools_1.formatVehicleTire)(vehicle.tireSize) }) : '-' })) }))] })), localEditMode && (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 12, sx: { mt: 1 } }, { children: (0, jsx_runtime_1.jsx)(MovaVehicleTireField_1.default, { vehicleTire: form.tireSize.value, onChangeVehicleTire: handleOnChangeVehicleTire }) })), !localEditMode && (0, jsx_runtime_1.jsxs)(material_1.Grid, __assign({ container: true, textAlign: 'justify', sx: { pt: 2 } }, { children: [(0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 8 }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ variant: "body1", color: "text.secondary" }, { children: "Dernier contr\u00F4le technique :" })) })), (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 4, sx: { textAlign: 'right' } }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ variant: "body1", color: "text.secondary" }, { children: (0, jsx_runtime_1.jsx)("b", { children: (0, DateUtils_1.formatDateByTimezone)(vehicle.lastInspectionDate, 'Europe/Paris', Enums_1.DateFormatTypes.SHORT_FORMAT_DATE) !== '' ? (0, DateUtils_1.formatDateByTimezone)(vehicle.lastInspectionDate, 'Europe/Paris', Enums_1.DateFormatTypes.SHORT_FORMAT_DATE) : '-' }) })) }))] })), localEditMode && (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 12 }, { children: (0, jsx_runtime_1.jsx)(material_1.FormControl, __assign({ fullWidth: true, sx: { marginTop: 2 } }, { children: (0, jsx_runtime_1.jsx)(x_date_pickers_1.DatePicker, { label: "Dernier contrôle technique", name: 'lastInspectionDate', value: form.lastInspectionDate.value, format: 'dd/MM/yyyy', formatDensity: 'dense', views: ['day'], displayWeekNumber: true, onChange: function (e) { return handleChange('lastInspectionDate', e); } }) })) })), !localEditMode && (0, jsx_runtime_1.jsxs)(material_1.Grid, __assign({ container: true, textAlign: 'justify', sx: { pt: 2 } }, { children: [(0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 8 }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ variant: "body1", color: "text.secondary" }, { children: "Dernier entretien :" })) })), (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 4, sx: { textAlign: 'right' } }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ variant: "body1", color: "text.secondary" }, { children: (0, jsx_runtime_1.jsx)("b", { children: (0, DateUtils_1.formatDateByTimezone)(vehicle.lastMaintenanceDate, 'Europe/Paris', Enums_1.DateFormatTypes.SHORT_FORMAT_DATE) !== '' ? (0, DateUtils_1.formatDateByTimezone)(vehicle.lastMaintenanceDate, 'Europe/Paris', Enums_1.DateFormatTypes.SHORT_FORMAT_DATE) : '-' }) })) }))] })), localEditMode && (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 12 }, { children: (0, jsx_runtime_1.jsx)(material_1.FormControl, __assign({ fullWidth: true, sx: { marginTop: 2 } }, { children: (0, jsx_runtime_1.jsx)(x_date_pickers_1.DatePicker, { label: "Dernier entretien", name: 'lastMaintenanceDate', value: form.lastMaintenanceDate.value, format: 'dd/MM/yyyy', formatDensity: 'dense', views: ['day'], displayWeekNumber: true, onChange: function (e) { return handleChange('lastMaintenanceDate', e); } }) })) }))] })), !localEditMode && (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 12 }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ variant: "h6", component: "div", align: "center", sx: { mt: 3, mb: 1 }, color: (0, material_1.darken)(theme.palette.primary.main, 0.2) }, { children: "CARNET DU V\u00C9HICULE" })) })), vehicle.documents && ((_b = vehicle.documents) === null || _b === void 0 ? void 0 : _b.map(function (invoice, index) { return ((0, jsx_runtime_1.jsxs)(material_1.Grid, __assign({ container: true, sx: { justifyContent: 'space-between', alignItems: 'center' } }, { children: [(0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 11, sx: { textAlign: 'left' } }, { children: (0, jsx_runtime_1.jsx)(material_1.Tooltip, __assign({ title: invoice.originalFileName }, { children: (0, jsx_runtime_1.jsx)(material_1.Link, __assign({ color: (0, material_1.darken)('#F29ABA', 0.2), href: invoice.fileSignedUrl, target: "_blank", rel: "noopener" }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ variant: "body1" }, { children: invoice.fileName })) })) })) }), (index + 1) * 50), (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 1, sx: { textAlign: 'right' } }, { children: (0, jsx_runtime_1.jsx)(material_1.IconButton, __assign({ disabled: !(invoice.ownerId.toString() == currentUser.id), onClick: function (e) { return handleDeleteDocument(e, invoice === null || invoice === void 0 ? void 0 : invoice.id); } }, { children: (0, jsx_runtime_1.jsx)(CloseRounded_2.default, {}) })) }), (index + 1) * 100)] }), index + 1)); })), (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ container: true }, { children: (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 12, sx: { mt: 2, textAlign: 'center' } }, { children: (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("input", { accept: "image/*, application/pdf", type: "file", style: { display: 'none' }, ref: invoiceInputRef, id: "raised-button-invoice", onChange: function (e) { return handleFileChange(e, docTypeCurrent.current); } }), (0, jsx_runtime_1.jsx)(material_1.Button, __assign({ size: 'large', disabled: currentUpload, onClick: function () { return setShowLinkedDocument(true); }, component: "span", variant: "outlined", startIcon: (0, jsx_runtime_1.jsx)(icons_material_1.AttachFile, {}), sx: { alignItems: 'center', width: '90%', mt: 2, mb: 1, height: '50px', p: 1, color: (0, material_1.darken)(theme.palette.primary.main, 0.2) } }, { children: "Ajouter un document" })), currentUpload && (0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ variant: 'body2', sx: { animation: 'blink 1.5s infinite' } }, { children: "Document en cours d'importation..." })), sizeLimit && (0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ variant: 'body1', sx: { animation: 'blink 1.5s infinite' }, color: theme.palette.warning.dark }, { children: "Echec de l'importation car la taille du fichier d\u00E9passe 10Mo" })), !sizeLimit && (0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ variant: 'body2' }, { children: "Taille maximale du fichier : 10Mo" }))] }) })) }))] })] })), (0, jsx_runtime_1.jsxs)(material_1.CardActions, __assign({ sx: { mt: 3, justifyContent: localEditMode ? 'center' : 'end' } }, { children: [!localEditMode &&
250
- (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsxs)(material_1.Button, __assign({ onClick: handleOnClickEdit, color: "inherit", sx: { width: '45%' }, variant: 'text' }, { children: [(0, jsx_runtime_1.jsx)(EditRounded_1.default, { sx: { mr: 1 } }), "MODIFIER"] })) }), localEditMode &&
251
- (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(material_1.Button, __assign({ onClick: handleOnClickCancel, sx: { width: '45%', color: theme.palette.text.secondary }, variant: 'text' }, { children: [(0, jsx_runtime_1.jsx)(CloseRounded_1.default, { sx: { mr: 1 } }), "ANNULER"] })), (0, jsx_runtime_1.jsxs)(material_1.Button, __assign({ onClick: handleOnClickValidate, sx: { width: '45%', color: (0, material_1.darken)(theme.palette.primary.main, 0.2) }, variant: 'text' }, { children: [(0, jsx_runtime_1.jsx)(EditRounded_1.default, { sx: { mr: 1 } }), "VALIDER"] }))] })] }))] })), isShowLinkedDocument && (0, jsx_runtime_1.jsx)(LinkedDocumentDialog_1.LinkedDocumentDialog, { isVehicle: true, isShowLinkedDocument: isShowLinkedDocument, appType: appType, toggleShowLinkedDocument: toggleShowLinkedDocument, message: messageRGPD }), (0, jsx_runtime_1.jsx)(ConfirmationDialog_1.default, { open: openConfirmDocumentDelete, onClose: handleCloseConfirmDocumentDelete, onConfirm: handleConfirmDocumentDelete, message: "\u00CAtes-vous s\u00FBr de vouloir supprimer ce document ?" }), (0, jsx_runtime_1.jsx)(ConfirmationDialog_1.default, { open: openConfirmVehicleDelete, onClose: handleCloseConfirmVehicleDelete, onConfirm: handleConfirmVehicleDelete, message: "\u00CAtes-vous s\u00FBr de vouloir supprimer ce v\u00E9hicule ?" })] }));
230
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [vehicle && ((0, jsx_runtime_1.jsxs)(material_1.Card, __assign({ variant: "outlined", sx: {
231
+ maxWidth: fullwidth ? "80%" : 500,
232
+ backgroundColor: focused ? theme.palette.primary.light : "white",
233
+ overflow: "visible",
234
+ mt: 4,
235
+ pb: 1,
236
+ } }, { children: [(0, jsx_runtime_1.jsxs)(material_1.CardContent, __assign({ sx: { pt: 0, pb: 0 } }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Typography, __assign({ variant: "h6", component: "div", align: "center", sx: { mb: 1 }, color: (0, material_1.darken)(theme.palette.primary.main, 0.2) }, { children: [vehicle.brand && "".concat(vehicle.brand, " "), vehicle.model && "".concat(vehicle.model, " "), vehicle.version && "".concat(vehicle.version)] })), (0, jsx_runtime_1.jsxs)(material_1.Grid, __assign({ container: true, justifyContent: "space-between" }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Grid, __assign({ container: true, sx: { mb: 1, alignItems: "center", justifyContent: "center" } }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Grid, __assign({ item: true, xs: 6, sx: { position: "relative", minWidth: "234px" } }, { children: [(0, jsx_runtime_1.jsx)("img", { src: car_plate_bg_png_1.default, alt: "Plaque d'immatriculation", style: { height: "50px", position: "relative" } }), (0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ variant: "h6", color: theme.palette.text.primary, sx: { position: "absolute", top: "8px", left: "76px" } }, { children: (0, jsx_runtime_1.jsx)("b", { children: (0, Tools_1.formatFrenchVehiclePlate)(vehicle.plate) }) }))] })), onDelete && ((0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 6, style: {
237
+ display: "flex",
238
+ alignItems: "center",
239
+ justifyContent: "center",
240
+ } }, { children: (0, jsx_runtime_1.jsx)(material_1.Button, __assign({ variant: "contained", color: "error", onClick: function (e) { return handleOnClickDeleteVehicle(e); } }, { children: "Supprimer" })) })))] })), !localEditMode && ((0, jsx_runtime_1.jsxs)(material_1.Grid, __assign({ container: true, textAlign: "justify", sx: { pt: 2 } }, { children: [(0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 8 }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ variant: "body1", color: "text.secondary" }, { children: "Km actuel :" })) })), (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 4, sx: { textAlign: "right" } }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ variant: "body1", color: "text.secondary" }, { children: (0, jsx_runtime_1.jsxs)("b", { children: [vehicle.currentMileage, " km"] }) })) }))] }))), localEditMode && ((0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 12 }, { children: (0, jsx_runtime_1.jsx)(material_1.TextField, { label: "Kilom\u00E9trage actuel", name: "currentMileage", variant: "outlined", type: "number", required: true, value: form.currentMileage.value, onChange: function (e) { return handleInputChange(e); }, error: Boolean(form.currentMileage.error), sx: {
241
+ width: "100%",
242
+ mt: 2,
243
+ "& input": { textTransform: "uppercase" }, // CSS pour forcer les majuscules dans l'input
244
+ }, helperText: Boolean(form.currentMileage.error &&
245
+ form.currentMileage.value > 0)
246
+ ? form.currentMileage.error
247
+ : "Sur votre tableau de bord 😉" }) }))), !localEditMode && ((0, jsx_runtime_1.jsxs)(material_1.Grid, __assign({ container: true, textAlign: "justify", sx: { pt: 2 } }, { children: [(0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 8 }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ variant: "body1", color: "text.secondary" }, { children: "Km moyen annuel :" })) })), (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 4, sx: { textAlign: "right" } }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ variant: "body1", color: "text.secondary" }, { children: (0, jsx_runtime_1.jsxs)("b", { children: [vehicle.averageMileagePerYear, " km"] }) })) }))] }))), localEditMode && ((0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 12 }, { children: (0, jsx_runtime_1.jsxs)(material_1.FormControl, __assign({ fullWidth: true, margin: "normal", error: Boolean(form.averageMileagePerYear.error) }, { children: [(0, jsx_runtime_1.jsx)(material_1.InputLabel, __assign({ id: "averageMileagePerYear-label" }, { children: "Kilom\u00E9trage moyen annuel" })), (0, jsx_runtime_1.jsxs)(material_1.Select, __assign({ labelId: "averageMileagePerYear-label", id: "averageMileagePerYear", name: "averageMileagePerYear", value: form.averageMileagePerYear.value
248
+ ? String(form.averageMileagePerYear.value)
249
+ : "", onChange: function (e) { return handleSelectChange(e); }, label: "Kilom\u00E9trage moyen annuel" }, { children: [(0, jsx_runtime_1.jsx)(material_1.MenuItem, __assign({ value: 5000 }, { children: "5 000" })), (0, jsx_runtime_1.jsx)(material_1.MenuItem, __assign({ value: 10000 }, { children: "10 000" })), (0, jsx_runtime_1.jsx)(material_1.MenuItem, __assign({ value: 15000 }, { children: "15 000" })), (0, jsx_runtime_1.jsx)(material_1.MenuItem, __assign({ value: 20000 }, { children: "20 000" })), (0, jsx_runtime_1.jsx)(material_1.MenuItem, __assign({ value: 25000 }, { children: "25 000" })), (0, jsx_runtime_1.jsx)(material_1.MenuItem, __assign({ value: 30000 }, { children: "30 000" })), (0, jsx_runtime_1.jsx)(material_1.MenuItem, __assign({ value: 50000 }, { children: "50 000" })), (0, jsx_runtime_1.jsx)(material_1.MenuItem, __assign({ value: 75000 }, { children: "75 000" })), (0, jsx_runtime_1.jsx)(material_1.MenuItem, __assign({ value: 100000 }, { children: "100 000" })), (0, jsx_runtime_1.jsx)(material_1.MenuItem, __assign({ value: 999999 }, { children: "+100 000" }))] })), (0, jsx_runtime_1.jsx)(material_1.FormHelperText, { children: form.averageMileagePerYear.error })] })) }))), !localEditMode && ((0, jsx_runtime_1.jsxs)(material_1.Grid, __assign({ container: true, textAlign: "justify", sx: { pt: 2 } }, { children: [(0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 6 }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ variant: "body1", color: "text.secondary" }, { children: "Pneumatiques :" })) })), (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 6, sx: { textAlign: "right" } }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ variant: "body1", color: "text.secondary" }, { children: isVehicleTireSizeDefined(vehicle) ? ((0, jsx_runtime_1.jsx)("b", { children: (0, Tools_1.formatVehicleTire)(vehicle.tireSize) })) : ("-") })) }))] }))), localEditMode && ((0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 12, sx: { mt: 1 } }, { children: (0, jsx_runtime_1.jsx)(MovaVehicleTireField_1.default, { vehicleTire: form.tireSize.value, onChangeVehicleTire: handleOnChangeVehicleTire }) }))), !localEditMode && ((0, jsx_runtime_1.jsxs)(material_1.Grid, __assign({ container: true, textAlign: "justify", sx: { pt: 2 } }, { children: [(0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 8 }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ variant: "body1", color: "text.secondary" }, { children: "Dernier contr\u00F4le technique :" })) })), (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 4, sx: { textAlign: "right" } }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ variant: "body1", color: "text.secondary" }, { children: (0, jsx_runtime_1.jsx)("b", { children: (0, DateUtils_1.formatDateByTimezone)(vehicle.lastInspectionDate, "Europe/Paris", Enums_1.DateFormatTypes.SHORT_FORMAT_DATE) !== ""
250
+ ? (0, DateUtils_1.formatDateByTimezone)(vehicle.lastInspectionDate, "Europe/Paris", Enums_1.DateFormatTypes.SHORT_FORMAT_DATE)
251
+ : "-" }) })) }))] }))), localEditMode && ((0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 12 }, { children: (0, jsx_runtime_1.jsx)(material_1.FormControl, __assign({ fullWidth: true, sx: { marginTop: 2 } }, { children: (0, jsx_runtime_1.jsx)(x_date_pickers_1.DatePicker, { label: "Dernier contrôle technique", name: "lastInspectionDate", value: form.lastInspectionDate.value, format: "dd/MM/yyyy", formatDensity: "dense", views: ["day"], displayWeekNumber: true, onChange: function (e) { return handleChange("lastInspectionDate", e); } }) })) }))), !localEditMode && ((0, jsx_runtime_1.jsxs)(material_1.Grid, __assign({ container: true, textAlign: "justify", sx: { pt: 2 } }, { children: [(0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 8 }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ variant: "body1", color: "text.secondary" }, { children: "Dernier entretien :" })) })), (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 4, sx: { textAlign: "right" } }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ variant: "body1", color: "text.secondary" }, { children: (0, jsx_runtime_1.jsx)("b", { children: (0, DateUtils_1.formatDateByTimezone)(vehicle.lastMaintenanceDate, "Europe/Paris", Enums_1.DateFormatTypes.SHORT_FORMAT_DATE) !== ""
252
+ ? (0, DateUtils_1.formatDateByTimezone)(vehicle.lastMaintenanceDate, "Europe/Paris", Enums_1.DateFormatTypes.SHORT_FORMAT_DATE)
253
+ : "-" }) })) }))] }))), localEditMode && ((0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 12 }, { children: (0, jsx_runtime_1.jsx)(material_1.FormControl, __assign({ fullWidth: true, sx: { marginTop: 2 } }, { children: (0, jsx_runtime_1.jsx)(x_date_pickers_1.DatePicker, { label: "Dernier entretien", name: "lastMaintenanceDate", value: form.lastMaintenanceDate.value, format: "dd/MM/yyyy", formatDensity: "dense", views: ["day"], displayWeekNumber: true, onChange: function (e) { return handleChange("lastMaintenanceDate", e); } }) })) })))] })), !localEditMode && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 12 }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ variant: "h6", component: "div", align: "center", sx: { mt: 3, mb: 1 }, color: (0, material_1.darken)(theme.palette.primary.main, 0.2) }, { children: "CARNET DU V\u00C9HICULE" })) })), vehicle.documents &&
254
+ ((_b = vehicle.documents) === null || _b === void 0 ? void 0 : _b.map(function (invoice, index) { return ((0, jsx_runtime_1.jsxs)(material_1.Grid, __assign({ container: true, sx: {
255
+ justifyContent: "space-between",
256
+ alignItems: "center",
257
+ } }, { children: [(0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 11, sx: { textAlign: "left" } }, { children: (0, jsx_runtime_1.jsx)(material_1.Tooltip, __assign({ title: invoice.originalFileName }, { children: (0, jsx_runtime_1.jsx)(material_1.Link, __assign({ color: (0, material_1.darken)("#F29ABA", 0.2), href: invoice.fileSignedUrl, target: "_blank", rel: "noopener" }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ variant: "body1" }, { children: invoice.fileName })) })) })) }), (index + 1) * 50), (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 1, sx: { textAlign: "right" } }, { children: (0, jsx_runtime_1.jsx)(material_1.IconButton, __assign({ disabled: !(invoice.ownerId.toString() == currentUser.id), onClick: function (e) { return handleDeleteDocument(e, invoice === null || invoice === void 0 ? void 0 : invoice.id); } }, { children: (0, jsx_runtime_1.jsx)(CloseRounded_1.default, {}) })) }), (index + 1) * 100)] }), index + 1)); })), (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ container: true }, { children: (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 12, sx: { mt: 2, textAlign: "center" } }, { children: (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("input", { accept: "image/*, application/pdf", type: "file", style: { display: "none" }, ref: invoiceInputRef, id: "raised-button-invoice", onChange: function (e) {
258
+ return handleFileChange(e, docTypeCurrent.current);
259
+ } }), (0, jsx_runtime_1.jsx)(material_1.Button, __assign({ size: "large", disabled: currentUpload, onClick: function () { return setShowLinkedDocument(true); }, component: "span", variant: "outlined", startIcon: (0, jsx_runtime_1.jsx)(icons_material_1.AttachFile, {}), sx: {
260
+ alignItems: "center",
261
+ width: "90%",
262
+ mt: 2,
263
+ mb: 1,
264
+ height: "50px",
265
+ p: 1,
266
+ color: (0, material_1.darken)(theme.palette.primary.main, 0.2),
267
+ } }, { children: "Ajouter un document" })), currentUpload && ((0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ variant: "body2", sx: { animation: "blink 1.5s infinite" } }, { children: "Document en cours d'importation..." }))), sizeLimit && ((0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ variant: "body1", sx: { animation: "blink 1.5s infinite" }, color: theme.palette.warning.dark }, { children: "Echec de l'importation car la taille du fichier d\u00E9passe 10Mo" }))), !sizeLimit && ((0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ variant: "body2" }, { children: "Taille maximale du fichier : 10Mo" })))] }) })) }))] }))] })), (0, jsx_runtime_1.jsxs)(material_1.CardActions, __assign({ sx: { mt: 3, justifyContent: localEditMode ? "center" : "end" } }, { children: [!localEditMode && ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsxs)(material_1.Button, __assign({ onClick: handleOnClickEdit, color: "inherit", sx: { width: "45%" }, variant: "text" }, { children: [(0, jsx_runtime_1.jsx)(EditRounded_1.default, { sx: { mr: 1 } }), "MODIFIER"] })) })), localEditMode && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(material_1.Button, __assign({ onClick: handleOnClickCancel, sx: { width: "45%", color: theme.palette.text.secondary }, variant: "text" }, { children: [(0, jsx_runtime_1.jsx)(CloseRounded_1.default, { sx: { mr: 1 } }), "ANNULER"] })), (0, jsx_runtime_1.jsxs)(material_1.Button, __assign({ onClick: handleOnClickValidate, sx: {
268
+ width: "45%",
269
+ color: (0, material_1.darken)(theme.palette.primary.main, 0.2),
270
+ }, variant: "text" }, { children: [(0, jsx_runtime_1.jsx)(EditRounded_1.default, { sx: { mr: 1 } }), "VALIDER"] }))] }))] }))] }))), isShowLinkedDocument && ((0, jsx_runtime_1.jsx)(LinkedDocumentDialog_1.LinkedDocumentDialog, { isVehicle: true, isShowLinkedDocument: isShowLinkedDocument, appType: appType, toggleShowLinkedDocument: toggleShowLinkedDocument, message: messageRGPD })), (0, jsx_runtime_1.jsx)(ConfirmationDialog_1.default, { open: openConfirmDocumentDelete, onClose: handleCloseConfirmDocumentDelete, onConfirm: handleConfirmDocumentDelete, message: "\u00CAtes-vous s\u00FBr de vouloir supprimer ce document ?" }), (0, jsx_runtime_1.jsx)(ConfirmationDialog_1.default, { open: openConfirmVehicleDelete, onClose: handleCloseConfirmVehicleDelete, onConfirm: handleConfirmVehicleDelete, message: "\u00CAtes-vous s\u00FBr de vouloir supprimer ce v\u00E9hicule ?" })] }));
252
271
  };
253
272
  exports.default = VehicleFullCard;
@@ -66,6 +66,11 @@ var request = function (options) {
66
66
  headers.append('Authorization', 'Bearer ' + (0, CookieUtils_1.readCookie)(CookieUtils_1.COOKIE_PRO_TOKEN));
67
67
  }
68
68
  break;
69
+ case Enums_1.MovaAppType.ADMIN:
70
+ if ((0, CookieUtils_1.readCookie)(CookieUtils_1.COOKIE_ADMIN_TOKEN)) {
71
+ headers.append('Authorization', 'Bearer ' + (0, CookieUtils_1.readCookie)(CookieUtils_1.COOKIE_ADMIN_TOKEN));
72
+ }
73
+ break;
69
74
  }
70
75
  // On intègre les headers aux options
71
76
  var defaults = { headers: headers };
@@ -1,5 +1,6 @@
1
1
  export declare const COOKIE_PRO_TOKEN: string;
2
2
  export declare const COOKIE_INDIVIDUAL_TOKEN: string;
3
+ export declare const COOKIE_ADMIN_TOKEN: string;
3
4
  export declare const COOKIE_DEFAULT_EXPIRES: number;
4
5
  export declare const createCookie: (name: string, value: string) => void;
5
6
  export declare const deleteCookie: (name: string) => void;
@@ -3,10 +3,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.readCookie = exports.deleteCookie = exports.createCookie = exports.COOKIE_DEFAULT_EXPIRES = exports.COOKIE_INDIVIDUAL_TOKEN = exports.COOKIE_PRO_TOKEN = void 0;
6
+ exports.readCookie = exports.deleteCookie = exports.createCookie = exports.COOKIE_DEFAULT_EXPIRES = exports.COOKIE_ADMIN_TOKEN = exports.COOKIE_INDIVIDUAL_TOKEN = exports.COOKIE_PRO_TOKEN = void 0;
7
7
  var js_cookie_1 = __importDefault(require("js-cookie"));
8
8
  exports.COOKIE_PRO_TOKEN = 'movalibProToken';
9
9
  exports.COOKIE_INDIVIDUAL_TOKEN = 'movalibIndividualToken';
10
+ exports.COOKIE_ADMIN_TOKEN = 'movalibAdminToken';
10
11
  exports.COOKIE_DEFAULT_EXPIRES = 7;
11
12
  var createCookie = function (name, value) {
12
13
  console.log('from lib', name, value);
@@ -153,7 +153,7 @@ export declare enum DigitalPassportIndex {
153
153
  export declare enum EventState {
154
154
  /**
155
155
  * Demande d'empreinte bancaire (pour validation de la demande de RDV)
156
- */
156
+ */
157
157
  REQUIRES_PAYMENT_AUTHORIZATION = "REQUIRES_PAYMENT_AUTHORIZATION",
158
158
  /**
159
159
  * Nouvelle demande de rendez-vous (origine client OU centre)
@@ -192,7 +192,8 @@ export declare enum EventType {
192
192
  APPOINTMENT = "APPOINTMENT",
193
193
  UNAVAILABILITY = "UNAVAILABILITY",
194
194
  NOTE = "NOTE",
195
- PENDING_APPOINTMENT = "PENDING_APPOINTMENT"
195
+ PENDING_APPOINTMENT = "PENDING_APPOINTMENT",
196
+ WAITING_VEHICLE = "WAITING_VEHICLE"
196
197
  }
197
198
  export declare enum DayOfWeek {
198
199
  MONDAY = "MONDAY",
@@ -222,12 +223,12 @@ export declare enum DocumentType {
222
223
  }
223
224
  export declare enum MovaAppType {
224
225
  /**
225
- * Application Garagiste
226
- */
226
+ * Application Garagiste
227
+ */
227
228
  GARAGE = "GARAGE",
228
229
  /**
229
- * Application Utilisateur (automobiliste)
230
- */
230
+ * Application Utilisateur (automobiliste)
231
+ */
231
232
  INDIVIDUAL = "INDIVIDUAL",
232
233
  /**
233
234
  * Application Administrateur (MovaTeam)
@@ -175,7 +175,7 @@ var EventState;
175
175
  (function (EventState) {
176
176
  /**
177
177
  * Demande d'empreinte bancaire (pour validation de la demande de RDV)
178
- */
178
+ */
179
179
  EventState["REQUIRES_PAYMENT_AUTHORIZATION"] = "REQUIRES_PAYMENT_AUTHORIZATION";
180
180
  /**
181
181
  * Nouvelle demande de rendez-vous (origine client OU centre)
@@ -216,6 +216,7 @@ var EventType;
216
216
  EventType["UNAVAILABILITY"] = "UNAVAILABILITY";
217
217
  EventType["NOTE"] = "NOTE";
218
218
  EventType["PENDING_APPOINTMENT"] = "PENDING_APPOINTMENT";
219
+ EventType["WAITING_VEHICLE"] = "WAITING_VEHICLE";
219
220
  })(EventType = exports.EventType || (exports.EventType = {}));
220
221
  var DayOfWeek;
221
222
  (function (DayOfWeek) {
@@ -249,12 +250,12 @@ var DocumentType;
249
250
  var MovaAppType;
250
251
  (function (MovaAppType) {
251
252
  /**
252
- * Application Garagiste
253
- */
253
+ * Application Garagiste
254
+ */
254
255
  MovaAppType["GARAGE"] = "GARAGE";
255
256
  /**
256
- * Application Utilisateur (automobiliste)
257
- */
257
+ * Application Utilisateur (automobiliste)
258
+ */
258
259
  MovaAppType["INDIVIDUAL"] = "INDIVIDUAL";
259
260
  /**
260
261
  * Application Administrateur (MovaTeam)
@@ -12,6 +12,7 @@ export default class Document {
12
12
  updateDate?: Date;
13
13
  reference?: string;
14
14
  rejectReason?: string;
15
- constructor(id: string, ownerId: number, state: DocumentState, fileName: string, originalFileName: string, fileType: string, fileSignedUrl: string, type: DocumentType, creationDate?: Date, updateDate?: Date, reference?: string);
15
+ validateToken?: string;
16
+ constructor(id: string, ownerId: number, state: DocumentState, fileName: string, originalFileName: string, fileType: string, fileSignedUrl: string, type: DocumentType, creationDate?: Date, updateDate?: Date, reference?: string, validateToken?: string);
16
17
  static findByTypeAndReference(documents: Document[], type: DocumentType, reference: string): Document | undefined;
17
18
  }
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  var Document = /** @class */ (function () {
4
- function Document(id, ownerId, state, fileName, originalFileName, fileType, fileSignedUrl, type, creationDate, updateDate, reference) {
4
+ function Document(id, ownerId, state, fileName, originalFileName, fileType, fileSignedUrl, type, creationDate, updateDate, reference, validateToken) {
5
5
  this.id = id;
6
6
  this.state = state;
7
7
  this.ownerId = ownerId;
@@ -13,13 +13,11 @@ var Document = /** @class */ (function () {
13
13
  this.creationDate = creationDate;
14
14
  this.updateDate = updateDate;
15
15
  this.reference = reference;
16
+ this.validateToken = validateToken;
16
17
  }
17
18
  Document.findByTypeAndReference = function (documents, type, reference) {
18
19
  if (documents && type && reference) {
19
- return documents.find(function (document) {
20
- return document.type === type &&
21
- document.reference === reference;
22
- });
20
+ return documents.find(function (document) { return document.type === type && document.reference === reference; });
23
21
  }
24
22
  return undefined;
25
23
  };
@@ -9,6 +9,15 @@ import Product from "./Product";
9
9
  import Supplier from "./Supplier";
10
10
  import User from "./User";
11
11
  import Vehicle from "./Vehicle";
12
+ interface order {
13
+ id: string;
14
+ supplier: Supplier;
15
+ orderPreference: string;
16
+ orderType: string;
17
+ orderDate: Date;
18
+ comment: string;
19
+ deliveryDate: Date | null;
20
+ }
12
21
  export default class Event {
13
22
  id: string;
14
23
  ownerId: number;
@@ -23,6 +32,7 @@ export default class Event {
23
32
  prestations?: Prestation[];
24
33
  operations?: Operation[];
25
34
  products?: Product[];
35
+ orders?: order[];
26
36
  /**
27
37
  * Un tableau d'invités, dans notre cas d'usage nous n'aurons qu'un invité de type Client
28
38
  */
@@ -67,6 +77,7 @@ export default class Event {
67
77
  origin?: string;
68
78
  quoteLastSendingTime?: Date;
69
79
  invoiceSendingDate?: Date;
70
- constructor(id: string, ownerId: number, type: EventType, title: string, garageName: string, garageId: number, color: string, state: EventState, garageAddress?: Address, start?: Date, end?: Date, prestations?: Prestation[], operations?: Operation[], products?: Product[], guestsId?: string[], vehicleId?: number, quoteId?: number, notes?: string, vehicleAvailableNotified?: boolean, editable?: boolean, resourceId?: number, garageVehicleId?: number, garageVehicleRequest?: boolean, vehicleAvailableNotificationTime?: Date, interventionEndTime?: Date, quoteLastSendingTime?: Date, invoiceSendingDate?: Date);
80
+ constructor(id: string, ownerId: number, type: EventType, title: string, garageName: string, garageId: number, color: string, state: EventState, garageAddress?: Address, start?: Date, end?: Date, prestations?: Prestation[], operations?: Operation[], products?: Product[], guestsId?: string[], vehicleId?: number, quoteId?: number, notes?: string, vehicleAvailableNotified?: boolean, editable?: boolean, resourceId?: number, garageVehicleId?: number, garageVehicleRequest?: boolean, vehicleAvailableNotificationTime?: Date, interventionEndTime?: Date, quoteLastSendingTime?: Date, invoiceSendingDate?: Date, orders?: order[]);
71
81
  static getPrestationsList(event: Event): string[];
72
82
  }
83
+ export {};
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  var Event = /** @class */ (function () {
4
- function Event(id, ownerId, type, title, garageName, garageId, color, state, garageAddress, start, end, prestations, operations, products, guestsId, vehicleId, quoteId, notes, vehicleAvailableNotified, editable, resourceId, garageVehicleId, garageVehicleRequest, vehicleAvailableNotificationTime, interventionEndTime, quoteLastSendingTime, invoiceSendingDate) {
4
+ function Event(id, ownerId, type, title, garageName, garageId, color, state, garageAddress, start, end, prestations, operations, products, guestsId, vehicleId, quoteId, notes, vehicleAvailableNotified, editable, resourceId, garageVehicleId, garageVehicleRequest, vehicleAvailableNotificationTime, interventionEndTime, quoteLastSendingTime, invoiceSendingDate, orders) {
5
5
  this.id = id;
6
6
  this.notes = notes;
7
7
  this.ownerId = ownerId;
@@ -37,6 +37,7 @@ var Event = /** @class */ (function () {
37
37
  this.invoiceSendingDate = invoiceSendingDate
38
38
  ? new Date(invoiceSendingDate)
39
39
  : undefined;
40
+ this.orders = orders;
40
41
  }
41
42
  Event.getPrestationsList = function (event) {
42
43
  if (event && event.prestations) {