@movalib/movalib-commons 1.54.0 → 1.55.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +6 -4
- package/dist/index.js +7 -2
- package/dist/src/GaragePLV.d.ts +1 -6
- package/dist/src/GaragePLV.js +4 -153
- package/dist/src/components/QrCodePLVContainer/PLVComponent.d.ts +16 -0
- package/dist/src/components/QrCodePLVContainer/PLVComponent.js +145 -0
- package/dist/src/components/QrCodePLVContainer/QrCodePLVContainer.d.ts +4 -0
- package/dist/src/components/QrCodePLVContainer/QrCodePLVContainer.js +141 -0
- package/index.ts +55 -14
- package/package.json +2 -4
- package/src/GaragePLV.tsx +13 -213
- package/src/components/QrCodePLVContainer/PLVComponent.tsx +214 -0
- package/src/components/QrCodePLVContainer/QrCodePLVContainer.tsx +202 -0
- package/src/QRCode.css +0 -8
- /package/{dist/src → src/components/QrCodePLVContainer}/QRCode.css +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -22,6 +22,8 @@ export { default as MovaCopyright } from './src/MovaCopyright';
|
|
|
22
22
|
export { default as MovaVehicleTireField } from './src/MovaVehicleTireField';
|
|
23
23
|
export { default as ConfirmationDialog } from './src/ConfirmationDialog';
|
|
24
24
|
export { default as GenderSelector } from './src/GenderSelector';
|
|
25
|
+
export { QrCodePLVContainer } from './src/components/QrCodePLVContainer/QrCodePLVContainer';
|
|
26
|
+
export { PLVComponent, PrintSize } from './src/components/QrCodePLVContainer/PLVComponent';
|
|
25
27
|
export { default as Subscription } from './src/models/Subscription';
|
|
26
28
|
export { default as Absence } from './src/models/Absence';
|
|
27
29
|
export { default as Employee } from './src/models/Employee';
|
|
@@ -42,10 +44,10 @@ export { default as Event } from './src/models/Event';
|
|
|
42
44
|
export { default as VehicleTire } from './src/models/VehicleTire';
|
|
43
45
|
export type { APIRequest, APIResponse } from './src/helpers/ApiHelper';
|
|
44
46
|
export type { DaySchedule, DayInterval } from './src/ScheduleFields';
|
|
45
|
-
export type { MovaFormField, MovaLoginForm, MovaUserSignUpForm, MovaInterval, MovaVehicleForm, AddressFieldName } from './src/helpers/Types';
|
|
47
|
+
export type { MovaFormField, MovaLoginForm, MovaUserSignUpForm, MovaInterval, MovaVehicleForm, AddressFieldName, } from './src/helpers/Types';
|
|
46
48
|
export { readCookie, deleteCookie } from './src/helpers/CookieUtils';
|
|
47
|
-
export { validateField, formatVehicleTire, formatFrenchVehiclePlate, isEmpty, getApplicationShortLabel, capitalizeFirstLetter, flexLeftRow, formatPhoneNumber, getFormattedSchedule, getFormattedIntervals, findScheduleByDayOfWeek, getDayOfWeekLabel, isSafariOniOS, getApplicationsShortLabels } from './src/helpers/Tools';
|
|
49
|
+
export { validateField, formatVehicleTire, formatFrenchVehiclePlate, isEmpty, getApplicationShortLabel, capitalizeFirstLetter, flexLeftRow, formatPhoneNumber, getFormattedSchedule, getFormattedIntervals, findScheduleByDayOfWeek, getDayOfWeekLabel, isSafariOniOS, getApplicationsShortLabels, } from './src/helpers/Tools';
|
|
48
50
|
export { validatePhoneNumber, validateText, validateEmail } from './src/helpers/Validator';
|
|
49
51
|
export { formatDateByCountryCode, getLongFormattedDateTime } from './src/helpers/DateUtils';
|
|
50
|
-
export { request, API_BASE_URL
|
|
51
|
-
export { RoleType, MovaAppType, DayOfWeek, EventState, EventType, DocumentType, DigitalPassportIndex, DocumentState, Gender, DateFormatTypes, PartsApplicationType, ProductType, OrderPreference, OrderState, SlotAlgorithm, VehiclePlateFormat as VehiclePlateType, SubscriptionPaymentInterval, RegistrationState, PrestationType, PrestationState, CountryCode, SubscriptionState, SubscriptionType, APIMethod } from './src/helpers/Enums';
|
|
52
|
+
export { request, API_BASE_URL } from './src/helpers/ApiHelper';
|
|
53
|
+
export { RoleType, MovaAppType, DayOfWeek, EventState, EventType, DocumentType, DigitalPassportIndex, DocumentState, Gender, DateFormatTypes, PartsApplicationType, ProductType, OrderPreference, OrderState, SlotAlgorithm, VehiclePlateFormat as VehiclePlateType, SubscriptionPaymentInterval, RegistrationState, PrestationType, PrestationState, CountryCode, SubscriptionState, SubscriptionType, APIMethod, } 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.
|
|
8
|
-
exports.APIMethod = exports.SubscriptionType = exports.SubscriptionState = exports.CountryCode = exports.PrestationState = exports.PrestationType = exports.RegistrationState = exports.SubscriptionPaymentInterval = exports.VehiclePlateType = exports.SlotAlgorithm = exports.OrderState = exports.OrderPreference = exports.ProductType = exports.PartsApplicationType = exports.DateFormatTypes = exports.Gender = exports.DocumentState = exports.DigitalPassportIndex = exports.DocumentType = exports.EventType = exports.EventState = exports.DayOfWeek = exports.MovaAppType = exports.RoleType = exports.API_BASE_URL = exports.request = exports.getLongFormattedDateTime = exports.formatDateByCountryCode = exports.validateEmail = exports.validateText = exports.validatePhoneNumber = exports.getApplicationsShortLabels = exports.isSafariOniOS = exports.getDayOfWeekLabel = exports.findScheduleByDayOfWeek = exports.getFormattedIntervals = exports.getFormattedSchedule = exports.formatPhoneNumber = exports.flexLeftRow = void 0;
|
|
7
|
+
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.Employee = exports.Absence = exports.Subscription = exports.PrintSize = exports.PLVComponent = exports.QrCodePLVContainer = 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.IbanInput = exports.DialogForgotPassword = exports.UserService = exports.GarageService = exports.AuthenticationService = exports.VehicleService = void 0;
|
|
8
|
+
exports.APIMethod = exports.SubscriptionType = exports.SubscriptionState = exports.CountryCode = exports.PrestationState = exports.PrestationType = exports.RegistrationState = exports.SubscriptionPaymentInterval = exports.VehiclePlateType = exports.SlotAlgorithm = exports.OrderState = exports.OrderPreference = exports.ProductType = exports.PartsApplicationType = exports.DateFormatTypes = exports.Gender = exports.DocumentState = exports.DigitalPassportIndex = exports.DocumentType = exports.EventType = exports.EventState = exports.DayOfWeek = exports.MovaAppType = exports.RoleType = exports.API_BASE_URL = exports.request = exports.getLongFormattedDateTime = exports.formatDateByCountryCode = exports.validateEmail = exports.validateText = exports.validatePhoneNumber = exports.getApplicationsShortLabels = exports.isSafariOniOS = exports.getDayOfWeekLabel = exports.findScheduleByDayOfWeek = exports.getFormattedIntervals = exports.getFormattedSchedule = exports.formatPhoneNumber = exports.flexLeftRow = exports.capitalizeFirstLetter = exports.getApplicationShortLabel = exports.isEmpty = void 0;
|
|
9
9
|
// Export des services
|
|
10
10
|
var VehicleService_1 = require("./src/services/VehicleService");
|
|
11
11
|
Object.defineProperty(exports, "VehicleService", { enumerable: true, get: function () { return __importDefault(VehicleService_1).default; } });
|
|
@@ -56,6 +56,11 @@ var ConfirmationDialog_1 = require("./src/ConfirmationDialog");
|
|
|
56
56
|
Object.defineProperty(exports, "ConfirmationDialog", { enumerable: true, get: function () { return __importDefault(ConfirmationDialog_1).default; } });
|
|
57
57
|
var GenderSelector_1 = require("./src/GenderSelector");
|
|
58
58
|
Object.defineProperty(exports, "GenderSelector", { enumerable: true, get: function () { return __importDefault(GenderSelector_1).default; } });
|
|
59
|
+
var QrCodePLVContainer_1 = require("./src/components/QrCodePLVContainer/QrCodePLVContainer");
|
|
60
|
+
Object.defineProperty(exports, "QrCodePLVContainer", { enumerable: true, get: function () { return QrCodePLVContainer_1.QrCodePLVContainer; } });
|
|
61
|
+
var PLVComponent_1 = require("./src/components/QrCodePLVContainer/PLVComponent");
|
|
62
|
+
Object.defineProperty(exports, "PLVComponent", { enumerable: true, get: function () { return PLVComponent_1.PLVComponent; } });
|
|
63
|
+
Object.defineProperty(exports, "PrintSize", { enumerable: true, get: function () { return PLVComponent_1.PrintSize; } });
|
|
59
64
|
// Export des classes
|
|
60
65
|
var Subscription_1 = require("./src/models/Subscription");
|
|
61
66
|
Object.defineProperty(exports, "Subscription", { enumerable: true, get: function () { return __importDefault(Subscription_1).default; } });
|
package/dist/src/GaragePLV.d.ts
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
import { FC } from 'react';
|
|
2
|
-
export declare enum PrintSize {
|
|
3
|
-
A3 = 0,
|
|
4
|
-
A4 = 1
|
|
5
|
-
}
|
|
1
|
+
import { type FC } from 'react';
|
|
6
2
|
interface GaragePLVProps {
|
|
7
3
|
url: string;
|
|
8
|
-
printSize?: PrintSize;
|
|
9
4
|
}
|
|
10
5
|
declare const GaragePLV: FC<GaragePLVProps>;
|
|
11
6
|
export default GaragePLV;
|
package/dist/src/GaragePLV.js
CHANGED
|
@@ -1,19 +1,4 @@
|
|
|
1
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
2
|
var __assign = (this && this.__assign) || function () {
|
|
18
3
|
__assign = Object.assign || function(t) {
|
|
19
4
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
@@ -25,142 +10,13 @@ var __assign = (this && this.__assign) || function () {
|
|
|
25
10
|
};
|
|
26
11
|
return __assign.apply(this, arguments);
|
|
27
12
|
};
|
|
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
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
55
|
-
exports.PrintSize = void 0;
|
|
56
14
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
57
|
-
var react_1 = __importStar(require("react"));
|
|
58
|
-
var QRCode_1 = __importDefault(require("./QRCode"));
|
|
59
|
-
var react_to_print_1 = require("react-to-print");
|
|
60
15
|
var material_1 = require("@mui/material");
|
|
16
|
+
var react_1 = require("react");
|
|
17
|
+
var react_to_print_1 = require("react-to-print");
|
|
18
|
+
var PLVComponent_1 = require("./components/QrCodePLVContainer/PLVComponent");
|
|
61
19
|
var Tools_1 = require("./helpers/Tools");
|
|
62
|
-
var logo_large_png_1 = __importDefault(require("./assets/images/logo/logo_large.png"));
|
|
63
|
-
var leafs_large_png_1 = __importDefault(require("./assets/images/leafs_large.png"));
|
|
64
|
-
var theme_1 = __importDefault(require("../theme"));
|
|
65
|
-
var PrintSize;
|
|
66
|
-
(function (PrintSize) {
|
|
67
|
-
PrintSize[PrintSize["A3"] = 0] = "A3";
|
|
68
|
-
PrintSize[PrintSize["A4"] = 1] = "A4";
|
|
69
|
-
})(PrintSize = exports.PrintSize || (exports.PrintSize = {}));
|
|
70
|
-
var PLVTitle = {
|
|
71
|
-
display: 'flex',
|
|
72
|
-
justifyContent: 'left',
|
|
73
|
-
alignItems: 'center',
|
|
74
|
-
textTransform: 'uppercase',
|
|
75
|
-
fontFamily: 'Montserrat, sans-serif',
|
|
76
|
-
fontSize: '50px',
|
|
77
|
-
lineHeight: 1.2,
|
|
78
|
-
};
|
|
79
|
-
var PLVTitleA3 = {
|
|
80
|
-
display: 'flex',
|
|
81
|
-
justifyContent: 'left',
|
|
82
|
-
alignItems: 'center',
|
|
83
|
-
textTransform: 'uppercase',
|
|
84
|
-
fontFamily: 'Montserrat, sans-serif',
|
|
85
|
-
fontSize: '75px',
|
|
86
|
-
lineHeight: 1.2,
|
|
87
|
-
};
|
|
88
|
-
var PLVHeaderLogo = {
|
|
89
|
-
display: 'flex',
|
|
90
|
-
justifyContent: 'center',
|
|
91
|
-
alignItems: 'center',
|
|
92
|
-
width: '25%'
|
|
93
|
-
};
|
|
94
|
-
var PLVFooterLogo = {
|
|
95
|
-
display: 'flex',
|
|
96
|
-
justifyContent: 'end',
|
|
97
|
-
alignItems: 'center',
|
|
98
|
-
width: '15%',
|
|
99
|
-
right: '6%',
|
|
100
|
-
position: 'relative',
|
|
101
|
-
zIndex: -1
|
|
102
|
-
};
|
|
103
|
-
var PLVQRCode = {
|
|
104
|
-
display: 'flex',
|
|
105
|
-
justifyContent: 'center',
|
|
106
|
-
alignItems: 'center'
|
|
107
|
-
};
|
|
108
|
-
var PLVBaseLine = {
|
|
109
|
-
display: 'flex',
|
|
110
|
-
justifyContent: 'left',
|
|
111
|
-
alignItems: 'center',
|
|
112
|
-
fontFamily: 'Caveat',
|
|
113
|
-
lineHeight: 2.5,
|
|
114
|
-
fontWeight: 700,
|
|
115
|
-
marginTop: 20,
|
|
116
|
-
paddingLeft: 0,
|
|
117
|
-
//transform: 'rotate(-10deg)',
|
|
118
|
-
fontSize: '27px',
|
|
119
|
-
};
|
|
120
|
-
var PLVBaseLineA3 = {
|
|
121
|
-
display: 'flex',
|
|
122
|
-
justifyContent: 'left',
|
|
123
|
-
alignItems: 'center',
|
|
124
|
-
fontFamily: 'Caveat',
|
|
125
|
-
lineHeight: 2.5,
|
|
126
|
-
fontWeight: 700,
|
|
127
|
-
marginTop: 20,
|
|
128
|
-
//transform: 'rotate(-10deg)',
|
|
129
|
-
fontSize: '38px',
|
|
130
|
-
};
|
|
131
|
-
var PVLFooterText = {
|
|
132
|
-
fontFamily: 'Montserrat, sans-serif',
|
|
133
|
-
textTransform: 'uppercase',
|
|
134
|
-
fontSize: '14px',
|
|
135
|
-
letterSpacing: 4,
|
|
136
|
-
position: 'absolute'
|
|
137
|
-
};
|
|
138
|
-
var PVLFooterTextA3 = {
|
|
139
|
-
fontFamily: 'Montserrat, sans-serif',
|
|
140
|
-
textTransform: 'uppercase',
|
|
141
|
-
fontSize: '20px',
|
|
142
|
-
letterSpacing: 4,
|
|
143
|
-
position: 'absolute'
|
|
144
|
-
};
|
|
145
|
-
/**
|
|
146
|
-
* PLV Garage au format A4
|
|
147
|
-
*/
|
|
148
|
-
var PLVComponent = /** @class */ (function (_super) {
|
|
149
|
-
__extends(PLVComponent, _super);
|
|
150
|
-
function PLVComponent() {
|
|
151
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
152
|
-
}
|
|
153
|
-
PLVComponent.prototype.render = function () {
|
|
154
|
-
return ((0, jsx_runtime_1.jsx)("div", __assign({ className: "printable-content", style: {
|
|
155
|
-
width: this.props.printSize === PrintSize.A4 ? '210mm' :
|
|
156
|
-
this.props.printSize === PrintSize.A3 ? '297mm' : '0mm',
|
|
157
|
-
height: this.props.printSize === PrintSize.A4 ? '297mm' :
|
|
158
|
-
this.props.printSize === PrintSize.A3 ? '420mm' : '0mm',
|
|
159
|
-
} }, { 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: 6, mb: 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: this.props.printSize === PrintSize.A3 ? PLVTitleA3 : 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: this.props.printSize === PrintSize.A3 ? PLVTitleA3 : 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: this.props.printSize === PrintSize.A3 ? PLVTitleA3 : 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: this.props.printSize === PrintSize.A3 ? PLVTitleA3 : 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: this.props.printSize === PrintSize.A3 ? PLVTitleA3 : 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: 6, sx: { pl: 0, mt: this.props.printSize === PrintSize.A3 ? 11 : 7 }, style: PLVQRCode }, { children: (0, jsx_runtime_1.jsx)(QRCode_1.default, { data: this.props.url, size: this.props.printSize === PrintSize.A4 ? 300 : 450 }) })), (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 6, style: PLVBaseLine }, { children: (0, jsx_runtime_1.jsxs)(material_1.Typography, __assign({ style: this.props.printSize === PrintSize.A3 ? PLVBaseLineA3 : PLVBaseLine }, { children: ["Vos rendez-vous et factures en un clic", (0, jsx_runtime_1.jsx)("br", {}), "Alertes et suivi en temps r\u00E9\u00E9l", (0, jsx_runtime_1.jsx)("br", {}), "Regroupez 100% de vos documents", (0, jsx_runtime_1.jsx)("br", {}), "Movalib vous r\u00E9concilie avec votre auto !"] })) })), (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 12, style: Tools_1.flexStart }, { children: (0, jsx_runtime_1.jsxs)(material_1.Typography, __assign({ color: theme_1.default.palette.primary.dark, sx: { ml: this.props.printSize === PrintSize.A3 ? 8 : 7,
|
|
160
|
-
fontSize: this.props.printSize === PrintSize.A3 ? '1.6rem' : '1rem' } }, { children: ["Ou rendez-vous sur ", (0, jsx_runtime_1.jsx)("b", { children: "app.movalib.com" })] })) })), (0, jsx_runtime_1.jsxs)(material_1.Grid, __assign({ item: true, xs: 12, sx: { mt: this.props.printSize === PrintSize.A3 ? 11 : 7 }, style: PLVFooterLogo }, { children: [(0, jsx_runtime_1.jsx)("span", __assign({ style: this.props.printSize === PrintSize.A3 ? PVLFooterTextA3 : PVLFooterText }, { children: "WWW.MOVALIB.COM" })), (0, jsx_runtime_1.jsx)("img", { src: leafs_large_png_1.default, style: PLVFooterLogo })] }))] })) })));
|
|
161
|
-
};
|
|
162
|
-
return PLVComponent;
|
|
163
|
-
}(react_1.default.Component));
|
|
164
20
|
var GaragePLV = function (_a) {
|
|
165
21
|
var url = _a.url;
|
|
166
22
|
var PLVrefA4 = (0, react_1.useRef)(null);
|
|
@@ -174,11 +30,6 @@ var GaragePLV = function (_a) {
|
|
|
174
30
|
content: function () { return PLVrefA3.current; },
|
|
175
31
|
documentTitle: 'Movalib_PLV_A3',
|
|
176
32
|
});
|
|
177
|
-
return ((0, jsx_runtime_1.jsxs)("div", __assign({ style: Tools_1.flexCenter }, { children: [(0, jsx_runtime_1.jsx)(PLVComponent, { ref: PLVrefA4, url: url, printSize: PrintSize.A4 }), (0, jsx_runtime_1.jsx)(PLVComponent, { ref: PLVrefA3, url: url, printSize: PrintSize.A3 }), (0, jsx_runtime_1.jsx)(material_1.Button, __assign({ onClick: handleA4Print, variant: 'outlined', sx: { color: (0, material_1.darken)(theme.palette.primary.main, 0.2), mr: 2 } }, { children: "\uD83E\uDDFE\u00A0\u00A0Imprimer la PLV (A4)" })), (0, jsx_runtime_1.jsx)(material_1.Button, __assign({ onClick: handleA3Print, variant: 'outlined', sx: { color: (0, material_1.darken)(theme.palette.primary.main, 0.2) } }, { children: "\uD83E\uDDFE\u00A0\u00A0Imprimer la PLV (A3)" }))] })));
|
|
33
|
+
return ((0, jsx_runtime_1.jsxs)("div", __assign({ style: Tools_1.flexCenter }, { children: [(0, jsx_runtime_1.jsx)(PLVComponent_1.PLVComponent, { ref: PLVrefA4, url: url, printSize: PLVComponent_1.PrintSize.A4 }), (0, jsx_runtime_1.jsx)(PLVComponent_1.PLVComponent, { ref: PLVrefA3, url: url, printSize: PLVComponent_1.PrintSize.A3 }), (0, jsx_runtime_1.jsx)(material_1.Button, __assign({ onClick: handleA4Print, variant: 'outlined', sx: { color: (0, material_1.darken)(theme.palette.primary.main, 0.2), mr: 2 } }, { children: "\uD83E\uDDFE\u00A0\u00A0Imprimer la PLV (A4)" })), (0, jsx_runtime_1.jsx)(material_1.Button, __assign({ onClick: handleA3Print, variant: 'outlined', sx: { color: (0, material_1.darken)(theme.palette.primary.main, 0.2) } }, { children: "\uD83E\uDDFE\u00A0\u00A0Imprimer la PLV (A3)" }))] })));
|
|
178
34
|
};
|
|
179
35
|
exports.default = GaragePLV;
|
|
180
|
-
// CSS pour cacher le contenu à l'écran mais le rendre imprimable
|
|
181
|
-
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";
|
|
182
|
-
var styleSheet = document.createElement("style");
|
|
183
|
-
styleSheet.innerText = css;
|
|
184
|
-
document.head.appendChild(styleSheet);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare enum PrintSize {
|
|
3
|
+
A3 = "A3",
|
|
4
|
+
A4 = "A4"
|
|
5
|
+
}
|
|
6
|
+
type PLVComponentProps = {
|
|
7
|
+
printSize: PrintSize;
|
|
8
|
+
url: string;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* PLV Garage au format A4
|
|
12
|
+
*/
|
|
13
|
+
export declare class PLVComponent extends React.Component<PLVComponentProps> {
|
|
14
|
+
render(): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
}
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,145 @@
|
|
|
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 __importDefault = (this && this.__importDefault) || function (mod) {
|
|
29
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
30
|
+
};
|
|
31
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
|
+
exports.PLVComponent = exports.PrintSize = void 0;
|
|
33
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
34
|
+
var material_1 = require("@mui/material");
|
|
35
|
+
var react_1 = __importDefault(require("react"));
|
|
36
|
+
var theme_1 = __importDefault(require("../../../theme"));
|
|
37
|
+
var QRCode_1 = __importDefault(require("../../QRCode"));
|
|
38
|
+
var leafs_large_png_1 = __importDefault(require("../../assets/images/leafs_large.png"));
|
|
39
|
+
var logo_large_png_1 = __importDefault(require("../../assets/images/logo/logo_large.png"));
|
|
40
|
+
var Tools_1 = require("../../helpers/Tools");
|
|
41
|
+
var PLVTitle = {
|
|
42
|
+
display: 'flex',
|
|
43
|
+
justifyContent: 'left',
|
|
44
|
+
alignItems: 'center',
|
|
45
|
+
textTransform: 'uppercase',
|
|
46
|
+
fontFamily: 'Montserrat, sans-serif',
|
|
47
|
+
fontSize: '50px',
|
|
48
|
+
lineHeight: 1.2,
|
|
49
|
+
};
|
|
50
|
+
var PLVTitleA3 = {
|
|
51
|
+
display: 'flex',
|
|
52
|
+
justifyContent: 'left',
|
|
53
|
+
alignItems: 'center',
|
|
54
|
+
textTransform: 'uppercase',
|
|
55
|
+
fontFamily: 'Montserrat, sans-serif',
|
|
56
|
+
fontSize: '75px',
|
|
57
|
+
lineHeight: 1.2,
|
|
58
|
+
};
|
|
59
|
+
var PLVHeaderLogo = {
|
|
60
|
+
display: 'flex',
|
|
61
|
+
justifyContent: 'center',
|
|
62
|
+
alignItems: 'center',
|
|
63
|
+
width: '25%',
|
|
64
|
+
};
|
|
65
|
+
var PLVFooterLogo = {
|
|
66
|
+
display: 'flex',
|
|
67
|
+
justifyContent: 'end',
|
|
68
|
+
alignItems: 'center',
|
|
69
|
+
width: '15%',
|
|
70
|
+
right: '6%',
|
|
71
|
+
position: 'relative',
|
|
72
|
+
zIndex: -1,
|
|
73
|
+
};
|
|
74
|
+
var PLVQRCode = {
|
|
75
|
+
display: 'flex',
|
|
76
|
+
justifyContent: 'center',
|
|
77
|
+
alignItems: 'center',
|
|
78
|
+
};
|
|
79
|
+
var PLVBaseLine = {
|
|
80
|
+
display: 'flex',
|
|
81
|
+
justifyContent: 'left',
|
|
82
|
+
alignItems: 'center',
|
|
83
|
+
fontFamily: 'Caveat',
|
|
84
|
+
lineHeight: 2.5,
|
|
85
|
+
fontWeight: 700,
|
|
86
|
+
marginTop: 20,
|
|
87
|
+
paddingLeft: 0,
|
|
88
|
+
//transform: 'rotate(-10deg)',
|
|
89
|
+
fontSize: '27px',
|
|
90
|
+
};
|
|
91
|
+
var PLVBaseLineA3 = {
|
|
92
|
+
display: 'flex',
|
|
93
|
+
justifyContent: 'left',
|
|
94
|
+
alignItems: 'center',
|
|
95
|
+
fontFamily: 'Caveat',
|
|
96
|
+
lineHeight: 2.5,
|
|
97
|
+
fontWeight: 700,
|
|
98
|
+
marginTop: 20,
|
|
99
|
+
//transform: 'rotate(-10deg)',
|
|
100
|
+
fontSize: '38px',
|
|
101
|
+
};
|
|
102
|
+
var PVLFooterText = {
|
|
103
|
+
fontFamily: 'Montserrat, sans-serif',
|
|
104
|
+
textTransform: 'uppercase',
|
|
105
|
+
fontSize: '14px',
|
|
106
|
+
letterSpacing: 4,
|
|
107
|
+
position: 'absolute',
|
|
108
|
+
};
|
|
109
|
+
var PVLFooterTextA3 = {
|
|
110
|
+
fontFamily: 'Montserrat, sans-serif',
|
|
111
|
+
textTransform: 'uppercase',
|
|
112
|
+
fontSize: '20px',
|
|
113
|
+
letterSpacing: 4,
|
|
114
|
+
position: 'absolute',
|
|
115
|
+
};
|
|
116
|
+
var PrintSize;
|
|
117
|
+
(function (PrintSize) {
|
|
118
|
+
PrintSize["A3"] = "A3";
|
|
119
|
+
PrintSize["A4"] = "A4";
|
|
120
|
+
})(PrintSize = exports.PrintSize || (exports.PrintSize = {}));
|
|
121
|
+
/**
|
|
122
|
+
* PLV Garage au format A4
|
|
123
|
+
*/
|
|
124
|
+
var PLVComponent = /** @class */ (function (_super) {
|
|
125
|
+
__extends(PLVComponent, _super);
|
|
126
|
+
function PLVComponent() {
|
|
127
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
128
|
+
}
|
|
129
|
+
PLVComponent.prototype.render = function () {
|
|
130
|
+
return ((0, jsx_runtime_1.jsx)("div", __assign({ className: 'printable-content', style: {
|
|
131
|
+
width: this.props.printSize === PrintSize.A4 ? '210mm' : this.props.printSize === PrintSize.A3 ? '297mm' : '0mm',
|
|
132
|
+
height: this.props.printSize === PrintSize.A4 ? '297mm' : this.props.printSize === PrintSize.A3 ? '420mm' : '0mm',
|
|
133
|
+
} }, { 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: 6, mb: 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: this.props.printSize === PrintSize.A3 ? PLVTitleA3 : 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: this.props.printSize === PrintSize.A3 ? PLVTitleA3 : 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: this.props.printSize === PrintSize.A3 ? PLVTitleA3 : 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: this.props.printSize === PrintSize.A3 ? PLVTitleA3 : 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: this.props.printSize === PrintSize.A3 ? PLVTitleA3 : 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: 6, sx: { pl: 0, mt: this.props.printSize === PrintSize.A3 ? 11 : 7 }, style: PLVQRCode }, { children: (0, jsx_runtime_1.jsx)(QRCode_1.default, { data: this.props.url, size: this.props.printSize === PrintSize.A4 ? 300 : 450 }) })), (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 6, style: PLVBaseLine }, { children: (0, jsx_runtime_1.jsxs)(material_1.Typography, __assign({ style: this.props.printSize === PrintSize.A3 ? PLVBaseLineA3 : PLVBaseLine }, { children: ["Vos rendez-vous et factures en un clic", (0, jsx_runtime_1.jsx)("br", {}), "Alertes et suivi en temps r\u00E9\u00E9l", (0, jsx_runtime_1.jsx)("br", {}), "Regroupez 100% de vos documents", (0, jsx_runtime_1.jsx)("br", {}), "Movalib vous r\u00E9concilie avec votre auto !"] })) })), (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 12, style: Tools_1.flexStart }, { children: (0, jsx_runtime_1.jsxs)(material_1.Typography, __assign({ color: theme_1.default.palette.primary.dark, sx: {
|
|
134
|
+
ml: this.props.printSize === PrintSize.A3 ? 8 : 7,
|
|
135
|
+
fontSize: this.props.printSize === PrintSize.A3 ? '1.6rem' : '1rem',
|
|
136
|
+
} }, { children: ["Ou rendez-vous sur ", (0, jsx_runtime_1.jsx)("b", { children: "app.movalib.com" })] })) })), (0, jsx_runtime_1.jsxs)(material_1.Grid, __assign({ item: true, xs: 12, sx: { mt: this.props.printSize === PrintSize.A3 ? 11 : 7 }, style: PLVFooterLogo }, { children: [(0, jsx_runtime_1.jsx)("span", __assign({ style: this.props.printSize === PrintSize.A3 ? PVLFooterTextA3 : PVLFooterText }, { children: "WWW.MOVALIB.COM" })), (0, jsx_runtime_1.jsx)("img", { src: leafs_large_png_1.default, style: PLVFooterLogo })] }))] })) })));
|
|
137
|
+
};
|
|
138
|
+
return PLVComponent;
|
|
139
|
+
}(react_1.default.Component));
|
|
140
|
+
exports.PLVComponent = PLVComponent;
|
|
141
|
+
// CSS pour cacher le contenu à l'écran mais le rendre imprimable
|
|
142
|
+
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";
|
|
143
|
+
var styleSheet = document.createElement('style');
|
|
144
|
+
styleSheet.innerText = css;
|
|
145
|
+
document.head.appendChild(styleSheet);
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.QrCodePLVContainer = void 0;
|
|
18
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
19
|
+
var icons_material_1 = require("@mui/icons-material");
|
|
20
|
+
var material_1 = require("@mui/material");
|
|
21
|
+
require("./QRCode.css");
|
|
22
|
+
var html2canvas_1 = __importDefault(require("html2canvas"));
|
|
23
|
+
var qr_code_styling_1 = __importDefault(require("qr-code-styling"));
|
|
24
|
+
var react_1 = require("react");
|
|
25
|
+
var react_to_print_1 = require("react-to-print");
|
|
26
|
+
var DownloadedQRCode_1 = require("../../DownloadedQRCode");
|
|
27
|
+
var leaf_yellow_small_png_1 = __importDefault(require("../../assets/images/leaf_yellow_small.png"));
|
|
28
|
+
var Tools_1 = require("../../helpers/Tools");
|
|
29
|
+
var PLVComponent_1 = require("./PLVComponent");
|
|
30
|
+
var QrCodePLVContainer = function (_a) {
|
|
31
|
+
var data = _a.data;
|
|
32
|
+
var _b = (0, react_1.useState)(null), selectedChoice = _b[0], setSelectedChoice = _b[1];
|
|
33
|
+
var qrCodeRef = (0, react_1.useRef)(null);
|
|
34
|
+
var PLVrefA4 = (0, react_1.useRef)(null);
|
|
35
|
+
var PLVrefA3 = (0, react_1.useRef)(null);
|
|
36
|
+
var theme = (0, material_1.useTheme)();
|
|
37
|
+
var qrCodeOptions = (0, react_1.useMemo)(function () { return ({
|
|
38
|
+
width: 300,
|
|
39
|
+
height: 300,
|
|
40
|
+
type: 'canvas',
|
|
41
|
+
data: data,
|
|
42
|
+
image: leaf_yellow_small_png_1.default,
|
|
43
|
+
margin: 10,
|
|
44
|
+
qrOptions: {
|
|
45
|
+
typeNumber: 0,
|
|
46
|
+
mode: 'Byte',
|
|
47
|
+
errorCorrectionLevel: 'Q',
|
|
48
|
+
},
|
|
49
|
+
imageOptions: {
|
|
50
|
+
hideBackgroundDots: true,
|
|
51
|
+
imageSize: 0.4,
|
|
52
|
+
margin: 15,
|
|
53
|
+
},
|
|
54
|
+
dotsOptions: {
|
|
55
|
+
color: (0, material_1.darken)(theme.palette.primary.main, 0.4),
|
|
56
|
+
type: 'square',
|
|
57
|
+
},
|
|
58
|
+
backgroundOptions: {
|
|
59
|
+
color: 'white',
|
|
60
|
+
},
|
|
61
|
+
cornersSquareOptions: {
|
|
62
|
+
color: (0, material_1.darken)(theme.palette.secondary.main, 0.2),
|
|
63
|
+
type: 'square',
|
|
64
|
+
},
|
|
65
|
+
cornersDotOptions: {
|
|
66
|
+
color: (0, material_1.darken)(theme.palette.secondary.main, 0.2),
|
|
67
|
+
type: 'square',
|
|
68
|
+
},
|
|
69
|
+
}); }, [data, theme.palette]);
|
|
70
|
+
var qrCode = (0, react_1.useMemo)(function () { return new qr_code_styling_1.default(qrCodeOptions); }, [qrCodeOptions]);
|
|
71
|
+
(0, react_1.useEffect)(function () {
|
|
72
|
+
if (qrCodeRef.current) {
|
|
73
|
+
qrCode.append(qrCodeRef.current);
|
|
74
|
+
}
|
|
75
|
+
}, [qrCode]);
|
|
76
|
+
var printA4PLV = (0, react_to_print_1.useReactToPrint)({
|
|
77
|
+
content: function () { return PLVrefA4.current; },
|
|
78
|
+
documentTitle: 'Movalib_PLV_A4',
|
|
79
|
+
});
|
|
80
|
+
var printA3PLV = (0, react_to_print_1.useReactToPrint)({
|
|
81
|
+
content: function () { return PLVrefA3.current; },
|
|
82
|
+
documentTitle: 'Movalib_PLV_A3',
|
|
83
|
+
});
|
|
84
|
+
var downloadQRCodeHeadless = (0, react_1.useCallback)(function () {
|
|
85
|
+
qrCode.download({
|
|
86
|
+
extension: 'png',
|
|
87
|
+
name: 'movalib-qr-code',
|
|
88
|
+
});
|
|
89
|
+
}, [qrCode.download]);
|
|
90
|
+
var downloadQrCodeWithCTA = (0, react_1.useCallback)(function () {
|
|
91
|
+
// Check if we have everything we need
|
|
92
|
+
var qrCodeContainer = document.querySelector('#qr-code-container');
|
|
93
|
+
var qrCodeDiv = qrCodeContainer === null || qrCodeContainer === void 0 ? void 0 : qrCodeContainer.querySelector('.qr-code');
|
|
94
|
+
var qrCodeCanva = qrCodeDiv === null || qrCodeDiv === void 0 ? void 0 : qrCodeDiv.querySelector('canvas');
|
|
95
|
+
var downloadedDiv = document.getElementById('qr-code-downloaded-container');
|
|
96
|
+
// If we don't have the QR Code, we can't download it
|
|
97
|
+
if (!(qrCodeContainer && qrCodeDiv && qrCodeCanva && downloadedDiv)) {
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
var tmpRendered = downloadedDiv.cloneNode(true);
|
|
101
|
+
tmpRendered.style.display = 'flex';
|
|
102
|
+
var downloadedQrCodeImgContainer = tmpRendered.querySelector('#qr-code-img-container');
|
|
103
|
+
downloadedQrCodeImgContainer.append(qrCodeCanva);
|
|
104
|
+
// add it to the document to be able to download it
|
|
105
|
+
document.body.append(tmpRendered);
|
|
106
|
+
// create the canva of the tmpRendered div and download it
|
|
107
|
+
(0, html2canvas_1.default)(tmpRendered).then(function (canvas) {
|
|
108
|
+
var a = document.createElement('a');
|
|
109
|
+
a.download = 'movalib-qr-code.png';
|
|
110
|
+
a.href = canvas.toDataURL('image/png');
|
|
111
|
+
a.click();
|
|
112
|
+
});
|
|
113
|
+
// remove the tmpRendered div
|
|
114
|
+
tmpRendered.remove();
|
|
115
|
+
// re-append the QR Code to the initial container
|
|
116
|
+
qrCode.append(qrCodeRef.current);
|
|
117
|
+
}, [qrCode.append]);
|
|
118
|
+
var onChangeSelectedChoice = function (e) {
|
|
119
|
+
setSelectedChoice(e.target.value);
|
|
120
|
+
};
|
|
121
|
+
var onClickDownload = (0, react_1.useMemo)(function () {
|
|
122
|
+
switch (selectedChoice) {
|
|
123
|
+
case 'A3':
|
|
124
|
+
return printA3PLV;
|
|
125
|
+
case 'A4':
|
|
126
|
+
return printA4PLV;
|
|
127
|
+
case 'QR_Headless':
|
|
128
|
+
return downloadQRCodeHeadless;
|
|
129
|
+
case 'QR_Google':
|
|
130
|
+
return downloadQrCodeWithCTA;
|
|
131
|
+
default:
|
|
132
|
+
return function () { };
|
|
133
|
+
}
|
|
134
|
+
}, [selectedChoice, printA3PLV, printA4PLV, downloadQRCodeHeadless, downloadQrCodeWithCTA]);
|
|
135
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Box, __assign({ display: 'flex', flexDirection: 'column', alignItems: 'center', gap: '24px' }, { children: [(0, jsx_runtime_1.jsx)(PLVComponent_1.PLVComponent, { ref: PLVrefA4, url: data, printSize: PLVComponent_1.PrintSize.A4 }), (0, jsx_runtime_1.jsx)(PLVComponent_1.PLVComponent, { ref: PLVrefA3, url: data, printSize: PLVComponent_1.PrintSize.A3 }), (0, jsx_runtime_1.jsxs)(material_1.Grid, __assign({ container: true, alignItems: 'center' }, { children: [(0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 7 }, { children: (0, jsx_runtime_1.jsxs)(material_1.FormControl, __assign({ fullWidth: true, size: 'small' }, { children: [(0, jsx_runtime_1.jsx)(material_1.InputLabel, __assign({ id: 'qrcode-plv-select' }, { children: "Choisissez votre support" })), (0, jsx_runtime_1.jsxs)(material_1.Select, __assign({ labelId: 'qrcode-plv-select', label: 'Choisissez votre support', id: 'qrcode-plv-select', onChange: onChangeSelectedChoice, value: selectedChoice }, { children: [(0, jsx_runtime_1.jsx)(material_1.MenuItem, __assign({ value: 'A3' }, { children: "\uD83E\uDDFE\u00A0\u00A0PLV format A4" })), (0, jsx_runtime_1.jsx)(material_1.MenuItem, __assign({ value: 'A4' }, { children: "\uD83E\uDDFE\u00A0\u00A0PLV format A3" })), (0, jsx_runtime_1.jsx)(material_1.MenuItem, __assign({ value: 'QR_Google' }, { children: "QR Code format GoogleMyBusiness" })), (0, jsx_runtime_1.jsx)(material_1.MenuItem, __assign({ value: 'QR_Headless' }, { children: "QR Code seul" }))] }))] })) })), (0, jsx_runtime_1.jsx)(material_1.Grid, { item: true, xs: 1 }), (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 4 }, { children: (0, jsx_runtime_1.jsx)(material_1.Button, __assign({ startIcon: selectedChoice === 'A3' || selectedChoice === 'A4' ? (0, jsx_runtime_1.jsx)(icons_material_1.DocumentScanner, {}) : (0, jsx_runtime_1.jsx)(icons_material_1.QrCode2, {}), onClick: onClickDownload, variant: 'outlined', disabled: !selectedChoice, sx: { color: (0, material_1.darken)(theme.palette.primary.main, 0.2), borderRadius: '10rem' } }, { children: selectedChoice === 'A3' || selectedChoice === 'A4' ? 'Imprimer' : 'Télécharger' })) }))] })), (0, jsx_runtime_1.jsx)("div", __assign({ id: 'qr-code-container', style: Tools_1.flexCenter }, { children: (0, jsx_runtime_1.jsx)("div", { ref: qrCodeRef, style: {
|
|
136
|
+
height: '300px',
|
|
137
|
+
width: '300px',
|
|
138
|
+
maxWidth: '300px !important',
|
|
139
|
+
}, className: 'qr-code' }) })), (0, jsx_runtime_1.jsx)(DownloadedQRCode_1.DownloadedQRCode, {})] })));
|
|
140
|
+
};
|
|
141
|
+
exports.QrCodePLVContainer = QrCodePLVContainer;
|