@movalib/movalib-commons 1.64.1 → 1.64.3
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/.github/workflows/main.yml +24 -0
- package/dist/src/MovaVehicleTireField.d.ts +3 -2
- package/dist/src/MovaVehicleTireField.js +15 -11
- package/dist/src/components/vehicle/VehicleFullCard.js +40 -17
- package/dist/src/helpers/Enums.d.ts +2 -1
- package/dist/src/helpers/Enums.js +1 -0
- package/dist/src/helpers/Types.d.ts +5 -0
- package/dist/src/models/Event.d.ts +2 -1
- package/dist/src/models/Event.js +2 -1
- package/dist/src/models/Garage.d.ts +2 -1
- package/dist/src/models/Garage.js +2 -1
- package/dist/src/models/Prestation.d.ts +2 -1
- package/dist/src/models/Prestation.js +2 -1
- package/dist/src/models/Vehicle.d.ts +6 -1
- package/dist/src/models/Vehicle.js +6 -1
- package/dist/src/services/GarageService.d.ts +1 -0
- package/dist/src/services/GarageService.js +7 -0
- package/dist/src/services/GarageService.types.d.ts +4 -0
- package/package.json +2 -1
- package/src/MovaVehicleTireField.tsx +118 -107
- package/src/components/vehicle/VehicleFullCard.tsx +144 -70
- package/src/helpers/Enums.ts +1 -0
- package/src/helpers/Types.ts +5 -0
- package/src/models/Event.ts +4 -1
- package/src/models/Garage.ts +4 -1
- package/src/models/Prestation.ts +3 -1
- package/src/models/Vehicle.ts +15 -0
- package/src/services/GarageService.ts +9 -0
- package/src/services/GarageService.types.ts +31 -27
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
name: Publish to GitHub Packages
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch: # déclenchement manuel uniquement
|
|
5
|
+
permissions:
|
|
6
|
+
contents: read
|
|
7
|
+
packages: write
|
|
8
|
+
jobs:
|
|
9
|
+
publish:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
steps:
|
|
12
|
+
- uses: actions/checkout@v3
|
|
13
|
+
|
|
14
|
+
- uses: actions/setup-node@v3
|
|
15
|
+
with:
|
|
16
|
+
node-version: 18.20.8
|
|
17
|
+
registry-url: https://npm.pkg.github.com/
|
|
18
|
+
scope: "@movalib"
|
|
19
|
+
|
|
20
|
+
- run: npm ci
|
|
21
|
+
|
|
22
|
+
- run: npm publish
|
|
23
|
+
env:
|
|
24
|
+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { type FC } from
|
|
2
|
-
import VehicleTire from
|
|
1
|
+
import { type FC } from "react";
|
|
2
|
+
import VehicleTire from "./models/VehicleTire";
|
|
3
3
|
interface MovaVehicleTireFieldProps {
|
|
4
|
+
label?: string;
|
|
4
5
|
vehicleTire?: VehicleTire;
|
|
5
6
|
onChangeVehicleTire: (vehicleTire: VehicleTire, isValid: boolean) => void;
|
|
6
7
|
}
|
|
@@ -6,13 +6,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
7
|
var material_1 = require("@mui/material");
|
|
8
8
|
var react_1 = require("react");
|
|
9
|
-
var VehicleTire_1 = __importDefault(require("./models/VehicleTire"));
|
|
10
9
|
var Tools_1 = require("./helpers/Tools");
|
|
10
|
+
var VehicleTire_1 = __importDefault(require("./models/VehicleTire"));
|
|
11
11
|
// Regex pour une taille de pneumatique Française
|
|
12
12
|
var regex = /^[A-Za-z0-9]{7}/;
|
|
13
13
|
var MovaVehicleTireField = function (_a) {
|
|
14
|
-
var vehicleTire = _a.vehicleTire, onChangeVehicleTire = _a.onChangeVehicleTire;
|
|
15
|
-
var _b = (0, react_1.useState)(
|
|
14
|
+
var vehicleTire = _a.vehicleTire, onChangeVehicleTire = _a.onChangeVehicleTire, label = _a.label;
|
|
15
|
+
var _b = (0, react_1.useState)(""), tireInfo = _b[0], setTireInfo = _b[1];
|
|
16
16
|
var _c = (0, react_1.useState)(false), error = _c[0], setError = _c[1];
|
|
17
17
|
var _d = (0, react_1.useState)(0), lastLength = _d[0], setLastLength = _d[1]; // Ajout d'un état pour stocker la longueur précédente
|
|
18
18
|
(0, react_1.useEffect)(function () {
|
|
@@ -25,7 +25,10 @@ var MovaVehicleTireField = function (_a) {
|
|
|
25
25
|
var rawValue = e.target.value;
|
|
26
26
|
// Cette expression régulière supprimera tous les caractères qui ne sont pas des chiffres ou des lettres alphabétiques, à l'exception de "R" et "r".
|
|
27
27
|
// On ne peut saisir que 10 caractères maximum (ex : 245551791V)
|
|
28
|
-
var value = rawValue
|
|
28
|
+
var value = rawValue
|
|
29
|
+
.toUpperCase()
|
|
30
|
+
.replace(/[^0-9A-QS-Za-qs-z]/g, "")
|
|
31
|
+
.slice(0, 15);
|
|
29
32
|
// On valide la saisie (le champ n'est pas obligatoire)
|
|
30
33
|
var isValid = value.length == 0 || (value.length > 0 && regex.test(value));
|
|
31
34
|
setError(!regex.test(value));
|
|
@@ -56,8 +59,9 @@ var MovaVehicleTireField = function (_a) {
|
|
|
56
59
|
//console.log('2 valeu',JSON.stringify(value));
|
|
57
60
|
if (additonalChar) {
|
|
58
61
|
var endString = rawValue.substring(15);
|
|
59
|
-
value =
|
|
60
|
-
|
|
62
|
+
value =
|
|
63
|
+
value.substring(0, 15) + (endString !== undefined ? endString : "");
|
|
64
|
+
console.log(rawValue.split(" ")[5]);
|
|
61
65
|
}
|
|
62
66
|
else {
|
|
63
67
|
var endString = rawValue.substring(12);
|
|
@@ -76,14 +80,14 @@ var MovaVehicleTireField = function (_a) {
|
|
|
76
80
|
else {
|
|
77
81
|
var width = parts[0], _separator = parts[1], height = parts[2], diameter = parts[3], speedIndex = parts[4];
|
|
78
82
|
speedIndex = value.substring(13);
|
|
79
|
-
var vehicleTire_2 = new VehicleTire_1.default(width !== null && width !== void 0 ? width :
|
|
83
|
+
var vehicleTire_2 = new VehicleTire_1.default(width !== null && width !== void 0 ? width : "", height !== null && height !== void 0 ? height : "", diameter !== null && diameter !== void 0 ? diameter : "", speedIndex !== null && speedIndex !== void 0 ? speedIndex : "");
|
|
80
84
|
onChangeVehicleTire(vehicleTire_2, isValid);
|
|
81
85
|
}
|
|
82
86
|
setLastLength(value.length); // Mettre à jour la longueur précédente
|
|
83
87
|
};
|
|
84
|
-
return ((0, jsx_runtime_1.jsx)(material_1.TextField, { label: "Taille des pneumatiques", variant: "outlined", value: tireInfo, onChange: handleChange, fullWidth: true, placeholder:
|
|
85
|
-
width:
|
|
86
|
-
|
|
87
|
-
}, error: error && tireInfo.length > 0, helperText: error && tireInfo.length > 0 ? "Saisie invalide" :
|
|
88
|
+
return ((0, jsx_runtime_1.jsx)(material_1.TextField, { label: label ? "Taille des pneumatiques ".concat(label) : "Taille des pneumatiques", variant: "outlined", value: tireInfo, onChange: handleChange, fullWidth: true, placeholder: "XXX XX RXX XXX", sx: {
|
|
89
|
+
width: "100%",
|
|
90
|
+
"& input": { textTransform: "uppercase" }, // CSS pour forcer les majuscules dans l'input
|
|
91
|
+
}, error: error && tireInfo.length > 0, helperText: error && tireInfo.length > 0 ? "Saisie invalide" : "" }));
|
|
88
92
|
};
|
|
89
93
|
exports.default = MovaVehicleTireField;
|
|
@@ -41,6 +41,11 @@ var initialUserFormState = {
|
|
|
41
41
|
lastMaintenanceDate: { value: null, isValid: true },
|
|
42
42
|
tireBrand: { value: "", isValid: true },
|
|
43
43
|
tireProfile: { value: "", isValid: true },
|
|
44
|
+
secondaryTireDiameter: { value: "", isValid: true },
|
|
45
|
+
secondaryTireHeight: { value: "", isValid: true },
|
|
46
|
+
secondaryTireSpeedIndex: { value: "", isValid: true },
|
|
47
|
+
secondaryTireWidth: { value: "", isValid: true },
|
|
48
|
+
secondaryTireSize: { value: null, isValid: true },
|
|
44
49
|
};
|
|
45
50
|
var VehicleFullCard = function (_a) {
|
|
46
51
|
var _b;
|
|
@@ -66,26 +71,24 @@ var VehicleFullCard = function (_a) {
|
|
|
66
71
|
initForm();
|
|
67
72
|
}, [vehicle]);
|
|
68
73
|
var initForm = function () {
|
|
69
|
-
if (vehicle)
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
setForm(function (prevForm) { return (__assign(__assign({}, prevForm), { tireDiameter: __assign(__assign({}, prevForm["tireDiameter"]), { value: vehicle.tireDiameter }) })); });
|
|
75
|
-
setForm(function (prevForm) { return (__assign(__assign({}, prevForm), { tireSpeedIndex: __assign(__assign({}, prevForm["tireSpeedIndex"]), { value: vehicle.tireSpeedIndex }) })); });
|
|
76
|
-
setForm(function (prevForm) { return (__assign(__assign({}, prevForm), { lastInspectionDate: __assign(__assign({}, prevForm["lastInspectionDate"]), { value: vehicle.lastInspectionDate
|
|
74
|
+
if (!vehicle)
|
|
75
|
+
return;
|
|
76
|
+
console.log("vehicle", vehicle);
|
|
77
|
+
setForm(function (prevForm) {
|
|
78
|
+
var updatedForm = __assign(__assign({}, prevForm), { currentMileage: __assign(__assign({}, prevForm.currentMileage), { value: vehicle.currentMileage }), averageMileagePerYear: __assign(__assign({}, prevForm.averageMileagePerYear), { value: vehicle.averageMileagePerYear }), tireWidth: __assign(__assign({}, prevForm.tireWidth), { value: vehicle.tireWidth }), tireHeight: __assign(__assign({}, prevForm.tireHeight), { value: vehicle.tireHeight }), tireDiameter: __assign(__assign({}, prevForm.tireDiameter), { value: vehicle.tireDiameter }), tireSpeedIndex: __assign(__assign({}, prevForm.tireSpeedIndex), { value: vehicle.tireSpeedIndex }), secondaryTireWidth: __assign(__assign({}, prevForm.secondaryTireWidth), { value: vehicle.secondaryTireWidth }), secondaryTireHeight: __assign(__assign({}, prevForm.secondaryTireHeight), { value: vehicle.secondaryTireHeight }), secondaryTireDiameter: __assign(__assign({}, prevForm.secondaryTireDiameter), { value: vehicle.secondaryTireDiameter }), secondaryTireSpeedIndex: __assign(__assign({}, prevForm.secondaryTireSpeedIndex), { value: vehicle.secondaryTireSpeedIndex }), lastInspectionDate: __assign(__assign({}, prevForm.lastInspectionDate), { value: vehicle.lastInspectionDate
|
|
77
79
|
? new Date(vehicle.lastInspectionDate)
|
|
78
|
-
: null }) })
|
|
79
|
-
setForm(function (prevForm) { return (__assign(__assign({}, prevForm), { lastMaintenanceDate: __assign(__assign({}, prevForm["lastMaintenanceDate"]), { value: vehicle.lastMaintenanceDate
|
|
80
|
+
: null }), lastMaintenanceDate: __assign(__assign({}, prevForm.lastMaintenanceDate), { value: vehicle.lastMaintenanceDate
|
|
80
81
|
? new Date(vehicle.lastMaintenanceDate)
|
|
81
|
-
: null }) }))
|
|
82
|
-
setForm(function (prevForm) { return (__assign(__assign({}, prevForm), { tireBrand: __assign(__assign({}, prevForm["tireBrand"]), { value: vehicle.tireBrand }) })); });
|
|
83
|
-
setForm(function (prevForm) { return (__assign(__assign({}, prevForm), { tireProfile: __assign(__assign({}, prevForm["tireProfile"]), { value: vehicle.tireProfile }) })); });
|
|
82
|
+
: null }), tireBrand: __assign(__assign({}, prevForm.tireBrand), { value: vehicle.tireBrand }), tireProfile: __assign(__assign({}, prevForm.tireProfile), { value: vehicle.tireProfile }) });
|
|
84
83
|
if (isVehicleTireSizeDefined(vehicle)) {
|
|
85
|
-
|
|
84
|
+
updatedForm.tireSize = __assign(__assign({}, prevForm.tireSize), { value: vehicle.tireSize });
|
|
86
85
|
}
|
|
87
|
-
|
|
88
|
-
|
|
86
|
+
if (isVehicleSecondaryTireSizeDefined(vehicle)) {
|
|
87
|
+
updatedForm.secondaryTireSize = __assign(__assign({}, prevForm.secondaryTireSize), { value: vehicle.secondaryTireSize });
|
|
88
|
+
}
|
|
89
|
+
return updatedForm;
|
|
90
|
+
});
|
|
91
|
+
Logger_1.default.info(form);
|
|
89
92
|
};
|
|
90
93
|
var toggleShowLinkedDocument = function (docType) {
|
|
91
94
|
setShowLinkedDocument(!isShowLinkedDocument);
|
|
@@ -100,6 +103,11 @@ var VehicleFullCard = function (_a) {
|
|
|
100
103
|
var isVehicleTireSizeDefined = function (vehicle) {
|
|
101
104
|
return (vehicle.tireSize && vehicle.tireSize.diameter && vehicle.tireSize.height);
|
|
102
105
|
};
|
|
106
|
+
var isVehicleSecondaryTireSizeDefined = function (vehicle) {
|
|
107
|
+
return (vehicle.secondaryTireSize &&
|
|
108
|
+
vehicle.secondaryTireSize.diameter &&
|
|
109
|
+
vehicle.secondaryTireSize.height);
|
|
110
|
+
};
|
|
103
111
|
var validateForm = function () {
|
|
104
112
|
var newForm = __assign({}, form);
|
|
105
113
|
// Validator pour les champs obligatoires
|
|
@@ -162,6 +170,9 @@ var VehicleFullCard = function (_a) {
|
|
|
162
170
|
var handleOnChangeVehicleTire = function (vehicleTire, isValid) {
|
|
163
171
|
setForm(function (prevForm) { return (__assign(__assign({}, prevForm), { tireSize: __assign(__assign({}, prevForm["tireSize"]), { value: vehicleTire, isValid: isValid }) })); });
|
|
164
172
|
};
|
|
173
|
+
var handleOnChangeVehicleSecondaryTire = function (vehicleTire, isValid) {
|
|
174
|
+
setForm(function (prevForm) { return (__assign(__assign({}, prevForm), { secondaryTireSize: __assign(__assign({}, prevForm["secondaryTireSize"]), { value: vehicleTire, isValid: isValid }) })); });
|
|
175
|
+
};
|
|
165
176
|
var handleOnClickDeleteVehicle = function (e) {
|
|
166
177
|
e.preventDefault();
|
|
167
178
|
setOpenConfirmVehicleDelete(true);
|
|
@@ -189,6 +200,18 @@ var VehicleFullCard = function (_a) {
|
|
|
189
200
|
tireSpeedIndex: form.tireSize.isValid && form.tireSize.value
|
|
190
201
|
? form.tireSize.value.speedIndex
|
|
191
202
|
: undefined,
|
|
203
|
+
secondaryTireWidth: form.secondaryTireSize && form.secondaryTireSize.value
|
|
204
|
+
? form.secondaryTireSize.value.width
|
|
205
|
+
: undefined,
|
|
206
|
+
secondaryTireHeight: form.secondaryTireSize && form.secondaryTireSize.value
|
|
207
|
+
? form.secondaryTireSize.value.height
|
|
208
|
+
: undefined,
|
|
209
|
+
secondaryTireDiameter: form.secondaryTireSize && form.secondaryTireSize.value
|
|
210
|
+
? form.secondaryTireSize.value.diameter
|
|
211
|
+
: undefined,
|
|
212
|
+
secondaryTireSpeedIndex: form.secondaryTireSize && form.secondaryTireSize.value
|
|
213
|
+
? form.secondaryTireSize.value.speedIndex
|
|
214
|
+
: undefined,
|
|
192
215
|
lastInspectionDate: form.lastInspectionDate.value,
|
|
193
216
|
lastMaintenanceDate: form.lastMaintenanceDate.value,
|
|
194
217
|
tireBrand: form.tireBrand.value,
|
|
@@ -248,7 +271,7 @@ var VehicleFullCard = function (_a) {
|
|
|
248
271
|
? form.currentMileage.error
|
|
249
272
|
: "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
|
|
250
273
|
? String(form.averageMileagePerYear.value)
|
|
251
|
-
: "", 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.
|
|
274
|
+
: "", 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)(jsx_runtime_1.Fragment, { children: [(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.jsxs)(material_1.Typography, __assign({ variant: "body1", color: "text.secondary" }, { children: ["Pneumatiques", " ", isVehicleSecondaryTireSizeDefined(vehicle) ? "AV" : "", " ", ":"] })) })), (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) })) : ("-") })) }))] })), isVehicleSecondaryTireSizeDefined(vehicle) && ((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 AR:" })) })), (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: isVehicleSecondaryTireSizeDefined(vehicle) ? ((0, jsx_runtime_1.jsx)("b", { children: (0, Tools_1.formatVehicleTire)(vehicle.secondaryTireSize) })) : ("-") })) }))] })))] })), !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: "Marque 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: vehicle.tireBrand ? (0, jsx_runtime_1.jsx)("b", { children: vehicle.tireBrand }) : "-" })) }))] }))), !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: "Mod\u00E8le 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: vehicle.tireProfile ? (0, jsx_runtime_1.jsx)("b", { children: vehicle.tireProfile }) : "-" })) }))] }))), localEditMode && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(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, { label: "AV", vehicleTire: form.tireSize.value, onChangeVehicleTire: handleOnChangeVehicleTire }) })), (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, { label: "AR", vehicleTire: form.secondaryTireSize.value, onChangeVehicleTire: handleOnChangeVehicleSecondaryTire }) }))] })), localEditMode && ((0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 12 }, { children: (0, jsx_runtime_1.jsx)(material_1.TextField, { label: "Mod\u00E8le pneumatique", name: "tireProfile", variant: "outlined", value: form.tireProfile.value, onChange: function (e) { return handleInputChange(e); }, error: Boolean(form.tireProfile.error), sx: {
|
|
252
275
|
width: "100%",
|
|
253
276
|
mt: 2,
|
|
254
277
|
"& input": { textTransform: "uppercase" }, // CSS pour forcer les majuscules dans l'input
|
|
@@ -216,7 +216,8 @@ export declare enum QuoteState {
|
|
|
216
216
|
QUOTE_DRAFT = "QUOTE_DRAFT",
|
|
217
217
|
QUOTE_SENT = "QUOTE_SENT",
|
|
218
218
|
QUOTE_ACCEPTED = "QUOTE_ACCEPTED",
|
|
219
|
-
QUOTE_REJECTED = "QUOTE_REJECTED"
|
|
219
|
+
QUOTE_REJECTED = "QUOTE_REJECTED",
|
|
220
|
+
QUOTE_CANCELLED = "CANCELLED"
|
|
220
221
|
}
|
|
221
222
|
export declare enum DocumentType {
|
|
222
223
|
USER_BANK_DETAILS = "USER_BANK_DETAILS",
|
|
@@ -243,6 +243,7 @@ var QuoteState;
|
|
|
243
243
|
QuoteState["QUOTE_SENT"] = "QUOTE_SENT";
|
|
244
244
|
QuoteState["QUOTE_ACCEPTED"] = "QUOTE_ACCEPTED";
|
|
245
245
|
QuoteState["QUOTE_REJECTED"] = "QUOTE_REJECTED";
|
|
246
|
+
QuoteState["QUOTE_CANCELLED"] = "CANCELLED";
|
|
246
247
|
})(QuoteState = exports.QuoteState || (exports.QuoteState = {}));
|
|
247
248
|
var DocumentType;
|
|
248
249
|
(function (DocumentType) {
|
|
@@ -18,6 +18,11 @@ export type MovaVehicleForm = {
|
|
|
18
18
|
lastMaintenanceDate: MovaFormField;
|
|
19
19
|
tireBrand: MovaFormField;
|
|
20
20
|
tireProfile: MovaFormField;
|
|
21
|
+
secondaryTireSize: MovaFormField;
|
|
22
|
+
secondaryTireWidth: MovaFormField;
|
|
23
|
+
secondaryTireHeight: MovaFormField;
|
|
24
|
+
secondaryTireDiameter: MovaFormField;
|
|
25
|
+
secondaryTireSpeedIndex: MovaFormField;
|
|
21
26
|
};
|
|
22
27
|
/**
|
|
23
28
|
* Type utilisé pour définir un interval sur une objet Schedule
|
|
@@ -83,7 +83,8 @@ export default class Event {
|
|
|
83
83
|
updatedDate?: Date;
|
|
84
84
|
quoteFirstSendingTime?: Date;
|
|
85
85
|
lastQuoteCreationDate?: Date;
|
|
86
|
-
|
|
86
|
+
urgent?: boolean;
|
|
87
|
+
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[], vehicleLoanStart?: Date, vehicleLoanEnd?: Date, creationDate?: Date, updatedDate?: Date, lastQuoteCreationDate?: Date, quoteFirstSendingTime?: Date, urgent?: boolean);
|
|
87
88
|
static getPrestationsList(event: Event): string[];
|
|
88
89
|
static getCurrentQuote(event: Event): Document | null;
|
|
89
90
|
}
|
package/dist/src/models/Event.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
var Enums_1 = require("../helpers/Enums");
|
|
4
4
|
var Event = /** @class */ (function () {
|
|
5
|
-
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, vehicleLoanStart, vehicleLoanEnd, creationDate, updatedDate, lastQuoteCreationDate, quoteFirstSendingTime) {
|
|
5
|
+
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, vehicleLoanStart, vehicleLoanEnd, creationDate, updatedDate, lastQuoteCreationDate, quoteFirstSendingTime, urgent) {
|
|
6
6
|
this.id = id;
|
|
7
7
|
this.notes = notes;
|
|
8
8
|
this.ownerId = ownerId;
|
|
@@ -51,6 +51,7 @@ var Event = /** @class */ (function () {
|
|
|
51
51
|
this.quoteFirstSendingTime = quoteFirstSendingTime
|
|
52
52
|
? new Date(quoteFirstSendingTime)
|
|
53
53
|
: undefined;
|
|
54
|
+
this.urgent = urgent;
|
|
54
55
|
}
|
|
55
56
|
Event.getPrestationsList = function (event) {
|
|
56
57
|
if (event && event.prestations) {
|
|
@@ -62,5 +62,6 @@ export default class Garage {
|
|
|
62
62
|
quoteRequestStart?: Date;
|
|
63
63
|
companyRegistrationNumber?: string;
|
|
64
64
|
establishmentRegistrationNumber?: string;
|
|
65
|
-
|
|
65
|
+
reopeningDate?: Date;
|
|
66
|
+
constructor(id: string, adminId: string, name: string, address: Address, workforce: number, prestations: Prestation[], schedules: Schedule[], contactPhone: string, prestationCategories: CategoryPrestation[], dayPeriodFastServiceExcluded: boolean, loanerVehicleFastServiceExcluded: boolean, fastServiceThreshold: number, timezone: string, vehicles?: VehicleGarage[], contactEmail?: string, logo?: string, suppliers?: Supplier[], documents?: Document[], subscriptions?: Subscription[], loanerVehicleActive?: boolean, loanerVehicleRequestActive?: boolean, customStyle?: string, subscription?: Subscription, partialWorkforce?: number, mailCustomization?: boolean, billingActive?: boolean, billingToken?: string, billingSimulationActive?: boolean, appId?: number, establishmentRegistrationNumber?: string, companyRegistrationNumber?: string, quoteRequestStart?: Date, reopeningDate?: Date);
|
|
66
67
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
var Garage = /** @class */ (function () {
|
|
4
|
-
function Garage(id, adminId, name, address, workforce, prestations, schedules, contactPhone, prestationCategories, dayPeriodFastServiceExcluded, loanerVehicleFastServiceExcluded, fastServiceThreshold, timezone, vehicles, contactEmail, logo, suppliers, documents, subscriptions, loanerVehicleActive, loanerVehicleRequestActive, customStyle, subscription, partialWorkforce, mailCustomization, billingActive, billingToken, billingSimulationActive, appId, establishmentRegistrationNumber, companyRegistrationNumber, quoteRequestStart) {
|
|
4
|
+
function Garage(id, adminId, name, address, workforce, prestations, schedules, contactPhone, prestationCategories, dayPeriodFastServiceExcluded, loanerVehicleFastServiceExcluded, fastServiceThreshold, timezone, vehicles, contactEmail, logo, suppliers, documents, subscriptions, loanerVehicleActive, loanerVehicleRequestActive, customStyle, subscription, partialWorkforce, mailCustomization, billingActive, billingToken, billingSimulationActive, appId, establishmentRegistrationNumber, companyRegistrationNumber, quoteRequestStart, reopeningDate) {
|
|
5
5
|
this.id = id;
|
|
6
6
|
this.adminId = adminId;
|
|
7
7
|
this.name = name;
|
|
@@ -34,6 +34,7 @@ var Garage = /** @class */ (function () {
|
|
|
34
34
|
this.quoteRequestStart = quoteRequestStart;
|
|
35
35
|
this.companyRegistrationNumber = companyRegistrationNumber;
|
|
36
36
|
this.establishmentRegistrationNumber = establishmentRegistrationNumber;
|
|
37
|
+
this.reopeningDate = reopeningDate;
|
|
37
38
|
}
|
|
38
39
|
return Garage;
|
|
39
40
|
}());
|
|
@@ -22,10 +22,11 @@ export default class Prestation {
|
|
|
22
22
|
* La notion de position (ou d'ordre) peut être utile à l'affichage d'une liste de prestation par exemple
|
|
23
23
|
*/
|
|
24
24
|
position: number;
|
|
25
|
+
availableOnline: boolean;
|
|
25
26
|
active: boolean;
|
|
26
27
|
state: PrestationState;
|
|
27
28
|
multipleApplication: boolean;
|
|
28
29
|
operationsVisible: boolean;
|
|
29
30
|
categoryCode: string;
|
|
30
|
-
constructor(id: number, code: string, name: string, description: string, category: string, downtime: number, appointmentDelay: number, position: number, active: boolean, state: PrestationState, multipleApplication: boolean, operationsVisible: boolean, categoryCode: string, operations?: Operation[]);
|
|
31
|
+
constructor(id: number, code: string, name: string, description: string, category: string, downtime: number, appointmentDelay: number, position: number, active: boolean, state: PrestationState, multipleApplication: boolean, operationsVisible: boolean, categoryCode: string, availableOnline: boolean, operations?: Operation[]);
|
|
31
32
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
var Prestation = /** @class */ (function () {
|
|
4
|
-
function Prestation(id, code, name, description, category, downtime, appointmentDelay, position, active, state, multipleApplication, operationsVisible, categoryCode, operations) {
|
|
4
|
+
function Prestation(id, code, name, description, category, downtime, appointmentDelay, position, active, state, multipleApplication, operationsVisible, categoryCode, availableOnline, operations) {
|
|
5
5
|
this.id = id;
|
|
6
6
|
this.code = code;
|
|
7
7
|
this.name = name;
|
|
@@ -16,6 +16,7 @@ var Prestation = /** @class */ (function () {
|
|
|
16
16
|
this.operations = operations;
|
|
17
17
|
this.state = state;
|
|
18
18
|
this.categoryCode = categoryCode;
|
|
19
|
+
this.availableOnline = availableOnline;
|
|
19
20
|
}
|
|
20
21
|
return Prestation;
|
|
21
22
|
}());
|
|
@@ -25,6 +25,11 @@ export default class Vehicle {
|
|
|
25
25
|
foreignPlate: boolean;
|
|
26
26
|
tireBrand?: string;
|
|
27
27
|
tireProfile?: string;
|
|
28
|
-
|
|
28
|
+
secondaryTireDiameter: string;
|
|
29
|
+
secondaryTireHeight: string;
|
|
30
|
+
secondaryTireSpeedIndex: string;
|
|
31
|
+
secondaryTireWidth: string;
|
|
32
|
+
secondaryTireSize: VehicleTire;
|
|
33
|
+
constructor(id: number, ownerId: number, averageMileagePerYear: number, plate: string, brand: string, model: string, version: string, vin: string, currentMileage: number, digitalPassportIndex: DigitalPassportIndex, firstRegistrationDate: Date, ktype: string, tireDiameter: string, tireHeight: string, tireSpeedIndex: string, tireWidth: string, documents: Document[], tireSize: VehicleTire, lastInspectionDate: Date, lastMaintenanceDate: Date, foreignPlate: boolean, secondaryTireDiameter: string, secondaryTireHeight: string, secondaryTireSpeedIndex: string, secondaryTireWidth: string, secondaryTireSize: VehicleTire, tireBrand?: string, tireProfile?: string);
|
|
29
34
|
getVehicleLabel(): string;
|
|
30
35
|
}
|
|
@@ -11,7 +11,7 @@ Carburant : Essence
|
|
|
11
11
|
Cylindrée : 1984 cm3
|
|
12
12
|
Puissance : 140 KW (190 HP) */
|
|
13
13
|
var Vehicle = /** @class */ (function () {
|
|
14
|
-
function Vehicle(id, ownerId, averageMileagePerYear, plate, brand, model, version, vin, currentMileage, digitalPassportIndex, firstRegistrationDate, ktype, tireDiameter, tireHeight, tireSpeedIndex, tireWidth, documents, tireSize, lastInspectionDate, lastMaintenanceDate, foreignPlate, tireBrand, tireProfile) {
|
|
14
|
+
function Vehicle(id, ownerId, averageMileagePerYear, plate, brand, model, version, vin, currentMileage, digitalPassportIndex, firstRegistrationDate, ktype, tireDiameter, tireHeight, tireSpeedIndex, tireWidth, documents, tireSize, lastInspectionDate, lastMaintenanceDate, foreignPlate, secondaryTireDiameter, secondaryTireHeight, secondaryTireSpeedIndex, secondaryTireWidth, secondaryTireSize, tireBrand, tireProfile) {
|
|
15
15
|
this.id = id;
|
|
16
16
|
this.ownerId = ownerId;
|
|
17
17
|
this.averageMileagePerYear = averageMileagePerYear;
|
|
@@ -35,6 +35,11 @@ var Vehicle = /** @class */ (function () {
|
|
|
35
35
|
this.foreignPlate = foreignPlate;
|
|
36
36
|
this.tireBrand = tireBrand;
|
|
37
37
|
this.tireProfile = tireProfile;
|
|
38
|
+
this.secondaryTireDiameter = secondaryTireDiameter;
|
|
39
|
+
this.secondaryTireHeight = secondaryTireHeight;
|
|
40
|
+
this.secondaryTireSpeedIndex = secondaryTireSpeedIndex;
|
|
41
|
+
this.secondaryTireWidth = secondaryTireWidth;
|
|
42
|
+
this.secondaryTireSize = secondaryTireSize;
|
|
38
43
|
}
|
|
39
44
|
Vehicle.prototype.getVehicleLabel = function () {
|
|
40
45
|
return "".concat(this.brand, " ").concat(this.model, " ").concat(this.version);
|
|
@@ -5,6 +5,7 @@ import Operation from "../models/Operation";
|
|
|
5
5
|
import Product from "../models/Product";
|
|
6
6
|
import { AddCustomerVehicleParams, DeleteCustomerVehicleParams } from "./GarageService.types";
|
|
7
7
|
export default class GarageService {
|
|
8
|
+
static toogleUrgentQuote(garageId: string, quoteId: string): Promise<APIResponse<string>>;
|
|
8
9
|
static updatePaymentAuthorization(garageId: string, req: any): Promise<APIResponse<string>>;
|
|
9
10
|
static toogleGaragePaymentAuthorization(garageId: string): Promise<APIResponse<string>>;
|
|
10
11
|
static toogleEventVehicleReceived(garageId: string, eventId: string): Promise<APIResponse<string>>;
|
|
@@ -16,6 +16,13 @@ var Enums_1 = require("../helpers/Enums");
|
|
|
16
16
|
var GarageService = /** @class */ (function () {
|
|
17
17
|
function GarageService() {
|
|
18
18
|
}
|
|
19
|
+
GarageService.toogleUrgentQuote = function (garageId, quoteId) {
|
|
20
|
+
return (0, ApiHelper_1.request)({
|
|
21
|
+
url: "".concat(ApiHelper_1.API_BASE_URL, "/garage/").concat(garageId, "/quotes/").concat(quoteId, "/urgent"),
|
|
22
|
+
method: Enums_1.APIMethod.PATCH,
|
|
23
|
+
appType: Enums_1.MovaAppType.GARAGE,
|
|
24
|
+
});
|
|
25
|
+
};
|
|
19
26
|
GarageService.updatePaymentAuthorization = function (garageId, req) {
|
|
20
27
|
return (0, ApiHelper_1.request)({
|
|
21
28
|
url: "".concat(ApiHelper_1.API_BASE_URL, "/garage/").concat(garageId, "/settings/payment-authorization/update"),
|
|
@@ -14,6 +14,10 @@ export type AddCustomerVehicleParams = {
|
|
|
14
14
|
tireHeight?: string;
|
|
15
15
|
tireDiameter?: string;
|
|
16
16
|
tireSpeedIndex?: string;
|
|
17
|
+
secondaryTireWidth?: string;
|
|
18
|
+
secondaryTireHeight?: string;
|
|
19
|
+
secondaryTireDiameter?: string;
|
|
20
|
+
secondaryTireSpeedIndex?: string;
|
|
17
21
|
lastMaintenanceDate?: string;
|
|
18
22
|
lastInspectionDate?: string;
|
|
19
23
|
isForeignPlate?: boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@movalib/movalib-commons",
|
|
3
|
-
"version": "1.64.
|
|
3
|
+
"version": "1.64.3",
|
|
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",
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
"scripts": {
|
|
9
9
|
"start": "webpack-dev-server --entry ./devIndex.tsx --open",
|
|
10
10
|
"build": "rm -rf dist && tsc && npm run copy-assets",
|
|
11
|
+
"build:publish": "rm -rf dist && tsc && npm run copy-assets && npm publish",
|
|
11
12
|
"copy-assets": "cp -r src/assets/ dist/src/assets/ && cp -r src/style/. dist/src/style/",
|
|
12
13
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
13
14
|
"clean": "rm -rf dist node_modules package-lock.json",
|
|
@@ -1,116 +1,127 @@
|
|
|
1
|
-
import { TextField } from
|
|
2
|
-
import { useState, type FC
|
|
3
|
-
import
|
|
4
|
-
import
|
|
1
|
+
import { TextField } from "@mui/material";
|
|
2
|
+
import { useEffect, useState, type FC } from "react";
|
|
3
|
+
import { formatVehicleTire } from "./helpers/Tools";
|
|
4
|
+
import VehicleTire from "./models/VehicleTire";
|
|
5
5
|
|
|
6
6
|
interface MovaVehicleTireFieldProps {
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
label?: string;
|
|
8
|
+
vehicleTire?: VehicleTire;
|
|
9
|
+
onChangeVehicleTire: (vehicleTire: VehicleTire, isValid: boolean) => void;
|
|
9
10
|
}
|
|
10
11
|
|
|
11
12
|
// Regex pour une taille de pneumatique Française
|
|
12
13
|
const regex = /^[A-Za-z0-9]{7}/;
|
|
13
14
|
|
|
14
|
-
const MovaVehicleTireField: FC<MovaVehicleTireFieldProps> = ({
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
15
|
+
const MovaVehicleTireField: FC<MovaVehicleTireFieldProps> = ({
|
|
16
|
+
vehicleTire,
|
|
17
|
+
onChangeVehicleTire,
|
|
18
|
+
label,
|
|
19
|
+
}) => {
|
|
20
|
+
const [tireInfo, setTireInfo] = useState("");
|
|
21
|
+
const [error, setError] = useState<boolean>(false);
|
|
22
|
+
const [lastLength, setLastLength] = useState<number>(0); // Ajout d'un état pour stocker la longueur précédente
|
|
23
|
+
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
if (vehicleTire) {
|
|
26
|
+
setTireInfo(formatVehicleTire(vehicleTire));
|
|
27
|
+
}
|
|
28
|
+
}, [vehicleTire]);
|
|
29
|
+
|
|
30
|
+
const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
31
|
+
e.preventDefault();
|
|
32
|
+
const rawValue = e.target.value;
|
|
33
|
+
// Cette expression régulière supprimera tous les caractères qui ne sont pas des chiffres ou des lettres alphabétiques, à l'exception de "R" et "r".
|
|
34
|
+
// On ne peut saisir que 10 caractères maximum (ex : 245551791V)
|
|
35
|
+
let value = rawValue
|
|
36
|
+
.toUpperCase()
|
|
37
|
+
.replace(/[^0-9A-QS-Za-qs-z]/g, "")
|
|
38
|
+
.slice(0, 15);
|
|
39
|
+
|
|
40
|
+
// On valide la saisie (le champ n'est pas obligatoire)
|
|
41
|
+
let isValid = value.length == 0 || (value.length > 0 && regex.test(value));
|
|
42
|
+
setError(!regex.test(value));
|
|
43
|
+
|
|
44
|
+
// Vérifier si l'utilisateur est en train de supprimer un caractère
|
|
45
|
+
const isDeleting = rawValue.length < lastLength;
|
|
46
|
+
// Ajout du " / "
|
|
47
|
+
if (value.length >= 3 && !(rawValue.length == 5 && isDeleting)) {
|
|
48
|
+
value = `${value.substring(0, 3)} / ${value.substring(3)}`;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// Ajout du " R"
|
|
52
|
+
if (value.length >= 8 && !(rawValue.length == 9 && isDeleting)) {
|
|
53
|
+
value = `${value.substring(0, 8)} R${value.substring(8)}`;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
let additonalChar = false;
|
|
57
|
+
|
|
58
|
+
if (value[12] && /^[A-Z]$/.test(value[12])) {
|
|
59
|
+
if (rawValue.length === 14 && isDeleting) {
|
|
60
|
+
value = `${value.substring(0, 12)}`;
|
|
61
|
+
} else {
|
|
62
|
+
additonalChar = true;
|
|
63
|
+
value = `${value.substring(0, 13)} ${value.substring(13)}`;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// Ajout d'un espace après la saisie du diamètre des pneus
|
|
68
|
+
if (value.length >= 12 && !(rawValue.length <= 12 && isDeleting)) {
|
|
69
|
+
value = `${value.substring(0, 12)} ${value.substring(12)}`;
|
|
70
|
+
}
|
|
71
|
+
//console.log('2 valeu',JSON.stringify(value));
|
|
72
|
+
if (additonalChar) {
|
|
73
|
+
let endString = rawValue.substring(15);
|
|
74
|
+
value =
|
|
75
|
+
value.substring(0, 15) + (endString !== undefined ? endString : "");
|
|
76
|
+
console.log(rawValue.split(" ")[5]);
|
|
77
|
+
} else {
|
|
78
|
+
let endString = rawValue.substring(12);
|
|
79
|
+
if (endString && endString.length > 1) {
|
|
80
|
+
value = value.substring(0, 13) + endString.trimStart();
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const parts = value.split(" ");
|
|
85
|
+
|
|
86
|
+
setTireInfo(value);
|
|
87
|
+
if (value.length >= 16) {
|
|
88
|
+
let [width, _separator, height, diameter, speedIndex] = parts;
|
|
89
|
+
speedIndex = value.substring(13);
|
|
90
|
+
const vehicleTire = new VehicleTire(width, height, diameter, speedIndex);
|
|
91
|
+
onChangeVehicleTire(vehicleTire, isValid);
|
|
92
|
+
} else {
|
|
93
|
+
let [width, _separator, height, diameter, speedIndex] = parts;
|
|
94
|
+
speedIndex = value.substring(13);
|
|
95
|
+
const vehicleTire = new VehicleTire(
|
|
96
|
+
width ?? "",
|
|
97
|
+
height ?? "",
|
|
98
|
+
diameter ?? "",
|
|
99
|
+
speedIndex ?? ""
|
|
100
|
+
);
|
|
101
|
+
onChangeVehicleTire(vehicleTire, isValid);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
setLastLength(value.length); // Mettre à jour la longueur précédente
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
return (
|
|
108
|
+
<TextField
|
|
109
|
+
label={
|
|
110
|
+
label ? `Taille des pneumatiques ${label}` : "Taille des pneumatiques"
|
|
111
|
+
}
|
|
112
|
+
variant="outlined"
|
|
113
|
+
value={tireInfo}
|
|
114
|
+
onChange={handleChange}
|
|
115
|
+
fullWidth
|
|
116
|
+
placeholder="XXX XX RXX XXX"
|
|
117
|
+
sx={{
|
|
118
|
+
width: "100%",
|
|
119
|
+
"& input": { textTransform: "uppercase" }, // CSS pour forcer les majuscules dans l'input
|
|
120
|
+
}}
|
|
121
|
+
error={error && tireInfo.length > 0}
|
|
122
|
+
helperText={error && tireInfo.length > 0 ? "Saisie invalide" : ""}
|
|
123
|
+
/>
|
|
124
|
+
);
|
|
125
|
+
};
|
|
115
126
|
|
|
116
127
|
export default MovaVehicleTireField;
|
|
@@ -72,6 +72,11 @@ const initialUserFormState = {
|
|
|
72
72
|
lastMaintenanceDate: { value: null, isValid: true },
|
|
73
73
|
tireBrand: { value: "", isValid: true },
|
|
74
74
|
tireProfile: { value: "", isValid: true },
|
|
75
|
+
secondaryTireDiameter: { value: "", isValid: true },
|
|
76
|
+
secondaryTireHeight: { value: "", isValid: true },
|
|
77
|
+
secondaryTireSpeedIndex: { value: "", isValid: true },
|
|
78
|
+
secondaryTireWidth: { value: "", isValid: true },
|
|
79
|
+
secondaryTireSize: { value: null, isValid: true },
|
|
75
80
|
};
|
|
76
81
|
|
|
77
82
|
const VehicleFullCard: FC<VehicleFullCardProps> = ({
|
|
@@ -127,79 +132,75 @@ const VehicleFullCard: FC<VehicleFullCardProps> = ({
|
|
|
127
132
|
}, [vehicle]);
|
|
128
133
|
|
|
129
134
|
const initForm = () => {
|
|
130
|
-
if (vehicle)
|
|
131
|
-
|
|
135
|
+
if (!vehicle) return;
|
|
136
|
+
console.log("vehicle", vehicle);
|
|
137
|
+
setForm((prevForm) => {
|
|
138
|
+
const updatedForm = {
|
|
132
139
|
...prevForm,
|
|
133
140
|
currentMileage: {
|
|
134
|
-
...prevForm
|
|
141
|
+
...prevForm.currentMileage,
|
|
135
142
|
value: vehicle.currentMileage,
|
|
136
143
|
},
|
|
137
|
-
}));
|
|
138
|
-
setForm((prevForm) => ({
|
|
139
|
-
...prevForm,
|
|
140
144
|
averageMileagePerYear: {
|
|
141
|
-
...prevForm
|
|
145
|
+
...prevForm.averageMileagePerYear,
|
|
142
146
|
value: vehicle.averageMileagePerYear,
|
|
143
147
|
},
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
...prevForm,
|
|
147
|
-
tireWidth: { ...prevForm["tireWidth"], value: vehicle.tireWidth },
|
|
148
|
-
}));
|
|
149
|
-
setForm((prevForm) => ({
|
|
150
|
-
...prevForm,
|
|
151
|
-
tireHeight: { ...prevForm["tireHeight"], value: vehicle.tireHeight },
|
|
152
|
-
}));
|
|
153
|
-
setForm((prevForm) => ({
|
|
154
|
-
...prevForm,
|
|
155
|
-
tireDiameter: {
|
|
156
|
-
...prevForm["tireDiameter"],
|
|
157
|
-
value: vehicle.tireDiameter,
|
|
158
|
-
},
|
|
159
|
-
}));
|
|
160
|
-
setForm((prevForm) => ({
|
|
161
|
-
...prevForm,
|
|
148
|
+
tireWidth: { ...prevForm.tireWidth, value: vehicle.tireWidth },
|
|
149
|
+
tireHeight: { ...prevForm.tireHeight, value: vehicle.tireHeight },
|
|
150
|
+
tireDiameter: { ...prevForm.tireDiameter, value: vehicle.tireDiameter },
|
|
162
151
|
tireSpeedIndex: {
|
|
163
|
-
...prevForm
|
|
152
|
+
...prevForm.tireSpeedIndex,
|
|
164
153
|
value: vehicle.tireSpeedIndex,
|
|
165
154
|
},
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
155
|
+
secondaryTireWidth: {
|
|
156
|
+
...prevForm.secondaryTireWidth,
|
|
157
|
+
value: vehicle.secondaryTireWidth,
|
|
158
|
+
},
|
|
159
|
+
secondaryTireHeight: {
|
|
160
|
+
...prevForm.secondaryTireHeight,
|
|
161
|
+
value: vehicle.secondaryTireHeight,
|
|
162
|
+
},
|
|
163
|
+
secondaryTireDiameter: {
|
|
164
|
+
...prevForm.secondaryTireDiameter,
|
|
165
|
+
value: vehicle.secondaryTireDiameter,
|
|
166
|
+
},
|
|
167
|
+
secondaryTireSpeedIndex: {
|
|
168
|
+
...prevForm.secondaryTireSpeedIndex,
|
|
169
|
+
value: vehicle.secondaryTireSpeedIndex,
|
|
170
|
+
},
|
|
169
171
|
lastInspectionDate: {
|
|
170
|
-
...prevForm
|
|
172
|
+
...prevForm.lastInspectionDate,
|
|
171
173
|
value: vehicle.lastInspectionDate
|
|
172
174
|
? new Date(vehicle.lastInspectionDate)
|
|
173
175
|
: null,
|
|
174
176
|
},
|
|
175
|
-
}));
|
|
176
|
-
setForm((prevForm) => ({
|
|
177
|
-
...prevForm,
|
|
178
177
|
lastMaintenanceDate: {
|
|
179
|
-
...prevForm
|
|
178
|
+
...prevForm.lastMaintenanceDate,
|
|
180
179
|
value: vehicle.lastMaintenanceDate
|
|
181
180
|
? new Date(vehicle.lastMaintenanceDate)
|
|
182
181
|
: null,
|
|
183
182
|
},
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
tireBrand: { ...prevForm["tireBrand"], value: vehicle.tireBrand },
|
|
188
|
-
}));
|
|
189
|
-
setForm((prevForm) => ({
|
|
190
|
-
...prevForm,
|
|
191
|
-
tireProfile: { ...prevForm["tireProfile"], value: vehicle.tireProfile },
|
|
192
|
-
}));
|
|
183
|
+
tireBrand: { ...prevForm.tireBrand, value: vehicle.tireBrand },
|
|
184
|
+
tireProfile: { ...prevForm.tireProfile, value: vehicle.tireProfile },
|
|
185
|
+
};
|
|
193
186
|
|
|
194
187
|
if (isVehicleTireSizeDefined(vehicle)) {
|
|
195
|
-
|
|
196
|
-
...prevForm,
|
|
197
|
-
|
|
198
|
-
}
|
|
188
|
+
updatedForm.tireSize = {
|
|
189
|
+
...prevForm.tireSize,
|
|
190
|
+
value: vehicle.tireSize,
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
if (isVehicleSecondaryTireSizeDefined(vehicle)) {
|
|
194
|
+
updatedForm.secondaryTireSize = {
|
|
195
|
+
...prevForm.secondaryTireSize,
|
|
196
|
+
value: vehicle.secondaryTireSize,
|
|
197
|
+
};
|
|
199
198
|
}
|
|
200
199
|
|
|
201
|
-
|
|
202
|
-
}
|
|
200
|
+
return updatedForm;
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
Logger.info(form);
|
|
203
204
|
};
|
|
204
205
|
|
|
205
206
|
const toggleShowLinkedDocument = (docType: DocumentType | null) => {
|
|
@@ -217,6 +218,13 @@ const VehicleFullCard: FC<VehicleFullCardProps> = ({
|
|
|
217
218
|
vehicle.tireSize && vehicle.tireSize.diameter && vehicle.tireSize.height
|
|
218
219
|
);
|
|
219
220
|
};
|
|
221
|
+
const isVehicleSecondaryTireSizeDefined = (vehicle: Vehicle) => {
|
|
222
|
+
return (
|
|
223
|
+
vehicle.secondaryTireSize &&
|
|
224
|
+
vehicle.secondaryTireSize.diameter &&
|
|
225
|
+
vehicle.secondaryTireSize.height
|
|
226
|
+
);
|
|
227
|
+
};
|
|
220
228
|
|
|
221
229
|
const validateForm = () => {
|
|
222
230
|
let newForm: MovaVehicleForm = { ...form };
|
|
@@ -316,6 +324,20 @@ const VehicleFullCard: FC<VehicleFullCardProps> = ({
|
|
|
316
324
|
}));
|
|
317
325
|
};
|
|
318
326
|
|
|
327
|
+
const handleOnChangeVehicleSecondaryTire = (
|
|
328
|
+
vehicleTire: VehicleTire,
|
|
329
|
+
isValid: boolean
|
|
330
|
+
) => {
|
|
331
|
+
setForm((prevForm) => ({
|
|
332
|
+
...prevForm,
|
|
333
|
+
secondaryTireSize: {
|
|
334
|
+
...prevForm["secondaryTireSize"],
|
|
335
|
+
value: vehicleTire,
|
|
336
|
+
isValid: isValid,
|
|
337
|
+
},
|
|
338
|
+
}));
|
|
339
|
+
};
|
|
340
|
+
|
|
319
341
|
const handleOnClickDeleteVehicle = (
|
|
320
342
|
e: React.MouseEvent<HTMLButtonElement, MouseEvent>
|
|
321
343
|
) => {
|
|
@@ -355,6 +377,23 @@ const VehicleFullCard: FC<VehicleFullCardProps> = ({
|
|
|
355
377
|
form.tireSize.isValid && form.tireSize.value
|
|
356
378
|
? (form.tireSize.value as VehicleTire).speedIndex
|
|
357
379
|
: undefined,
|
|
380
|
+
secondaryTireWidth:
|
|
381
|
+
form.secondaryTireSize && form.secondaryTireSize.value
|
|
382
|
+
? (form.secondaryTireSize.value as VehicleTire).width
|
|
383
|
+
: undefined,
|
|
384
|
+
secondaryTireHeight:
|
|
385
|
+
form.secondaryTireSize && form.secondaryTireSize.value
|
|
386
|
+
? (form.secondaryTireSize.value as VehicleTire).height
|
|
387
|
+
: undefined,
|
|
388
|
+
secondaryTireDiameter:
|
|
389
|
+
form.secondaryTireSize && form.secondaryTireSize.value
|
|
390
|
+
? (form.secondaryTireSize.value as VehicleTire).diameter
|
|
391
|
+
: undefined,
|
|
392
|
+
secondaryTireSpeedIndex:
|
|
393
|
+
form.secondaryTireSize && form.secondaryTireSize.value
|
|
394
|
+
? (form.secondaryTireSize.value as VehicleTire).speedIndex
|
|
395
|
+
: undefined,
|
|
396
|
+
|
|
358
397
|
lastInspectionDate: form.lastInspectionDate.value,
|
|
359
398
|
lastMaintenanceDate: form.lastMaintenanceDate.value,
|
|
360
399
|
tireBrand: form.tireBrand.value,
|
|
@@ -572,22 +611,47 @@ const VehicleFullCard: FC<VehicleFullCardProps> = ({
|
|
|
572
611
|
)}
|
|
573
612
|
|
|
574
613
|
{!localEditMode && (
|
|
575
|
-
|
|
576
|
-
<Grid
|
|
577
|
-
<
|
|
578
|
-
|
|
579
|
-
|
|
614
|
+
<>
|
|
615
|
+
<Grid container textAlign="justify" sx={{ pt: 2 }}>
|
|
616
|
+
<Grid item xs={6}>
|
|
617
|
+
<Typography variant="body1" color="text.secondary">
|
|
618
|
+
Pneumatiques{" "}
|
|
619
|
+
{isVehicleSecondaryTireSizeDefined(vehicle) ? "AV" : ""}{" "}
|
|
620
|
+
:
|
|
621
|
+
</Typography>
|
|
622
|
+
</Grid>
|
|
623
|
+
<Grid item xs={6} sx={{ textAlign: "right" }}>
|
|
624
|
+
<Typography variant="body1" color="text.secondary">
|
|
625
|
+
{isVehicleTireSizeDefined(vehicle) ? (
|
|
626
|
+
<b>{formatVehicleTire(vehicle.tireSize)}</b>
|
|
627
|
+
) : (
|
|
628
|
+
"-"
|
|
629
|
+
)}
|
|
630
|
+
</Typography>
|
|
631
|
+
</Grid>
|
|
580
632
|
</Grid>
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
633
|
+
|
|
634
|
+
{isVehicleSecondaryTireSizeDefined(vehicle) && (
|
|
635
|
+
<Grid container textAlign="justify" sx={{ pt: 2 }}>
|
|
636
|
+
<Grid item xs={6}>
|
|
637
|
+
<Typography variant="body1" color="text.secondary">
|
|
638
|
+
Pneumatiques AR:
|
|
639
|
+
</Typography>
|
|
640
|
+
</Grid>
|
|
641
|
+
<Grid item xs={6} sx={{ textAlign: "right" }}>
|
|
642
|
+
<Typography variant="body1" color="text.secondary">
|
|
643
|
+
{isVehicleSecondaryTireSizeDefined(vehicle) ? (
|
|
644
|
+
<b>
|
|
645
|
+
{formatVehicleTire(vehicle.secondaryTireSize)}
|
|
646
|
+
</b>
|
|
647
|
+
) : (
|
|
648
|
+
"-"
|
|
649
|
+
)}
|
|
650
|
+
</Typography>
|
|
651
|
+
</Grid>
|
|
652
|
+
</Grid>
|
|
653
|
+
)}
|
|
654
|
+
</>
|
|
591
655
|
)}
|
|
592
656
|
{!localEditMode && (
|
|
593
657
|
<Grid container textAlign="justify" sx={{ pt: 2 }}>
|
|
@@ -620,12 +684,22 @@ const VehicleFullCard: FC<VehicleFullCardProps> = ({
|
|
|
620
684
|
)}
|
|
621
685
|
|
|
622
686
|
{localEditMode && (
|
|
623
|
-
|
|
624
|
-
<
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
687
|
+
<>
|
|
688
|
+
<Grid item xs={12} sx={{ mt: 1 }}>
|
|
689
|
+
<MovaVehicleTireField
|
|
690
|
+
label="AV"
|
|
691
|
+
vehicleTire={form.tireSize.value}
|
|
692
|
+
onChangeVehicleTire={handleOnChangeVehicleTire}
|
|
693
|
+
/>
|
|
694
|
+
</Grid>
|
|
695
|
+
<Grid item xs={12} sx={{ mt: 1 }}>
|
|
696
|
+
<MovaVehicleTireField
|
|
697
|
+
label="AR"
|
|
698
|
+
vehicleTire={form.secondaryTireSize.value}
|
|
699
|
+
onChangeVehicleTire={handleOnChangeVehicleSecondaryTire}
|
|
700
|
+
/>
|
|
701
|
+
</Grid>
|
|
702
|
+
</>
|
|
629
703
|
)}
|
|
630
704
|
{localEditMode && (
|
|
631
705
|
<Grid item xs={12}>
|
package/src/helpers/Enums.ts
CHANGED
package/src/helpers/Types.ts
CHANGED
|
@@ -24,6 +24,11 @@ export type MovaVehicleForm = {
|
|
|
24
24
|
lastMaintenanceDate: MovaFormField;
|
|
25
25
|
tireBrand: MovaFormField;
|
|
26
26
|
tireProfile: MovaFormField;
|
|
27
|
+
secondaryTireSize: MovaFormField;
|
|
28
|
+
secondaryTireWidth: MovaFormField;
|
|
29
|
+
secondaryTireHeight: MovaFormField;
|
|
30
|
+
secondaryTireDiameter: MovaFormField;
|
|
31
|
+
secondaryTireSpeedIndex: MovaFormField;
|
|
27
32
|
};
|
|
28
33
|
|
|
29
34
|
/**
|
package/src/models/Event.ts
CHANGED
|
@@ -94,6 +94,7 @@ export default class Event {
|
|
|
94
94
|
updatedDate?: Date;
|
|
95
95
|
quoteFirstSendingTime?: Date;
|
|
96
96
|
lastQuoteCreationDate?: Date;
|
|
97
|
+
urgent?: boolean;
|
|
97
98
|
constructor(
|
|
98
99
|
id: string,
|
|
99
100
|
ownerId: number,
|
|
@@ -128,7 +129,8 @@ export default class Event {
|
|
|
128
129
|
creationDate?: Date,
|
|
129
130
|
updatedDate?: Date,
|
|
130
131
|
lastQuoteCreationDate?: Date,
|
|
131
|
-
quoteFirstSendingTime?: Date
|
|
132
|
+
quoteFirstSendingTime?: Date,
|
|
133
|
+
urgent?: boolean
|
|
132
134
|
) {
|
|
133
135
|
this.id = id;
|
|
134
136
|
this.notes = notes;
|
|
@@ -178,6 +180,7 @@ export default class Event {
|
|
|
178
180
|
this.quoteFirstSendingTime = quoteFirstSendingTime
|
|
179
181
|
? new Date(quoteFirstSendingTime)
|
|
180
182
|
: undefined;
|
|
183
|
+
this.urgent = urgent
|
|
181
184
|
}
|
|
182
185
|
|
|
183
186
|
static getPrestationsList(event: Event): string[] {
|
package/src/models/Garage.ts
CHANGED
|
@@ -68,6 +68,7 @@ export default class Garage {
|
|
|
68
68
|
quoteRequestStart?: Date;
|
|
69
69
|
companyRegistrationNumber?: string;
|
|
70
70
|
establishmentRegistrationNumber?: string;
|
|
71
|
+
reopeningDate?: Date;
|
|
71
72
|
constructor(
|
|
72
73
|
id: string,
|
|
73
74
|
adminId: string,
|
|
@@ -100,7 +101,8 @@ export default class Garage {
|
|
|
100
101
|
appId?: number,
|
|
101
102
|
establishmentRegistrationNumber?: string,
|
|
102
103
|
companyRegistrationNumber?: string,
|
|
103
|
-
quoteRequestStart?: Date
|
|
104
|
+
quoteRequestStart?: Date,
|
|
105
|
+
reopeningDate?: Date
|
|
104
106
|
) {
|
|
105
107
|
this.id = id;
|
|
106
108
|
this.adminId = adminId;
|
|
@@ -134,5 +136,6 @@ export default class Garage {
|
|
|
134
136
|
this.quoteRequestStart = quoteRequestStart;
|
|
135
137
|
this.companyRegistrationNumber = companyRegistrationNumber;
|
|
136
138
|
this.establishmentRegistrationNumber = establishmentRegistrationNumber;
|
|
139
|
+
this.reopeningDate = reopeningDate;
|
|
137
140
|
}
|
|
138
141
|
}
|
package/src/models/Prestation.ts
CHANGED
|
@@ -25,6 +25,7 @@ export default class Prestation {
|
|
|
25
25
|
* La notion de position (ou d'ordre) peut être utile à l'affichage d'une liste de prestation par exemple
|
|
26
26
|
*/
|
|
27
27
|
position: number;
|
|
28
|
+
availableOnline: boolean;
|
|
28
29
|
|
|
29
30
|
active:boolean;
|
|
30
31
|
|
|
@@ -37,7 +38,7 @@ export default class Prestation {
|
|
|
37
38
|
|
|
38
39
|
constructor(id:number, code: string, name:string, description: string, category:string,
|
|
39
40
|
downtime:number, appointmentDelay: number, position: number, active: boolean, state: PrestationState,
|
|
40
|
-
multipleApplication: boolean, operationsVisible: boolean,categoryCode: string, operations?: Operation[]) {
|
|
41
|
+
multipleApplication: boolean, operationsVisible: boolean,categoryCode: string, availableOnline:boolean, operations?: Operation[]) {
|
|
41
42
|
this.id = id;
|
|
42
43
|
this.code = code;
|
|
43
44
|
this.name = name;
|
|
@@ -52,5 +53,6 @@ export default class Prestation {
|
|
|
52
53
|
this.operations = operations;
|
|
53
54
|
this.state = state;
|
|
54
55
|
this.categoryCode = categoryCode;
|
|
56
|
+
this.availableOnline = availableOnline;
|
|
55
57
|
}
|
|
56
58
|
}
|
package/src/models/Vehicle.ts
CHANGED
|
@@ -38,6 +38,11 @@ export default class Vehicle {
|
|
|
38
38
|
foreignPlate: boolean;
|
|
39
39
|
tireBrand?: string;
|
|
40
40
|
tireProfile?: string;
|
|
41
|
+
secondaryTireDiameter: string;
|
|
42
|
+
secondaryTireHeight: string;
|
|
43
|
+
secondaryTireSpeedIndex: string;
|
|
44
|
+
secondaryTireWidth: string;
|
|
45
|
+
secondaryTireSize: VehicleTire;
|
|
41
46
|
|
|
42
47
|
constructor(
|
|
43
48
|
id: number,
|
|
@@ -61,6 +66,11 @@ export default class Vehicle {
|
|
|
61
66
|
lastInspectionDate: Date,
|
|
62
67
|
lastMaintenanceDate: Date,
|
|
63
68
|
foreignPlate: boolean,
|
|
69
|
+
secondaryTireDiameter: string,
|
|
70
|
+
secondaryTireHeight: string,
|
|
71
|
+
secondaryTireSpeedIndex: string,
|
|
72
|
+
secondaryTireWidth: string,
|
|
73
|
+
secondaryTireSize: VehicleTire,
|
|
64
74
|
tireBrand?: string,
|
|
65
75
|
tireProfile?: string
|
|
66
76
|
) {
|
|
@@ -87,6 +97,11 @@ export default class Vehicle {
|
|
|
87
97
|
this.foreignPlate = foreignPlate;
|
|
88
98
|
this.tireBrand = tireBrand;
|
|
89
99
|
this.tireProfile = tireProfile;
|
|
100
|
+
this.secondaryTireDiameter = secondaryTireDiameter;
|
|
101
|
+
this.secondaryTireHeight = secondaryTireHeight;
|
|
102
|
+
this.secondaryTireSpeedIndex = secondaryTireSpeedIndex;
|
|
103
|
+
this.secondaryTireWidth = secondaryTireWidth;
|
|
104
|
+
this.secondaryTireSize = secondaryTireSize;
|
|
90
105
|
}
|
|
91
106
|
|
|
92
107
|
getVehicleLabel() {
|
|
@@ -10,6 +10,15 @@ import {
|
|
|
10
10
|
} from "./GarageService.types";
|
|
11
11
|
|
|
12
12
|
export default class GarageService {
|
|
13
|
+
|
|
14
|
+
static toogleUrgentQuote(garageId: string, quoteId: string): Promise<APIResponse<string>> {
|
|
15
|
+
return request({
|
|
16
|
+
url: `${API_BASE_URL}/garage/${garageId}/quotes/${quoteId}/urgent`,
|
|
17
|
+
method: APIMethod.PATCH,
|
|
18
|
+
appType: MovaAppType.GARAGE,
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
|
|
13
22
|
static updatePaymentAuthorization(
|
|
14
23
|
garageId: string,
|
|
15
24
|
req: any
|
|
@@ -1,32 +1,36 @@
|
|
|
1
1
|
export type AddCustomerVehicleParams = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
/** L'identifiant unique du garage */
|
|
3
|
+
garageId: string;
|
|
4
|
+
/** L'identifiant unique du client */
|
|
5
|
+
customerId: string;
|
|
6
|
+
/** La plaque d'immat du véhicule */
|
|
7
|
+
plate: string;
|
|
8
|
+
/** Le nombre de km au compteur */
|
|
9
|
+
currentMileage?: number;
|
|
10
|
+
/** Le nombre moyen de km par an */
|
|
11
|
+
averageMileagePerYear?: number;
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
13
|
+
/** Identification du pneu (XXX XX RXX XXX) */
|
|
14
|
+
tireWidth?: string;
|
|
15
|
+
tireHeight?: string;
|
|
16
|
+
tireDiameter?: string;
|
|
17
|
+
tireSpeedIndex?: string;
|
|
18
|
+
secondaryTireWidth?: string;
|
|
19
|
+
secondaryTireHeight?: string;
|
|
20
|
+
secondaryTireDiameter?: string;
|
|
21
|
+
secondaryTireSpeedIndex?: string;
|
|
22
|
+
lastMaintenanceDate?: string;
|
|
23
|
+
lastInspectionDate?: string;
|
|
23
24
|
|
|
25
|
+
isForeignPlate?: boolean;
|
|
26
|
+
model?: string;
|
|
27
|
+
};
|
|
24
28
|
|
|
25
29
|
export type DeleteCustomerVehicleParams = {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
30
|
+
/** L'identifiant unique du garage */
|
|
31
|
+
garageId: string;
|
|
32
|
+
/** L'identifiant unique du client */
|
|
33
|
+
customerId: string;
|
|
34
|
+
/** L'identifiant unique du véhicule */
|
|
35
|
+
vehicleId: string;
|
|
36
|
+
};
|