@movalib/movalib-commons 1.59.13 → 1.59.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.development +2 -0
- package/devIndex.tsx +1 -1
- package/dist/devIndex.js +1 -1
- package/dist/index.d.ts +6 -3
- package/dist/index.js +14 -4
- package/dist/src/components/LinkedDocumentDialog.d.ts +11 -0
- package/dist/src/components/LinkedDocumentDialog.js +55 -0
- package/dist/src/{VehicleFullCard.d.ts → components/vehicle/VehicleFullCard.d.ts} +5 -2
- package/dist/src/{VehicleFullCard.js → components/vehicle/VehicleFullCard.js} +44 -22
- package/dist/src/components/vehicle/VehiclePlateField.d.ts +8 -0
- package/dist/src/components/vehicle/VehiclePlateField.js +122 -0
- package/dist/src/helpers/CookieUtils.js +2 -1
- package/dist/src/helpers/Enums.d.ts +10 -1
- package/dist/src/helpers/Enums.js +10 -1
- package/dist/src/helpers/Tools.d.ts +1 -0
- package/dist/src/helpers/Tools.js +10 -1
- package/dist/src/models/Garage.d.ts +2 -0
- package/dist/src/services/AuthenticationService.js +2 -0
- package/dist/src/services/GarageService.d.ts +8 -4
- package/dist/src/services/GarageService.js +75 -45
- package/dist/src/services/UserConnected.d.ts +9 -0
- package/dist/src/services/UserConnected.js +59 -0
- package/dist/src/services/UserService.d.ts +1 -1
- package/dist/src/services/VehicleService.d.ts +3 -0
- package/dist/src/services/VehicleService.js +22 -0
- package/dist/src/style/styled.d.ts +17 -0
- package/dist/src/style/styled.js +68 -0
- package/dist/src/style/styled.ts +70 -0
- package/index.ts +8 -3
- package/package.json +3 -2
- package/src/VehiclePlateField.tsx +1 -0
- package/src/components/LinkedDocumentDialog.tsx +200 -0
- package/src/components/vehicle/VehicleFullCard.tsx +549 -0
- package/src/components/vehicle/VehiclePlateField.tsx +164 -0
- package/src/helpers/CookieUtils.ts +2 -1
- package/src/helpers/Enums.ts +12 -1
- package/src/helpers/Tools.ts +5 -0
- package/src/models/Event.ts +1 -1
- package/src/models/Garage.ts +2 -0
- package/src/services/AuthenticationService.ts +2 -1
- package/src/services/GarageService.ts +557 -390
- package/src/services/UserConnected.ts +56 -0
- package/src/services/UserService.ts +1 -1
- package/src/services/VehicleService.ts +25 -0
- package/src/style/styled.ts +70 -0
- package/src/VehicleFullCard.tsx +0 -503
package/.env.development
CHANGED
package/devIndex.tsx
CHANGED
|
@@ -21,7 +21,7 @@ import ScheduleFields, { DaySchedule } from './src/ScheduleFields';
|
|
|
21
21
|
import Schedule from './src/models/Schedule';
|
|
22
22
|
import { flexCenter } from './src/helpers/Tools';
|
|
23
23
|
import AccountValidation from './src/AccountValidation';
|
|
24
|
-
import VehiclePlateField from './src/VehiclePlateField';
|
|
24
|
+
import VehiclePlateField from './src/components/vehicle/VehiclePlateField';
|
|
25
25
|
import GaragePLV from './src/GaragePLV';
|
|
26
26
|
import AddressFields from './src/AddressFields';
|
|
27
27
|
import IbanInput from './src/IbanInput';
|
package/dist/devIndex.js
CHANGED
|
@@ -58,7 +58,7 @@ var ScheduleFields_1 = __importDefault(require("./src/ScheduleFields"));
|
|
|
58
58
|
var Schedule_1 = __importDefault(require("./src/models/Schedule"));
|
|
59
59
|
var Tools_1 = require("./src/helpers/Tools");
|
|
60
60
|
var AccountValidation_1 = __importDefault(require("./src/AccountValidation"));
|
|
61
|
-
var VehiclePlateField_1 = __importDefault(require("./src/VehiclePlateField"));
|
|
61
|
+
var VehiclePlateField_1 = __importDefault(require("./src/components/vehicle/VehiclePlateField"));
|
|
62
62
|
var GaragePLV_1 = __importDefault(require("./src/GaragePLV"));
|
|
63
63
|
var AddressFields_1 = __importDefault(require("./src/AddressFields"));
|
|
64
64
|
var IbanInput_1 = __importDefault(require("./src/IbanInput"));
|
package/dist/index.d.ts
CHANGED
|
@@ -2,18 +2,19 @@ export { default as VehicleService } from './src/services/VehicleService';
|
|
|
2
2
|
export { default as AuthenticationService } from './src/services/AuthenticationService';
|
|
3
3
|
export { default as GarageService } from './src/services/GarageService';
|
|
4
4
|
export { default as UserService } from './src/services/UserService';
|
|
5
|
+
export { default as UserConnected } from './src/services/UserConnected';
|
|
5
6
|
export { default as DialogForgotPassword } from './src/DialogForgotPassword';
|
|
6
7
|
export { default as IbanInput } from './src/IbanInput';
|
|
7
8
|
export { default as GaragePLV } from './src/GaragePLV';
|
|
8
9
|
export { default as AccountValidation } from './src/AccountValidation';
|
|
9
10
|
export { default as AddressFields } from './src/AddressFields';
|
|
10
11
|
export { default as ScheduleFields } from './src/ScheduleFields';
|
|
11
|
-
export { default as VehicleFullCard } from './src/VehicleFullCard';
|
|
12
|
+
export { default as VehicleFullCard } from './src/components/vehicle/VehicleFullCard';
|
|
12
13
|
export { default as MovaDigitalPassport } from './src/MovaDigitalPassport';
|
|
13
14
|
export { default as Loader } from './src/Loader';
|
|
14
15
|
export { default as MovaDialog } from './src/MovaDialog';
|
|
15
16
|
export { default as QRCode } from './src/QRCode';
|
|
16
|
-
export { default as VehiclePlateField, regexPlate, oldRegexPlate } from './src/VehiclePlateField';
|
|
17
|
+
export { default as VehiclePlateField, regexPlate, oldRegexPlate } from './src/components/vehicle/VehiclePlateField';
|
|
17
18
|
export { default as TestButton } from './src/TestButton';
|
|
18
19
|
export { default as MovaSnackbar } from './src/MovaSnackbar';
|
|
19
20
|
export { default as MovaLogin } from './src/MovaLogin';
|
|
@@ -25,6 +26,7 @@ export { default as GenderSelector } from './src/GenderSelector';
|
|
|
25
26
|
export { default as ActivateAccount } from './src/components/singup/ActivateAccount';
|
|
26
27
|
export { QrCodePLVContainer } from './src/components/QrCodePLVContainer/QrCodePLVContainer';
|
|
27
28
|
export { PLVComponent, PrintSize } from './src/components/QrCodePLVContainer/PLVComponent';
|
|
29
|
+
export { LinkedDocumentDialog } from './src/components/LinkedDocumentDialog';
|
|
28
30
|
export { default as Subscription } from './src/models/Subscription';
|
|
29
31
|
export { default as Absence } from './src/models/Absence';
|
|
30
32
|
export { default as Employee } from './src/models/Employee';
|
|
@@ -49,9 +51,10 @@ export type { APIRequest, APIResponse } from './src/helpers/ApiHelper';
|
|
|
49
51
|
export type { DaySchedule, DayInterval } from './src/ScheduleFields';
|
|
50
52
|
export type { MovaFormField, MovaLoginForm, MovaUserSignUpForm, MovaInterval, MovaVehicleForm, AddressFieldName, } from './src/helpers/Types';
|
|
51
53
|
export { readCookie, deleteCookie } from './src/helpers/CookieUtils';
|
|
52
|
-
export { validateField, formatVehicleTire, formatFrenchVehiclePlate, isEmpty, getApplicationShortLabel, capitalizeFirstLetter, flexLeftRow, formatPhoneNumber, getFormattedSchedule, getFormattedIntervals, findScheduleByDayOfWeek, getDayOfWeekLabel, isSafariOniOS, getApplicationsShortLabels, } from './src/helpers/Tools';
|
|
54
|
+
export { validateField, formatVehicleTire, formatFrenchVehiclePlate, isEmpty, getApplicationShortLabel, capitalizeFirstLetter, flexLeftRow, formatPhoneNumber, getFormattedSchedule, getFormattedIntervals, findScheduleByDayOfWeek, getDayOfWeekLabel, isSafariOniOS, iAmOwner, getApplicationsShortLabels, } from './src/helpers/Tools';
|
|
53
55
|
export { validatePhoneNumber, validateText, validateEmail } from './src/helpers/Validator';
|
|
54
56
|
export { formatDateByCountryCode, getLongFormattedDateTime } from './src/helpers/DateUtils';
|
|
55
57
|
export { request, API_BASE_URL } from './src/helpers/ApiHelper';
|
|
56
58
|
export { CustomerType, RoleType, MovaAppType, DayOfWeek, EventState, EventType, DocumentType, DigitalPassportIndex, DocumentState, Gender, DateFormatTypes, PartsApplicationType, ProductType, OrderPreference, OrderState, SlotAlgorithm, VehiclePlateFormat as VehiclePlateType, SubscriptionPaymentInterval, RegistrationState, PrestationType, PrestationState, CountryCode, SubscriptionState, SubscriptionType, APIMethod, } from './src/helpers/Enums';
|
|
57
59
|
export { openDialogPrint } from './src/utils/DialogPrint';
|
|
60
|
+
export { StyledToggleButton, StyledToggleButtonGroup } from './src/style/styled';
|
package/dist/index.js
CHANGED
|
@@ -4,8 +4,9 @@ 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.
|
|
7
|
+
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.LinkedDocumentDialog = exports.PrintSize = exports.PLVComponent = exports.QrCodePLVContainer = exports.ActivateAccount = 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.UserConnected = exports.UserService = exports.GarageService = exports.AuthenticationService = exports.VehicleService = void 0;
|
|
8
|
+
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.iAmOwner = 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 = exports.readCookie = exports.CategoryPrestation = exports.VehicleTire = void 0;
|
|
9
|
+
exports.StyledToggleButtonGroup = exports.StyledToggleButton = exports.openDialogPrint = exports.APIMethod = void 0;
|
|
9
10
|
// Export des services
|
|
10
11
|
var VehicleService_1 = require("./src/services/VehicleService");
|
|
11
12
|
Object.defineProperty(exports, "VehicleService", { enumerable: true, get: function () { return __importDefault(VehicleService_1).default; } });
|
|
@@ -15,6 +16,8 @@ var GarageService_1 = require("./src/services/GarageService");
|
|
|
15
16
|
Object.defineProperty(exports, "GarageService", { enumerable: true, get: function () { return __importDefault(GarageService_1).default; } });
|
|
16
17
|
var UserService_1 = require("./src/services/UserService");
|
|
17
18
|
Object.defineProperty(exports, "UserService", { enumerable: true, get: function () { return __importDefault(UserService_1).default; } });
|
|
19
|
+
var UserConnected_1 = require("./src/services/UserConnected");
|
|
20
|
+
Object.defineProperty(exports, "UserConnected", { enumerable: true, get: function () { return __importDefault(UserConnected_1).default; } });
|
|
18
21
|
// Export des composants
|
|
19
22
|
var DialogForgotPassword_1 = require("./src/DialogForgotPassword");
|
|
20
23
|
Object.defineProperty(exports, "DialogForgotPassword", { enumerable: true, get: function () { return __importDefault(DialogForgotPassword_1).default; } });
|
|
@@ -28,7 +31,7 @@ var AddressFields_1 = require("./src/AddressFields");
|
|
|
28
31
|
Object.defineProperty(exports, "AddressFields", { enumerable: true, get: function () { return __importDefault(AddressFields_1).default; } });
|
|
29
32
|
var ScheduleFields_1 = require("./src/ScheduleFields");
|
|
30
33
|
Object.defineProperty(exports, "ScheduleFields", { enumerable: true, get: function () { return __importDefault(ScheduleFields_1).default; } });
|
|
31
|
-
var VehicleFullCard_1 = require("./src/VehicleFullCard");
|
|
34
|
+
var VehicleFullCard_1 = require("./src/components/vehicle/VehicleFullCard");
|
|
32
35
|
Object.defineProperty(exports, "VehicleFullCard", { enumerable: true, get: function () { return __importDefault(VehicleFullCard_1).default; } });
|
|
33
36
|
var MovaDigitalPassport_1 = require("./src/MovaDigitalPassport");
|
|
34
37
|
Object.defineProperty(exports, "MovaDigitalPassport", { enumerable: true, get: function () { return __importDefault(MovaDigitalPassport_1).default; } });
|
|
@@ -38,7 +41,7 @@ var MovaDialog_1 = require("./src/MovaDialog");
|
|
|
38
41
|
Object.defineProperty(exports, "MovaDialog", { enumerable: true, get: function () { return __importDefault(MovaDialog_1).default; } });
|
|
39
42
|
var QRCode_1 = require("./src/QRCode");
|
|
40
43
|
Object.defineProperty(exports, "QRCode", { enumerable: true, get: function () { return __importDefault(QRCode_1).default; } });
|
|
41
|
-
var VehiclePlateField_1 = require("./src/VehiclePlateField");
|
|
44
|
+
var VehiclePlateField_1 = require("./src/components/vehicle/VehiclePlateField");
|
|
42
45
|
Object.defineProperty(exports, "VehiclePlateField", { enumerable: true, get: function () { return __importDefault(VehiclePlateField_1).default; } });
|
|
43
46
|
Object.defineProperty(exports, "regexPlate", { enumerable: true, get: function () { return VehiclePlateField_1.regexPlate; } });
|
|
44
47
|
Object.defineProperty(exports, "oldRegexPlate", { enumerable: true, get: function () { return VehiclePlateField_1.oldRegexPlate; } });
|
|
@@ -65,6 +68,8 @@ Object.defineProperty(exports, "QrCodePLVContainer", { enumerable: true, get: fu
|
|
|
65
68
|
var PLVComponent_1 = require("./src/components/QrCodePLVContainer/PLVComponent");
|
|
66
69
|
Object.defineProperty(exports, "PLVComponent", { enumerable: true, get: function () { return PLVComponent_1.PLVComponent; } });
|
|
67
70
|
Object.defineProperty(exports, "PrintSize", { enumerable: true, get: function () { return PLVComponent_1.PrintSize; } });
|
|
71
|
+
var LinkedDocumentDialog_1 = require("./src/components/LinkedDocumentDialog");
|
|
72
|
+
Object.defineProperty(exports, "LinkedDocumentDialog", { enumerable: true, get: function () { return LinkedDocumentDialog_1.LinkedDocumentDialog; } });
|
|
68
73
|
// Export des classes
|
|
69
74
|
var Subscription_1 = require("./src/models/Subscription");
|
|
70
75
|
Object.defineProperty(exports, "Subscription", { enumerable: true, get: function () { return __importDefault(Subscription_1).default; } });
|
|
@@ -124,6 +129,7 @@ Object.defineProperty(exports, "getFormattedIntervals", { enumerable: true, get:
|
|
|
124
129
|
Object.defineProperty(exports, "findScheduleByDayOfWeek", { enumerable: true, get: function () { return Tools_1.findScheduleByDayOfWeek; } });
|
|
125
130
|
Object.defineProperty(exports, "getDayOfWeekLabel", { enumerable: true, get: function () { return Tools_1.getDayOfWeekLabel; } });
|
|
126
131
|
Object.defineProperty(exports, "isSafariOniOS", { enumerable: true, get: function () { return Tools_1.isSafariOniOS; } });
|
|
132
|
+
Object.defineProperty(exports, "iAmOwner", { enumerable: true, get: function () { return Tools_1.iAmOwner; } });
|
|
127
133
|
Object.defineProperty(exports, "getApplicationsShortLabels", { enumerable: true, get: function () { return Tools_1.getApplicationsShortLabels; } });
|
|
128
134
|
var Validator_1 = require("./src/helpers/Validator");
|
|
129
135
|
Object.defineProperty(exports, "validatePhoneNumber", { enumerable: true, get: function () { return Validator_1.validatePhoneNumber; } });
|
|
@@ -165,3 +171,7 @@ Object.defineProperty(exports, "APIMethod", { enumerable: true, get: function ()
|
|
|
165
171
|
// Export des utils
|
|
166
172
|
var DialogPrint_1 = require("./src/utils/DialogPrint");
|
|
167
173
|
Object.defineProperty(exports, "openDialogPrint", { enumerable: true, get: function () { return DialogPrint_1.openDialogPrint; } });
|
|
174
|
+
// Export des styles
|
|
175
|
+
var styled_1 = require("./src/style/styled");
|
|
176
|
+
Object.defineProperty(exports, "StyledToggleButton", { enumerable: true, get: function () { return styled_1.StyledToggleButton; } });
|
|
177
|
+
Object.defineProperty(exports, "StyledToggleButtonGroup", { enumerable: true, get: function () { return styled_1.StyledToggleButtonGroup; } });
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { DocumentType, MovaAppType } from "../helpers/Enums";
|
|
3
|
+
type LinkedDocumentDialog = {
|
|
4
|
+
isShowLinkedDocument: boolean;
|
|
5
|
+
toggleShowLinkedDocument: (docType: DocumentType | null) => void;
|
|
6
|
+
isVehicle: boolean;
|
|
7
|
+
message?: JSX.Element;
|
|
8
|
+
appType: MovaAppType;
|
|
9
|
+
};
|
|
10
|
+
export declare const LinkedDocumentDialog: ({ isShowLinkedDocument, toggleShowLinkedDocument, isVehicle, message, appType, }: LinkedDocumentDialog) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.LinkedDocumentDialog = void 0;
|
|
18
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
19
|
+
var Dialog_1 = __importDefault(require("@mui/material/Dialog"));
|
|
20
|
+
var Toolbar_1 = __importDefault(require("@mui/material/Toolbar"));
|
|
21
|
+
var theme_1 = __importDefault(require("../../theme"));
|
|
22
|
+
var DialogTitle_1 = __importDefault(require("@mui/material/DialogTitle"));
|
|
23
|
+
var Box_1 = __importDefault(require("@mui/material/Box"));
|
|
24
|
+
var icons_material_1 = require("@mui/icons-material");
|
|
25
|
+
var Typography_1 = __importDefault(require("@mui/material/Typography"));
|
|
26
|
+
var IconButton_1 = __importDefault(require("@mui/material/IconButton"));
|
|
27
|
+
var CloseRounded_1 = __importDefault(require("@mui/icons-material/CloseRounded"));
|
|
28
|
+
var DialogContent_1 = __importDefault(require("@mui/material/DialogContent"));
|
|
29
|
+
var DialogActions_1 = __importDefault(require("@mui/material/DialogActions"));
|
|
30
|
+
var Button_1 = __importDefault(require("@mui/material/Button"));
|
|
31
|
+
var Enums_1 = require("../helpers/Enums");
|
|
32
|
+
var react_1 = require("react");
|
|
33
|
+
var material_1 = require("@mui/material");
|
|
34
|
+
var styled_1 = require("../style/styled");
|
|
35
|
+
var LinkedDocumentDialog = function (_a) {
|
|
36
|
+
var isShowLinkedDocument = _a.isShowLinkedDocument, toggleShowLinkedDocument = _a.toggleShowLinkedDocument, isVehicle = _a.isVehicle, message = _a.message, appType = _a.appType;
|
|
37
|
+
var _b = (0, react_1.useState)(null), selectedTypeDocument = _b[0], setSelectedTypeDocument = _b[1];
|
|
38
|
+
var isMobile = (0, material_1.useMediaQuery)(theme_1.default.breakpoints.down('md'));
|
|
39
|
+
return ((0, jsx_runtime_1.jsxs)(Dialog_1.default, __assign({ open: isShowLinkedDocument, fullWidth: true, maxWidth: 'md', onClose: function () { return toggleShowLinkedDocument(null); }, "aria-labelledby": 'alert-dialog-title', "aria-describedby": 'alert-dialog-description' }, { children: [(0, jsx_runtime_1.jsx)(Toolbar_1.default, __assign({ disableGutters: true, sx: {
|
|
40
|
+
display: 'block',
|
|
41
|
+
background: theme_1.default.palette.grey[200],
|
|
42
|
+
minHeight: 3,
|
|
43
|
+
p: 0,
|
|
44
|
+
} }, { children: (0, jsx_runtime_1.jsx)(DialogTitle_1.default, __assign({ id: 'search-dialog-title' }, { children: (0, jsx_runtime_1.jsxs)(Box_1.default, __assign({ position: 'relative', sx: { display: 'flex', flexDirection: 'row', justifyContent: 'space-between' } }, { children: [(0, jsx_runtime_1.jsx)(icons_material_1.FindInPage, { sx: { height: '30px', width: '30px' } }), (0, jsx_runtime_1.jsx)(Typography_1.default, __assign({ variant: 'h6', sx: {
|
|
45
|
+
textTransform: 'uppercase',
|
|
46
|
+
fontStyle: 'bold',
|
|
47
|
+
textAlign: 'center',
|
|
48
|
+
} }, { children: "Quel type de document ?" })), (0, jsx_runtime_1.jsx)(IconButton_1.default, __assign({ size: 'small', "aria-label": 'close', onClick: function () { return toggleShowLinkedDocument(null); }, title: 'Fermer' }, { children: (0, jsx_runtime_1.jsx)(CloseRounded_1.default, {}) }))] })) })) })), (0, jsx_runtime_1.jsxs)(DialogContent_1.default, __assign({ sx: { textAlign: 'center' } }, { children: [(0, jsx_runtime_1.jsx)(material_1.ToggleButtonGroup, __assign({ orientation: isMobile ? 'vertical' : 'horizontal', size: 'small', value: selectedTypeDocument, exclusive: true, onChange: function (_, value) {
|
|
49
|
+
setSelectedTypeDocument(value);
|
|
50
|
+
}, "aria-label": 'update-scheduling-alert', sx: { gap: 3, flexWrap: 'wrap', justifyContent: 'center' } }, { children: isVehicle ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(styled_1.StyledToggleButton, __assign({ size: 'small', sx: { width: '230px' }, customSelectedBackgroundColor: theme_1.default.palette.primary.main, customHoverColor: theme_1.default.palette.primary.light, value: Enums_1.DocumentType.VEHICLE_TIRE_PHOTO, selected: selectedTypeDocument === Enums_1.DocumentType.VEHICLE_TIRE_PHOTO, "aria-label": 'document tire' }, { children: (0, jsx_runtime_1.jsx)("b", { children: "Photo pneu" }) })), appType === Enums_1.MovaAppType.INDIVIDUAL && ((0, jsx_runtime_1.jsx)(styled_1.StyledToggleButton, __assign({ size: 'small', sx: { width: '230px' }, customSelectedBackgroundColor: theme_1.default.palette.primary.main, customHoverColor: theme_1.default.palette.primary.light, value: Enums_1.DocumentType.VEHICLE_MAINTENANCE_INVOICE, selected: selectedTypeDocument === Enums_1.DocumentType.VEHICLE_MAINTENANCE_INVOICE, "aria-label": 'invoice document' }, { children: (0, jsx_runtime_1.jsx)("b", { children: "Facture" }) }))), (0, jsx_runtime_1.jsx)(styled_1.StyledToggleButton, __assign({ size: 'small', sx: { width: '230px' }, customSelectedBackgroundColor: theme_1.default.palette.primary.main, customHoverColor: theme_1.default.palette.primary.light, value: Enums_1.DocumentType.VEHICLE_INSPECTION, selected: selectedTypeDocument === Enums_1.DocumentType.VEHICLE_INSPECTION, "aria-label": 'vehicule inspection docuemnt' }, { children: (0, jsx_runtime_1.jsx)("b", { children: "Contr\u00F4le technique" }) })), (0, jsx_runtime_1.jsx)(styled_1.StyledToggleButton, __assign({ size: 'small', sx: { width: '230px' }, customSelectedBackgroundColor: theme_1.default.palette.primary.main, customHoverColor: theme_1.default.palette.primary.light, value: Enums_1.DocumentType.VEHICLE_OTHER, selected: selectedTypeDocument === Enums_1.DocumentType.VEHICLE_OTHER, "aria-label": 'vehicule document other' }, { children: (0, jsx_runtime_1.jsx)("b", { children: "Autre" }) }))] })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(styled_1.StyledToggleButton, __assign({ size: 'small', sx: { width: '230px' }, customSelectedBackgroundColor: theme_1.default.palette.primary.main, customHoverColor: theme_1.default.palette.primary.light, value: Enums_1.DocumentType.EVENT_VISUAL_PROOFS, selected: selectedTypeDocument === Enums_1.DocumentType.EVENT_VISUAL_PROOFS, "aria-label": 'event visual proof document' }, { children: (0, jsx_runtime_1.jsx)("b", { children: "Photos et Preuves Visuelles" }) })), (0, jsx_runtime_1.jsx)(styled_1.StyledToggleButton, __assign({ size: 'small', sx: { width: '230px' }, customSelectedBackgroundColor: theme_1.default.palette.primary.main, customHoverColor: theme_1.default.palette.primary.light, value: Enums_1.DocumentType.EVENT_OTHER, selected: selectedTypeDocument === Enums_1.DocumentType.EVENT_OTHER, "aria-label": 'event document other' }, { children: (0, jsx_runtime_1.jsx)("b", { children: "Autre" }) }))] })) })), message && ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: message }))] })), (0, jsx_runtime_1.jsxs)(DialogActions_1.default, __assign({ sx: {
|
|
51
|
+
py: 1,
|
|
52
|
+
backgroundColor: theme_1.default.palette.grey[200],
|
|
53
|
+
} }, { children: [(0, jsx_runtime_1.jsx)(Button_1.default, __assign({ color: 'inherit', onClick: function () { return toggleShowLinkedDocument(null); } }, { children: "Annuler" })), (0, jsx_runtime_1.jsx)(Box_1.default, { sx: { flexGrow: 1 } }), (0, jsx_runtime_1.jsx)(Button_1.default, __assign({ color: 'primary', autoFocus: true, sx: { ml: 1 }, disabled: !selectedTypeDocument, onClick: function () { return toggleShowLinkedDocument(selectedTypeDocument); } }, { children: (0, jsx_runtime_1.jsx)("b", { children: "Valider" }) }))] }))] })));
|
|
54
|
+
};
|
|
55
|
+
exports.LinkedDocumentDialog = LinkedDocumentDialog;
|
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
import { type FC } from 'react';
|
|
2
|
-
import { MovaVehicleForm } from '
|
|
3
|
-
import Vehicle from '
|
|
2
|
+
import { MovaVehicleForm } from '../../helpers/Types';
|
|
3
|
+
import Vehicle from '../../models/Vehicle';
|
|
4
|
+
import { MovaAppType } from '../../helpers/Enums';
|
|
4
5
|
interface VehicleFullCardProps {
|
|
5
6
|
vehicle: Vehicle;
|
|
6
7
|
onError: (message: string) => void;
|
|
7
8
|
onUploadDocument: (data: FormData) => void;
|
|
8
9
|
onDeleteDocument: (documentId: string) => void;
|
|
9
10
|
editMode: boolean;
|
|
11
|
+
appType: MovaAppType;
|
|
10
12
|
fullwidth?: boolean;
|
|
11
13
|
focused?: boolean;
|
|
12
14
|
onUpdate?: (form: MovaVehicleForm) => void;
|
|
13
15
|
onDelete?: () => void;
|
|
16
|
+
currentUpload: boolean;
|
|
14
17
|
}
|
|
15
18
|
declare const VehicleFullCard: FC<VehicleFullCardProps>;
|
|
16
19
|
export default VehicleFullCard;
|
|
@@ -17,17 +17,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
18
18
|
var material_1 = require("@mui/material");
|
|
19
19
|
var react_1 = require("react");
|
|
20
|
-
var car_figure_png_1 = __importDefault(require("
|
|
21
|
-
var MovaVehicleTireField_1 = __importDefault(require("
|
|
22
|
-
var ConfirmationDialog_1 = __importDefault(require("
|
|
23
|
-
var Enums_1 = require("
|
|
24
|
-
var Tools_1 = require("
|
|
25
|
-
var MovaDigitalPassport_1 = __importDefault(require("
|
|
26
|
-
var DateUtils_1 = require("
|
|
20
|
+
var car_figure_png_1 = __importDefault(require("../../assets/images/car_figure.png"));
|
|
21
|
+
var MovaVehicleTireField_1 = __importDefault(require("../../MovaVehicleTireField"));
|
|
22
|
+
var ConfirmationDialog_1 = __importDefault(require("../../ConfirmationDialog"));
|
|
23
|
+
var Enums_1 = require("../../helpers/Enums");
|
|
24
|
+
var Tools_1 = require("../../helpers/Tools");
|
|
25
|
+
var MovaDigitalPassport_1 = __importDefault(require("../../MovaDigitalPassport"));
|
|
26
|
+
var DateUtils_1 = require("../../helpers/DateUtils");
|
|
27
27
|
var CloseRounded_1 = __importDefault(require("@mui/icons-material/CloseRounded"));
|
|
28
28
|
var EditRounded_1 = __importDefault(require("@mui/icons-material/EditRounded"));
|
|
29
29
|
var CloseRounded_2 = __importDefault(require("@mui/icons-material/CloseRounded"));
|
|
30
|
-
var Logger_1 = __importDefault(require("
|
|
30
|
+
var Logger_1 = __importDefault(require("../../helpers/Logger"));
|
|
31
|
+
var icons_material_1 = require("@mui/icons-material");
|
|
32
|
+
var LinkedDocumentDialog_1 = require("../LinkedDocumentDialog");
|
|
31
33
|
var initialUserFormState = {
|
|
32
34
|
currentMileage: { value: null, isValid: true },
|
|
33
35
|
averageMileagePerYear: { value: null, isValid: true },
|
|
@@ -38,18 +40,22 @@ var initialUserFormState = {
|
|
|
38
40
|
tireSpeedIndex: { value: '', isValid: true }
|
|
39
41
|
};
|
|
40
42
|
var VehicleFullCard = function (_a) {
|
|
41
|
-
var _b
|
|
42
|
-
var vehicle = _a.vehicle, fullwidth = _a.fullwidth, onError = _a.onError, onUploadDocument = _a.onUploadDocument, onDeleteDocument = _a.onDeleteDocument,
|
|
43
|
+
var _b;
|
|
44
|
+
var vehicle = _a.vehicle, fullwidth = _a.fullwidth, onError = _a.onError, onUploadDocument = _a.onUploadDocument, onDeleteDocument = _a.onDeleteDocument, appType = _a.appType, _c = _a.editMode, editMode = _c === void 0 ? false : _c, _d = _a.focused, focused = _d === void 0 ? false : _d, onUpdate = _a.onUpdate, onDelete = _a.onDelete, currentUpload = _a.currentUpload;
|
|
43
45
|
var theme = (0, material_1.useTheme)();
|
|
44
|
-
var
|
|
45
|
-
var
|
|
46
|
-
var
|
|
47
|
-
var
|
|
46
|
+
var _e = (0, react_1.useState)(editMode), localEditMode = _e[0], setLocalEditMode = _e[1];
|
|
47
|
+
var _f = (0, react_1.useState)(false), openConfirmDocumentDelete = _f[0], setOpenConfirmDocumentDelete = _f[1];
|
|
48
|
+
var _g = (0, react_1.useState)(false), openConfirmVehicleDelete = _g[0], setOpenConfirmVehicleDelete = _g[1];
|
|
49
|
+
var _h = (0, react_1.useState)(''), documentToDelete = _h[0], setDocumentToDelete = _h[1];
|
|
50
|
+
var _j = (0, react_1.useState)(false), sizeLimit = _j[0], setSizeLimit = _j[1];
|
|
48
51
|
// Formulaire utilisé pour les modifications d'informations sur le véhicule
|
|
49
52
|
var _k = (0, react_1.useState)(initialUserFormState), form = _k[0], setForm = _k[1];
|
|
50
53
|
// Références aux éventuels documents uploadés depuis la fiche
|
|
51
54
|
var invoiceInputRef = (0, react_1.useRef)(null);
|
|
52
55
|
var tirePictureInputRef = (0, react_1.useRef)(null);
|
|
56
|
+
var _l = (0, react_1.useState)(false), isShowLinkedDocument = _l[0], setShowLinkedDocument = _l[1];
|
|
57
|
+
var docTypeCurrent = (0, react_1.useRef)();
|
|
58
|
+
var messageRGPD = appType === Enums_1.MovaAppType.INDIVIDUAL ? (0, jsx_runtime_1.jsx)(material_1.Box, {}) : (0, jsx_runtime_1.jsx)(material_1.Box, __assign({ sx: { mt: 2 } }, { children: (0, jsx_runtime_1.jsx)(material_1.Alert, __assign({ severity: 'warning' }, { children: "Vous \u00EAtes responsable des documents que vous importez, en ajoutant un document vous reconnaissez disposer du consentement explicite du client pour le stockage de ses donn\u00E9es conform\u00E9ment \u00E0 la r\u00E9glementation RGPD." })) }));
|
|
53
59
|
(0, react_1.useEffect)(function () {
|
|
54
60
|
setLocalEditMode(editMode);
|
|
55
61
|
}, [editMode]);
|
|
@@ -91,6 +97,16 @@ var VehicleFullCard = function (_a) {
|
|
|
91
97
|
Logger_1.default.info(form);
|
|
92
98
|
}
|
|
93
99
|
};
|
|
100
|
+
var toggleShowLinkedDocument = function (docType) {
|
|
101
|
+
setShowLinkedDocument(!isShowLinkedDocument);
|
|
102
|
+
if (docType && invoiceInputRef.current) {
|
|
103
|
+
docTypeCurrent.current = docType;
|
|
104
|
+
invoiceInputRef.current.click();
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
docTypeCurrent.current = undefined;
|
|
108
|
+
}
|
|
109
|
+
};
|
|
94
110
|
var isVehicleTireSizeDefined = function (vehicle) {
|
|
95
111
|
return vehicle.tireSize && vehicle.tireSize.diameter && vehicle.tireSize.height && vehicle.tireSize.speedIndex && vehicle.tireSize.width;
|
|
96
112
|
};
|
|
@@ -115,6 +131,10 @@ var VehicleFullCard = function (_a) {
|
|
|
115
131
|
setForm(__assign(__assign({}, form), newField));
|
|
116
132
|
};
|
|
117
133
|
var uploadVehicleDocument = function (document, documentType) {
|
|
134
|
+
if (document.size > 10000000) {
|
|
135
|
+
setSizeLimit(true);
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
118
138
|
if (vehicle && document && documentType) {
|
|
119
139
|
// Utilisation d'un formData pour permettre le trasnfert de fichier vers l'API
|
|
120
140
|
var formData = new FormData();
|
|
@@ -203,9 +223,11 @@ var VehicleFullCard = function (_a) {
|
|
|
203
223
|
}
|
|
204
224
|
};
|
|
205
225
|
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [vehicle &&
|
|
206
|
-
(0, jsx_runtime_1.jsxs)(material_1.Card, __assign({ variant: 'outlined', sx: {
|
|
226
|
+
(0, jsx_runtime_1.jsxs)(material_1.Card, __assign({ variant: 'outlined', sx: {
|
|
227
|
+
maxWidth: fullwidth ? '80%' : 345,
|
|
207
228
|
backgroundColor: focused ? theme.palette.primary.light : 'white',
|
|
208
|
-
overflow: 'visible', mt: 4, pb: 1
|
|
229
|
+
overflow: 'visible', mt: 4, pb: 1
|
|
230
|
+
} }, { children: [(0, jsx_runtime_1.jsx)("img", { src: car_figure_png_1.default, style: {
|
|
209
231
|
position: 'relative',
|
|
210
232
|
width: '40%',
|
|
211
233
|
top: '-25px',
|
|
@@ -217,12 +239,12 @@ var VehicleFullCard = function (_a) {
|
|
|
217
239
|
'& input': { textTransform: 'uppercase' } // CSS pour forcer les majuscules dans l'input
|
|
218
240
|
}, helperText: Boolean(form.currentMileage.error && form.currentMileage.value > 0)
|
|
219
241
|
? form.currentMileage.error : "Sur votre tableau de bord 😉" }) })), !localEditMode && (0, jsx_runtime_1.jsxs)(material_1.Grid, __assign({ container: true, textAlign: 'justify', sx: { pt: 2 } }, { children: [(0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 8 }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ variant: "body1", color: "text.secondary" }, { children: "Km moyen annuel :" })) })), (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 4, sx: { textAlign: 'right' } }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ variant: "body1", color: "text.secondary" }, { children: (0, jsx_runtime_1.jsxs)("b", { children: [vehicle.averageMileagePerYear, " km"] }) })) }))] })), localEditMode && (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 12 }, { children: (0, jsx_runtime_1.jsxs)(material_1.FormControl, __assign({ fullWidth: true, margin: "normal", error: Boolean(form.averageMileagePerYear.error) }, { children: [(0, jsx_runtime_1.jsx)(material_1.InputLabel, __assign({ id: "averageMileagePerYear-label" }, { children: "Kilom\u00E9trage moyen annuel" })), (0, jsx_runtime_1.jsxs)(material_1.Select, __assign({ labelId: "averageMileagePerYear-label", id: "averageMileagePerYear", name: "averageMileagePerYear", value: form.averageMileagePerYear.value ?
|
|
220
|
-
String(form.averageMileagePerYear.value) : '', onChange: function (e) { return handleSelectChange(e); }, label: "Kilom\u00E9trage moyen annuel" }, { children: [(0, jsx_runtime_1.jsx)(material_1.MenuItem, __assign({ value: 5000 }, { children: "5 000" })), (0, jsx_runtime_1.jsx)(material_1.MenuItem, __assign({ value: 10000 }, { children: "10 000" })), (0, jsx_runtime_1.jsx)(material_1.MenuItem, __assign({ value: 15000 }, { children: "15 000" })), (0, jsx_runtime_1.jsx)(material_1.MenuItem, __assign({ value: 20000 }, { children: "20 000" })), (0, jsx_runtime_1.jsx)(material_1.MenuItem, __assign({ value: 25000 }, { children: "25 000" })), (0, jsx_runtime_1.jsx)(material_1.MenuItem, __assign({ value: 30000 }, { children: "30 000" })), (0, jsx_runtime_1.jsx)(material_1.MenuItem, __assign({ value: 50000 }, { children: "50 000" })), (0, jsx_runtime_1.jsx)(material_1.MenuItem, __assign({ value: 75000 }, { children: "75 000" })), (0, jsx_runtime_1.jsx)(material_1.MenuItem, __assign({ value: 100000 }, { children: "100 000" })), (0, jsx_runtime_1.jsx)(material_1.MenuItem, __assign({ value: 999999 }, { children: "+100 000" }))] })), (0, jsx_runtime_1.jsx)(material_1.FormHelperText, { children: form.averageMileagePerYear.error })] })) })), !localEditMode && (0, jsx_runtime_1.jsxs)(material_1.Grid, __assign({ container: true, textAlign: 'justify', sx: { pt: 2 } }, { children: [(0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 6 }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ variant: "body1", color: "text.secondary" }, { children: "Pneumatiques :" })) })), (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 6, sx: { textAlign: 'right' } }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ variant: "body1", color: "text.secondary" }, { children: isVehicleTireSizeDefined(vehicle) ? (0, jsx_runtime_1.jsx)("b", { children: (0, Tools_1.formatVehicleTire)(vehicle.tireSize) }) : '-' })) }))] })), localEditMode && (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 12, sx: { mt: 1 } }, { children: (0, jsx_runtime_1.jsx)(MovaVehicleTireField_1.default, { vehicleTire: form.tireSize.value, onChangeVehicleTire: handleOnChangeVehicleTire }) }))] })), !localEditMode && (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 12 }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ variant: "h6", component: "div", align: "center", sx: { mt: 3, mb: 1 }, color: (0, material_1.darken)(theme.palette.primary.main, 0.2) }, { children: "CARNET DU V\u00C9HICULE" })) })), vehicle.documents && ((_b = vehicle.documents) === null || _b === void 0 ? void 0 : _b.
|
|
221
|
-
color: (0, material_1.darken)(theme.palette.primary.main, 0.2) } }, { children: "Ajouter Facture" })) }))] }) })), (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 6, sx: { mt: 2, textAlign: 'center' } }, { children: (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("input", { accept: "image/*", type: "file", style: { display: 'none' }, ref: tirePictureInputRef, id: "raised-button-tire", onChange: function (e) { return handleFileChange(e, Enums_1.DocumentType.VEHICLE_TIRE_PHOTO); } }), (0, jsx_runtime_1.jsx)("label", __assign({ htmlFor: "raised-button-tire" }, { children: (0, jsx_runtime_1.jsx)(material_1.Button, __assign({ component: "span", variant: "outlined", sx: { alignItems: 'normal', width: '90%', mt: 2, mb: 1, height: '70px', p: 1,
|
|
222
|
-
color: (0, material_1.darken)(theme.palette.primary.main, 0.2) } }, { children: "Ajouter Photo Pneu" })) }))] }) }))] }))] })] })), (0, jsx_runtime_1.jsxs)(material_1.CardActions, __assign({ sx: { mt: 3, justifyContent: localEditMode ? 'center' : 'end' } }, { children: [!localEditMode &&
|
|
242
|
+
String(form.averageMileagePerYear.value) : '', onChange: function (e) { return handleSelectChange(e); }, label: "Kilom\u00E9trage moyen annuel" }, { children: [(0, jsx_runtime_1.jsx)(material_1.MenuItem, __assign({ value: 5000 }, { children: "5 000" })), (0, jsx_runtime_1.jsx)(material_1.MenuItem, __assign({ value: 10000 }, { children: "10 000" })), (0, jsx_runtime_1.jsx)(material_1.MenuItem, __assign({ value: 15000 }, { children: "15 000" })), (0, jsx_runtime_1.jsx)(material_1.MenuItem, __assign({ value: 20000 }, { children: "20 000" })), (0, jsx_runtime_1.jsx)(material_1.MenuItem, __assign({ value: 25000 }, { children: "25 000" })), (0, jsx_runtime_1.jsx)(material_1.MenuItem, __assign({ value: 30000 }, { children: "30 000" })), (0, jsx_runtime_1.jsx)(material_1.MenuItem, __assign({ value: 50000 }, { children: "50 000" })), (0, jsx_runtime_1.jsx)(material_1.MenuItem, __assign({ value: 75000 }, { children: "75 000" })), (0, jsx_runtime_1.jsx)(material_1.MenuItem, __assign({ value: 100000 }, { children: "100 000" })), (0, jsx_runtime_1.jsx)(material_1.MenuItem, __assign({ value: 999999 }, { children: "+100 000" }))] })), (0, jsx_runtime_1.jsx)(material_1.FormHelperText, { children: form.averageMileagePerYear.error })] })) })), !localEditMode && (0, jsx_runtime_1.jsxs)(material_1.Grid, __assign({ container: true, textAlign: 'justify', sx: { pt: 2 } }, { children: [(0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 6 }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ variant: "body1", color: "text.secondary" }, { children: "Pneumatiques :" })) })), (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 6, sx: { textAlign: 'right' } }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ variant: "body1", color: "text.secondary" }, { children: isVehicleTireSizeDefined(vehicle) ? (0, jsx_runtime_1.jsx)("b", { children: (0, Tools_1.formatVehicleTire)(vehicle.tireSize) }) : '-' })) }))] })), localEditMode && (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 12, sx: { mt: 1 } }, { children: (0, jsx_runtime_1.jsx)(MovaVehicleTireField_1.default, { vehicleTire: form.tireSize.value, onChangeVehicleTire: handleOnChangeVehicleTire }) }))] })), !localEditMode && (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 12 }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ variant: "h6", component: "div", align: "center", sx: { mt: 3, mb: 1 }, color: (0, material_1.darken)(theme.palette.primary.main, 0.2) }, { children: "CARNET DU V\u00C9HICULE" })) })), vehicle.documents && ((_b = vehicle.documents) === null || _b === void 0 ? void 0 : _b.map(function (invoice, index) { return ((0, jsx_runtime_1.jsxs)(material_1.Grid, __assign({ container: true, sx: { justifyContent: 'space-between', alignItems: 'center' } }, { children: [(0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 11, sx: { textAlign: 'left' } }, { children: (0, jsx_runtime_1.jsx)(material_1.Tooltip, __assign({ title: invoice.originalFileName }, { children: (0, jsx_runtime_1.jsx)(material_1.Link, __assign({ color: (0, material_1.darken)('#F29ABA', 0.2), href: invoice.fileSignedUrl, target: "_blank", rel: "noopener" }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ variant: "body1" }, { children: invoice.fileName + ' ' + (0, DateUtils_1.formatDateByCountryCode)(invoice.creationDate, 'fr', Enums_1.DateFormatTypes.SHORT_FORMAT_DATE) })) })) })) }), (index + 1) * 50), (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 1, sx: { textAlign: 'right' } }, { children: (0, jsx_runtime_1.jsx)(material_1.IconButton, __assign({ disabled: !(0, Tools_1.iAmOwner)(invoice === null || invoice === void 0 ? void 0 : invoice.ownerId), onClick: function (e) { return handleDeleteDocument(e, invoice === null || invoice === void 0 ? void 0 : invoice.id); } }, { children: (0, jsx_runtime_1.jsx)(CloseRounded_2.default, {}) })) }), (index + 1) * 100)] }), index + 1)); })), (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ container: true }, { children: (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 12, sx: { mt: 2, textAlign: 'center' } }, { children: (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("input", { accept: "image/*, application/pdf", type: "file", style: { display: 'none' }, ref: invoiceInputRef, id: "raised-button-invoice", onChange: function (e) { return handleFileChange(e, docTypeCurrent.current); } }), (0, jsx_runtime_1.jsx)(material_1.Button, __assign({ size: 'large', disabled: currentUpload, onClick: function () { return setShowLinkedDocument(true); }, component: "span", variant: "outlined", startIcon: (0, jsx_runtime_1.jsx)(icons_material_1.AttachFile, {}), sx: { alignItems: 'center', width: '90%', mt: 2, mb: 1, height: '50px', p: 1, color: (0, material_1.darken)(theme.palette.primary.main, 0.2) } }, { children: "Ajouter un document" })), currentUpload && (0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ variant: 'body2', sx: { animation: 'blink 1.5s infinite' } }, { children: "Document en cours d'importation..." })), sizeLimit && (0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ variant: 'body1', sx: { animation: 'blink 1.5s infinite' }, color: theme.palette.warning.dark }, { children: "Echec de l'importation car la taille du fichier d\u00E9passe 10Mo" })), !sizeLimit && (0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ variant: 'body2' }, { children: "Taille maximale du fichier : 10Mo" }))] }) })) }))] })] })), (0, jsx_runtime_1.jsxs)(material_1.CardActions, __assign({ sx: { mt: 3, justifyContent: localEditMode ? 'center' : 'end' } }, { children: [!localEditMode &&
|
|
223
243
|
(0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsxs)(material_1.Button, __assign({ onClick: handleOnClickEdit, color: "inherit", sx: { width: '45%' }, variant: 'text' }, { children: [(0, jsx_runtime_1.jsx)(EditRounded_1.default, { sx: { mr: 1 } }), "MODIFIER"] })) }), localEditMode &&
|
|
224
|
-
(0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(material_1.Button, __assign({ onClick: handleOnClickCancel, sx: { width: '45%', color: theme.palette.text.secondary }, variant: 'text' }, { children: [(0, jsx_runtime_1.jsx)(CloseRounded_1.default, { sx: { mr: 1 } }), "ANNULER"] })), (0, jsx_runtime_1.jsxs)(material_1.Button, __assign({ onClick: handleOnClickValidate, sx: { width: '45%', color: (0, material_1.darken)(theme.palette.primary.main, 0.2) }, variant: 'text' }, { children: [(0, jsx_runtime_1.jsx)(EditRounded_1.default, { sx: { mr: 1 } }), "VALIDER"] }))] })] }))] })), localEditMode && onDelete &&
|
|
225
|
-
(0, jsx_runtime_1.jsx)(material_1.Button, __assign({ onClick: function (e) { return handleOnClickDeleteVehicle(e); }, sx: {
|
|
226
|
-
|
|
244
|
+
(0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(material_1.Button, __assign({ onClick: handleOnClickCancel, sx: { width: '45%', color: theme.palette.text.secondary }, variant: 'text' }, { children: [(0, jsx_runtime_1.jsx)(CloseRounded_1.default, { sx: { mr: 1 } }), "ANNULER"] })), (0, jsx_runtime_1.jsxs)(material_1.Button, __assign({ onClick: handleOnClickValidate, sx: { width: '45%', color: (0, material_1.darken)(theme.palette.primary.main, 0.2) }, variant: 'text' }, { children: [(0, jsx_runtime_1.jsx)(EditRounded_1.default, { sx: { mr: 1 } }), "VALIDER"] }))] })] }))] })), isShowLinkedDocument && (0, jsx_runtime_1.jsx)(LinkedDocumentDialog_1.LinkedDocumentDialog, { isVehicle: true, isShowLinkedDocument: isShowLinkedDocument, appType: appType, toggleShowLinkedDocument: toggleShowLinkedDocument, message: messageRGPD }), localEditMode && onDelete &&
|
|
245
|
+
(0, jsx_runtime_1.jsx)(material_1.Button, __assign({ onClick: function (e) { return handleOnClickDeleteVehicle(e); }, sx: {
|
|
246
|
+
width: '90', mt: 4, color: theme.palette.error.light,
|
|
247
|
+
borderColor: theme.palette.error.light
|
|
248
|
+
}, variant: 'outlined' }, { children: "Supprimer le v\u00E9hicule" })), (0, jsx_runtime_1.jsx)(ConfirmationDialog_1.default, { open: openConfirmDocumentDelete, onClose: handleCloseConfirmDocumentDelete, onConfirm: handleConfirmDocumentDelete, message: "\u00CAtes-vous s\u00FBr de vouloir supprimer ce document ?" }), (0, jsx_runtime_1.jsx)(ConfirmationDialog_1.default, { open: openConfirmVehicleDelete, onClose: handleCloseConfirmVehicleDelete, onConfirm: handleConfirmVehicleDelete, message: "\u00CAtes-vous s\u00FBr de vouloir supprimer ce v\u00E9hicule ?" })] }));
|
|
227
249
|
};
|
|
228
250
|
exports.default = VehicleFullCard;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FunctionComponent } from 'react';
|
|
2
|
+
interface VehiclePlateFieldProps {
|
|
3
|
+
onValidVehiclePlate: (vehiclePlate: string) => void;
|
|
4
|
+
}
|
|
5
|
+
export declare const regexPlate: RegExp;
|
|
6
|
+
export declare const oldRegexPlate: RegExp;
|
|
7
|
+
declare const VehiclePlateField: FunctionComponent<VehiclePlateFieldProps>;
|
|
8
|
+
export default VehiclePlateField;
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.oldRegexPlate = exports.regexPlate = void 0;
|
|
18
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
19
|
+
var react_1 = require("react");
|
|
20
|
+
var TextField_1 = __importDefault(require("@mui/material/TextField"));
|
|
21
|
+
var material_1 = require("@mui/material");
|
|
22
|
+
var SearchRounded_1 = __importDefault(require("@mui/icons-material/SearchRounded"));
|
|
23
|
+
var Enums_1 = require("../../helpers/Enums");
|
|
24
|
+
var Logger_1 = __importDefault(require("../../helpers/Logger"));
|
|
25
|
+
// Regex pour une plaque d'immatriculation française (nouveau format SIV)
|
|
26
|
+
exports.regexPlate = /^[A-Z]{2}-\d{3}-[A-Z]{2}$/;
|
|
27
|
+
// Regex pour une plaque d'immatriculation française (ancien format FNI)
|
|
28
|
+
exports.oldRegexPlate = /^\d{1,4}[ -]?[A-Z]{1,4}[ -]?\d{1,4}$/;
|
|
29
|
+
var VehiclePlateField = function (_a) {
|
|
30
|
+
var onValidVehiclePlate = _a.onValidVehiclePlate;
|
|
31
|
+
var _b = (0, react_1.useState)(''), value = _b[0], setValue = _b[1];
|
|
32
|
+
var _c = (0, react_1.useState)(false), error = _c[0], setError = _c[1];
|
|
33
|
+
var _d = (0, react_1.useState)(0), lastLength = _d[0], setLastLength = _d[1]; // Ajout d'un état pour stocker la longueur précédente
|
|
34
|
+
var _e = (0, react_1.useState)(''), helperText = _e[0], setHelperText = _e[1];
|
|
35
|
+
// Hook de validation de la plaque
|
|
36
|
+
(0, react_1.useEffect)(function () {
|
|
37
|
+
if (!error && value !== '' && value.match(exports.regexPlate)) {
|
|
38
|
+
onValidVehiclePlate(value);
|
|
39
|
+
}
|
|
40
|
+
}, [error, value, onValidVehiclePlate]);
|
|
41
|
+
var getPlateFormat = function (plate) {
|
|
42
|
+
if (plate === '') {
|
|
43
|
+
// Si la saisie est vide, retournez un format par défaut (nouveau format, par exemple)
|
|
44
|
+
return undefined;
|
|
45
|
+
}
|
|
46
|
+
if (/^[A-Za-z]/.test(plate)) {
|
|
47
|
+
// Commence par une lettre => nouveau format
|
|
48
|
+
return Enums_1.VehiclePlateFormat.FRENCH_NEW;
|
|
49
|
+
}
|
|
50
|
+
else if (/^\d/.test(plate)) {
|
|
51
|
+
// Commence par un chiffre => ancien format
|
|
52
|
+
return Enums_1.VehiclePlateFormat.FRENCH_OLD;
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
Logger_1.default.error("Format de plaque inconnu");
|
|
56
|
+
// On retourne le nouveau format par défaut
|
|
57
|
+
return Enums_1.VehiclePlateFormat.FRENCH_NEW;
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
var handleChange = function (e) {
|
|
61
|
+
var inputValue = e.target.value.toUpperCase().replace(/[^A-Z0-9]/g, ''); // Convertir en majuscules et supprimer les caractères non valides
|
|
62
|
+
// Si la saisie commence par une lettre, on contrôle l'ancien format, sinon le nouveau
|
|
63
|
+
switch (getPlateFormat(inputValue)) {
|
|
64
|
+
case Enums_1.VehiclePlateFormat.FRENCH_NEW: {
|
|
65
|
+
setHelperText((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["Format d\u00E9tect\u00E9 : ", (0, jsx_runtime_1.jsx)("b", { children: "AA-111-AA" })] }));
|
|
66
|
+
handleChangeFrenchNew(inputValue);
|
|
67
|
+
break;
|
|
68
|
+
}
|
|
69
|
+
case Enums_1.VehiclePlateFormat.FRENCH_OLD: {
|
|
70
|
+
setHelperText((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["Format d\u00E9tect\u00E9 (ancien) : ", (0, jsx_runtime_1.jsx)("b", { children: "1111 AAAA 1111" }), (0, jsx_runtime_1.jsx)("br", {}), "Pour lancer la recherche, cliquez sur ", (0, jsx_runtime_1.jsx)(SearchRounded_1.default, {})] }));
|
|
71
|
+
handleChangeFrenchOld(inputValue);
|
|
72
|
+
break;
|
|
73
|
+
}
|
|
74
|
+
case undefined: {
|
|
75
|
+
setHelperText('');
|
|
76
|
+
setValue('');
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
var validatePlate = function () {
|
|
81
|
+
if (exports.oldRegexPlate.test(value)) {
|
|
82
|
+
onValidVehiclePlate(value);
|
|
83
|
+
}
|
|
84
|
+
setError(!exports.oldRegexPlate.test(value));
|
|
85
|
+
};
|
|
86
|
+
var handleChangeFrenchOld = function (inputValue) {
|
|
87
|
+
// ON bloque la saisie à 12 caractères max (limite des anciennes plaques)
|
|
88
|
+
if (!(inputValue.length > 12)) {
|
|
89
|
+
setValue(inputValue);
|
|
90
|
+
}
|
|
91
|
+
setLastLength(inputValue.length); // Mettre à jour la longueur précédente
|
|
92
|
+
};
|
|
93
|
+
var handleChangeFrenchNew = function (inputValue) {
|
|
94
|
+
// Vérifier si l'utilisateur est en train de supprimer un caractère
|
|
95
|
+
var isDeleting = inputValue.length < lastLength;
|
|
96
|
+
// Supprimer les tirets pour avoir une chaîne propre
|
|
97
|
+
var cleanInput = inputValue.replace(/-/g, '');
|
|
98
|
+
// Ajouter des tirets aux positions appropriées
|
|
99
|
+
if (cleanInput.length > 1 && !(cleanInput.length == 2 && isDeleting)) {
|
|
100
|
+
inputValue = "".concat(cleanInput.slice(0, 2), "-").concat(cleanInput.slice(2));
|
|
101
|
+
}
|
|
102
|
+
if (cleanInput.length > 4 && !(cleanInput.length == 5 && isDeleting)) {
|
|
103
|
+
inputValue = "".concat(cleanInput.slice(0, 2), "-").concat(cleanInput.slice(2, 5), "-").concat(cleanInput.slice(5, 7));
|
|
104
|
+
}
|
|
105
|
+
setValue(inputValue);
|
|
106
|
+
// On teste la plaque une fois la saisie terminée
|
|
107
|
+
if (inputValue.length == 9) {
|
|
108
|
+
setError(!exports.regexPlate.test(inputValue));
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
setError(false);
|
|
112
|
+
}
|
|
113
|
+
setLastLength(inputValue.length); // Mettre à jour la longueur précédente
|
|
114
|
+
};
|
|
115
|
+
return ((0, jsx_runtime_1.jsx)(TextField_1.default, { label: "Plaque d'immatriculation", variant: "outlined", value: value, onChange: handleChange, error: error, autoFocus: true, sx: {
|
|
116
|
+
width: '100%',
|
|
117
|
+
'& input': { textTransform: 'uppercase' } // CSS pour forcer les majuscules dans l'input
|
|
118
|
+
}, helperText: lastLength > 0 ? helperText : '', InputProps: {
|
|
119
|
+
endAdornment: ((0, jsx_runtime_1.jsx)(material_1.InputAdornment, __assign({ position: "end", sx: { mr: 1, display: getPlateFormat(value) === Enums_1.VehiclePlateFormat.FRENCH_OLD ? 'inherit' : 'none' } }, { children: (0, jsx_runtime_1.jsx)(material_1.IconButton, __assign({ edge: "end", onClick: validatePlate }, { children: (0, jsx_runtime_1.jsx)(SearchRounded_1.default, {}) })) }))),
|
|
120
|
+
} }));
|
|
121
|
+
};
|
|
122
|
+
exports.default = VehiclePlateField;
|
|
@@ -9,8 +9,9 @@ exports.COOKIE_PRO_TOKEN = 'movalibProToken';
|
|
|
9
9
|
exports.COOKIE_INDIVIDUAL_TOKEN = 'movalibIndividualToken';
|
|
10
10
|
exports.COOKIE_DEFAULT_EXPIRES = 7;
|
|
11
11
|
var createCookie = function (name, value) {
|
|
12
|
+
console.log('from lib', name, value);
|
|
12
13
|
if (name && value) {
|
|
13
|
-
js_cookie_1.default.set(name, value, { expires: exports.COOKIE_DEFAULT_EXPIRES, sameSite: '
|
|
14
|
+
js_cookie_1.default.set(name, value, { expires: exports.COOKIE_DEFAULT_EXPIRES, sameSite: 'Lax' });
|
|
14
15
|
}
|
|
15
16
|
};
|
|
16
17
|
exports.createCookie = createCookie;
|
|
@@ -151,6 +151,10 @@ export declare enum DigitalPassportIndex {
|
|
|
151
151
|
C = "C"
|
|
152
152
|
}
|
|
153
153
|
export declare enum EventState {
|
|
154
|
+
/**
|
|
155
|
+
* Demande d'empreinte bancaire (pour validation de la demande de RDV)
|
|
156
|
+
*/
|
|
157
|
+
REQUIRES_PAYMENT_AUTHORIZATION = "REQUIRES_PAYMENT_AUTHORIZATION",
|
|
154
158
|
/**
|
|
155
159
|
* Nouvelle demande de rendez-vous (origine client OU centre)
|
|
156
160
|
*/
|
|
@@ -207,8 +211,13 @@ export declare enum DocumentType {
|
|
|
207
211
|
USER_BANK_DETAILS = "USER_BANK_DETAILS",
|
|
208
212
|
USER_APPOINTMENT_QUOTE = "USER_APPOINTMENT_QUOTE",
|
|
209
213
|
VEHICLE_MAINTENANCE_INVOICE = "VEHICLE_MAINTENANCE_INVOICE",
|
|
214
|
+
GARAGE_LOGO = "GARAGE_LOGO",
|
|
210
215
|
VEHICLE_TIRE_PHOTO = "VEHICLE_TIRE_PHOTO",
|
|
211
|
-
|
|
216
|
+
VEHICLE_INSPECTION = "VEHICLE_INSPECTION",
|
|
217
|
+
VEHICLE_OTHER = "VEHICLE_OTHER",
|
|
218
|
+
EVENT_OTHER = "EVENT_OTHER",
|
|
219
|
+
EVENT_VISUAL_PROOFS = "EVENT_VISUAL_PROOFS",
|
|
220
|
+
EVENT_MAINTENANCE = "EVENT_MAINTENANCE"
|
|
212
221
|
}
|
|
213
222
|
export declare enum MovaAppType {
|
|
214
223
|
/**
|
|
@@ -173,6 +173,10 @@ var DigitalPassportIndex;
|
|
|
173
173
|
})(DigitalPassportIndex = exports.DigitalPassportIndex || (exports.DigitalPassportIndex = {}));
|
|
174
174
|
var EventState;
|
|
175
175
|
(function (EventState) {
|
|
176
|
+
/**
|
|
177
|
+
* Demande d'empreinte bancaire (pour validation de la demande de RDV)
|
|
178
|
+
*/
|
|
179
|
+
EventState["REQUIRES_PAYMENT_AUTHORIZATION"] = "REQUIRES_PAYMENT_AUTHORIZATION";
|
|
176
180
|
/**
|
|
177
181
|
* Nouvelle demande de rendez-vous (origine client OU centre)
|
|
178
182
|
*/
|
|
@@ -233,8 +237,13 @@ var DocumentType;
|
|
|
233
237
|
DocumentType["USER_BANK_DETAILS"] = "USER_BANK_DETAILS";
|
|
234
238
|
DocumentType["USER_APPOINTMENT_QUOTE"] = "USER_APPOINTMENT_QUOTE";
|
|
235
239
|
DocumentType["VEHICLE_MAINTENANCE_INVOICE"] = "VEHICLE_MAINTENANCE_INVOICE";
|
|
236
|
-
DocumentType["VEHICLE_TIRE_PHOTO"] = "VEHICLE_TIRE_PHOTO";
|
|
237
240
|
DocumentType["GARAGE_LOGO"] = "GARAGE_LOGO";
|
|
241
|
+
DocumentType["VEHICLE_TIRE_PHOTO"] = "VEHICLE_TIRE_PHOTO";
|
|
242
|
+
DocumentType["VEHICLE_INSPECTION"] = "VEHICLE_INSPECTION";
|
|
243
|
+
DocumentType["VEHICLE_OTHER"] = "VEHICLE_OTHER";
|
|
244
|
+
DocumentType["EVENT_OTHER"] = "EVENT_OTHER";
|
|
245
|
+
DocumentType["EVENT_VISUAL_PROOFS"] = "EVENT_VISUAL_PROOFS";
|
|
246
|
+
DocumentType["EVENT_MAINTENANCE"] = "EVENT_MAINTENANCE";
|
|
238
247
|
})(DocumentType = exports.DocumentType || (exports.DocumentType = {}));
|
|
239
248
|
var MovaAppType;
|
|
240
249
|
(function (MovaAppType) {
|