@movalib/movalib-commons 1.59.1 → 1.59.3
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 +1 -1
- package/dist/index.js +2 -1
- package/dist/src/MovaSignUp.js +1 -1
- package/dist/src/components/QrCodePLVContainer/QrCodePLVContainer.d.ts +1 -0
- package/dist/src/components/QrCodePLVContainer/QrCodePLVContainer.js +15 -15
- package/dist/src/helpers/Enums.d.ts +4 -0
- package/dist/src/helpers/Enums.js +6 -1
- package/dist/src/models/Customer.d.ts +18 -1
- package/dist/src/models/Customer.js +5 -1
- package/index.ts +1 -0
- package/package.json +1 -1
- package/src/MovaSignUp.tsx +1 -1
- package/src/components/QrCodePLVContainer/QrCodePLVContainer.tsx +16 -15
- package/src/helpers/Enums.ts +4 -0
- package/src/models/Customer.ts +29 -1
package/dist/index.d.ts
CHANGED
|
@@ -51,5 +51,5 @@ export { validateField, formatVehicleTire, formatFrenchVehiclePlate, isEmpty, ge
|
|
|
51
51
|
export { validatePhoneNumber, validateText, validateEmail } from './src/helpers/Validator';
|
|
52
52
|
export { formatDateByCountryCode, getLongFormattedDateTime } from './src/helpers/DateUtils';
|
|
53
53
|
export { request, API_BASE_URL } from './src/helpers/ApiHelper';
|
|
54
|
-
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';
|
|
54
|
+
export { CustomerType, 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';
|
|
55
55
|
export { openDialogPrint } from './src/utils/DialogPrint';
|
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
};
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.formatVehicleTire = exports.validateField = exports.deleteCookie = exports.readCookie = exports.CategoryPrestation = 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.openDialogPrint = 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 = exports.formatFrenchVehiclePlate = void 0;
|
|
8
|
+
exports.openDialogPrint = 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.CustomerType = 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 = exports.formatFrenchVehiclePlate = 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; } });
|
|
@@ -131,6 +131,7 @@ Object.defineProperty(exports, "request", { enumerable: true, get: function () {
|
|
|
131
131
|
Object.defineProperty(exports, "API_BASE_URL", { enumerable: true, get: function () { return ApiHelper_1.API_BASE_URL; } });
|
|
132
132
|
// Export des enums
|
|
133
133
|
var Enums_1 = require("./src/helpers/Enums");
|
|
134
|
+
Object.defineProperty(exports, "CustomerType", { enumerable: true, get: function () { return Enums_1.CustomerType; } });
|
|
134
135
|
Object.defineProperty(exports, "RoleType", { enumerable: true, get: function () { return Enums_1.RoleType; } });
|
|
135
136
|
Object.defineProperty(exports, "MovaAppType", { enumerable: true, get: function () { return Enums_1.MovaAppType; } });
|
|
136
137
|
Object.defineProperty(exports, "DayOfWeek", { enumerable: true, get: function () { return Enums_1.DayOfWeek; } });
|
package/dist/src/MovaSignUp.js
CHANGED
|
@@ -231,7 +231,7 @@ var MovaSignUp = function (_a) {
|
|
|
231
231
|
}
|
|
232
232
|
} }), usePhoneNumber && (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.TextField, { type: "tel", margin: "normal", required: true, fullWidth: true, id: "phoneNumber", label: "N\u00B0 de t\u00E9l\u00E9phone", name: "phoneNumber", autoComplete: "tel", onChange: function (e) { return handleInputChange(e); }, value: userForm.phoneNumber.value, error: Boolean(userForm.phoneNumber.error), helperText: userForm.phoneNumber.error, InputProps: {
|
|
233
233
|
endAdornment: ((0, jsx_runtime_1.jsx)(InputAdornment_1.default, __assign({ position: "end" }, { children: (0, jsx_runtime_1.jsx)(material_1.IconButton, __assign({ edge: "end", onClick: function () { return setOpenPhoneNumberInfo(!openPhoneNumberInfo); } }, { children: (0, jsx_runtime_1.jsx)(Info_1.default, {}) })) }))),
|
|
234
|
-
} }), openPhoneNumberInfo && (0, jsx_runtime_1.jsx)(material_1.Alert, __assign({ severity: "info", variant: 'standard' }, { children: "
|
|
234
|
+
} }), openPhoneNumberInfo && (0, jsx_runtime_1.jsx)(material_1.Alert, __assign({ severity: "info", variant: 'standard' }, { children: "Entrez le num\u00E9ro de t\u00E9l\u00E9phone que vous avez utilis\u00E9 pour r\u00E9server, afin de suivre facilement vos rendez-vous." }))] }), (0, jsx_runtime_1.jsx)(material_1.TextField, { margin: "normal", required: true, fullWidth: true, id: "email", label: "Adresse email", name: "email", autoComplete: "email", onChange: function (e) { return handleInputChange(e); }, value: userForm.email.value, error: !userForm.email.isValid, helperText: userForm.email.error, sx: {
|
|
235
235
|
'& .MuiOutlinedInput-notchedOutline': {
|
|
236
236
|
borderColor: darkMode ? 'white' : 'default', // Couleur de la bordure
|
|
237
237
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import '../../style/QRCode.css';
|
|
2
|
+
export declare const getPdfDocument: (url: string) => import("pdfjs-dist/types/src/display/api").PDFDocumentLoadingTask;
|
|
2
3
|
export declare const QrCodePLVContainer: ({ data }: {
|
|
3
4
|
data: string;
|
|
4
5
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -73,7 +73,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
73
73
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
74
74
|
};
|
|
75
75
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
76
|
-
exports.QrCodePLVContainer = void 0;
|
|
76
|
+
exports.QrCodePLVContainer = exports.getPdfDocument = void 0;
|
|
77
77
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
78
78
|
var icons_material_1 = require("@mui/icons-material");
|
|
79
79
|
var material_1 = require("@mui/material");
|
|
@@ -88,7 +88,11 @@ var Tools_1 = require("../../helpers/Tools");
|
|
|
88
88
|
var pdf_lib_1 = require("pdf-lib");
|
|
89
89
|
var PLVComponent_1 = require("./PLVComponent");
|
|
90
90
|
var pdfjsLib = __importStar(require("pdfjs-dist"));
|
|
91
|
-
pdfjsLib.GlobalWorkerOptions.workerSrc = '/pdf.worker.mjs';
|
|
91
|
+
pdfjsLib.GlobalWorkerOptions.workerSrc = '/pdf.worker.min.mjs';
|
|
92
|
+
var getPdfDocument = function (url) {
|
|
93
|
+
return pdfjsLib.getDocument(url);
|
|
94
|
+
};
|
|
95
|
+
exports.getPdfDocument = getPdfDocument;
|
|
92
96
|
var QrCodePLVContainer = function (_a) {
|
|
93
97
|
var data = _a.data;
|
|
94
98
|
var _b = (0, react_1.useState)(null), selectedChoice = _b[0], setSelectedChoice = _b[1];
|
|
@@ -144,24 +148,14 @@ var QrCodePLVContainer = function (_a) {
|
|
|
144
148
|
var urlA4 = printPLV('A4').then(function (url) {
|
|
145
149
|
setUrlA4(url);
|
|
146
150
|
});
|
|
147
|
-
var urlA3 = printPLV('A3').then(function (url) {
|
|
148
|
-
setUrlA3(url);
|
|
149
|
-
});
|
|
150
151
|
}, [data]);
|
|
151
|
-
(0, react_1.useEffect)(function () {
|
|
152
|
-
if (PLVrefA4.current || PLVrefA3.current) {
|
|
153
|
-
setIsReady(true);
|
|
154
|
-
}
|
|
155
|
-
else {
|
|
156
|
-
setIsReady(false);
|
|
157
|
-
}
|
|
158
|
-
}, [PLVrefA4.current, PLVrefA3.current]);
|
|
159
152
|
function printPLV(format) {
|
|
160
153
|
return __awaiter(this, void 0, void 0, function () {
|
|
161
154
|
var pdfUrl, response, existingPdfBytes, pdfDoc, qrCodeBlob, qrImageBytes, qrImage, pages, firstPage, _a, width, height, optionQrcode, modifiedPdfBytes, blob, url, loadingTask, pdf, page, canvas, context, viewport, renderContext, imageUrl;
|
|
162
155
|
return __generator(this, function (_b) {
|
|
163
156
|
switch (_b.label) {
|
|
164
157
|
case 0:
|
|
158
|
+
setIsReady(false);
|
|
165
159
|
pdfUrl = "/Movalib_".concat(format, ".pdf");
|
|
166
160
|
return [4 /*yield*/, fetch(pdfUrl)];
|
|
167
161
|
case 1:
|
|
@@ -208,7 +202,7 @@ var QrCodePLVContainer = function (_a) {
|
|
|
208
202
|
modifiedPdfBytes = _b.sent();
|
|
209
203
|
blob = new Blob([modifiedPdfBytes], { type: 'application/pdf' });
|
|
210
204
|
url = URL.createObjectURL(blob);
|
|
211
|
-
loadingTask =
|
|
205
|
+
loadingTask = (0, exports.getPdfDocument)(url);
|
|
212
206
|
return [4 /*yield*/, loadingTask.promise];
|
|
213
207
|
case 8:
|
|
214
208
|
pdf = _b.sent();
|
|
@@ -217,7 +211,7 @@ var QrCodePLVContainer = function (_a) {
|
|
|
217
211
|
page = _b.sent();
|
|
218
212
|
canvas = document.createElement('canvas');
|
|
219
213
|
context = canvas.getContext('2d');
|
|
220
|
-
viewport = page.getViewport({ scale:
|
|
214
|
+
viewport = page.getViewport({ scale: 3 });
|
|
221
215
|
canvas.width = viewport.width;
|
|
222
216
|
canvas.height = viewport.height;
|
|
223
217
|
renderContext = {
|
|
@@ -228,6 +222,7 @@ var QrCodePLVContainer = function (_a) {
|
|
|
228
222
|
case 10:
|
|
229
223
|
_b.sent();
|
|
230
224
|
imageUrl = canvas.toDataURL('image/png');
|
|
225
|
+
setIsReady(true);
|
|
231
226
|
return [2 /*return*/, imageUrl];
|
|
232
227
|
}
|
|
233
228
|
});
|
|
@@ -268,6 +263,11 @@ var QrCodePLVContainer = function (_a) {
|
|
|
268
263
|
qrCode.append(qrCodeRef.current);
|
|
269
264
|
}, [qrCode.append]);
|
|
270
265
|
var onChangeSelectedChoice = function (e) {
|
|
266
|
+
if (e.target.value === 'A3' && !urlA3) {
|
|
267
|
+
printPLV('A3').then(function (url) {
|
|
268
|
+
setUrlA3(url);
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
271
|
setSelectedChoice(e.target.value);
|
|
272
272
|
};
|
|
273
273
|
var printA3PLV = (0, react_to_print_1.useReactToPrint)({
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RoleType = exports.MovaAppType = exports.DocumentType = exports.DocumentState = exports.DayOfWeek = exports.EventType = exports.EventState = exports.DigitalPassportIndex = exports.Gender = exports.DateFormatTypes = exports.APIMethod = exports.PartsApplicationType = exports.ProductType = exports.OrderPreference = exports.OrderState = exports.SlotAlgorithm = exports.VehiclePlateFormat = exports.RegistrationState = exports.SubscriptionPaymentInterval = exports.PrestationType = exports.PrestationState = exports.CountryCode = exports.SubscriptionState = exports.SubscriptionType = void 0;
|
|
3
|
+
exports.RoleType = exports.MovaAppType = exports.DocumentType = exports.DocumentState = exports.DayOfWeek = exports.EventType = exports.EventState = exports.DigitalPassportIndex = exports.Gender = exports.DateFormatTypes = exports.APIMethod = exports.PartsApplicationType = exports.ProductType = exports.OrderPreference = exports.OrderState = exports.SlotAlgorithm = exports.VehiclePlateFormat = exports.RegistrationState = exports.SubscriptionPaymentInterval = exports.PrestationType = exports.PrestationState = exports.CountryCode = exports.SubscriptionState = exports.SubscriptionType = exports.CustomerType = void 0;
|
|
4
|
+
var CustomerType;
|
|
5
|
+
(function (CustomerType) {
|
|
6
|
+
CustomerType["INDIVIDUAL"] = "INDIVIDUAL";
|
|
7
|
+
CustomerType["PROFESSIONAL"] = "PROFESSIONAL";
|
|
8
|
+
})(CustomerType = exports.CustomerType || (exports.CustomerType = {}));
|
|
4
9
|
var SubscriptionType;
|
|
5
10
|
(function (SubscriptionType) {
|
|
6
11
|
SubscriptionType["PRO_FREE"] = "PRO_FREE";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { CustomerType } from "../helpers/Enums";
|
|
1
2
|
import Address from "./Address";
|
|
2
3
|
import Role from "./Role";
|
|
3
4
|
import User from "./User";
|
|
@@ -8,8 +9,24 @@ export default class Customer extends User {
|
|
|
8
9
|
key: string;
|
|
9
10
|
value: number;
|
|
10
11
|
}[];
|
|
12
|
+
/**
|
|
13
|
+
* Type de client (professionnel / particulier)
|
|
14
|
+
*/
|
|
15
|
+
type: CustomerType;
|
|
16
|
+
/**
|
|
17
|
+
* Raison sociale si client Professionnel
|
|
18
|
+
*/
|
|
19
|
+
companyName: string;
|
|
20
|
+
/**
|
|
21
|
+
* Téléphone de contact additionnel (souvent un fixe pour les pro)
|
|
22
|
+
*/
|
|
23
|
+
companyPhoneNumber: string;
|
|
24
|
+
/**
|
|
25
|
+
* Notes relatives au client
|
|
26
|
+
*/
|
|
27
|
+
notes: string;
|
|
11
28
|
constructor(id: string, roles: Role[] | undefined, firstname: string | undefined, lastname: string | undefined, avatar: string | undefined, addresses: Address[] | undefined, vehicles: Vehicle[], email: string | undefined, turnover: {
|
|
12
29
|
key: string;
|
|
13
30
|
value: number;
|
|
14
|
-
}[]);
|
|
31
|
+
}[], type: CustomerType, companyName: string, companyPhoneNumber: string, notes: string);
|
|
15
32
|
}
|
|
@@ -21,7 +21,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
21
21
|
var User_1 = __importDefault(require("./User"));
|
|
22
22
|
var Customer = /** @class */ (function (_super) {
|
|
23
23
|
__extends(Customer, _super);
|
|
24
|
-
function Customer(id, roles, firstname, lastname, avatar, addresses, vehicles, email, turnover) {
|
|
24
|
+
function Customer(id, roles, firstname, lastname, avatar, addresses, vehicles, email, turnover, type, companyName, companyPhoneNumber, notes) {
|
|
25
25
|
if (roles === void 0) { roles = []; }
|
|
26
26
|
if (firstname === void 0) { firstname = ''; }
|
|
27
27
|
if (lastname === void 0) { lastname = ''; }
|
|
@@ -31,6 +31,10 @@ var Customer = /** @class */ (function (_super) {
|
|
|
31
31
|
var _this = _super.call(this, id, roles, firstname, lastname, avatar, email) || this;
|
|
32
32
|
_this.vehicles = vehicles;
|
|
33
33
|
_this.turnover = turnover;
|
|
34
|
+
_this.type = type;
|
|
35
|
+
_this.companyName = companyName;
|
|
36
|
+
_this.companyPhoneNumber = companyPhoneNumber;
|
|
37
|
+
_this.notes = notes;
|
|
34
38
|
return _this;
|
|
35
39
|
}
|
|
36
40
|
return Customer;
|
package/index.ts
CHANGED
package/package.json
CHANGED
package/src/MovaSignUp.tsx
CHANGED
|
@@ -302,7 +302,7 @@ const MovaSignUp: FunctionComponent<MovaSignUpProps> = ({ loading, movaAppType,
|
|
|
302
302
|
),
|
|
303
303
|
}}
|
|
304
304
|
/>
|
|
305
|
-
{openPhoneNumberInfo && <Alert severity="info" variant='standard'>
|
|
305
|
+
{openPhoneNumberInfo && <Alert severity="info" variant='standard'>Entrez le numéro de téléphone que vous avez utilisé pour réserver, afin de suivre facilement vos rendez-vous.</Alert>}
|
|
306
306
|
</>
|
|
307
307
|
}
|
|
308
308
|
<TextField
|
|
@@ -24,8 +24,10 @@ import { flexCenter } from '../../helpers/Tools';
|
|
|
24
24
|
import { PDFDocument } from 'pdf-lib';
|
|
25
25
|
import { PLVComponentV2, PrintSize } from './PLVComponent';
|
|
26
26
|
import * as pdfjsLib from 'pdfjs-dist';
|
|
27
|
-
pdfjsLib.GlobalWorkerOptions.workerSrc = '/pdf.worker.mjs';
|
|
28
|
-
|
|
27
|
+
pdfjsLib.GlobalWorkerOptions.workerSrc = '/pdf.worker.min.mjs';
|
|
28
|
+
export const getPdfDocument = (url: string) => {
|
|
29
|
+
return pdfjsLib.getDocument(url);
|
|
30
|
+
};
|
|
29
31
|
type SelectChoice = null | 'A3' | 'A4' | 'QR_Headless' | 'QR_Google';
|
|
30
32
|
export const QrCodePLVContainer = ({ data }: { data: string }) => {
|
|
31
33
|
const [selectedChoice, setSelectedChoice] = useState<SelectChoice>(null);
|
|
@@ -88,20 +90,13 @@ export const QrCodePLVContainer = ({ data }: { data: string }) => {
|
|
|
88
90
|
const urlA4 = printPLV('A4').then((url) => {
|
|
89
91
|
setUrlA4(url);
|
|
90
92
|
});
|
|
91
|
-
const urlA3 = printPLV('A3').then((url) => {
|
|
92
|
-
setUrlA3(url);
|
|
93
|
-
});
|
|
94
93
|
}, [data]);
|
|
95
94
|
|
|
96
|
-
|
|
97
|
-
if (PLVrefA4.current || PLVrefA3.current) {
|
|
98
|
-
setIsReady(true);
|
|
99
|
-
} else {
|
|
100
|
-
setIsReady(false);
|
|
101
|
-
}
|
|
102
|
-
}, [PLVrefA4.current, PLVrefA3.current]);
|
|
95
|
+
|
|
103
96
|
|
|
104
97
|
async function printPLV(format: string) {
|
|
98
|
+
setIsReady(false);
|
|
99
|
+
|
|
105
100
|
// Chemin du fichier PDF
|
|
106
101
|
const pdfUrl = `/Movalib_${format}.pdf`;
|
|
107
102
|
// Récupérer le fichier PDF depuis le serveur
|
|
@@ -156,7 +151,7 @@ export const QrCodePLVContainer = ({ data }: { data: string }) => {
|
|
|
156
151
|
|
|
157
152
|
|
|
158
153
|
// Convertir le PDF en image
|
|
159
|
-
const loadingTask =
|
|
154
|
+
const loadingTask = getPdfDocument(url);
|
|
160
155
|
const pdf = await loadingTask.promise;
|
|
161
156
|
|
|
162
157
|
// Récupérer la première page
|
|
@@ -166,7 +161,7 @@ export const QrCodePLVContainer = ({ data }: { data: string }) => {
|
|
|
166
161
|
const canvas = document.createElement('canvas');
|
|
167
162
|
const context = canvas.getContext('2d');
|
|
168
163
|
|
|
169
|
-
const viewport = page.getViewport({ scale:
|
|
164
|
+
const viewport = page.getViewport({ scale: 3});
|
|
170
165
|
canvas.width = viewport.width;
|
|
171
166
|
canvas.height = viewport.height;
|
|
172
167
|
|
|
@@ -179,6 +174,7 @@ export const QrCodePLVContainer = ({ data }: { data: string }) => {
|
|
|
179
174
|
|
|
180
175
|
// Convertir le canvas en URL d'image (data URL)
|
|
181
176
|
const imageUrl = canvas.toDataURL('image/png');
|
|
177
|
+
setIsReady(true);
|
|
182
178
|
return imageUrl;
|
|
183
179
|
}
|
|
184
180
|
|
|
@@ -226,6 +222,11 @@ export const QrCodePLVContainer = ({ data }: { data: string }) => {
|
|
|
226
222
|
}, [qrCode.append]);
|
|
227
223
|
|
|
228
224
|
const onChangeSelectedChoice: SelectProps<SelectChoice>['onChange'] = (e) => {
|
|
225
|
+
if(e.target.value === 'A3' && !urlA3){
|
|
226
|
+
printPLV('A3').then((url) => {
|
|
227
|
+
setUrlA3(url);
|
|
228
|
+
});
|
|
229
|
+
}
|
|
229
230
|
setSelectedChoice(e.target.value as SelectChoice);
|
|
230
231
|
};
|
|
231
232
|
|
|
@@ -256,7 +257,7 @@ export const QrCodePLVContainer = ({ data }: { data: string }) => {
|
|
|
256
257
|
return (
|
|
257
258
|
<Box display='flex' flexDirection='column' alignItems='center' gap='24px'>
|
|
258
259
|
{urlA4 && <PLVComponentV2 ref={PLVrefA4} url={urlA4} printSize={PrintSize.A4} />}
|
|
259
|
-
{urlA3
|
|
260
|
+
{urlA3 && <PLVComponentV2 ref={PLVrefA3} url={urlA3} printSize={PrintSize.A3} />}
|
|
260
261
|
|
|
261
262
|
<Grid container justifyContent='center' alignItems='center'>
|
|
262
263
|
<Grid item xs={7}>
|
package/src/helpers/Enums.ts
CHANGED
package/src/models/Customer.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { CustomerType } from "../helpers/Enums";
|
|
1
2
|
import Address from "./Address";
|
|
2
3
|
import Role from "./Role";
|
|
3
4
|
import User from "./User";
|
|
@@ -9,6 +10,25 @@ export default class Customer extends User {
|
|
|
9
10
|
// Properties
|
|
10
11
|
vehicles: Vehicle[];
|
|
11
12
|
turnover: { key: string, value: number }[];
|
|
13
|
+
/**
|
|
14
|
+
* Type de client (professionnel / particulier)
|
|
15
|
+
*/
|
|
16
|
+
type: CustomerType;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Raison sociale si client Professionnel
|
|
20
|
+
*/
|
|
21
|
+
companyName: string;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Téléphone de contact additionnel (souvent un fixe pour les pro)
|
|
25
|
+
*/
|
|
26
|
+
companyPhoneNumber: string;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Notes relatives au client
|
|
30
|
+
*/
|
|
31
|
+
notes: string;
|
|
12
32
|
|
|
13
33
|
constructor(
|
|
14
34
|
id: string,
|
|
@@ -19,11 +39,19 @@ export default class Customer extends User {
|
|
|
19
39
|
addresses : Address[] = [],
|
|
20
40
|
vehicles: Vehicle[],
|
|
21
41
|
email: string = '',
|
|
22
|
-
turnover: { key: string, value: number }[]
|
|
42
|
+
turnover: { key: string, value: number }[],
|
|
43
|
+
type: CustomerType,
|
|
44
|
+
companyName: string,
|
|
45
|
+
companyPhoneNumber: string,
|
|
46
|
+
notes: string) {
|
|
23
47
|
|
|
24
48
|
super(id, roles, firstname, lastname, avatar, email);
|
|
25
49
|
|
|
26
50
|
this.vehicles = vehicles;
|
|
27
51
|
this.turnover = turnover;
|
|
52
|
+
this.type = type;
|
|
53
|
+
this.companyName = companyName;
|
|
54
|
+
this.companyPhoneNumber = companyPhoneNumber;
|
|
55
|
+
this.notes = notes;
|
|
28
56
|
}
|
|
29
57
|
}
|