@movalib/movalib-commons 1.64.7 → 1.64.9

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.
@@ -10,6 +10,42 @@ var __assign = (this && this.__assign) || function () {
10
10
  };
11
11
  return __assign.apply(this, arguments);
12
12
  };
13
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
14
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
15
+ return new (P || (P = Promise))(function (resolve, reject) {
16
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
17
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
18
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
19
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
20
+ });
21
+ };
22
+ var __generator = (this && this.__generator) || function (thisArg, body) {
23
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
24
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
25
+ function verb(n) { return function (v) { return step([n, v]); }; }
26
+ function step(op) {
27
+ if (f) throw new TypeError("Generator is already executing.");
28
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
29
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
30
+ if (y = 0, t) op = [op[0] & 2, t.value];
31
+ switch (op[0]) {
32
+ case 0: case 1: t = op; break;
33
+ case 4: _.label++; return { value: op[1], done: false };
34
+ case 5: _.label++; y = op[1]; op = [0]; continue;
35
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
36
+ default:
37
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
38
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
39
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
40
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
41
+ if (t[2]) _.ops.pop();
42
+ _.trys.pop(); continue;
43
+ }
44
+ op = body.call(thisArg, _);
45
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
46
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
47
+ }
48
+ };
13
49
  var __importDefault = (this && this.__importDefault) || function (mod) {
14
50
  return (mod && mod.__esModule) ? mod : { "default": mod };
15
51
  };
@@ -258,11 +294,33 @@ var VehicleFullCard = function (_a) {
258
294
  overflow: "visible",
259
295
  mt: 4,
260
296
  pb: 1,
261
- } }, { children: [(0, jsx_runtime_1.jsxs)(material_1.CardContent, __assign({ sx: { pt: 0, pb: 0 } }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Typography, __assign({ variant: "h6", component: "div", align: "center", sx: { mb: 1 }, color: (0, material_1.darken)(theme.palette.primary.main, 0.2) }, { children: [vehicle.brand && "".concat(vehicle.brand, " "), vehicle.model && "".concat(vehicle.model, " "), vehicle.version && "".concat(vehicle.version)] })), (0, jsx_runtime_1.jsxs)(material_1.Grid, __assign({ container: true, justifyContent: "space-between" }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Grid, __assign({ container: true, sx: { mb: 1, alignItems: "center", justifyContent: "center" } }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Grid, __assign({ item: true, xs: 6, sx: { position: "relative", minWidth: "234px" } }, { children: [(0, jsx_runtime_1.jsx)("img", { src: car_plate_bg_png_1.default, alt: "Plaque d'immatriculation", style: { height: "50px", position: "relative" } }), (0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ variant: "h6", color: theme.palette.text.primary, sx: { position: "absolute", top: "8px", left: "76px" } }, { children: (0, jsx_runtime_1.jsx)("b", { children: (0, Tools_1.formatVehiclePlate)(vehicle.plate, vehicle.foreignPlate) }) }))] })), onDelete && ((0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 6, style: {
297
+ } }, { children: [(0, jsx_runtime_1.jsxs)(material_1.CardContent, __assign({ sx: { pt: 0, pb: 0 } }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Typography, __assign({ variant: "h6", component: "div", align: "center", sx: { mb: 1 }, color: (0, material_1.darken)(theme.palette.primary.main, 0.2) }, { children: [vehicle.brand && "".concat(vehicle.brand, " "), vehicle.model && "".concat(vehicle.model, " "), vehicle.version && "".concat(vehicle.version)] })), (0, jsx_runtime_1.jsxs)(material_1.Grid, __assign({ container: true, justifyContent: "space-between" }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Grid, __assign({ container: true, sx: { mb: 1, alignItems: "center", justifyContent: "center" } }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Grid, __assign({ item: true, xs: 6, sx: { position: "relative", minWidth: "234px" } }, { children: [(0, jsx_runtime_1.jsx)("img", { src: car_plate_bg_png_1.default, alt: "Plaque d'immatriculation", style: { height: "50px", position: "relative" } }), (0, jsx_runtime_1.jsxs)(material_1.Typography, __assign({ variant: "h6", color: theme.palette.text.primary, sx: {
298
+ position: "absolute",
299
+ top: "8px",
300
+ left: "76px",
301
+ display: "flex",
302
+ } }, { children: [(0, jsx_runtime_1.jsx)("b", { children: (0, Tools_1.formatVehiclePlate)(vehicle.plate, vehicle.foreignPlate) }), (0, jsx_runtime_1.jsx)(material_1.IconButton, __assign({ sx: { ml: 1 }, onClick: function () { return __awaiter(void 0, void 0, void 0, function () {
303
+ return __generator(this, function (_a) {
304
+ switch (_a.label) {
305
+ case 0: return [4 /*yield*/, navigator.clipboard.writeText((0, Tools_1.formatVehiclePlate)(vehicle.plate, vehicle.foreignPlate))];
306
+ case 1: return [2 /*return*/, _a.sent()];
307
+ }
308
+ });
309
+ }); }, size: "small", "aria-label": "Copier le VIN" }, { children: (0, jsx_runtime_1.jsx)(icons_material_1.ContentCopy, { fontSize: "small" }) }))] }))] })), onDelete && ((0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 6, style: {
262
310
  display: "flex",
263
311
  alignItems: "center",
264
312
  justifyContent: "center",
265
- } }, { children: (0, jsx_runtime_1.jsx)(material_1.Button, __assign({ variant: "contained", color: "error", onClick: function (e) { return handleOnClickDeleteVehicle(e); } }, { children: "Supprimer" })) })))] })), !localEditMode && ((0, jsx_runtime_1.jsxs)(material_1.Grid, __assign({ container: true, textAlign: "justify", sx: { pt: 2 } }, { children: [(0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 8 }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ variant: "body1", color: "text.secondary" }, { children: "Km actuel :" })) })), (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 4, sx: { textAlign: "right" } }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ variant: "body1", color: "text.secondary" }, { children: (0, jsx_runtime_1.jsxs)("b", { children: [vehicle.currentMileage, " km"] }) })) }))] }))), localEditMode && ((0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 12 }, { children: (0, jsx_runtime_1.jsx)(material_1.TextField, { label: "Kilom\u00E9trage actuel", name: "currentMileage", variant: "outlined", type: "number", required: true, value: form.currentMileage.value, onChange: function (e) { return handleInputChange(e); }, error: Boolean(form.currentMileage.error), sx: {
313
+ } }, { children: (0, jsx_runtime_1.jsx)(material_1.Button, __assign({ variant: "contained", color: "error", onClick: function (e) { return handleOnClickDeleteVehicle(e); } }, { children: "Supprimer" })) })))] })), !localEditMode && ((0, jsx_runtime_1.jsxs)(material_1.Grid, __assign({ container: true, textAlign: "justify", sx: { pt: 2 } }, { children: [(0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 8 }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ variant: "body1", color: "text.secondary" }, { children: "Km actuel :" })) })), (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 4, sx: { textAlign: "right" } }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ variant: "body1", color: "text.secondary" }, { children: (0, jsx_runtime_1.jsxs)("b", { children: [vehicle.currentMileage, " km"] }) })) }))] }))), !localEditMode && vehicle.vin && ((0, jsx_runtime_1.jsxs)(material_1.Grid, __assign({ container: true, textAlign: "justify", sx: { pt: 2 } }, { children: [(0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 6 }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ variant: "body1", color: "text.secondary" }, { children: "Vin :" })) })), (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 6, sx: { textAlign: "right" } }, { children: (0, jsx_runtime_1.jsxs)(material_1.Typography, __assign({ variant: "body1", color: "text.secondary", sx: {
314
+ display: "flex",
315
+ flexDirection: "row",
316
+ alignItems: "center",
317
+ justifyContent: "flex-end",
318
+ } }, { children: [(0, jsx_runtime_1.jsx)("b", { children: vehicle.vin }), (0, jsx_runtime_1.jsx)(material_1.IconButton, __assign({ sx: { ml: 1, height: "24px" }, onClick: function () { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
319
+ switch (_a.label) {
320
+ case 0: return [4 /*yield*/, navigator.clipboard.writeText(vehicle.vin)];
321
+ case 1: return [2 /*return*/, _a.sent()];
322
+ }
323
+ }); }); }, size: "small", "aria-label": "Copier le VIN" }, { children: (0, jsx_runtime_1.jsx)(icons_material_1.ContentCopy, { fontSize: "small" }) }))] })) }))] }))), localEditMode && ((0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 12 }, { children: (0, jsx_runtime_1.jsx)(material_1.TextField, { label: "Kilom\u00E9trage actuel", name: "currentMileage", variant: "outlined", type: "number", required: true, value: form.currentMileage.value, onChange: function (e) { return handleInputChange(e); }, error: Boolean(form.currentMileage.error), sx: {
266
324
  width: "100%",
267
325
  mt: 2,
268
326
  "& input": { textTransform: "uppercase" }, // CSS pour forcer les majuscules dans l'input
@@ -64,5 +64,6 @@ export default class Garage {
64
64
  companyRegistrationNumber?: string;
65
65
  establishmentRegistrationNumber?: string;
66
66
  reopeningDate?: Date;
67
- 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, establishmentRegistrationNumber?: string, companyRegistrationNumber?: string, quoteRequestStart?: Date, reopeningDate?: Date, demoBillingActive?: boolean);
67
+ targetMargin?: number;
68
+ 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, establishmentRegistrationNumber?: string, companyRegistrationNumber?: string, quoteRequestStart?: Date, reopeningDate?: Date, targetMargin?: number, demoBillingActive?: boolean);
68
69
  }
@@ -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, billingActive, billingToken, billingSimulationActive, appId, establishmentRegistrationNumber, companyRegistrationNumber, quoteRequestStart, reopeningDate, demoBillingActive) {
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, establishmentRegistrationNumber, companyRegistrationNumber, quoteRequestStart, reopeningDate, targetMargin, demoBillingActive) {
5
5
  this.id = id;
6
6
  this.adminId = adminId;
7
7
  this.name = name;
@@ -35,6 +35,7 @@ var Garage = /** @class */ (function () {
35
35
  this.companyRegistrationNumber = companyRegistrationNumber;
36
36
  this.establishmentRegistrationNumber = establishmentRegistrationNumber;
37
37
  this.reopeningDate = reopeningDate;
38
+ this.targetMargin = targetMargin;
38
39
  this.demoBillingActive = demoBillingActive;
39
40
  }
40
41
  return Garage;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@movalib/movalib-commons",
3
- "version": "1.64.7",
3
+ "version": "1.64.9",
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",
@@ -1,4 +1,4 @@
1
- import { AttachFile } from "@mui/icons-material";
1
+ import { AttachFile, ContentCopy } from "@mui/icons-material";
2
2
  import {
3
3
  default as CancelIcon,
4
4
  default as CloseIcon,
@@ -484,11 +484,31 @@ const VehicleFullCard: FC<VehicleFullCardProps> = ({
484
484
  <Typography
485
485
  variant="h6"
486
486
  color={theme.palette.text.primary}
487
- sx={{ position: "absolute", top: "8px", left: "76px" }}
487
+ sx={{
488
+ position: "absolute",
489
+ top: "8px",
490
+ left: "76px",
491
+ display: "flex",
492
+ }}
488
493
  >
489
494
  <b>
490
495
  {formatVehiclePlate(vehicle.plate, vehicle.foreignPlate)}
491
496
  </b>
497
+ <IconButton
498
+ sx={{ ml: 1 }}
499
+ onClick={async () =>
500
+ await navigator.clipboard.writeText(
501
+ formatVehiclePlate(
502
+ vehicle.plate,
503
+ vehicle.foreignPlate
504
+ )
505
+ )
506
+ }
507
+ size="small"
508
+ aria-label="Copier le VIN"
509
+ >
510
+ <ContentCopy fontSize="small" />
511
+ </IconButton>
492
512
  </Typography>
493
513
  </Grid>
494
514
  {onDelete && (
@@ -527,6 +547,40 @@ const VehicleFullCard: FC<VehicleFullCardProps> = ({
527
547
  </Grid>
528
548
  )}
529
549
 
550
+ {!localEditMode && vehicle.vin && (
551
+ <Grid container textAlign="justify" sx={{ pt: 2 }}>
552
+ <Grid item xs={6}>
553
+ <Typography variant="body1" color="text.secondary">
554
+ Vin :
555
+ </Typography>
556
+ </Grid>
557
+ <Grid item xs={6} sx={{ textAlign: "right" }}>
558
+ <Typography
559
+ variant="body1"
560
+ color="text.secondary"
561
+ sx={{
562
+ display: "flex",
563
+ flexDirection: "row",
564
+ alignItems: "center",
565
+ justifyContent: "flex-end",
566
+ }}
567
+ >
568
+ <b>{vehicle.vin}</b>
569
+ <IconButton
570
+ sx={{ ml: 1, height: "24px" }}
571
+ onClick={async () =>
572
+ await navigator.clipboard.writeText(vehicle.vin)
573
+ }
574
+ size="small"
575
+ aria-label="Copier le VIN"
576
+ >
577
+ <ContentCopy fontSize="small" />
578
+ </IconButton>
579
+ </Typography>
580
+ </Grid>
581
+ </Grid>
582
+ )}
583
+
530
584
  {localEditMode && (
531
585
  <Grid item xs={12}>
532
586
  <TextField
@@ -70,6 +70,7 @@ export default class Garage {
70
70
  companyRegistrationNumber?: string;
71
71
  establishmentRegistrationNumber?: string;
72
72
  reopeningDate?: Date;
73
+ targetMargin?: number;
73
74
  constructor(
74
75
  id: string,
75
76
  adminId: string,
@@ -104,6 +105,7 @@ export default class Garage {
104
105
  companyRegistrationNumber?: string,
105
106
  quoteRequestStart?: Date,
106
107
  reopeningDate?: Date,
108
+ targetMargin?: number,
107
109
  demoBillingActive?: boolean
108
110
  ) {
109
111
  this.id = id;
@@ -139,6 +141,7 @@ export default class Garage {
139
141
  this.companyRegistrationNumber = companyRegistrationNumber;
140
142
  this.establishmentRegistrationNumber = establishmentRegistrationNumber;
141
143
  this.reopeningDate = reopeningDate;
144
+ this.targetMargin = targetMargin;
142
145
  this.demoBillingActive = demoBillingActive;
143
146
  }
144
147
  }