@movalib/movalib-commons 1.0.64 → 1.0.66

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.
@@ -38,18 +38,21 @@ var initialUserFormState = {
38
38
  tireSpeedIndex: { value: '', isValid: true }
39
39
  };
40
40
  var VehicleFullCard = function (_a) {
41
- var vehicle = _a.vehicle, fullwidth = _a.fullwidth, onError = _a.onError, onUploadDocument = _a.onUploadDocument, onDeleteDocument = _a.onDeleteDocument, _b = _a.editMode, editMode = _b === void 0 ? false : _b, _c = _a.focused, focused = _c === void 0 ? false : _c, onUpdate = _a.onUpdate, onDelete = _a.onDelete;
41
+ var _b, _c;
42
+ var vehicle = _a.vehicle, fullwidth = _a.fullwidth, onError = _a.onError, onUploadDocument = _a.onUploadDocument, onDeleteDocument = _a.onDeleteDocument, _d = _a.editMode, editMode = _d === void 0 ? false : _d, _e = _a.focused, focused = _e === void 0 ? false : _e, onUpdate = _a.onUpdate, onDelete = _a.onDelete;
42
43
  var theme = (0, material_1.useTheme)();
43
- var _d = (0, react_1.useState)(editMode), localEditMode = _d[0], setLocalEditMode = _d[1];
44
- var _e = (0, react_1.useState)(false), openConfirmDocumentDelete = _e[0], setOpenConfirmDocumentDelete = _e[1];
45
- var _f = (0, react_1.useState)(false), openConfirmVehicleDelete = _f[0], setOpenConfirmVehicleDelete = _f[1];
46
- var _g = (0, react_1.useState)(''), documentToDelete = _g[0], setDocumentToDelete = _g[1];
44
+ var _f = (0, react_1.useState)(editMode), localEditMode = _f[0], setLocalEditMode = _f[1];
45
+ var _g = (0, react_1.useState)(false), openConfirmDocumentDelete = _g[0], setOpenConfirmDocumentDelete = _g[1];
46
+ var _h = (0, react_1.useState)(false), openConfirmVehicleDelete = _h[0], setOpenConfirmVehicleDelete = _h[1];
47
+ var _j = (0, react_1.useState)(''), documentToDelete = _j[0], setDocumentToDelete = _j[1];
47
48
  // Formulaire utilisé pour les modifications d'informations sur le véhicule
48
- var _h = (0, react_1.useState)(initialUserFormState), form = _h[0], setForm = _h[1];
49
- var _j = (0, react_1.useState)([]), vehicleDocuments = _j[0], setVehicleDocuments = _j[1];
49
+ var _k = (0, react_1.useState)(initialUserFormState), form = _k[0], setForm = _k[1];
50
50
  // Références aux éventuels documents uploadés depuis la fiche
51
51
  var invoiceInputRef = (0, react_1.useRef)(null);
52
52
  var tirePictureInputRef = (0, react_1.useRef)(null);
53
+ (0, react_1.useEffect)(function () {
54
+ setLocalEditMode(editMode);
55
+ }, [editMode]);
53
56
  (0, react_1.useEffect)(function () {
54
57
  initForm();
55
58
  }, [vehicle]);
@@ -214,8 +217,8 @@ var VehicleFullCard = function (_a) {
214
217
  '& input': { textTransform: 'uppercase' } // CSS pour forcer les majuscules dans l'input
215
218
  }, helperText: Boolean(form.currentMileage.error && form.currentMileage.value > 0)
216
219
  ? form.currentMileage.error : "Sur ton 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 ?
217
- 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)(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" })) })), vehicleDocuments && (vehicleDocuments === null || vehicleDocuments === void 0 ? void 0 : vehicleDocuments.filter(function (doc) { return doc.type === Enums_1.DocumentType.VEHICLE_MAINTENANCE_INVOICE; }).map(function (invoice, index) { return ((0, jsx_runtime_1.jsxs)(material_1.Grid, __assign({ container: true, sx: { justifyContent: 'center', alignItems: 'center' } }, { children: [(0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 11, sm: 6, md: 4, sx: { textAlign: 'left' } }, { children: (0, jsx_runtime_1.jsxs)(material_1.Link, __assign({ color: (0, material_1.darken)('#F29ABA', 0.2), href: invoice.fileSignedUrl, target: "_blank", rel: "noopener" }, { children: ["Facture du ", (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, DateUtils_1.formatDateByCountryCode)(invoice.creationDate, 'fr', Enums_1.DateFormatTypes.SHORT_FORMAT_DATE) })] })) }), (index + 1) * 50), (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 1, sm: 1, md: 1, sx: { textAlign: 'right' } }, { children: (0, jsx_runtime_1.jsx)(material_1.IconButton, __assign({ onClick: function (e) { return handleDeleteDocument(e, invoice.id); } }, { children: (0, jsx_runtime_1.jsx)(CloseRounded_2.default, {}) })) }), (index + 1) * 100)] }), index + 1)); })), vehicleDocuments && (vehicleDocuments === null || vehicleDocuments === void 0 ? void 0 : vehicleDocuments.filter(function (doc) { return doc.type === Enums_1.DocumentType.VEHICLE_TIRE_PHOTO; }).map(function (tirePhoto, index) { return ((0, jsx_runtime_1.jsxs)(material_1.Grid, __assign({ container: true, sx: { justifyContent: 'center', alignItems: 'center' } }, { children: [(0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 11, sm: 6, md: 4, sx: { textAlign: 'left' } }, { children: (0, jsx_runtime_1.jsxs)(material_1.Link, __assign({ color: (0, material_1.darken)('#F29ABA', 0.2), href: tirePhoto.fileSignedUrl, target: "_blank", rel: "noopener" }, { children: ["Photo pneu du ", (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, DateUtils_1.formatDateByCountryCode)(tirePhoto.creationDate, 'fr', Enums_1.DateFormatTypes.SHORT_FORMAT_DATE) })] })) }), (index + 1) * 50), (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 1, sm: 1, md: 1, sx: { textAlign: 'right' } }, { children: (0, jsx_runtime_1.jsx)(material_1.IconButton, __assign({ onClick: function (e) { return handleDeleteDocument(e, tirePhoto.id); } }, { children: (0, jsx_runtime_1.jsx)(CloseRounded_2.default, {}) })) }), (index + 1) * 100)] }), index + 1)); })), (0, jsx_runtime_1.jsxs)(material_1.Grid, __assign({ container: true }, { children: [(0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 6, sx: { mt: 2 } }, { 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, Enums_1.DocumentType.VEHICLE_MAINTENANCE_INVOICE); } }), (0, jsx_runtime_1.jsx)("label", __assign({ htmlFor: "raised-button-invoice" }, { children: (0, jsx_runtime_1.jsx)(material_1.Button, __assign({ size: 'large', component: "span", variant: "outlined", sx: { alignItems: 'normal', width: '90%', mt: 2, mb: 1, height: '70px', p: 1,
218
- color: (0, material_1.darken)(theme.palette.primary.main, 0.2) } }, { children: "Ajouter Facture" })) }))] }) })), (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 6, sx: { mt: 2 } }, { children: (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("input", { accept: "image/*", type: "file", style: { display: 'none' }, ref: tirePictureInputRef, id: "raised-button-tire", onChange: function (e) { return handleFileChange(e, Enums_1.DocumentType.VEHICLE_TIRE_PHOTO); } }), (0, jsx_runtime_1.jsx)("label", __assign({ htmlFor: "raised-button-tire" }, { children: (0, jsx_runtime_1.jsx)(material_1.Button, __assign({ component: "span", size: 'large', variant: "outlined", sx: { alignItems: 'normal', width: '90%', mt: 2, mb: 1, height: '70px', p: 1,
220
+ 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)(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.filter(function (doc) { return doc.type === Enums_1.DocumentType.VEHICLE_MAINTENANCE_INVOICE; }).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.Link, __assign({ color: (0, material_1.darken)('#F29ABA', 0.2), href: invoice.fileSignedUrl, target: "_blank", rel: "noopener" }, { children: (0, jsx_runtime_1.jsxs)(material_1.Typography, __assign({ variant: "body1" }, { children: ["Facture du ", (0, DateUtils_1.formatDateByCountryCode)(invoice.creationDate, 'fr', Enums_1.DateFormatTypes.SHORT_FORMAT_DATE)] })) })) }), (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({ onClick: function (e) { return handleDeleteDocument(e, invoice.id); } }, { children: (0, jsx_runtime_1.jsx)(CloseRounded_2.default, {}) })) }), (index + 1) * 100)] }), index + 1)); })), vehicle.documents && ((_c = vehicle.documents) === null || _c === void 0 ? void 0 : _c.filter(function (doc) { return doc.type === Enums_1.DocumentType.VEHICLE_TIRE_PHOTO; }).map(function (tirePhoto, 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.Link, __assign({ color: (0, material_1.darken)('#F29ABA', 0.2), href: tirePhoto.fileSignedUrl, target: "_blank", rel: "noopener" }, { children: (0, jsx_runtime_1.jsxs)(material_1.Typography, __assign({ variant: "body1" }, { children: ["Photo pneu du ", (0, DateUtils_1.formatDateByCountryCode)(tirePhoto.creationDate, 'fr', Enums_1.DateFormatTypes.SHORT_FORMAT_DATE)] })) })) }), (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({ onClick: function (e) { return handleDeleteDocument(e, tirePhoto.id); } }, { children: (0, jsx_runtime_1.jsx)(CloseRounded_2.default, {}) })) }), (index + 1) * 100)] }), index + 1)); })), (0, jsx_runtime_1.jsxs)(material_1.Grid, __assign({ container: true }, { children: [(0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 6, 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, Enums_1.DocumentType.VEHICLE_MAINTENANCE_INVOICE); } }), (0, jsx_runtime_1.jsx)("label", __assign({ htmlFor: "raised-button-invoice" }, { children: (0, jsx_runtime_1.jsx)(material_1.Button, __assign({ size: 'large', component: "span", variant: "outlined", sx: { alignItems: 'normal', width: '90%', mt: 2, mb: 1, height: '70px', p: 1,
221
+ color: (0, material_1.darken)(theme.palette.primary.main, 0.2) } }, { children: "Ajouter Facture" })) }))] }) })), (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 6, sx: { mt: 2, textAlign: 'center' } }, { children: (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("input", { accept: "image/*", type: "file", style: { display: 'none' }, ref: tirePictureInputRef, id: "raised-button-tire", onChange: function (e) { return handleFileChange(e, Enums_1.DocumentType.VEHICLE_TIRE_PHOTO); } }), (0, jsx_runtime_1.jsx)("label", __assign({ htmlFor: "raised-button-tire" }, { children: (0, jsx_runtime_1.jsx)(material_1.Button, __assign({ component: "span", variant: "outlined", sx: { alignItems: 'normal', width: '90%', mt: 2, mb: 1, height: '70px', p: 1,
219
222
  color: (0, material_1.darken)(theme.palette.primary.main, 0.2) } }, { children: "Ajouter Photo Pneu" })) }))] }) }))] }))] })] })), (0, jsx_runtime_1.jsxs)(material_1.CardActions, __assign({ sx: { mt: 3, justifyContent: localEditMode ? 'center' : 'end' } }, { children: [!localEditMode &&
220
223
  (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 &&
221
224
  (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"] }))] })] }))] })), localEditMode && onDelete &&
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@movalib/movalib-commons",
3
- "version": "1.0.64",
3
+ "version": "1.0.66",
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",
@@ -49,11 +49,14 @@ const VehicleFullCard: FC<VehicleFullCardProps> = ({ vehicle, fullwidth, onError
49
49
  const [documentToDelete, setDocumentToDelete] = useState('');
50
50
  // Formulaire utilisé pour les modifications d'informations sur le véhicule
51
51
  const [form, setForm] = useState<MovaVehicleForm>(initialUserFormState);
52
- const [vehicleDocuments, setVehicleDocuments] = useState<Document[]>([]);
53
52
  // Références aux éventuels documents uploadés depuis la fiche
54
53
  const invoiceInputRef = useRef(null);
55
54
  const tirePictureInputRef = useRef(null);
56
55
 
56
+ useEffect(() => {
57
+ setLocalEditMode(editMode);
58
+ }, [editMode]);
59
+
57
60
  useEffect(() => {
58
61
  initForm();
59
62
  }, [vehicle]);
@@ -362,15 +365,17 @@ const VehicleFullCard: FC<VehicleFullCardProps> = ({ vehicle, fullwidth, onError
362
365
  </Grid>
363
366
 
364
367
  {/** Les FACTURES du véhicule */}
365
- {vehicleDocuments && vehicleDocuments?.filter(doc => doc.type === DocumentType.VEHICLE_MAINTENANCE_INVOICE)
368
+ {vehicle.documents && vehicle.documents?.filter(doc => doc.type === DocumentType.VEHICLE_MAINTENANCE_INVOICE)
366
369
  .map((invoice, index) => (
367
- <Grid container sx={{ justifyContent: 'center', alignItems: 'center' }} key={index+1}>
368
- <Grid item xs={11} sm={6} md={4} key={(index+1)*50} sx={{ textAlign: 'left' }} >
370
+ <Grid container sx={{ justifyContent: 'space-between', alignItems: 'center' }} key={index+1}>
371
+ <Grid item xs={11} key={(index+1)*50} sx={{ textAlign: 'left' }} >
369
372
  <Link color={darken('#F29ABA', 0.2)} href={invoice.fileSignedUrl} target="_blank" rel="noopener">
370
- Facture du <>{formatDateByCountryCode(invoice.creationDate, 'fr', DateFormatTypes.SHORT_FORMAT_DATE)}</>
373
+ <Typography variant="body1">
374
+ Facture du {formatDateByCountryCode(invoice.creationDate, 'fr', DateFormatTypes.SHORT_FORMAT_DATE)}
375
+ </Typography>
371
376
  </Link>
372
377
  </Grid>
373
- <Grid item xs={1} sm={1} md={1} key={(index+1)*100} sx={{ textAlign: 'right' }}>
378
+ <Grid item xs={1} key={(index+1)*100} sx={{ textAlign: 'right' }}>
374
379
  <IconButton onClick={(e) => handleDeleteDocument(e, invoice.id)}>
375
380
  <CloseIcon />
376
381
  </IconButton>
@@ -379,15 +384,17 @@ const VehicleFullCard: FC<VehicleFullCardProps> = ({ vehicle, fullwidth, onError
379
384
  ))}
380
385
 
381
386
  {/** Les PHOTOS du véhicule */}
382
- {vehicleDocuments && vehicleDocuments?.filter(doc => doc.type === DocumentType.VEHICLE_TIRE_PHOTO)
387
+ {vehicle.documents && vehicle.documents?.filter(doc => doc.type === DocumentType.VEHICLE_TIRE_PHOTO)
383
388
  .map((tirePhoto, index) => (
384
- <Grid container sx={{ justifyContent: 'center', alignItems: 'center' }} key={index+1}>
385
- <Grid item xs={11} sm={6} md={4} key={(index+1)*50} sx={{ textAlign: 'left' }} >
389
+ <Grid container sx={{ justifyContent: 'space-between', alignItems: 'center' }} key={index+1}>
390
+ <Grid item xs={11} key={(index+1)*50} sx={{ textAlign: 'left' }} >
386
391
  <Link color={darken('#F29ABA', 0.2)} href={tirePhoto.fileSignedUrl} target="_blank" rel="noopener">
387
- Photo pneu du <>{formatDateByCountryCode(tirePhoto.creationDate, 'fr', DateFormatTypes.SHORT_FORMAT_DATE)}</>
392
+ <Typography variant="body1">
393
+ Photo pneu du {formatDateByCountryCode(tirePhoto.creationDate, 'fr', DateFormatTypes.SHORT_FORMAT_DATE)}
394
+ </Typography>
388
395
  </Link>
389
396
  </Grid>
390
- <Grid item xs={1} sm={1} md={1} key={(index+1)*100} sx={{ textAlign: 'right' }}>
397
+ <Grid item xs={1} key={(index+1)*100} sx={{ textAlign: 'right' }}>
391
398
  <IconButton onClick={(e) => handleDeleteDocument(e, tirePhoto.id)}>
392
399
  <CloseIcon />
393
400
  </IconButton>
@@ -396,7 +403,7 @@ const VehicleFullCard: FC<VehicleFullCardProps> = ({ vehicle, fullwidth, onError
396
403
  ))}
397
404
 
398
405
  <Grid container >
399
- <Grid item xs={6} sx={{ mt: 2 }} >
406
+ <Grid item xs={6} sx={{ mt: 2, textAlign: 'center' }} >
400
407
  {/* Input caché de type "file" */}
401
408
  <div>
402
409
  <input
@@ -417,7 +424,7 @@ const VehicleFullCard: FC<VehicleFullCardProps> = ({ vehicle, fullwidth, onError
417
424
  </div>
418
425
  </Grid>
419
426
 
420
- <Grid item xs={6} sx={{ mt: 2 }} >
427
+ <Grid item xs={6} sx={{ mt: 2, textAlign: 'center' }} >
421
428
  {/* Input caché de type "file" */}
422
429
  <div>
423
430
  <input
@@ -429,7 +436,7 @@ const VehicleFullCard: FC<VehicleFullCardProps> = ({ vehicle, fullwidth, onError
429
436
  onChange={(e) => handleFileChange(e, DocumentType.VEHICLE_TIRE_PHOTO)}
430
437
  />
431
438
  <label htmlFor="raised-button-tire">
432
- <Button component="span" size='large' variant="outlined"
439
+ <Button component="span" variant="outlined"
433
440
  sx={{ alignItems: 'normal', width:'90%', mt: 2, mb: 1, height: '70px', p:1,
434
441
  color:darken(theme.palette.primary.main, 0.2) }}>
435
442
  Ajouter Photo Pneu