@movalib/movalib-commons 1.1.20 → 1.1.22

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/PV_README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # 1. build this movalib commons lib
2
2
 
3
- ### `npm build`
3
+ ### `npm run build`
4
4
 
5
5
  # 2. publish this movalib commons lib (public)
6
6
 
package/devIndex.tsx CHANGED
@@ -71,7 +71,7 @@ const App = () => {
71
71
 
72
72
  const getQRCodeData = ():string => {
73
73
  // On renvoie les données pour le QR Code, l'url change selon l'environnement (variables d'environnement)
74
- return `https://localhost:3001/#/garage/1?redirect=garage`;
74
+ return `https://app.movalib.com/#/garage/2?redirect=garage`;
75
75
  }
76
76
 
77
77
  const handleScheduleChange = (schedule: DaySchedule[]) => {
@@ -133,7 +133,7 @@ const App = () => {
133
133
 
134
134
  <GaragePLV url={getQRCodeData()} />
135
135
 
136
- <QRCode data={getQRCodeData()} showDownload={true} />
136
+ <QRCode data={getQRCodeData()} showDownload={true} size={400} />
137
137
 
138
138
  <div style={{ marginTop: '40px' }} />
139
139
 
package/dist/devIndex.js CHANGED
@@ -97,7 +97,7 @@ var App = function () {
97
97
  };
98
98
  var getQRCodeData = function () {
99
99
  // On renvoie les données pour le QR Code, l'url change selon l'environnement (variables d'environnement)
100
- return "https://localhost:3001/#/garage/1?redirect=garage";
100
+ return "https://app.movalib.com/#/garage/2?redirect=garage";
101
101
  };
102
102
  var handleScheduleChange = function (schedule) {
103
103
  if (schedule) {
@@ -128,7 +128,7 @@ var App = function () {
128
128
  throw new Error('Function not implemented.');
129
129
  } }), (0, jsx_runtime_1.jsx)(MovaSignUp_1.default, { darkMode: false, movaAppType: Enums_1.MovaAppType.INDIVIDUAL, onSubmit: function (form) {
130
130
  alert('Form Submitted !');
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
+ } }), (0, jsx_runtime_1.jsx)(GaragePLV_1.default, { url: getQRCodeData() }), (0, jsx_runtime_1.jsx)(QRCode_1.default, { data: getQRCodeData(), showDownload: true, size: 400 }), (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) {
132
132
  throw new Error('Function not implemented.');
133
133
  } })] })) })) }));
134
134
  };
@@ -1,6 +1,11 @@
1
1
  import { FC } from 'react';
2
+ export declare enum PrintSize {
3
+ A3 = 0,
4
+ A4 = 1
5
+ }
2
6
  interface GaragePLVProps {
3
7
  url: string;
8
+ printSize?: PrintSize;
4
9
  }
5
10
  declare const GaragePLV: FC<GaragePLVProps>;
6
11
  export default GaragePLV;
@@ -52,6 +52,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
52
52
  return (mod && mod.__esModule) ? mod : { "default": mod };
53
53
  };
54
54
  Object.defineProperty(exports, "__esModule", { value: true });
55
+ exports.PrintSize = void 0;
55
56
  var jsx_runtime_1 = require("react/jsx-runtime");
56
57
  var react_1 = __importStar(require("react"));
57
58
  var QRCode_1 = __importDefault(require("./QRCode"));
@@ -60,6 +61,11 @@ var material_1 = require("@mui/material");
60
61
  var Tools_1 = require("./helpers/Tools");
61
62
  var logo_large_png_1 = __importDefault(require("./assets/images/logo/logo_large.png"));
62
63
  var leafs_large_png_1 = __importDefault(require("./assets/images/leafs_large.png"));
64
+ var PrintSize;
65
+ (function (PrintSize) {
66
+ PrintSize[PrintSize["A3"] = 0] = "A3";
67
+ PrintSize[PrintSize["A4"] = 1] = "A4";
68
+ })(PrintSize = exports.PrintSize || (exports.PrintSize = {}));
63
69
  var PLVTitle = {
64
70
  display: 'flex',
65
71
  justifyContent: 'left',
@@ -67,7 +73,16 @@ var PLVTitle = {
67
73
  textTransform: 'uppercase',
68
74
  fontFamily: 'Montserrat, sans-serif',
69
75
  fontSize: '50px',
70
- lineHeight: 1,
76
+ lineHeight: 1.2,
77
+ };
78
+ var PLVTitleA3 = {
79
+ display: 'flex',
80
+ justifyContent: 'left',
81
+ alignItems: 'center',
82
+ textTransform: 'uppercase',
83
+ fontFamily: 'Montserrat, sans-serif',
84
+ fontSize: '75px',
85
+ lineHeight: 1.2,
71
86
  };
72
87
  var PLVHeaderLogo = {
73
88
  display: 'flex',
@@ -93,10 +108,20 @@ var PLVBaseLine = {
93
108
  display: 'flex',
94
109
  justifyContent: 'left',
95
110
  alignItems: 'center',
96
- fontFamily: 'Dancing Script',
111
+ fontFamily: 'Caveat',
112
+ fontWeight: 700,
97
113
  transform: 'rotate(-10deg)',
98
114
  fontSize: '30px',
99
115
  };
116
+ var PLVBaseLineA3 = {
117
+ display: 'flex',
118
+ justifyContent: 'left',
119
+ alignItems: 'center',
120
+ fontFamily: 'Caveat',
121
+ fontWeight: 700,
122
+ transform: 'rotate(-10deg)',
123
+ fontSize: '40px',
124
+ };
100
125
  var PVLFooterText = {
101
126
  fontFamily: 'Montserrat, sans-serif',
102
127
  textTransform: 'uppercase',
@@ -104,6 +129,13 @@ var PVLFooterText = {
104
129
  letterSpacing: 4,
105
130
  position: 'absolute'
106
131
  };
132
+ var PVLFooterTextA3 = {
133
+ fontFamily: 'Montserrat, sans-serif',
134
+ textTransform: 'uppercase',
135
+ fontSize: '20px',
136
+ letterSpacing: 4,
137
+ position: 'absolute'
138
+ };
107
139
  /**
108
140
  * PLV Garage au format A4
109
141
  */
@@ -113,19 +145,29 @@ var PLVComponent = /** @class */ (function (_super) {
113
145
  return _super !== null && _super.apply(this, arguments) || this;
114
146
  }
115
147
  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 })] }))] })) })));
148
+ return ((0, jsx_runtime_1.jsx)("div", __assign({ className: "printable-content", style: {
149
+ width: this.props.printSize === PrintSize.A4 ? '210mm' :
150
+ this.props.printSize === PrintSize.A3 ? '297mm' : '0mm',
151
+ height: this.props.printSize === PrintSize.A4 ? '297mm' :
152
+ this.props.printSize === PrintSize.A3 ? '420mm' : '0mm',
153
+ } }, { 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 } }, { 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: "Dans ce garage" })) })), (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: 7, sx: { pl: 8, 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 ? 350 : 500 }) })), (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: this.props.printSize === PrintSize.A3 ? PLVBaseLineA3 : PLVBaseLine }, { children: "En plus l'appli est gratuite !" })) })), (0, jsx_runtime_1.jsxs)(material_1.Grid, __assign({ item: true, xs: 12, sx: { mt: 3 }, 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 })] }))] })) })));
117
154
  };
118
155
  return PLVComponent;
119
156
  }(react_1.default.Component));
120
157
  var GaragePLV = function (_a) {
121
158
  var url = _a.url;
122
- var componentRef = (0, react_1.useRef)(null);
159
+ var PLVrefA4 = (0, react_1.useRef)(null);
160
+ var PLVrefA3 = (0, react_1.useRef)(null);
123
161
  var theme = (0, material_1.useTheme)();
124
- var handlePrint = (0, react_to_print_1.useReactToPrint)({
125
- content: function () { return componentRef.current; },
162
+ var handleA4Print = (0, react_to_print_1.useReactToPrint)({
163
+ content: function () { return PLVrefA4.current; },
126
164
  documentTitle: 'Movalib_PLV_A4',
127
165
  });
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)" }))] })));
166
+ var handleA3Print = (0, react_to_print_1.useReactToPrint)({
167
+ content: function () { return PLVrefA3.current; },
168
+ documentTitle: 'Movalib_PLV_A3',
169
+ });
170
+ 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)" }))] })));
129
171
  };
130
172
  exports.default = GaragePLV;
131
173
  // CSS pour cacher le contenu à l'écran mais le rendre imprimable
@@ -1,4 +1,8 @@
1
1
  .qr-code canvas {
2
- max-width: 300px !important;
2
+ /*max-width: 300px !important;*/
3
+ /* margin: 20px 0; */
4
+ display: flex;
5
+ align-items: center;
6
+ justify-content: center;
3
7
  width: 100%;
4
8
  }
@@ -1,6 +1,7 @@
1
1
  import { type FC } from 'react';
2
2
  import './QRCode.css';
3
3
  interface QRCodeProps {
4
+ size?: number;
4
5
  data?: string;
5
6
  showDownload?: boolean;
6
7
  }
@@ -20,24 +20,14 @@ var leaf_yellow_small_png_1 = __importDefault(require("./assets/images/leaf_yell
20
20
  var material_1 = require("@mui/material");
21
21
  var qr_code_styling_1 = __importDefault(require("qr-code-styling"));
22
22
  require("./QRCode.css");
23
- var styles = {
24
- inputWrapper: {
25
- margin: "20px 0",
26
- display: "flex",
27
- alignItems: 'center',
28
- justifyContent: "center",
29
- width: '300px',
30
- height: '300px'
31
- }
32
- };
33
23
  var QRCode = function (_a) {
34
- var data = _a.data, _b = _a.showDownload, showDownload = _b === void 0 ? false : _b;
24
+ var _b = _a.size, size = _b === void 0 ? 300 : _b, data = _a.data, _c = _a.showDownload, showDownload = _c === void 0 ? false : _c;
35
25
  var theme = (0, material_1.useTheme)();
36
26
  // Le contenu du QR Code est transmis en props, sinon redirection vers le site vitrine
37
27
  var defaultData = 'https://movalib.com';
38
- var _c = (0, react_1.useState)({
39
- width: 600,
40
- height: 600,
28
+ var _d = (0, react_1.useState)({
29
+ width: size * 2,
30
+ height: size * 2,
41
31
  type: 'canvas',
42
32
  data: data !== null && data !== void 0 ? data : defaultData,
43
33
  image: leaf_yellow_small_png_1.default,
@@ -90,9 +80,9 @@ var QRCode = function (_a) {
90
80
  // colorStops: [{ offset: 0, color: '#00266e' }, { offset: 1, color: '#4060b3' }]
91
81
  // },
92
82
  }
93
- }), options = _c[0], setOptions = _c[1];
83
+ }), options = _d[0], setOptions = _d[1];
94
84
  // Format de téléchargement par défaut
95
- var _d = (0, react_1.useState)("png"), fileExt = _d[0], setFileExt = _d[1];
85
+ var _e = (0, react_1.useState)("png"), fileExt = _e[0], setFileExt = _e[1];
96
86
  var qrCode = (0, react_1.useState)(new qr_code_styling_1.default(options))[0];
97
87
  var ref = (0, react_1.useRef)(null);
98
88
  (0, react_1.useEffect)(function () {
@@ -120,7 +110,7 @@ var QRCode = function (_a) {
120
110
  display: 'flex',
121
111
  flexDirection: 'column',
122
112
  alignItems: 'center'
123
- } }, { children: [(0, jsx_runtime_1.jsx)("div", { ref: ref, style: styles.inputWrapper, className: 'qr-code' }), showDownload &&
113
+ } }, { children: [(0, jsx_runtime_1.jsx)("div", { ref: ref, style: { height: "".concat(size, "px"), width: "".concat(size, "px"), maxWidth: "".concat(size, "px !important") }, className: 'qr-code' }), showDownload &&
124
114
  (0, jsx_runtime_1.jsx)(material_1.Box, __assign({ sx: { display: 'flex', justifyContent: 'center' } }, { children: (0, jsx_runtime_1.jsx)(material_1.Button, __assign({ variant: 'outlined', onClick: onDownloadClick, sx: { color: (0, material_1.darken)(theme.palette.primary.main, 0.2) } }, { children: "T\u00E9l\u00E9charger" })) }))] })));
125
115
  };
126
116
  exports.default = QRCode;
@@ -7,12 +7,14 @@ import Operation from "./Operation";
7
7
  import Product from "./Product";
8
8
  import Supplier from "./Supplier";
9
9
  import Document from "./Document";
10
+ import Address from "./Address";
10
11
  export default class Event {
11
12
  id: string;
12
13
  ownerId: number;
13
14
  type: EventType;
14
15
  title: string;
15
16
  garageName: string;
17
+ garageAddress: Address;
16
18
  garageId: number;
17
19
  start?: Date;
18
20
  end?: Date;
@@ -41,6 +43,6 @@ export default class Event {
41
43
  supplier?: Supplier;
42
44
  quoteAmount?: number;
43
45
  documents?: Document[];
44
- constructor(id: string, ownerId: number, type: EventType, title: string, garageName: string, garageId: number, state: EventState, start?: Date, end?: Date, prestations?: Prestation[], operations?: Operation[], products?: Product[], guestsId?: string[], vehicleId?: number, quoteId?: number, notes?: string);
46
+ constructor(id: string, ownerId: number, type: EventType, title: string, garageName: string, garageAddress: Address, garageId: number, state: EventState, start?: Date, end?: Date, prestations?: Prestation[], operations?: Operation[], products?: Product[], guestsId?: string[], vehicleId?: number, quoteId?: number, notes?: string);
45
47
  static getPrestationsList(event: Event): string[];
46
48
  }
@@ -1,13 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  var Event = /** @class */ (function () {
4
- function Event(id, ownerId, type, title, garageName, garageId, state, start, end, prestations, operations, products, guestsId, vehicleId, quoteId, notes) {
4
+ function Event(id, ownerId, type, title, garageName, garageAddress, garageId, state, start, end, prestations, operations, products, guestsId, vehicleId, quoteId, notes) {
5
5
  this.id = id;
6
6
  this.notes = notes;
7
7
  this.ownerId = ownerId;
8
8
  this.type = type;
9
9
  this.title = title;
10
10
  this.garageName = garageName;
11
+ this.garageAddress = garageAddress;
11
12
  this.garageId = garageId;
12
13
  this.state = state;
13
14
  this.start = start ? new Date(start) : undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@movalib/movalib-commons",
3
- "version": "1.1.20",
3
+ "version": "1.1.22",
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",
package/public/index.html CHANGED
@@ -4,6 +4,7 @@
4
4
  <title>Movalib Commons</title>
5
5
  <link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700&display=swap" rel="stylesheet">
6
6
  <link href="https://fonts.googleapis.com/css2?family=Dancing+Script:wght@700&display=swap" rel="stylesheet">
7
+ <link href="https://fonts.googleapis.com/css2?family=Caveat:wght@400;700&display=swap" rel="stylesheet">
7
8
 
8
9
  </head>
9
10
  <body>
package/src/GaragePLV.tsx CHANGED
@@ -7,8 +7,14 @@ import LogoLarge from './assets/images/logo/logo_large.png';
7
7
  import LeafsLarge from './assets/images/leafs_large.png';
8
8
  import theme from '../theme';
9
9
 
10
+ export enum PrintSize {
11
+ A3,
12
+ A4
13
+ }
14
+
10
15
  interface GaragePLVProps {
11
16
  url: string;
17
+ printSize?: PrintSize
12
18
  }
13
19
 
14
20
  const PLVTitle:CSSProperties = {
@@ -18,7 +24,17 @@ const PLVTitle:CSSProperties = {
18
24
  textTransform: 'uppercase',
19
25
  fontFamily: 'Montserrat, sans-serif',
20
26
  fontSize: '50px',
21
- lineHeight: 1,
27
+ lineHeight: 1.2,
28
+ }
29
+
30
+ const PLVTitleA3:CSSProperties = {
31
+ display: 'flex',
32
+ justifyContent: 'left',
33
+ alignItems: 'center',
34
+ textTransform: 'uppercase',
35
+ fontFamily: 'Montserrat, sans-serif',
36
+ fontSize: '75px',
37
+ lineHeight: 1.2,
22
38
  }
23
39
 
24
40
  const PLVHeaderLogo:CSSProperties = {
@@ -48,11 +64,22 @@ const PLVBaseLine:CSSProperties = {
48
64
  display: 'flex',
49
65
  justifyContent: 'left',
50
66
  alignItems: 'center',
51
- fontFamily: 'Dancing Script',
67
+ fontFamily: 'Caveat',
68
+ fontWeight: 700,
52
69
  transform: 'rotate(-10deg)',
53
70
  fontSize: '30px',
54
71
  }
55
72
 
73
+ const PLVBaseLineA3:CSSProperties = {
74
+ display: 'flex',
75
+ justifyContent: 'left',
76
+ alignItems: 'center',
77
+ fontFamily: 'Caveat',
78
+ fontWeight: 700,
79
+ transform: 'rotate(-10deg)',
80
+ fontSize: '40px',
81
+ }
82
+
56
83
  const PVLFooterText:CSSProperties = {
57
84
  fontFamily: 'Montserrat, sans-serif',
58
85
  textTransform: 'uppercase',
@@ -61,6 +88,14 @@ const PVLFooterText:CSSProperties = {
61
88
  position: 'absolute'
62
89
  }
63
90
 
91
+ const PVLFooterTextA3:CSSProperties = {
92
+ fontFamily: 'Montserrat, sans-serif',
93
+ textTransform: 'uppercase',
94
+ fontSize: '20px',
95
+ letterSpacing: 4,
96
+ position: 'absolute'
97
+ }
98
+
64
99
  /**
65
100
  * PLV Garage au format A4
66
101
  */
@@ -68,52 +103,56 @@ class PLVComponent extends React.Component<GaragePLVProps> {
68
103
 
69
104
  render() {
70
105
  return (
71
-
72
- <div className="printable-content" style={{ width: '210mm', height: '297mm' }}>
106
+
107
+ <div className="printable-content" style={{
108
+ width: this.props.printSize === PrintSize.A4 ? '210mm' :
109
+ this.props.printSize === PrintSize.A3 ? '297mm' : '0mm',
110
+ height: this.props.printSize === PrintSize.A4 ? '297mm' :
111
+ this.props.printSize === PrintSize.A3 ? '420mm' : '0mm', }}>
112
+
73
113
  <Grid container>
74
114
 
75
- <Grid item xs={12} style={PLVHeaderLogo} sx={{ m: 2, mt: 4}}>
115
+ <Grid item xs={12} style={PLVHeaderLogo} sx={{ m: 2, mt: 6}}>
76
116
  <img src={LogoLarge} style={PLVHeaderLogo}/>
77
117
  </Grid>
78
118
 
79
119
  <Grid item xs={12} sx={{ ml: 6, mt: 4 }}>
80
- <Typography style={PLVTitle} >
120
+ <Typography style={this.props.printSize === PrintSize.A3 ? PLVTitleA3 : PLVTitle} >
81
121
  <span className='highlight'>Dans ce garage</span>
82
122
  </Typography>
83
- <Typography style={PLVTitle}>
123
+ <Typography style={this.props.printSize === PrintSize.A3 ? PLVTitleA3 : PLVTitle}>
84
124
  <span className='highlight'> prenez rendez-vous </span>
85
125
  </Typography>
86
- <Typography style={PLVTitle}>
126
+ <Typography style={this.props.printSize === PrintSize.A3 ? PLVTitleA3 : PLVTitle}>
87
127
  <span className='highlight'> en un clic. </span>
88
128
  </Typography>
89
129
  </Grid>
90
130
 
91
131
  <Grid item xs={12} sx={{ ml: 6, mt: 4 }}>
92
- <Typography style={PLVTitle}>
132
+ <Typography style={this.props.printSize === PrintSize.A3 ? PLVTitleA3 : PLVTitle}>
93
133
  <span className='not-highlight'> Votre entretien </span>
94
134
  </Typography>
95
- <Typography style={PLVTitle}>
135
+ <Typography style={this.props.printSize === PrintSize.A3 ? PLVTitleA3 : PLVTitle}>
96
136
  <span className='not-highlight'> auto ne sera plus </span>
97
137
  </Typography>
98
- <Typography style={PLVTitle}>
138
+ <Typography style={this.props.printSize === PrintSize.A3 ? PLVTitleA3 : PLVTitle}>
99
139
  <span className='not-highlight'> un casse-tête ! </span>
100
140
  </Typography>
101
141
  </Grid>
102
142
 
103
- <Grid item xs={7} sx={{ pl: 8, mt: 8 }} style={PLVQRCode}>
104
- <QRCode data={this.props.url} />
143
+ <Grid item xs={7} sx={{ pl: 8, mt: this.props.printSize === PrintSize.A3 ? 11 : 7 }} style={PLVQRCode}>
144
+ <QRCode data={this.props.url} size={this.props.printSize === PrintSize.A4 ? 350 : 500} />
105
145
  </Grid>
106
146
 
107
147
  <Grid item xs={5} style={PLVBaseLine}>
108
- <Typography style={PLVBaseLine}>
148
+ <Typography style={this.props.printSize === PrintSize.A3 ? PLVBaseLineA3 : PLVBaseLine }>
109
149
  En plus l'appli est gratuite !
110
150
  </Typography>
111
151
  </Grid>
112
152
 
113
- <Grid item xs={12} sx={{ mt: 13 }} style={PLVFooterLogo}>
114
- <span style={PVLFooterText}>WWW.MOVALIB.COM</span>
153
+ <Grid item xs={12} sx={{ mt: 3 }} style={PLVFooterLogo}>
154
+ <span style={this.props.printSize === PrintSize.A3 ? PVLFooterTextA3 : PVLFooterText}>WWW.MOVALIB.COM</span>
115
155
  <img src={LeafsLarge} style={PLVFooterLogo}/>
116
-
117
156
  </Grid>
118
157
 
119
158
  </Grid>
@@ -125,19 +164,30 @@ class PLVComponent extends React.Component<GaragePLVProps> {
125
164
 
126
165
  const GaragePLV: FC<GaragePLVProps> = ({ url }) => {
127
166
 
128
- const componentRef = useRef<PLVComponent>(null);
167
+ const PLVrefA4 = useRef<PLVComponent>(null);
168
+ const PLVrefA3 = useRef<PLVComponent>(null);
129
169
  const theme = useTheme();
130
170
 
131
- const handlePrint = useReactToPrint({
132
- content: () => componentRef.current,
133
- documentTitle: 'Movalib_PLV_A4',
171
+ const handleA4Print = useReactToPrint({
172
+ content: () => PLVrefA4.current,
173
+ documentTitle: 'Movalib_PLV_A4',
174
+ });
175
+
176
+ const handleA3Print = useReactToPrint({
177
+ content: () => PLVrefA3.current,
178
+ documentTitle: 'Movalib_PLV_A3',
134
179
  });
135
180
 
136
181
  return (
137
182
  <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>
183
+
184
+ <PLVComponent ref={PLVrefA4} url={url} printSize={PrintSize.A4} />
185
+ <PLVComponent ref={PLVrefA3} url={url} printSize={PrintSize.A3} />
186
+
187
+ <Button onClick={handleA4Print} variant='outlined'
188
+ sx={{ color: darken(theme.palette.primary.main, 0.2), mr: 2 }}>🧾&nbsp;&nbsp;Imprimer la PLV (A4)</Button>
189
+ <Button onClick={handleA3Print} variant='outlined'
190
+ sx={{ color: darken(theme.palette.primary.main, 0.2)}}>🧾&nbsp;&nbsp;Imprimer la PLV (A3)</Button>
141
191
  </div>
142
192
  );
143
193
  };
package/src/QRCode.css CHANGED
@@ -1,4 +1,8 @@
1
1
  .qr-code canvas {
2
- max-width: 300px !important;
2
+ /*max-width: 300px !important;*/
3
+ /* margin: 20px 0; */
4
+ display: flex;
5
+ align-items: center;
6
+ justify-content: center;
3
7
  width: 100%;
4
8
  }
package/src/QRCode.tsx CHANGED
@@ -13,25 +13,16 @@ import QRCodeStyling, {
13
13
  Options
14
14
  } from "qr-code-styling";
15
15
  import './QRCode.css';
16
+ import { Height } from '@mui/icons-material';
16
17
 
17
18
 
18
19
  interface QRCodeProps {
20
+ size?: number,
19
21
  data?:string,
20
22
  showDownload?:boolean
21
23
  }
22
-
23
- const styles = {
24
- inputWrapper: {
25
- margin: "20px 0",
26
- display: "flex",
27
- alignItems: 'center',
28
- justifyContent: "center",
29
- width: '300px',
30
- height: '300px'
31
- }
32
- };
33
24
 
34
- const QRCode: FC<QRCodeProps> = ({ data, showDownload=false }) => {
25
+ const QRCode: FC<QRCodeProps> = ({ size = 300, data, showDownload=false }) => {
35
26
 
36
27
  const theme = useTheme();
37
28
 
@@ -39,8 +30,8 @@ const QRCode: FC<QRCodeProps> = ({ data, showDownload=false }) => {
39
30
  const defaultData:string = 'https://movalib.com';
40
31
 
41
32
  const [options, setOptions] = useState<Options>({
42
- width: 600,
43
- height: 600,
33
+ width: size*2,
34
+ height: size*2,
44
35
  type: 'canvas' as DrawType,
45
36
  data: data ?? defaultData,
46
37
  image: QRCodeImage,
@@ -129,7 +120,9 @@ const QRCode: FC<QRCodeProps> = ({ data, showDownload=false }) => {
129
120
  display: 'flex',
130
121
  flexDirection: 'column',
131
122
  alignItems: 'center' }} >
132
- <div ref={ref} style={styles.inputWrapper} className='qr-code' />
123
+ <div ref={ref} style={{height: `${size}px`, width: `${size}px`, maxWidth: `${size}px !important`}}
124
+ className='qr-code'
125
+ />
133
126
  {/* <select onChange={onExtensionChange} value={fileExt}>
134
127
  <option value="svg">SVG</option>
135
128
  <option value="png">PNG</option>
@@ -138,7 +131,8 @@ const QRCode: FC<QRCodeProps> = ({ data, showDownload=false }) => {
138
131
  </select> */}
139
132
  {showDownload &&
140
133
  <Box sx={{ display:'flex', justifyContent:'center'}}>
141
- <Button variant='outlined' onClick={onDownloadClick} sx={{ color: darken(theme.palette.primary.main, 0.2)}}>Télécharger</Button>
134
+ <Button variant='outlined' onClick={onDownloadClick} sx={{ color: darken(theme.palette.primary.main, 0.2)}}>
135
+ Télécharger</Button>
142
136
  </Box>
143
137
  }
144
138
  </Box>
@@ -7,6 +7,7 @@ import Operation from "./Operation";
7
7
  import Product from "./Product";
8
8
  import Supplier from "./Supplier";
9
9
  import Document from "./Document";
10
+ import Address from "./Address";
10
11
 
11
12
  export default class Event {
12
13
 
@@ -16,6 +17,7 @@ export default class Event {
16
17
  type: EventType;
17
18
  title: string;
18
19
  garageName: string;
20
+ garageAddress: Address;
19
21
  garageId: number;
20
22
  start?: Date;
21
23
  end?: Date;
@@ -45,7 +47,7 @@ export default class Event {
45
47
  quoteAmount?: number;
46
48
  documents?: Document[];
47
49
 
48
- constructor(id: string, ownerId: number, type : EventType, title: string, garageName: string, garageId: number,
50
+ constructor(id: string, ownerId: number, type : EventType, title: string, garageName: string, garageAddress: Address, garageId: number,
49
51
  state: EventState, start?: Date, end?: Date, prestations?: Prestation[], operations?: Operation[], products?: Product[],
50
52
  guestsId?: string[], vehicleId?: number, quoteId?: number, notes?: string)
51
53
  {
@@ -55,6 +57,7 @@ export default class Event {
55
57
  this.type = type;
56
58
  this.title = title;
57
59
  this.garageName = garageName;
60
+ this.garageAddress = garageAddress;
58
61
  this.garageId = garageId;
59
62
  this.state = state;
60
63
  this.start = start ? new Date(start) : undefined;