@movalib/movalib-commons 1.1.69 → 1.1.71

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
@@ -20,6 +20,8 @@ export { default as MovaCopyright } from './src/MovaCopyright';
20
20
  export { default as MovaVehicleTireField } from './src/MovaVehicleTireField';
21
21
  export { default as ConfirmationDialog } from './src/ConfirmationDialog';
22
22
  export { default as GenderSelector } from './src/GenderSelector';
23
+ export { default as Absence } from './src/models/Absence';
24
+ export { default as Employee } from './src/models/Employee';
23
25
  export { default as Supplier } from './src/models/Supplier';
24
26
  export { default as Product } from './src/models/Product';
25
27
  export { default as Prestation } from './src/models/Prestation';
@@ -43,4 +45,4 @@ export { validateField, formatVehicleTire, formatFrenchVehiclePlate, isEmpty, ge
43
45
  export { validatePhoneNumber, validateText, validateEmail } from './src/helpers/Validator';
44
46
  export { formatDateByCountryCode, getLongFormattedDateTime } from './src/helpers/DateUtils';
45
47
  export { request } from './src/helpers/ApiHelper';
46
- export { RoleType, MovaAppType, DayOfWeek, EventState, EventType, DocumentType, DigitalPassportIndex, DocumentState, Gender, DateFormatTypes, PartsApplicationType, ProductType, OrderPreference, OrderState, SlotAlgorithm, VehiclePlateFormat as VehiclePlateType, SubscriptionPaymentInterval, RegistrationState } from './src/helpers/Enums';
48
+ export { RoleType, MovaAppType, DayOfWeek, EventState, EventType, DocumentType, DigitalPassportIndex, DocumentState, Gender, DateFormatTypes, PartsApplicationType, ProductType, OrderPreference, OrderState, SlotAlgorithm, VehiclePlateFormat as VehiclePlateType, SubscriptionPaymentInterval, RegistrationState, PrestationType } from './src/helpers/Enums';
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.findScheduleByDayOfWeek = exports.getFormattedIntervals = exports.getFormattedSchedule = exports.formatPhoneNumber = exports.flexLeftRow = exports.capitalizeFirstLetter = exports.getApplicationShortLabel = exports.isEmpty = exports.formatFrenchVehiclePlate = exports.formatVehicleTire = exports.validateField = exports.deleteCookie = exports.readCookie = 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.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.UserService = exports.GarageService = exports.AuthenticationService = void 0;
8
- 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.request = exports.getLongFormattedDateTime = exports.formatDateByCountryCode = exports.validateEmail = exports.validateText = exports.validatePhoneNumber = void 0;
7
+ exports.getFormattedSchedule = exports.formatPhoneNumber = exports.flexLeftRow = exports.capitalizeFirstLetter = exports.getApplicationShortLabel = exports.isEmpty = exports.formatFrenchVehiclePlate = exports.formatVehicleTire = exports.validateField = exports.deleteCookie = exports.readCookie = 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.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.UserService = exports.GarageService = exports.AuthenticationService = void 0;
8
+ 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.request = exports.getLongFormattedDateTime = exports.formatDateByCountryCode = exports.validateEmail = exports.validateText = exports.validatePhoneNumber = exports.findScheduleByDayOfWeek = exports.getFormattedIntervals = void 0;
9
9
  // Export des services
10
10
  var AuthenticationService_1 = require("./src/services/AuthenticationService");
11
11
  Object.defineProperty(exports, "AuthenticationService", { enumerable: true, get: function () { return __importDefault(AuthenticationService_1).default; } });
@@ -53,6 +53,10 @@ Object.defineProperty(exports, "ConfirmationDialog", { enumerable: true, get: fu
53
53
  var GenderSelector_1 = require("./src/GenderSelector");
54
54
  Object.defineProperty(exports, "GenderSelector", { enumerable: true, get: function () { return __importDefault(GenderSelector_1).default; } });
55
55
  // Export des classes
56
+ var Absence_1 = require("./src/models/Absence");
57
+ Object.defineProperty(exports, "Absence", { enumerable: true, get: function () { return __importDefault(Absence_1).default; } });
58
+ var Employee_1 = require("./src/models/Employee");
59
+ Object.defineProperty(exports, "Employee", { enumerable: true, get: function () { return __importDefault(Employee_1).default; } });
56
60
  var Supplier_1 = require("./src/models/Supplier");
57
61
  Object.defineProperty(exports, "Supplier", { enumerable: true, get: function () { return __importDefault(Supplier_1).default; } });
58
62
  var Product_1 = require("./src/models/Product");
@@ -128,3 +132,4 @@ Object.defineProperty(exports, "SlotAlgorithm", { enumerable: true, get: functio
128
132
  Object.defineProperty(exports, "VehiclePlateType", { enumerable: true, get: function () { return Enums_1.VehiclePlateFormat; } });
129
133
  Object.defineProperty(exports, "SubscriptionPaymentInterval", { enumerable: true, get: function () { return Enums_1.SubscriptionPaymentInterval; } });
130
134
  Object.defineProperty(exports, "RegistrationState", { enumerable: true, get: function () { return Enums_1.RegistrationState; } });
135
+ Object.defineProperty(exports, "PrestationType", { enumerable: true, get: function () { return Enums_1.PrestationType; } });
@@ -4,7 +4,7 @@ interface AccountValidationProps {
4
4
  movaAppType: MovaAppType;
5
5
  smsValidation: boolean;
6
6
  onSubmit: (success: boolean, message: string) => void;
7
- onResendSecurityCode: (success: boolean, message: string) => void;
7
+ onResendSecurityCode?: (success: boolean, message: string) => void;
8
8
  }
9
9
  declare const AccountValidation: FunctionComponent<AccountValidationProps>;
10
10
  export default AccountValidation;
@@ -166,7 +166,7 @@ var AccountValidation = function (_a) {
166
166
  };
167
167
  var resendCode = function () {
168
168
  var _a;
169
- if (controlPhoneNumber()) {
169
+ if (controlPhoneNumber() && onResendSecurityCode) {
170
170
  var req = {
171
171
  phoneNumber: (_a = validationForm.phoneNumber) === null || _a === void 0 ? void 0 : _a.value
172
172
  };
@@ -175,16 +175,12 @@ var AccountValidation = function (_a) {
175
175
  var _a, _b;
176
176
  Logger_1.default.info(response);
177
177
  if (response.success) {
178
- if (onResendSecurityCode) {
179
- // Fermeture boite de dialogue
180
- setOpenPhoneNumberInput(false);
181
- onResendSecurityCode(response.success, (_a = response.data) !== null && _a !== void 0 ? _a : '');
182
- }
178
+ // Fermeture boite de dialogue
179
+ setOpenPhoneNumberInput(false);
180
+ onResendSecurityCode(response.success, (_a = response.data) !== null && _a !== void 0 ? _a : '');
183
181
  }
184
182
  else {
185
- if (onResendSecurityCode) {
186
- onResendSecurityCode(response.success, (_b = response.error) !== null && _b !== void 0 ? _b : '');
187
- }
183
+ onResendSecurityCode(response.success, (_b = response.error) !== null && _b !== void 0 ? _b : '');
188
184
  }
189
185
  }).catch(function (error) {
190
186
  Logger_1.default.error(error);
@@ -1,3 +1,25 @@
1
+ export declare enum PrestationType {
2
+ /**
3
+ * Services courants, mécanique légère : vidange, entretien, pneumatiques
4
+ */
5
+ SIMPLE_MAINTENANCE = "SIMPLE_MAINTENANCE",
6
+ /**
7
+ * Services lours, mécanique plus invasive : moteur, distribution, liaison au sol etc...
8
+ */
9
+ HEAVY_SERVICES = "HEAVY_SERVICES",
10
+ /**
11
+ * Recherche de panne, diagnostique électronique
12
+ */
13
+ ELECTRONIC = "ELECTRONIC",
14
+ /**
15
+ * Carrosserie et peinture
16
+ */
17
+ BODYWORK = "BODYWORK",
18
+ /**
19
+ * Pour les prestations qui ne rentrent dans aucune des catégories précédentes
20
+ */
21
+ OTHER = "OTHER"
22
+ }
1
23
  export declare enum SubscriptionPaymentInterval {
2
24
  /**
3
25
  * Paiement Mensuel
@@ -1,6 +1,29 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RoleType = exports.MovaAppType = exports.DocumentType = exports.DocumentState = exports.DayOfWeek = exports.EventType = exports.EventState = exports.DigitalPassportIndex = exports.Gender = exports.DateFormatTypes = exports.APIMethod = exports.PartsApplicationType = exports.ProductType = exports.OrderPreference = exports.OrderState = exports.SlotAlgorithm = exports.VehiclePlateFormat = exports.RegistrationState = exports.SubscriptionPaymentInterval = void 0;
3
+ exports.RoleType = exports.MovaAppType = exports.DocumentType = exports.DocumentState = exports.DayOfWeek = exports.EventType = exports.EventState = exports.DigitalPassportIndex = exports.Gender = exports.DateFormatTypes = exports.APIMethod = exports.PartsApplicationType = exports.ProductType = exports.OrderPreference = exports.OrderState = exports.SlotAlgorithm = exports.VehiclePlateFormat = exports.RegistrationState = exports.SubscriptionPaymentInterval = exports.PrestationType = void 0;
4
+ var PrestationType;
5
+ (function (PrestationType) {
6
+ /**
7
+ * Services courants, mécanique légère : vidange, entretien, pneumatiques
8
+ */
9
+ PrestationType["SIMPLE_MAINTENANCE"] = "SIMPLE_MAINTENANCE";
10
+ /**
11
+ * Services lours, mécanique plus invasive : moteur, distribution, liaison au sol etc...
12
+ */
13
+ PrestationType["HEAVY_SERVICES"] = "HEAVY_SERVICES";
14
+ /**
15
+ * Recherche de panne, diagnostique électronique
16
+ */
17
+ PrestationType["ELECTRONIC"] = "ELECTRONIC";
18
+ /**
19
+ * Carrosserie et peinture
20
+ */
21
+ PrestationType["BODYWORK"] = "BODYWORK";
22
+ /**
23
+ * Pour les prestations qui ne rentrent dans aucune des catégories précédentes
24
+ */
25
+ PrestationType["OTHER"] = "OTHER";
26
+ })(PrestationType = exports.PrestationType || (exports.PrestationType = {}));
4
27
  var SubscriptionPaymentInterval;
5
28
  (function (SubscriptionPaymentInterval) {
6
29
  /**
@@ -0,0 +1,8 @@
1
+ import Employee from "./Employee";
2
+ export default class Absence {
3
+ id: string;
4
+ employee: Employee;
5
+ start: Date;
6
+ end: Date;
7
+ constructor(id: string, employee: Employee, start: Date, end: Date);
8
+ }
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var Absence = /** @class */ (function () {
4
+ function Absence(id, employee, start, end) {
5
+ this.id = id;
6
+ this.employee = employee;
7
+ this.start = start;
8
+ this.end = end;
9
+ }
10
+ return Absence;
11
+ }());
12
+ exports.default = Absence;
@@ -0,0 +1,11 @@
1
+ import { PrestationType } from "../helpers/Enums";
2
+ import Absence from "./Absence";
3
+ import Role from "./Role";
4
+ import Schedule from "./Schedule";
5
+ import User from "./User";
6
+ export default class Employee extends User {
7
+ absences: Absence[];
8
+ prestationTypes: PrestationType[];
9
+ schedules: Schedule[];
10
+ constructor(id: string, roles: Role[] | undefined, firstname: string | undefined, lastname: string | undefined, avatar: string | undefined, absences: Absence[], prestationTypes?: PrestationType[], schedules?: Schedule[]);
11
+ }
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ var __importDefault = (this && this.__importDefault) || function (mod) {
18
+ return (mod && mod.__esModule) ? mod : { "default": mod };
19
+ };
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ var User_1 = __importDefault(require("./User"));
22
+ var Employee = /** @class */ (function (_super) {
23
+ __extends(Employee, _super);
24
+ function Employee(id, roles, firstname, lastname, avatar, absences, prestationTypes, schedules) {
25
+ if (roles === void 0) { roles = []; }
26
+ if (firstname === void 0) { firstname = ''; }
27
+ if (lastname === void 0) { lastname = ''; }
28
+ if (avatar === void 0) { avatar = ''; }
29
+ if (prestationTypes === void 0) { prestationTypes = []; }
30
+ if (schedules === void 0) { schedules = []; }
31
+ var _this = _super.call(this, id, roles, firstname, lastname, avatar) || this;
32
+ _this.absences = absences;
33
+ _this.prestationTypes = prestationTypes;
34
+ _this.schedules = schedules;
35
+ return _this;
36
+ }
37
+ return Employee;
38
+ }(User_1.default));
39
+ exports.default = Employee;
@@ -29,5 +29,6 @@ export default class Garage {
29
29
  subscriptionIban?: string;
30
30
  subscriptionPaymentInterval?: SubscriptionPaymentInterval;
31
31
  creationDate?: Date;
32
+ teamManagementActive?: boolean;
32
33
  constructor(id: string, adminId: string, name: string, address: Address, workforce: number, prestations: Prestation[], schedules: Schedule[], contactPhone: string, contactEmail?: string, logo?: string, suppliers?: Supplier[]);
33
34
  }
@@ -8,15 +8,15 @@ export default class User {
8
8
  firstname: string;
9
9
  lastname: string;
10
10
  avatar: string;
11
- email: string;
12
11
  password: string;
13
12
  created: Date;
13
+ email?: string;
14
14
  gender?: Gender;
15
15
  birthDate?: Date;
16
16
  addresses?: Address[];
17
17
  phoneNumber?: string;
18
18
  vehicles?: Vehicle[];
19
- constructor(id: string, roles: Role[], firstname?: string, lastname?: string, avatar?: string, email?: string, password?: string, created?: Date, gender?: Gender, birthDate?: Date, addresses?: Address[], phoneNumber?: string, vehicles?: Vehicle[]);
19
+ constructor(id: string, roles: Role[], firstname?: string, lastname?: string, avatar?: string, password?: string, created?: Date, email?: string, gender?: Gender, birthDate?: Date, addresses?: Address[], phoneNumber?: string, vehicles?: Vehicle[]);
20
20
  static getFirstLetter: (user: User) => string;
21
21
  static isGarageCustomer: (user: User) => boolean;
22
22
  static isGarageTechnician: (user: User) => boolean;
@@ -2,11 +2,10 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  var Enums_1 = require("../helpers/Enums");
4
4
  var User = /** @class */ (function () {
5
- function User(id, roles, firstname, lastname, avatar, email, password, created, gender, birthDate, addresses, phoneNumber, vehicles) {
5
+ function User(id, roles, firstname, lastname, avatar, password, created, email, gender, birthDate, addresses, phoneNumber, vehicles) {
6
6
  if (firstname === void 0) { firstname = ''; }
7
7
  if (lastname === void 0) { lastname = ''; }
8
8
  if (avatar === void 0) { avatar = ''; }
9
- if (email === void 0) { email = ''; }
10
9
  if (password === void 0) { password = ''; }
11
10
  if (created === void 0) { created = new Date(); }
12
11
  this.id = id;
@@ -1,6 +1,15 @@
1
1
  import { APIResponse } from "../helpers/ApiHelper";
2
+ import Employee from "../models/Employee";
2
3
  import Garage from "../models/Garage";
3
4
  export default class GarageService {
5
+ static deleteGarageEmployeePrestationType(garageId: string, employeeId: string, req: any): Promise<APIResponse<string>>;
6
+ static createGarageEmployeePrestationType(garageId: string, employeeId: string, req: any): Promise<APIResponse<string>>;
7
+ static deleteGarageEmployeeAbsence(garageId: string, employeeId: string, req: any): Promise<APIResponse<string>>;
8
+ static createGarageEmployeeAbsence(garageId: string, employeeId: string, req: any): Promise<APIResponse<string>>;
9
+ static updateGarageEmployeeSchedules(garageId: string, employeeId: string, req: any): Promise<APIResponse<string>>;
10
+ static deleteGarageEmployee(garageId: string, req: any): Promise<APIResponse<string>>;
11
+ static createGarageEmployee(garageId: string, req: any): Promise<APIResponse<string>>;
12
+ static getEmployees(): Promise<APIResponse<Employee[]>>;
4
13
  static activateGarage(garageId: string): Promise<APIResponse<string>>;
5
14
  static salesSignUp(formData: FormData): Promise<APIResponse<number>>;
6
15
  static sendNewEventQuote(garageId: string, eventId: string, formData: FormData): Promise<APIResponse<string>>;
@@ -5,6 +5,69 @@ var Enums_1 = require("../helpers/Enums");
5
5
  var GarageService = /** @class */ (function () {
6
6
  function GarageService() {
7
7
  }
8
+ GarageService.deleteGarageEmployeePrestationType = function (garageId, employeeId, req) {
9
+ return (0, ApiHelper_1.request)({
10
+ url: "".concat(ApiHelper_1.API_BASE_URL, "/garage/").concat(garageId, "/employees/").concat(employeeId, "/prestations-type"),
11
+ method: Enums_1.APIMethod.DELETE,
12
+ appType: Enums_1.MovaAppType.GARAGE,
13
+ body: JSON.stringify(req)
14
+ });
15
+ };
16
+ GarageService.createGarageEmployeePrestationType = function (garageId, employeeId, req) {
17
+ return (0, ApiHelper_1.request)({
18
+ url: "".concat(ApiHelper_1.API_BASE_URL, "/garage/").concat(garageId, "/employees/").concat(employeeId, "/prestations-type"),
19
+ method: Enums_1.APIMethod.POST,
20
+ appType: Enums_1.MovaAppType.GARAGE,
21
+ body: JSON.stringify(req)
22
+ });
23
+ };
24
+ GarageService.deleteGarageEmployeeAbsence = function (garageId, employeeId, req) {
25
+ return (0, ApiHelper_1.request)({
26
+ url: "".concat(ApiHelper_1.API_BASE_URL, "/garage/").concat(garageId, "/employees/").concat(employeeId, "/absences"),
27
+ method: Enums_1.APIMethod.DELETE,
28
+ appType: Enums_1.MovaAppType.GARAGE,
29
+ body: JSON.stringify(req)
30
+ });
31
+ };
32
+ GarageService.createGarageEmployeeAbsence = function (garageId, employeeId, req) {
33
+ return (0, ApiHelper_1.request)({
34
+ url: "".concat(ApiHelper_1.API_BASE_URL, "/garage/").concat(garageId, "/employees/").concat(employeeId, "/absences"),
35
+ method: Enums_1.APIMethod.POST,
36
+ appType: Enums_1.MovaAppType.GARAGE,
37
+ body: JSON.stringify(req)
38
+ });
39
+ };
40
+ GarageService.updateGarageEmployeeSchedules = function (garageId, employeeId, req) {
41
+ return (0, ApiHelper_1.request)({
42
+ url: "".concat(ApiHelper_1.API_BASE_URL, "/garage/").concat(garageId, "/employees/").concat(employeeId, "/schedules"),
43
+ method: Enums_1.APIMethod.PATCH,
44
+ appType: Enums_1.MovaAppType.GARAGE,
45
+ body: JSON.stringify(req)
46
+ });
47
+ };
48
+ GarageService.deleteGarageEmployee = function (garageId, req) {
49
+ return (0, ApiHelper_1.request)({
50
+ url: "".concat(ApiHelper_1.API_BASE_URL, "/garage/").concat(garageId, "/employees"),
51
+ method: Enums_1.APIMethod.DELETE,
52
+ appType: Enums_1.MovaAppType.GARAGE,
53
+ body: JSON.stringify(req)
54
+ });
55
+ };
56
+ GarageService.createGarageEmployee = function (garageId, req) {
57
+ return (0, ApiHelper_1.request)({
58
+ url: "".concat(ApiHelper_1.API_BASE_URL, "/garage/").concat(garageId, "/employees"),
59
+ method: Enums_1.APIMethod.POST,
60
+ appType: Enums_1.MovaAppType.GARAGE,
61
+ body: JSON.stringify(req)
62
+ });
63
+ };
64
+ GarageService.getEmployees = function () {
65
+ return (0, ApiHelper_1.request)({
66
+ url: "".concat(ApiHelper_1.API_BASE_URL, "/user/employees"),
67
+ method: Enums_1.APIMethod.GET,
68
+ appType: Enums_1.MovaAppType.GARAGE
69
+ });
70
+ };
8
71
  GarageService.activateGarage = function (garageId) {
9
72
  return (0, ApiHelper_1.request)({
10
73
  url: "".concat(ApiHelper_1.API_BASE_URL, "/garage/").concat(garageId, "/activate"),
package/index.ts CHANGED
@@ -27,6 +27,8 @@ export { default as ConfirmationDialog } from './src/ConfirmationDialog';
27
27
  export { default as GenderSelector } from './src/GenderSelector';
28
28
 
29
29
  // Export des classes
30
+ export { default as Absence } from './src/models/Absence';
31
+ export { default as Employee } from './src/models/Employee';
30
32
  export { default as Supplier } from './src/models/Supplier';
31
33
  export { default as Product } from './src/models/Product';
32
34
  export { default as Prestation } from './src/models/Prestation';
@@ -61,5 +63,5 @@ export { request } from './src/helpers/ApiHelper';
61
63
  export { RoleType, MovaAppType, DayOfWeek, EventState, EventType, DocumentType,
62
64
  DigitalPassportIndex, DocumentState, Gender, DateFormatTypes, PartsApplicationType,
63
65
  ProductType, OrderPreference, OrderState, SlotAlgorithm, VehiclePlateFormat as VehiclePlateType,
64
- SubscriptionPaymentInterval, RegistrationState } from './src/helpers/Enums';
66
+ SubscriptionPaymentInterval, RegistrationState, PrestationType } from './src/helpers/Enums';
65
67
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@movalib/movalib-commons",
3
- "version": "1.1.69",
3
+ "version": "1.1.71",
4
4
  "description": "Bibliothèque d'objets communs à l'ensemble des projets React de Movalib",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -28,7 +28,7 @@ interface AccountValidationProps {
28
28
  movaAppType: MovaAppType,
29
29
  smsValidation: boolean,
30
30
  onSubmit: (success:boolean, message:string) => void,
31
- onResendSecurityCode: (success:boolean, message:string) => void,
31
+ onResendSecurityCode?: (success:boolean, message:string) => void,
32
32
  }
33
33
 
34
34
  const AccountValidation: FunctionComponent<AccountValidationProps> = ({ movaAppType, smsValidation, onSubmit, onResendSecurityCode }) => {
@@ -195,7 +195,7 @@ const AccountValidation: FunctionComponent<AccountValidationProps> = ({ movaAppT
195
195
 
196
196
  const resendCode = () => {
197
197
 
198
- if(controlPhoneNumber()){
198
+ if(controlPhoneNumber() && onResendSecurityCode){
199
199
 
200
200
  let req = {
201
201
  phoneNumber : validationForm.phoneNumber?.value
@@ -207,15 +207,11 @@ const AccountValidation: FunctionComponent<AccountValidationProps> = ({ movaAppT
207
207
  Logger.info(response);
208
208
 
209
209
  if(response.success){
210
- if(onResendSecurityCode){
211
- // Fermeture boite de dialogue
212
- setOpenPhoneNumberInput(false);
213
- onResendSecurityCode(response.success, response.data ?? '');
214
- }
210
+ // Fermeture boite de dialogue
211
+ setOpenPhoneNumberInput(false);
212
+ onResendSecurityCode(response.success, response.data ?? '');
215
213
  }else{
216
- if(onResendSecurityCode){
217
- onResendSecurityCode(response.success, response.error ?? '');
218
- }
214
+ onResendSecurityCode(response.success, response.error ?? '');
219
215
  }
220
216
 
221
217
  }).catch(error => {
@@ -1,3 +1,27 @@
1
+ export enum PrestationType {
2
+
3
+ /**
4
+ * Services courants, mécanique légère : vidange, entretien, pneumatiques
5
+ */
6
+ SIMPLE_MAINTENANCE = "SIMPLE_MAINTENANCE",
7
+ /**
8
+ * Services lours, mécanique plus invasive : moteur, distribution, liaison au sol etc...
9
+ */
10
+ HEAVY_SERVICES = "HEAVY_SERVICES",
11
+ /**
12
+ * Recherche de panne, diagnostique électronique
13
+ */
14
+ ELECTRONIC = "ELECTRONIC",
15
+ /**
16
+ * Carrosserie et peinture
17
+ */
18
+ BODYWORK = "BODYWORK",
19
+ /**
20
+ * Pour les prestations qui ne rentrent dans aucune des catégories précédentes
21
+ */
22
+ OTHER = "OTHER"
23
+ }
24
+
1
25
  export enum SubscriptionPaymentInterval {
2
26
  /**
3
27
  * Paiement Mensuel
@@ -1,4 +1,3 @@
1
-
2
1
  export type MovaValidationForm = {
3
2
  password: MovaFormField,
4
3
  confirmation: MovaFormField,
@@ -0,0 +1,21 @@
1
+ import Employee from "./Employee";
2
+
3
+ export default class Absence {
4
+
5
+ id: string; // UUID
6
+ employee: Employee;
7
+ start: Date;
8
+ end: Date;
9
+
10
+ constructor(
11
+ id: string,
12
+ employee: Employee,
13
+ start: Date,
14
+ end: Date
15
+ ) {
16
+ this.id = id;
17
+ this.employee = employee;
18
+ this.start = start;
19
+ this.end = end;
20
+ }
21
+ }
@@ -0,0 +1,34 @@
1
+ import { PrestationType } from "../helpers/Enums";
2
+ import Absence from "./Absence";
3
+ import Address from "./Address";
4
+ import Role from "./Role";
5
+ import Schedule from "./Schedule";
6
+ import User from "./User";
7
+
8
+
9
+ export default class Employee extends User {
10
+
11
+ // Liste des périodes de congés du collab
12
+ absences: Absence[];
13
+ // Listes des types de prestation qu'il peut réaliser
14
+ prestationTypes: PrestationType[];
15
+ // Horaires de travail
16
+ schedules: Schedule[];
17
+
18
+ constructor(
19
+ id: string,
20
+ roles: Role[] = [],
21
+ firstname: string = '',
22
+ lastname: string = '',
23
+ avatar: string = '',
24
+ absences: Absence[],
25
+ prestationTypes: PrestationType[] = [],
26
+ schedules: Schedule [] = []) {
27
+
28
+ super(id, roles, firstname, lastname, avatar);
29
+
30
+ this.absences = absences;
31
+ this.prestationTypes = prestationTypes;
32
+ this.schedules = schedules;
33
+ }
34
+ }
@@ -31,6 +31,7 @@ export default class Garage {
31
31
  subscriptionIban?: string;
32
32
  subscriptionPaymentInterval?: SubscriptionPaymentInterval;
33
33
  creationDate?: Date;
34
+ teamManagementActive?: boolean;
34
35
 
35
36
  constructor(
36
37
  id:string,
@@ -11,9 +11,9 @@ export default class User {
11
11
  firstname: string;
12
12
  lastname: string;
13
13
  avatar: string;
14
- email: string;
15
14
  password: string;
16
15
  created: Date;
16
+ email?: string;
17
17
  gender?: Gender;
18
18
  birthDate?: Date;
19
19
  addresses? : Address[]
@@ -26,9 +26,9 @@ export default class User {
26
26
  firstname: string = '',
27
27
  lastname: string = '',
28
28
  avatar: string = '',
29
- email: string = '',
30
29
  password: string = '',
31
30
  created: Date = new Date(),
31
+ email?: string,
32
32
  gender?: Gender,
33
33
  birthDate?: Date,
34
34
  addresses?: Address[],
@@ -1,9 +1,81 @@
1
1
  import { APIResponse, API_BASE_URL, request } from "../helpers/ApiHelper";
2
2
  import { APIMethod, MovaAppType } from "../helpers/Enums";
3
+ import Employee from "../models/Employee";
3
4
  import Garage from "../models/Garage";
4
5
 
5
6
  export default class GarageService {
6
7
 
8
+ static deleteGarageEmployeePrestationType(garageId: string, employeeId: string, req: any): Promise<APIResponse<string>> {
9
+ return request({
10
+ url: `${API_BASE_URL}/garage/${garageId}/employees/${employeeId}/prestations-type`,
11
+ method: APIMethod.DELETE,
12
+ appType: MovaAppType.GARAGE,
13
+ body: JSON.stringify(req)
14
+ });
15
+ }
16
+
17
+ static createGarageEmployeePrestationType(garageId: string, employeeId: string, req: any): Promise<APIResponse<string>> {
18
+ return request({
19
+ url: `${API_BASE_URL}/garage/${garageId}/employees/${employeeId}/prestations-type`,
20
+ method: APIMethod.POST,
21
+ appType: MovaAppType.GARAGE,
22
+ body: JSON.stringify(req)
23
+ });
24
+ }
25
+
26
+ static deleteGarageEmployeeAbsence(garageId: string, employeeId: string, req: any): Promise<APIResponse<string>> {
27
+ return request({
28
+ url: `${API_BASE_URL}/garage/${garageId}/employees/${employeeId}/absences`,
29
+ method: APIMethod.DELETE,
30
+ appType: MovaAppType.GARAGE,
31
+ body: JSON.stringify(req)
32
+ });
33
+ }
34
+
35
+ static createGarageEmployeeAbsence(garageId: string, employeeId: string, req: any): Promise<APIResponse<string>> {
36
+ return request({
37
+ url: `${API_BASE_URL}/garage/${garageId}/employees/${employeeId}/absences`,
38
+ method: APIMethod.POST,
39
+ appType: MovaAppType.GARAGE,
40
+ body: JSON.stringify(req)
41
+ });
42
+ }
43
+
44
+ static updateGarageEmployeeSchedules(garageId: string, employeeId: string, req: any): Promise<APIResponse<string>> {
45
+ return request({
46
+ url: `${API_BASE_URL}/garage/${garageId}/employees/${employeeId}/schedules`,
47
+ method: APIMethod.PATCH,
48
+ appType: MovaAppType.GARAGE,
49
+ body: JSON.stringify(req)
50
+ });
51
+ }
52
+
53
+ static deleteGarageEmployee(garageId: string, req: any): Promise<APIResponse<string>> {
54
+ return request({
55
+ url: `${API_BASE_URL}/garage/${garageId}/employees`,
56
+ method: APIMethod.DELETE,
57
+ appType: MovaAppType.GARAGE,
58
+ body: JSON.stringify(req)
59
+ });
60
+ }
61
+
62
+ static createGarageEmployee(garageId: string, req: any): Promise<APIResponse<string>> {
63
+ return request({
64
+ url: `${API_BASE_URL}/garage/${garageId}/employees`,
65
+ method: APIMethod.POST,
66
+ appType: MovaAppType.GARAGE,
67
+ body: JSON.stringify(req)
68
+ });
69
+ }
70
+
71
+ static getEmployees(): Promise<APIResponse<Employee[]>> {
72
+ return request({
73
+ url: `${API_BASE_URL}/user/employees`,
74
+ method: APIMethod.GET,
75
+ appType: MovaAppType.GARAGE
76
+ });
77
+ }
78
+
7
79
  static activateGarage(garageId: string): Promise<APIResponse<string>> {
8
80
 
9
81
  return request({