@movalib/movalib-commons 1.0.77 → 1.0.78
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 +6 -3
- package/dist/index.js +11 -2
- package/dist/src/ScheduleFields.d.ts +1 -1
- package/dist/src/helpers/Enums.d.ts +13 -0
- package/dist/src/helpers/Enums.js +17 -1
- package/dist/src/helpers/Types.d.ts +0 -4
- package/dist/src/models/Event.d.ts +5 -9
- package/dist/src/models/Event.js +3 -16
- package/dist/src/models/Operation.d.ts +11 -0
- package/dist/src/models/Operation.js +14 -0
- package/dist/src/models/Prestation.d.ts +9 -4
- package/dist/src/models/Prestation.js +3 -10
- package/dist/src/models/Product.d.ts +9 -0
- package/dist/src/models/Product.js +13 -0
- package/index.ts +8 -4
- package/package.json +1 -1
- package/src/ScheduleFields.tsx +1 -1
- package/src/helpers/Enums.ts +17 -0
- package/src/helpers/Types.ts +0 -5
- package/src/models/Event.ts +7 -26
- package/src/models/Operation.ts +23 -0
- package/src/models/Prestation.ts +13 -15
- package/src/models/Product.ts +19 -0
package/dist/index.d.ts
CHANGED
|
@@ -17,6 +17,9 @@ export { default as MovaCopyright } from './src/MovaCopyright';
|
|
|
17
17
|
export { default as MovaVehicleTireField } from './src/MovaVehicleTireField';
|
|
18
18
|
export { default as ConfirmationDialog } from './src/ConfirmationDialog';
|
|
19
19
|
export { default as GenderSelector } from './src/GenderSelector';
|
|
20
|
+
export { default as Product } from './src/models/Product';
|
|
21
|
+
export { default as Prestation } from './src/models/Prestation';
|
|
22
|
+
export { default as Operation } from './src/models/Operation';
|
|
20
23
|
export { default as Logger } from './src/helpers/Logger';
|
|
21
24
|
export { default as Customer } from './src/models/Customer';
|
|
22
25
|
export { default as User } from './src/models/User';
|
|
@@ -29,10 +32,10 @@ export { default as Schedule } from './src/models/Schedule';
|
|
|
29
32
|
export { default as Event } from './src/models/Event';
|
|
30
33
|
export { default as VehicleTire } from './src/models/VehicleTire';
|
|
31
34
|
export type { APIRequest, APIResponse } from './src/helpers/ApiHelper';
|
|
32
|
-
export type { DaySchedule } from './src/ScheduleFields';
|
|
33
|
-
export type { MovaFormField, MovaLoginForm, MovaUserSignUpForm, MovaInterval,
|
|
35
|
+
export type { DaySchedule, DayInterval } from './src/ScheduleFields';
|
|
36
|
+
export type { MovaFormField, MovaLoginForm, MovaUserSignUpForm, MovaInterval, MovaVehicleForm, AddressFieldName } from './src/helpers/Types';
|
|
34
37
|
export { readCookie, deleteCookie } from './src/helpers/CookieUtils';
|
|
35
38
|
export { validateField, formatVehicleTire, formatFrenchVehiclePlate, isEmpty } from './src/helpers/Tools';
|
|
36
39
|
export { validatePhoneNumber, validateText, validateEmail } from './src/helpers/Validator';
|
|
37
40
|
export { formatDateByCountryCode, getLongFormattedDateTime, capitalizeFirstLetter } from './src/helpers/DateUtils';
|
|
38
|
-
export { RoleType, MovaAppType, DayOfWeek, EventState, EventType, DocumentType, DigitalPassportIndex, DocumentState, Gender, DateFormatTypes } from './src/helpers/Enums';
|
|
41
|
+
export { RoleType, MovaAppType, DayOfWeek, EventState, EventType, DocumentType, DigitalPassportIndex, DocumentState, Gender, DateFormatTypes, PartsApplicationType, ProductType, OrderPreference } 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.
|
|
8
|
-
exports.DateFormatTypes = exports.Gender = void 0;
|
|
7
|
+
exports.EventType = exports.EventState = exports.DayOfWeek = exports.MovaAppType = exports.RoleType = exports.capitalizeFirstLetter = exports.getLongFormattedDateTime = exports.formatDateByCountryCode = exports.validateEmail = exports.validateText = exports.validatePhoneNumber = 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.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.UserService = exports.GarageService = exports.AuthenticationService = void 0;
|
|
8
|
+
exports.OrderPreference = exports.ProductType = exports.PartsApplicationType = exports.DateFormatTypes = exports.Gender = exports.DocumentState = exports.DigitalPassportIndex = exports.DocumentType = 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; } });
|
|
@@ -47,6 +47,12 @@ Object.defineProperty(exports, "ConfirmationDialog", { enumerable: true, get: fu
|
|
|
47
47
|
var GenderSelector_1 = require("./src/GenderSelector");
|
|
48
48
|
Object.defineProperty(exports, "GenderSelector", { enumerable: true, get: function () { return __importDefault(GenderSelector_1).default; } });
|
|
49
49
|
// Export des classes
|
|
50
|
+
var Product_1 = require("./src/models/Product");
|
|
51
|
+
Object.defineProperty(exports, "Product", { enumerable: true, get: function () { return __importDefault(Product_1).default; } });
|
|
52
|
+
var Prestation_1 = require("./src/models/Prestation");
|
|
53
|
+
Object.defineProperty(exports, "Prestation", { enumerable: true, get: function () { return __importDefault(Prestation_1).default; } });
|
|
54
|
+
var Operation_1 = require("./src/models/Operation");
|
|
55
|
+
Object.defineProperty(exports, "Operation", { enumerable: true, get: function () { return __importDefault(Operation_1).default; } });
|
|
50
56
|
var Logger_1 = require("./src/helpers/Logger");
|
|
51
57
|
Object.defineProperty(exports, "Logger", { enumerable: true, get: function () { return __importDefault(Logger_1).default; } });
|
|
52
58
|
var Customer_1 = require("./src/models/Customer");
|
|
@@ -98,3 +104,6 @@ Object.defineProperty(exports, "DigitalPassportIndex", { enumerable: true, get:
|
|
|
98
104
|
Object.defineProperty(exports, "DocumentState", { enumerable: true, get: function () { return Enums_1.DocumentState; } });
|
|
99
105
|
Object.defineProperty(exports, "Gender", { enumerable: true, get: function () { return Enums_1.Gender; } });
|
|
100
106
|
Object.defineProperty(exports, "DateFormatTypes", { enumerable: true, get: function () { return Enums_1.DateFormatTypes; } });
|
|
107
|
+
Object.defineProperty(exports, "PartsApplicationType", { enumerable: true, get: function () { return Enums_1.PartsApplicationType; } });
|
|
108
|
+
Object.defineProperty(exports, "ProductType", { enumerable: true, get: function () { return Enums_1.ProductType; } });
|
|
109
|
+
Object.defineProperty(exports, "OrderPreference", { enumerable: true, get: function () { return Enums_1.OrderPreference; } });
|
|
@@ -2,7 +2,7 @@ import { FunctionComponent } from 'react';
|
|
|
2
2
|
import Schedule from './models/Schedule';
|
|
3
3
|
import { DayOfWeek } from './helpers/Enums';
|
|
4
4
|
export declare const FR_WEEK_DAYS: string[];
|
|
5
|
-
type DayInterval = {
|
|
5
|
+
export type DayInterval = {
|
|
6
6
|
startTime: Date | '' | null;
|
|
7
7
|
endTime: Date | '' | null;
|
|
8
8
|
countryCode: string;
|
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
export declare enum OrderPreference {
|
|
2
|
+
LOW_RANGE = "LOW_RANGE",
|
|
3
|
+
MID_RANGE = "MID_RANGE",
|
|
4
|
+
HIGH_RANGE = "HIGH_RANGE"
|
|
5
|
+
}
|
|
6
|
+
export declare enum ProductType {
|
|
7
|
+
FRONT = "PART",
|
|
8
|
+
REAR = "CONSUMABLE"
|
|
9
|
+
}
|
|
10
|
+
export declare enum PartsApplicationType {
|
|
11
|
+
FRONT = "FRONT",
|
|
12
|
+
REAR = "REAR"
|
|
13
|
+
}
|
|
1
14
|
export declare enum APIMethod {
|
|
2
15
|
GET = "GET",
|
|
3
16
|
PUT = "PUT",
|
|
@@ -1,6 +1,22 @@
|
|
|
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 = 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 = void 0;
|
|
4
|
+
var OrderPreference;
|
|
5
|
+
(function (OrderPreference) {
|
|
6
|
+
OrderPreference["LOW_RANGE"] = "LOW_RANGE";
|
|
7
|
+
OrderPreference["MID_RANGE"] = "MID_RANGE";
|
|
8
|
+
OrderPreference["HIGH_RANGE"] = "HIGH_RANGE";
|
|
9
|
+
})(OrderPreference = exports.OrderPreference || (exports.OrderPreference = {}));
|
|
10
|
+
var ProductType;
|
|
11
|
+
(function (ProductType) {
|
|
12
|
+
ProductType["FRONT"] = "PART";
|
|
13
|
+
ProductType["REAR"] = "CONSUMABLE";
|
|
14
|
+
})(ProductType = exports.ProductType || (exports.ProductType = {}));
|
|
15
|
+
var PartsApplicationType;
|
|
16
|
+
(function (PartsApplicationType) {
|
|
17
|
+
PartsApplicationType["FRONT"] = "FRONT";
|
|
18
|
+
PartsApplicationType["REAR"] = "REAR";
|
|
19
|
+
})(PartsApplicationType = exports.PartsApplicationType || (exports.PartsApplicationType = {}));
|
|
4
20
|
var APIMethod;
|
|
5
21
|
(function (APIMethod) {
|
|
6
22
|
APIMethod["GET"] = "GET";
|
|
@@ -3,7 +3,7 @@ import { EventState, EventType } from "../helpers/Enums";
|
|
|
3
3
|
import Prestation from "./Prestation";
|
|
4
4
|
import Customer from "./Customer";
|
|
5
5
|
import Vehicle from "./Vehicle";
|
|
6
|
-
import
|
|
6
|
+
import Operation from "./Operation";
|
|
7
7
|
export default class Event {
|
|
8
8
|
id: string;
|
|
9
9
|
ownerId: number;
|
|
@@ -15,6 +15,7 @@ export default class Event {
|
|
|
15
15
|
end?: Date;
|
|
16
16
|
state: EventState;
|
|
17
17
|
prestations?: Prestation[];
|
|
18
|
+
operations?: Operation[];
|
|
18
19
|
/**
|
|
19
20
|
* Un tableau d'invités, dans notre cas d'usage nous n'aurons qu'un invité de type Client
|
|
20
21
|
*/
|
|
@@ -32,11 +33,7 @@ export default class Event {
|
|
|
32
33
|
* Eventuel numéro de devis rattaché à l'évent
|
|
33
34
|
*/
|
|
34
35
|
quoteId?: number;
|
|
35
|
-
|
|
36
|
-
* MVP : pour l'instant les références sont transmises sous cette forme classique
|
|
37
|
-
*/
|
|
38
|
-
originReferences?: OriginReference[];
|
|
39
|
-
constructor({ id, notes, ownerId, type, title, garageName, garageId, state, start, end, prestations, guestsId, vehicleId, quoteId, originReferences }: {
|
|
36
|
+
constructor({ id, notes, ownerId, type, title, garageName, garageId, state, start, end, prestations, operations, guestsId, vehicleId, quoteId }: {
|
|
40
37
|
id: string;
|
|
41
38
|
notes?: string;
|
|
42
39
|
ownerId: number;
|
|
@@ -48,11 +45,10 @@ export default class Event {
|
|
|
48
45
|
start?: Date;
|
|
49
46
|
end?: Date;
|
|
50
47
|
prestations?: Prestation[];
|
|
48
|
+
operations?: Operation[];
|
|
51
49
|
guestsId?: string[];
|
|
52
50
|
vehicleId?: number;
|
|
53
51
|
quoteId?: number;
|
|
54
|
-
originReferences?: OriginReference[];
|
|
55
52
|
});
|
|
56
|
-
static
|
|
57
|
-
static getServicesList(event: Event): string[];
|
|
53
|
+
static getPrestationsList(event: Event): string[];
|
|
58
54
|
}
|
package/dist/src/models/Event.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
var Event = /** @class */ (function () {
|
|
4
4
|
function Event(_a) {
|
|
5
|
-
var id = _a.id, notes = _a.notes, ownerId = _a.ownerId, type = _a.type, title = _a.title, garageName = _a.garageName, garageId = _a.garageId, state = _a.state, start = _a.start, end = _a.end, prestations = _a.prestations,
|
|
5
|
+
var id = _a.id, notes = _a.notes, ownerId = _a.ownerId, type = _a.type, title = _a.title, garageName = _a.garageName, garageId = _a.garageId, state = _a.state, start = _a.start, end = _a.end, prestations = _a.prestations, operations = _a.operations, guestsId = _a.guestsId, vehicleId = _a.vehicleId, quoteId = _a.quoteId;
|
|
6
6
|
this.id = id;
|
|
7
7
|
this.notes = notes;
|
|
8
8
|
this.ownerId = ownerId;
|
|
@@ -13,26 +13,13 @@ var Event = /** @class */ (function () {
|
|
|
13
13
|
this.state = state;
|
|
14
14
|
this.start = start ? new Date(start) : undefined;
|
|
15
15
|
this.end = end ? new Date(end) : undefined;
|
|
16
|
+
this.operations = operations;
|
|
16
17
|
this.prestations = prestations;
|
|
17
18
|
this.guestsId = guestsId;
|
|
18
19
|
this.vehicleId = vehicleId;
|
|
19
20
|
this.quoteId = quoteId;
|
|
20
|
-
this.originReferences = originReferences;
|
|
21
21
|
}
|
|
22
|
-
Event.
|
|
23
|
-
var _a;
|
|
24
|
-
var list = '';
|
|
25
|
-
if (event.originReferences && event.originReferences.length !== 0) {
|
|
26
|
-
(_a = event.originReferences) === null || _a === void 0 ? void 0 : _a.forEach(function (reference, index) {
|
|
27
|
-
if (index > 0) {
|
|
28
|
-
list += " / ";
|
|
29
|
-
}
|
|
30
|
-
list += "".concat(reference.key, " : ").concat(reference.value);
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
return list;
|
|
34
|
-
};
|
|
35
|
-
Event.getServicesList = function (event) {
|
|
22
|
+
Event.getPrestationsList = function (event) {
|
|
36
23
|
if (event && event.prestations) {
|
|
37
24
|
console.log(event.prestations.map(function (n) { return n.name; }));
|
|
38
25
|
return event.prestations.map(function (n) { return n.name; });
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { PartsApplicationType } from "../helpers/Enums";
|
|
2
|
+
import Product from "./Product";
|
|
3
|
+
export default class Operation {
|
|
4
|
+
id: number;
|
|
5
|
+
code: string;
|
|
6
|
+
name: string;
|
|
7
|
+
description: string;
|
|
8
|
+
application?: PartsApplicationType;
|
|
9
|
+
products?: Product[];
|
|
10
|
+
constructor(id: number, code: string, name: string, description: string, application: PartsApplicationType, products: Product[]);
|
|
11
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var Operation = /** @class */ (function () {
|
|
4
|
+
function Operation(id, code, name, description, application, products) {
|
|
5
|
+
this.id = id;
|
|
6
|
+
this.code = code;
|
|
7
|
+
this.name = name;
|
|
8
|
+
this.description = description;
|
|
9
|
+
this.application = application;
|
|
10
|
+
this.products = products;
|
|
11
|
+
}
|
|
12
|
+
return Operation;
|
|
13
|
+
}());
|
|
14
|
+
exports.default = Operation;
|
|
@@ -1,15 +1,20 @@
|
|
|
1
|
+
import Operation from "./Operation";
|
|
1
2
|
export default class Prestation {
|
|
2
3
|
id: number;
|
|
3
4
|
name: string;
|
|
4
5
|
description: string;
|
|
5
6
|
category: string;
|
|
6
7
|
/**
|
|
7
|
-
*
|
|
8
|
+
* Durée d'immobilisation pour cette prestation (en jours)
|
|
8
9
|
*/
|
|
9
10
|
downtime: number;
|
|
10
11
|
/**
|
|
11
|
-
*
|
|
12
|
+
* Délai avant prise de rendez-vous pour cette prestation (en jours)
|
|
12
13
|
*/
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
appointmentDelay: number;
|
|
15
|
+
/**
|
|
16
|
+
* Opérations inhérentes à cette prestation
|
|
17
|
+
*/
|
|
18
|
+
operations?: Operation[];
|
|
19
|
+
constructor(id: number, name: string, description: string, category: string, downtime: number, appointmentDelay: number, operations?: Operation[]);
|
|
15
20
|
}
|
|
@@ -1,21 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
var Prestation = /** @class */ (function () {
|
|
4
|
-
|
|
5
|
-
parts: [ // Les pièces nécessaires pour ce service
|
|
6
|
-
{
|
|
7
|
-
id: number,
|
|
8
|
-
name: string,
|
|
9
|
-
cost: number, // Le coût de chaque pièce
|
|
10
|
-
// autres informations sur la pièce...
|
|
11
|
-
}; */
|
|
12
|
-
function Prestation(id, name, description, category, downtime, options) {
|
|
4
|
+
function Prestation(id, name, description, category, downtime, appointmentDelay, operations) {
|
|
13
5
|
this.id = id;
|
|
14
6
|
this.name = name;
|
|
15
7
|
this.description = description;
|
|
16
8
|
this.category = category;
|
|
17
9
|
this.downtime = downtime;
|
|
18
|
-
this.
|
|
10
|
+
this.appointmentDelay = appointmentDelay;
|
|
11
|
+
this.operations = operations;
|
|
19
12
|
}
|
|
20
13
|
return Prestation;
|
|
21
14
|
}());
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { OrderPreference, ProductType } from "../helpers/Enums";
|
|
2
|
+
export default class Product {
|
|
3
|
+
id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
type: ProductType;
|
|
6
|
+
orderPreference?: OrderPreference;
|
|
7
|
+
originReferences?: string[];
|
|
8
|
+
constructor(id: string, code: string, name: string, type: ProductType, orderPreference: OrderPreference, originReferences: string[]);
|
|
9
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var Product = /** @class */ (function () {
|
|
4
|
+
function Product(id, code, name, type, orderPreference, originReferences) {
|
|
5
|
+
this.id = id;
|
|
6
|
+
this.name = name;
|
|
7
|
+
this.type = type;
|
|
8
|
+
this.orderPreference = orderPreference;
|
|
9
|
+
this.originReferences = originReferences;
|
|
10
|
+
}
|
|
11
|
+
return Product;
|
|
12
|
+
}());
|
|
13
|
+
exports.default = Product;
|
package/index.ts
CHANGED
|
@@ -24,6 +24,9 @@ export { default as ConfirmationDialog } from './src/ConfirmationDialog';
|
|
|
24
24
|
export { default as GenderSelector } from './src/GenderSelector';
|
|
25
25
|
|
|
26
26
|
// Export des classes
|
|
27
|
+
export { default as Product } from './src/models/Product';
|
|
28
|
+
export { default as Prestation } from './src/models/Prestation';
|
|
29
|
+
export { default as Operation } from './src/models/Operation';
|
|
27
30
|
export { default as Logger } from './src/helpers/Logger';
|
|
28
31
|
export { default as Customer } from './src/models/Customer';
|
|
29
32
|
export { default as User } from './src/models/User';
|
|
@@ -38,9 +41,9 @@ export { default as VehicleTire } from './src/models/VehicleTire';
|
|
|
38
41
|
|
|
39
42
|
// Export des types
|
|
40
43
|
export type { APIRequest, APIResponse } from './src/helpers/ApiHelper';
|
|
41
|
-
export type { DaySchedule } from './src/ScheduleFields';
|
|
42
|
-
export type { MovaFormField, MovaLoginForm, MovaUserSignUpForm, MovaInterval,
|
|
43
|
-
MovaVehicleForm, AddressFieldName} from './src/helpers/Types';
|
|
44
|
+
export type { DaySchedule, DayInterval } from './src/ScheduleFields';
|
|
45
|
+
export type { MovaFormField, MovaLoginForm, MovaUserSignUpForm, MovaInterval,
|
|
46
|
+
MovaVehicleForm, AddressFieldName } from './src/helpers/Types';
|
|
44
47
|
|
|
45
48
|
// Export des méthodes utilitaires
|
|
46
49
|
export { readCookie, deleteCookie } from './src/helpers/CookieUtils';
|
|
@@ -50,5 +53,6 @@ export { formatDateByCountryCode, getLongFormattedDateTime, capitalizeFirstLette
|
|
|
50
53
|
|
|
51
54
|
// Export des enums
|
|
52
55
|
export { RoleType, MovaAppType, DayOfWeek, EventState, EventType, DocumentType,
|
|
53
|
-
DigitalPassportIndex, DocumentState, Gender, DateFormatTypes
|
|
56
|
+
DigitalPassportIndex, DocumentState, Gender, DateFormatTypes, PartsApplicationType,
|
|
57
|
+
ProductType, OrderPreference } from './src/helpers/Enums';
|
|
54
58
|
|
package/package.json
CHANGED
package/src/ScheduleFields.tsx
CHANGED
|
@@ -13,7 +13,7 @@ import { toUTCToLocaleDate } from './helpers/DateUtils';
|
|
|
13
13
|
|
|
14
14
|
export const FR_WEEK_DAYS: string[] = ['Lundi', 'Mardi', 'Mercredi', 'Jeudi', 'Vendredi', 'Samedi', 'Dimanche'];
|
|
15
15
|
|
|
16
|
-
type DayInterval = {
|
|
16
|
+
export type DayInterval = {
|
|
17
17
|
startTime: Date | '' | null,
|
|
18
18
|
endTime: Date | '' | null,
|
|
19
19
|
countryCode: string,
|
package/src/helpers/Enums.ts
CHANGED
|
@@ -1,3 +1,20 @@
|
|
|
1
|
+
export enum OrderPreference {
|
|
2
|
+
LOW_RANGE = 'LOW_RANGE',
|
|
3
|
+
MID_RANGE = 'MID_RANGE',
|
|
4
|
+
HIGH_RANGE = 'HIGH_RANGE',
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
export enum ProductType {
|
|
9
|
+
FRONT = 'PART',
|
|
10
|
+
REAR = 'CONSUMABLE',
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export enum PartsApplicationType {
|
|
14
|
+
FRONT = 'FRONT',
|
|
15
|
+
REAR = 'REAR',
|
|
16
|
+
}
|
|
17
|
+
|
|
1
18
|
export enum APIMethod {
|
|
2
19
|
GET = 'GET',
|
|
3
20
|
PUT = 'PUT',
|
package/src/helpers/Types.ts
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
export type AddressFieldName = 'streetName' | 'additional' | 'postalCode' | 'cityName';
|
|
3
3
|
|
|
4
|
-
export type OriginReference = {
|
|
5
|
-
key: string;
|
|
6
|
-
value: string
|
|
7
|
-
};
|
|
8
|
-
|
|
9
4
|
export type MovaVehicleForm = {
|
|
10
5
|
currentMileage: MovaFormField, // Integer
|
|
11
6
|
averageMileagePerYear: MovaFormField, // Integer
|
package/src/models/Event.ts
CHANGED
|
@@ -3,8 +3,7 @@ import { EventState, EventType } from "../helpers/Enums";
|
|
|
3
3
|
import Prestation from "./Prestation";
|
|
4
4
|
import Customer from "./Customer";
|
|
5
5
|
import Vehicle from "./Vehicle";
|
|
6
|
-
import
|
|
7
|
-
import { channel } from "diagnostics_channel";
|
|
6
|
+
import Operation from "./Operation";
|
|
8
7
|
|
|
9
8
|
export default class Event {
|
|
10
9
|
|
|
@@ -19,6 +18,7 @@ export default class Event {
|
|
|
19
18
|
end?: Date;
|
|
20
19
|
state: EventState;
|
|
21
20
|
prestations?: Prestation[];
|
|
21
|
+
operations?: Operation[];
|
|
22
22
|
/**
|
|
23
23
|
* Un tableau d'invités, dans notre cas d'usage nous n'aurons qu'un invité de type Client
|
|
24
24
|
*/
|
|
@@ -37,15 +37,10 @@ export default class Event {
|
|
|
37
37
|
*/
|
|
38
38
|
quoteId?: number;
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
* MVP : pour l'instant les références sont transmises sous cette forme classique
|
|
42
|
-
*/
|
|
43
|
-
originReferences?: OriginReference[];
|
|
44
|
-
|
|
45
|
-
constructor({ id, notes, ownerId, type, title, garageName, garageId, state, start, end, prestations, guestsId, vehicleId, quoteId, originReferences }
|
|
40
|
+
constructor({ id, notes, ownerId, type, title, garageName, garageId, state, start, end, prestations, operations, guestsId, vehicleId, quoteId }
|
|
46
41
|
: { id: string; notes?: string; ownerId: number; type : EventType; title: string; garageName: string; garageId: number;
|
|
47
|
-
state: EventState; start?: Date; end?: Date, prestations?: Prestation[],
|
|
48
|
-
guestsId?: string[], vehicleId?: number, quoteId?: number
|
|
42
|
+
state: EventState; start?: Date; end?: Date, prestations?: Prestation[], operations?: Operation[],
|
|
43
|
+
guestsId?: string[], vehicleId?: number, quoteId?: number})
|
|
49
44
|
{
|
|
50
45
|
this.id = id;
|
|
51
46
|
this.notes = notes;
|
|
@@ -57,28 +52,14 @@ export default class Event {
|
|
|
57
52
|
this.state = state;
|
|
58
53
|
this.start = start ? new Date(start) : undefined;
|
|
59
54
|
this.end = end ? new Date(end) : undefined;
|
|
55
|
+
this.operations = operations;
|
|
60
56
|
this.prestations = prestations;
|
|
61
57
|
this.guestsId = guestsId;
|
|
62
58
|
this.vehicleId = vehicleId;
|
|
63
59
|
this.quoteId = quoteId;
|
|
64
|
-
this.originReferences = originReferences;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
static getOriginReferences(event: Event) : string | undefined {
|
|
68
|
-
let list:string = '';
|
|
69
|
-
|
|
70
|
-
if(event.originReferences && event.originReferences.length !== 0){
|
|
71
|
-
event.originReferences?.forEach((reference, index) => {
|
|
72
|
-
if(index > 0){
|
|
73
|
-
list += " / ";
|
|
74
|
-
}
|
|
75
|
-
list += `${reference.key} : ${reference.value}`;
|
|
76
|
-
})
|
|
77
|
-
}
|
|
78
|
-
return list;
|
|
79
60
|
}
|
|
80
61
|
|
|
81
|
-
static
|
|
62
|
+
static getPrestationsList(event: Event) : string[] {
|
|
82
63
|
if(event && event.prestations) {
|
|
83
64
|
console.log(event.prestations.map(n => n.name));
|
|
84
65
|
return event.prestations.map(n => n.name);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { PartsApplicationType } from "../helpers/Enums";
|
|
2
|
+
import Product from "./Product";
|
|
3
|
+
|
|
4
|
+
export default class Operation {
|
|
5
|
+
|
|
6
|
+
// Properties
|
|
7
|
+
id: number;
|
|
8
|
+
code: string;
|
|
9
|
+
name: string;
|
|
10
|
+
description: string;
|
|
11
|
+
// Eventuelle application de l'opération (avant, arrière)
|
|
12
|
+
application?: PartsApplicationType;
|
|
13
|
+
products?: Product[];
|
|
14
|
+
|
|
15
|
+
constructor(id:number, code: string, name:string, description: string, application: PartsApplicationType, products: Product[]) {
|
|
16
|
+
this.id = id;
|
|
17
|
+
this.code = code;
|
|
18
|
+
this.name = name;
|
|
19
|
+
this.description = description;
|
|
20
|
+
this.application = application;
|
|
21
|
+
this.products = products;
|
|
22
|
+
}
|
|
23
|
+
}
|
package/src/models/Prestation.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import Operation from "./Operation";
|
|
2
|
+
|
|
1
3
|
export default class Prestation {
|
|
2
4
|
|
|
3
5
|
// Properties
|
|
@@ -6,30 +8,26 @@ export default class Prestation {
|
|
|
6
8
|
description: string;
|
|
7
9
|
category: string;
|
|
8
10
|
/**
|
|
9
|
-
*
|
|
11
|
+
* Durée d'immobilisation pour cette prestation (en jours)
|
|
10
12
|
*/
|
|
11
13
|
downtime: number;
|
|
12
14
|
/**
|
|
13
|
-
*
|
|
15
|
+
* Délai avant prise de rendez-vous pour cette prestation (en jours)
|
|
14
16
|
*/
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
name: string,
|
|
22
|
-
cost: number, // Le coût de chaque pièce
|
|
23
|
-
// autres informations sur la pièce...
|
|
24
|
-
}; */
|
|
25
|
-
|
|
17
|
+
appointmentDelay: number;
|
|
18
|
+
/**
|
|
19
|
+
* Opérations inhérentes à cette prestation
|
|
20
|
+
*/
|
|
21
|
+
operations?: Operation[];
|
|
22
|
+
|
|
26
23
|
constructor(id:number, name:string, description: string, category:string,
|
|
27
|
-
downtime:number,
|
|
24
|
+
downtime:number, appointmentDelay: number, operations?: Operation[]) {
|
|
28
25
|
this.id = id;
|
|
29
26
|
this.name = name;
|
|
30
27
|
this.description = description;
|
|
31
28
|
this.category = category;
|
|
32
29
|
this.downtime = downtime;
|
|
33
|
-
this.
|
|
30
|
+
this.appointmentDelay = appointmentDelay;
|
|
31
|
+
this.operations = operations;
|
|
34
32
|
}
|
|
35
33
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { OrderPreference, ProductType } from "../helpers/Enums";
|
|
2
|
+
|
|
3
|
+
export default class Product {
|
|
4
|
+
|
|
5
|
+
// Properties
|
|
6
|
+
id: string; //UUID
|
|
7
|
+
name: string;
|
|
8
|
+
type: ProductType;
|
|
9
|
+
orderPreference?: OrderPreference;
|
|
10
|
+
originReferences?: string[];
|
|
11
|
+
|
|
12
|
+
constructor(id:string, code: string, name:string, type: ProductType, orderPreference: OrderPreference, originReferences: string[]) {
|
|
13
|
+
this.id = id;
|
|
14
|
+
this.name = name;
|
|
15
|
+
this.type = type;
|
|
16
|
+
this.orderPreference = orderPreference;
|
|
17
|
+
this.originReferences = originReferences;
|
|
18
|
+
}
|
|
19
|
+
}
|