@movalib/movalib-commons 1.59.6 → 1.59.7

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/dist/index.d.ts CHANGED
@@ -13,7 +13,7 @@ export { default as MovaDigitalPassport } from './src/MovaDigitalPassport';
13
13
  export { default as Loader } from './src/Loader';
14
14
  export { default as MovaDialog } from './src/MovaDialog';
15
15
  export { default as QRCode } from './src/QRCode';
16
- export { default as VehiclePlateField } from './src/VehiclePlateField';
16
+ export { default as VehiclePlateField, regexPlate, oldRegexPlate } from './src/VehiclePlateField';
17
17
  export { default as TestButton } from './src/TestButton';
18
18
  export { default as MovaSnackbar } from './src/MovaSnackbar';
19
19
  export { default as MovaLogin } from './src/MovaLogin';
@@ -39,6 +39,7 @@ export { default as Address } from './src/models/Address';
39
39
  export { default as Vehicle } from './src/models/Vehicle';
40
40
  export { default as Document } from './src/models/Document';
41
41
  export { default as Garage } from './src/models/Garage';
42
+ export { default as VehicleGarage } from './src/models/VehicleGarage';
42
43
  export { default as Schedule } from './src/models/Schedule';
43
44
  export { default as Event } from './src/models/Event';
44
45
  export { default as VehicleTire } from './src/models/VehicleTire';
package/dist/index.js CHANGED
@@ -4,8 +4,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  return (mod && mod.__esModule) ? mod : { "default": mod };
5
5
  };
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.formatVehicleTire = exports.validateField = exports.deleteCookie = exports.readCookie = exports.CategoryPrestation = exports.VehicleTire = exports.Event = exports.Schedule = exports.Garage = exports.Document = exports.Vehicle = exports.Address = exports.Role = exports.User = exports.Customer = exports.Logger = exports.Operation = exports.Prestation = exports.Product = exports.Supplier = exports.Employee = exports.Absence = exports.Subscription = exports.PrintSize = exports.PLVComponent = exports.QrCodePLVContainer = exports.GenderSelector = exports.ConfirmationDialog = exports.MovaVehicleTireField = exports.MovaCopyright = exports.MovaSignUp = exports.MovaLogin = exports.MovaSnackbar = exports.TestButton = exports.VehiclePlateField = exports.QRCode = exports.MovaDialog = exports.Loader = exports.MovaDigitalPassport = exports.VehicleFullCard = exports.ScheduleFields = exports.AddressFields = exports.AccountValidation = exports.GaragePLV = exports.IbanInput = exports.DialogForgotPassword = exports.UserService = exports.GarageService = exports.AuthenticationService = exports.VehicleService = void 0;
8
- exports.openDialogPrint = exports.APIMethod = exports.SubscriptionType = exports.SubscriptionState = exports.CountryCode = exports.PrestationState = exports.PrestationType = exports.RegistrationState = exports.SubscriptionPaymentInterval = exports.VehiclePlateType = exports.SlotAlgorithm = exports.OrderState = exports.OrderPreference = exports.ProductType = exports.PartsApplicationType = exports.DateFormatTypes = exports.Gender = exports.DocumentState = exports.DigitalPassportIndex = exports.DocumentType = exports.EventType = exports.EventState = exports.DayOfWeek = exports.MovaAppType = exports.RoleType = exports.CustomerType = exports.API_BASE_URL = exports.request = exports.getLongFormattedDateTime = exports.formatDateByCountryCode = exports.validateEmail = exports.validateText = exports.validatePhoneNumber = exports.getApplicationsShortLabels = exports.isSafariOniOS = exports.getDayOfWeekLabel = exports.findScheduleByDayOfWeek = exports.getFormattedIntervals = exports.getFormattedSchedule = exports.formatPhoneNumber = exports.flexLeftRow = exports.capitalizeFirstLetter = exports.getApplicationShortLabel = exports.isEmpty = exports.formatFrenchVehiclePlate = void 0;
7
+ exports.readCookie = exports.CategoryPrestation = exports.VehicleTire = exports.Event = exports.Schedule = exports.VehicleGarage = exports.Garage = exports.Document = exports.Vehicle = exports.Address = exports.Role = exports.User = exports.Customer = exports.Logger = exports.Operation = exports.Prestation = exports.Product = exports.Supplier = exports.Employee = exports.Absence = exports.Subscription = exports.PrintSize = exports.PLVComponent = exports.QrCodePLVContainer = exports.GenderSelector = exports.ConfirmationDialog = exports.MovaVehicleTireField = exports.MovaCopyright = exports.MovaSignUp = exports.MovaLogin = exports.MovaSnackbar = exports.TestButton = exports.oldRegexPlate = exports.regexPlate = exports.VehiclePlateField = exports.QRCode = exports.MovaDialog = exports.Loader = exports.MovaDigitalPassport = exports.VehicleFullCard = exports.ScheduleFields = exports.AddressFields = exports.AccountValidation = exports.GaragePLV = exports.IbanInput = exports.DialogForgotPassword = exports.UserService = exports.GarageService = exports.AuthenticationService = exports.VehicleService = void 0;
8
+ exports.openDialogPrint = exports.APIMethod = exports.SubscriptionType = exports.SubscriptionState = exports.CountryCode = exports.PrestationState = exports.PrestationType = exports.RegistrationState = exports.SubscriptionPaymentInterval = exports.VehiclePlateType = exports.SlotAlgorithm = exports.OrderState = exports.OrderPreference = exports.ProductType = exports.PartsApplicationType = exports.DateFormatTypes = exports.Gender = exports.DocumentState = exports.DigitalPassportIndex = exports.DocumentType = exports.EventType = exports.EventState = exports.DayOfWeek = exports.MovaAppType = exports.RoleType = exports.CustomerType = exports.API_BASE_URL = exports.request = exports.getLongFormattedDateTime = exports.formatDateByCountryCode = exports.validateEmail = exports.validateText = exports.validatePhoneNumber = exports.getApplicationsShortLabels = exports.isSafariOniOS = exports.getDayOfWeekLabel = exports.findScheduleByDayOfWeek = exports.getFormattedIntervals = exports.getFormattedSchedule = exports.formatPhoneNumber = exports.flexLeftRow = exports.capitalizeFirstLetter = exports.getApplicationShortLabel = exports.isEmpty = exports.formatFrenchVehiclePlate = exports.formatVehicleTire = exports.validateField = exports.deleteCookie = void 0;
9
9
  // Export des services
10
10
  var VehicleService_1 = require("./src/services/VehicleService");
11
11
  Object.defineProperty(exports, "VehicleService", { enumerable: true, get: function () { return __importDefault(VehicleService_1).default; } });
@@ -40,6 +40,8 @@ var QRCode_1 = require("./src/QRCode");
40
40
  Object.defineProperty(exports, "QRCode", { enumerable: true, get: function () { return __importDefault(QRCode_1).default; } });
41
41
  var VehiclePlateField_1 = require("./src/VehiclePlateField");
42
42
  Object.defineProperty(exports, "VehiclePlateField", { enumerable: true, get: function () { return __importDefault(VehiclePlateField_1).default; } });
43
+ Object.defineProperty(exports, "regexPlate", { enumerable: true, get: function () { return VehiclePlateField_1.regexPlate; } });
44
+ Object.defineProperty(exports, "oldRegexPlate", { enumerable: true, get: function () { return VehiclePlateField_1.oldRegexPlate; } });
43
45
  var TestButton_1 = require("./src/TestButton");
44
46
  Object.defineProperty(exports, "TestButton", { enumerable: true, get: function () { return __importDefault(TestButton_1).default; } });
45
47
  var MovaSnackbar_1 = require("./src/MovaSnackbar");
@@ -92,6 +94,8 @@ var Document_1 = require("./src/models/Document");
92
94
  Object.defineProperty(exports, "Document", { enumerable: true, get: function () { return __importDefault(Document_1).default; } });
93
95
  var Garage_1 = require("./src/models/Garage");
94
96
  Object.defineProperty(exports, "Garage", { enumerable: true, get: function () { return __importDefault(Garage_1).default; } });
97
+ var VehicleGarage_1 = require("./src/models/VehicleGarage");
98
+ Object.defineProperty(exports, "VehicleGarage", { enumerable: true, get: function () { return __importDefault(VehicleGarage_1).default; } });
95
99
  var Schedule_1 = require("./src/models/Schedule");
96
100
  Object.defineProperty(exports, "Schedule", { enumerable: true, get: function () { return __importDefault(Schedule_1).default; } });
97
101
  var Event_1 = require("./src/models/Event");
@@ -2,5 +2,7 @@ import { FunctionComponent } from 'react';
2
2
  interface VehiclePlateFieldProps {
3
3
  onValidVehiclePlate: (vehiclePlate: string) => void;
4
4
  }
5
+ export declare const regexPlate: RegExp;
6
+ export declare const oldRegexPlate: RegExp;
5
7
  declare const VehiclePlateField: FunctionComponent<VehiclePlateFieldProps>;
6
8
  export default VehiclePlateField;
@@ -14,6 +14,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
14
14
  return (mod && mod.__esModule) ? mod : { "default": mod };
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.oldRegexPlate = exports.regexPlate = void 0;
17
18
  var jsx_runtime_1 = require("react/jsx-runtime");
18
19
  var react_1 = require("react");
19
20
  var TextField_1 = __importDefault(require("@mui/material/TextField"));
@@ -22,9 +23,9 @@ var Logger_1 = __importDefault(require("./helpers/Logger"));
22
23
  var material_1 = require("@mui/material");
23
24
  var SearchRounded_1 = __importDefault(require("@mui/icons-material/SearchRounded"));
24
25
  // Regex pour une plaque d'immatriculation française (nouveau format SIV)
25
- var regex = /^[A-Z]{2}-\d{3}-[A-Z]{2}$/;
26
+ exports.regexPlate = /^[A-Z]{2}-\d{3}-[A-Z]{2}$/;
26
27
  // Regex pour une plaque d'immatriculation française (ancien format FNI)
27
- var oldRegex = /^\d{1,4}[ -]?[A-Z]{1,4}[ -]?\d{1,4}$/;
28
+ exports.oldRegexPlate = /^\d{1,4}[ -]?[A-Z]{1,4}[ -]?\d{1,4}$/;
28
29
  var VehiclePlateField = function (_a) {
29
30
  var onValidVehiclePlate = _a.onValidVehiclePlate;
30
31
  var _b = (0, react_1.useState)(''), value = _b[0], setValue = _b[1];
@@ -33,7 +34,7 @@ var VehiclePlateField = function (_a) {
33
34
  var _e = (0, react_1.useState)(''), helperText = _e[0], setHelperText = _e[1];
34
35
  // Hook de validation de la plaque
35
36
  (0, react_1.useEffect)(function () {
36
- if (!error && value !== '' && value.match(regex)) {
37
+ if (!error && value !== '' && value.match(exports.regexPlate)) {
37
38
  onValidVehiclePlate(value);
38
39
  }
39
40
  }, [error, value, onValidVehiclePlate]);
@@ -77,10 +78,10 @@ var VehiclePlateField = function (_a) {
77
78
  }
78
79
  };
79
80
  var validatePlate = function () {
80
- if (oldRegex.test(value)) {
81
+ if (exports.oldRegexPlate.test(value)) {
81
82
  onValidVehiclePlate(value);
82
83
  }
83
- setError(!oldRegex.test(value));
84
+ setError(!exports.oldRegexPlate.test(value));
84
85
  };
85
86
  var handleChangeFrenchOld = function (inputValue) {
86
87
  // ON bloque la saisie à 12 caractères max (limite des anciennes plaques)
@@ -104,7 +105,7 @@ var VehiclePlateField = function (_a) {
104
105
  setValue(inputValue);
105
106
  // On teste la plaque une fois la saisie terminée
106
107
  if (inputValue.length == 9) {
107
- setError(!regex.test(inputValue));
108
+ setError(!exports.regexPlate.test(inputValue));
108
109
  }
109
110
  else {
110
111
  setError(false);
@@ -60,6 +60,8 @@ export default class Event {
60
60
  repairOrderNumber?: number;
61
61
  orderComment?: string;
62
62
  vehicleReceived?: boolean;
63
- 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);
63
+ garageVehicleId?: number;
64
+ garageVehicleRequest?: boolean;
65
+ 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);
64
66
  static getPrestationsList(event: Event): string[];
65
67
  }
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  var Event = /** @class */ (function () {
4
- function Event(id, ownerId, type, title, garageName, garageId, color, state, garageAddress, start, end, prestations, operations, products, guestsId, vehicleId, quoteId, notes, vehicleAvailableNotified, editable, resourceId) {
4
+ function Event(id, ownerId, type, title, garageName, garageId, color, state, garageAddress, start, end, prestations, operations, products, guestsId, vehicleId, quoteId, notes, vehicleAvailableNotified, editable, resourceId, garageVehicleId, garageVehicleRequest) {
5
5
  this.id = id;
6
6
  this.notes = notes;
7
7
  this.ownerId = ownerId;
@@ -23,6 +23,8 @@ var Event = /** @class */ (function () {
23
23
  this.editable = editable;
24
24
  this.resourceId = resourceId;
25
25
  this.color = color;
26
+ this.garageVehicleId = garageVehicleId;
27
+ this.garageVehicleRequest = garageVehicleRequest;
26
28
  }
27
29
  Event.getPrestationsList = function (event) {
28
30
  if (event && event.prestations) {
@@ -8,6 +8,7 @@ import User from "./User";
8
8
  import Subscription from "./Subscription";
9
9
  import Employee from "./Employee";
10
10
  import CategoryPrestation from "./CategoryPrestation";
11
+ import VehicleGarage from "./VehicleGarage";
11
12
  export default class Garage {
12
13
  id: string;
13
14
  adminId: string;
@@ -18,6 +19,7 @@ export default class Garage {
18
19
  prestationCategories: CategoryPrestation[];
19
20
  prestations: Prestation[];
20
21
  schedules: Schedule[];
22
+ vehicles?: VehicleGarage[];
21
23
  countryCode?: string;
22
24
  contactEmail?: string;
23
25
  admin?: User;
@@ -43,5 +45,7 @@ export default class Garage {
43
45
  operatorsActive?: boolean;
44
46
  employees?: Employee[];
45
47
  defaultView?: string;
46
- constructor(id: string, adminId: string, name: string, address: Address, workforce: number, prestations: Prestation[], schedules: Schedule[], contactPhone: string, prestationCategories: CategoryPrestation[], contactEmail?: string, logo?: string, suppliers?: Supplier[], documents?: Document[], subscriptions?: Subscription[]);
48
+ loanerVehicleActive?: boolean;
49
+ loanerVehicleRequestActive?: boolean;
50
+ constructor(id: string, adminId: string, name: string, address: Address, workforce: number, prestations: Prestation[], schedules: Schedule[], contactPhone: string, prestationCategories: CategoryPrestation[], vehicles?: VehicleGarage[], contactEmail?: string, logo?: string, suppliers?: Supplier[], documents?: Document[], subscriptions?: Subscription[], loanerVehicleActive?: boolean, loanerVehicleRequestActive?: boolean);
47
51
  }
@@ -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, contactEmail, logo, suppliers, documents, subscriptions) {
4
+ function Garage(id, adminId, name, address, workforce, prestations, schedules, contactPhone, prestationCategories, vehicles, contactEmail, logo, suppliers, documents, subscriptions, loanerVehicleActive, loanerVehicleRequestActive) {
5
5
  this.id = id;
6
6
  this.adminId = adminId;
7
7
  this.name = name;
@@ -16,6 +16,9 @@ var Garage = /** @class */ (function () {
16
16
  this.suppliers = suppliers;
17
17
  this.documents = documents;
18
18
  this.subscriptions = subscriptions;
19
+ this.vehicles = vehicles;
20
+ this.loanerVehicleActive = loanerVehicleActive;
21
+ this.loanerVehicleRequestActive = loanerVehicleRequestActive;
19
22
  }
20
23
  return Garage;
21
24
  }());
@@ -0,0 +1,9 @@
1
+ import Vehicle from "./Vehicle";
2
+ export default class VehicleGarage {
3
+ id: number;
4
+ index: number;
5
+ color: string;
6
+ type: string;
7
+ vehicle: Vehicle;
8
+ constructor(id: number, index: number, color: string, type: string, vehicle: Vehicle);
9
+ }
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var VehicleGarage = /** @class */ (function () {
4
+ function VehicleGarage(id, index, color, type, vehicle) {
5
+ this.id = id;
6
+ this.index = index;
7
+ this.color = color;
8
+ this.type = type;
9
+ this.vehicle = vehicle;
10
+ }
11
+ return VehicleGarage;
12
+ }());
13
+ exports.default = VehicleGarage;
@@ -45,4 +45,20 @@ export default class GarageService {
45
45
  }): Promise<APIResponse<string>>;
46
46
  static addCustomerVehicle({ garageId, customerId, ...payload }: AddCustomerVehicleParams): Promise<APIResponse<string>>;
47
47
  static deleteCustomerVehicle({ garageId, customerId, vehicleId }: DeleteCustomerVehicleParams): Promise<APIResponse<string>>;
48
+ static toogleGarageLoanerVehicleRequest(garageId: string, req: any): Promise<APIResponse<string>>;
49
+ static toogleGarageLoanerVehicle(garageId: string): Promise<APIResponse<string>>;
50
+ static addGarageVehicle({ garageId, req }: {
51
+ garageId: string;
52
+ req: {
53
+ plate: string;
54
+ };
55
+ }): Promise<APIResponse<string>>;
56
+ static deleteGarageVehicle({ garageId, vehicleId }: {
57
+ garageId: string;
58
+ vehicleId: number;
59
+ }): Promise<APIResponse<string>>;
60
+ static getAllGarageVehicles(garageId: string): Promise<APIResponse<any>>;
61
+ static getOneGarageVehicle(garageId: string, vehicleId: number): Promise<APIResponse<any>>;
62
+ static assignGarageVehicleEvent(garageId: string, eventId: string, vehicleId: number): Promise<APIResponse<string>>;
63
+ static deassignGarageVehicleEvent(garageId: string, eventId: string): Promise<APIResponse<string>>;
48
64
  }
@@ -319,6 +319,66 @@ var GarageService = /** @class */ (function () {
319
319
  appType: Enums_1.MovaAppType.GARAGE,
320
320
  });
321
321
  };
322
+ GarageService.toogleGarageLoanerVehicleRequest = function (garageId, req) {
323
+ return (0, ApiHelper_1.request)({
324
+ url: "".concat(ApiHelper_1.API_BASE_URL, "/garage/").concat(garageId, "/settings/loaner-vehicle-request"),
325
+ method: Enums_1.APIMethod.PATCH,
326
+ appType: Enums_1.MovaAppType.GARAGE,
327
+ body: JSON.stringify(req)
328
+ });
329
+ };
330
+ GarageService.toogleGarageLoanerVehicle = function (garageId) {
331
+ return (0, ApiHelper_1.request)({
332
+ url: "".concat(ApiHelper_1.API_BASE_URL, "/garage/").concat(garageId, "/settings/loaner-vehicle"),
333
+ method: Enums_1.APIMethod.PATCH,
334
+ appType: Enums_1.MovaAppType.GARAGE,
335
+ });
336
+ };
337
+ GarageService.addGarageVehicle = function (_a) {
338
+ var garageId = _a.garageId, req = _a.req;
339
+ return (0, ApiHelper_1.request)({
340
+ url: "".concat(ApiHelper_1.API_BASE_URL, "/garage/").concat(garageId, "/vehicle"),
341
+ method: Enums_1.APIMethod.POST,
342
+ appType: Enums_1.MovaAppType.GARAGE,
343
+ body: JSON.stringify(req)
344
+ });
345
+ };
346
+ GarageService.deleteGarageVehicle = function (_a) {
347
+ var garageId = _a.garageId, vehicleId = _a.vehicleId;
348
+ return (0, ApiHelper_1.request)({
349
+ url: "".concat(ApiHelper_1.API_BASE_URL, "/garage/").concat(garageId, "/vehicle/").concat(vehicleId),
350
+ method: Enums_1.APIMethod.DELETE,
351
+ appType: Enums_1.MovaAppType.GARAGE
352
+ });
353
+ };
354
+ GarageService.getAllGarageVehicles = function (garageId) {
355
+ return (0, ApiHelper_1.request)({
356
+ url: "".concat(ApiHelper_1.API_BASE_URL, "/garage/").concat(garageId, "/vehicles"),
357
+ method: Enums_1.APIMethod.GET,
358
+ appType: Enums_1.MovaAppType.GARAGE
359
+ });
360
+ };
361
+ GarageService.getOneGarageVehicle = function (garageId, vehicleId) {
362
+ return (0, ApiHelper_1.request)({
363
+ url: "".concat(ApiHelper_1.API_BASE_URL, "/garage/").concat(garageId, "/vehicle/").concat(vehicleId),
364
+ method: Enums_1.APIMethod.GET,
365
+ appType: Enums_1.MovaAppType.GARAGE
366
+ });
367
+ };
368
+ GarageService.assignGarageVehicleEvent = function (garageId, eventId, vehicleId) {
369
+ return (0, ApiHelper_1.request)({
370
+ url: "".concat(ApiHelper_1.API_BASE_URL, "/garage/").concat(garageId, "/event/").concat(eventId, "/vehicles/").concat(vehicleId),
371
+ method: Enums_1.APIMethod.PATCH,
372
+ appType: Enums_1.MovaAppType.GARAGE
373
+ });
374
+ };
375
+ GarageService.deassignGarageVehicleEvent = function (garageId, eventId) {
376
+ return (0, ApiHelper_1.request)({
377
+ url: "".concat(ApiHelper_1.API_BASE_URL, "/garage/").concat(garageId, "/event/").concat(eventId, "/vehicles"),
378
+ method: Enums_1.APIMethod.DELETE,
379
+ appType: Enums_1.MovaAppType.GARAGE
380
+ });
381
+ };
322
382
  return GarageService;
323
383
  }());
324
384
  exports.default = GarageService;
package/index.ts CHANGED
@@ -19,7 +19,7 @@ export { default as MovaDigitalPassport } from './src/MovaDigitalPassport';
19
19
  export { default as Loader } from './src/Loader';
20
20
  export { default as MovaDialog } from './src/MovaDialog';
21
21
  export { default as QRCode } from './src/QRCode';
22
- export { default as VehiclePlateField } from './src/VehiclePlateField';
22
+ export { default as VehiclePlateField, regexPlate, oldRegexPlate } from './src/VehiclePlateField';
23
23
  export { default as TestButton } from './src/TestButton';
24
24
  export { default as MovaSnackbar } from './src/MovaSnackbar';
25
25
  export { default as MovaLogin } from './src/MovaLogin';
@@ -46,6 +46,7 @@ export { default as Address } from './src/models/Address';
46
46
  export { default as Vehicle } from './src/models/Vehicle';
47
47
  export { default as Document } from './src/models/Document';
48
48
  export { default as Garage } from './src/models/Garage';
49
+ export { default as VehicleGarage } from './src/models/VehicleGarage';
49
50
  export { default as Schedule } from './src/models/Schedule';
50
51
  export { default as Event } from './src/models/Event';
51
52
  export { default as VehicleTire } from './src/models/VehicleTire';
package/package.json CHANGED
@@ -1,57 +1,55 @@
1
1
  {
2
- "name": "@movalib/movalib-commons",
3
- "version": "1.59.6",
4
- "description": "Bibliothèque d'objets communs à l'ensemble des projets React de Movalib",
5
- "main": "dist/index.js",
6
- "types": "dist/index.d.ts",
7
- "private": false,
8
- "scripts": {
9
- "start": "webpack-dev-server --entry ./devIndex.tsx --open --https",
10
- "build": "rm -rf dist && tsc && npm run copy-assets",
11
- "copy-assets": "cp -r src/assets/ dist/src/assets/ && cp -r src/style/ dist/src/style/",
12
- "test": "echo \"Error: no test specified\" && exit 1",
13
- "clean": "rm -rf dist node_modules package-lock.json"
14
- },
15
- "keywords": [],
16
- "author": "",
17
- "license": "ISC",
18
- "dependencies": {
19
- "@emotion/react": "^11.11.1",
20
- "@emotion/styled": "^11.11.0",
21
- "@mui/icons-material": "^5.11.17",
22
- "@mui/lab": "^5.0.0-alpha.134",
23
- "@mui/material": "^5.13.5",
24
- "@mui/x-date-pickers": "^6.9.1",
25
- "@types/react": "^18.2.22",
26
- "@types/react-dom": "^18.2.7",
27
- "@types/react-router-dom": "^5.3.0",
28
- "date-fns": "^2.29.3",
29
- "date-fns-tz": "^2.0.0",
30
- "file-loader": "^6.2.0",
31
- "html2canvas": "^1.4.1",
32
- "js-cookie": "^3.0.5",
33
- "pdf-lib": "^1.17.1",
34
- "pdfjs-dist": "^4.6.82",
35
- "qr-code-styling": "^1.4.4",
36
- "react": "^18.2.0",
37
- "react-dom": "^18.2.0",
38
- "react-input-mask": "^2.0.4",
39
- "react-router-dom": "^5.1.2",
40
- "react-scripts": "5.0.1",
41
- "react-to-print": "^2.14.15",
42
- "typescript": "^4.9.5"
43
- },
44
- "eslintConfig": {
45
- "extends": [
46
- "react-app"
47
- ]
48
- },
49
- "devDependencies": {
50
- "@types/js-cookie": "^3.0.4",
51
- "@types/pdfjs-dist": "^2.10.377",
52
- "@types/react-input-mask": "^3.0.5",
53
- "html-webpack-plugin": "^5.5.3",
54
- "ts-loader": "^9.4.4",
55
- "webpack-cli": "^5.1.4"
56
- }
2
+ "name": "@movalib/movalib-commons",
3
+ "version": "1.59.7",
4
+ "description": "Bibliothèque d'objets communs à l'ensemble des projets React de Movalib",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "private": false,
8
+ "scripts": {
9
+ "start": "webpack-dev-server --entry ./devIndex.tsx --open --https",
10
+ "build": "rm -rf dist && tsc && npm run copy-assets",
11
+ "copy-assets": "cp -r src/assets/ dist/src/assets/ && cp -r src/style/ dist/src/style/",
12
+ "test": "echo \"Error: no test specified\" && exit 1",
13
+ "clean": "rm -rf dist node_modules package-lock.json"
14
+ },
15
+ "keywords": [],
16
+ "author": "",
17
+ "license": "ISC",
18
+ "dependencies": {
19
+ "@emotion/react": "^11.11.1",
20
+ "@emotion/styled": "^11.11.0",
21
+ "@mui/icons-material": "^5.11.17",
22
+ "@mui/lab": "^5.0.0-alpha.134",
23
+ "@mui/material": "^5.13.5",
24
+ "@mui/x-date-pickers": "^6.9.1",
25
+ "@types/react": "^18.2.22",
26
+ "@types/react-dom": "^18.2.7",
27
+ "@types/react-router-dom": "^5.3.0",
28
+ "date-fns": "^2.29.3",
29
+ "date-fns-tz": "^2.0.0",
30
+ "file-loader": "^6.2.0",
31
+ "html2canvas": "^1.4.1",
32
+ "js-cookie": "^3.0.5",
33
+ "pdf-lib": "^1.17.1",
34
+ "pdfjs-dist": "^4.6.82",
35
+ "qr-code-styling": "^1.4.4",
36
+ "react": "^18.2.0",
37
+ "react-dom": "^18.2.0",
38
+ "react-input-mask": "^2.0.4",
39
+ "react-router-dom": "^5.1.2",
40
+ "react-scripts": "5.0.1",
41
+ "react-to-print": "^2.14.15",
42
+ "typescript": "^4.9.5"
43
+ },
44
+ "eslintConfig": {
45
+ "extends": ["react-app"]
46
+ },
47
+ "devDependencies": {
48
+ "@types/js-cookie": "^3.0.4",
49
+ "@types/pdfjs-dist": "^2.10.377",
50
+ "@types/react-input-mask": "^3.0.5",
51
+ "html-webpack-plugin": "^5.5.3",
52
+ "ts-loader": "^9.4.4",
53
+ "webpack-cli": "^5.1.4"
54
+ }
57
55
  }
@@ -10,9 +10,9 @@ interface VehiclePlateFieldProps {
10
10
  }
11
11
 
12
12
  // Regex pour une plaque d'immatriculation française (nouveau format SIV)
13
- const regex = /^[A-Z]{2}-\d{3}-[A-Z]{2}$/;
13
+ export const regexPlate = /^[A-Z]{2}-\d{3}-[A-Z]{2}$/;
14
14
  // Regex pour une plaque d'immatriculation française (ancien format FNI)
15
- const oldRegex = /^\d{1,4}[ -]?[A-Z]{1,4}[ -]?\d{1,4}$/;
15
+ export const oldRegexPlate = /^\d{1,4}[ -]?[A-Z]{1,4}[ -]?\d{1,4}$/;
16
16
 
17
17
 
18
18
  const VehiclePlateField: FunctionComponent<VehiclePlateFieldProps> = ({ onValidVehiclePlate }) => {
@@ -24,7 +24,7 @@ const VehiclePlateField: FunctionComponent<VehiclePlateFieldProps> = ({ onValidV
24
24
 
25
25
  // Hook de validation de la plaque
26
26
  useEffect(() => {
27
- if (!error && value !== '' && value.match(regex)) {
27
+ if (!error && value !== '' && value.match(regexPlate)) {
28
28
  onValidVehiclePlate(value);
29
29
  }
30
30
 
@@ -78,11 +78,11 @@ const VehiclePlateField: FunctionComponent<VehiclePlateFieldProps> = ({ onValidV
78
78
 
79
79
  const validatePlate = () => {
80
80
 
81
- if(oldRegex.test(value)){
81
+ if(oldRegexPlate.test(value)){
82
82
  onValidVehiclePlate(value);
83
83
  }
84
84
 
85
- setError(!oldRegex.test(value));
85
+ setError(!oldRegexPlate.test(value));
86
86
  }
87
87
 
88
88
  const handleChangeFrenchOld = (inputValue: string) => {
@@ -116,7 +116,7 @@ const VehiclePlateField: FunctionComponent<VehiclePlateFieldProps> = ({ onValidV
116
116
 
117
117
  // On teste la plaque une fois la saisie terminée
118
118
  if(inputValue.length == 9){
119
- setError(!regex.test(inputValue));
119
+ setError(!regexPlate.test(inputValue));
120
120
  } else {
121
121
  setError(false);
122
122
  }
@@ -67,10 +67,13 @@ export default class Event {
67
67
  repairOrderNumber?: number;
68
68
  orderComment?: string;
69
69
  vehicleReceived?: boolean;
70
+ garageVehicleId?: number;
71
+ garageVehicleRequest?: boolean;
70
72
 
71
73
  constructor(id: string, ownerId: number, type : EventType, title: string, garageName: string, garageId: number,color: string,
72
74
  state: EventState, garageAddress?: Address, start?: Date, end?: Date, prestations?: Prestation[], operations?: Operation[], products?: Product[],
73
- guestsId?: string[], vehicleId?: number, quoteId?: number, notes?: string, vehicleAvailableNotified?: boolean, editable?: boolean, resourceId?: number)
75
+ guestsId?: string[], vehicleId?: number, quoteId?: number, notes?: string, vehicleAvailableNotified?: boolean, editable?: boolean,
76
+ resourceId?: number, garageVehicleId?: number, garageVehicleRequest?: boolean)
74
77
  {
75
78
  this.id = id;
76
79
  this.notes = notes;
@@ -93,6 +96,8 @@ export default class Event {
93
96
  this.editable = editable;
94
97
  this.resourceId = resourceId;
95
98
  this.color = color;
99
+ this.garageVehicleId = garageVehicleId;
100
+ this.garageVehicleRequest = garageVehicleRequest;
96
101
  }
97
102
 
98
103
  static getPrestationsList(event: Event) : string[] {
@@ -8,6 +8,7 @@ import User from "./User";
8
8
  import Subscription from "./Subscription";
9
9
  import Employee from "./Employee";
10
10
  import CategoryPrestation from "./CategoryPrestation";
11
+ import VehicleGarage from "./VehicleGarage";
11
12
 
12
13
  export default class Garage {
13
14
 
@@ -20,6 +21,7 @@ export default class Garage {
20
21
  prestationCategories: CategoryPrestation[];
21
22
  prestations: Prestation[];
22
23
  schedules: Schedule[];
24
+ vehicles?: VehicleGarage[];
23
25
  countryCode?: string;
24
26
  contactEmail?: string;
25
27
  admin?: User;
@@ -45,6 +47,8 @@ export default class Garage {
45
47
  operatorsActive?: boolean;
46
48
  employees?: Employee[];
47
49
  defaultView?: string;
50
+ loanerVehicleActive?: boolean;
51
+ loanerVehicleRequestActive?: boolean;
48
52
 
49
53
  constructor(
50
54
  id:string,
@@ -56,11 +60,14 @@ export default class Garage {
56
60
  schedules: Schedule[],
57
61
  contactPhone: string,
58
62
  prestationCategories: CategoryPrestation[],
63
+ vehicles?: VehicleGarage[],
59
64
  contactEmail?: string,
60
65
  logo?:string,
61
66
  suppliers?: Supplier[],
62
67
  documents?: Document[],
63
- subscriptions?: Subscription[]
68
+ subscriptions?: Subscription[],
69
+ loanerVehicleActive?: boolean,
70
+ loanerVehicleRequestActive?: boolean
64
71
  ) {
65
72
  this.id = id;
66
73
  this.adminId = adminId;
@@ -76,5 +83,8 @@ export default class Garage {
76
83
  this.suppliers = suppliers;
77
84
  this.documents = documents;
78
85
  this.subscriptions = subscriptions;
86
+ this.vehicles = vehicles;
87
+ this.loanerVehicleActive = loanerVehicleActive;
88
+ this.loanerVehicleRequestActive = loanerVehicleRequestActive;
79
89
  }
80
90
  }
@@ -0,0 +1,20 @@
1
+ import { DigitalPassportIndex } from "../helpers/Enums";
2
+ import Vehicle from "./Vehicle";
3
+ import VehicleTire from "./VehicleTire";
4
+ import Document from './Document';
5
+
6
+ export default class VehicleGarage {
7
+ id: number;
8
+ index: number;
9
+ color: string;
10
+ type: string;
11
+ vehicle: Vehicle
12
+
13
+ constructor( id: number,index: number, color: string, type: string, vehicle: Vehicle) {
14
+ this.id = id;
15
+ this.index = index;
16
+ this.color = color;
17
+ this.type = type;
18
+ this.vehicle = vehicle;
19
+ }
20
+ }
@@ -350,4 +350,69 @@ export default class GarageService {
350
350
  })
351
351
  }
352
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,
367
+ });
368
+ }
369
+
370
+ static addGarageVehicle({garageId, req} :{garageId: string, req: {plate: string}}): Promise<APIResponse<string>> {
371
+ return request({
372
+ url: `${API_BASE_URL}/garage/${garageId}/vehicle`,
373
+ method: APIMethod.POST,
374
+ 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
+ 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
+ }
353
418
  }