@movalib/movalib-commons 1.59.13 → 1.59.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/.env.development +2 -0
  2. package/devIndex.tsx +1 -1
  3. package/dist/devIndex.js +1 -1
  4. package/dist/index.d.ts +6 -3
  5. package/dist/index.js +14 -4
  6. package/dist/src/components/LinkedDocumentDialog.d.ts +11 -0
  7. package/dist/src/components/LinkedDocumentDialog.js +55 -0
  8. package/dist/src/{VehicleFullCard.d.ts → components/vehicle/VehicleFullCard.d.ts} +5 -2
  9. package/dist/src/{VehicleFullCard.js → components/vehicle/VehicleFullCard.js} +44 -22
  10. package/dist/src/components/vehicle/VehiclePlateField.d.ts +8 -0
  11. package/dist/src/components/vehicle/VehiclePlateField.js +122 -0
  12. package/dist/src/helpers/CookieUtils.js +2 -1
  13. package/dist/src/helpers/Enums.d.ts +10 -1
  14. package/dist/src/helpers/Enums.js +10 -1
  15. package/dist/src/helpers/Tools.d.ts +1 -0
  16. package/dist/src/helpers/Tools.js +10 -1
  17. package/dist/src/models/Garage.d.ts +2 -0
  18. package/dist/src/services/AuthenticationService.js +2 -0
  19. package/dist/src/services/GarageService.d.ts +8 -4
  20. package/dist/src/services/GarageService.js +75 -45
  21. package/dist/src/services/UserConnected.d.ts +9 -0
  22. package/dist/src/services/UserConnected.js +59 -0
  23. package/dist/src/services/UserService.d.ts +1 -1
  24. package/dist/src/services/VehicleService.d.ts +3 -0
  25. package/dist/src/services/VehicleService.js +22 -0
  26. package/dist/src/style/styled.d.ts +17 -0
  27. package/dist/src/style/styled.js +68 -0
  28. package/dist/src/style/styled.ts +70 -0
  29. package/index.ts +8 -3
  30. package/package.json +3 -2
  31. package/src/VehiclePlateField.tsx +1 -0
  32. package/src/components/LinkedDocumentDialog.tsx +200 -0
  33. package/src/components/vehicle/VehicleFullCard.tsx +549 -0
  34. package/src/components/vehicle/VehiclePlateField.tsx +164 -0
  35. package/src/helpers/CookieUtils.ts +2 -1
  36. package/src/helpers/Enums.ts +12 -1
  37. package/src/helpers/Tools.ts +5 -0
  38. package/src/models/Event.ts +1 -1
  39. package/src/models/Garage.ts +2 -0
  40. package/src/services/AuthenticationService.ts +2 -1
  41. package/src/services/GarageService.ts +557 -390
  42. package/src/services/UserConnected.ts +56 -0
  43. package/src/services/UserService.ts +1 -1
  44. package/src/services/VehicleService.ts +25 -0
  45. package/src/style/styled.ts +70 -0
  46. package/src/VehicleFullCard.tsx +0 -503
@@ -2,42 +2,81 @@ import { APIResponse, API_BASE_URL, request } from "../helpers/ApiHelper";
2
2
  import { APIMethod, MovaAppType } from "../helpers/Enums";
3
3
  import Employee from "../models/Employee";
4
4
  import Garage from "../models/Garage";
5
- import {AddCustomerVehicleParams, DeleteCustomerVehicleParams} from "./GarageService.types";
5
+ import {
6
+ AddCustomerVehicleParams,
7
+ DeleteCustomerVehicleParams,
8
+ } from "./GarageService.types";
6
9
 
7
10
  export default class GarageService {
8
11
 
9
- static toogleEventVehicleReceived(garageId: string, eventId: string): Promise<APIResponse<string>> {
10
- return request({
11
- url: `${API_BASE_URL}/garage/${garageId}/events/${eventId}/vehicle-received`,
12
- method: APIMethod.PATCH,
13
- appType: MovaAppType.GARAGE
14
- });
15
- }
16
-
17
- static setOrderedEvent(garageId: string, eventId: string, req: any): Promise<APIResponse<string>> {
18
- return request({
19
- url: `${API_BASE_URL}/garage/${garageId}/events/${eventId}/ordered`,
20
- method: APIMethod.POST,
21
- appType: MovaAppType.GARAGE,
22
- body: JSON.stringify(req)
23
- });
24
- }
25
-
26
- static deleteEventEmployee(garageId: string, eventId: string): Promise<APIResponse<string>> {
27
- return request({
28
- url: `${API_BASE_URL}/garage/${garageId}/event/${eventId}/employees`,
29
- method: APIMethod.DELETE,
30
- appType: MovaAppType.GARAGE
31
- });
32
- }
33
-
34
- static updateEventEmployee(garageId: string, eventId: string, employeeId: string): Promise<APIResponse<string>> {
35
- return request({
36
- url: `${API_BASE_URL}/garage/${garageId}/event/${eventId}/employees/${employeeId}`,
37
- method: APIMethod.PATCH,
38
- appType: MovaAppType.GARAGE
39
- });
40
- }
12
+ static updatePaymentAuthorization(
13
+ garageId: string,
14
+ req: any
15
+ ): Promise<APIResponse<string>> {
16
+ return request({
17
+ url: `${API_BASE_URL}/garage/${garageId}/settings/payment-authorization/update`,
18
+ method: APIMethod.PATCH,
19
+ appType: MovaAppType.GARAGE,
20
+ body: JSON.stringify(req),
21
+ });
22
+ }
23
+
24
+ static toogleGaragePaymentAuthorization(
25
+ garageId: string,
26
+ ): Promise<APIResponse<string>> {
27
+ return request({
28
+ url: `${API_BASE_URL}/garage/${garageId}/settings/payment-authorization`,
29
+ method: APIMethod.PATCH,
30
+ appType: MovaAppType.GARAGE,
31
+ });
32
+ }
33
+
34
+ static toogleEventVehicleReceived(
35
+ garageId: string,
36
+ eventId: string,
37
+ ): Promise<APIResponse<string>> {
38
+ return request({
39
+ url: `${API_BASE_URL}/garage/${garageId}/events/${eventId}/vehicle-received`,
40
+ method: APIMethod.PATCH,
41
+ appType: MovaAppType.GARAGE,
42
+ });
43
+ }
44
+
45
+ static setOrderedEvent(
46
+ garageId: string,
47
+ eventId: string,
48
+ req: any,
49
+ ): Promise<APIResponse<string>> {
50
+ return request({
51
+ url: `${API_BASE_URL}/garage/${garageId}/events/${eventId}/ordered`,
52
+ method: APIMethod.POST,
53
+ appType: MovaAppType.GARAGE,
54
+ body: JSON.stringify(req),
55
+ });
56
+ }
57
+
58
+ static deleteEventEmployee(
59
+ garageId: string,
60
+ eventId: string,
61
+ ): Promise<APIResponse<string>> {
62
+ return request({
63
+ url: `${API_BASE_URL}/garage/${garageId}/event/${eventId}/employees`,
64
+ method: APIMethod.DELETE,
65
+ appType: MovaAppType.GARAGE,
66
+ });
67
+ }
68
+
69
+ static updateEventEmployee(
70
+ garageId: string,
71
+ eventId: string,
72
+ employeeId: string,
73
+ ): Promise<APIResponse<string>> {
74
+ return request({
75
+ url: `${API_BASE_URL}/garage/${garageId}/event/${eventId}/employees/${employeeId}`,
76
+ method: APIMethod.PATCH,
77
+ appType: MovaAppType.GARAGE,
78
+ });
79
+ }
41
80
 
42
81
  static updateColorPrestationCategory(garageId: string, categoryCode: string, color: string): Promise<APIResponse<string>> {
43
82
  return request({
@@ -65,372 +104,500 @@ export default class GarageService {
65
104
  });
66
105
  }
67
106
 
68
- static sendGarageMandate(garageId: string): Promise<APIResponse<string>> {
69
-
70
- return request({
71
- url: `${API_BASE_URL}/garage/${garageId}/subscription-mandate`,
72
- method: APIMethod.POST,
73
- appType: MovaAppType.GARAGE
74
- });
75
- }
76
-
77
- static getGarageAllData(garageId: string): Promise<APIResponse<Garage>> {
78
- return request({
79
- url: `${API_BASE_URL}/garage/${garageId}/all-data`,
80
- method: APIMethod.GET,
81
- appType: MovaAppType.GARAGE
82
- });
83
- }
84
-
85
- static createGaragePrestationRequest(garageId: string, req: any): Promise<APIResponse<string>> {
86
- return request({
87
- url: `${API_BASE_URL}/garage/${garageId}/prestations/request`,
88
- method: APIMethod.POST,
89
- appType: MovaAppType.GARAGE,
90
- body: JSON.stringify(req)
91
- });
92
- }
93
-
94
- static getGarageSettings(garageId: string): Promise<APIResponse<Garage>> {
95
- return request({
96
- url: `${API_BASE_URL}/garage/${garageId}/settings`,
97
- method: APIMethod.GET,
98
- appType: MovaAppType.GARAGE
99
- });
100
- }
101
-
102
- static uploadLogo(garageId: string, formData: FormData): Promise<APIResponse<string>> {
103
- return request({
104
- url: `${API_BASE_URL}/garage/${garageId}/logo`,
105
- method: APIMethod.PATCH,
106
- appType: MovaAppType.GARAGE,
107
- body: formData
108
- });
109
- }
110
-
111
- static sendAppointmentVehicleAvailable(garageId: string, eventId: string): Promise<APIResponse<string>> {
112
- return request({
113
- url: `${API_BASE_URL}/garage/${garageId}/event/${eventId}/vehicle-available`,
114
- method: APIMethod.POST,
115
- appType: MovaAppType.GARAGE
116
- });
117
- }
118
-
119
- static enableGaragePrestation(garageId: string, prestationId: string): Promise<APIResponse<string>> {
120
- return request({
121
- url: `${API_BASE_URL}/garage/${garageId}/prestations/${prestationId}/enable`,
122
- method: APIMethod.PATCH,
123
- appType: MovaAppType.GARAGE
124
- });
125
- }
126
-
127
- static disableGaragePrestation(garageId: string, prestationId: string): Promise<APIResponse<string>> {
128
- return request({
129
- url: `${API_BASE_URL}/garage/${garageId}/prestations/${prestationId}/disable`,
130
- method: APIMethod.PATCH,
131
- appType: MovaAppType.GARAGE
132
- });
133
- }
134
-
135
- static getEmployeeDetails(garageId: string, employeeId: string): Promise<APIResponse<Employee>> {
136
- return request({
137
- url: `${API_BASE_URL}/garage/${garageId}/employees/${employeeId}`,
138
- method: APIMethod.GET,
139
- appType: MovaAppType.GARAGE
140
- });
141
- }
142
-
143
-
144
- static updateGaragePrestation(garageId: string, prestationId: string, req: any): Promise<APIResponse<string>> {
145
- return request({
146
- url: `${API_BASE_URL}/garage/${garageId}/prestations/${prestationId}`,
147
- method: APIMethod.PATCH,
148
- appType: MovaAppType.GARAGE,
149
- body: JSON.stringify(req)
150
- });
151
- }
152
-
153
- static deleteGarageEmployeePrestation(garageId: string, employeeId: string, prestationId: string): Promise<APIResponse<string>> {
154
- return request({
155
- url: `${API_BASE_URL}/garage/${garageId}/employees/${employeeId}/prestations/${prestationId}`,
156
- method: APIMethod.DELETE,
157
- appType: MovaAppType.GARAGE
158
- });
159
- }
160
-
161
- static createGarageEmployeePrestation(garageId: string, employeeId: string, prestationId: string): Promise<APIResponse<string>> {
162
- return request({
163
- url: `${API_BASE_URL}/garage/${garageId}/employees/${employeeId}/prestations/${prestationId}`,
164
- method: APIMethod.POST,
165
- appType: MovaAppType.GARAGE
166
- });
167
- }
168
-
169
- static deleteGarageEmployeeAbsence(garageId: string, employeeId: string, absenceId: string): Promise<APIResponse<string>> {
170
- return request({
171
- url: `${API_BASE_URL}/garage/${garageId}/employees/${employeeId}/absences/${absenceId}`,
172
- method: APIMethod.DELETE,
173
- appType: MovaAppType.GARAGE
174
- });
175
- }
176
-
177
- static createGarageEmployeeAbsence(garageId: string, employeeId: string, req: any): Promise<APIResponse<string>> {
178
- return request({
179
- url: `${API_BASE_URL}/garage/${garageId}/employees/${employeeId}/absences`,
180
- method: APIMethod.POST,
181
- appType: MovaAppType.GARAGE,
182
- body: JSON.stringify(req)
183
- });
184
- }
185
-
186
- static updateGarageEmployee(garageId: string, employeeId: string, req: any): Promise<APIResponse<string>> {
187
- return request({
188
- url: `${API_BASE_URL}/garage/${garageId}/employees/${employeeId}`,
189
- method: APIMethod.PATCH,
190
- appType: MovaAppType.GARAGE,
191
- body: JSON.stringify(req)
192
- });
193
- }
194
-
195
- static updateGarageEmployeeSchedules(garageId: string, employeeId: string, req: any): Promise<APIResponse<string>> {
196
- return request({
197
- url: `${API_BASE_URL}/garage/${garageId}/employees/${employeeId}/schedules`,
198
- method: APIMethod.PATCH,
199
- appType: MovaAppType.GARAGE,
200
- body: JSON.stringify(req)
201
- });
202
- }
203
-
204
- static deleteGarageEmployee(garageId: string, employeeId: string): Promise<APIResponse<string>> {
205
- return request({
206
- url: `${API_BASE_URL}/garage/${garageId}/employees/${employeeId}`,
207
- method: APIMethod.DELETE,
208
- appType: MovaAppType.GARAGE
209
- });
210
- }
211
-
212
- static createGarageEmployee(garageId: string, req: any): Promise<APIResponse<string>> {
213
- return request({
214
- url: `${API_BASE_URL}/garage/${garageId}/employees`,
215
- method: APIMethod.POST,
216
- appType: MovaAppType.GARAGE,
217
- body: JSON.stringify(req)
218
- });
219
- }
220
-
221
- static getEmployees(garageId: string): Promise<APIResponse<Employee[]>> {
222
- return request({
223
- url: `${API_BASE_URL}/garage/${garageId}/employees`,
224
- method: APIMethod.GET,
225
- appType: MovaAppType.GARAGE
226
- });
227
- }
228
-
229
- static activateGarage(garageId: string): Promise<APIResponse<string>> {
230
-
231
- return request({
232
- url: `${API_BASE_URL}/garage/${garageId}/activate`,
233
- method: APIMethod.PATCH,
234
- appType: MovaAppType.GARAGE
235
- });
236
- }
237
-
238
- static salesSignUp(formData: FormData): Promise<APIResponse<number>> {
239
- return request({
240
- url: `${API_BASE_URL}/garage/sales-signup`,
241
- method: APIMethod.POST,
242
- appType: MovaAppType.GARAGE,
243
- body: formData
244
- });
245
- }
246
-
247
- static sendNewEventQuote(garageId: string, eventId: string, formData: FormData): Promise<APIResponse<string>> {
248
- return request({
249
- url: `${API_BASE_URL}/garage/${garageId}/event/${eventId}/quote`,
250
- method: APIMethod.PATCH,
251
- appType: MovaAppType.GARAGE,
252
- body: formData
253
- });
254
- }
255
-
256
- static sendCustomerReminder(garageId: string, eventId: string, message: string): Promise<APIResponse<string>> {
257
-
258
- return request({
259
- url: `${API_BASE_URL}/garage/${garageId}/event/${eventId}/customer-reminder`,
260
- method: APIMethod.POST,
261
- appType: MovaAppType.GARAGE,
262
- body: message
263
- });
264
- }
265
-
266
- static updateGarageEvent(garageId: string, eventId: string, req: any): Promise<APIResponse<string>> {
267
-
268
- return request({
269
- url: `${API_BASE_URL}/garage/${garageId}/event/${eventId}`,
270
- method: APIMethod.PATCH,
271
- appType: MovaAppType.GARAGE,
272
- body: JSON.stringify(req)
273
- });
274
- }
275
-
276
- static sendSupplierRequest(garageId: string, eventId: string, req: any): Promise<APIResponse<string>> {
277
- return request({
278
- url: `${API_BASE_URL}/garage/${garageId}/events/${eventId}/supplierRequest`,
279
- method: APIMethod.POST,
280
- appType: MovaAppType.GARAGE,
281
- body: JSON.stringify(req)
282
- });
283
- }
284
-
285
- static deleteGarageSupplier(garageId: string, supplierId: string): Promise<APIResponse<string>> {
286
- return request({
287
- url: `${API_BASE_URL}/garage/${garageId}/suppliers/${supplierId}`,
288
- method: APIMethod.DELETE,
289
- appType: MovaAppType.GARAGE
290
- });
291
- }
292
-
293
- static createGarageSupplier(garageId: string, req: any): Promise<APIResponse<string>> {
294
- return request({
295
- url: `${API_BASE_URL}/garage/${garageId}/suppliers`,
296
- method: APIMethod.POST,
297
- appType: MovaAppType.GARAGE,
298
- body: JSON.stringify(req)
299
- });
300
- }
301
-
302
- static updateGarageSupplier(garageId: string, supplierId: number ,req: any): Promise<APIResponse<string>> {
303
- return request({
304
- url: `${API_BASE_URL}/garage/${garageId}/suppliers/${supplierId}`,
305
- method: APIMethod.PATCH,
306
- appType: MovaAppType.GARAGE,
307
- body: JSON.stringify(req)
308
- });
309
- }
310
- static updateGarage(garageId: string, req: any): Promise<APIResponse<string>> {
311
- return request({
312
- url: `${API_BASE_URL}/garage/${garageId}`,
313
- method: APIMethod.PATCH,
314
- appType: MovaAppType.GARAGE,
315
- body: JSON.stringify(req)
316
- });
317
- }
318
-
319
- static getAdministratedGarages({garageId}: {garageId: string}): Promise<APIResponse<Garage>> {
320
- return request({
321
- url: `${API_BASE_URL}/user/garage/${garageId}`,
322
- method: APIMethod.GET,
323
- appType: MovaAppType.GARAGE
324
- });
325
- }
326
-
327
- static sendGarageSupportRequest(garageId: string, req: { message: string }): Promise<APIResponse<string>> {
328
- return request({
329
- url: `${API_BASE_URL}/garage/${garageId}/support-request`,
330
- method: APIMethod.POST,
331
- appType: MovaAppType.GARAGE,
332
- body: JSON.stringify(req)
333
- });
334
- }
335
-
336
- static addCustomerVehicle({garageId, customerId, ...payload}: AddCustomerVehicleParams):Promise<APIResponse<string>> {
107
+ static uploadEventDocument(garageId: string, eventId: string, req: FormData): Promise<APIResponse<string>> {
337
108
  return request({
338
- url: `${API_BASE_URL}/garage/${garageId}/customers/${customerId}/vehicles`,
109
+ url: `${API_BASE_URL}/garage/${garageId}/event/${eventId}/documents`,
339
110
  method: APIMethod.POST,
340
111
  appType: MovaAppType.GARAGE,
341
- body: JSON.stringify(payload)
342
- })
343
- }
344
-
345
- static deleteCustomerVehicle({garageId, customerId, vehicleId}: DeleteCustomerVehicleParams):Promise<APIResponse<string>> {
346
- return request({
347
- url: `${API_BASE_URL}/garage/${garageId}/customers/${customerId}/vehicles/${vehicleId}`,
348
- method: APIMethod.DELETE,
349
- appType: MovaAppType.GARAGE,
350
- })
351
- }
352
-
353
- static toogleGarageLoanerVehicleRequest(garageId: string, req: any): Promise<APIResponse<string>> {
354
- return request({
355
- url: `${API_BASE_URL}/garage/${garageId}/settings/loaner-vehicle-request`,
356
- method: APIMethod.PATCH,
357
- appType: MovaAppType.GARAGE,
358
- body: JSON.stringify(req)
359
- });
360
- }
361
-
362
- static toogleGarageLoanerVehicle(garageId: string): Promise<APIResponse<string>> {
363
- return request({
364
- url: `${API_BASE_URL}/garage/${garageId}/settings/loaner-vehicle`,
365
- method: APIMethod.PATCH,
366
- appType: MovaAppType.GARAGE,
112
+ body: req
367
113
  });
368
- }
114
+ }
369
115
 
370
- static addGarageVehicle({garageId, req} :{garageId: string, req: {plate: string}}): Promise<APIResponse<string>> {
116
+ static deleteEventDocument(garageId: string, eventId: string, docId: string): Promise<APIResponse<string>> {
371
117
  return request({
372
- url: `${API_BASE_URL}/garage/${garageId}/vehicle`,
373
- method: APIMethod.POST,
118
+ url: `${API_BASE_URL}/garage/${garageId}/event/${eventId}/documents/${docId}`,
374
119
  appType: MovaAppType.GARAGE,
375
- body: JSON.stringify(req)
376
- });
377
- }
378
-
379
- static deleteGarageVehicle({garageId, vehicleId}:{garageId: string, vehicleId: number}): Promise<APIResponse<string>> {
380
- return request({
381
- url: `${API_BASE_URL}/garage/${garageId}/vehicle/${vehicleId}`,
382
120
  method: APIMethod.DELETE,
383
- appType: MovaAppType.GARAGE
384
- });
385
- }
386
-
387
- static getAllGarageVehicles(garageId: string): Promise<APIResponse<any>> {
388
- return request({
389
- url: `${API_BASE_URL}/garage/${garageId}/vehicles`,
390
- method: APIMethod.GET,
391
- appType: MovaAppType.GARAGE
392
- })
393
- }
394
-
395
- static getOneGarageVehicle(garageId: string, vehicleId: number): Promise<APIResponse<any>> {
396
- return request({
397
- url: `${API_BASE_URL}/garage/${garageId}/vehicle/${vehicleId}`,
398
- method: APIMethod.GET,
399
- appType: MovaAppType.GARAGE
400
- })
401
- }
402
-
403
- static assignGarageVehicleEvent(garageId: string, eventId: string, vehicleId: number): Promise<APIResponse<string>> {
404
- return request({
405
- url: `${API_BASE_URL}/garage/${garageId}/event/${eventId}/vehicles/${vehicleId}`,
406
- method: APIMethod.PATCH,
407
- appType: MovaAppType.GARAGE
408
- })
409
- }
410
-
411
- static deassignGarageVehicleEvent(garageId: string, eventId: string): Promise<APIResponse<string>> {
412
- return request({
413
- url: `${API_BASE_URL}/garage/${garageId}/event/${eventId}/vehicles`,
414
- method: APIMethod.DELETE,
415
- appType: MovaAppType.GARAGE
416
- })
417
- }
418
-
419
- // CSM
420
- static getGaragesCsm(): Promise<APIResponse<Garage[]>> {
421
- return request({
422
- url: `${API_BASE_URL}/csm/garages/list`,
423
- method: APIMethod.GET,
424
- appType: MovaAppType.GARAGE
425
- });
426
- }
427
-
428
- static getOneGarageCsm(garageId: string): Promise<APIResponse<Garage[]>> {
429
- return request({
430
- url: `${API_BASE_URL}/csm/garage/${garageId}`,
431
- method: APIMethod.GET,
432
- appType: MovaAppType.GARAGE
433
121
  });
434
122
  }
435
123
 
124
+ static sendGarageMandate(garageId: string): Promise<APIResponse<string>> {
125
+ return request({
126
+ url: `${API_BASE_URL}/garage/${garageId}/subscription-mandate`,
127
+ method: APIMethod.POST,
128
+ appType: MovaAppType.GARAGE,
129
+ });
130
+ }
131
+
132
+ static getGarageAllData(garageId: string): Promise<APIResponse<Garage>> {
133
+ return request({
134
+ url: `${API_BASE_URL}/garage/${garageId}/all-data`,
135
+ method: APIMethod.GET,
136
+ appType: MovaAppType.GARAGE,
137
+ });
138
+ }
139
+
140
+ static createGaragePrestationRequest(
141
+ garageId: string,
142
+ req: any,
143
+ ): Promise<APIResponse<string>> {
144
+ return request({
145
+ url: `${API_BASE_URL}/garage/${garageId}/prestations/request`,
146
+ method: APIMethod.POST,
147
+ appType: MovaAppType.GARAGE,
148
+ body: JSON.stringify(req),
149
+ });
150
+ }
151
+
152
+ static getGarageSettings(garageId: string): Promise<APIResponse<Garage>> {
153
+ return request({
154
+ url: `${API_BASE_URL}/garage/${garageId}/settings`,
155
+ method: APIMethod.GET,
156
+ appType: MovaAppType.GARAGE,
157
+ });
158
+ }
159
+
160
+ static uploadLogo(
161
+ garageId: string,
162
+ formData: FormData,
163
+ ): Promise<APIResponse<string>> {
164
+ return request({
165
+ url: `${API_BASE_URL}/garage/${garageId}/logo`,
166
+ method: APIMethod.PATCH,
167
+ appType: MovaAppType.GARAGE,
168
+ body: formData,
169
+ });
170
+ }
171
+
172
+ static sendAppointmentVehicleAvailable(
173
+ garageId: string,
174
+ eventId: string,
175
+ ): Promise<APIResponse<string>> {
176
+ return request({
177
+ url: `${API_BASE_URL}/garage/${garageId}/event/${eventId}/vehicle-available`,
178
+ method: APIMethod.POST,
179
+ appType: MovaAppType.GARAGE,
180
+ });
181
+ }
182
+
183
+ static enableGaragePrestation(
184
+ garageId: string,
185
+ prestationId: string,
186
+ ): Promise<APIResponse<string>> {
187
+ return request({
188
+ url: `${API_BASE_URL}/garage/${garageId}/prestations/${prestationId}/enable`,
189
+ method: APIMethod.PATCH,
190
+ appType: MovaAppType.GARAGE,
191
+ });
192
+ }
193
+
194
+ static disableGaragePrestation(
195
+ garageId: string,
196
+ prestationId: string,
197
+ ): Promise<APIResponse<string>> {
198
+ return request({
199
+ url: `${API_BASE_URL}/garage/${garageId}/prestations/${prestationId}/disable`,
200
+ method: APIMethod.PATCH,
201
+ appType: MovaAppType.GARAGE,
202
+ });
203
+ }
204
+
205
+ static getEmployeeDetails(
206
+ garageId: string,
207
+ employeeId: string,
208
+ ): Promise<APIResponse<Employee>> {
209
+ return request({
210
+ url: `${API_BASE_URL}/garage/${garageId}/employees/${employeeId}`,
211
+ method: APIMethod.GET,
212
+ appType: MovaAppType.GARAGE,
213
+ });
214
+ }
215
+
216
+ static updateGaragePrestation(
217
+ garageId: string,
218
+ prestationId: string,
219
+ req: any,
220
+ ): Promise<APIResponse<string>> {
221
+ return request({
222
+ url: `${API_BASE_URL}/garage/${garageId}/prestations/${prestationId}`,
223
+ method: APIMethod.PATCH,
224
+ appType: MovaAppType.GARAGE,
225
+ body: JSON.stringify(req),
226
+ });
227
+ }
228
+
229
+ static deleteGarageEmployeePrestation(
230
+ garageId: string,
231
+ employeeId: string,
232
+ prestationId: string,
233
+ ): Promise<APIResponse<string>> {
234
+ return request({
235
+ url: `${API_BASE_URL}/garage/${garageId}/employees/${employeeId}/prestations/${prestationId}`,
236
+ method: APIMethod.DELETE,
237
+ appType: MovaAppType.GARAGE,
238
+ });
239
+ }
240
+
241
+ static createGarageEmployeePrestation(
242
+ garageId: string,
243
+ employeeId: string,
244
+ prestationId: string,
245
+ ): Promise<APIResponse<string>> {
246
+ return request({
247
+ url: `${API_BASE_URL}/garage/${garageId}/employees/${employeeId}/prestations/${prestationId}`,
248
+ method: APIMethod.POST,
249
+ appType: MovaAppType.GARAGE,
250
+ });
251
+ }
252
+
253
+ static deleteGarageEmployeeAbsence(
254
+ garageId: string,
255
+ employeeId: string,
256
+ absenceId: string,
257
+ ): Promise<APIResponse<string>> {
258
+ return request({
259
+ url: `${API_BASE_URL}/garage/${garageId}/employees/${employeeId}/absences/${absenceId}`,
260
+ method: APIMethod.DELETE,
261
+ appType: MovaAppType.GARAGE,
262
+ });
263
+ }
264
+
265
+ static createGarageEmployeeAbsence(
266
+ garageId: string,
267
+ employeeId: string,
268
+ req: any,
269
+ ): Promise<APIResponse<string>> {
270
+ return request({
271
+ url: `${API_BASE_URL}/garage/${garageId}/employees/${employeeId}/absences`,
272
+ method: APIMethod.POST,
273
+ appType: MovaAppType.GARAGE,
274
+ body: JSON.stringify(req),
275
+ });
276
+ }
277
+
278
+ static updateGarageEmployee(
279
+ garageId: string,
280
+ employeeId: string,
281
+ req: any,
282
+ ): Promise<APIResponse<string>> {
283
+ return request({
284
+ url: `${API_BASE_URL}/garage/${garageId}/employees/${employeeId}`,
285
+ method: APIMethod.PATCH,
286
+ appType: MovaAppType.GARAGE,
287
+ body: JSON.stringify(req),
288
+ });
289
+ }
290
+
291
+ static updateGarageEmployeeSchedules(
292
+ garageId: string,
293
+ employeeId: string,
294
+ req: any,
295
+ ): Promise<APIResponse<string>> {
296
+ return request({
297
+ url: `${API_BASE_URL}/garage/${garageId}/employees/${employeeId}/schedules`,
298
+ method: APIMethod.PATCH,
299
+ appType: MovaAppType.GARAGE,
300
+ body: JSON.stringify(req),
301
+ });
302
+ }
303
+
304
+ static deleteGarageEmployee(
305
+ garageId: string,
306
+ employeeId: string,
307
+ ): Promise<APIResponse<string>> {
308
+ return request({
309
+ url: `${API_BASE_URL}/garage/${garageId}/employees/${employeeId}`,
310
+ method: APIMethod.DELETE,
311
+ appType: MovaAppType.GARAGE,
312
+ });
313
+ }
314
+
315
+ static createGarageEmployee(
316
+ garageId: string,
317
+ req: any,
318
+ ): Promise<APIResponse<string>> {
319
+ return request({
320
+ url: `${API_BASE_URL}/garage/${garageId}/employees`,
321
+ method: APIMethod.POST,
322
+ appType: MovaAppType.GARAGE,
323
+ body: JSON.stringify(req),
324
+ });
325
+ }
326
+
327
+ static getEmployees(garageId: string): Promise<APIResponse<Employee[]>> {
328
+ return request({
329
+ url: `${API_BASE_URL}/garage/${garageId}/employees`,
330
+ method: APIMethod.GET,
331
+ appType: MovaAppType.GARAGE,
332
+ });
333
+ }
334
+
335
+ static activateGarage(garageId: string): Promise<APIResponse<string>> {
336
+ return request({
337
+ url: `${API_BASE_URL}/garage/${garageId}/activate`,
338
+ method: APIMethod.PATCH,
339
+ appType: MovaAppType.GARAGE,
340
+ });
341
+ }
342
+
343
+ static salesSignUp(formData: FormData): Promise<APIResponse<number>> {
344
+ return request({
345
+ url: `${API_BASE_URL}/garage/sales-signup`,
346
+ method: APIMethod.POST,
347
+ appType: MovaAppType.GARAGE,
348
+ body: formData,
349
+ });
350
+ }
351
+
352
+ static sendNewEventQuote(
353
+ garageId: string,
354
+ eventId: string,
355
+ formData: FormData,
356
+ ): Promise<APIResponse<string>> {
357
+ return request({
358
+ url: `${API_BASE_URL}/garage/${garageId}/event/${eventId}/quote`,
359
+ method: APIMethod.PATCH,
360
+ appType: MovaAppType.GARAGE,
361
+ body: formData,
362
+ });
363
+ }
364
+
365
+ static sendCustomerReminder(
366
+ garageId: string,
367
+ eventId: string,
368
+ message: string,
369
+ ): Promise<APIResponse<string>> {
370
+ return request({
371
+ url: `${API_BASE_URL}/garage/${garageId}/event/${eventId}/customer-reminder`,
372
+ method: APIMethod.POST,
373
+ appType: MovaAppType.GARAGE,
374
+ body: message,
375
+ });
376
+ }
377
+
378
+ static updateGarageEvent(
379
+ garageId: string,
380
+ eventId: string,
381
+ req: any,
382
+ ): Promise<APIResponse<string>> {
383
+ return request({
384
+ url: `${API_BASE_URL}/garage/${garageId}/event/${eventId}`,
385
+ method: APIMethod.PATCH,
386
+ appType: MovaAppType.GARAGE,
387
+ body: JSON.stringify(req),
388
+ });
389
+ }
390
+
391
+ static sendSupplierRequest(
392
+ garageId: string,
393
+ eventId: string,
394
+ req: any,
395
+ ): Promise<APIResponse<string>> {
396
+ return request({
397
+ url: `${API_BASE_URL}/garage/${garageId}/events/${eventId}/supplierRequest`,
398
+ method: APIMethod.POST,
399
+ appType: MovaAppType.GARAGE,
400
+ body: JSON.stringify(req),
401
+ });
402
+ }
403
+
404
+ static deleteGarageSupplier(
405
+ garageId: string,
406
+ supplierId: string,
407
+ ): Promise<APIResponse<string>> {
408
+ return request({
409
+ url: `${API_BASE_URL}/garage/${garageId}/suppliers/${supplierId}`,
410
+ method: APIMethod.DELETE,
411
+ appType: MovaAppType.GARAGE,
412
+ });
413
+ }
414
+
415
+ static createGarageSupplier(
416
+ garageId: string,
417
+ req: any,
418
+ ): Promise<APIResponse<string>> {
419
+ return request({
420
+ url: `${API_BASE_URL}/garage/${garageId}/suppliers`,
421
+ method: APIMethod.POST,
422
+ appType: MovaAppType.GARAGE,
423
+ body: JSON.stringify(req),
424
+ });
425
+ }
426
+
427
+ static updateGarageSupplier(
428
+ garageId: string,
429
+ supplierId: number,
430
+ req: any,
431
+ ): Promise<APIResponse<string>> {
432
+ return request({
433
+ url: `${API_BASE_URL}/garage/${garageId}/suppliers/${supplierId}`,
434
+ method: APIMethod.PATCH,
435
+ appType: MovaAppType.GARAGE,
436
+ body: JSON.stringify(req),
437
+ });
438
+ }
439
+ static updateGarage(
440
+ garageId: string,
441
+ req: any,
442
+ ): Promise<APIResponse<string>> {
443
+ return request({
444
+ url: `${API_BASE_URL}/garage/${garageId}`,
445
+ method: APIMethod.PATCH,
446
+ appType: MovaAppType.GARAGE,
447
+ body: JSON.stringify(req),
448
+ });
449
+ }
450
+
451
+ static getAdministratedGarages({
452
+ garageId,
453
+ }: { garageId: string }): Promise<APIResponse<Garage>> {
454
+ return request({
455
+ url: `${API_BASE_URL}/user/garage/${garageId}`,
456
+ method: APIMethod.GET,
457
+ appType: MovaAppType.GARAGE,
458
+ });
459
+ }
460
+
461
+ static sendGarageSupportRequest(
462
+ garageId: string,
463
+ req: { message: string },
464
+ ): Promise<APIResponse<string>> {
465
+ return request({
466
+ url: `${API_BASE_URL}/garage/${garageId}/support-request`,
467
+ method: APIMethod.POST,
468
+ appType: MovaAppType.GARAGE,
469
+ body: JSON.stringify(req),
470
+ });
471
+ }
472
+
473
+ static addCustomerVehicle({
474
+ garageId,
475
+ customerId,
476
+ ...payload
477
+ }: AddCustomerVehicleParams): Promise<APIResponse<string>> {
478
+ return request({
479
+ url: `${API_BASE_URL}/garage/${garageId}/customers/${customerId}/vehicles`,
480
+ method: APIMethod.POST,
481
+ appType: MovaAppType.GARAGE,
482
+ body: JSON.stringify(payload),
483
+ });
484
+ }
485
+
486
+ static deleteCustomerVehicle({
487
+ garageId,
488
+ customerId,
489
+ vehicleId,
490
+ }: DeleteCustomerVehicleParams): Promise<APIResponse<string>> {
491
+ return request({
492
+ url: `${API_BASE_URL}/garage/${garageId}/customers/${customerId}/vehicles/${vehicleId}`,
493
+ method: APIMethod.DELETE,
494
+ appType: MovaAppType.GARAGE,
495
+ });
496
+ }
497
+
498
+ static toogleGarageLoanerVehicleRequest(
499
+ garageId: string,
500
+ req: any,
501
+ ): Promise<APIResponse<string>> {
502
+ return request({
503
+ url: `${API_BASE_URL}/garage/${garageId}/settings/loaner-vehicle-request`,
504
+ method: APIMethod.PATCH,
505
+ appType: MovaAppType.GARAGE,
506
+ body: JSON.stringify(req),
507
+ });
508
+ }
509
+
510
+ static toogleGarageLoanerVehicle(
511
+ garageId: string,
512
+ ): Promise<APIResponse<string>> {
513
+ return request({
514
+ url: `${API_BASE_URL}/garage/${garageId}/settings/loaner-vehicle`,
515
+ method: APIMethod.PATCH,
516
+ appType: MovaAppType.GARAGE,
517
+ });
518
+ }
519
+
520
+ static addGarageVehicle({
521
+ garageId,
522
+ req,
523
+ }: { garageId: string; req: { plate: string } }): Promise<
524
+ APIResponse<string>
525
+ > {
526
+ return request({
527
+ url: `${API_BASE_URL}/garage/${garageId}/vehicle`,
528
+ method: APIMethod.POST,
529
+ appType: MovaAppType.GARAGE,
530
+ body: JSON.stringify(req),
531
+ });
532
+ }
533
+
534
+ static deleteGarageVehicle({
535
+ garageId,
536
+ vehicleId,
537
+ }: { garageId: string; vehicleId: number }): Promise<APIResponse<string>> {
538
+ return request({
539
+ url: `${API_BASE_URL}/garage/${garageId}/vehicle/${vehicleId}`,
540
+ method: APIMethod.DELETE,
541
+ appType: MovaAppType.GARAGE,
542
+ });
543
+ }
544
+
545
+ static getAllGarageVehicles(garageId: string): Promise<APIResponse<any>> {
546
+ return request({
547
+ url: `${API_BASE_URL}/garage/${garageId}/vehicles`,
548
+ method: APIMethod.GET,
549
+ appType: MovaAppType.GARAGE,
550
+ });
551
+ }
552
+
553
+ static getOneGarageVehicle(
554
+ garageId: string,
555
+ vehicleId: number,
556
+ ): Promise<APIResponse<any>> {
557
+ return request({
558
+ url: `${API_BASE_URL}/garage/${garageId}/vehicle/${vehicleId}`,
559
+ method: APIMethod.GET,
560
+ appType: MovaAppType.GARAGE,
561
+ });
562
+ }
563
+
564
+ static assignGarageVehicleEvent(
565
+ garageId: string,
566
+ eventId: string,
567
+ vehicleId: number,
568
+ ): Promise<APIResponse<string>> {
569
+ return request({
570
+ url: `${API_BASE_URL}/garage/${garageId}/event/${eventId}/vehicles/${vehicleId}`,
571
+ method: APIMethod.PATCH,
572
+ appType: MovaAppType.GARAGE,
573
+ });
574
+ }
575
+
576
+ static deassignGarageVehicleEvent(
577
+ garageId: string,
578
+ eventId: string,
579
+ ): Promise<APIResponse<string>> {
580
+ return request({
581
+ url: `${API_BASE_URL}/garage/${garageId}/event/${eventId}/vehicles`,
582
+ method: APIMethod.DELETE,
583
+ appType: MovaAppType.GARAGE,
584
+ });
585
+ }
586
+
587
+ // CSM
588
+ static getGaragesCsm(): Promise<APIResponse<Garage[]>> {
589
+ return request({
590
+ url: `${API_BASE_URL}/csm/garages/list`,
591
+ method: APIMethod.GET,
592
+ appType: MovaAppType.GARAGE,
593
+ });
594
+ }
595
+
596
+ static getOneGarageCsm(garageId: string): Promise<APIResponse<Garage[]>> {
597
+ return request({
598
+ url: `${API_BASE_URL}/csm/garage/${garageId}`,
599
+ method: APIMethod.GET,
600
+ appType: MovaAppType.GARAGE,
601
+ });
602
+ }
436
603
  }