@movalib/movalib-commons 1.62.3 → 1.63.0
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/devIndex.tsx +15 -4
- package/dist/devIndex.js +10 -2
- package/dist/index.d.ts +2 -1
- package/dist/index.js +6 -4
- package/dist/src/components/MovaTableBack/MovaTableBack.d.ts +25 -0
- package/dist/src/components/MovaTableBack/MovaTableBack.js +95 -0
- package/dist/src/components/vehicle/VehicleFullCard.js +5 -3
- package/dist/src/components/vehicle/VehiclePlateField.d.ts +5 -1
- package/dist/src/components/vehicle/VehiclePlateField.js +74 -16
- package/dist/src/helpers/Enums.d.ts +4 -2
- package/dist/src/helpers/Enums.js +2 -0
- package/dist/src/helpers/Tools.d.ts +1 -1
- package/dist/src/helpers/Tools.js +18 -9
- package/dist/src/models/Customer.d.ts +3 -1
- package/dist/src/models/Customer.js +9 -5
- package/dist/src/models/Document.d.ts +4 -1
- package/dist/src/models/Document.js +10 -2
- package/dist/src/models/Garage.d.ts +11 -7
- package/dist/src/models/Garage.js +5 -1
- package/dist/src/models/Vehicle.d.ts +2 -1
- package/dist/src/models/Vehicle.js +2 -1
- package/dist/src/services/GarageService.types.d.ts +2 -0
- package/index.ts +2 -1
- package/package.json +1 -1
- package/src/components/MovaTableBack/MovaTableBack.tsx +249 -0
- package/src/components/vehicle/VehicleFullCard.tsx +47 -43
- package/src/components/vehicle/VehiclePlateField.tsx +112 -28
- package/src/helpers/Enums.ts +2 -0
- package/src/helpers/Tools.ts +18 -8
- package/src/models/Customer.ts +49 -45
- package/src/models/Document.ts +20 -2
- package/src/models/Garage.ts +121 -104
- package/src/models/Vehicle.ts +4 -1
- package/src/services/GarageService.types.ts +2 -0
- package/dist/src/VehiclePlateField.d.ts +0 -8
- package/dist/src/VehiclePlateField.js +0 -122
- package/src/VehiclePlateField.tsx +0 -165
package/devIndex.tsx
CHANGED
|
@@ -35,6 +35,8 @@ const App = () => {
|
|
|
35
35
|
// Chargement de données garage de test
|
|
36
36
|
const [garage, setGarage] = useState<Garage>();
|
|
37
37
|
const [openAccountValidation, setOpenAccountValidation] = useState<Boolean>(false);
|
|
38
|
+
const [plateCountry, setPlateCountry] = useState<"FR" | "INTL">("FR");
|
|
39
|
+
const [plateModel, setPlateModel] = useState<string>();
|
|
38
40
|
|
|
39
41
|
useEffect(() => {
|
|
40
42
|
refreshGarageData();
|
|
@@ -119,10 +121,19 @@ const App = () => {
|
|
|
119
121
|
gender: undefined
|
|
120
122
|
}} />
|
|
121
123
|
|
|
122
|
-
<Container
|
|
123
|
-
<VehiclePlateField
|
|
124
|
-
|
|
125
|
-
|
|
124
|
+
<Container sx={{ width: '400px', mt: 2}}>
|
|
125
|
+
<VehiclePlateField
|
|
126
|
+
onCountryChange={(country) => {
|
|
127
|
+
console.log("Changement pays :", country);
|
|
128
|
+
setPlateCountry(country);
|
|
129
|
+
}}
|
|
130
|
+
onValidVehiclePlate={function (vehiclePlate: string, country: string): void {
|
|
131
|
+
console.log('plaque valide, pays :', country);
|
|
132
|
+
}} country={plateCountry} model={plateModel}
|
|
133
|
+
onModelChange={(model) => {
|
|
134
|
+
console.log("Changement modèle :", model);
|
|
135
|
+
setPlateModel(model);
|
|
136
|
+
}}/>
|
|
126
137
|
</Container>
|
|
127
138
|
<Container style={flexCenter} sx={{ width: '400px', mt: 2}}>
|
|
128
139
|
<MovaVehicleTireField onChangeVehicleTire={(vehicleTire) => {
|
package/dist/devIndex.js
CHANGED
|
@@ -69,6 +69,8 @@ var App = function () {
|
|
|
69
69
|
// Chargement de données garage de test
|
|
70
70
|
var _a = (0, react_1.useState)(), garage = _a[0], setGarage = _a[1];
|
|
71
71
|
var _b = (0, react_1.useState)(false), openAccountValidation = _b[0], setOpenAccountValidation = _b[1];
|
|
72
|
+
var _c = (0, react_1.useState)("FR"), plateCountry = _c[0], setPlateCountry = _c[1];
|
|
73
|
+
var _d = (0, react_1.useState)(), plateModel = _d[0], setPlateModel = _d[1];
|
|
72
74
|
(0, react_1.useEffect)(function () {
|
|
73
75
|
refreshGarageData();
|
|
74
76
|
}, []);
|
|
@@ -130,8 +132,14 @@ var App = function () {
|
|
|
130
132
|
return;
|
|
131
133
|
}, form: {
|
|
132
134
|
gender: undefined
|
|
133
|
-
} }), (0, jsx_runtime_1.jsx)(material_1.Container, __assign({
|
|
134
|
-
|
|
135
|
+
} }), (0, jsx_runtime_1.jsx)(material_1.Container, __assign({ sx: { width: '400px', mt: 2 } }, { children: (0, jsx_runtime_1.jsx)(VehiclePlateField_1.default, { onCountryChange: function (country) {
|
|
136
|
+
console.log("Changement pays :", country);
|
|
137
|
+
setPlateCountry(country);
|
|
138
|
+
}, onValidVehiclePlate: function (vehiclePlate, country) {
|
|
139
|
+
console.log('plaque valide, pays :', country);
|
|
140
|
+
}, country: plateCountry, model: plateModel, onModelChange: function (model) {
|
|
141
|
+
console.log("Changement modèle :", model);
|
|
142
|
+
setPlateModel(model);
|
|
135
143
|
} }) })), (0, jsx_runtime_1.jsx)(material_1.Container, __assign({ style: Tools_1.flexCenter, sx: { width: '400px', mt: 2 } }, { children: (0, jsx_runtime_1.jsx)(MovaVehicleTireField_1.default, { onChangeVehicleTire: function (vehicleTire) {
|
|
136
144
|
console.log('formatVehicleTire', (0, Tools_1.formatVehicleTire)(vehicleTire));
|
|
137
145
|
} }) })), (0, jsx_runtime_1.jsx)(MovaLogin_1.default, { darkMode: false, movaAppType: Enums_1.MovaAppType.INDIVIDUAL, version: "0.1.3", onSubmit: function (form) {
|
package/dist/index.d.ts
CHANGED
|
@@ -27,6 +27,7 @@ export { QrCodePLVContainer } from './src/components/QrCodePLVContainer/QrCodePL
|
|
|
27
27
|
export { PLVComponent, PrintSize } from './src/components/QrCodePLVContainer/PLVComponent';
|
|
28
28
|
export { LinkedDocumentDialog } from './src/components/LinkedDocumentDialog';
|
|
29
29
|
export { default as MovaTable } from './src/components/MovaTable/MovaTable';
|
|
30
|
+
export { default as MovaTableBack } from "./src/components/MovaTableBack/MovaTableBack";
|
|
30
31
|
export { default as Subscription } from './src/models/Subscription';
|
|
31
32
|
export { default as Absence } from './src/models/Absence';
|
|
32
33
|
export { default as Employee } from './src/models/Employee';
|
|
@@ -51,7 +52,7 @@ export type { APIRequest, APIResponse } from './src/helpers/ApiHelper';
|
|
|
51
52
|
export type { DaySchedule, DayInterval } from './src/ScheduleFields';
|
|
52
53
|
export type { MovaFormField, MovaLoginForm, MovaUserSignUpForm, MovaInterval, MovaVehicleForm, AddressFieldName, } from './src/helpers/Types';
|
|
53
54
|
export { readCookie, deleteCookie } from './src/helpers/CookieUtils';
|
|
54
|
-
export { validateField, formatVehicleTire,
|
|
55
|
+
export { validateField, formatVehicleTire, formatVehiclePlate, isEmpty, getApplicationShortLabel, capitalizeFirstLetter, flexLeftRow, formatPhoneNumber, getFormattedSchedule, getFormattedIntervals, findScheduleByDayOfWeek, getDayOfWeekLabel, isSafariOniOS, getApplicationsShortLabels, } from './src/helpers/Tools';
|
|
55
56
|
export { validatePhoneNumber, validateText, validateEmail } from './src/helpers/Validator';
|
|
56
57
|
export { formatDateByTimezone, getLongFormattedDateTime } from './src/helpers/DateUtils';
|
|
57
58
|
export { request, API_BASE_URL } from './src/helpers/ApiHelper';
|
package/dist/index.js
CHANGED
|
@@ -4,9 +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.
|
|
9
|
-
exports.StyledToggleButtonGroup = exports.StyledToggleButton = exports.openDialogPrint = void 0;
|
|
7
|
+
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.MovaTableBack = exports.MovaTable = 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.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.formatDateByTimezone = exports.validateEmail = exports.validateText = exports.validatePhoneNumber = exports.getApplicationsShortLabels = exports.isSafariOniOS = exports.getDayOfWeekLabel = exports.findScheduleByDayOfWeek = exports.getFormattedIntervals = exports.getFormattedSchedule = exports.formatPhoneNumber = exports.flexLeftRow = exports.capitalizeFirstLetter = exports.getApplicationShortLabel = exports.isEmpty = exports.formatVehiclePlate = exports.formatVehicleTire = exports.validateField = exports.deleteCookie = exports.readCookie = exports.CategoryPrestation = exports.VehicleTire = exports.Event = void 0;
|
|
9
|
+
exports.StyledToggleButtonGroup = exports.StyledToggleButton = exports.openDialogPrint = exports.APIMethod = void 0;
|
|
10
10
|
// Export des services
|
|
11
11
|
var VehicleService_1 = require("./src/services/VehicleService");
|
|
12
12
|
Object.defineProperty(exports, "VehicleService", { enumerable: true, get: function () { return __importDefault(VehicleService_1).default; } });
|
|
@@ -70,6 +70,8 @@ var LinkedDocumentDialog_1 = require("./src/components/LinkedDocumentDialog");
|
|
|
70
70
|
Object.defineProperty(exports, "LinkedDocumentDialog", { enumerable: true, get: function () { return LinkedDocumentDialog_1.LinkedDocumentDialog; } });
|
|
71
71
|
var MovaTable_1 = require("./src/components/MovaTable/MovaTable");
|
|
72
72
|
Object.defineProperty(exports, "MovaTable", { enumerable: true, get: function () { return __importDefault(MovaTable_1).default; } });
|
|
73
|
+
var MovaTableBack_1 = require("./src/components/MovaTableBack/MovaTableBack");
|
|
74
|
+
Object.defineProperty(exports, "MovaTableBack", { enumerable: true, get: function () { return __importDefault(MovaTableBack_1).default; } });
|
|
73
75
|
// Export des classes
|
|
74
76
|
var Subscription_1 = require("./src/models/Subscription");
|
|
75
77
|
Object.defineProperty(exports, "Subscription", { enumerable: true, get: function () { return __importDefault(Subscription_1).default; } });
|
|
@@ -118,7 +120,7 @@ Object.defineProperty(exports, "deleteCookie", { enumerable: true, get: function
|
|
|
118
120
|
var Tools_1 = require("./src/helpers/Tools");
|
|
119
121
|
Object.defineProperty(exports, "validateField", { enumerable: true, get: function () { return Tools_1.validateField; } });
|
|
120
122
|
Object.defineProperty(exports, "formatVehicleTire", { enumerable: true, get: function () { return Tools_1.formatVehicleTire; } });
|
|
121
|
-
Object.defineProperty(exports, "
|
|
123
|
+
Object.defineProperty(exports, "formatVehiclePlate", { enumerable: true, get: function () { return Tools_1.formatVehiclePlate; } });
|
|
122
124
|
Object.defineProperty(exports, "isEmpty", { enumerable: true, get: function () { return Tools_1.isEmpty; } });
|
|
123
125
|
Object.defineProperty(exports, "getApplicationShortLabel", { enumerable: true, get: function () { return Tools_1.getApplicationShortLabel; } });
|
|
124
126
|
Object.defineProperty(exports, "capitalizeFirstLetter", { enumerable: true, get: function () { return Tools_1.capitalizeFirstLetter; } });
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ComponentType, MouseEvent } from "react";
|
|
2
|
+
type TMovaTable<T> = {
|
|
3
|
+
useDataHook: (page: number, rowsPerPage: number, search?: string) => {
|
|
4
|
+
data: T[];
|
|
5
|
+
totalElements: number;
|
|
6
|
+
isLoading: boolean;
|
|
7
|
+
refresh: () => void;
|
|
8
|
+
};
|
|
9
|
+
displayedColumns: {
|
|
10
|
+
displayName: string;
|
|
11
|
+
component: ComponentType<{
|
|
12
|
+
element: T;
|
|
13
|
+
}>;
|
|
14
|
+
autoWidth?: boolean;
|
|
15
|
+
}[];
|
|
16
|
+
pagination?: number[];
|
|
17
|
+
compact?: boolean;
|
|
18
|
+
onRowClick?: (data: T) => void;
|
|
19
|
+
onRowRightClick?: (data: T, event: MouseEvent<HTMLTableRowElement>) => void;
|
|
20
|
+
isClickable?: (data: T) => boolean;
|
|
21
|
+
onRowDoubleClick?: (data: T) => void;
|
|
22
|
+
filterChildren?: React.ReactNode;
|
|
23
|
+
};
|
|
24
|
+
export default function MovaTableBack<T>({ useDataHook, displayedColumns, pagination, compact, onRowClick, onRowRightClick, onRowDoubleClick, isClickable, filterChildren, }: TMovaTable<T>): import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,95 @@
|
|
|
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
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
18
|
+
var icons_material_1 = require("@mui/icons-material");
|
|
19
|
+
var Search_1 = __importDefault(require("@mui/icons-material/Search"));
|
|
20
|
+
var material_1 = require("@mui/material");
|
|
21
|
+
var react_1 = require("react");
|
|
22
|
+
function MovaTableBack(_a) {
|
|
23
|
+
var useDataHook = _a.useDataHook, displayedColumns = _a.displayedColumns, pagination = _a.pagination, compact = _a.compact, onRowClick = _a.onRowClick, onRowRightClick = _a.onRowRightClick, onRowDoubleClick = _a.onRowDoubleClick, isClickable = _a.isClickable, filterChildren = _a.filterChildren;
|
|
24
|
+
var _b = (0, react_1.useState)(0), currentPageIndex = _b[0], setCurrentPageIndex = _b[1];
|
|
25
|
+
var _c = (0, react_1.useState)(25), rowsPerPage = _c[0], setRowsPerPage = _c[1];
|
|
26
|
+
var _d = (0, react_1.useState)(""), search = _d[0], setSearch = _d[1];
|
|
27
|
+
var clickTimeout = (0, react_1.useRef)(null);
|
|
28
|
+
var _e = useDataHook(currentPageIndex, rowsPerPage, search), data = _e.data, totalElements = _e.totalElements, isLoading = _e.isLoading, refresh = _e.refresh;
|
|
29
|
+
var handleDoubleClick = (0, react_1.useCallback)(function (element) {
|
|
30
|
+
if (!onRowDoubleClick)
|
|
31
|
+
return;
|
|
32
|
+
if (clickTimeout.current) {
|
|
33
|
+
clearTimeout(clickTimeout.current);
|
|
34
|
+
clickTimeout.current = null;
|
|
35
|
+
}
|
|
36
|
+
onRowDoubleClick(element);
|
|
37
|
+
}, [onRowDoubleClick]);
|
|
38
|
+
var handleRowClick = (0, react_1.useCallback)(function (element) {
|
|
39
|
+
if (!onRowClick)
|
|
40
|
+
return;
|
|
41
|
+
if (clickTimeout.current)
|
|
42
|
+
return;
|
|
43
|
+
clickTimeout.current = setTimeout(function () {
|
|
44
|
+
onRowClick(element);
|
|
45
|
+
clickTimeout.current = null;
|
|
46
|
+
}, 200);
|
|
47
|
+
}, [onRowClick]);
|
|
48
|
+
var handlePageChange = function (event, page) {
|
|
49
|
+
setCurrentPageIndex(page);
|
|
50
|
+
};
|
|
51
|
+
var handleRowsPerPageChange = function (event) {
|
|
52
|
+
setCurrentPageIndex(0);
|
|
53
|
+
setRowsPerPage(Number(event.target.value));
|
|
54
|
+
};
|
|
55
|
+
var handleSearchChange = (0, material_1.debounce)(function (event) {
|
|
56
|
+
var search = event === null || event === void 0 ? void 0 : event.target.value;
|
|
57
|
+
if (search.length > 2) {
|
|
58
|
+
setSearch(search);
|
|
59
|
+
setCurrentPageIndex(0);
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
setSearch("");
|
|
63
|
+
setCurrentPageIndex(0);
|
|
64
|
+
}
|
|
65
|
+
}, 700);
|
|
66
|
+
return ((0, jsx_runtime_1.jsxs)("div", __assign({ style: { height: "100%", display: "flex", flexDirection: "column" } }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Box, __assign({ sx: {
|
|
67
|
+
width: "50%",
|
|
68
|
+
my: 2,
|
|
69
|
+
px: 2,
|
|
70
|
+
display: "flex",
|
|
71
|
+
gap: 2,
|
|
72
|
+
} }, { children: [(0, jsx_runtime_1.jsx)(material_1.TextField, { size: "small", type: "search", onChange: handleSearchChange, inputProps: {
|
|
73
|
+
startAdornment: ((0, jsx_runtime_1.jsx)(material_1.InputAdornment, __assign({ position: "start" }, { children: (0, jsx_runtime_1.jsx)(Search_1.default, {}) }))),
|
|
74
|
+
}, sx: { width: "100%" }, placeholder: "Rechercher" }), refresh && ((0, jsx_runtime_1.jsx)(material_1.Button, __assign({ size: "small", onClick: refresh, variant: "contained" }, { children: (0, jsx_runtime_1.jsx)(icons_material_1.Refresh, {}) })))] })), filterChildren && filterChildren, (0, jsx_runtime_1.jsx)(material_1.TableContainer, __assign({ sx: { height: "100%" }, component: material_1.Paper }, { children: (0, jsx_runtime_1.jsxs)(material_1.Table, __assign({ size: compact ? "small" : "medium", sx: { height: "100%" }, stickyHeader: true }, { children: [(0, jsx_runtime_1.jsx)(material_1.TableHead, { children: (0, jsx_runtime_1.jsx)(material_1.TableRow, { children: displayedColumns.map(function (column, index) { return ((0, jsx_runtime_1.jsx)(material_1.TableCell, { children: column.displayName }, index)); }) }) }), (0, jsx_runtime_1.jsxs)(material_1.TableBody, __assign({ sx: { overflowY: "auto" } }, { children: [isLoading && ((0, jsx_runtime_1.jsx)(material_1.TableRow, { children: (0, jsx_runtime_1.jsx)(material_1.TableCell, __assign({ colSpan: 5, sx: { padding: 0 } }, { children: (0, jsx_runtime_1.jsx)(material_1.LinearProgress, {}) })) })), (data === null || data === void 0 ? void 0 : data.length) !== 0 &&
|
|
75
|
+
(data === null || data === void 0 ? void 0 : data.map(function (element, index) { return ((0, jsx_runtime_1.jsx)(material_1.TableRow, __assign({ onDoubleClick: function () {
|
|
76
|
+
handleDoubleClick(element);
|
|
77
|
+
}, onClick: function () { return handleRowClick(element); }, onContextMenu: function (event) {
|
|
78
|
+
return onRowRightClick && onRowRightClick(element, event);
|
|
79
|
+
}, sx: {
|
|
80
|
+
backgroundColor: "white",
|
|
81
|
+
cursor: isClickable
|
|
82
|
+
? isClickable(element)
|
|
83
|
+
? "pointer"
|
|
84
|
+
: "default"
|
|
85
|
+
: "pointer",
|
|
86
|
+
height: "auto",
|
|
87
|
+
}, hover: true }, { children: displayedColumns.map(function (column, index) { return ((0, jsx_runtime_1.jsx)(material_1.TableCell, __assign({ sx: column.autoWidth
|
|
88
|
+
? {
|
|
89
|
+
whiteSpace: "nowrap",
|
|
90
|
+
width: "1%",
|
|
91
|
+
maxWidth: "fit-content",
|
|
92
|
+
}
|
|
93
|
+
: {} }, { children: column.component && ((0, jsx_runtime_1.jsx)(column.component, { element: element })) }), index)); }) }), index)); })), (0, jsx_runtime_1.jsx)(material_1.TableRow, { sx: { height: "100%" } })] })), pagination && pagination.length > 0 && ((0, jsx_runtime_1.jsx)(material_1.TableFooter, __assign({ sx: { position: "sticky", bottom: 0, backgroundColor: "white" } }, { children: (0, jsx_runtime_1.jsx)(material_1.TableRow, { children: (0, jsx_runtime_1.jsx)(material_1.TablePagination, { count: totalElements, onPageChange: handlePageChange, page: currentPageIndex, rowsPerPage: rowsPerPage, labelRowsPerPage: "Lignes par page :", onRowsPerPageChange: handleRowsPerPageChange, rowsPerPageOptions: pagination }) }) })))] })) }))] })));
|
|
94
|
+
}
|
|
95
|
+
exports.default = MovaTableBack;
|
|
@@ -229,7 +229,7 @@ var VehicleFullCard = function (_a) {
|
|
|
229
229
|
overflow: "visible",
|
|
230
230
|
mt: 4,
|
|
231
231
|
pb: 1,
|
|
232
|
-
} }, { children: [(0, jsx_runtime_1.jsxs)(material_1.CardContent, __assign({ sx: { pt: 0, pb: 0 } }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Typography, __assign({ variant: "h6", component: "div", align: "center", sx: { mb: 1 }, color: (0, material_1.darken)(theme.palette.primary.main, 0.2) }, { children: [vehicle.brand && "".concat(vehicle.brand, " "), vehicle.model && "".concat(vehicle.model, " "), vehicle.version && "".concat(vehicle.version)] })), (0, jsx_runtime_1.jsxs)(material_1.Grid, __assign({ container: true, justifyContent: "space-between" }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Grid, __assign({ container: true, sx: { mb: 1, alignItems: "center", justifyContent: "center" } }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Grid, __assign({ item: true, xs: 6, sx: { position: "relative", minWidth: "234px" } }, { children: [(0, jsx_runtime_1.jsx)("img", { src: car_plate_bg_png_1.default, alt: "Plaque d'immatriculation", style: { height: "50px", position: "relative" } }), (0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ variant: "h6", color: theme.palette.text.primary, sx: { position: "absolute", top: "8px", left: "76px" } }, { children: (0, jsx_runtime_1.jsx)("b", { children: (0, Tools_1.
|
|
232
|
+
} }, { children: [(0, jsx_runtime_1.jsxs)(material_1.CardContent, __assign({ sx: { pt: 0, pb: 0 } }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Typography, __assign({ variant: "h6", component: "div", align: "center", sx: { mb: 1 }, color: (0, material_1.darken)(theme.palette.primary.main, 0.2) }, { children: [vehicle.brand && "".concat(vehicle.brand, " "), vehicle.model && "".concat(vehicle.model, " "), vehicle.version && "".concat(vehicle.version)] })), (0, jsx_runtime_1.jsxs)(material_1.Grid, __assign({ container: true, justifyContent: "space-between" }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Grid, __assign({ container: true, sx: { mb: 1, alignItems: "center", justifyContent: "center" } }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Grid, __assign({ item: true, xs: 6, sx: { position: "relative", minWidth: "234px" } }, { children: [(0, jsx_runtime_1.jsx)("img", { src: car_plate_bg_png_1.default, alt: "Plaque d'immatriculation", style: { height: "50px", position: "relative" } }), (0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ variant: "h6", color: theme.palette.text.primary, sx: { position: "absolute", top: "8px", left: "76px" } }, { children: (0, jsx_runtime_1.jsx)("b", { children: (0, Tools_1.formatVehiclePlate)(vehicle.plate, vehicle.foreignPlate) }) }))] })), onDelete && ((0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 6, style: {
|
|
233
233
|
display: "flex",
|
|
234
234
|
alignItems: "center",
|
|
235
235
|
justifyContent: "center",
|
|
@@ -247,10 +247,12 @@ var VehicleFullCard = function (_a) {
|
|
|
247
247
|
: "-" }) })) }))] }))), localEditMode && ((0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 12 }, { children: (0, jsx_runtime_1.jsx)(material_1.FormControl, __assign({ fullWidth: true, sx: { marginTop: 2 } }, { children: (0, jsx_runtime_1.jsx)(x_date_pickers_1.DatePicker, { label: "Dernier contrôle technique", name: "lastInspectionDate", value: form.lastInspectionDate.value, format: "dd/MM/yyyy", formatDensity: "dense", views: ["day"], displayWeekNumber: true, onChange: function (e) { return handleChange("lastInspectionDate", e); } }) })) }))), !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: "Dernier entretien :" })) })), (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.jsx)("b", { children: (0, DateUtils_1.formatDateByTimezone)(vehicle.lastMaintenanceDate, "Europe/Paris", Enums_1.DateFormatTypes.SHORT_FORMAT_DATE) !== ""
|
|
248
248
|
? (0, DateUtils_1.formatDateByTimezone)(vehicle.lastMaintenanceDate, "Europe/Paris", Enums_1.DateFormatTypes.SHORT_FORMAT_DATE)
|
|
249
249
|
: "-" }) })) }))] }))), localEditMode && ((0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 12 }, { children: (0, jsx_runtime_1.jsx)(material_1.FormControl, __assign({ fullWidth: true, sx: { marginTop: 2 } }, { children: (0, jsx_runtime_1.jsx)(x_date_pickers_1.DatePicker, { label: "Dernier entretien", name: "lastMaintenanceDate", value: form.lastMaintenanceDate.value, format: "dd/MM/yyyy", formatDensity: "dense", views: ["day"], displayWeekNumber: true, onChange: function (e) { return handleChange("lastMaintenanceDate", e); } }) })) })))] })), !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 &&
|
|
250
|
-
((_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: {
|
|
250
|
+
((_b = vehicle.documents) === null || _b === void 0 ? void 0 : _b.filter(function (doc) { return doc.fileSignedUrl; }).map(function (invoice, index) { return ((0, jsx_runtime_1.jsxs)(material_1.Grid, __assign({ container: true, sx: {
|
|
251
251
|
justifyContent: "space-between",
|
|
252
252
|
alignItems: "center",
|
|
253
|
-
} }, { 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 })) })) })) }), (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: !(invoice.ownerId.toString() == currentUser.id), onClick: function (e) {
|
|
253
|
+
} }, { 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 })) })) })) }), (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: !(invoice.ownerId.toString() == currentUser.id), onClick: function (e) {
|
|
254
|
+
return handleDeleteDocument(e, invoice === null || invoice === void 0 ? void 0 : invoice.id);
|
|
255
|
+
} }, { children: (0, jsx_runtime_1.jsx)(CloseRounded_1.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) {
|
|
254
256
|
return handleFileChange(e, docTypeCurrent.current);
|
|
255
257
|
} }), (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: {
|
|
256
258
|
alignItems: "center",
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { FunctionComponent } from 'react';
|
|
2
2
|
interface VehiclePlateFieldProps {
|
|
3
|
-
onValidVehiclePlate: (vehiclePlate: string) => void;
|
|
3
|
+
onValidVehiclePlate: (vehiclePlate: string, country: 'FR' | 'INTL') => void;
|
|
4
|
+
onCountryChange?: (country: 'FR' | 'INTL') => void;
|
|
5
|
+
country: 'FR' | 'INTL';
|
|
6
|
+
model?: string;
|
|
7
|
+
onModelChange?: (model: string) => void;
|
|
4
8
|
}
|
|
5
9
|
export declare const regexPlate: RegExp;
|
|
6
10
|
export declare const oldRegexPlate: RegExp;
|
|
@@ -18,26 +18,34 @@ exports.oldRegexPlate = exports.regexPlate = void 0;
|
|
|
18
18
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
19
19
|
var react_1 = require("react");
|
|
20
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
21
|
var Enums_1 = require("../../helpers/Enums");
|
|
24
22
|
var Logger_1 = __importDefault(require("../../helpers/Logger"));
|
|
23
|
+
var material_1 = require("@mui/material");
|
|
24
|
+
var SearchRounded_1 = __importDefault(require("@mui/icons-material/SearchRounded"));
|
|
25
25
|
// Regex pour une plaque d'immatriculation française (nouveau format SIV)
|
|
26
26
|
exports.regexPlate = /^[A-Z]{2}-\d{3}-[A-Z]{2}$/;
|
|
27
27
|
// Regex pour une plaque d'immatriculation française (ancien format FNI)
|
|
28
28
|
exports.oldRegexPlate = /^\d{1,4}[ -]?[A-Z]{1,4}[ -]?\d{1,4}$/;
|
|
29
29
|
var VehiclePlateField = function (_a) {
|
|
30
|
-
var onValidVehiclePlate = _a.onValidVehiclePlate;
|
|
30
|
+
var onValidVehiclePlate = _a.onValidVehiclePlate, onCountryChange = _a.onCountryChange, country = _a.country, onModelChange = _a.onModelChange, model = _a.model;
|
|
31
31
|
var _b = (0, react_1.useState)(''), value = _b[0], setValue = _b[1];
|
|
32
32
|
var _c = (0, react_1.useState)(false), error = _c[0], setError = _c[1];
|
|
33
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
34
|
var _e = (0, react_1.useState)(''), helperText = _e[0], setHelperText = _e[1];
|
|
35
|
+
var MIN_FOREIGN_PLATE_LENGTH = 6;
|
|
35
36
|
// Hook de validation de la plaque
|
|
36
37
|
(0, react_1.useEffect)(function () {
|
|
37
|
-
if (
|
|
38
|
-
|
|
38
|
+
if (country === 'FR') {
|
|
39
|
+
if (!error && value !== '' && value.match(exports.regexPlate)) {
|
|
40
|
+
onValidVehiclePlate(value, country);
|
|
41
|
+
}
|
|
39
42
|
}
|
|
40
|
-
|
|
43
|
+
else {
|
|
44
|
+
if (value.length >= MIN_FOREIGN_PLATE_LENGTH) {
|
|
45
|
+
onValidVehiclePlate(value, country);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}, [error, value, country, onValidVehiclePlate]);
|
|
41
49
|
var getPlateFormat = function (plate) {
|
|
42
50
|
if (plate === '') {
|
|
43
51
|
// Si la saisie est vide, retournez un format par défaut (nouveau format, par exemple)
|
|
@@ -58,7 +66,16 @@ var VehiclePlateField = function (_a) {
|
|
|
58
66
|
}
|
|
59
67
|
};
|
|
60
68
|
var handleChange = function (e) {
|
|
61
|
-
var inputValue = e.target.value.toUpperCase()
|
|
69
|
+
var inputValue = e.target.value.toUpperCase();
|
|
70
|
+
if (country === 'INTL') {
|
|
71
|
+
setValue(inputValue);
|
|
72
|
+
setHelperText(inputValue.length >= MIN_FOREIGN_PLATE_LENGTH
|
|
73
|
+
? (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {})
|
|
74
|
+
: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["Veuillez saisir au moins ", MIN_FOREIGN_PLATE_LENGTH, " caract\u00E8res"] }));
|
|
75
|
+
setError(inputValue.length > 0 && inputValue.length < MIN_FOREIGN_PLATE_LENGTH);
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
inputValue = inputValue.replace(/[^A-Z0-9]/g, '');
|
|
62
79
|
// Si la saisie commence par une lettre, on contrôle l'ancien format, sinon le nouveau
|
|
63
80
|
switch (getPlateFormat(inputValue)) {
|
|
64
81
|
case Enums_1.VehiclePlateFormat.FRENCH_NEW: {
|
|
@@ -78,10 +95,24 @@ var VehiclePlateField = function (_a) {
|
|
|
78
95
|
}
|
|
79
96
|
};
|
|
80
97
|
var validatePlate = function () {
|
|
81
|
-
if (
|
|
82
|
-
|
|
98
|
+
if (country === 'FR') {
|
|
99
|
+
if (exports.oldRegexPlate.test(value)) {
|
|
100
|
+
onValidVehiclePlate(value, country);
|
|
101
|
+
setError(false);
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
setError(true);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
if (value.length >= MIN_FOREIGN_PLATE_LENGTH) {
|
|
109
|
+
onValidVehiclePlate(value, country);
|
|
110
|
+
setError(false);
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
setError(true);
|
|
114
|
+
}
|
|
83
115
|
}
|
|
84
|
-
setError(!exports.oldRegexPlate.test(value));
|
|
85
116
|
};
|
|
86
117
|
var handleChangeFrenchOld = function (inputValue) {
|
|
87
118
|
// ON bloque la saisie à 12 caractères max (limite des anciennes plaques)
|
|
@@ -112,11 +143,38 @@ var VehiclePlateField = function (_a) {
|
|
|
112
143
|
}
|
|
113
144
|
setLastLength(inputValue.length); // Mettre à jour la longueur précédente
|
|
114
145
|
};
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
146
|
+
var handleCountryChange = function (event) {
|
|
147
|
+
var newCountry = event.target.value;
|
|
148
|
+
setValue('');
|
|
149
|
+
setHelperText('');
|
|
150
|
+
setError(false);
|
|
151
|
+
onCountryChange === null || onCountryChange === void 0 ? void 0 : onCountryChange(newCountry); // ✅ callback vers parent
|
|
152
|
+
};
|
|
153
|
+
var handleModelChange = function (event) {
|
|
154
|
+
var newModel = event.target.value.toUpperCase();
|
|
155
|
+
onModelChange === null || onModelChange === void 0 ? void 0 : onModelChange(newModel); // ✅ callback vers parent
|
|
156
|
+
};
|
|
157
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(material_1.Box, __assign({ display: "flex", alignItems: "start", gap: 1, width: "100%" }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Select, __assign({ value: country, onChange: handleCountryChange, variant: "outlined", sx: {
|
|
158
|
+
minWidth: 70,
|
|
159
|
+
'.MuiSelect-select': {
|
|
160
|
+
display: 'flex',
|
|
161
|
+
alignItems: 'center',
|
|
162
|
+
height: '100%',
|
|
163
|
+
},
|
|
164
|
+
'.MuiOutlinedInput-notchedOutline': {
|
|
165
|
+
height: '100%',
|
|
166
|
+
},
|
|
167
|
+
p: 0,
|
|
168
|
+
pb: '4px'
|
|
169
|
+
} }, { children: [(0, jsx_runtime_1.jsx)(material_1.MenuItem, __assign({ value: "FR" }, { children: "\uD83C\uDDEB\uD83C\uDDF7" })), (0, jsx_runtime_1.jsx)(material_1.MenuItem, __assign({ value: "INTL" }, { children: "\uD83C\uDF10" }))] })), (0, jsx_runtime_1.jsx)(TextField_1.default, { label: country === "INTL" ? "Plaque étrangère / non reconnue" : "Plaque d'immatriculation (FR)", variant: "outlined", value: value, onChange: handleChange, error: error, autoFocus: true, sx: {
|
|
170
|
+
width: '100%',
|
|
171
|
+
'& input': { textTransform: 'uppercase' } // CSS pour forcer les majuscules dans l'input
|
|
172
|
+
}, helperText: lastLength > 0 || country === 'INTL' ? helperText : '', InputProps: {
|
|
173
|
+
endAdornment: country === 'FR' && getPlateFormat(value) === Enums_1.VehiclePlateFormat.FRENCH_OLD ? ((0, jsx_runtime_1.jsx)(material_1.InputAdornment, __assign({ position: "end", sx: { mr: 1 } }, { children: (0, jsx_runtime_1.jsx)(material_1.IconButton, __assign({ edge: "end", onClick: validatePlate }, { children: (0, jsx_runtime_1.jsx)(SearchRounded_1.default, {}) })) }))) : undefined,
|
|
174
|
+
} })] })), (country === 'INTL') && (0, jsx_runtime_1.jsx)(material_1.Box, { children: (0, jsx_runtime_1.jsx)(TextField_1.default, { label: "Pr\u00E9cisez le mod\u00E8le ...", variant: "outlined", value: model, onChange: handleModelChange, autoFocus: true, sx: {
|
|
175
|
+
width: '100%',
|
|
176
|
+
mt: 1,
|
|
177
|
+
'& input': { textTransform: 'uppercase' } // CSS pour forcer les majuscules dans l'input
|
|
178
|
+
} }) })] }));
|
|
121
179
|
};
|
|
122
180
|
exports.default = VehiclePlateField;
|
|
@@ -83,7 +83,8 @@ export declare enum RegistrationState {
|
|
|
83
83
|
}
|
|
84
84
|
export declare enum VehiclePlateFormat {
|
|
85
85
|
FRENCH_NEW = "FRENCH_NEW",
|
|
86
|
-
FRENCH_OLD = "FRENCH_OLD"
|
|
86
|
+
FRENCH_OLD = "FRENCH_OLD",
|
|
87
|
+
FOREIGN = "FOREIGN"
|
|
87
88
|
}
|
|
88
89
|
export declare enum SlotAlgorithm {
|
|
89
90
|
/**
|
|
@@ -226,7 +227,8 @@ export declare enum DocumentType {
|
|
|
226
227
|
VEHICLE_OTHER = "VEHICLE_OTHER",
|
|
227
228
|
EVENT_OTHER = "EVENT_OTHER",
|
|
228
229
|
EVENT_VISUAL_PROOFS = "EVENT_VISUAL_PROOFS",
|
|
229
|
-
EVENT_MAINTENANCE = "EVENT_MAINTENANCE"
|
|
230
|
+
EVENT_MAINTENANCE = "EVENT_MAINTENANCE",
|
|
231
|
+
VEHICLE_MAINTENANCE_INVOICE_AVOID = "VEHICLE_MAINTENANCE_INVOICE_AVOID"
|
|
230
232
|
}
|
|
231
233
|
export declare enum MovaAppType {
|
|
232
234
|
/**
|
|
@@ -96,6 +96,7 @@ var VehiclePlateFormat;
|
|
|
96
96
|
(function (VehiclePlateFormat) {
|
|
97
97
|
VehiclePlateFormat["FRENCH_NEW"] = "FRENCH_NEW";
|
|
98
98
|
VehiclePlateFormat["FRENCH_OLD"] = "FRENCH_OLD";
|
|
99
|
+
VehiclePlateFormat["FOREIGN"] = "FOREIGN";
|
|
99
100
|
})(VehiclePlateFormat = exports.VehiclePlateFormat || (exports.VehiclePlateFormat = {}));
|
|
100
101
|
var SlotAlgorithm;
|
|
101
102
|
(function (SlotAlgorithm) {
|
|
@@ -254,6 +255,7 @@ var DocumentType;
|
|
|
254
255
|
DocumentType["EVENT_OTHER"] = "EVENT_OTHER";
|
|
255
256
|
DocumentType["EVENT_VISUAL_PROOFS"] = "EVENT_VISUAL_PROOFS";
|
|
256
257
|
DocumentType["EVENT_MAINTENANCE"] = "EVENT_MAINTENANCE";
|
|
258
|
+
DocumentType["VEHICLE_MAINTENANCE_INVOICE_AVOID"] = "VEHICLE_MAINTENANCE_INVOICE_AVOID";
|
|
257
259
|
})(DocumentType = exports.DocumentType || (exports.DocumentType = {}));
|
|
258
260
|
var MovaAppType;
|
|
259
261
|
(function (MovaAppType) {
|
|
@@ -24,7 +24,7 @@ export declare const getApplicationShortLabel: (application: PartsApplicationTyp
|
|
|
24
24
|
export declare const flexEnd: CSSProperties;
|
|
25
25
|
export declare const flexCenter: CSSProperties;
|
|
26
26
|
export declare const isEmpty: (data: Object) => boolean;
|
|
27
|
-
export declare const
|
|
27
|
+
export declare const formatVehiclePlate: (input: string | undefined, isForeignPlate: boolean) => string;
|
|
28
28
|
export declare const formatVehicleTire: (vehicleTire: VehicleTire) => string;
|
|
29
29
|
export declare const formatVehicleTireStr: (input: string) => string;
|
|
30
30
|
/**
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.validateField = exports.formatVehicleTireStr = exports.formatVehicleTire = exports.
|
|
6
|
+
exports.validateField = exports.formatVehicleTireStr = exports.formatVehicleTire = exports.formatVehiclePlate = exports.isEmpty = exports.flexCenter = exports.flexEnd = exports.getApplicationShortLabel = exports.capitalizeFirstLetter = exports.flexLeftRow = exports.getFrenchDayLabel = exports.getDayOfWeek = exports.findScheduleByDayOfWeek = exports.formatTime = exports.getFormattedIntervals = exports.getFormattedSchedule = exports.formatPhoneNumber = exports.getDayOfWeekIndex = exports.getDayOfWeekLabel = exports.FR_WEEK_DAYS = exports.isInvalidPhoneNumber = exports.isInvalidMobileNumber = exports.isSafariOniOS = exports.flexStart = exports.getApplicationsShortLabels = void 0;
|
|
7
7
|
var max_1 = __importDefault(require("libphonenumber-js/max"));
|
|
8
8
|
var Enums_1 = require("./Enums");
|
|
9
9
|
var getApplicationsShortLabels = function (applications) {
|
|
@@ -266,22 +266,26 @@ var isEmpty = function (data) {
|
|
|
266
266
|
return Object.keys(data).length === 0;
|
|
267
267
|
};
|
|
268
268
|
exports.isEmpty = isEmpty;
|
|
269
|
-
var
|
|
269
|
+
var formatVehiclePlate = function (input, isForeignPlate) {
|
|
270
270
|
if (input) {
|
|
271
|
-
// On commence par détecter s'il s'agit d'un ancien ou nouveau format
|
|
272
271
|
var plateFormat = null;
|
|
273
|
-
if (
|
|
274
|
-
//
|
|
272
|
+
if (isForeignPlate) {
|
|
273
|
+
// Plaque étrangère
|
|
274
|
+
plateFormat = Enums_1.VehiclePlateFormat.FOREIGN;
|
|
275
|
+
}
|
|
276
|
+
else if (/^[A-Za-z]/.test(input)) {
|
|
277
|
+
// Commence par une lettre => nouveau format FR
|
|
275
278
|
plateFormat = Enums_1.VehiclePlateFormat.FRENCH_NEW;
|
|
276
279
|
}
|
|
277
280
|
else if (/^\d/.test(input)) {
|
|
278
|
-
// Commence par un chiffre => ancien format
|
|
281
|
+
// Commence par un chiffre => ancien format FR
|
|
279
282
|
plateFormat = Enums_1.VehiclePlateFormat.FRENCH_OLD;
|
|
280
283
|
}
|
|
281
|
-
|
|
282
|
-
var cleanedInput = input.replace(/[^A-Z0-9]/gi, "").toUpperCase();
|
|
284
|
+
var cleanedInput = input;
|
|
283
285
|
switch (plateFormat) {
|
|
284
286
|
case Enums_1.VehiclePlateFormat.FRENCH_NEW: {
|
|
287
|
+
// Supprimer tous les caractères non alphanumériques
|
|
288
|
+
cleanedInput = input.replace(/[^A-Z0-9]/gi, "").toUpperCase();
|
|
285
289
|
// Ajouter des tirets aux positions appropriées
|
|
286
290
|
if (cleanedInput.length >= 2) {
|
|
287
291
|
cleanedInput = "".concat(cleanedInput.slice(0, 2), "-").concat(cleanedInput.slice(2));
|
|
@@ -292,15 +296,20 @@ var formatFrenchVehiclePlate = function (input) {
|
|
|
292
296
|
break;
|
|
293
297
|
}
|
|
294
298
|
case Enums_1.VehiclePlateFormat.FRENCH_OLD: {
|
|
299
|
+
// Supprimer tous les caractères non alphanumériques
|
|
300
|
+
cleanedInput = input.replace(/[^A-Z0-9]/gi, "").toUpperCase();
|
|
295
301
|
// Rien de particulier, pas de tiret sur les anciennes plaques
|
|
296
302
|
break;
|
|
297
303
|
}
|
|
304
|
+
case Enums_1.VehiclePlateFormat.FOREIGN: {
|
|
305
|
+
// On retourne la plaque telle qu'enregistrée par l'utilisateur, ras
|
|
306
|
+
}
|
|
298
307
|
}
|
|
299
308
|
return cleanedInput;
|
|
300
309
|
}
|
|
301
310
|
return "";
|
|
302
311
|
};
|
|
303
|
-
exports.
|
|
312
|
+
exports.formatVehiclePlate = formatVehiclePlate;
|
|
304
313
|
var formatVehicleTire = function (vehicleTire) {
|
|
305
314
|
if (vehicleTire) {
|
|
306
315
|
var concatened = "".concat(vehicleTire.width).concat(vehicleTire.height).concat(vehicleTire.diameter).concat(vehicleTire.speedIndex);
|
|
@@ -25,8 +25,10 @@ export default class Customer extends User {
|
|
|
25
25
|
* Notes relatives au client
|
|
26
26
|
*/
|
|
27
27
|
notes: string;
|
|
28
|
+
billingAddress?: Address;
|
|
29
|
+
siren?: string;
|
|
28
30
|
constructor(id: string, roles: Role[] | undefined, firstname: string | undefined, lastname: string | undefined, avatar: string | undefined, addresses: Address[] | undefined, vehicles: Vehicle[], email: string | undefined, turnover: {
|
|
29
31
|
key: string;
|
|
30
32
|
value: number;
|
|
31
|
-
}[], type: CustomerType, companyName: string, companyPhoneNumber: string, notes: string);
|
|
33
|
+
}[], type: CustomerType, companyName: string, companyPhoneNumber: string, billingAddress: Address | undefined, notes: string, siren?: string);
|
|
32
34
|
}
|
|
@@ -21,13 +21,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
21
21
|
var User_1 = __importDefault(require("./User"));
|
|
22
22
|
var Customer = /** @class */ (function (_super) {
|
|
23
23
|
__extends(Customer, _super);
|
|
24
|
-
function Customer(id, roles, firstname, lastname, avatar, addresses, vehicles, email, turnover, type, companyName, companyPhoneNumber, notes) {
|
|
24
|
+
function Customer(id, roles, firstname, lastname, avatar, addresses, vehicles, email, turnover, type, companyName, companyPhoneNumber, billingAddress, notes, siren) {
|
|
25
25
|
if (roles === void 0) { roles = []; }
|
|
26
|
-
if (firstname === void 0) { firstname =
|
|
27
|
-
if (lastname === void 0) { lastname =
|
|
28
|
-
if (avatar === void 0) { avatar =
|
|
26
|
+
if (firstname === void 0) { firstname = ""; }
|
|
27
|
+
if (lastname === void 0) { lastname = ""; }
|
|
28
|
+
if (avatar === void 0) { avatar = ""; }
|
|
29
29
|
if (addresses === void 0) { addresses = []; }
|
|
30
|
-
if (email === void 0) { email =
|
|
30
|
+
if (email === void 0) { email = ""; }
|
|
31
|
+
if (billingAddress === void 0) { billingAddress = undefined; }
|
|
32
|
+
if (siren === void 0) { siren = ""; }
|
|
31
33
|
var _this = _super.call(this, id, roles, firstname, lastname, avatar, email) || this;
|
|
32
34
|
_this.vehicles = vehicles;
|
|
33
35
|
_this.turnover = turnover;
|
|
@@ -35,6 +37,8 @@ var Customer = /** @class */ (function (_super) {
|
|
|
35
37
|
_this.companyName = companyName;
|
|
36
38
|
_this.companyPhoneNumber = companyPhoneNumber;
|
|
37
39
|
_this.notes = notes;
|
|
40
|
+
_this.billingAddress = billingAddress;
|
|
41
|
+
_this.siren = siren;
|
|
38
42
|
return _this;
|
|
39
43
|
}
|
|
40
44
|
return Customer;
|
|
@@ -5,6 +5,7 @@ export default class Document {
|
|
|
5
5
|
state: DocumentState;
|
|
6
6
|
fileName: string;
|
|
7
7
|
originalFileName: string;
|
|
8
|
+
eventId?: string;
|
|
8
9
|
fileType: string;
|
|
9
10
|
fileSignedUrl: string;
|
|
10
11
|
type: DocumentType;
|
|
@@ -17,6 +18,8 @@ export default class Document {
|
|
|
17
18
|
totalAmountInclVat?: number;
|
|
18
19
|
lastSendingTime?: Date;
|
|
19
20
|
firstSendingTime?: Date;
|
|
20
|
-
|
|
21
|
+
sinaoDocumentId?: number;
|
|
22
|
+
constructor(id: string, ownerId: number, state: DocumentState, fileName: string, originalFileName: string, fileType: string, fileSignedUrl: string, type: DocumentType, creationDate?: Date, updateDate?: Date, reference?: string, validateToken?: string, remindersCount?: number, totalAmountInclVat?: number, lastSendingTime?: Date, firstSendingTime?: Date, eventId?: string, sinaoDocumentId?: number);
|
|
21
23
|
static findByTypeAndReference(documents: Document[], type: DocumentType, reference: string): Document | undefined;
|
|
24
|
+
static findManyByTypeAndReference(documents: Document[], type: DocumentType, reference: string): Document[] | undefined;
|
|
22
25
|
}
|