@movalib/movalib-commons 1.62.2 → 1.62.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -0
- package/dist/index.js +5 -3
- 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 -7
- package/dist/src/helpers/Enums.d.ts +2 -1
- package/dist/src/helpers/Enums.js +1 -0
- 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/index.ts +1 -0
- package/package.json +1 -1
- package/src/components/MovaTableBack/MovaTableBack.tsx +249 -0
- package/src/components/vehicle/VehicleFullCard.tsx +46 -46
- package/src/helpers/Enums.ts +1 -0
- package/src/models/Customer.ts +49 -45
- package/src/models/Document.ts +20 -2
- package/src/models/Garage.ts +121 -104
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';
|
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.formatFrenchVehiclePlate = 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; } });
|
|
@@ -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;
|
|
@@ -94,11 +94,7 @@ var VehicleFullCard = function (_a) {
|
|
|
94
94
|
}
|
|
95
95
|
};
|
|
96
96
|
var isVehicleTireSizeDefined = function (vehicle) {
|
|
97
|
-
return (vehicle.tireSize &&
|
|
98
|
-
vehicle.tireSize.diameter &&
|
|
99
|
-
vehicle.tireSize.height &&
|
|
100
|
-
vehicle.tireSize.speedIndex &&
|
|
101
|
-
vehicle.tireSize.width);
|
|
97
|
+
return (vehicle.tireSize && vehicle.tireSize.diameter && vehicle.tireSize.height);
|
|
102
98
|
};
|
|
103
99
|
var validateForm = function () {
|
|
104
100
|
var newForm = __assign({}, form);
|
|
@@ -251,10 +247,12 @@ var VehicleFullCard = function (_a) {
|
|
|
251
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) !== ""
|
|
252
248
|
? (0, DateUtils_1.formatDateByTimezone)(vehicle.lastMaintenanceDate, "Europe/Paris", Enums_1.DateFormatTypes.SHORT_FORMAT_DATE)
|
|
253
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 &&
|
|
254
|
-
((_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: {
|
|
255
251
|
justifyContent: "space-between",
|
|
256
252
|
alignItems: "center",
|
|
257
|
-
} }, { 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) {
|
|
258
256
|
return handleFileChange(e, docTypeCurrent.current);
|
|
259
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: {
|
|
260
258
|
alignItems: "center",
|
|
@@ -226,7 +226,8 @@ export declare enum DocumentType {
|
|
|
226
226
|
VEHICLE_OTHER = "VEHICLE_OTHER",
|
|
227
227
|
EVENT_OTHER = "EVENT_OTHER",
|
|
228
228
|
EVENT_VISUAL_PROOFS = "EVENT_VISUAL_PROOFS",
|
|
229
|
-
EVENT_MAINTENANCE = "EVENT_MAINTENANCE"
|
|
229
|
+
EVENT_MAINTENANCE = "EVENT_MAINTENANCE",
|
|
230
|
+
VEHICLE_MAINTENANCE_INVOICE_AVOID = "VEHICLE_MAINTENANCE_INVOICE_AVOID"
|
|
230
231
|
}
|
|
231
232
|
export declare enum MovaAppType {
|
|
232
233
|
/**
|
|
@@ -254,6 +254,7 @@ var DocumentType;
|
|
|
254
254
|
DocumentType["EVENT_OTHER"] = "EVENT_OTHER";
|
|
255
255
|
DocumentType["EVENT_VISUAL_PROOFS"] = "EVENT_VISUAL_PROOFS";
|
|
256
256
|
DocumentType["EVENT_MAINTENANCE"] = "EVENT_MAINTENANCE";
|
|
257
|
+
DocumentType["VEHICLE_MAINTENANCE_INVOICE_AVOID"] = "VEHICLE_MAINTENANCE_INVOICE_AVOID";
|
|
257
258
|
})(DocumentType = exports.DocumentType || (exports.DocumentType = {}));
|
|
258
259
|
var MovaAppType;
|
|
259
260
|
(function (MovaAppType) {
|
|
@@ -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
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
var Document = /** @class */ (function () {
|
|
4
|
-
function Document(id, ownerId, state, fileName, originalFileName, fileType, fileSignedUrl, type, creationDate, updateDate, reference, validateToken, remindersCount, totalAmountInclVat, lastSendingTime, firstSendingTime) {
|
|
4
|
+
function Document(id, ownerId, state, fileName, originalFileName, fileType, fileSignedUrl, type, creationDate, updateDate, reference, validateToken, remindersCount, totalAmountInclVat, lastSendingTime, firstSendingTime, eventId, sinaoDocumentId) {
|
|
5
5
|
this.id = id;
|
|
6
6
|
this.state = state;
|
|
7
7
|
this.ownerId = ownerId;
|
|
@@ -22,10 +22,18 @@ var Document = /** @class */ (function () {
|
|
|
22
22
|
this.firstSendingTime = firstSendingTime
|
|
23
23
|
? new Date(firstSendingTime)
|
|
24
24
|
: undefined;
|
|
25
|
+
this.eventId = eventId;
|
|
26
|
+
this.sinaoDocumentId = sinaoDocumentId;
|
|
25
27
|
}
|
|
26
28
|
Document.findByTypeAndReference = function (documents, type, reference) {
|
|
27
29
|
if (documents && type && reference) {
|
|
28
|
-
return documents.find(function (document) { return document.type === type && document.
|
|
30
|
+
return documents.find(function (document) { return document.type === type && document.eventId === reference; });
|
|
31
|
+
}
|
|
32
|
+
return undefined;
|
|
33
|
+
};
|
|
34
|
+
Document.findManyByTypeAndReference = function (documents, type, reference) {
|
|
35
|
+
if (documents && type && reference) {
|
|
36
|
+
return documents.filter(function (document) { return document.type === type && document.eventId === reference; });
|
|
29
37
|
}
|
|
30
38
|
return undefined;
|
|
31
39
|
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
+
import { OrderPreference, RegistrationState, SlotAlgorithm, SubscriptionPaymentInterval } from "../helpers/Enums";
|
|
1
2
|
import Address from "./Address";
|
|
2
|
-
import
|
|
3
|
+
import CategoryPrestation from "./CategoryPrestation";
|
|
4
|
+
import Document from "./Document";
|
|
5
|
+
import Employee from "./Employee";
|
|
3
6
|
import Prestation from "./Prestation";
|
|
7
|
+
import Schedule from "./Schedule";
|
|
8
|
+
import Subscription from "./Subscription";
|
|
4
9
|
import Supplier from "./Supplier";
|
|
5
|
-
import Document from "./Document";
|
|
6
|
-
import { OrderPreference, RegistrationState, SlotAlgorithm, SubscriptionPaymentInterval } from "../helpers/Enums";
|
|
7
10
|
import User from "./User";
|
|
8
|
-
import Subscription from "./Subscription";
|
|
9
|
-
import Employee from "./Employee";
|
|
10
|
-
import CategoryPrestation from "./CategoryPrestation";
|
|
11
11
|
import VehicleGarage from "./VehicleGarage";
|
|
12
12
|
export default class Garage {
|
|
13
13
|
id: string;
|
|
@@ -55,5 +55,9 @@ export default class Garage {
|
|
|
55
55
|
timezone: string;
|
|
56
56
|
customStyle?: string;
|
|
57
57
|
mailCustomization?: boolean;
|
|
58
|
-
|
|
58
|
+
billingActive?: boolean;
|
|
59
|
+
billingToken?: string;
|
|
60
|
+
billingSimulationActive?: boolean;
|
|
61
|
+
appId?: number;
|
|
62
|
+
constructor(id: string, adminId: string, name: string, address: Address, workforce: number, prestations: Prestation[], schedules: Schedule[], contactPhone: string, prestationCategories: CategoryPrestation[], dayPeriodFastServiceExcluded: boolean, loanerVehicleFastServiceExcluded: boolean, fastServiceThreshold: number, timezone: string, vehicles?: VehicleGarage[], contactEmail?: string, logo?: string, suppliers?: Supplier[], documents?: Document[], subscriptions?: Subscription[], loanerVehicleActive?: boolean, loanerVehicleRequestActive?: boolean, customStyle?: string, subscription?: Subscription, partialWorkforce?: number, mailCustomization?: boolean, billingActive?: boolean, billingToken?: string, billingSimulationActive?: boolean, appId?: number);
|
|
59
63
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
var Garage = /** @class */ (function () {
|
|
4
|
-
function Garage(id, adminId, name, address, workforce, prestations, schedules, contactPhone, prestationCategories, dayPeriodFastServiceExcluded, loanerVehicleFastServiceExcluded, fastServiceThreshold, timezone, vehicles, contactEmail, logo, suppliers, documents, subscriptions, loanerVehicleActive, loanerVehicleRequestActive, customStyle, subscription, partialWorkforce, mailCustomization) {
|
|
4
|
+
function Garage(id, adminId, name, address, workforce, prestations, schedules, contactPhone, prestationCategories, dayPeriodFastServiceExcluded, loanerVehicleFastServiceExcluded, fastServiceThreshold, timezone, vehicles, contactEmail, logo, suppliers, documents, subscriptions, loanerVehicleActive, loanerVehicleRequestActive, customStyle, subscription, partialWorkforce, mailCustomization, billingActive, billingToken, billingSimulationActive, appId) {
|
|
5
5
|
this.id = id;
|
|
6
6
|
this.adminId = adminId;
|
|
7
7
|
this.name = name;
|
|
@@ -27,6 +27,10 @@ var Garage = /** @class */ (function () {
|
|
|
27
27
|
this.customStyle = customStyle;
|
|
28
28
|
this.timezone = timezone;
|
|
29
29
|
this.mailCustomization = mailCustomization;
|
|
30
|
+
this.billingActive = billingActive;
|
|
31
|
+
this.billingToken = billingToken;
|
|
32
|
+
this.billingSimulationActive = billingSimulationActive;
|
|
33
|
+
this.appId = appId;
|
|
30
34
|
}
|
|
31
35
|
return Garage;
|
|
32
36
|
}());
|
package/index.ts
CHANGED
|
@@ -32,6 +32,7 @@ export { QrCodePLVContainer } from './src/components/QrCodePLVContainer/QrCodePL
|
|
|
32
32
|
export { PLVComponent, PrintSize } from './src/components/QrCodePLVContainer/PLVComponent';
|
|
33
33
|
export {LinkedDocumentDialog} from './src/components/LinkedDocumentDialog';
|
|
34
34
|
export { default as MovaTable } from './src/components/MovaTable/MovaTable';
|
|
35
|
+
export {default as MovaTableBack} from "./src/components/MovaTableBack/MovaTableBack"
|
|
35
36
|
|
|
36
37
|
// Export des classes
|
|
37
38
|
export { default as Subscription } from './src/models/Subscription';
|
package/package.json
CHANGED
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
import { Refresh } from "@mui/icons-material";
|
|
2
|
+
import SearchIcon from "@mui/icons-material/Search";
|
|
3
|
+
import {
|
|
4
|
+
Box,
|
|
5
|
+
Button,
|
|
6
|
+
InputAdornment,
|
|
7
|
+
LinearProgress,
|
|
8
|
+
Paper,
|
|
9
|
+
Table,
|
|
10
|
+
TableBody,
|
|
11
|
+
TableCell,
|
|
12
|
+
TableContainer,
|
|
13
|
+
TableFooter,
|
|
14
|
+
TableHead,
|
|
15
|
+
TablePagination,
|
|
16
|
+
TableRow,
|
|
17
|
+
TextField,
|
|
18
|
+
debounce,
|
|
19
|
+
} from "@mui/material";
|
|
20
|
+
import {
|
|
21
|
+
ChangeEvent,
|
|
22
|
+
ComponentType,
|
|
23
|
+
MouseEvent,
|
|
24
|
+
useCallback,
|
|
25
|
+
useRef,
|
|
26
|
+
useState,
|
|
27
|
+
} from "react";
|
|
28
|
+
|
|
29
|
+
type TMovaTable<T> = {
|
|
30
|
+
useDataHook: (
|
|
31
|
+
page: number,
|
|
32
|
+
rowsPerPage: number,
|
|
33
|
+
search?: string
|
|
34
|
+
) => {
|
|
35
|
+
data: T[];
|
|
36
|
+
totalElements: number;
|
|
37
|
+
isLoading: boolean;
|
|
38
|
+
refresh: () => void;
|
|
39
|
+
};
|
|
40
|
+
displayedColumns: {
|
|
41
|
+
displayName: string;
|
|
42
|
+
component: ComponentType<{ element: T }>;
|
|
43
|
+
autoWidth?: boolean;
|
|
44
|
+
}[];
|
|
45
|
+
pagination?: number[];
|
|
46
|
+
compact?: boolean;
|
|
47
|
+
onRowClick?: (data: T) => void;
|
|
48
|
+
onRowRightClick?: (data: T, event: MouseEvent<HTMLTableRowElement>) => void;
|
|
49
|
+
isClickable?: (data: T) => boolean;
|
|
50
|
+
onRowDoubleClick?: (data: T) => void;
|
|
51
|
+
filterChildren?: React.ReactNode;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export default function MovaTableBack<T>({
|
|
55
|
+
useDataHook,
|
|
56
|
+
displayedColumns,
|
|
57
|
+
pagination,
|
|
58
|
+
compact,
|
|
59
|
+
onRowClick,
|
|
60
|
+
onRowRightClick,
|
|
61
|
+
onRowDoubleClick,
|
|
62
|
+
isClickable,
|
|
63
|
+
filterChildren,
|
|
64
|
+
}: TMovaTable<T>) {
|
|
65
|
+
const [currentPageIndex, setCurrentPageIndex] = useState<number>(0);
|
|
66
|
+
const [rowsPerPage, setRowsPerPage] = useState<number>(25);
|
|
67
|
+
const [search, setSearch] = useState("");
|
|
68
|
+
const clickTimeout = useRef<ReturnType<typeof setTimeout> | null>(null);
|
|
69
|
+
|
|
70
|
+
const { data, totalElements, isLoading, refresh } = useDataHook(
|
|
71
|
+
currentPageIndex,
|
|
72
|
+
rowsPerPage,
|
|
73
|
+
search
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
const handleDoubleClick = useCallback(
|
|
77
|
+
(element: T) => {
|
|
78
|
+
if (!onRowDoubleClick) return;
|
|
79
|
+
|
|
80
|
+
if (clickTimeout.current) {
|
|
81
|
+
clearTimeout(clickTimeout.current);
|
|
82
|
+
clickTimeout.current = null;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
onRowDoubleClick(element);
|
|
86
|
+
},
|
|
87
|
+
[onRowDoubleClick]
|
|
88
|
+
);
|
|
89
|
+
|
|
90
|
+
const handleRowClick = useCallback(
|
|
91
|
+
(element: T) => {
|
|
92
|
+
if (!onRowClick) return;
|
|
93
|
+
|
|
94
|
+
if (clickTimeout.current) return;
|
|
95
|
+
|
|
96
|
+
clickTimeout.current = setTimeout(() => {
|
|
97
|
+
onRowClick(element);
|
|
98
|
+
clickTimeout.current = null;
|
|
99
|
+
}, 200);
|
|
100
|
+
},
|
|
101
|
+
[onRowClick]
|
|
102
|
+
);
|
|
103
|
+
|
|
104
|
+
const handlePageChange = (
|
|
105
|
+
event: MouseEvent<HTMLButtonElement> | null,
|
|
106
|
+
page: number
|
|
107
|
+
) => {
|
|
108
|
+
setCurrentPageIndex(page);
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
const handleRowsPerPageChange = (
|
|
112
|
+
event: ChangeEvent<HTMLInputElement | HTMLTextAreaElement>
|
|
113
|
+
) => {
|
|
114
|
+
setCurrentPageIndex(0);
|
|
115
|
+
setRowsPerPage(Number(event.target.value));
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
const handleSearchChange = debounce((event) => {
|
|
119
|
+
const search = event?.target.value;
|
|
120
|
+
if (search.length > 2) {
|
|
121
|
+
setSearch(search);
|
|
122
|
+
setCurrentPageIndex(0);
|
|
123
|
+
} else {
|
|
124
|
+
setSearch("");
|
|
125
|
+
setCurrentPageIndex(0);
|
|
126
|
+
}
|
|
127
|
+
}, 700);
|
|
128
|
+
|
|
129
|
+
return (
|
|
130
|
+
<div style={{ height: "100%", display: "flex", flexDirection: "column" }}>
|
|
131
|
+
<Box
|
|
132
|
+
sx={{
|
|
133
|
+
width: "50%",
|
|
134
|
+
my: 2,
|
|
135
|
+
px: 2,
|
|
136
|
+
display: "flex",
|
|
137
|
+
gap: 2,
|
|
138
|
+
}}
|
|
139
|
+
>
|
|
140
|
+
<TextField
|
|
141
|
+
size="small"
|
|
142
|
+
type="search"
|
|
143
|
+
onChange={handleSearchChange}
|
|
144
|
+
inputProps={{
|
|
145
|
+
startAdornment: (
|
|
146
|
+
<InputAdornment position="start">
|
|
147
|
+
<SearchIcon />
|
|
148
|
+
</InputAdornment>
|
|
149
|
+
),
|
|
150
|
+
}}
|
|
151
|
+
sx={{ width: "100%" }}
|
|
152
|
+
placeholder="Rechercher"
|
|
153
|
+
/>
|
|
154
|
+
{refresh && (
|
|
155
|
+
<Button size="small" onClick={refresh} variant="contained">
|
|
156
|
+
<Refresh />
|
|
157
|
+
</Button>
|
|
158
|
+
)}
|
|
159
|
+
</Box>
|
|
160
|
+
{filterChildren && filterChildren}
|
|
161
|
+
<TableContainer sx={{ height: "100%" }} component={Paper}>
|
|
162
|
+
<Table
|
|
163
|
+
size={compact ? "small" : "medium"}
|
|
164
|
+
sx={{ height: "100%" }}
|
|
165
|
+
stickyHeader
|
|
166
|
+
>
|
|
167
|
+
<TableHead>
|
|
168
|
+
<TableRow>
|
|
169
|
+
{displayedColumns.map((column, index) => (
|
|
170
|
+
<TableCell key={index}>{column.displayName}</TableCell>
|
|
171
|
+
))}
|
|
172
|
+
</TableRow>
|
|
173
|
+
</TableHead>
|
|
174
|
+
<TableBody sx={{ overflowY: "auto" }}>
|
|
175
|
+
{isLoading && (
|
|
176
|
+
<TableRow>
|
|
177
|
+
<TableCell colSpan={5} sx={{ padding: 0 }}>
|
|
178
|
+
<LinearProgress />
|
|
179
|
+
</TableCell>
|
|
180
|
+
</TableRow>
|
|
181
|
+
)}
|
|
182
|
+
|
|
183
|
+
{data?.length !== 0 &&
|
|
184
|
+
data?.map((element, index) => (
|
|
185
|
+
<TableRow
|
|
186
|
+
onDoubleClick={() => {
|
|
187
|
+
handleDoubleClick(element);
|
|
188
|
+
}}
|
|
189
|
+
onClick={() => handleRowClick(element)}
|
|
190
|
+
onContextMenu={(event) =>
|
|
191
|
+
onRowRightClick && onRowRightClick(element, event)
|
|
192
|
+
}
|
|
193
|
+
sx={{
|
|
194
|
+
backgroundColor: "white",
|
|
195
|
+
cursor: isClickable
|
|
196
|
+
? isClickable(element)
|
|
197
|
+
? "pointer"
|
|
198
|
+
: "default"
|
|
199
|
+
: "pointer",
|
|
200
|
+
height: "auto",
|
|
201
|
+
}}
|
|
202
|
+
hover
|
|
203
|
+
key={index}
|
|
204
|
+
>
|
|
205
|
+
{displayedColumns.map((column, index) => (
|
|
206
|
+
<TableCell
|
|
207
|
+
key={index}
|
|
208
|
+
sx={
|
|
209
|
+
column.autoWidth
|
|
210
|
+
? {
|
|
211
|
+
whiteSpace: "nowrap",
|
|
212
|
+
width: "1%",
|
|
213
|
+
maxWidth: "fit-content",
|
|
214
|
+
}
|
|
215
|
+
: {}
|
|
216
|
+
}
|
|
217
|
+
>
|
|
218
|
+
{column.component && (
|
|
219
|
+
<column.component element={element} />
|
|
220
|
+
)}
|
|
221
|
+
</TableCell>
|
|
222
|
+
))}
|
|
223
|
+
</TableRow>
|
|
224
|
+
))}
|
|
225
|
+
<TableRow sx={{ height: "100%" }} />
|
|
226
|
+
</TableBody>
|
|
227
|
+
|
|
228
|
+
{pagination && pagination.length > 0 && (
|
|
229
|
+
<TableFooter
|
|
230
|
+
sx={{ position: "sticky", bottom: 0, backgroundColor: "white" }}
|
|
231
|
+
>
|
|
232
|
+
<TableRow>
|
|
233
|
+
<TablePagination
|
|
234
|
+
count={totalElements}
|
|
235
|
+
onPageChange={handlePageChange}
|
|
236
|
+
page={currentPageIndex}
|
|
237
|
+
rowsPerPage={rowsPerPage}
|
|
238
|
+
labelRowsPerPage="Lignes par page :"
|
|
239
|
+
onRowsPerPageChange={handleRowsPerPageChange}
|
|
240
|
+
rowsPerPageOptions={pagination}
|
|
241
|
+
/>
|
|
242
|
+
</TableRow>
|
|
243
|
+
</TableFooter>
|
|
244
|
+
)}
|
|
245
|
+
</Table>
|
|
246
|
+
</TableContainer>
|
|
247
|
+
</div>
|
|
248
|
+
);
|
|
249
|
+
}
|
|
@@ -207,11 +207,7 @@ const VehicleFullCard: FC<VehicleFullCardProps> = ({
|
|
|
207
207
|
|
|
208
208
|
const isVehicleTireSizeDefined = (vehicle: Vehicle) => {
|
|
209
209
|
return (
|
|
210
|
-
vehicle.tireSize &&
|
|
211
|
-
vehicle.tireSize.diameter &&
|
|
212
|
-
vehicle.tireSize.height &&
|
|
213
|
-
vehicle.tireSize.speedIndex &&
|
|
214
|
-
vehicle.tireSize.width
|
|
210
|
+
vehicle.tireSize && vehicle.tireSize.diameter && vehicle.tireSize.height
|
|
215
211
|
);
|
|
216
212
|
};
|
|
217
213
|
|
|
@@ -696,51 +692,55 @@ const VehicleFullCard: FC<VehicleFullCardProps> = ({
|
|
|
696
692
|
</Grid>
|
|
697
693
|
|
|
698
694
|
{vehicle.documents &&
|
|
699
|
-
vehicle.documents
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
sx={{
|
|
703
|
-
justifyContent: "space-between",
|
|
704
|
-
alignItems: "center",
|
|
705
|
-
}}
|
|
706
|
-
key={index + 1}
|
|
707
|
-
>
|
|
708
|
-
<Grid
|
|
709
|
-
item
|
|
710
|
-
xs={11}
|
|
711
|
-
key={(index + 1) * 50}
|
|
712
|
-
sx={{ textAlign: "left" }}
|
|
713
|
-
>
|
|
714
|
-
<Tooltip title={invoice.originalFileName}>
|
|
715
|
-
<Link
|
|
716
|
-
color={darken("#F29ABA", 0.2)}
|
|
717
|
-
href={invoice.fileSignedUrl}
|
|
718
|
-
target="_blank"
|
|
719
|
-
rel="noopener"
|
|
720
|
-
>
|
|
721
|
-
<Typography variant="body1">
|
|
722
|
-
{invoice.fileName}
|
|
723
|
-
</Typography>
|
|
724
|
-
</Link>
|
|
725
|
-
</Tooltip>
|
|
726
|
-
</Grid>
|
|
695
|
+
vehicle.documents
|
|
696
|
+
?.filter((doc) => doc.fileSignedUrl)
|
|
697
|
+
.map((invoice, index) => (
|
|
727
698
|
<Grid
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
699
|
+
container
|
|
700
|
+
sx={{
|
|
701
|
+
justifyContent: "space-between",
|
|
702
|
+
alignItems: "center",
|
|
703
|
+
}}
|
|
704
|
+
key={index + 1}
|
|
732
705
|
>
|
|
733
|
-
<
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
}
|
|
737
|
-
|
|
706
|
+
<Grid
|
|
707
|
+
item
|
|
708
|
+
xs={11}
|
|
709
|
+
key={(index + 1) * 50}
|
|
710
|
+
sx={{ textAlign: "left" }}
|
|
738
711
|
>
|
|
739
|
-
<
|
|
740
|
-
|
|
712
|
+
<Tooltip title={invoice.originalFileName}>
|
|
713
|
+
<Link
|
|
714
|
+
color={darken("#F29ABA", 0.2)}
|
|
715
|
+
href={invoice.fileSignedUrl}
|
|
716
|
+
target="_blank"
|
|
717
|
+
rel="noopener"
|
|
718
|
+
>
|
|
719
|
+
<Typography variant="body1">
|
|
720
|
+
{invoice.fileName}
|
|
721
|
+
</Typography>
|
|
722
|
+
</Link>
|
|
723
|
+
</Tooltip>
|
|
724
|
+
</Grid>
|
|
725
|
+
<Grid
|
|
726
|
+
item
|
|
727
|
+
xs={1}
|
|
728
|
+
key={(index + 1) * 100}
|
|
729
|
+
sx={{ textAlign: "right" }}
|
|
730
|
+
>
|
|
731
|
+
<IconButton
|
|
732
|
+
disabled={
|
|
733
|
+
!(invoice.ownerId.toString() == currentUser.id)
|
|
734
|
+
}
|
|
735
|
+
onClick={(e) =>
|
|
736
|
+
handleDeleteDocument(e, invoice?.id)
|
|
737
|
+
}
|
|
738
|
+
>
|
|
739
|
+
<CloseIcon />
|
|
740
|
+
</IconButton>
|
|
741
|
+
</Grid>
|
|
741
742
|
</Grid>
|
|
742
|
-
|
|
743
|
-
))}
|
|
743
|
+
))}
|
|
744
744
|
|
|
745
745
|
{/* * Les FACTURES du véhicule
|
|
746
746
|
{vehicle.documents && vehicle.documents?.filter(doc => doc.type === DocumentType.VEHICLE_MAINTENANCE_INVOICE)
|
package/src/helpers/Enums.ts
CHANGED
|
@@ -252,6 +252,7 @@ export enum DocumentType {
|
|
|
252
252
|
EVENT_OTHER = "EVENT_OTHER",
|
|
253
253
|
EVENT_VISUAL_PROOFS = "EVENT_VISUAL_PROOFS",
|
|
254
254
|
EVENT_MAINTENANCE = "EVENT_MAINTENANCE",
|
|
255
|
+
VEHICLE_MAINTENANCE_INVOICE_AVOID = "VEHICLE_MAINTENANCE_INVOICE_AVOID",
|
|
255
256
|
}
|
|
256
257
|
|
|
257
258
|
export enum MovaAppType {
|
package/src/models/Customer.ts
CHANGED
|
@@ -4,54 +4,58 @@ import Role from "./Role";
|
|
|
4
4
|
import User from "./User";
|
|
5
5
|
import Vehicle from "./Vehicle";
|
|
6
6
|
|
|
7
|
-
|
|
8
7
|
export default class Customer extends User {
|
|
8
|
+
// Properties
|
|
9
|
+
vehicles: Vehicle[];
|
|
10
|
+
turnover: { key: string; value: number }[];
|
|
11
|
+
/**
|
|
12
|
+
* Type de client (professionnel / particulier)
|
|
13
|
+
*/
|
|
14
|
+
type: CustomerType;
|
|
9
15
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
* Type de client (professionnel / particulier)
|
|
15
|
-
*/
|
|
16
|
-
type: CustomerType;
|
|
16
|
+
/**
|
|
17
|
+
* Raison sociale si client Professionnel
|
|
18
|
+
*/
|
|
19
|
+
companyName: string;
|
|
17
20
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Téléphone de contact additionnel (souvent un fixe pour les pro)
|
|
25
|
-
*/
|
|
26
|
-
companyPhoneNumber: string;
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Notes relatives au client
|
|
30
|
-
*/
|
|
31
|
-
notes: string;
|
|
21
|
+
/**
|
|
22
|
+
* Téléphone de contact additionnel (souvent un fixe pour les pro)
|
|
23
|
+
*/
|
|
24
|
+
companyPhoneNumber: string;
|
|
32
25
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
addresses : Address[] = [],
|
|
40
|
-
vehicles: Vehicle[],
|
|
41
|
-
email: string = '',
|
|
42
|
-
turnover: { key: string, value: number }[],
|
|
43
|
-
type: CustomerType,
|
|
44
|
-
companyName: string,
|
|
45
|
-
companyPhoneNumber: string,
|
|
46
|
-
notes: string) {
|
|
26
|
+
/**
|
|
27
|
+
* Notes relatives au client
|
|
28
|
+
*/
|
|
29
|
+
notes: string;
|
|
30
|
+
billingAddress?: Address;
|
|
31
|
+
siren?: string;
|
|
47
32
|
|
|
48
|
-
|
|
33
|
+
constructor(
|
|
34
|
+
id: string,
|
|
35
|
+
roles: Role[] = [],
|
|
36
|
+
firstname: string = "",
|
|
37
|
+
lastname: string = "",
|
|
38
|
+
avatar: string = "",
|
|
39
|
+
addresses: Address[] = [],
|
|
40
|
+
vehicles: Vehicle[],
|
|
41
|
+
email: string = "",
|
|
42
|
+
turnover: { key: string; value: number }[],
|
|
43
|
+
type: CustomerType,
|
|
44
|
+
companyName: string,
|
|
45
|
+
companyPhoneNumber: string,
|
|
46
|
+
billingAddress: Address | undefined = undefined,
|
|
47
|
+
notes: string,
|
|
48
|
+
siren: string = ""
|
|
49
|
+
) {
|
|
50
|
+
super(id, roles, firstname, lastname, avatar, email);
|
|
49
51
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
52
|
+
this.vehicles = vehicles;
|
|
53
|
+
this.turnover = turnover;
|
|
54
|
+
this.type = type;
|
|
55
|
+
this.companyName = companyName;
|
|
56
|
+
this.companyPhoneNumber = companyPhoneNumber;
|
|
57
|
+
this.notes = notes;
|
|
58
|
+
this.billingAddress = billingAddress;
|
|
59
|
+
this.siren = siren;
|
|
60
|
+
}
|
|
61
|
+
}
|
package/src/models/Document.ts
CHANGED
|
@@ -7,6 +7,7 @@ export default class Document {
|
|
|
7
7
|
state: DocumentState;
|
|
8
8
|
fileName: string;
|
|
9
9
|
originalFileName: string;
|
|
10
|
+
eventId?: string; // Optional, used for event documents
|
|
10
11
|
fileType: string;
|
|
11
12
|
fileSignedUrl: string;
|
|
12
13
|
type: DocumentType;
|
|
@@ -19,6 +20,7 @@ export default class Document {
|
|
|
19
20
|
totalAmountInclVat?: number;
|
|
20
21
|
lastSendingTime?: Date;
|
|
21
22
|
firstSendingTime?: Date;
|
|
23
|
+
sinaoDocumentId?: number;
|
|
22
24
|
constructor(
|
|
23
25
|
id: string,
|
|
24
26
|
ownerId: number,
|
|
@@ -35,7 +37,9 @@ export default class Document {
|
|
|
35
37
|
remindersCount?: number,
|
|
36
38
|
totalAmountInclVat?: number,
|
|
37
39
|
lastSendingTime?: Date,
|
|
38
|
-
firstSendingTime?: Date
|
|
40
|
+
firstSendingTime?: Date,
|
|
41
|
+
eventId?: string,
|
|
42
|
+
sinaoDocumentId?: number
|
|
39
43
|
) {
|
|
40
44
|
this.id = id;
|
|
41
45
|
this.state = state;
|
|
@@ -57,6 +61,8 @@ export default class Document {
|
|
|
57
61
|
this.firstSendingTime = firstSendingTime
|
|
58
62
|
? new Date(firstSendingTime)
|
|
59
63
|
: undefined;
|
|
64
|
+
this.eventId = eventId;
|
|
65
|
+
this.sinaoDocumentId = sinaoDocumentId;
|
|
60
66
|
}
|
|
61
67
|
|
|
62
68
|
static findByTypeAndReference(
|
|
@@ -66,7 +72,19 @@ export default class Document {
|
|
|
66
72
|
): Document | undefined {
|
|
67
73
|
if (documents && type && reference) {
|
|
68
74
|
return documents.find(
|
|
69
|
-
(document) => document.type === type && document.
|
|
75
|
+
(document) => document.type === type && document.eventId === reference
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
return undefined;
|
|
79
|
+
}
|
|
80
|
+
static findManyByTypeAndReference(
|
|
81
|
+
documents: Document[],
|
|
82
|
+
type: DocumentType,
|
|
83
|
+
reference: string
|
|
84
|
+
): Document[] | undefined {
|
|
85
|
+
if (documents && type && reference) {
|
|
86
|
+
return documents.filter(
|
|
87
|
+
(document) => document.type === type && document.eventId === reference
|
|
70
88
|
);
|
|
71
89
|
}
|
|
72
90
|
return undefined;
|
package/src/models/Garage.ts
CHANGED
|
@@ -1,113 +1,130 @@
|
|
|
1
|
+
import {
|
|
2
|
+
OrderPreference,
|
|
3
|
+
RegistrationState,
|
|
4
|
+
SlotAlgorithm,
|
|
5
|
+
SubscriptionPaymentInterval,
|
|
6
|
+
} from "../helpers/Enums";
|
|
1
7
|
import Address from "./Address";
|
|
2
|
-
import
|
|
8
|
+
import CategoryPrestation from "./CategoryPrestation";
|
|
9
|
+
import Document from "./Document";
|
|
10
|
+
import Employee from "./Employee";
|
|
3
11
|
import Prestation from "./Prestation";
|
|
12
|
+
import Schedule from "./Schedule";
|
|
13
|
+
import Subscription from "./Subscription";
|
|
4
14
|
import Supplier from "./Supplier";
|
|
5
|
-
import Document from "./Document";
|
|
6
|
-
import { OrderPreference, RegistrationState, SlotAlgorithm, SubscriptionPaymentInterval } from "../helpers/Enums";
|
|
7
15
|
import User from "./User";
|
|
8
|
-
import Subscription from "./Subscription";
|
|
9
|
-
import Employee from "./Employee";
|
|
10
|
-
import CategoryPrestation from "./CategoryPrestation";
|
|
11
16
|
import VehicleGarage from "./VehicleGarage";
|
|
12
17
|
|
|
13
18
|
export default class Garage {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
19
|
+
id: string;
|
|
20
|
+
adminId: string;
|
|
21
|
+
name: string;
|
|
22
|
+
address: Address;
|
|
23
|
+
workforce: number;
|
|
24
|
+
partialWorkforce?: number;
|
|
25
|
+
contactPhone: string;
|
|
26
|
+
prestationCategories: CategoryPrestation[];
|
|
27
|
+
prestations: Prestation[];
|
|
28
|
+
schedules: Schedule[];
|
|
29
|
+
dayPeriodFastServiceExcluded: boolean;
|
|
30
|
+
loanerVehicleFastServiceExcluded: boolean;
|
|
31
|
+
fastServiceThreshold: number;
|
|
32
|
+
vehicles?: VehicleGarage[];
|
|
33
|
+
countryCode?: string;
|
|
34
|
+
contactEmail?: string;
|
|
35
|
+
admin?: User;
|
|
36
|
+
logo?: string;
|
|
37
|
+
suppliers?: Supplier[];
|
|
38
|
+
orderPreference?: OrderPreference;
|
|
39
|
+
amVehicleDeposit?: Date;
|
|
40
|
+
pmVehicleDeposit?: Date;
|
|
41
|
+
appointmentRequestStart?: Date;
|
|
42
|
+
slotAlgorithm?: SlotAlgorithm;
|
|
43
|
+
customerQuoteActive?: boolean;
|
|
44
|
+
supplierOrderActive?: boolean;
|
|
45
|
+
registrationState?: RegistrationState;
|
|
46
|
+
subscriptionIban?: string;
|
|
47
|
+
subscriptionPaymentInterval?: SubscriptionPaymentInterval;
|
|
48
|
+
creationDate?: Date;
|
|
49
|
+
teamManagementActive?: boolean;
|
|
50
|
+
documents?: Document[];
|
|
51
|
+
subscriptions?: Subscription[];
|
|
52
|
+
subscription?: Subscription;
|
|
53
|
+
supportPhoneNumber?: string;
|
|
54
|
+
operatorsActive?: boolean;
|
|
55
|
+
employees?: Employee[];
|
|
56
|
+
defaultView?: string;
|
|
57
|
+
loanerVehicleActive?: boolean;
|
|
58
|
+
loanerVehicleRequestActive?: boolean;
|
|
59
|
+
paymentAuthorizationActive?: boolean;
|
|
60
|
+
paymentAuthorizationMinDowntime?: number;
|
|
61
|
+
timezone: string;
|
|
62
|
+
customStyle?: string;
|
|
63
|
+
mailCustomization?: boolean;
|
|
64
|
+
billingActive?: boolean;
|
|
65
|
+
billingToken?: string;
|
|
66
|
+
billingSimulationActive?: boolean;
|
|
67
|
+
appId?: number;
|
|
59
68
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
69
|
+
constructor(
|
|
70
|
+
id: string,
|
|
71
|
+
adminId: string,
|
|
72
|
+
name: string,
|
|
73
|
+
address: Address,
|
|
74
|
+
workforce: number,
|
|
75
|
+
prestations: Prestation[],
|
|
76
|
+
schedules: Schedule[],
|
|
77
|
+
contactPhone: string,
|
|
78
|
+
prestationCategories: CategoryPrestation[],
|
|
79
|
+
dayPeriodFastServiceExcluded: boolean,
|
|
80
|
+
loanerVehicleFastServiceExcluded: boolean,
|
|
81
|
+
fastServiceThreshold: number,
|
|
82
|
+
timezone: string,
|
|
83
|
+
vehicles?: VehicleGarage[],
|
|
84
|
+
contactEmail?: string,
|
|
85
|
+
logo?: string,
|
|
86
|
+
suppliers?: Supplier[],
|
|
87
|
+
documents?: Document[],
|
|
88
|
+
subscriptions?: Subscription[],
|
|
89
|
+
loanerVehicleActive?: boolean,
|
|
90
|
+
loanerVehicleRequestActive?: boolean,
|
|
91
|
+
customStyle?: string,
|
|
92
|
+
subscription?: Subscription,
|
|
93
|
+
partialWorkforce?: number,
|
|
94
|
+
mailCustomization?: boolean,
|
|
95
|
+
billingActive?: boolean,
|
|
96
|
+
billingToken?: string,
|
|
97
|
+
billingSimulationActive?: boolean,
|
|
98
|
+
appId?: number
|
|
99
|
+
) {
|
|
100
|
+
this.id = id;
|
|
101
|
+
this.adminId = adminId;
|
|
102
|
+
this.name = name;
|
|
103
|
+
this.address = address;
|
|
104
|
+
this.workforce = workforce;
|
|
105
|
+
this.prestationCategories = prestationCategories;
|
|
106
|
+
this.prestations = prestations;
|
|
107
|
+
this.schedules = schedules;
|
|
108
|
+
this.contactPhone = contactPhone;
|
|
109
|
+
this.contactEmail = contactEmail;
|
|
110
|
+
this.logo = logo;
|
|
111
|
+
this.suppliers = suppliers;
|
|
112
|
+
this.documents = documents;
|
|
113
|
+
this.subscriptions = subscriptions;
|
|
114
|
+
this.vehicles = vehicles;
|
|
115
|
+
this.loanerVehicleActive = loanerVehicleActive;
|
|
116
|
+
this.loanerVehicleRequestActive = loanerVehicleRequestActive;
|
|
117
|
+
this.subscription = subscription;
|
|
118
|
+
this.partialWorkforce = partialWorkforce;
|
|
119
|
+
this.dayPeriodFastServiceExcluded = dayPeriodFastServiceExcluded;
|
|
120
|
+
this.loanerVehicleFastServiceExcluded = loanerVehicleFastServiceExcluded;
|
|
121
|
+
this.fastServiceThreshold = fastServiceThreshold;
|
|
122
|
+
this.customStyle = customStyle;
|
|
123
|
+
this.timezone = timezone;
|
|
124
|
+
this.mailCustomization = mailCustomization;
|
|
125
|
+
this.billingActive = billingActive;
|
|
126
|
+
this.billingToken = billingToken;
|
|
127
|
+
this.billingSimulationActive = billingSimulationActive;
|
|
128
|
+
this.appId = appId;
|
|
129
|
+
}
|
|
113
130
|
}
|