@movalib/movalib-commons 1.1.18 → 1.1.20

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 CHANGED
@@ -22,6 +22,7 @@ import Schedule from './src/models/Schedule';
22
22
  import { flexCenter } from './src/helpers/Tools';
23
23
  import AccountValidation from './src/AccountValidation';
24
24
  import VehiclePlateField from './src/VehiclePlateField';
25
+ import GaragePLV from './src/GaragePLV';
25
26
 
26
27
  const App = () => {
27
28
 
@@ -130,6 +131,8 @@ const App = () => {
130
131
  alert('Form Submitted !');
131
132
  } } />
132
133
 
134
+ <GaragePLV url={getQRCodeData()} />
135
+
133
136
  <QRCode data={getQRCodeData()} showDownload={true} />
134
137
 
135
138
  <div style={{ marginTop: '40px' }} />
package/dist/devIndex.js CHANGED
@@ -59,6 +59,7 @@ var Schedule_1 = __importDefault(require("./src/models/Schedule"));
59
59
  var Tools_1 = require("./src/helpers/Tools");
60
60
  var AccountValidation_1 = __importDefault(require("./src/AccountValidation"));
61
61
  var VehiclePlateField_1 = __importDefault(require("./src/VehiclePlateField"));
62
+ var GaragePLV_1 = __importDefault(require("./src/GaragePLV"));
62
63
  var App = function () {
63
64
  Logger_1.default.enableLogging();
64
65
  // Chargement de données garage de test
@@ -127,7 +128,7 @@ var App = function () {
127
128
  throw new Error('Function not implemented.');
128
129
  } }), (0, jsx_runtime_1.jsx)(MovaSignUp_1.default, { darkMode: false, movaAppType: Enums_1.MovaAppType.INDIVIDUAL, onSubmit: function (form) {
129
130
  alert('Form Submitted !');
130
- } }), (0, jsx_runtime_1.jsx)(QRCode_1.default, { data: getQRCodeData(), showDownload: true }), (0, jsx_runtime_1.jsx)("div", { style: { marginTop: '40px' } }), (0, jsx_runtime_1.jsx)("div", __assign({ style: Tools_1.flexCenter }, { children: (0, jsx_runtime_1.jsx)(ScheduleFields_1.default, { schedules: garage === null || garage === void 0 ? void 0 : garage.schedules, size: "small", timePickerStep: 30, onChange: handleScheduleChange }) }))] })), (0, jsx_runtime_1.jsx)(material_1.Box, __assign({ style: Tools_1.flexCenter }, { children: (0, jsx_runtime_1.jsx)(material_1.Button, __assign({ onClick: function () { return setOpenAccountValidation(!openAccountValidation); } }, { children: "Validation de compte" })) })), openAccountValidation && (0, jsx_runtime_1.jsx)(AccountValidation_1.default, { movaAppType: Enums_1.MovaAppType.GARAGE, onSubmit: function (success, message) {
131
+ } }), (0, jsx_runtime_1.jsx)(GaragePLV_1.default, { url: getQRCodeData() }), (0, jsx_runtime_1.jsx)(QRCode_1.default, { data: getQRCodeData(), showDownload: true }), (0, jsx_runtime_1.jsx)("div", { style: { marginTop: '40px' } }), (0, jsx_runtime_1.jsx)("div", __assign({ style: Tools_1.flexCenter }, { children: (0, jsx_runtime_1.jsx)(ScheduleFields_1.default, { schedules: garage === null || garage === void 0 ? void 0 : garage.schedules, size: "small", timePickerStep: 30, onChange: handleScheduleChange }) }))] })), (0, jsx_runtime_1.jsx)(material_1.Box, __assign({ style: Tools_1.flexCenter }, { children: (0, jsx_runtime_1.jsx)(material_1.Button, __assign({ onClick: function () { return setOpenAccountValidation(!openAccountValidation); } }, { children: "Validation de compte" })) })), openAccountValidation && (0, jsx_runtime_1.jsx)(AccountValidation_1.default, { movaAppType: Enums_1.MovaAppType.GARAGE, onSubmit: function (success, message) {
131
132
  throw new Error('Function not implemented.');
132
133
  } })] })) })) }));
133
134
  };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export { default as AuthenticationService } from './src/services/AuthenticationService';
2
2
  export { default as GarageService } from './src/services/GarageService';
3
3
  export { default as UserService } from './src/services/UserService';
4
+ export { default as GaragePLV } from './src/GaragePLV';
4
5
  export { default as AccountValidation } from './src/AccountValidation';
5
6
  export { default as AddressFields } from './src/AddressFields';
6
7
  export { default as ScheduleFields } from './src/ScheduleFields';
@@ -37,7 +38,7 @@ export type { APIRequest, APIResponse } from './src/helpers/ApiHelper';
37
38
  export type { DaySchedule, DayInterval } from './src/ScheduleFields';
38
39
  export type { MovaFormField, MovaLoginForm, MovaUserSignUpForm, MovaInterval, MovaVehicleForm, AddressFieldName } from './src/helpers/Types';
39
40
  export { readCookie, deleteCookie } from './src/helpers/CookieUtils';
40
- export { validateField, formatVehicleTire, formatFrenchVehiclePlate, isEmpty, getApplicationShortLabel } from './src/helpers/Tools';
41
+ export { validateField, formatVehicleTire, formatFrenchVehiclePlate, isEmpty, getApplicationShortLabel, capitalizeFirstLetter } from './src/helpers/Tools';
41
42
  export { validatePhoneNumber, validateText, validateEmail } from './src/helpers/Validator';
42
- export { formatDateByCountryCode, getLongFormattedDateTime, capitalizeFirstLetter } from './src/helpers/DateUtils';
43
+ export { formatDateByCountryCode, getLongFormattedDateTime } from './src/helpers/DateUtils';
43
44
  export { RoleType, MovaAppType, DayOfWeek, EventState, EventType, DocumentType, DigitalPassportIndex, DocumentState, Gender, DateFormatTypes, PartsApplicationType, ProductType, OrderPreference, OrderState, SlotAlgorithm, VehiclePlateFormat as VehiclePlateType } from './src/helpers/Enums';
package/dist/index.js CHANGED
@@ -4,8 +4,8 @@ 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.MovaAppType = exports.RoleType = exports.capitalizeFirstLetter = exports.getLongFormattedDateTime = exports.formatDateByCountryCode = exports.validateEmail = exports.validateText = exports.validatePhoneNumber = exports.getApplicationShortLabel = exports.isEmpty = exports.formatFrenchVehiclePlate = exports.formatVehicleTire = exports.validateField = exports.deleteCookie = exports.readCookie = exports.VehicleTire = exports.Event = exports.Schedule = 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.GenderSelector = exports.ConfirmationDialog = exports.MovaVehicleTireField = exports.MovaCopyright = exports.MovaSignUp = exports.MovaLogin = exports.MovaSnackbar = exports.TestButton = exports.VehiclePlateField = exports.QRCode = exports.MovaDialog = exports.Loader = exports.MovaDigitalPassport = exports.VehicleFullCard = exports.ScheduleFields = exports.AddressFields = exports.AccountValidation = exports.UserService = exports.GarageService = exports.AuthenticationService = void 0;
8
- 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 = void 0;
7
+ exports.RoleType = exports.getLongFormattedDateTime = exports.formatDateByCountryCode = exports.validateEmail = exports.validateText = exports.validatePhoneNumber = exports.capitalizeFirstLetter = exports.getApplicationShortLabel = exports.isEmpty = exports.formatFrenchVehiclePlate = exports.formatVehicleTire = exports.validateField = exports.deleteCookie = exports.readCookie = exports.VehicleTire = exports.Event = exports.Schedule = 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.GenderSelector = exports.ConfirmationDialog = exports.MovaVehicleTireField = exports.MovaCopyright = exports.MovaSignUp = exports.MovaLogin = exports.MovaSnackbar = exports.TestButton = exports.VehiclePlateField = exports.QRCode = exports.MovaDialog = exports.Loader = exports.MovaDigitalPassport = exports.VehicleFullCard = exports.ScheduleFields = exports.AddressFields = exports.AccountValidation = exports.GaragePLV = exports.UserService = exports.GarageService = exports.AuthenticationService = void 0;
8
+ 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 = void 0;
9
9
  // Export des services
10
10
  var AuthenticationService_1 = require("./src/services/AuthenticationService");
11
11
  Object.defineProperty(exports, "AuthenticationService", { enumerable: true, get: function () { return __importDefault(AuthenticationService_1).default; } });
@@ -14,6 +14,8 @@ Object.defineProperty(exports, "GarageService", { enumerable: true, get: functio
14
14
  var UserService_1 = require("./src/services/UserService");
15
15
  Object.defineProperty(exports, "UserService", { enumerable: true, get: function () { return __importDefault(UserService_1).default; } });
16
16
  // Export des composants
17
+ var GaragePLV_1 = require("./src/GaragePLV");
18
+ Object.defineProperty(exports, "GaragePLV", { enumerable: true, get: function () { return __importDefault(GaragePLV_1).default; } });
17
19
  var AccountValidation_1 = require("./src/AccountValidation");
18
20
  Object.defineProperty(exports, "AccountValidation", { enumerable: true, get: function () { return __importDefault(AccountValidation_1).default; } });
19
21
  var AddressFields_1 = require("./src/AddressFields");
@@ -89,6 +91,7 @@ Object.defineProperty(exports, "formatVehicleTire", { enumerable: true, get: fun
89
91
  Object.defineProperty(exports, "formatFrenchVehiclePlate", { enumerable: true, get: function () { return Tools_1.formatFrenchVehiclePlate; } });
90
92
  Object.defineProperty(exports, "isEmpty", { enumerable: true, get: function () { return Tools_1.isEmpty; } });
91
93
  Object.defineProperty(exports, "getApplicationShortLabel", { enumerable: true, get: function () { return Tools_1.getApplicationShortLabel; } });
94
+ Object.defineProperty(exports, "capitalizeFirstLetter", { enumerable: true, get: function () { return Tools_1.capitalizeFirstLetter; } });
92
95
  var Validator_1 = require("./src/helpers/Validator");
93
96
  Object.defineProperty(exports, "validatePhoneNumber", { enumerable: true, get: function () { return Validator_1.validatePhoneNumber; } });
94
97
  Object.defineProperty(exports, "validateText", { enumerable: true, get: function () { return Validator_1.validateText; } });
@@ -96,7 +99,6 @@ Object.defineProperty(exports, "validateEmail", { enumerable: true, get: functio
96
99
  var DateUtils_1 = require("./src/helpers/DateUtils");
97
100
  Object.defineProperty(exports, "formatDateByCountryCode", { enumerable: true, get: function () { return DateUtils_1.formatDateByCountryCode; } });
98
101
  Object.defineProperty(exports, "getLongFormattedDateTime", { enumerable: true, get: function () { return DateUtils_1.getLongFormattedDateTime; } });
99
- Object.defineProperty(exports, "capitalizeFirstLetter", { enumerable: true, get: function () { return DateUtils_1.capitalizeFirstLetter; } });
100
102
  // Export des enums
101
103
  var Enums_1 = require("./src/helpers/Enums");
102
104
  Object.defineProperty(exports, "RoleType", { enumerable: true, get: function () { return Enums_1.RoleType; } });
@@ -0,0 +1,6 @@
1
+ import { FC } from 'react';
2
+ interface GaragePLVProps {
3
+ url: string;
4
+ }
5
+ declare const GaragePLV: FC<GaragePLVProps>;
6
+ export default GaragePLV;
@@ -0,0 +1,135 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ var __assign = (this && this.__assign) || function () {
18
+ __assign = Object.assign || function(t) {
19
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
20
+ s = arguments[i];
21
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
22
+ t[p] = s[p];
23
+ }
24
+ return t;
25
+ };
26
+ return __assign.apply(this, arguments);
27
+ };
28
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
29
+ if (k2 === undefined) k2 = k;
30
+ var desc = Object.getOwnPropertyDescriptor(m, k);
31
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
32
+ desc = { enumerable: true, get: function() { return m[k]; } };
33
+ }
34
+ Object.defineProperty(o, k2, desc);
35
+ }) : (function(o, m, k, k2) {
36
+ if (k2 === undefined) k2 = k;
37
+ o[k2] = m[k];
38
+ }));
39
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
40
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
41
+ }) : function(o, v) {
42
+ o["default"] = v;
43
+ });
44
+ var __importStar = (this && this.__importStar) || function (mod) {
45
+ if (mod && mod.__esModule) return mod;
46
+ var result = {};
47
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
48
+ __setModuleDefault(result, mod);
49
+ return result;
50
+ };
51
+ var __importDefault = (this && this.__importDefault) || function (mod) {
52
+ return (mod && mod.__esModule) ? mod : { "default": mod };
53
+ };
54
+ Object.defineProperty(exports, "__esModule", { value: true });
55
+ var jsx_runtime_1 = require("react/jsx-runtime");
56
+ var react_1 = __importStar(require("react"));
57
+ var QRCode_1 = __importDefault(require("./QRCode"));
58
+ var react_to_print_1 = require("react-to-print");
59
+ var material_1 = require("@mui/material");
60
+ var Tools_1 = require("./helpers/Tools");
61
+ var logo_large_png_1 = __importDefault(require("./assets/images/logo/logo_large.png"));
62
+ var leafs_large_png_1 = __importDefault(require("./assets/images/leafs_large.png"));
63
+ var PLVTitle = {
64
+ display: 'flex',
65
+ justifyContent: 'left',
66
+ alignItems: 'center',
67
+ textTransform: 'uppercase',
68
+ fontFamily: 'Montserrat, sans-serif',
69
+ fontSize: '50px',
70
+ lineHeight: 1,
71
+ };
72
+ var PLVHeaderLogo = {
73
+ display: 'flex',
74
+ justifyContent: 'center',
75
+ alignItems: 'center',
76
+ width: '25%'
77
+ };
78
+ var PLVFooterLogo = {
79
+ display: 'flex',
80
+ justifyContent: 'end',
81
+ alignItems: 'center',
82
+ width: '15%',
83
+ right: '6%',
84
+ position: 'relative',
85
+ zIndex: -1
86
+ };
87
+ var PLVQRCode = {
88
+ display: 'flex',
89
+ justifyContent: 'center',
90
+ alignItems: 'center'
91
+ };
92
+ var PLVBaseLine = {
93
+ display: 'flex',
94
+ justifyContent: 'left',
95
+ alignItems: 'center',
96
+ fontFamily: 'Dancing Script',
97
+ transform: 'rotate(-10deg)',
98
+ fontSize: '30px',
99
+ };
100
+ var PVLFooterText = {
101
+ fontFamily: 'Montserrat, sans-serif',
102
+ textTransform: 'uppercase',
103
+ fontSize: '14px',
104
+ letterSpacing: 4,
105
+ position: 'absolute'
106
+ };
107
+ /**
108
+ * PLV Garage au format A4
109
+ */
110
+ var PLVComponent = /** @class */ (function (_super) {
111
+ __extends(PLVComponent, _super);
112
+ function PLVComponent() {
113
+ return _super !== null && _super.apply(this, arguments) || this;
114
+ }
115
+ PLVComponent.prototype.render = function () {
116
+ return ((0, jsx_runtime_1.jsx)("div", __assign({ className: "printable-content", style: { width: '210mm', height: '297mm' } }, { children: (0, jsx_runtime_1.jsxs)(material_1.Grid, __assign({ container: true }, { children: [(0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 12, style: PLVHeaderLogo, sx: { m: 2, mt: 4 } }, { children: (0, jsx_runtime_1.jsx)("img", { src: logo_large_png_1.default, style: PLVHeaderLogo }) })), (0, jsx_runtime_1.jsxs)(material_1.Grid, __assign({ item: true, xs: 12, sx: { ml: 6, mt: 4 } }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ style: PLVTitle }, { children: (0, jsx_runtime_1.jsx)("span", __assign({ className: 'highlight' }, { children: "Dans ce garage" })) })), (0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ style: PLVTitle }, { children: (0, jsx_runtime_1.jsx)("span", __assign({ className: 'highlight' }, { children: " prenez rendez-vous " })) })), (0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ style: PLVTitle }, { children: (0, jsx_runtime_1.jsx)("span", __assign({ className: 'highlight' }, { children: " en un clic. " })) }))] })), (0, jsx_runtime_1.jsxs)(material_1.Grid, __assign({ item: true, xs: 12, sx: { ml: 6, mt: 4 } }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ style: PLVTitle }, { children: (0, jsx_runtime_1.jsx)("span", __assign({ className: 'not-highlight' }, { children: " Votre entretien " })) })), (0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ style: PLVTitle }, { children: (0, jsx_runtime_1.jsx)("span", __assign({ className: 'not-highlight' }, { children: " auto ne sera plus " })) })), (0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ style: PLVTitle }, { children: (0, jsx_runtime_1.jsx)("span", __assign({ className: 'not-highlight' }, { children: " un casse-t\u00EAte ! " })) }))] })), (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 7, sx: { pl: 8, mt: 8 }, style: PLVQRCode }, { children: (0, jsx_runtime_1.jsx)(QRCode_1.default, { data: this.props.url }) })), (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 5, style: PLVBaseLine }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ style: PLVBaseLine }, { children: "En plus l'appli est gratuite !" })) })), (0, jsx_runtime_1.jsxs)(material_1.Grid, __assign({ item: true, xs: 12, sx: { mt: 13 }, style: PLVFooterLogo }, { children: [(0, jsx_runtime_1.jsx)("span", __assign({ style: PVLFooterText }, { children: "WWW.MOVALIB.COM" })), (0, jsx_runtime_1.jsx)("img", { src: leafs_large_png_1.default, style: PLVFooterLogo })] }))] })) })));
117
+ };
118
+ return PLVComponent;
119
+ }(react_1.default.Component));
120
+ var GaragePLV = function (_a) {
121
+ var url = _a.url;
122
+ var componentRef = (0, react_1.useRef)(null);
123
+ var theme = (0, material_1.useTheme)();
124
+ var handlePrint = (0, react_to_print_1.useReactToPrint)({
125
+ content: function () { return componentRef.current; },
126
+ documentTitle: 'Movalib_PLV_A4',
127
+ });
128
+ return ((0, jsx_runtime_1.jsxs)("div", __assign({ style: Tools_1.flexCenter }, { children: [(0, jsx_runtime_1.jsx)(PLVComponent, { ref: componentRef, url: url }), (0, jsx_runtime_1.jsx)(material_1.Button, __assign({ onClick: handlePrint, variant: 'outlined', sx: { color: (0, material_1.darken)(theme.palette.primary.main, 0.2) } }, { children: "Imprimer la PLV (A4)" }))] })));
129
+ };
130
+ exports.default = GaragePLV;
131
+ // CSS pour cacher le contenu à l'écran mais le rendre imprimable
132
+ var css = "\n .highlight {\n background-color: #BCD46C; /* Couleur de surlignage */\n margin: 4px 4px; /* Espacement autour du texte surlign\u00E9 */\n padding-left : 8px;\n padding-right: 8px;\n font-weight: 500;\n color: white;\n }\n .not-highlight {\n margin: 4px 4px; /* Espacement autour du texte surlign\u00E9 */\n padding-left : 8px;\n padding-right: 8px;\n color: #BCD46C;\n }\n\n .printable-content {\n visibility: hidden;\n position: absolute;\n left: -10000px;\n top: -10000px;\n }\n @media print {\n .printable-content {\n visibility: visible;\n position: static;\n }\n }\n";
133
+ var styleSheet = document.createElement("style");
134
+ styleSheet.innerText = css;
135
+ document.head.appendChild(styleSheet);
@@ -99,7 +99,6 @@ var MovaLogin = function (_a) {
99
99
  var _e = (0, react_1.useState)(false), showPassword = _e[0], setShowPassword = _e[1];
100
100
  var handleDateChange = function (name, date) {
101
101
  var _a;
102
- console.log(date);
103
102
  if (name && date) {
104
103
  var fieldName = name;
105
104
  var fieldValue = date;
@@ -112,6 +111,14 @@ var MovaLogin = function (_a) {
112
111
  if (e) {
113
112
  var fieldName = e.target.name;
114
113
  var fieldValue = e.target.value;
114
+ // Capitalisation automatique du prénom
115
+ if (fieldName == "firstname") {
116
+ fieldValue = (0, Tools_1.capitalizeFirstLetter)(fieldValue);
117
+ }
118
+ // Uppercase automatique pour le nom
119
+ if (fieldName == "lastname") {
120
+ fieldValue = fieldValue.toUpperCase();
121
+ }
115
122
  var newField = (_a = {}, _a[fieldName] = { value: fieldValue, isValid: true }, _a);
116
123
  setUserForm(__assign(__assign({}, userForm), newField));
117
124
  }
@@ -33,7 +33,7 @@ var styles = {
33
33
  var QRCode = function (_a) {
34
34
  var data = _a.data, _b = _a.showDownload, showDownload = _b === void 0 ? false : _b;
35
35
  var theme = (0, material_1.useTheme)();
36
- // Le contenu du QR Code est transmis en props, sinon redirection vers ls site vitrine
36
+ // Le contenu du QR Code est transmis en props, sinon redirection vers le site vitrine
37
37
  var defaultData = 'https://movalib.com';
38
38
  var _c = (0, react_1.useState)({
39
39
  width: 600,
@@ -5,4 +5,3 @@ export declare const countryTimeZones: {
5
5
  export declare const toUTCToLocaleDate: (date: "" | Date | null, countryCode: string) => Date;
6
6
  export declare const formatDateByCountryCode: (date: Date | undefined, countryCode: string, formatType: DateFormatTypes) => string;
7
7
  export declare function getLongFormattedDateTime(date: Date | undefined, timeZone: string, locale: Locale): string;
8
- export declare function capitalizeFirstLetter(str: string): string;
@@ -1,9 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.capitalizeFirstLetter = exports.getLongFormattedDateTime = exports.formatDateByCountryCode = exports.toUTCToLocaleDate = exports.countryTimeZones = void 0;
3
+ exports.getLongFormattedDateTime = exports.formatDateByCountryCode = exports.toUTCToLocaleDate = exports.countryTimeZones = void 0;
4
4
  var date_fns_tz_1 = require("date-fns-tz");
5
5
  var locale_1 = require("date-fns/locale");
6
6
  var Enums_1 = require("./Enums");
7
+ var Tools_1 = require("./Tools");
7
8
  // Tableau de correspondance entre les codes de pays et les fuseaux horaires
8
9
  exports.countryTimeZones = {
9
10
  'FR': 'Europe/Paris',
@@ -42,8 +43,8 @@ var formatDateByCountryCode = function (date, countryCode, formatType) {
42
43
  exports.formatDateByCountryCode = formatDateByCountryCode;
43
44
  function getLongFormattedDateTime(date, timeZone, locale) {
44
45
  if (date) {
45
- var day = capitalizeFirstLetter((0, date_fns_tz_1.format)(date, 'eeee', { timeZone: timeZone, locale: locale }));
46
- var month = capitalizeFirstLetter((0, date_fns_tz_1.format)(date, 'MMMM', { timeZone: timeZone, locale: locale }));
46
+ var day = (0, Tools_1.capitalizeFirstLetter)((0, date_fns_tz_1.format)(date, 'eeee', { timeZone: timeZone, locale: locale }));
47
+ var month = (0, Tools_1.capitalizeFirstLetter)((0, date_fns_tz_1.format)(date, 'MMMM', { timeZone: timeZone, locale: locale }));
47
48
  var hours = (0, date_fns_tz_1.format)(date, 'HH', { timeZone: timeZone, locale: locale });
48
49
  var minutes = (0, date_fns_tz_1.format)(date, 'mm', { timeZone: timeZone, locale: locale });
49
50
  var dayOfMonth = (0, date_fns_tz_1.format)(date, 'dd', { timeZone: timeZone, locale: locale });
@@ -52,12 +53,3 @@ function getLongFormattedDateTime(date, timeZone, locale) {
52
53
  return '';
53
54
  }
54
55
  exports.getLongFormattedDateTime = getLongFormattedDateTime;
55
- function capitalizeFirstLetter(str) {
56
- if (str.length === 0) {
57
- return str;
58
- }
59
- var firstChar = str.charAt(0).toUpperCase();
60
- var restOfString = str.slice(1);
61
- return firstChar + restOfString;
62
- }
63
- exports.capitalizeFirstLetter = capitalizeFirstLetter;
@@ -2,6 +2,7 @@ import VehicleTire from "../models/VehicleTire";
2
2
  import { MovaFormField } from "./Types";
3
3
  import { CSSProperties } from "react";
4
4
  import { PartsApplicationType } from "./Enums";
5
+ export declare const capitalizeFirstLetter: (str: string) => string;
5
6
  export declare const getApplicationShortLabel: (application: PartsApplicationType | undefined) => "" | "AV" | "AR" | "AV + AR" | "G" | "D" | "G + D";
6
7
  export declare const flexEnd: CSSProperties;
7
8
  export declare const flexCenter: CSSProperties;
@@ -1,7 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.validateField = exports.formatVehicleTireStr = exports.formatVehicleTire = exports.formatFrenchVehiclePlate = exports.isEmpty = exports.flexCenter = exports.flexEnd = exports.getApplicationShortLabel = void 0;
3
+ exports.validateField = exports.formatVehicleTireStr = exports.formatVehicleTire = exports.formatFrenchVehiclePlate = exports.isEmpty = exports.flexCenter = exports.flexEnd = exports.getApplicationShortLabel = exports.capitalizeFirstLetter = void 0;
4
4
  var Enums_1 = require("./Enums");
5
+ var capitalizeFirstLetter = function (str) {
6
+ if (str.length === 0) {
7
+ return str;
8
+ }
9
+ var firstChar = str.charAt(0).toUpperCase();
10
+ var restOfString = str.slice(1);
11
+ return firstChar + restOfString;
12
+ };
13
+ exports.capitalizeFirstLetter = capitalizeFirstLetter;
5
14
  var getApplicationShortLabel = function (application) {
6
15
  if (application) {
7
16
  switch (application) {
package/index.ts CHANGED
@@ -6,6 +6,7 @@ export { default as GarageService } from './src/services/GarageService';
6
6
  export { default as UserService } from './src/services/UserService';
7
7
 
8
8
  // Export des composants
9
+ export { default as GaragePLV } from './src/GaragePLV';
9
10
  export { default as AccountValidation } from './src/AccountValidation';
10
11
  export { default as AddressFields } from './src/AddressFields';
11
12
  export { default as ScheduleFields } from './src/ScheduleFields';
@@ -49,9 +50,10 @@ export type { MovaFormField, MovaLoginForm, MovaUserSignUpForm, MovaInterval,
49
50
 
50
51
  // Export des méthodes utilitaires
51
52
  export { readCookie, deleteCookie } from './src/helpers/CookieUtils';
52
- export { validateField, formatVehicleTire, formatFrenchVehiclePlate, isEmpty, getApplicationShortLabel } from './src/helpers/Tools';
53
+ export { validateField, formatVehicleTire, formatFrenchVehiclePlate, isEmpty, getApplicationShortLabel,
54
+ capitalizeFirstLetter } from './src/helpers/Tools';
53
55
  export { validatePhoneNumber, validateText, validateEmail } from './src/helpers/Validator';
54
- export { formatDateByCountryCode, getLongFormattedDateTime, capitalizeFirstLetter } from './src/helpers/DateUtils';
56
+ export { formatDateByCountryCode, getLongFormattedDateTime } from './src/helpers/DateUtils';
55
57
 
56
58
  // Export des enums
57
59
  export { RoleType, MovaAppType, DayOfWeek, EventState, EventType, DocumentType,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@movalib/movalib-commons",
3
- "version": "1.1.18",
3
+ "version": "1.1.20",
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",
@@ -34,6 +34,7 @@
34
34
  "react-dom": "^18.2.0",
35
35
  "react-router-dom": "^5.1.2",
36
36
  "react-scripts": "5.0.1",
37
+ "react-to-print": "^2.14.15",
37
38
  "typescript": "^4.9.5"
38
39
  },
39
40
  "eslintConfig": {
package/public/index.html CHANGED
@@ -2,6 +2,9 @@
2
2
  <html>
3
3
  <head>
4
4
  <title>Movalib Commons</title>
5
+ <link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700&display=swap" rel="stylesheet">
6
+ <link href="https://fonts.googleapis.com/css2?family=Dancing+Script:wght@700&display=swap" rel="stylesheet">
7
+
5
8
  </head>
6
9
  <body>
7
10
  <div id="root"></div>
@@ -0,0 +1,179 @@
1
+ import React, { CSSProperties, FC, useRef } from 'react';
2
+ import QRCode from './QRCode';
3
+ import { useReactToPrint } from 'react-to-print';
4
+ import { Button, Grid, Typography, darken, useTheme } from '@mui/material';
5
+ import { flexCenter } from './helpers/Tools';
6
+ import LogoLarge from './assets/images/logo/logo_large.png';
7
+ import LeafsLarge from './assets/images/leafs_large.png';
8
+ import theme from '../theme';
9
+
10
+ interface GaragePLVProps {
11
+ url: string;
12
+ }
13
+
14
+ const PLVTitle:CSSProperties = {
15
+ display: 'flex',
16
+ justifyContent: 'left',
17
+ alignItems: 'center',
18
+ textTransform: 'uppercase',
19
+ fontFamily: 'Montserrat, sans-serif',
20
+ fontSize: '50px',
21
+ lineHeight: 1,
22
+ }
23
+
24
+ const PLVHeaderLogo:CSSProperties = {
25
+ display: 'flex',
26
+ justifyContent: 'center',
27
+ alignItems: 'center',
28
+ width:'25%'
29
+ }
30
+
31
+ const PLVFooterLogo:CSSProperties = {
32
+ display: 'flex',
33
+ justifyContent: 'end',
34
+ alignItems: 'center',
35
+ width:'15%',
36
+ right: '6%',
37
+ position: 'relative',
38
+ zIndex: -1
39
+ }
40
+
41
+ const PLVQRCode:CSSProperties = {
42
+ display: 'flex',
43
+ justifyContent: 'center',
44
+ alignItems: 'center'
45
+ }
46
+
47
+ const PLVBaseLine:CSSProperties = {
48
+ display: 'flex',
49
+ justifyContent: 'left',
50
+ alignItems: 'center',
51
+ fontFamily: 'Dancing Script',
52
+ transform: 'rotate(-10deg)',
53
+ fontSize: '30px',
54
+ }
55
+
56
+ const PVLFooterText:CSSProperties = {
57
+ fontFamily: 'Montserrat, sans-serif',
58
+ textTransform: 'uppercase',
59
+ fontSize: '14px',
60
+ letterSpacing: 4,
61
+ position: 'absolute'
62
+ }
63
+
64
+ /**
65
+ * PLV Garage au format A4
66
+ */
67
+ class PLVComponent extends React.Component<GaragePLVProps> {
68
+
69
+ render() {
70
+ return (
71
+
72
+ <div className="printable-content" style={{ width: '210mm', height: '297mm' }}>
73
+ <Grid container>
74
+
75
+ <Grid item xs={12} style={PLVHeaderLogo} sx={{ m: 2, mt: 4}}>
76
+ <img src={LogoLarge} style={PLVHeaderLogo}/>
77
+ </Grid>
78
+
79
+ <Grid item xs={12} sx={{ ml: 6, mt: 4 }}>
80
+ <Typography style={PLVTitle} >
81
+ <span className='highlight'>Dans ce garage</span>
82
+ </Typography>
83
+ <Typography style={PLVTitle}>
84
+ <span className='highlight'> prenez rendez-vous </span>
85
+ </Typography>
86
+ <Typography style={PLVTitle}>
87
+ <span className='highlight'> en un clic. </span>
88
+ </Typography>
89
+ </Grid>
90
+
91
+ <Grid item xs={12} sx={{ ml: 6, mt: 4 }}>
92
+ <Typography style={PLVTitle}>
93
+ <span className='not-highlight'> Votre entretien </span>
94
+ </Typography>
95
+ <Typography style={PLVTitle}>
96
+ <span className='not-highlight'> auto ne sera plus </span>
97
+ </Typography>
98
+ <Typography style={PLVTitle}>
99
+ <span className='not-highlight'> un casse-tête ! </span>
100
+ </Typography>
101
+ </Grid>
102
+
103
+ <Grid item xs={7} sx={{ pl: 8, mt: 8 }} style={PLVQRCode}>
104
+ <QRCode data={this.props.url} />
105
+ </Grid>
106
+
107
+ <Grid item xs={5} style={PLVBaseLine}>
108
+ <Typography style={PLVBaseLine}>
109
+ En plus l'appli est gratuite !
110
+ </Typography>
111
+ </Grid>
112
+
113
+ <Grid item xs={12} sx={{ mt: 13 }} style={PLVFooterLogo}>
114
+ <span style={PVLFooterText}>WWW.MOVALIB.COM</span>
115
+ <img src={LeafsLarge} style={PLVFooterLogo}/>
116
+
117
+ </Grid>
118
+
119
+ </Grid>
120
+
121
+ </div>
122
+ );
123
+ }
124
+ }
125
+
126
+ const GaragePLV: FC<GaragePLVProps> = ({ url }) => {
127
+
128
+ const componentRef = useRef<PLVComponent>(null);
129
+ const theme = useTheme();
130
+
131
+ const handlePrint = useReactToPrint({
132
+ content: () => componentRef.current,
133
+ documentTitle: 'Movalib_PLV_A4',
134
+ });
135
+
136
+ return (
137
+ <div style={flexCenter}>
138
+ <PLVComponent ref={componentRef} url={url} />
139
+ <Button onClick={handlePrint} variant='outlined'
140
+ sx={{ color: darken(theme.palette.primary.main, 0.2)}}>Imprimer la PLV (A4)</Button>
141
+ </div>
142
+ );
143
+ };
144
+
145
+ export default GaragePLV;
146
+
147
+ // CSS pour cacher le contenu à l'écran mais le rendre imprimable
148
+ const css = `
149
+ .highlight {
150
+ background-color: #BCD46C; /* Couleur de surlignage */
151
+ margin: 4px 4px; /* Espacement autour du texte surligné */
152
+ padding-left : 8px;
153
+ padding-right: 8px;
154
+ font-weight: 500;
155
+ color: white;
156
+ }
157
+ .not-highlight {
158
+ margin: 4px 4px; /* Espacement autour du texte surligné */
159
+ padding-left : 8px;
160
+ padding-right: 8px;
161
+ color: #BCD46C;
162
+ }
163
+
164
+ .printable-content {
165
+ visibility: hidden;
166
+ position: absolute;
167
+ left: -10000px;
168
+ top: -10000px;
169
+ }
170
+ @media print {
171
+ .printable-content {
172
+ visibility: visible;
173
+ position: static;
174
+ }
175
+ }
176
+ `;
177
+ const styleSheet = document.createElement("style");
178
+ styleSheet.innerText = css;
179
+ document.head.appendChild(styleSheet);
@@ -14,7 +14,7 @@ import { MovaFormField, MovaUserSignUpForm } from "./helpers/Types";
14
14
  import { MovaAppType } from "./helpers/Enums";
15
15
  import { validateEmail } from "./helpers/Validator";
16
16
  import GenderSelector from "./GenderSelector";
17
- import { validateField } from "./helpers/Tools";
17
+ import { capitalizeFirstLetter, validateField } from "./helpers/Tools";
18
18
  import { useHistory } from "react-router-dom";
19
19
  import InputAdornment from '@mui/material/InputAdornment';
20
20
  import Visibility from '@mui/icons-material/Visibility';
@@ -68,7 +68,7 @@ const MovaLogin: FunctionComponent<MovaSignUpProps> = ({ loading, movaAppType, o
68
68
  const [showPassword, setShowPassword] = useState(false);
69
69
 
70
70
  const handleDateChange = (name: string, date: Date | null) => {
71
- console.log(date)
71
+
72
72
  if(name && date){
73
73
  const fieldName: string = name;
74
74
  const fieldValue: Date = date;
@@ -81,9 +81,20 @@ const MovaLogin: FunctionComponent<MovaSignUpProps> = ({ loading, movaAppType, o
81
81
  const handleInputChange = (e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement> | null): void => {
82
82
  if(e){
83
83
  const fieldName: string = e.target.name;
84
- const fieldValue: string = e.target.value;
84
+ let fieldValue: string = e.target.value;
85
+
86
+ // Capitalisation automatique du prénom
87
+ if (fieldName == "firstname"){
88
+ fieldValue = capitalizeFirstLetter(fieldValue);
89
+ }
90
+
91
+ // Uppercase automatique pour le nom
92
+ if (fieldName == "lastname"){
93
+ fieldValue = fieldValue.toUpperCase();
94
+ }
95
+
85
96
  const newField: MovaFormField = { [fieldName]: { value: fieldValue, isValid: true } };
86
-
97
+
87
98
  setUserForm({ ...userForm, ...newField});
88
99
  }
89
100
  }
package/src/QRCode.tsx CHANGED
@@ -35,7 +35,7 @@ const QRCode: FC<QRCodeProps> = ({ data, showDownload=false }) => {
35
35
 
36
36
  const theme = useTheme();
37
37
 
38
- // Le contenu du QR Code est transmis en props, sinon redirection vers ls site vitrine
38
+ // Le contenu du QR Code est transmis en props, sinon redirection vers le site vitrine
39
39
  const defaultData:string = 'https://movalib.com';
40
40
 
41
41
  const [options, setOptions] = useState<Options>({
@@ -1,6 +1,7 @@
1
1
  import { format, utcToZonedTime } from 'date-fns-tz';
2
2
  import { fr } from 'date-fns/locale';
3
3
  import { DateFormatTypes } from './Enums';
4
+ import { capitalizeFirstLetter } from './Tools';
4
5
 
5
6
  // Tableau de correspondance entre les codes de pays et les fuseaux horaires
6
7
  export const countryTimeZones: { [key: string]: string } = {
@@ -62,15 +63,4 @@ export function getLongFormattedDateTime(date: Date | undefined, timeZone: strin
62
63
  return `${day} ${dayOfMonth} ${month} à ${hours}:${minutes}`;
63
64
  }
64
65
  return '';
65
- }
66
-
67
- export function capitalizeFirstLetter(str: string): string {
68
- if (str.length === 0) {
69
- return str;
70
- }
71
-
72
- const firstChar = str.charAt(0).toUpperCase();
73
- const restOfString = str.slice(1);
74
-
75
- return firstChar + restOfString;
76
- }
66
+ }
@@ -4,6 +4,17 @@ import { MovaFormField } from "./Types";
4
4
  import { CSSProperties } from "react";
5
5
  import { PartsApplicationType, VehiclePlateFormat } from "./Enums";
6
6
 
7
+ export const capitalizeFirstLetter = (str: string): string => {
8
+ if (str.length === 0) {
9
+ return str;
10
+ }
11
+
12
+ const firstChar = str.charAt(0).toUpperCase();
13
+ const restOfString = str.slice(1);
14
+
15
+ return firstChar + restOfString;
16
+ }
17
+
7
18
  export const getApplicationShortLabel = (application:PartsApplicationType | undefined) => {
8
19
  if(application){
9
20
  switch(application){