@movalib/movalib-commons 1.68.37 → 1.68.39
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/src/components/vehicle/VehicleFullCard.js +2 -2
- package/dist/src/models/LoanVehicle.d.ts +6 -1
- package/dist/src/models/LoanVehicle.js +6 -1
- package/dist/src/services/GarageService.d.ts +1 -0
- package/dist/src/services/GarageService.js +7 -0
- package/package.json +1 -1
- package/src/components/vehicle/VehicleFullCard.tsx +3 -3
- package/src/models/LoanVehicle.ts +17 -2
- package/src/services/GarageService.ts +13 -0
|
@@ -54,7 +54,7 @@ var jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
54
54
|
var icons_material_1 = require("@mui/icons-material");
|
|
55
55
|
var CloseRounded_1 = __importDefault(require("@mui/icons-material/CloseRounded"));
|
|
56
56
|
var EditRounded_1 = __importDefault(require("@mui/icons-material/EditRounded"));
|
|
57
|
-
var
|
|
57
|
+
var StickyNote2_1 = __importDefault(require("@mui/icons-material/StickyNote2"));
|
|
58
58
|
var material_1 = require("@mui/material");
|
|
59
59
|
var x_date_pickers_1 = require("@mui/x-date-pickers");
|
|
60
60
|
var moment_1 = __importDefault(require("moment"));
|
|
@@ -283,7 +283,7 @@ var VehicleFullCard = function (_a) {
|
|
|
283
283
|
case 1: return [2 /*return*/, _a.sent()];
|
|
284
284
|
}
|
|
285
285
|
});
|
|
286
|
-
}); }, "aria-label": "Copier la plaque", children: (0, jsx_runtime_1.jsx)(icons_material_1.ContentCopy, { sx: { fontSize: 14, color: "text.disabled" } }) })] })] }), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: { display: "flex", flexDirection: "row", alignItems: "flex-end", gap: 1 }, children: [vehicle.notes && appType !== Enums_1.MovaAppType.INDIVIDUAL && (isDesktop ? ((0, jsx_runtime_1.jsx)(material_1.Tooltip, { title: vehicle.notes.length > 500 ? vehicle.notes.slice(0, 500) + '…' : vehicle.notes, children: (0, jsx_runtime_1.jsx)(
|
|
286
|
+
}); }, "aria-label": "Copier la plaque", children: (0, jsx_runtime_1.jsx)(icons_material_1.ContentCopy, { sx: { fontSize: 14, color: "text.disabled" } }) })] })] }), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: { display: "flex", flexDirection: "row", alignItems: "flex-end", gap: 1 }, children: [vehicle.notes && appType !== Enums_1.MovaAppType.INDIVIDUAL && (isDesktop ? ((0, jsx_runtime_1.jsx)(material_1.Tooltip, { title: vehicle.notes.length > 500 ? vehicle.notes.slice(0, 500) + '…' : vehicle.notes, children: (0, jsx_runtime_1.jsx)(StickyNote2_1.default, { sx: { color: theme.palette.primary.main, fontSize: 22, cursor: 'default', alignSelf: 'center' } }) })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.IconButton, { size: "small", onClick: function (e) { return setNotesAnchorEl(e.currentTarget); }, sx: { p: 0.5, alignSelf: 'center' }, children: (0, jsx_runtime_1.jsx)(StickyNote2_1.default, { sx: { color: theme.palette.primary.main, fontSize: 22 } }) }), (0, jsx_runtime_1.jsx)(material_1.Popover, { open: Boolean(notesAnchorEl), anchorEl: notesAnchorEl, onClose: function () { return setNotesAnchorEl(null); }, anchorOrigin: { vertical: 'bottom', horizontal: 'right' }, transformOrigin: { vertical: 'top', horizontal: 'right' }, children: (0, jsx_runtime_1.jsx)(material_1.Typography, { sx: { p: 2, maxWidth: 280, fontSize: 13 }, children: vehicle.notes.length > 500 ? vehicle.notes.slice(0, 500) + '…' : vehicle.notes }) })] }))), onDelete && ((0, jsx_runtime_1.jsx)(material_1.Button, { variant: "outlined", color: "error", size: "small", onClick: function (e) { return handleOnClickDeleteVehicle(e); }, children: "Supprimer" })), !localEditMode && ((0, jsx_runtime_1.jsx)(material_1.Button, { onClick: handleOnClickEdit, size: "small", variant: "outlined", startIcon: (0, jsx_runtime_1.jsx)(EditRounded_1.default, { sx: { fontSize: "14px !important" } }), sx: {
|
|
287
287
|
fontSize: 12,
|
|
288
288
|
borderColor: "divider",
|
|
289
289
|
}, children: "Modifier" }))] })] }), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: { px: 2, py: 1.5, borderBottom: "0.5px solid", borderColor: "divider" }, children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "body2", sx: sectionTitleSx, children: "Kilom\u00E9trage" }), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 1 }, children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { sx: { bgcolor: "grey.50", borderRadius: 1, p: 1.25 }, children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "caption", color: "text.secondary", display: "block", children: "Actuel" }), !localEditMode ? ((0, jsx_runtime_1.jsxs)(material_1.Typography, { variant: "body1", fontWeight: 500, children: [(_b = vehicle.currentMileage) !== null && _b !== void 0 ? _b : "-", " ", (0, jsx_runtime_1.jsx)(material_1.Typography, { component: "span", variant: "caption", color: "text.secondary", children: "km" })] })) : ((0, jsx_runtime_1.jsx)(material_1.TextField, { name: "currentMileage", variant: "standard", type: "number", required: true, value: (_c = form.currentMileage.value) !== null && _c !== void 0 ? _c : "", onChange: handleInputChange, error: Boolean(form.currentMileage.error), helperText: Boolean(form.currentMileage.error && form.currentMileage.value > 0)
|
|
@@ -4,5 +4,10 @@ export default class LoanVehicle {
|
|
|
4
4
|
garageVehicleId: number;
|
|
5
5
|
vehicleLoanEnd: Date;
|
|
6
6
|
vehicleLoanStart: Date;
|
|
7
|
-
|
|
7
|
+
vehicleReturnDate?: Date;
|
|
8
|
+
garageVehicleMileage?: number;
|
|
9
|
+
vehicleReturnMileage?: number;
|
|
10
|
+
existHistory?: boolean;
|
|
11
|
+
existHistoryReturn?: boolean;
|
|
12
|
+
constructor(id: number, eventId: string, garageVehicleId: number, vehicleLoanStart: Date, vehicleLoanEnd: Date, vehicleReturnDate?: Date, garageVehicleMileage?: number, vehicleReturnMileage?: number, existHistory?: boolean, existHistoryReturn?: boolean);
|
|
8
13
|
}
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
var LoanVehicle = /** @class */ (function () {
|
|
4
|
-
function LoanVehicle(id, eventId, garageVehicleId, vehicleLoanStart, vehicleLoanEnd) {
|
|
4
|
+
function LoanVehicle(id, eventId, garageVehicleId, vehicleLoanStart, vehicleLoanEnd, vehicleReturnDate, garageVehicleMileage, vehicleReturnMileage, existHistory, existHistoryReturn) {
|
|
5
5
|
this.id = id;
|
|
6
6
|
this.eventId = eventId;
|
|
7
7
|
this.garageVehicleId = garageVehicleId;
|
|
8
8
|
this.vehicleLoanStart = new Date(vehicleLoanStart);
|
|
9
9
|
this.vehicleLoanEnd = new Date(vehicleLoanEnd);
|
|
10
|
+
this.vehicleReturnDate = vehicleReturnDate ? new Date(vehicleReturnDate) : undefined;
|
|
11
|
+
this.existHistory = existHistory;
|
|
12
|
+
this.vehicleReturnMileage = vehicleReturnMileage;
|
|
13
|
+
this.garageVehicleMileage = garageVehicleMileage;
|
|
14
|
+
this.existHistoryReturn = existHistoryReturn;
|
|
10
15
|
}
|
|
11
16
|
return LoanVehicle;
|
|
12
17
|
}());
|
|
@@ -82,6 +82,7 @@ export default class GarageService {
|
|
|
82
82
|
static assignGarageVehicleEvent(garageId: string, eventId: string, vehicleId: number, req: any): Promise<APIResponse<string>>;
|
|
83
83
|
static editGarageVehicleDateEvent(garageId: string, eventId: string, req: any): Promise<APIResponse<string>>;
|
|
84
84
|
static deassignGarageVehicleEvent(garageId: string, eventId: string): Promise<APIResponse<string>>;
|
|
85
|
+
static returnGarageVehicleBooking(garageId: string, bookingId: number, returnDate: string, mileage: number): Promise<APIResponse<string>>;
|
|
85
86
|
static getGaragesCsm(): Promise<APIResponse<Garage[]>>;
|
|
86
87
|
static getOneGarageCsm(garageId: string): Promise<APIResponse<Garage[]>>;
|
|
87
88
|
static getAllOperations(garageId: string): Promise<APIResponse<Operation>>;
|
|
@@ -499,6 +499,13 @@ var GarageService = /** @class */ (function () {
|
|
|
499
499
|
appType: Enums_1.MovaAppType.GARAGE,
|
|
500
500
|
});
|
|
501
501
|
};
|
|
502
|
+
GarageService.returnGarageVehicleBooking = function (garageId, bookingId, returnDate, mileage) {
|
|
503
|
+
return (0, ApiHelper_1.request)({
|
|
504
|
+
url: "".concat(ApiHelper_1.API_BASE_URL, "/garage/").concat(garageId, "/loaner/booking/").concat(bookingId, "/return?returnDate=").concat(encodeURIComponent(returnDate), "&mileage=").concat(mileage),
|
|
505
|
+
method: Enums_1.APIMethod.PATCH,
|
|
506
|
+
appType: Enums_1.MovaAppType.GARAGE,
|
|
507
|
+
});
|
|
508
|
+
};
|
|
502
509
|
// CSM
|
|
503
510
|
GarageService.getGaragesCsm = function () {
|
|
504
511
|
return (0, ApiHelper_1.request)({
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
default as CloseIcon,
|
|
5
5
|
} from "@mui/icons-material/CloseRounded";
|
|
6
6
|
import EditIcon from "@mui/icons-material/EditRounded";
|
|
7
|
-
import
|
|
7
|
+
import StickyNote2Icon from "@mui/icons-material/StickyNote2";
|
|
8
8
|
import {
|
|
9
9
|
Alert,
|
|
10
10
|
Box,
|
|
@@ -407,12 +407,12 @@ const VehicleFullCard: FC<VehicleFullCardProps> = ({
|
|
|
407
407
|
{vehicle.notes && appType !== MovaAppType.INDIVIDUAL && (
|
|
408
408
|
isDesktop ? (
|
|
409
409
|
<Tooltip title={vehicle.notes.length > 500 ? vehicle.notes.slice(0, 500) + '…' : vehicle.notes}>
|
|
410
|
-
<
|
|
410
|
+
<StickyNote2Icon sx={{ color: theme.palette.primary.main, fontSize: 22, cursor: 'default', alignSelf: 'center' }} />
|
|
411
411
|
</Tooltip>
|
|
412
412
|
) : (
|
|
413
413
|
<>
|
|
414
414
|
<IconButton size="small" onClick={(e) => setNotesAnchorEl(e.currentTarget)} sx={{ p: 0.5, alignSelf: 'center' }}>
|
|
415
|
-
<
|
|
415
|
+
<StickyNote2Icon sx={{ color: theme.palette.primary.main, fontSize: 22 }} />
|
|
416
416
|
</IconButton>
|
|
417
417
|
<Popover
|
|
418
418
|
open={Boolean(notesAnchorEl)}
|
|
@@ -5,18 +5,33 @@ export default class LoanVehicle {
|
|
|
5
5
|
|
|
6
6
|
vehicleLoanEnd: Date;
|
|
7
7
|
vehicleLoanStart: Date;
|
|
8
|
-
|
|
8
|
+
vehicleReturnDate?: Date;
|
|
9
|
+
garageVehicleMileage?: number;
|
|
10
|
+
vehicleReturnMileage?:number;
|
|
11
|
+
existHistory?:boolean;
|
|
12
|
+
existHistoryReturn?:boolean;
|
|
9
13
|
constructor(
|
|
10
14
|
id: number,
|
|
11
15
|
eventId: string,
|
|
12
16
|
garageVehicleId: number,
|
|
13
17
|
vehicleLoanStart: Date,
|
|
14
|
-
vehicleLoanEnd: Date
|
|
18
|
+
vehicleLoanEnd: Date,
|
|
19
|
+
vehicleReturnDate?: Date,
|
|
20
|
+
garageVehicleMileage?:number,
|
|
21
|
+
vehicleReturnMileage?:number,
|
|
22
|
+
existHistory?:boolean,
|
|
23
|
+
existHistoryReturn?:boolean,
|
|
24
|
+
|
|
15
25
|
) {
|
|
16
26
|
this.id = id;
|
|
17
27
|
this.eventId = eventId;
|
|
18
28
|
this.garageVehicleId = garageVehicleId;
|
|
19
29
|
this.vehicleLoanStart = new Date(vehicleLoanStart);
|
|
20
30
|
this.vehicleLoanEnd = new Date(vehicleLoanEnd);
|
|
31
|
+
this.vehicleReturnDate = vehicleReturnDate ? new Date(vehicleReturnDate) : undefined;
|
|
32
|
+
this.existHistory = existHistory;
|
|
33
|
+
this.vehicleReturnMileage = vehicleReturnMileage;
|
|
34
|
+
this.garageVehicleMileage = garageVehicleMileage;
|
|
35
|
+
this.existHistoryReturn = existHistoryReturn;
|
|
21
36
|
}
|
|
22
37
|
}
|
|
@@ -741,6 +741,19 @@ export default class GarageService {
|
|
|
741
741
|
});
|
|
742
742
|
}
|
|
743
743
|
|
|
744
|
+
static returnGarageVehicleBooking(
|
|
745
|
+
garageId: string,
|
|
746
|
+
bookingId: number,
|
|
747
|
+
returnDate: string,
|
|
748
|
+
mileage: number
|
|
749
|
+
): Promise<APIResponse<string>> {
|
|
750
|
+
return request({
|
|
751
|
+
url: `${API_BASE_URL}/garage/${garageId}/loaner/booking/${bookingId}/return?returnDate=${encodeURIComponent(returnDate)}&mileage=${mileage}`,
|
|
752
|
+
method: APIMethod.PATCH,
|
|
753
|
+
appType: MovaAppType.GARAGE,
|
|
754
|
+
});
|
|
755
|
+
}
|
|
756
|
+
|
|
744
757
|
// CSM
|
|
745
758
|
static getGaragesCsm(): Promise<APIResponse<Garage[]>> {
|
|
746
759
|
return request({
|