@movalib/movalib-commons 1.59.14 → 1.59.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/devIndex.tsx +1 -1
- package/dist/devIndex.js +1 -1
- package/dist/index.d.ts +6 -3
- package/dist/index.js +14 -4
- package/dist/src/components/LinkedDocumentDialog.d.ts +11 -0
- package/dist/src/components/LinkedDocumentDialog.js +55 -0
- package/dist/src/{VehicleFullCard.d.ts → components/vehicle/VehicleFullCard.d.ts} +5 -2
- package/dist/src/{VehicleFullCard.js → components/vehicle/VehicleFullCard.js} +44 -22
- package/dist/src/components/vehicle/VehiclePlateField.d.ts +8 -0
- package/dist/src/components/vehicle/VehiclePlateField.js +122 -0
- package/dist/src/helpers/CookieUtils.js +2 -1
- package/dist/src/helpers/Enums.d.ts +6 -1
- package/dist/src/helpers/Enums.js +6 -1
- package/dist/src/helpers/Tools.d.ts +1 -0
- package/dist/src/helpers/Tools.js +10 -1
- package/dist/src/services/AuthenticationService.js +2 -0
- package/dist/src/services/GarageService.d.ts +2 -0
- package/dist/src/services/GarageService.js +18 -3
- package/dist/src/services/UserConnected.d.ts +9 -0
- package/dist/src/services/UserConnected.js +59 -0
- package/dist/src/services/UserService.d.ts +1 -1
- package/dist/src/services/VehicleService.d.ts +3 -0
- package/dist/src/services/VehicleService.js +22 -0
- package/dist/src/style/styled.d.ts +17 -0
- package/dist/src/style/styled.js +68 -0
- package/dist/src/style/styled.ts +70 -0
- package/index.ts +8 -3
- package/package.json +3 -2
- package/src/VehiclePlateField.tsx +1 -0
- package/src/components/LinkedDocumentDialog.tsx +200 -0
- package/src/components/vehicle/VehicleFullCard.tsx +549 -0
- package/src/components/vehicle/VehiclePlateField.tsx +164 -0
- package/src/helpers/CookieUtils.ts +2 -1
- package/src/helpers/Enums.ts +8 -1
- package/src/helpers/Tools.ts +5 -0
- package/src/models/Event.ts +1 -1
- package/src/services/AuthenticationService.ts +2 -1
- package/src/services/GarageService.ts +42 -36
- package/src/services/UserConnected.ts +56 -0
- package/src/services/UserService.ts +1 -1
- package/src/services/VehicleService.ts +25 -0
- package/src/style/styled.ts +70 -0
- package/src/VehicleFullCard.tsx +0 -503
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.validateField = exports.formatVehicleTireStr = exports.formatVehicleTire = exports.formatFrenchVehiclePlate = 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.isSafariOniOS = exports.flexStart = exports.getApplicationsShortLabels = void 0;
|
|
6
|
+
exports.validateField = exports.formatVehicleTireStr = exports.formatVehicleTire = exports.formatFrenchVehiclePlate = 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.iAmOwner = exports.getDayOfWeekIndex = exports.getDayOfWeekLabel = exports.FR_WEEK_DAYS = exports.isSafariOniOS = exports.flexStart = exports.getApplicationsShortLabels = void 0;
|
|
4
7
|
var Enums_1 = require("./Enums");
|
|
8
|
+
var UserConnected_1 = __importDefault(require("../services/UserConnected"));
|
|
5
9
|
var getApplicationsShortLabels = function (applications) {
|
|
6
10
|
if (!applications) {
|
|
7
11
|
return '';
|
|
@@ -38,6 +42,11 @@ var getDayOfWeekIndex = function (day) {
|
|
|
38
42
|
return -1;
|
|
39
43
|
};
|
|
40
44
|
exports.getDayOfWeekIndex = getDayOfWeekIndex;
|
|
45
|
+
var iAmOwner = function (ownreId) {
|
|
46
|
+
var _a;
|
|
47
|
+
return ownreId === ((_a = UserConnected_1.default.getInstance().me) === null || _a === void 0 ? void 0 : _a.id);
|
|
48
|
+
};
|
|
49
|
+
exports.iAmOwner = iAmOwner;
|
|
41
50
|
var formatPhoneNumber = function (phoneNumber) {
|
|
42
51
|
var formattedNumber = "";
|
|
43
52
|
if (phoneNumber) {
|
|
@@ -43,6 +43,7 @@ var ApiHelper_1 = require("../helpers/ApiHelper");
|
|
|
43
43
|
var CookieUtils_1 = require("../helpers/CookieUtils");
|
|
44
44
|
var Enums_1 = require("../helpers/Enums");
|
|
45
45
|
var Logger_1 = __importDefault(require("../helpers/Logger"));
|
|
46
|
+
var UserConnected_1 = __importDefault(require("./UserConnected"));
|
|
46
47
|
var UserService_1 = __importDefault(require("./UserService"));
|
|
47
48
|
var AuthenticationService = /** @class */ (function () {
|
|
48
49
|
function AuthenticationService() {
|
|
@@ -110,6 +111,7 @@ var AuthenticationService = /** @class */ (function () {
|
|
|
110
111
|
Logger_1.default.error(errorMsg);
|
|
111
112
|
return [2 /*return*/, { success: false, error: errorMsg }];
|
|
112
113
|
}
|
|
114
|
+
UserConnected_1.default.getInstance().me = userResponse.data;
|
|
113
115
|
return [2 /*return*/, { success: true, data: userResponse.data }];
|
|
114
116
|
case 3: return [2 /*return*/, tokenResponse];
|
|
115
117
|
case 4: return [3 /*break*/, 6];
|
|
@@ -12,6 +12,8 @@ export default class GarageService {
|
|
|
12
12
|
static updateColorPrestationCategory(garageId: string, categoryCode: string, color: string): Promise<APIResponse<string>>;
|
|
13
13
|
static updateGarageEventColor(garageId: string, eventId: string, color: string): Promise<APIResponse<string>>;
|
|
14
14
|
static updateVehicleGarageEvent(garageId: string, eventId: string, req: any): Promise<APIResponse<string>>;
|
|
15
|
+
static uploadEventDocument(garageId: string, eventId: string, req: FormData): Promise<APIResponse<string>>;
|
|
16
|
+
static deleteEventDocument(garageId: string, eventId: string, docId: string): Promise<APIResponse<string>>;
|
|
15
17
|
static sendGarageMandate(garageId: string): Promise<APIResponse<string>>;
|
|
16
18
|
static getGarageAllData(garageId: string): Promise<APIResponse<Garage>>;
|
|
17
19
|
static createGaragePrestationRequest(garageId: string, req: any): Promise<APIResponse<string>>;
|
|
@@ -65,7 +65,7 @@ var GarageService = /** @class */ (function () {
|
|
|
65
65
|
url: "".concat(ApiHelper_1.API_BASE_URL, "/garage/").concat(garageId, "/prestation-category/").concat(categoryCode, "/color"),
|
|
66
66
|
method: Enums_1.APIMethod.PATCH,
|
|
67
67
|
appType: Enums_1.MovaAppType.GARAGE,
|
|
68
|
-
body: JSON.stringify({ color: color })
|
|
68
|
+
body: JSON.stringify({ color: color })
|
|
69
69
|
});
|
|
70
70
|
};
|
|
71
71
|
GarageService.updateGarageEventColor = function (garageId, eventId, color) {
|
|
@@ -73,7 +73,7 @@ var GarageService = /** @class */ (function () {
|
|
|
73
73
|
url: "".concat(ApiHelper_1.API_BASE_URL, "/garage/").concat(garageId, "/event/").concat(eventId, "/color"),
|
|
74
74
|
method: Enums_1.APIMethod.PATCH,
|
|
75
75
|
appType: Enums_1.MovaAppType.GARAGE,
|
|
76
|
-
body: JSON.stringify({ color: color })
|
|
76
|
+
body: JSON.stringify({ color: color })
|
|
77
77
|
});
|
|
78
78
|
};
|
|
79
79
|
GarageService.updateVehicleGarageEvent = function (garageId, eventId, req) {
|
|
@@ -81,7 +81,22 @@ var GarageService = /** @class */ (function () {
|
|
|
81
81
|
url: "".concat(ApiHelper_1.API_BASE_URL, "/garage/").concat(garageId, "/event/").concat(eventId, "/vehicle"),
|
|
82
82
|
method: Enums_1.APIMethod.PATCH,
|
|
83
83
|
appType: Enums_1.MovaAppType.GARAGE,
|
|
84
|
-
body: JSON.stringify(req)
|
|
84
|
+
body: JSON.stringify(req)
|
|
85
|
+
});
|
|
86
|
+
};
|
|
87
|
+
GarageService.uploadEventDocument = function (garageId, eventId, req) {
|
|
88
|
+
return (0, ApiHelper_1.request)({
|
|
89
|
+
url: "".concat(ApiHelper_1.API_BASE_URL, "/garage/").concat(garageId, "/event/").concat(eventId, "/documents"),
|
|
90
|
+
method: Enums_1.APIMethod.POST,
|
|
91
|
+
appType: Enums_1.MovaAppType.GARAGE,
|
|
92
|
+
body: req
|
|
93
|
+
});
|
|
94
|
+
};
|
|
95
|
+
GarageService.deleteEventDocument = function (garageId, eventId, docId) {
|
|
96
|
+
return (0, ApiHelper_1.request)({
|
|
97
|
+
url: "".concat(ApiHelper_1.API_BASE_URL, "/garage/").concat(garageId, "/event/").concat(eventId, "/documents/").concat(docId),
|
|
98
|
+
appType: Enums_1.MovaAppType.GARAGE,
|
|
99
|
+
method: Enums_1.APIMethod.DELETE,
|
|
85
100
|
});
|
|
86
101
|
};
|
|
87
102
|
GarageService.sendGarageMandate = function (garageId) {
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
var UserService_1 = __importDefault(require("./UserService"));
|
|
7
|
+
var UserConnected = /** @class */ (function () {
|
|
8
|
+
function UserConnected() {
|
|
9
|
+
var storedUser = localStorage.getItem('user');
|
|
10
|
+
this._me = storedUser ? JSON.parse(storedUser) : null;
|
|
11
|
+
}
|
|
12
|
+
UserConnected.getInstance = function () {
|
|
13
|
+
if (!UserConnected.instance) {
|
|
14
|
+
UserConnected.instance = new UserConnected();
|
|
15
|
+
}
|
|
16
|
+
return UserConnected.instance;
|
|
17
|
+
};
|
|
18
|
+
Object.defineProperty(UserConnected.prototype, "me", {
|
|
19
|
+
get: function () {
|
|
20
|
+
var _this = this;
|
|
21
|
+
if (!this._me) {
|
|
22
|
+
var storedUser = localStorage.getItem('user');
|
|
23
|
+
if (storedUser === undefined || storedUser === null || storedUser === 'undefined') {
|
|
24
|
+
UserService_1.default.getCurrentUser()
|
|
25
|
+
.then(function (response) {
|
|
26
|
+
localStorage.setItem('user', JSON.stringify(response.data));
|
|
27
|
+
_this._me = response.data;
|
|
28
|
+
return _this._me;
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
this._me = JSON.parse(storedUser);
|
|
33
|
+
return this._me;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
return this._me;
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
set: function (user) {
|
|
41
|
+
this._me = user;
|
|
42
|
+
if (user) {
|
|
43
|
+
localStorage.setItem('user', JSON.stringify(user));
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
localStorage.removeItem('user'); // Supprime les données si user est null ou undefined
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
enumerable: false,
|
|
50
|
+
configurable: true
|
|
51
|
+
});
|
|
52
|
+
UserConnected.prototype.clearUser = function () {
|
|
53
|
+
// Méthode pour effacer l'utilisateur
|
|
54
|
+
this._me = null;
|
|
55
|
+
localStorage.removeItem('user');
|
|
56
|
+
};
|
|
57
|
+
return UserConnected;
|
|
58
|
+
}());
|
|
59
|
+
exports.default = UserConnected;
|
|
@@ -3,5 +3,8 @@ import { MovaAppType } from "../helpers/Enums";
|
|
|
3
3
|
import { EditVehicleParams } from "./VehicleService.types";
|
|
4
4
|
export default class VehicleService {
|
|
5
5
|
static getVehicleDescription(appType: MovaAppType, plate: string): Promise<APIResponse<string>>;
|
|
6
|
+
static getVehicleDocument(appType: MovaAppType, vehicleId: number): Promise<APIResponse<string>>;
|
|
7
|
+
static deleteVehicleDocument(appType: MovaAppType, vehicleId: number, documentId: string): Promise<APIResponse<string>>;
|
|
8
|
+
static uploadVehicleDocument(appType: MovaAppType, vehicleId: number, req: FormData): Promise<APIResponse<string>>;
|
|
6
9
|
static editVehicle({ vehicleId, appType, ...payload }: EditVehicleParams): Promise<APIResponse<string>>;
|
|
7
10
|
}
|
|
@@ -23,6 +23,28 @@ var VehicleService = /** @class */ (function () {
|
|
|
23
23
|
appType: appType,
|
|
24
24
|
});
|
|
25
25
|
};
|
|
26
|
+
VehicleService.getVehicleDocument = function (appType, vehicleId) {
|
|
27
|
+
return (0, ApiHelper_1.request)({
|
|
28
|
+
url: "".concat(ApiHelper_1.API_BASE_URL, "/vehicle/").concat(vehicleId, "/document"),
|
|
29
|
+
method: Enums_1.APIMethod.GET,
|
|
30
|
+
appType: appType,
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
VehicleService.deleteVehicleDocument = function (appType, vehicleId, documentId) {
|
|
34
|
+
return (0, ApiHelper_1.request)({
|
|
35
|
+
url: "".concat(ApiHelper_1.API_BASE_URL, "/vehicle/").concat(vehicleId, "/documents/").concat(documentId),
|
|
36
|
+
method: Enums_1.APIMethod.DELETE,
|
|
37
|
+
appType: appType,
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
VehicleService.uploadVehicleDocument = function (appType, vehicleId, req) {
|
|
41
|
+
return (0, ApiHelper_1.request)({
|
|
42
|
+
url: "".concat(ApiHelper_1.API_BASE_URL, "/vehicle/").concat(vehicleId, "/documents"),
|
|
43
|
+
method: Enums_1.APIMethod.POST,
|
|
44
|
+
appType: appType,
|
|
45
|
+
body: req
|
|
46
|
+
});
|
|
47
|
+
};
|
|
26
48
|
VehicleService.editVehicle = function (_a) {
|
|
27
49
|
var vehicleId = _a.vehicleId, appType = _a.appType, payload = __rest(_a, ["vehicleId", "appType"]);
|
|
28
50
|
return (0, ApiHelper_1.request)({
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ToggleButtonProps } from "@mui/material";
|
|
3
|
+
interface StyledToggleButtonProps extends ToggleButtonProps {
|
|
4
|
+
customSelectedBackgroundColor?: string;
|
|
5
|
+
customBackgroundColor?: string;
|
|
6
|
+
customHoverColor?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare const StyledToggleButton: import("@emotion/styled").StyledComponent<import("@mui/material").ToggleButtonOwnProps & Omit<import("@mui/material").ButtonBaseOwnProps, "classes"> & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
|
|
9
|
+
ref?: ((instance: HTMLButtonElement | null) => void) | import("react").RefObject<HTMLButtonElement> | null | undefined;
|
|
10
|
+
}, "color" | "children" | "sx" | "classes" | "className" | "style" | "tabIndex" | "onChange" | "onClick" | "fullWidth" | "size" | "disabled" | "value" | "action" | "selected" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | "disableFocusRipple"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & StyledToggleButtonProps, {}, {}>;
|
|
11
|
+
/**
|
|
12
|
+
* Personnalisation du style des Toogle Buttons
|
|
13
|
+
* Note : il n'est posssible de le personnaliser directement au niveau
|
|
14
|
+
* de l'objet "components" du theme.
|
|
15
|
+
*/
|
|
16
|
+
export declare const StyledToggleButtonGroup: import("@emotion/styled").StyledComponent<import("@mui/material").ToggleButtonGroupProps & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StyledToggleButtonGroup = exports.StyledToggleButton = void 0;
|
|
4
|
+
var material_1 = require("@mui/material");
|
|
5
|
+
exports.StyledToggleButton = (0, material_1.styled)(material_1.ToggleButton)(function (_a) {
|
|
6
|
+
var theme = _a.theme, customSelectedBackgroundColor = _a.customSelectedBackgroundColor, customBackgroundColor = _a.customBackgroundColor, customHoverColor = _a.customHoverColor;
|
|
7
|
+
return ({
|
|
8
|
+
padding: theme.spacing(1),
|
|
9
|
+
marginBottom: theme.spacing(2),
|
|
10
|
+
borderRadius: theme.shape.borderRadius,
|
|
11
|
+
'&:hover': {
|
|
12
|
+
backgroundColor: customHoverColor || theme.palette.warning.dark,
|
|
13
|
+
},
|
|
14
|
+
'&.Mui-selected': {
|
|
15
|
+
backgroundColor: customSelectedBackgroundColor || theme.palette.warning.main,
|
|
16
|
+
},
|
|
17
|
+
'&.Mui-selected:hover': {
|
|
18
|
+
backgroundColor: customHoverColor || theme.palette.warning.dark,
|
|
19
|
+
},
|
|
20
|
+
'&:not(:first-of-type)': {
|
|
21
|
+
borderRadius: theme.shape.borderRadius,
|
|
22
|
+
border: '1px solid rgba(0, 0, 0, 0.12)',
|
|
23
|
+
},
|
|
24
|
+
'&:first-of-type': {
|
|
25
|
+
borderRadius: theme.shape.borderRadius,
|
|
26
|
+
},
|
|
27
|
+
'&.Mui-disabled': {
|
|
28
|
+
border: 0,
|
|
29
|
+
backgroundColor: theme.palette.grey[100],
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
/**
|
|
34
|
+
* Personnalisation du style des Toogle Buttons
|
|
35
|
+
* Note : il n'est posssible de le personnaliser directement au niveau
|
|
36
|
+
* de l'objet "components" du theme.
|
|
37
|
+
*/
|
|
38
|
+
exports.StyledToggleButtonGroup = (0, material_1.styled)(material_1.ToggleButtonGroup)(function (_a) {
|
|
39
|
+
var theme = _a.theme;
|
|
40
|
+
return ({
|
|
41
|
+
'& .MuiToggleButtonGroup-grouped': {
|
|
42
|
+
padding: theme.spacing(1),
|
|
43
|
+
marginBottom: theme.spacing(2),
|
|
44
|
+
marginLeft: theme.spacing(1),
|
|
45
|
+
marginRight: theme.spacing(1),
|
|
46
|
+
'&.Mui-disabled': {
|
|
47
|
+
border: 0,
|
|
48
|
+
backgroundColor: theme.palette.grey[100],
|
|
49
|
+
},
|
|
50
|
+
'&.Mui-selected': {
|
|
51
|
+
backgroundColor: theme.palette.primary.light,
|
|
52
|
+
},
|
|
53
|
+
'&:not(:first-of-type)': {
|
|
54
|
+
borderRadius: theme.shape.borderRadius,
|
|
55
|
+
border: '1px solid rgba(0, 0, 0, 0.12)',
|
|
56
|
+
},
|
|
57
|
+
'&:first-of-type': {
|
|
58
|
+
borderRadius: theme.shape.borderRadius,
|
|
59
|
+
},
|
|
60
|
+
'&:hover': {
|
|
61
|
+
backgroundColor: (0, material_1.lighten)(theme.palette.primary.light, 0.3), // Modifier la couleur de fond au survol
|
|
62
|
+
},
|
|
63
|
+
'&.Mui-selected:hover': {
|
|
64
|
+
backgroundColor: theme.palette.primary.light, // Modifier la couleur de fond au survol
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
});
|
|
68
|
+
});
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { ToggleButtonProps, ToggleButton, styled, ToggleButtonGroup, lighten } from "@mui/material";
|
|
2
|
+
|
|
3
|
+
interface StyledToggleButtonProps extends ToggleButtonProps {
|
|
4
|
+
customSelectedBackgroundColor?: string;
|
|
5
|
+
customBackgroundColor?: string;
|
|
6
|
+
customHoverColor?: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const StyledToggleButton = styled(ToggleButton)<StyledToggleButtonProps>(
|
|
10
|
+
({ theme, customSelectedBackgroundColor, customBackgroundColor, customHoverColor }) => ({
|
|
11
|
+
padding: theme.spacing(1),
|
|
12
|
+
marginBottom: theme.spacing(2),
|
|
13
|
+
borderRadius: theme.shape.borderRadius,
|
|
14
|
+
'&:hover': {
|
|
15
|
+
backgroundColor: customHoverColor || theme.palette.warning.dark,
|
|
16
|
+
},
|
|
17
|
+
'&.Mui-selected': {
|
|
18
|
+
backgroundColor: customSelectedBackgroundColor || theme.palette.warning.main,
|
|
19
|
+
},
|
|
20
|
+
'&.Mui-selected:hover': {
|
|
21
|
+
backgroundColor: customHoverColor || theme.palette.warning.dark,
|
|
22
|
+
},
|
|
23
|
+
'&:not(:first-of-type)': {
|
|
24
|
+
borderRadius: theme.shape.borderRadius,
|
|
25
|
+
border: '1px solid rgba(0, 0, 0, 0.12)',
|
|
26
|
+
},
|
|
27
|
+
'&:first-of-type': {
|
|
28
|
+
borderRadius: theme.shape.borderRadius,
|
|
29
|
+
},
|
|
30
|
+
'&.Mui-disabled': {
|
|
31
|
+
border: 0,
|
|
32
|
+
backgroundColor: theme.palette.grey[100],
|
|
33
|
+
},
|
|
34
|
+
}),
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Personnalisation du style des Toogle Buttons
|
|
40
|
+
* Note : il n'est posssible de le personnaliser directement au niveau
|
|
41
|
+
* de l'objet "components" du theme.
|
|
42
|
+
*/
|
|
43
|
+
export const StyledToggleButtonGroup = styled(ToggleButtonGroup)(({ theme }) => ({
|
|
44
|
+
'& .MuiToggleButtonGroup-grouped': {
|
|
45
|
+
padding: theme.spacing(1),
|
|
46
|
+
marginBottom: theme.spacing(2),
|
|
47
|
+
marginLeft: theme.spacing(1),
|
|
48
|
+
marginRight: theme.spacing(1),
|
|
49
|
+
'&.Mui-disabled': {
|
|
50
|
+
border: 0,
|
|
51
|
+
backgroundColor: theme.palette.grey[100],
|
|
52
|
+
},
|
|
53
|
+
'&.Mui-selected': {
|
|
54
|
+
backgroundColor: theme.palette.primary.light,
|
|
55
|
+
},
|
|
56
|
+
'&:not(:first-of-type)': {
|
|
57
|
+
borderRadius: theme.shape.borderRadius,
|
|
58
|
+
border: '1px solid rgba(0, 0, 0, 0.12)',
|
|
59
|
+
},
|
|
60
|
+
'&:first-of-type': {
|
|
61
|
+
borderRadius: theme.shape.borderRadius,
|
|
62
|
+
},
|
|
63
|
+
'&:hover': {
|
|
64
|
+
backgroundColor: lighten(theme.palette.primary.light, 0.3), // Modifier la couleur de fond au survol
|
|
65
|
+
},
|
|
66
|
+
'&.Mui-selected:hover': {
|
|
67
|
+
backgroundColor: theme.palette.primary.light, // Modifier la couleur de fond au survol
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
}));
|
package/index.ts
CHANGED
|
@@ -6,7 +6,7 @@ export { default as VehicleService } from './src/services/VehicleService';
|
|
|
6
6
|
export { default as AuthenticationService } from './src/services/AuthenticationService';
|
|
7
7
|
export { default as GarageService } from './src/services/GarageService';
|
|
8
8
|
export { default as UserService } from './src/services/UserService';
|
|
9
|
-
|
|
9
|
+
export { default as UserConnected } from './src/services/UserConnected';
|
|
10
10
|
// Export des composants
|
|
11
11
|
export { default as DialogForgotPassword } from './src/DialogForgotPassword';
|
|
12
12
|
export { default as IbanInput } from './src/IbanInput';
|
|
@@ -14,12 +14,12 @@ export { default as GaragePLV } from './src/GaragePLV';
|
|
|
14
14
|
export { default as AccountValidation } from './src/AccountValidation';
|
|
15
15
|
export { default as AddressFields } from './src/AddressFields';
|
|
16
16
|
export { default as ScheduleFields } from './src/ScheduleFields';
|
|
17
|
-
export { default as VehicleFullCard } from './src/VehicleFullCard';
|
|
17
|
+
export { default as VehicleFullCard } from './src/components/vehicle/VehicleFullCard';
|
|
18
18
|
export { default as MovaDigitalPassport } from './src/MovaDigitalPassport';
|
|
19
19
|
export { default as Loader } from './src/Loader';
|
|
20
20
|
export { default as MovaDialog } from './src/MovaDialog';
|
|
21
21
|
export { default as QRCode } from './src/QRCode';
|
|
22
|
-
export { default as VehiclePlateField, regexPlate, oldRegexPlate } from './src/VehiclePlateField';
|
|
22
|
+
export { default as VehiclePlateField, regexPlate, oldRegexPlate } from './src/components/vehicle/VehiclePlateField';
|
|
23
23
|
export { default as TestButton } from './src/TestButton';
|
|
24
24
|
export { default as MovaSnackbar } from './src/MovaSnackbar';
|
|
25
25
|
export { default as MovaLogin } from './src/MovaLogin';
|
|
@@ -31,6 +31,7 @@ export { default as GenderSelector } from './src/GenderSelector';
|
|
|
31
31
|
export { default as ActivateAccount } from './src/components/singup/ActivateAccount';
|
|
32
32
|
export { QrCodePLVContainer } from './src/components/QrCodePLVContainer/QrCodePLVContainer';
|
|
33
33
|
export { PLVComponent, PrintSize } from './src/components/QrCodePLVContainer/PLVComponent';
|
|
34
|
+
export {LinkedDocumentDialog} from './src/components/LinkedDocumentDialog';
|
|
34
35
|
// Export des classes
|
|
35
36
|
export { default as Subscription } from './src/models/Subscription';
|
|
36
37
|
export { default as Absence } from './src/models/Absence';
|
|
@@ -80,6 +81,7 @@ export {
|
|
|
80
81
|
findScheduleByDayOfWeek,
|
|
81
82
|
getDayOfWeekLabel,
|
|
82
83
|
isSafariOniOS,
|
|
84
|
+
iAmOwner,
|
|
83
85
|
getApplicationsShortLabels,
|
|
84
86
|
} from './src/helpers/Tools';
|
|
85
87
|
export { validatePhoneNumber, validateText, validateEmail } from './src/helpers/Validator';
|
|
@@ -117,3 +119,6 @@ export {
|
|
|
117
119
|
|
|
118
120
|
// Export des utils
|
|
119
121
|
export { openDialogPrint } from './src/utils/DialogPrint';
|
|
122
|
+
|
|
123
|
+
// Export des styles
|
|
124
|
+
export { StyledToggleButton, StyledToggleButtonGroup} from './src/style/styled';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@movalib/movalib-commons",
|
|
3
|
-
"version": "1.59.
|
|
3
|
+
"version": "1.59.15",
|
|
4
4
|
"description": "Bibliothèque d'objets communs à l'ensemble des projets React de Movalib",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
"build": "rm -rf dist && tsc && npm run copy-assets",
|
|
11
11
|
"copy-assets": "cp -r src/assets/ dist/src/assets/ && cp -r src/style/ dist/src/style/",
|
|
12
12
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
13
|
-
"clean": "rm -rf dist node_modules package-lock.json"
|
|
13
|
+
"clean": "rm -rf dist node_modules package-lock.json",
|
|
14
|
+
"build:dev" : "rm -rf dist && tsc && npm run copy-assets && npm pack"
|
|
14
15
|
},
|
|
15
16
|
"keywords": [],
|
|
16
17
|
"author": "",
|
|
@@ -49,6 +49,7 @@ const VehiclePlateField: FunctionComponent<VehiclePlateFieldProps> = ({ onValidV
|
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
+
|
|
52
53
|
const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
53
54
|
|
|
54
55
|
let inputValue = e.target.value.toUpperCase().replace(/[^A-Z0-9]/g, ''); // Convertir en majuscules et supprimer les caractères non valides
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import Dialog from "@mui/material/Dialog";
|
|
2
|
+
import Toolbar from "@mui/material/Toolbar";
|
|
3
|
+
import theme from "../../theme";
|
|
4
|
+
import DialogTitle from "@mui/material/DialogTitle";
|
|
5
|
+
import Box from "@mui/material/Box";
|
|
6
|
+
import { FindInPage } from "@mui/icons-material";
|
|
7
|
+
import Typography from "@mui/material/Typography";
|
|
8
|
+
import IconButton from "@mui/material/IconButton";
|
|
9
|
+
import CloseRounded from "@mui/icons-material/CloseRounded";
|
|
10
|
+
import DialogContent from "@mui/material/DialogContent";
|
|
11
|
+
import DialogActions from "@mui/material/DialogActions";
|
|
12
|
+
import Button from "@mui/material/Button";
|
|
13
|
+
import { DocumentType, MovaAppType } from "../helpers/Enums";
|
|
14
|
+
import { useState } from "react";
|
|
15
|
+
import { ToggleButtonGroup, useMediaQuery } from "@mui/material";
|
|
16
|
+
import { StyledToggleButton } from "../style/styled";
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
type LinkedDocumentDialog = {
|
|
20
|
+
isShowLinkedDocument: boolean;
|
|
21
|
+
toggleShowLinkedDocument: (docType: DocumentType | null) => void;
|
|
22
|
+
isVehicle: boolean;
|
|
23
|
+
message?: JSX.Element;
|
|
24
|
+
appType: MovaAppType;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export const LinkedDocumentDialog = ({
|
|
28
|
+
isShowLinkedDocument,
|
|
29
|
+
toggleShowLinkedDocument,
|
|
30
|
+
isVehicle,
|
|
31
|
+
message,
|
|
32
|
+
appType,
|
|
33
|
+
}: LinkedDocumentDialog) => {
|
|
34
|
+
|
|
35
|
+
const [selectedTypeDocument, setSelectedTypeDocument] = useState<DocumentType | null>(null);
|
|
36
|
+
const isMobile = useMediaQuery(theme.breakpoints.down('md'));
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<Dialog
|
|
40
|
+
open={isShowLinkedDocument}
|
|
41
|
+
fullWidth
|
|
42
|
+
maxWidth='md'
|
|
43
|
+
onClose={() => toggleShowLinkedDocument(null)}
|
|
44
|
+
aria-labelledby='alert-dialog-title'
|
|
45
|
+
aria-describedby='alert-dialog-description'
|
|
46
|
+
>
|
|
47
|
+
<Toolbar
|
|
48
|
+
disableGutters
|
|
49
|
+
sx={{
|
|
50
|
+
display: 'block',
|
|
51
|
+
background: theme.palette.grey[200],
|
|
52
|
+
minHeight: 3,
|
|
53
|
+
p: 0,
|
|
54
|
+
}}
|
|
55
|
+
>
|
|
56
|
+
<DialogTitle id='search-dialog-title'>
|
|
57
|
+
<Box position='relative' sx={{ display: 'flex', flexDirection: 'row', justifyContent: 'space-between' }}>
|
|
58
|
+
<FindInPage sx={{ height: '30px', width: '30px' }} />
|
|
59
|
+
<Typography
|
|
60
|
+
variant='h6'
|
|
61
|
+
sx={{
|
|
62
|
+
textTransform: 'uppercase',
|
|
63
|
+
fontStyle: 'bold',
|
|
64
|
+
textAlign: 'center',
|
|
65
|
+
}}
|
|
66
|
+
>
|
|
67
|
+
Quel type de document ?
|
|
68
|
+
</Typography>
|
|
69
|
+
<IconButton
|
|
70
|
+
size='small'
|
|
71
|
+
aria-label='close'
|
|
72
|
+
onClick={() => toggleShowLinkedDocument(null)}
|
|
73
|
+
title={'Fermer'}
|
|
74
|
+
>
|
|
75
|
+
<CloseRounded />
|
|
76
|
+
</IconButton>
|
|
77
|
+
</Box>
|
|
78
|
+
</DialogTitle>
|
|
79
|
+
</Toolbar>
|
|
80
|
+
<DialogContent sx={{ textAlign: 'center' }}>
|
|
81
|
+
<ToggleButtonGroup
|
|
82
|
+
orientation={isMobile ? 'vertical' : 'horizontal'}
|
|
83
|
+
size='small'
|
|
84
|
+
value={selectedTypeDocument}
|
|
85
|
+
exclusive
|
|
86
|
+
onChange={(_, value: DocumentType) => {
|
|
87
|
+
setSelectedTypeDocument(value);
|
|
88
|
+
}}
|
|
89
|
+
aria-label='update-scheduling-alert'
|
|
90
|
+
sx={{ gap: 3, flexWrap: 'wrap', justifyContent: 'center' }}
|
|
91
|
+
>
|
|
92
|
+
{isVehicle ? (
|
|
93
|
+
<>
|
|
94
|
+
<StyledToggleButton
|
|
95
|
+
size='small'
|
|
96
|
+
sx={{ width: '230px' }}
|
|
97
|
+
customSelectedBackgroundColor={theme.palette.primary.main}
|
|
98
|
+
customHoverColor={theme.palette.primary.light}
|
|
99
|
+
value={DocumentType.VEHICLE_TIRE_PHOTO}
|
|
100
|
+
selected={selectedTypeDocument === DocumentType.VEHICLE_TIRE_PHOTO}
|
|
101
|
+
aria-label='document tire'
|
|
102
|
+
>
|
|
103
|
+
<b>Photo pneu</b>
|
|
104
|
+
</StyledToggleButton>
|
|
105
|
+
{appType === MovaAppType.INDIVIDUAL && (
|
|
106
|
+
<StyledToggleButton
|
|
107
|
+
size='small'
|
|
108
|
+
sx={{ width: '230px' }}
|
|
109
|
+
customSelectedBackgroundColor={theme.palette.primary.main}
|
|
110
|
+
customHoverColor={theme.palette.primary.light}
|
|
111
|
+
value={DocumentType.VEHICLE_MAINTENANCE_INVOICE}
|
|
112
|
+
selected={selectedTypeDocument === DocumentType.VEHICLE_MAINTENANCE_INVOICE}
|
|
113
|
+
aria-label='invoice document'
|
|
114
|
+
>
|
|
115
|
+
<b>Facture</b>
|
|
116
|
+
</StyledToggleButton>
|
|
117
|
+
)}
|
|
118
|
+
<StyledToggleButton
|
|
119
|
+
size='small'
|
|
120
|
+
sx={{ width: '230px' }}
|
|
121
|
+
customSelectedBackgroundColor={theme.palette.primary.main}
|
|
122
|
+
customHoverColor={theme.palette.primary.light}
|
|
123
|
+
value={DocumentType.VEHICLE_INSPECTION}
|
|
124
|
+
selected={selectedTypeDocument === DocumentType.VEHICLE_INSPECTION}
|
|
125
|
+
aria-label='vehicule inspection docuemnt'
|
|
126
|
+
>
|
|
127
|
+
<b>Contrôle technique</b>
|
|
128
|
+
</StyledToggleButton>
|
|
129
|
+
|
|
130
|
+
<StyledToggleButton
|
|
131
|
+
size='small'
|
|
132
|
+
sx={{ width: '230px' }}
|
|
133
|
+
customSelectedBackgroundColor={theme.palette.primary.main}
|
|
134
|
+
customHoverColor={theme.palette.primary.light}
|
|
135
|
+
value={DocumentType.VEHICLE_OTHER}
|
|
136
|
+
selected={selectedTypeDocument === DocumentType.VEHICLE_OTHER}
|
|
137
|
+
aria-label='vehicule document other'
|
|
138
|
+
>
|
|
139
|
+
<b>Autre</b>
|
|
140
|
+
</StyledToggleButton>
|
|
141
|
+
</>
|
|
142
|
+
) : (
|
|
143
|
+
<>
|
|
144
|
+
{/* <StyledToggleButton
|
|
145
|
+
size='small'
|
|
146
|
+
sx={{ width: '230px' }}
|
|
147
|
+
customSelectedBackgroundColor={theme.palette.primary.main}
|
|
148
|
+
customHoverColor={theme.palette.primary.light}
|
|
149
|
+
value={DocumentType.EVENT_MAINTENANCE}
|
|
150
|
+
selected={selectedTypeDocument === DocumentType.EVENT_MAINTENANCE}
|
|
151
|
+
aria-label='event visual proof document'
|
|
152
|
+
>
|
|
153
|
+
<b>Maintenance</b>
|
|
154
|
+
</StyledToggleButton> */}
|
|
155
|
+
<StyledToggleButton
|
|
156
|
+
size='small'
|
|
157
|
+
sx={{ width: '230px' }}
|
|
158
|
+
customSelectedBackgroundColor={theme.palette.primary.main}
|
|
159
|
+
customHoverColor={theme.palette.primary.light}
|
|
160
|
+
value={DocumentType.EVENT_VISUAL_PROOFS}
|
|
161
|
+
selected={selectedTypeDocument === DocumentType.EVENT_VISUAL_PROOFS}
|
|
162
|
+
aria-label='event visual proof document'
|
|
163
|
+
>
|
|
164
|
+
<b>Photos et Preuves Visuelles</b>
|
|
165
|
+
</StyledToggleButton>
|
|
166
|
+
<StyledToggleButton
|
|
167
|
+
size='small'
|
|
168
|
+
sx={{ width: '230px' }}
|
|
169
|
+
customSelectedBackgroundColor={theme.palette.primary.main}
|
|
170
|
+
customHoverColor={theme.palette.primary.light}
|
|
171
|
+
value={DocumentType.EVENT_OTHER}
|
|
172
|
+
selected={selectedTypeDocument === DocumentType.EVENT_OTHER}
|
|
173
|
+
aria-label='event document other'
|
|
174
|
+
>
|
|
175
|
+
<b>Autre</b>
|
|
176
|
+
</StyledToggleButton>
|
|
177
|
+
</>
|
|
178
|
+
)}
|
|
179
|
+
</ToggleButtonGroup>
|
|
180
|
+
{message && (
|
|
181
|
+
<>{message}</>
|
|
182
|
+
)}
|
|
183
|
+
</DialogContent>
|
|
184
|
+
<DialogActions
|
|
185
|
+
sx={{
|
|
186
|
+
py: 1,
|
|
187
|
+
backgroundColor: theme.palette.grey[200],
|
|
188
|
+
}}
|
|
189
|
+
>
|
|
190
|
+
<Button color='inherit' onClick={() => toggleShowLinkedDocument(null)}>
|
|
191
|
+
Annuler
|
|
192
|
+
</Button>
|
|
193
|
+
<Box sx={{ flexGrow: 1 }} />
|
|
194
|
+
<Button color='primary' autoFocus sx={{ ml: 1 }} disabled={!selectedTypeDocument} onClick={() => toggleShowLinkedDocument(selectedTypeDocument)}>
|
|
195
|
+
<b>Valider</b>
|
|
196
|
+
</Button>
|
|
197
|
+
</DialogActions>
|
|
198
|
+
</Dialog>
|
|
199
|
+
);
|
|
200
|
+
};
|