@movalib/movalib-commons 1.62.3 → 1.63.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/devIndex.tsx +15 -4
- package/dist/devIndex.js +10 -2
- package/dist/index.d.ts +2 -1
- package/dist/index.js +6 -4
- package/dist/src/components/MovaTableBack/MovaTableBack.d.ts +25 -0
- package/dist/src/components/MovaTableBack/MovaTableBack.js +95 -0
- package/dist/src/components/vehicle/VehicleFullCard.js +5 -3
- package/dist/src/components/vehicle/VehiclePlateField.d.ts +5 -1
- package/dist/src/components/vehicle/VehiclePlateField.js +74 -16
- package/dist/src/helpers/Enums.d.ts +4 -2
- package/dist/src/helpers/Enums.js +2 -0
- package/dist/src/helpers/Tools.d.ts +1 -1
- package/dist/src/helpers/Tools.js +18 -9
- package/dist/src/models/Customer.d.ts +3 -1
- package/dist/src/models/Customer.js +9 -5
- package/dist/src/models/Document.d.ts +4 -1
- package/dist/src/models/Document.js +10 -2
- package/dist/src/models/Garage.d.ts +11 -7
- package/dist/src/models/Garage.js +5 -1
- package/dist/src/models/Vehicle.d.ts +2 -1
- package/dist/src/models/Vehicle.js +2 -1
- package/dist/src/services/GarageService.types.d.ts +2 -0
- package/index.ts +2 -1
- package/package.json +1 -1
- package/src/components/MovaTableBack/MovaTableBack.tsx +249 -0
- package/src/components/vehicle/VehicleFullCard.tsx +47 -43
- package/src/components/vehicle/VehiclePlateField.tsx +112 -28
- package/src/helpers/Enums.ts +2 -0
- package/src/helpers/Tools.ts +18 -8
- package/src/models/Customer.ts +49 -45
- package/src/models/Document.ts +20 -2
- package/src/models/Garage.ts +121 -104
- package/src/models/Vehicle.ts +4 -1
- package/src/services/GarageService.types.ts +2 -0
- package/dist/src/VehiclePlateField.d.ts +0 -8
- package/dist/src/VehiclePlateField.js +0 -122
- package/src/VehiclePlateField.tsx +0 -165
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import React, { FunctionComponent, ReactNode, useEffect, useState } from 'react';
|
|
2
2
|
import TextField from '@mui/material/TextField';
|
|
3
|
-
import { IconButton, InputAdornment } from '@mui/material';
|
|
4
|
-
import SearchIcon from '@mui/icons-material/SearchRounded';
|
|
5
3
|
import { VehiclePlateFormat } from '../../helpers/Enums';
|
|
6
4
|
import Logger from '../../helpers/Logger';
|
|
5
|
+
import { Box, IconButton, InputAdornment, MenuItem, Select, SelectChangeEvent } from '@mui/material';
|
|
6
|
+
import SearchIcon from '@mui/icons-material/SearchRounded';
|
|
7
7
|
|
|
8
8
|
interface VehiclePlateFieldProps {
|
|
9
|
-
onValidVehiclePlate: (vehiclePlate: string) => void;
|
|
9
|
+
onValidVehiclePlate: (vehiclePlate: string, country: 'FR' | 'INTL') => void;
|
|
10
|
+
onCountryChange?: (country: 'FR' | 'INTL') => void;
|
|
11
|
+
country: 'FR' | 'INTL';
|
|
12
|
+
model?: string;
|
|
13
|
+
onModelChange?: (model :string) => void;
|
|
10
14
|
}
|
|
11
15
|
|
|
12
16
|
// Regex pour une plaque d'immatriculation française (nouveau format SIV)
|
|
@@ -15,20 +19,26 @@ export const regexPlate = /^[A-Z]{2}-\d{3}-[A-Z]{2}$/;
|
|
|
15
19
|
export const oldRegexPlate = /^\d{1,4}[ -]?[A-Z]{1,4}[ -]?\d{1,4}$/;
|
|
16
20
|
|
|
17
21
|
|
|
18
|
-
const VehiclePlateField: FunctionComponent<VehiclePlateFieldProps> = ({ onValidVehiclePlate }) => {
|
|
22
|
+
const VehiclePlateField: FunctionComponent<VehiclePlateFieldProps> = ({ onValidVehiclePlate, onCountryChange, country, onModelChange, model }) => {
|
|
19
23
|
|
|
20
24
|
const [value, setValue] = useState<string>('');
|
|
21
25
|
const [error, setError] = useState<boolean>(false);
|
|
22
26
|
const [lastLength, setLastLength] = useState<number>(0); // Ajout d'un état pour stocker la longueur précédente
|
|
23
27
|
const [helperText, setHelperText] = useState<ReactNode>('');
|
|
28
|
+
const MIN_FOREIGN_PLATE_LENGTH = 6;
|
|
24
29
|
|
|
25
30
|
// Hook de validation de la plaque
|
|
26
31
|
useEffect(() => {
|
|
27
|
-
if (
|
|
28
|
-
|
|
32
|
+
if (country === 'FR') {
|
|
33
|
+
if (!error && value !== '' && value.match(regexPlate)) {
|
|
34
|
+
onValidVehiclePlate(value, country);
|
|
35
|
+
}
|
|
36
|
+
} else {
|
|
37
|
+
if (value.length >= MIN_FOREIGN_PLATE_LENGTH) {
|
|
38
|
+
onValidVehiclePlate(value, country);
|
|
39
|
+
}
|
|
29
40
|
}
|
|
30
|
-
|
|
31
|
-
}, [error, value, onValidVehiclePlate]);
|
|
41
|
+
}, [error, value, country, onValidVehiclePlate]);
|
|
32
42
|
|
|
33
43
|
const getPlateFormat = (plate: string): VehiclePlateFormat | undefined => {
|
|
34
44
|
if (plate === '') {
|
|
@@ -49,9 +59,23 @@ const VehiclePlateField: FunctionComponent<VehiclePlateFieldProps> = ({ onValidV
|
|
|
49
59
|
}
|
|
50
60
|
}
|
|
51
61
|
|
|
62
|
+
|
|
52
63
|
const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
53
64
|
|
|
54
|
-
let inputValue = e.target.value.toUpperCase()
|
|
65
|
+
let inputValue = e.target.value.toUpperCase();
|
|
66
|
+
|
|
67
|
+
if (country === 'INTL') {
|
|
68
|
+
setValue(inputValue);
|
|
69
|
+
setHelperText(
|
|
70
|
+
inputValue.length >= MIN_FOREIGN_PLATE_LENGTH
|
|
71
|
+
? <></>
|
|
72
|
+
: <>Veuillez saisir au moins {MIN_FOREIGN_PLATE_LENGTH} caractères</>
|
|
73
|
+
);
|
|
74
|
+
setError(inputValue.length > 0 && inputValue.length < MIN_FOREIGN_PLATE_LENGTH);
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
inputValue = inputValue.replace(/[^A-Z0-9]/g, '');
|
|
55
79
|
|
|
56
80
|
// Si la saisie commence par une lettre, on contrôle l'ancien format, sinon le nouveau
|
|
57
81
|
switch(getPlateFormat(inputValue)){
|
|
@@ -83,12 +107,21 @@ const VehiclePlateField: FunctionComponent<VehiclePlateFieldProps> = ({ onValidV
|
|
|
83
107
|
};
|
|
84
108
|
|
|
85
109
|
const validatePlate = () => {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
110
|
+
if (country === 'FR') {
|
|
111
|
+
if (oldRegexPlate.test(value)) {
|
|
112
|
+
onValidVehiclePlate(value, country);
|
|
113
|
+
setError(false);
|
|
114
|
+
} else {
|
|
115
|
+
setError(true);
|
|
116
|
+
}
|
|
117
|
+
} else {
|
|
118
|
+
if (value.length >= MIN_FOREIGN_PLATE_LENGTH) {
|
|
119
|
+
onValidVehiclePlate(value, country);
|
|
120
|
+
setError(false);
|
|
121
|
+
} else {
|
|
122
|
+
setError(true);
|
|
123
|
+
}
|
|
89
124
|
}
|
|
90
|
-
|
|
91
|
-
setError(!oldRegexPlate.test(value));
|
|
92
125
|
}
|
|
93
126
|
|
|
94
127
|
const handleChangeFrenchOld = (inputValue: string) => {
|
|
@@ -130,9 +163,46 @@ const VehiclePlateField: FunctionComponent<VehiclePlateFieldProps> = ({ onValidV
|
|
|
130
163
|
setLastLength(inputValue.length); // Mettre à jour la longueur précédente
|
|
131
164
|
}
|
|
132
165
|
|
|
166
|
+
const handleCountryChange = (event: SelectChangeEvent<'FR' | 'INTL'>) => {
|
|
167
|
+
const newCountry = event.target.value as 'FR' | 'INTL';
|
|
168
|
+
setValue('');
|
|
169
|
+
setHelperText('');
|
|
170
|
+
setError(false);
|
|
171
|
+
|
|
172
|
+
onCountryChange?.(newCountry); // ✅ callback vers parent
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
const handleModelChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
176
|
+
const newModel = event.target.value.toUpperCase() as string;
|
|
177
|
+
onModelChange?.(newModel); // ✅ callback vers parent
|
|
178
|
+
};
|
|
179
|
+
|
|
133
180
|
return (
|
|
181
|
+
<>
|
|
182
|
+
<Box display="flex" alignItems="start" gap={1} width="100%">
|
|
183
|
+
<Select
|
|
184
|
+
value={country}
|
|
185
|
+
onChange={handleCountryChange}
|
|
186
|
+
variant="outlined"
|
|
187
|
+
sx={{
|
|
188
|
+
minWidth: 70,
|
|
189
|
+
'.MuiSelect-select': {
|
|
190
|
+
display: 'flex',
|
|
191
|
+
alignItems: 'center',
|
|
192
|
+
height: '100%',
|
|
193
|
+
},
|
|
194
|
+
'.MuiOutlinedInput-notchedOutline': {
|
|
195
|
+
height: '100%',
|
|
196
|
+
},
|
|
197
|
+
p: 0,
|
|
198
|
+
pb: '4px'
|
|
199
|
+
}}
|
|
200
|
+
>
|
|
201
|
+
<MenuItem value="FR">🇫🇷</MenuItem>
|
|
202
|
+
<MenuItem value="INTL">🌐</MenuItem>
|
|
203
|
+
</Select>
|
|
134
204
|
<TextField
|
|
135
|
-
label="Plaque d'immatriculation"
|
|
205
|
+
label={country === "INTL" ? "Plaque étrangère / non reconnue" : "Plaque d'immatriculation (FR)"}
|
|
136
206
|
variant="outlined"
|
|
137
207
|
value={value}
|
|
138
208
|
onChange={handleChange}
|
|
@@ -142,23 +212,37 @@ const VehiclePlateField: FunctionComponent<VehiclePlateFieldProps> = ({ onValidV
|
|
|
142
212
|
width: '100%',
|
|
143
213
|
'& input': { textTransform: 'uppercase' } // CSS pour forcer les majuscules dans l'input
|
|
144
214
|
}}
|
|
145
|
-
helperText={lastLength > 0 ? helperText : ''}
|
|
215
|
+
helperText={lastLength > 0 || country === 'INTL' ? helperText : ''}
|
|
146
216
|
InputProps={{
|
|
147
|
-
endAdornment:
|
|
217
|
+
endAdornment:
|
|
148
218
|
|
|
149
|
-
|
|
150
|
-
<
|
|
151
|
-
edge="end"
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
</InputAdornment>
|
|
219
|
+
country === 'FR' && getPlateFormat(value) === VehiclePlateFormat.FRENCH_OLD ? (
|
|
220
|
+
<InputAdornment position="end" sx={{ mr: 1 }}>
|
|
221
|
+
<IconButton edge="end" onClick={validatePlate}>
|
|
222
|
+
<SearchIcon />
|
|
223
|
+
</IconButton>
|
|
224
|
+
</InputAdornment>
|
|
225
|
+
) : undefined,
|
|
157
226
|
|
|
158
|
-
),
|
|
159
227
|
}}
|
|
160
|
-
/>
|
|
228
|
+
/>
|
|
229
|
+
</Box>
|
|
230
|
+
{(country === 'INTL') && <Box>
|
|
231
|
+
<TextField
|
|
232
|
+
label="Précisez le modèle ..."
|
|
233
|
+
variant="outlined"
|
|
234
|
+
value={model}
|
|
235
|
+
onChange={handleModelChange}
|
|
236
|
+
autoFocus
|
|
237
|
+
sx={{
|
|
238
|
+
width: '100%',
|
|
239
|
+
mt: 1,
|
|
240
|
+
'& input': { textTransform: 'uppercase' } // CSS pour forcer les majuscules dans l'input
|
|
241
|
+
}}
|
|
242
|
+
/>
|
|
243
|
+
</Box>}
|
|
244
|
+
</>
|
|
161
245
|
);
|
|
162
246
|
};
|
|
163
247
|
|
|
164
|
-
export default VehiclePlateField;
|
|
248
|
+
export default VehiclePlateField;
|
package/src/helpers/Enums.ts
CHANGED
|
@@ -92,6 +92,7 @@ export enum RegistrationState {
|
|
|
92
92
|
export enum VehiclePlateFormat {
|
|
93
93
|
FRENCH_NEW = "FRENCH_NEW",
|
|
94
94
|
FRENCH_OLD = "FRENCH_OLD",
|
|
95
|
+
FOREIGN = "FOREIGN"
|
|
95
96
|
}
|
|
96
97
|
|
|
97
98
|
export enum SlotAlgorithm {
|
|
@@ -252,6 +253,7 @@ export enum DocumentType {
|
|
|
252
253
|
EVENT_OTHER = "EVENT_OTHER",
|
|
253
254
|
EVENT_VISUAL_PROOFS = "EVENT_VISUAL_PROOFS",
|
|
254
255
|
EVENT_MAINTENANCE = "EVENT_MAINTENANCE",
|
|
256
|
+
VEHICLE_MAINTENANCE_INVOICE_AVOID = "VEHICLE_MAINTENANCE_INVOICE_AVOID",
|
|
255
257
|
}
|
|
256
258
|
|
|
257
259
|
export enum MovaAppType {
|
package/src/helpers/Tools.ts
CHANGED
|
@@ -294,24 +294,28 @@ export const isEmpty = (data: Object): boolean => {
|
|
|
294
294
|
return Object.keys(data).length === 0;
|
|
295
295
|
};
|
|
296
296
|
|
|
297
|
-
export const
|
|
297
|
+
export const formatVehiclePlate = (input: string | undefined, isForeignPlate: boolean): string => {
|
|
298
298
|
if (input) {
|
|
299
|
-
|
|
299
|
+
|
|
300
300
|
let plateFormat: VehiclePlateFormat | null = null;
|
|
301
301
|
|
|
302
|
-
if
|
|
303
|
-
//
|
|
302
|
+
if(isForeignPlate) {
|
|
303
|
+
// Plaque étrangère
|
|
304
|
+
plateFormat = VehiclePlateFormat.FOREIGN;
|
|
305
|
+
} else if (/^[A-Za-z]/.test(input)) {
|
|
306
|
+
// Commence par une lettre => nouveau format FR
|
|
304
307
|
plateFormat = VehiclePlateFormat.FRENCH_NEW;
|
|
305
308
|
} else if (/^\d/.test(input)) {
|
|
306
|
-
// Commence par un chiffre => ancien format
|
|
309
|
+
// Commence par un chiffre => ancien format FR
|
|
307
310
|
plateFormat = VehiclePlateFormat.FRENCH_OLD;
|
|
308
311
|
}
|
|
309
312
|
|
|
310
|
-
|
|
311
|
-
let cleanedInput = input.replace(/[^A-Z0-9]/gi, "").toUpperCase();
|
|
313
|
+
let cleanedInput = input;
|
|
312
314
|
|
|
313
315
|
switch (plateFormat) {
|
|
314
316
|
case VehiclePlateFormat.FRENCH_NEW: {
|
|
317
|
+
// Supprimer tous les caractères non alphanumériques
|
|
318
|
+
cleanedInput = input.replace(/[^A-Z0-9]/gi, "").toUpperCase();
|
|
315
319
|
// Ajouter des tirets aux positions appropriées
|
|
316
320
|
if (cleanedInput.length >= 2) {
|
|
317
321
|
cleanedInput = `${cleanedInput.slice(0, 2)}-${cleanedInput.slice(2)}`;
|
|
@@ -326,11 +330,17 @@ export const formatFrenchVehiclePlate = (input: string | undefined): string => {
|
|
|
326
330
|
}
|
|
327
331
|
|
|
328
332
|
case VehiclePlateFormat.FRENCH_OLD: {
|
|
333
|
+
// Supprimer tous les caractères non alphanumériques
|
|
334
|
+
cleanedInput = input.replace(/[^A-Z0-9]/gi, "").toUpperCase();
|
|
329
335
|
// Rien de particulier, pas de tiret sur les anciennes plaques
|
|
330
336
|
break;
|
|
331
337
|
}
|
|
332
|
-
}
|
|
333
338
|
|
|
339
|
+
case VehiclePlateFormat.FOREIGN: {
|
|
340
|
+
// On retourne la plaque telle qu'enregistrée par l'utilisateur, ras
|
|
341
|
+
|
|
342
|
+
}
|
|
343
|
+
}
|
|
334
344
|
return cleanedInput;
|
|
335
345
|
}
|
|
336
346
|
|
package/src/models/Customer.ts
CHANGED
|
@@ -4,54 +4,58 @@ import Role from "./Role";
|
|
|
4
4
|
import User from "./User";
|
|
5
5
|
import Vehicle from "./Vehicle";
|
|
6
6
|
|
|
7
|
-
|
|
8
7
|
export default class Customer extends User {
|
|
8
|
+
// Properties
|
|
9
|
+
vehicles: Vehicle[];
|
|
10
|
+
turnover: { key: string; value: number }[];
|
|
11
|
+
/**
|
|
12
|
+
* Type de client (professionnel / particulier)
|
|
13
|
+
*/
|
|
14
|
+
type: CustomerType;
|
|
9
15
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
* Type de client (professionnel / particulier)
|
|
15
|
-
*/
|
|
16
|
-
type: CustomerType;
|
|
16
|
+
/**
|
|
17
|
+
* Raison sociale si client Professionnel
|
|
18
|
+
*/
|
|
19
|
+
companyName: string;
|
|
17
20
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Téléphone de contact additionnel (souvent un fixe pour les pro)
|
|
25
|
-
*/
|
|
26
|
-
companyPhoneNumber: string;
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Notes relatives au client
|
|
30
|
-
*/
|
|
31
|
-
notes: string;
|
|
21
|
+
/**
|
|
22
|
+
* Téléphone de contact additionnel (souvent un fixe pour les pro)
|
|
23
|
+
*/
|
|
24
|
+
companyPhoneNumber: string;
|
|
32
25
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
addresses : Address[] = [],
|
|
40
|
-
vehicles: Vehicle[],
|
|
41
|
-
email: string = '',
|
|
42
|
-
turnover: { key: string, value: number }[],
|
|
43
|
-
type: CustomerType,
|
|
44
|
-
companyName: string,
|
|
45
|
-
companyPhoneNumber: string,
|
|
46
|
-
notes: string) {
|
|
26
|
+
/**
|
|
27
|
+
* Notes relatives au client
|
|
28
|
+
*/
|
|
29
|
+
notes: string;
|
|
30
|
+
billingAddress?: Address;
|
|
31
|
+
siren?: string;
|
|
47
32
|
|
|
48
|
-
|
|
33
|
+
constructor(
|
|
34
|
+
id: string,
|
|
35
|
+
roles: Role[] = [],
|
|
36
|
+
firstname: string = "",
|
|
37
|
+
lastname: string = "",
|
|
38
|
+
avatar: string = "",
|
|
39
|
+
addresses: Address[] = [],
|
|
40
|
+
vehicles: Vehicle[],
|
|
41
|
+
email: string = "",
|
|
42
|
+
turnover: { key: string; value: number }[],
|
|
43
|
+
type: CustomerType,
|
|
44
|
+
companyName: string,
|
|
45
|
+
companyPhoneNumber: string,
|
|
46
|
+
billingAddress: Address | undefined = undefined,
|
|
47
|
+
notes: string,
|
|
48
|
+
siren: string = ""
|
|
49
|
+
) {
|
|
50
|
+
super(id, roles, firstname, lastname, avatar, email);
|
|
49
51
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
52
|
+
this.vehicles = vehicles;
|
|
53
|
+
this.turnover = turnover;
|
|
54
|
+
this.type = type;
|
|
55
|
+
this.companyName = companyName;
|
|
56
|
+
this.companyPhoneNumber = companyPhoneNumber;
|
|
57
|
+
this.notes = notes;
|
|
58
|
+
this.billingAddress = billingAddress;
|
|
59
|
+
this.siren = siren;
|
|
60
|
+
}
|
|
61
|
+
}
|
package/src/models/Document.ts
CHANGED
|
@@ -7,6 +7,7 @@ export default class Document {
|
|
|
7
7
|
state: DocumentState;
|
|
8
8
|
fileName: string;
|
|
9
9
|
originalFileName: string;
|
|
10
|
+
eventId?: string; // Optional, used for event documents
|
|
10
11
|
fileType: string;
|
|
11
12
|
fileSignedUrl: string;
|
|
12
13
|
type: DocumentType;
|
|
@@ -19,6 +20,7 @@ export default class Document {
|
|
|
19
20
|
totalAmountInclVat?: number;
|
|
20
21
|
lastSendingTime?: Date;
|
|
21
22
|
firstSendingTime?: Date;
|
|
23
|
+
sinaoDocumentId?: number;
|
|
22
24
|
constructor(
|
|
23
25
|
id: string,
|
|
24
26
|
ownerId: number,
|
|
@@ -35,7 +37,9 @@ export default class Document {
|
|
|
35
37
|
remindersCount?: number,
|
|
36
38
|
totalAmountInclVat?: number,
|
|
37
39
|
lastSendingTime?: Date,
|
|
38
|
-
firstSendingTime?: Date
|
|
40
|
+
firstSendingTime?: Date,
|
|
41
|
+
eventId?: string,
|
|
42
|
+
sinaoDocumentId?: number
|
|
39
43
|
) {
|
|
40
44
|
this.id = id;
|
|
41
45
|
this.state = state;
|
|
@@ -57,6 +61,8 @@ export default class Document {
|
|
|
57
61
|
this.firstSendingTime = firstSendingTime
|
|
58
62
|
? new Date(firstSendingTime)
|
|
59
63
|
: undefined;
|
|
64
|
+
this.eventId = eventId;
|
|
65
|
+
this.sinaoDocumentId = sinaoDocumentId;
|
|
60
66
|
}
|
|
61
67
|
|
|
62
68
|
static findByTypeAndReference(
|
|
@@ -66,7 +72,19 @@ export default class Document {
|
|
|
66
72
|
): Document | undefined {
|
|
67
73
|
if (documents && type && reference) {
|
|
68
74
|
return documents.find(
|
|
69
|
-
(document) => document.type === type && document.
|
|
75
|
+
(document) => document.type === type && document.eventId === reference
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
return undefined;
|
|
79
|
+
}
|
|
80
|
+
static findManyByTypeAndReference(
|
|
81
|
+
documents: Document[],
|
|
82
|
+
type: DocumentType,
|
|
83
|
+
reference: string
|
|
84
|
+
): Document[] | undefined {
|
|
85
|
+
if (documents && type && reference) {
|
|
86
|
+
return documents.filter(
|
|
87
|
+
(document) => document.type === type && document.eventId === reference
|
|
70
88
|
);
|
|
71
89
|
}
|
|
72
90
|
return undefined;
|
package/src/models/Garage.ts
CHANGED
|
@@ -1,113 +1,130 @@
|
|
|
1
|
+
import {
|
|
2
|
+
OrderPreference,
|
|
3
|
+
RegistrationState,
|
|
4
|
+
SlotAlgorithm,
|
|
5
|
+
SubscriptionPaymentInterval,
|
|
6
|
+
} from "../helpers/Enums";
|
|
1
7
|
import Address from "./Address";
|
|
2
|
-
import
|
|
8
|
+
import CategoryPrestation from "./CategoryPrestation";
|
|
9
|
+
import Document from "./Document";
|
|
10
|
+
import Employee from "./Employee";
|
|
3
11
|
import Prestation from "./Prestation";
|
|
12
|
+
import Schedule from "./Schedule";
|
|
13
|
+
import Subscription from "./Subscription";
|
|
4
14
|
import Supplier from "./Supplier";
|
|
5
|
-
import Document from "./Document";
|
|
6
|
-
import { OrderPreference, RegistrationState, SlotAlgorithm, SubscriptionPaymentInterval } from "../helpers/Enums";
|
|
7
15
|
import User from "./User";
|
|
8
|
-
import Subscription from "./Subscription";
|
|
9
|
-
import Employee from "./Employee";
|
|
10
|
-
import CategoryPrestation from "./CategoryPrestation";
|
|
11
16
|
import VehicleGarage from "./VehicleGarage";
|
|
12
17
|
|
|
13
18
|
export default class Garage {
|
|
14
|
-
|
|
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
|
-
|
|
19
|
+
id: string;
|
|
20
|
+
adminId: string;
|
|
21
|
+
name: string;
|
|
22
|
+
address: Address;
|
|
23
|
+
workforce: number;
|
|
24
|
+
partialWorkforce?: number;
|
|
25
|
+
contactPhone: string;
|
|
26
|
+
prestationCategories: CategoryPrestation[];
|
|
27
|
+
prestations: Prestation[];
|
|
28
|
+
schedules: Schedule[];
|
|
29
|
+
dayPeriodFastServiceExcluded: boolean;
|
|
30
|
+
loanerVehicleFastServiceExcluded: boolean;
|
|
31
|
+
fastServiceThreshold: number;
|
|
32
|
+
vehicles?: VehicleGarage[];
|
|
33
|
+
countryCode?: string;
|
|
34
|
+
contactEmail?: string;
|
|
35
|
+
admin?: User;
|
|
36
|
+
logo?: string;
|
|
37
|
+
suppliers?: Supplier[];
|
|
38
|
+
orderPreference?: OrderPreference;
|
|
39
|
+
amVehicleDeposit?: Date;
|
|
40
|
+
pmVehicleDeposit?: Date;
|
|
41
|
+
appointmentRequestStart?: Date;
|
|
42
|
+
slotAlgorithm?: SlotAlgorithm;
|
|
43
|
+
customerQuoteActive?: boolean;
|
|
44
|
+
supplierOrderActive?: boolean;
|
|
45
|
+
registrationState?: RegistrationState;
|
|
46
|
+
subscriptionIban?: string;
|
|
47
|
+
subscriptionPaymentInterval?: SubscriptionPaymentInterval;
|
|
48
|
+
creationDate?: Date;
|
|
49
|
+
teamManagementActive?: boolean;
|
|
50
|
+
documents?: Document[];
|
|
51
|
+
subscriptions?: Subscription[];
|
|
52
|
+
subscription?: Subscription;
|
|
53
|
+
supportPhoneNumber?: string;
|
|
54
|
+
operatorsActive?: boolean;
|
|
55
|
+
employees?: Employee[];
|
|
56
|
+
defaultView?: string;
|
|
57
|
+
loanerVehicleActive?: boolean;
|
|
58
|
+
loanerVehicleRequestActive?: boolean;
|
|
59
|
+
paymentAuthorizationActive?: boolean;
|
|
60
|
+
paymentAuthorizationMinDowntime?: number;
|
|
61
|
+
timezone: string;
|
|
62
|
+
customStyle?: string;
|
|
63
|
+
mailCustomization?: boolean;
|
|
64
|
+
billingActive?: boolean;
|
|
65
|
+
billingToken?: string;
|
|
66
|
+
billingSimulationActive?: boolean;
|
|
67
|
+
appId?: number;
|
|
59
68
|
|
|
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
|
-
|
|
69
|
+
constructor(
|
|
70
|
+
id: string,
|
|
71
|
+
adminId: string,
|
|
72
|
+
name: string,
|
|
73
|
+
address: Address,
|
|
74
|
+
workforce: number,
|
|
75
|
+
prestations: Prestation[],
|
|
76
|
+
schedules: Schedule[],
|
|
77
|
+
contactPhone: string,
|
|
78
|
+
prestationCategories: CategoryPrestation[],
|
|
79
|
+
dayPeriodFastServiceExcluded: boolean,
|
|
80
|
+
loanerVehicleFastServiceExcluded: boolean,
|
|
81
|
+
fastServiceThreshold: number,
|
|
82
|
+
timezone: string,
|
|
83
|
+
vehicles?: VehicleGarage[],
|
|
84
|
+
contactEmail?: string,
|
|
85
|
+
logo?: string,
|
|
86
|
+
suppliers?: Supplier[],
|
|
87
|
+
documents?: Document[],
|
|
88
|
+
subscriptions?: Subscription[],
|
|
89
|
+
loanerVehicleActive?: boolean,
|
|
90
|
+
loanerVehicleRequestActive?: boolean,
|
|
91
|
+
customStyle?: string,
|
|
92
|
+
subscription?: Subscription,
|
|
93
|
+
partialWorkforce?: number,
|
|
94
|
+
mailCustomization?: boolean,
|
|
95
|
+
billingActive?: boolean,
|
|
96
|
+
billingToken?: string,
|
|
97
|
+
billingSimulationActive?: boolean,
|
|
98
|
+
appId?: number
|
|
99
|
+
) {
|
|
100
|
+
this.id = id;
|
|
101
|
+
this.adminId = adminId;
|
|
102
|
+
this.name = name;
|
|
103
|
+
this.address = address;
|
|
104
|
+
this.workforce = workforce;
|
|
105
|
+
this.prestationCategories = prestationCategories;
|
|
106
|
+
this.prestations = prestations;
|
|
107
|
+
this.schedules = schedules;
|
|
108
|
+
this.contactPhone = contactPhone;
|
|
109
|
+
this.contactEmail = contactEmail;
|
|
110
|
+
this.logo = logo;
|
|
111
|
+
this.suppliers = suppliers;
|
|
112
|
+
this.documents = documents;
|
|
113
|
+
this.subscriptions = subscriptions;
|
|
114
|
+
this.vehicles = vehicles;
|
|
115
|
+
this.loanerVehicleActive = loanerVehicleActive;
|
|
116
|
+
this.loanerVehicleRequestActive = loanerVehicleRequestActive;
|
|
117
|
+
this.subscription = subscription;
|
|
118
|
+
this.partialWorkforce = partialWorkforce;
|
|
119
|
+
this.dayPeriodFastServiceExcluded = dayPeriodFastServiceExcluded;
|
|
120
|
+
this.loanerVehicleFastServiceExcluded = loanerVehicleFastServiceExcluded;
|
|
121
|
+
this.fastServiceThreshold = fastServiceThreshold;
|
|
122
|
+
this.customStyle = customStyle;
|
|
123
|
+
this.timezone = timezone;
|
|
124
|
+
this.mailCustomization = mailCustomization;
|
|
125
|
+
this.billingActive = billingActive;
|
|
126
|
+
this.billingToken = billingToken;
|
|
127
|
+
this.billingSimulationActive = billingSimulationActive;
|
|
128
|
+
this.appId = appId;
|
|
129
|
+
}
|
|
113
130
|
}
|