@portnet/ui 5.0.24 → 5.0.25

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.
@@ -1,4134 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- require("core-js/modules/es.symbol.description.js");
8
- require("core-js/modules/es.array.includes.js");
9
- require("core-js/modules/es.array-buffer.constructor.js");
10
- require("core-js/modules/es.array-buffer.slice.js");
11
- require("core-js/modules/es.promise.js");
12
- require("core-js/modules/es.regexp.exec.js");
13
- require("core-js/modules/es.regexp.test.js");
14
- require("core-js/modules/es.string.includes.js");
15
- require("core-js/modules/es.string.split.js");
16
- require("core-js/modules/es.string.trim.js");
17
- require("core-js/modules/es.typed-array.uint8-array.js");
18
- require("core-js/modules/es.typed-array.fill.js");
19
- require("core-js/modules/es.typed-array.set.js");
20
- require("core-js/modules/es.typed-array.sort.js");
21
- require("core-js/modules/es.typed-array.to-locale-string.js");
22
- require("core-js/modules/esnext.iterator.constructor.js");
23
- require("core-js/modules/esnext.iterator.filter.js");
24
- require("core-js/modules/esnext.iterator.for-each.js");
25
- require("core-js/modules/esnext.iterator.map.js");
26
- require("core-js/modules/web.dom-collections.iterator.js");
27
- require("core-js/modules/web.url.js");
28
- require("core-js/modules/web.url.to-json.js");
29
- require("core-js/modules/web.url-search-params.js");
30
- var _react = require("react");
31
- var _reactRedux = require("react-redux");
32
- var _reactQuery = require("react-query");
33
- var _reactFontawesome = require("@fortawesome/react-fontawesome");
34
- var _reactToastify = require("react-toastify");
35
- var _reactstrap = require("reactstrap");
36
- var _freeRegularSvgIcons = require("@fortawesome/free-regular-svg-icons");
37
- var _freeSolidSvgIcons = require("@fortawesome/free-solid-svg-icons");
38
- var _iconsMaterial = require("@mui/icons-material");
39
- var _material = require("@mui/material");
40
- require("../../styles/help-widget.css");
41
- require("../../styles/ReclamationFormModal.css");
42
- var _useReclamation = require("../../hooks/useReclamation");
43
- var _guides = _interopRequireDefault(require("../../assets/guides"));
44
- var _PuiHelpWidgetContext = require("../common/PuiHelpWidgetContext");
45
- var _tijariaLogo = _interopRequireDefault(require("../../assets/images/tijariaLogo.ico"));
46
- var _GuideImage = require("./GuideImage");
47
- var _jsxRuntime = require("react/jsx-runtime");
48
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
49
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
50
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
51
- function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
52
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
53
- function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
54
- const WIDGET_FONT = "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif";
55
- const ContentPanel = _ref => {
56
- let {
57
- isOpen,
58
- onClose,
59
- contentData,
60
- title = "Contenu",
61
- showDownloadButton = false,
62
- showExternalLinkLabel = false,
63
- onDownload = null,
64
- loadingDownload = false,
65
- projectCode = null,
66
- externalLinkUrl = null,
67
- guideBaseUrl
68
- } = _ref;
69
- const {
70
- guideImageService
71
- } = (0, _PuiHelpWidgetContext.useHelpWidget)();
72
- const [position, setPosition] = (0, _react.useState)({
73
- x: window.innerWidth - 380,
74
- y: 40
75
- });
76
- const [isDragging, setIsDragging] = (0, _react.useState)(false);
77
- const [dragStart, setDragStart] = (0, _react.useState)({
78
- x: 0,
79
- y: 0
80
- });
81
- const panelRef = (0, _react.useRef)(null);
82
- const firstFocusableRef = (0, _react.useRef)(null);
83
- const previousActiveElement = (0, _react.useRef)(null);
84
- const [currentView, setCurrentView] = (0, _react.useState)("list");
85
- const [selectedSection, setSelectedSection] = (0, _react.useState)(null);
86
- const [fullscreenImage, setFullscreenImage] = (0, _react.useState)(null);
87
- const PANEL_WIDTH = 340;
88
- const PANEL_MAX_HEIGHT = 550;
89
- const RESIZE_MARGIN = 40;
90
- const MIN_VISIBLE_WIDTH = 80;
91
- (0, _react.useEffect)(() => {
92
- if (contentData) {
93
- setCurrentView("list");
94
- setSelectedSection(null);
95
- }
96
- }, [contentData]);
97
- (0, _react.useEffect)(() => {
98
- return () => {
99
- guideImageService.clearImageCache();
100
- };
101
- }, []);
102
- const handleSectionClick = section => {
103
- setSelectedSection(section);
104
- setCurrentView("detail");
105
- };
106
- const handleBack = () => {
107
- setCurrentView("list");
108
- setSelectedSection(null);
109
- };
110
- const handleOpenInNewWindow = () => {
111
- if (!selectedSection || !projectCode || !guideBaseUrl) return;
112
- const url = "".concat(guideBaseUrl, "/#/guide/").concat(projectCode, "?section=").concat(selectedSection.id);
113
- window.open(url, "_blank");
114
- };
115
- const handleImageClick = imageSrc => {
116
- setFullscreenImage(imageSrc);
117
- };
118
- const handleCloseFullscreen = () => {
119
- setFullscreenImage(null);
120
- };
121
- const handleMouseDown = e => {
122
- if (e.target.closest(".drag-handle")) {
123
- setIsDragging(true);
124
- setDragStart({
125
- x: e.clientX - position.x,
126
- y: e.clientY - position.y
127
- });
128
- }
129
- };
130
- const handleMouseMove = e => {
131
- if (isDragging) {
132
- const newX = e.clientX - dragStart.x;
133
- const newY = e.clientY - dragStart.y;
134
- const constrainedX = Math.max(0, newX);
135
- const maxX = window.innerWidth - MIN_VISIBLE_WIDTH;
136
- const finalX = Math.min(constrainedX, maxX);
137
- const finalY = Math.max(0, newY);
138
- setPosition({
139
- x: finalX,
140
- y: finalY
141
- });
142
- }
143
- };
144
- const handleMouseUp = () => {
145
- setIsDragging(false);
146
- };
147
- (0, _react.useEffect)(() => {
148
- const handleResize = () => {
149
- setPosition(prev => {
150
- var _panelRef$current;
151
- const panelHeight = ((_panelRef$current = panelRef.current) === null || _panelRef$current === void 0 ? void 0 : _panelRef$current.offsetHeight) || PANEL_MAX_HEIGHT;
152
- let newX = prev.x;
153
- let newY = prev.y;
154
- const maxX = window.innerWidth - PANEL_WIDTH - RESIZE_MARGIN;
155
- const maxY = window.innerHeight - panelHeight - RESIZE_MARGIN;
156
- if (prev.x + PANEL_WIDTH > window.innerWidth - RESIZE_MARGIN) {
157
- newX = Math.max(RESIZE_MARGIN, maxX);
158
- }
159
- if (prev.x < RESIZE_MARGIN) {
160
- newX = RESIZE_MARGIN;
161
- }
162
- if (prev.y + panelHeight > window.innerHeight - RESIZE_MARGIN) {
163
- newY = Math.max(RESIZE_MARGIN, maxY);
164
- }
165
- if (prev.y < RESIZE_MARGIN) {
166
- newY = RESIZE_MARGIN;
167
- }
168
- return {
169
- x: newX,
170
- y: newY
171
- };
172
- });
173
- };
174
- window.addEventListener("resize", handleResize);
175
- return () => window.removeEventListener("resize", handleResize);
176
- }, []);
177
- (0, _react.useEffect)(() => {
178
- if (isDragging) {
179
- document.addEventListener("mousemove", handleMouseMove);
180
- document.addEventListener("mouseup", handleMouseUp);
181
- return () => {
182
- document.removeEventListener("mousemove", handleMouseMove);
183
- document.removeEventListener("mouseup", handleMouseUp);
184
- };
185
- }
186
- }, [isDragging, dragStart]);
187
- (0, _react.useEffect)(() => {
188
- const handleEscape = e => {
189
- if (e.key === "Escape" && fullscreenImage) {
190
- handleCloseFullscreen();
191
- }
192
- };
193
- window.addEventListener("keydown", handleEscape);
194
- return () => window.removeEventListener("keydown", handleEscape);
195
- }, [fullscreenImage]);
196
- (0, _react.useEffect)(() => {
197
- if (isOpen) {
198
- previousActiveElement.current = document.activeElement;
199
- setTimeout(() => {
200
- var _firstFocusableRef$cu;
201
- (_firstFocusableRef$cu = firstFocusableRef.current) === null || _firstFocusableRef$cu === void 0 || _firstFocusableRef$cu.focus();
202
- }, 100);
203
- } else {
204
- if (previousActiveElement.current) {
205
- previousActiveElement.current.focus();
206
- }
207
- }
208
- }, [isOpen]);
209
- (0, _react.useEffect)(() => {
210
- if (!isOpen) return;
211
- const handleKeyDown = e => {
212
- if (e.key === "Escape") {
213
- if (fullscreenImage) {
214
- return;
215
- }
216
- onClose();
217
- return;
218
- }
219
- if (e.key === "Tab") {
220
- const panel = panelRef.current;
221
- if (!panel) return;
222
- const focusableElements = panel.querySelectorAll('button:not([disabled]), [href]:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"]):not([disabled])');
223
- const focusableArray = Array.from(focusableElements);
224
- const firstElement = focusableArray[0];
225
- const lastElement = focusableArray[focusableArray.length - 1];
226
- if (focusableArray.length === 0) return;
227
- if (e.shiftKey) {
228
- if (document.activeElement === firstElement) {
229
- lastElement.focus();
230
- e.preventDefault();
231
- }
232
- } else {
233
- if (document.activeElement === lastElement) {
234
- firstElement.focus();
235
- e.preventDefault();
236
- }
237
- }
238
- }
239
- };
240
- document.addEventListener("keydown", handleKeyDown);
241
- return () => document.removeEventListener("keydown", handleKeyDown);
242
- }, [isOpen, onClose, fullscreenImage]);
243
- (0, _react.useEffect)(() => {
244
- if (isOpen) {
245
- document.body.style.overflow = "hidden";
246
- } else {
247
- document.body.style.overflow = "";
248
- }
249
- return () => {
250
- document.body.style.overflow = "";
251
- };
252
- }, [isOpen]);
253
- (0, _react.useEffect)(() => {
254
- if (currentView === "detail") {
255
- setTimeout(() => {
256
- const panel = panelRef.current;
257
- if (!panel) return;
258
- const focusableElements = panel.querySelectorAll('button:not([disabled]), [href]:not([disabled]), [role="button"]:not([disabled])[tabindex="0"]');
259
- if (focusableElements.length > 0) {
260
- focusableElements[0].focus();
261
- }
262
- }, 100);
263
- } else if (currentView === "list") {
264
- setTimeout(() => {
265
- var _firstFocusableRef$cu2;
266
- (_firstFocusableRef$cu2 = firstFocusableRef.current) === null || _firstFocusableRef$cu2 === void 0 || _firstFocusableRef$cu2.focus();
267
- }, 100);
268
- }
269
- }, [currentView]);
270
- if (!isOpen) return null;
271
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
272
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
273
- ref: panelRef,
274
- role: "dialog",
275
- "aria-modal": "true",
276
- "aria-labelledby": "panel-title",
277
- style: {
278
- position: "fixed",
279
- left: "".concat(position.x, "px"),
280
- top: "".concat(position.y, "px"),
281
- width: "360px",
282
- height: "auto",
283
- maxHeight: "550px",
284
- backgroundColor: "white",
285
- border: "0px solid #dadce0",
286
- borderRadius: "16px",
287
- boxShadow: "0px 1px 3px 0px rgba(60, 64, 67, 0.3)",
288
- zIndex: 10000000,
289
- display: "flex",
290
- flexDirection: "column",
291
- overflow: "hidden",
292
- fontFamily: "'Google Sans', Roboto, Arial, sans-serif"
293
- },
294
- onMouseDown: handleMouseDown,
295
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
296
- className: "drag-handle",
297
- style: {
298
- display: "flex",
299
- alignItems: "center",
300
- justifyContent: "center",
301
- marginTop: "10px",
302
- padding: "16px 20px",
303
- cursor: "move",
304
- userSelect: "none",
305
- backgroundColor: "white",
306
- position: "relative"
307
- },
308
- children: [currentView === "detail" && /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
309
- onClick: handleBack,
310
- "aria-label": "Retour \xE0 la liste",
311
- tabIndex: 0,
312
- style: {
313
- background: "none",
314
- border: "none",
315
- cursor: "pointer",
316
- padding: "8px",
317
- borderRadius: "50%",
318
- display: "flex",
319
- alignItems: "center",
320
- justifyContent: "center",
321
- transition: "background-color 0.2s",
322
- position: "absolute",
323
- left: "12px",
324
- order: 1
325
- },
326
- onMouseEnter: e => e.currentTarget.style.backgroundColor = "#f1f3f4",
327
- onMouseLeave: e => e.currentTarget.style.backgroundColor = "transparent",
328
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)("svg", {
329
- xmlns: "http://www.w3.org/2000/svg",
330
- width: "22",
331
- height: "22",
332
- viewBox: "0 0 24 24",
333
- fill: "none",
334
- stroke: "#5f6368",
335
- strokeWidth: "2",
336
- strokeLinecap: "round",
337
- strokeLinejoin: "round",
338
- "aria-hidden": "true",
339
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
340
- d: "M19 12H5M12 19l-7-7 7-7"
341
- })
342
- })
343
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("h2", {
344
- id: "panel-title",
345
- style: {
346
- margin: 0,
347
- fontSize: "20px",
348
- fontWeight: "400",
349
- color: "#202124",
350
- letterSpacing: "0",
351
- order: 2
352
- },
353
- children: title
354
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
355
- ref: firstFocusableRef,
356
- onClick: onClose,
357
- "aria-label": "Fermer le panneau",
358
- tabIndex: 0,
359
- style: {
360
- background: "none",
361
- border: "none",
362
- cursor: "pointer",
363
- padding: "8px",
364
- borderRadius: "50%",
365
- display: "flex",
366
- alignItems: "center",
367
- justifyContent: "center",
368
- transition: "background-color 0.2s",
369
- position: "absolute",
370
- right: "12px",
371
- order: 3
372
- },
373
- onMouseEnter: e => e.currentTarget.style.backgroundColor = "#f1f3f4",
374
- onMouseLeave: e => e.currentTarget.style.backgroundColor = "transparent",
375
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("svg", {
376
- xmlns: "http://www.w3.org/2000/svg",
377
- width: "22",
378
- height: "22",
379
- viewBox: "0 0 24 24",
380
- fill: "none",
381
- stroke: "#5f6368",
382
- strokeWidth: "2",
383
- strokeLinecap: "round",
384
- strokeLinejoin: "round",
385
- "aria-hidden": "true",
386
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("line", {
387
- x1: "18",
388
- y1: "6",
389
- x2: "6",
390
- y2: "18"
391
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("line", {
392
- x1: "6",
393
- y1: "6",
394
- x2: "18",
395
- y2: "18"
396
- })]
397
- })
398
- })]
399
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
400
- style: {
401
- padding: "10px 16px",
402
- marginBottom: "7px",
403
- overflowY: "auto",
404
- flex: 1
405
- },
406
- children: currentView === "list" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
407
- children: !contentData ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
408
- style: {
409
- textAlign: "center",
410
- padding: "20px",
411
- marginBottom: 9
412
- },
413
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.CircularProgress, {
414
- size: 20,
415
- sx: {
416
- color: "#1967d2"
417
- }
418
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
419
- component: "div",
420
- sx: {
421
- fontSize: "14px",
422
- color: "#202124",
423
- marginTop: "10px",
424
- lineHeight: "normal"
425
- },
426
- children: "Chargement..."
427
- })]
428
- }) : contentData !== null && contentData !== void 0 && contentData.sections && contentData.sections.length > 0 ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
429
- children: [contentData.name && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
430
- style: {
431
- marginBottom: "7px"
432
- },
433
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)("h3", {
434
- style: {
435
- fontSize: "16px",
436
- color: "#202124",
437
- lineHeight: "24px",
438
- margin: 0,
439
- fontWeight: "400"
440
- },
441
- children: contentData.name
442
- })
443
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
444
- style: {
445
- display: "flex",
446
- flexDirection: "column",
447
- gap: "4px"
448
- },
449
- children: contentData.sections.map(section => /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
450
- onClick: () => handleSectionClick(section),
451
- onKeyDown: e => {
452
- if (e.key === "Enter" || e.key === " ") {
453
- e.preventDefault();
454
- handleSectionClick(section);
455
- }
456
- },
457
- role: "button",
458
- tabIndex: 0,
459
- "aria-label": "Ouvrir ".concat(section.title),
460
- style: {
461
- display: "flex",
462
- alignItems: "center",
463
- padding: "12px 2.2px",
464
- cursor: "pointer",
465
- borderRadius: "8px",
466
- transition: "background-color 0.2s",
467
- backgroundColor: "transparent"
468
- },
469
- onMouseEnter: e => {
470
- e.currentTarget.style.backgroundColor = "#f1f3f4";
471
- },
472
- onMouseLeave: e => {
473
- e.currentTarget.style.backgroundColor = "transparent";
474
- },
475
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
476
- style: {
477
- minWidth: "34px",
478
- height: "34px",
479
- borderRadius: "50%",
480
- backgroundColor: "#e8f0fe",
481
- display: "flex",
482
- alignItems: "center",
483
- justifyContent: "center",
484
- marginRight: "12px",
485
- flexShrink: 0
486
- },
487
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("svg", {
488
- xmlns: "http://www.w3.org/2000/svg",
489
- width: "16",
490
- height: "16",
491
- viewBox: "0 0 24 24",
492
- fill: "none",
493
- stroke: "#1967d2",
494
- strokeWidth: "2",
495
- strokeLinecap: "round",
496
- strokeLinejoin: "round",
497
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
498
- d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"
499
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("polyline", {
500
- points: "14 2 14 8 20 8"
501
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("line", {
502
- x1: "16",
503
- y1: "13",
504
- x2: "8",
505
- y2: "13"
506
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("line", {
507
- x1: "16",
508
- y1: "17",
509
- x2: "8",
510
- y2: "17"
511
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("line", {
512
- x1: "10",
513
- y1: "9",
514
- x2: "8",
515
- y2: "9"
516
- })]
517
- })
518
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
519
- style: {
520
- flex: 1
521
- },
522
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
523
- style: {
524
- fontSize: "16px",
525
- color: "#202124",
526
- fontWeight: "400",
527
- lineHeight: "20px"
528
- },
529
- children: section.title
530
- })
531
- })]
532
- }, section.id))
533
- }), showDownloadButton && onDownload && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
534
- style: {
535
- marginTop: "10px"
536
- },
537
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
538
- onClick: onDownload,
539
- onKeyDown: e => {
540
- if (e.key === "Enter" || e.key === " ") {
541
- e.preventDefault();
542
- onDownload();
543
- }
544
- },
545
- role: "button",
546
- tabIndex: 0,
547
- "aria-label": "T\xE9l\xE9charger le guide complet",
548
- style: {
549
- display: "flex",
550
- alignItems: "center",
551
- justifyContent: "center",
552
- gap: "6px",
553
- color: "#1967d2",
554
- fontSize: "14px",
555
- textDecoration: "none",
556
- padding: "8px",
557
- borderRadius: "4px",
558
- transition: "background-color 0.2s",
559
- cursor: loadingDownload ? "not-allowed" : "pointer",
560
- opacity: loadingDownload ? 0.6 : 1
561
- },
562
- onMouseEnter: e => !loadingDownload && (e.currentTarget.style.backgroundColor = "#f1f3f4"),
563
- onMouseLeave: e => e.currentTarget.style.backgroundColor = "transparent",
564
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
565
- children: "T\xE9l\xE9charger le guide complet"
566
- }), loadingDownload ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.CircularProgress, {
567
- size: 16,
568
- sx: {
569
- color: "#1967d2"
570
- }
571
- }) : /*#__PURE__*/(0, _jsxRuntime.jsxs)("svg", {
572
- xmlns: "http://www.w3.org/2000/svg",
573
- width: "16",
574
- height: "16",
575
- viewBox: "0 0 24 24",
576
- fill: "none",
577
- stroke: "currentColor",
578
- strokeWidth: "2",
579
- strokeLinecap: "round",
580
- strokeLinejoin: "round",
581
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
582
- d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"
583
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("polyline", {
584
- points: "7 10 12 15 17 10"
585
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("line", {
586
- x1: "12",
587
- y1: "15",
588
- x2: "12",
589
- y2: "3"
590
- })]
591
- })]
592
- })
593
- }), showExternalLinkLabel && externalLinkUrl && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
594
- style: {
595
- marginTop: "10px"
596
- },
597
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
598
- onClick: () => window.open(externalLinkUrl, "_blank"),
599
- onKeyDown: e => {
600
- if (e.key === "Enter" || e.key === " ") {
601
- e.preventDefault();
602
- window.open(externalLinkUrl, "_blank");
603
- }
604
- },
605
- role: "button",
606
- tabIndex: 0,
607
- "aria-label": "Voir plus de d\xE9tails (ouvre dans un nouvel onglet)",
608
- style: {
609
- display: "flex",
610
- alignItems: "center",
611
- justifyContent: "center",
612
- gap: "6px",
613
- color: "#1967d2",
614
- fontSize: "14px",
615
- textDecoration: "none",
616
- padding: "8px",
617
- borderRadius: "4px",
618
- transition: "background-color 0.2s",
619
- cursor: "pointer"
620
- },
621
- onMouseEnter: e => e.currentTarget.style.backgroundColor = "#f1f3f4",
622
- onMouseLeave: e => e.currentTarget.style.backgroundColor = "transparent",
623
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
624
- children: "Voir plus de d\xE9tails"
625
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("svg", {
626
- xmlns: "http://www.w3.org/2000/svg",
627
- width: "16",
628
- height: "16",
629
- viewBox: "0 0 24 24",
630
- fill: "none",
631
- stroke: "currentColor",
632
- strokeWidth: "2",
633
- strokeLinecap: "round",
634
- strokeLinejoin: "round",
635
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
636
- d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"
637
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("polyline", {
638
- points: "15 3 21 3 21 9"
639
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("line", {
640
- x1: "21",
641
- y1: "3",
642
- x2: "10",
643
- y2: "14"
644
- })]
645
- })]
646
- })
647
- })]
648
- }) : /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
649
- style: {
650
- textAlign: "center",
651
- padding: "50px 20px",
652
- color: "#202124"
653
- },
654
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
655
- component: "div",
656
- sx: {
657
- fontSize: "14px",
658
- lineHeight: "normal",
659
- color: "#202124"
660
- },
661
- children: "Aucune section disponible."
662
- })
663
- })
664
- }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
665
- children: selectedSection && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
666
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
667
- style: {
668
- marginBottom: "14px",
669
- marginTop: "4px"
670
- },
671
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)("h2", {
672
- style: {
673
- fontSize: "28px",
674
- color: "#202124",
675
- fontWeight: "400",
676
- lineHeight: "32px",
677
- margin: 0
678
- },
679
- children: selectedSection.title
680
- })
681
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
682
- style: {
683
- marginBottom: "20px"
684
- },
685
- children: selectedSection.paragraphs && selectedSection.paragraphs.map((paragraph, index) => {
686
- const text = typeof paragraph === "string" ? paragraph : paragraph.text;
687
- const isQuestion = typeof paragraph === "object" && paragraph.isQuestion;
688
- return /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
689
- style: {
690
- fontSize: "16px",
691
- color: "#202124",
692
- lineHeight: "22px",
693
- margin: index === 0 ? 0 : "12px 0 0 0",
694
- fontWeight: isQuestion ? "600" : "400"
695
- },
696
- children: text
697
- }, index);
698
- })
699
- }), selectedSection.images && selectedSection.images.length > 0 && projectCode && /*#__PURE__*/(0, _jsxRuntime.jsx)(_GuideImage.GuideImageGallery, {
700
- projectCode: projectCode,
701
- imageOrders: selectedSection.images,
702
- columns: 1,
703
- onImageClick: handleImageClick
704
- }), selectedSection.keywords && selectedSection.keywords.length > 0 && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
705
- style: {
706
- marginTop: "20px",
707
- marginBottom: "20px"
708
- },
709
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("h3", {
710
- style: {
711
- fontSize: "13px",
712
- fontWeight: "500",
713
- color: "#202124",
714
- margin: "0 0 10px 0",
715
- letterSpacing: "0.5px"
716
- },
717
- children: "Mots-cl\xE9s"
718
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
719
- style: {
720
- display: "flex",
721
- flexWrap: "wrap",
722
- gap: "6px"
723
- },
724
- children: selectedSection.keywords.map((keyword, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
725
- style: {
726
- backgroundColor: "#e8f0fe",
727
- color: "#1967d2",
728
- padding: "4px 10px",
729
- borderRadius: "12px",
730
- fontSize: "12px",
731
- fontWeight: "500"
732
- },
733
- children: keyword
734
- }, index))
735
- })]
736
- }), projectCode && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
737
- style: {
738
- marginTop: "24px",
739
- paddingTop: "16px",
740
- borderTop: "1px solid #e8eaed"
741
- },
742
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
743
- onClick: handleOpenInNewWindow,
744
- onKeyDown: e => {
745
- if (e.key === "Enter" || e.key === " ") {
746
- e.preventDefault();
747
- handleOpenInNewWindow();
748
- }
749
- },
750
- role: "button",
751
- tabIndex: 0,
752
- "aria-label": "Ouvrir dans une nouvelle fen\xEAtre",
753
- style: {
754
- display: "flex",
755
- alignItems: "center",
756
- justifyContent: "center",
757
- gap: "6px",
758
- color: "#1967d2",
759
- fontSize: "14px",
760
- padding: "8px",
761
- borderRadius: "4px",
762
- cursor: "pointer",
763
- transition: "background-color 0.2s"
764
- },
765
- onMouseEnter: e => e.currentTarget.style.backgroundColor = "#f1f3f4",
766
- onMouseLeave: e => e.currentTarget.style.backgroundColor = "transparent",
767
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
768
- children: "Ouvrir dans une nouvelle fen\xEAtre"
769
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("svg", {
770
- xmlns: "http://www.w3.org/2000/svg",
771
- width: "16",
772
- height: "16",
773
- viewBox: "0 0 24 24",
774
- fill: "none",
775
- stroke: "currentColor",
776
- strokeWidth: "2",
777
- strokeLinecap: "round",
778
- strokeLinejoin: "round",
779
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
780
- d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"
781
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("polyline", {
782
- points: "15 3 21 3 21 9"
783
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("line", {
784
- x1: "10",
785
- y1: "14",
786
- x2: "21",
787
- y2: "3"
788
- })]
789
- })]
790
- })
791
- })]
792
- })
793
- })
794
- })]
795
- }), fullscreenImage && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
796
- onClick: handleCloseFullscreen,
797
- style: {
798
- position: "fixed",
799
- top: 0,
800
- left: 0,
801
- width: "100vw",
802
- height: "100vh",
803
- backgroundColor: "rgba(0, 0, 0, 0.78)",
804
- zIndex: 20000000,
805
- display: "flex",
806
- alignItems: "center",
807
- justifyContent: "center",
808
- cursor: "zoom-out",
809
- animation: "fadeIn 0.2s ease-in-out"
810
- },
811
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
812
- onClick: handleCloseFullscreen,
813
- style: {
814
- position: "absolute",
815
- top: "20px",
816
- right: "20px",
817
- background: "rgba(255, 255, 255, 0.1)",
818
- border: "none",
819
- borderRadius: "50%",
820
- width: "48px",
821
- height: "48px",
822
- cursor: "pointer",
823
- display: "flex",
824
- alignItems: "center",
825
- justifyContent: "center",
826
- transition: "background-color 0.2s",
827
- zIndex: 20000001
828
- },
829
- onMouseEnter: e => e.currentTarget.style.backgroundColor = "rgba(255, 255, 255, 0.2)",
830
- onMouseLeave: e => e.currentTarget.style.backgroundColor = "rgba(255, 255, 255, 0.1)",
831
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("svg", {
832
- xmlns: "http://www.w3.org/2000/svg",
833
- width: "24",
834
- height: "24",
835
- viewBox: "0 0 24 24",
836
- fill: "none",
837
- stroke: "white",
838
- strokeWidth: "2",
839
- strokeLinecap: "round",
840
- strokeLinejoin: "round",
841
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("line", {
842
- x1: "18",
843
- y1: "6",
844
- x2: "6",
845
- y2: "18"
846
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("line", {
847
- x1: "6",
848
- y1: "6",
849
- x2: "18",
850
- y2: "18"
851
- })]
852
- })
853
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
854
- src: fullscreenImage,
855
- alt: "Full screen view",
856
- onClick: e => e.stopPropagation(),
857
- style: {
858
- maxWidth: "90vw",
859
- maxHeight: "90vh",
860
- objectFit: "contain",
861
- cursor: "default",
862
- boxShadow: "0 4px 20px rgba(0, 0, 0, 0.5)"
863
- }
864
- })]
865
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("style", {
866
- children: "\n @keyframes fadeIn {\n from { opacity: 0; }\n to { opacity: 1; }\n }\n \n /* Focus indicators for ContentPanel */\n [role=\"dialog\"] button:focus-visible,\n [role=\"dialog\"] [role=\"button\"]:focus-visible,\n [role=\"dialog\"] a:focus-visible {\n outline: 3px solid #1967d2 !important;\n outline-offset: 2px !important;\n box-shadow: 0 0 0 4px rgba(25, 103, 210, 0.1) !important;\n }\n \n [role=\"dialog\"] button:focus:not(:focus-visible),\n [role=\"dialog\"] a:focus:not(:focus-visible) {\n outline: none;\n }\n "
867
- })]
868
- });
869
- };
870
- const BottomContent = _ref2 => {
871
- let {
872
- showTijaria,
873
- viewingReclamations,
874
- viewingTijariaHistory,
875
- activeChat,
876
- infoMessages,
877
- incidentMessages,
878
- setViewingReclamations,
879
- setViewingTijariaHistory,
880
- setActiveChat,
881
- setInfoMessages,
882
- setIncidentMessages
883
- } = _ref2;
884
- const [selectedConversation, setSelectedConversation] = (0, _react.useState)(null);
885
- if (viewingReclamations) {
886
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(ReclamationsList, {
887
- onClose: () => setViewingReclamations(false)
888
- });
889
- }
890
- if (viewingTijariaHistory) {
891
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(TijariaHistory, {
892
- onClose: () => setViewingTijariaHistory(false),
893
- setSelectedConversation: setSelectedConversation
894
- });
895
- }
896
- if (activeChat) {
897
- const messages = activeChat === "info" ? infoMessages : incidentMessages;
898
- const setMessages = activeChat === "info" ? setInfoMessages : setIncidentMessages;
899
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(CustomChatInterface, {
900
- type: activeChat,
901
- onClose: () => setActiveChat(null),
902
- messages: messages,
903
- setMessages: setMessages
904
- });
905
- }
906
- if (!showTijaria) {
907
- return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
908
- style: {
909
- flex: 1
910
- }
911
- });
912
- }
913
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(TijariaChatbot, {
914
- selectedConversation: selectedConversation
915
- });
916
- };
917
- const CustomChatInterface = _ref3 => {
918
- let {
919
- type,
920
- onClose,
921
- messages,
922
- setMessages
923
- } = _ref3;
924
- const [inputMessage, setInputMessage] = (0, _react.useState)("");
925
- const [selectedFile, setSelectedFile] = (0, _react.useState)(null);
926
- const chatRef = (0, _react.useRef)(null);
927
- const fileInputRef = (0, _react.useRef)(null);
928
- const chatConfig = {
929
- info: {
930
- title: "Live Support",
931
- icon: _freeSolidSvgIcons.faHeadset,
932
- color: "#17a2b8",
933
- placeholder: "Posez votre question..."
934
- },
935
- incident: {
936
- title: "Signaler un incident",
937
- icon: _freeSolidSvgIcons.faWarning,
938
- color: "#E82930",
939
- placeholder: "Décrivez l'incident..."
940
- }
941
- };
942
- const config = chatConfig[type];
943
- (0, _react.useEffect)(() => {
944
- if (chatRef.current) {
945
- chatRef.current.scrollTop = chatRef.current.scrollHeight;
946
- }
947
- }, [messages]);
948
- const handleSendMessage = () => {
949
- if (!inputMessage.trim() && !selectedFile) return;
950
- const newMessage = {
951
- id: Date.now(),
952
- sender: "user",
953
- text: inputMessage,
954
- file: selectedFile,
955
- timestamp: new Date()
956
- };
957
- setMessages([...messages, newMessage]);
958
- setInputMessage("");
959
- setSelectedFile(null);
960
- setTimeout(() => {
961
- const responseMessage = {
962
- id: Date.now() + 1,
963
- sender: "agent",
964
- text: type === "info" ? "Merci pour votre question. Notre équipe reviendra vers vous dans les plus brefs délais." : "Votre incident a été enregistré. Nous vous contacterons bientôt pour le suivi.",
965
- timestamp: new Date()
966
- };
967
- setMessages(prev => [...prev, responseMessage]);
968
- }, 1000);
969
- };
970
- const handleFileSelect = e => {
971
- const file = e.target.files[0];
972
- if (file) {
973
- setSelectedFile(file);
974
- }
975
- };
976
- const handleKeyPress = e => {
977
- if (e.key === "Enter" && !e.shiftKey) {
978
- e.preventDefault();
979
- handleSendMessage();
980
- }
981
- };
982
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
983
- style: {
984
- flex: 1,
985
- display: "flex",
986
- flexDirection: "column",
987
- backgroundColor: "#f5f5f5"
988
- },
989
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
990
- style: {
991
- display: "flex",
992
- justifyContent: "space-between",
993
- alignItems: "center",
994
- padding: "12px 16px",
995
- backgroundColor: "white",
996
- borderBottom: "1px solid #e0e0e0"
997
- },
998
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
999
- style: {
1000
- display: "flex",
1001
- alignItems: "center",
1002
- gap: "12px",
1003
- paddingTop: 1,
1004
- paddingBottom: 2.5
1005
- }
1006
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
1007
- onClick: onClose,
1008
- style: {
1009
- cursor: "pointer",
1010
- color: "#666",
1011
- padding: "4px",
1012
- display: "flex",
1013
- alignItems: "center"
1014
- },
1015
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFontawesome.FontAwesomeIcon, {
1016
- icon: _freeSolidSvgIcons.faTimes,
1017
- style: {
1018
- fontSize: "16px"
1019
- }
1020
- })
1021
- })]
1022
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
1023
- style: {
1024
- display: "flex",
1025
- alignItems: "center",
1026
- gap: "12px",
1027
- padding: "16px",
1028
- backgroundColor: "white",
1029
- borderBottom: "1px solid #e0e0e0"
1030
- },
1031
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
1032
- style: {
1033
- width: "40px",
1034
- height: "40px",
1035
- borderRadius: "8px",
1036
- backgroundColor: "#f5f5f5",
1037
- display: "flex",
1038
- alignItems: "center",
1039
- justifyContent: "center"
1040
- },
1041
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFontawesome.FontAwesomeIcon, {
1042
- icon: config.icon,
1043
- style: {
1044
- color: config.color,
1045
- fontSize: "20px"
1046
- }
1047
- })
1048
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
1049
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
1050
- style: {
1051
- fontWeight: "400",
1052
- color: "#333",
1053
- fontSize: "16px"
1054
- },
1055
- children: config.title
1056
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
1057
- style: {
1058
- color: "#999",
1059
- fontSize: "12px"
1060
- },
1061
- children: "Support Agent"
1062
- })]
1063
- })]
1064
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
1065
- ref: chatRef,
1066
- style: {
1067
- flex: 1,
1068
- overflowY: "auto",
1069
- padding: "16px",
1070
- backgroundColor: "#f5f5f5"
1071
- },
1072
- children: messages.map(message => /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
1073
- style: {
1074
- display: "flex",
1075
- flexDirection: "column",
1076
- alignItems: message.sender === "user" ? "flex-end" : "flex-start",
1077
- marginBottom: "16px"
1078
- },
1079
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
1080
- style: {
1081
- display: "flex",
1082
- alignItems: "center",
1083
- gap: "6px",
1084
- marginBottom: "4px"
1085
- },
1086
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
1087
- style: {
1088
- width: "6px",
1089
- height: "6px",
1090
- borderRadius: "50%",
1091
- backgroundColor: message.sender === "user" ? config.color : "#4CAF50"
1092
- }
1093
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
1094
- style: {
1095
- color: "#999",
1096
- fontSize: "11px"
1097
- },
1098
- children: [message.sender === "user" ? "Vous" : "Support", " ", message.timestamp.toLocaleTimeString("fr-FR", {
1099
- hour: "2-digit",
1100
- minute: "2-digit"
1101
- })]
1102
- })]
1103
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
1104
- style: {
1105
- maxWidth: "75%",
1106
- padding: "12px 16px",
1107
- borderRadius: "8px",
1108
- backgroundColor: message.sender === "user" ? config.color : "white",
1109
- color: message.sender === "user" ? "white" : "#333",
1110
- boxShadow: message.sender !== "user" ? "0 1px 3px rgba(0,0,0,0.1)" : "none"
1111
- },
1112
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
1113
- style: {
1114
- fontSize: "14px",
1115
- lineHeight: "1.5",
1116
- whiteSpace: "pre-wrap",
1117
- wordBreak: "break-word"
1118
- },
1119
- children: message.text
1120
- }), message.file && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
1121
- style: {
1122
- marginTop: "8px",
1123
- padding: "8px",
1124
- backgroundColor: message.sender === "user" ? "rgba(255,255,255,0.2)" : "#f5f5f5",
1125
- borderRadius: "4px",
1126
- fontSize: "12px",
1127
- display: "flex",
1128
- alignItems: "center",
1129
- gap: "6px"
1130
- },
1131
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFontawesome.FontAwesomeIcon, {
1132
- icon: _freeSolidSvgIcons.faPaperclip
1133
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
1134
- children: message.file.name
1135
- })]
1136
- })]
1137
- }), message.sender === "user" && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
1138
- style: {
1139
- color: "#999",
1140
- fontSize: "10px",
1141
- marginTop: "4px"
1142
- },
1143
- children: "Lu"
1144
- })]
1145
- }, message.id))
1146
- }), selectedFile && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
1147
- style: {
1148
- padding: "8px 16px",
1149
- backgroundColor: "#fff3cd",
1150
- borderTop: "1px solid #ffc107",
1151
- display: "flex",
1152
- alignItems: "center",
1153
- justifyContent: "space-between"
1154
- },
1155
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
1156
- style: {
1157
- display: "flex",
1158
- alignItems: "center",
1159
- gap: "8px",
1160
- fontSize: "12px"
1161
- },
1162
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFontawesome.FontAwesomeIcon, {
1163
- icon: _freeSolidSvgIcons.faPaperclip,
1164
- style: {
1165
- color: "#856404"
1166
- }
1167
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
1168
- style: {
1169
- color: "#856404"
1170
- },
1171
- children: selectedFile.name
1172
- })]
1173
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFontawesome.FontAwesomeIcon, {
1174
- icon: _freeSolidSvgIcons.faTimes,
1175
- style: {
1176
- cursor: "pointer",
1177
- color: "#856404"
1178
- },
1179
- onClick: () => setSelectedFile(null)
1180
- })]
1181
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
1182
- style: {
1183
- display: "flex",
1184
- alignItems: "flex-end",
1185
- gap: "8px",
1186
- padding: "12px 16px",
1187
- backgroundColor: "white",
1188
- borderTop: "1px solid #e0e0e0"
1189
- },
1190
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactstrap.Input, {
1191
- type: "textarea",
1192
- rows: "1",
1193
- style: {
1194
- flex: 1,
1195
- border: "none",
1196
- resize: "none",
1197
- fontSize: "14px",
1198
- padding: "8px",
1199
- maxHeight: "100px",
1200
- overflowY: "auto",
1201
- outline: "none",
1202
- boxShadow: "none",
1203
- fontWeight: "400"
1204
- },
1205
- placeholder: config.placeholder,
1206
- value: inputMessage,
1207
- onChange: e => setInputMessage(e.target.value),
1208
- onKeyPress: handleKeyPress
1209
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
1210
- type: "file",
1211
- ref: fileInputRef,
1212
- style: {
1213
- display: "none"
1214
- },
1215
- onChange: handleFileSelect
1216
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
1217
- onClick: () => {
1218
- var _fileInputRef$current;
1219
- return (_fileInputRef$current = fileInputRef.current) === null || _fileInputRef$current === void 0 ? void 0 : _fileInputRef$current.click();
1220
- },
1221
- style: {
1222
- cursor: "pointer",
1223
- color: "#999",
1224
- padding: "8px",
1225
- display: "flex",
1226
- alignItems: "center"
1227
- },
1228
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFontawesome.FontAwesomeIcon, {
1229
- icon: _freeSolidSvgIcons.faPaperclip,
1230
- style: {
1231
- fontSize: "18px"
1232
- }
1233
- })
1234
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
1235
- onClick: handleSendMessage,
1236
- style: {
1237
- cursor: inputMessage.trim() || selectedFile ? "pointer" : "not-allowed",
1238
- color: inputMessage.trim() || selectedFile ? config.color : "#ccc",
1239
- padding: "8px",
1240
- display: "flex",
1241
- alignItems: "center",
1242
- transition: "color 0.2s"
1243
- },
1244
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFontawesome.FontAwesomeIcon, {
1245
- icon: _freeSolidSvgIcons.faPaperPlane,
1246
- style: {
1247
- fontSize: "18px"
1248
- }
1249
- })
1250
- })]
1251
- })]
1252
- });
1253
- };
1254
- const ReclamationFormModal = _ref4 => {
1255
- let {
1256
- open,
1257
- onClose
1258
- } = _ref4;
1259
- const [activeStep, setActiveStep] = (0, _react.useState)(0);
1260
- const [formData, setFormData] = (0, _react.useState)({
1261
- type: "",
1262
- service: "",
1263
- objet: "",
1264
- sujet: "",
1265
- files: []
1266
- });
1267
- const [submitted, setSubmitted] = (0, _react.useState)(false);
1268
- const [referenceNumber, setReferenceNumber] = (0, _react.useState)("");
1269
- const {
1270
- mutate: createReclamation,
1271
- isLoading
1272
- } = (0, _useReclamation.useCreateReclamation)();
1273
- const {
1274
- data: listServiceReclamation,
1275
- isFetching: isFetchingListServiceReclamation
1276
- } = (0, _useReclamation.useListServiceReclamation)();
1277
- const [error, setError] = (0, _react.useState)(null);
1278
- const errorRef = (0, _react.useRef)(null);
1279
- const CustomPopper = props => /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Popper, _objectSpread(_objectSpread({}, props), {}, {
1280
- placement: "bottom-start",
1281
- disablePortal: true
1282
- }));
1283
- const reclamationTypes = [{
1284
- codigo: "BESOIN_INFORMATIONS",
1285
- libelle: "Besoin d'informations"
1286
- }, {
1287
- codigo: "RECLAMATION",
1288
- libelle: "Réclamation"
1289
- }, {
1290
- codigo: "SIGNALER_INCIDENT_TECHNIQUE",
1291
- libelle: "Signaler un incident technique"
1292
- }];
1293
- const steps = ["Type de demande", "Service concerné", "Détails"];
1294
- const ALLOWED_FILE_TYPES = {
1295
- extensions: ".pdf,.doc,.docx,.xls,.xlsx,.jpg,.jpeg,.png,.gif",
1296
- mimeTypes: ["application/pdf", "application/msword", "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "application/vnd.ms-excel", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "image/jpeg", "image/png", "image/gif"]
1297
- };
1298
- (0, _react.useEffect)(() => {
1299
- if (!open) {
1300
- setTimeout(() => {
1301
- setActiveStep(0);
1302
- setFormData({
1303
- type: "",
1304
- service: "",
1305
- objet: "",
1306
- sujet: "",
1307
- files: []
1308
- });
1309
- setSubmitted(false);
1310
- setReferenceNumber("");
1311
- }, 300);
1312
- }
1313
- }, [open]);
1314
- (0, _react.useEffect)(() => {
1315
- if (error && errorRef.current) {
1316
- errorRef.current.scrollIntoView({
1317
- behavior: "smooth",
1318
- block: "center"
1319
- });
1320
- }
1321
- }, [error]);
1322
- const handleNext = () => {
1323
- setActiveStep(prev => prev + 1);
1324
- };
1325
- const handleBack = () => {
1326
- setActiveStep(prev => prev - 1);
1327
- };
1328
- const handleTypeChange = value => {
1329
- setFormData(prev => _objectSpread(_objectSpread({}, prev), {}, {
1330
- type: value
1331
- }));
1332
- };
1333
- const handleServiceChange = (event, value) => {
1334
- setFormData(prev => _objectSpread(_objectSpread({}, prev), {}, {
1335
- service: value
1336
- }));
1337
- };
1338
- const handleFileSelect = event => {
1339
- const newFiles = Array.from(event.target.files);
1340
- const maxSize = 2 * 1024 * 1024;
1341
- let hasErrors = false;
1342
- let errorMessages = [];
1343
- setError(null);
1344
- const validFiles = newFiles.filter(file => {
1345
- if (!ALLOWED_FILE_TYPES.mimeTypes.includes(file.type)) {
1346
- const errorMsg = "".concat(file.name, ": Type de fichier non autoris\xE9.");
1347
- errorMessages.push(errorMsg);
1348
- hasErrors = true;
1349
- return false;
1350
- }
1351
- if (file.size > maxSize) {
1352
- const errorMsg = "".concat(file.name, ": Taille sup\xE9rieure \xE0 2 Mo.");
1353
- errorMessages.push(errorMsg);
1354
- hasErrors = true;
1355
- return false;
1356
- }
1357
- return true;
1358
- });
1359
- if (hasErrors) {
1360
- const fullError = errorMessages.join(" ");
1361
- setError(fullError);
1362
- _reactToastify.toast.error(fullError);
1363
- }
1364
- setFormData(prev => _objectSpread(_objectSpread({}, prev), {}, {
1365
- files: [...prev.files, ...validFiles]
1366
- }));
1367
- };
1368
- const removeFile = indexToRemove => {
1369
- setFormData(prev => _objectSpread(_objectSpread({}, prev), {}, {
1370
- files: prev.files.filter((_, index) => index !== indexToRemove)
1371
- }));
1372
- };
1373
- const handleSubmit = () => {
1374
- setError(null);
1375
- createReclamation(formData, {
1376
- onSuccess: res => {
1377
- setReferenceNumber(res === null || res === void 0 ? void 0 : res.reference);
1378
- setSubmitted(true);
1379
- setError(null);
1380
- },
1381
- onError: err => {
1382
- var _err$response$data$me, _err$response;
1383
- const errorMessage = (_err$response$data$me = (_err$response = err.response) === null || _err$response === void 0 || (_err$response = _err$response.data) === null || _err$response === void 0 ? void 0 : _err$response.message) !== null && _err$response$data$me !== void 0 ? _err$response$data$me : "Une erreur est survenue, veuillez réessayer plus tard.";
1384
- setError(errorMessage);
1385
- _reactToastify.toast.error(errorMessage);
1386
- }
1387
- });
1388
- };
1389
- const handleClose = () => {
1390
- setError(null);
1391
- onClose();
1392
- };
1393
- const canProceedStep1 = formData.type !== "";
1394
- const canProceedStep2 = formData.service !== "";
1395
- const canSubmit = formData.objet && formData.sujet;
1396
- const renderStepContent = () => {
1397
- switch (activeStep) {
1398
- case 0:
1399
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Fade, {
1400
- in: true,
1401
- timeout: 500,
1402
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
1403
- className: "step-content",
1404
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
1405
- variant: "h5",
1406
- className: "step-title",
1407
- gutterBottom: true,
1408
- children: "Quel est le type de votre demande ?"
1409
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
1410
- variant: "body2",
1411
- color: "text.secondary",
1412
- sx: {
1413
- mb: 4
1414
- },
1415
- children: "S\xE9lectionnez le type qui correspond le mieux \xE0 votre besoin"
1416
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.FormControl, {
1417
- fullWidth: true,
1418
- variant: "outlined",
1419
- className: "type-select",
1420
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.InputLabel, {
1421
- id: "type-label",
1422
- children: "Type de demande"
1423
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Select, {
1424
- labelId: "type-label",
1425
- value: formData.type,
1426
- onChange: e => handleTypeChange(e.target.value),
1427
- label: "Type de demande",
1428
- children: reclamationTypes.map(type => /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.MenuItem, {
1429
- value: type.codigo,
1430
- children: type.libelle
1431
- }, type.codigo))
1432
- })]
1433
- })]
1434
- })
1435
- });
1436
- case 1:
1437
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Fade, {
1438
- in: true,
1439
- timeout: 500,
1440
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
1441
- className: "step-content",
1442
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
1443
- variant: "h5",
1444
- className: "step-title",
1445
- gutterBottom: true,
1446
- children: "Quel service est concern\xE9 ?"
1447
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
1448
- variant: "body2",
1449
- color: "text.secondary",
1450
- sx: {
1451
- mb: formData.type === "Besoin d'informations" ? 3 : 4
1452
- },
1453
- children: "Recherchez et s\xE9lectionnez le service appropri\xE9"
1454
- }), formData.type === "Besoin d'informations" && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Alert, {
1455
- severity: "Besoin d'informations",
1456
- icon: false,
1457
- sx: {
1458
- mb: 3,
1459
- pt: 1,
1460
- pb: 1,
1461
- borderRadius: 2,
1462
- backgroundColor: "#f5f9ff",
1463
- border: "1px solid #90caf9",
1464
- display: "flex",
1465
- flexDirection: "column",
1466
- maxWidth: 400,
1467
- mx: "auto"
1468
- },
1469
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.AlertTitle, {
1470
- sx: {
1471
- fontWeight: 600
1472
- },
1473
- children: "Besoin d'aide imm\xE9diate ?"
1474
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Typography, {
1475
- variant: "body2",
1476
- sx: {
1477
- mt: 0.5,
1478
- textAlign: "center"
1479
- },
1480
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("strong", {
1481
- children: "Assistance t\xE9l\xE9phonique: "
1482
- }), " \uD83D\uDCDE +212 520 47 31 00"]
1483
- })]
1484
- }), formData.type === "Besoin d'informations" && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
1485
- sx: {
1486
- mt: 3
1487
- }
1488
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Autocomplete, {
1489
- options: listServiceReclamation || [],
1490
- loading: isFetchingListServiceReclamation,
1491
- value: formData.service || "",
1492
- onChange: handleServiceChange,
1493
- getOptionLabel: option => (option === null || option === void 0 ? void 0 : option.libelle) || "",
1494
- renderInput: params => /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.TextField, _objectSpread(_objectSpread({}, params), {}, {
1495
- label: "Rechercher un service",
1496
- placeholder: "Commencez \xE0 taper...",
1497
- variant: "outlined",
1498
- fullWidth: true
1499
- })),
1500
- renderOption: (props, option) => /*#__PURE__*/(0, _jsxRuntime.jsx)("li", _objectSpread(_objectSpread({}, props), {}, {
1501
- className: "service-option",
1502
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
1503
- display: "flex",
1504
- alignItems: "center",
1505
- gap: 1,
1506
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
1507
- className: "service-bullet"
1508
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
1509
- children: option === null || option === void 0 ? void 0 : option.libelle
1510
- })]
1511
- })
1512
- })),
1513
- PopperComponent: CustomPopper,
1514
- noOptionsText: "Aucun service trouv\xE9",
1515
- className: "service-autocomplete"
1516
- })]
1517
- })
1518
- });
1519
- case 2:
1520
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Fade, {
1521
- in: true,
1522
- timeout: 500,
1523
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
1524
- className: "step-content details-step",
1525
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
1526
- variant: "h5",
1527
- className: "step-title",
1528
- gutterBottom: true,
1529
- children: "Compl\xE9tez votre demande"
1530
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
1531
- variant: "body2",
1532
- color: "text.secondary",
1533
- sx: {
1534
- mb: 4
1535
- },
1536
- children: "Fournissez les d\xE9tails n\xE9cessaires pour traiter votre demande"
1537
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
1538
- className: "form-fields",
1539
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.TextField, {
1540
- fullWidth: true,
1541
- required: true,
1542
- label: "Objet",
1543
- placeholder: "R\xE9sum\xE9 de votre demande",
1544
- value: formData.objet,
1545
- onChange: e => setFormData(prev => _objectSpread(_objectSpread({}, prev), {}, {
1546
- objet: e.target.value
1547
- })),
1548
- variant: "outlined",
1549
- className: "form-field"
1550
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.TextField, {
1551
- fullWidth: true,
1552
- required: true,
1553
- label: "Sujet",
1554
- placeholder: "D\xE9crivez en d\xE9tail votre demande...",
1555
- value: formData.sujet,
1556
- onChange: e => setFormData(prev => _objectSpread(_objectSpread({}, prev), {}, {
1557
- sujet: e.target.value
1558
- })),
1559
- variant: "outlined",
1560
- multiline: true,
1561
- rows: 6,
1562
- className: "form-field",
1563
- inputProps: {
1564
- maxLength: 500
1565
- }
1566
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
1567
- className: "file-upload-section",
1568
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
1569
- type: "file",
1570
- id: "file-upload",
1571
- accept: ALLOWED_FILE_TYPES.extensions,
1572
- hidden: true,
1573
- multiple: true,
1574
- onChange: handleFileSelect
1575
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
1576
- htmlFor: "file-upload",
1577
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
1578
- variant: "outlined",
1579
- component: "span",
1580
- startIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_iconsMaterial.CloudUpload, {}),
1581
- className: "upload-button",
1582
- fullWidth: true,
1583
- children: "Joindre des fichiers (optionnel)"
1584
- })
1585
- }), error && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Alert, {
1586
- ref: errorRef,
1587
- severity: "error",
1588
- onClose: () => setError(null),
1589
- style: {
1590
- marginTop: "12px"
1591
- },
1592
- children: error
1593
- }), formData.files.length > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
1594
- sx: {
1595
- mt: 2,
1596
- display: "flex",
1597
- flexWrap: "wrap",
1598
- gap: 1
1599
- },
1600
- children: formData.files.map((file, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Chip, {
1601
- icon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_iconsMaterial.AttachFile, {}),
1602
- label: file.name,
1603
- onDelete: () => removeFile(index),
1604
- className: "file-chip",
1605
- color: "primary",
1606
- variant: "outlined"
1607
- }, index))
1608
- })]
1609
- })]
1610
- })]
1611
- })
1612
- });
1613
- default:
1614
- return null;
1615
- }
1616
- };
1617
- if (submitted) {
1618
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Dialog, {
1619
- open: open,
1620
- onClose: handleClose,
1621
- maxWidth: "sm",
1622
- fullWidth: true,
1623
- className: "reclamation-modal success-modal",
1624
- PaperProps: {
1625
- className: "modal-paper"
1626
- },
1627
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.DialogContent, {
1628
- className: "success-content",
1629
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Zoom, {
1630
- in: true,
1631
- timeout: 500,
1632
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
1633
- className: "success-container",
1634
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_iconsMaterial.CheckCircle, {
1635
- className: "success-icon"
1636
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
1637
- variant: "h5",
1638
- className: "success-title",
1639
- gutterBottom: true,
1640
- children: "Demande enregistr\xE9e !"
1641
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
1642
- variant: "body1",
1643
- color: "text.secondary",
1644
- sx: {
1645
- mb: 3
1646
- },
1647
- children: "Votre demande a \xE9t\xE9 prise en charge avec succ\xE8s"
1648
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Paper, {
1649
- elevation: 3,
1650
- className: "reference-box",
1651
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
1652
- variant: "h5",
1653
- className: "reference-number",
1654
- children: referenceNumber
1655
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
1656
- variant: "caption",
1657
- color: "text.secondary",
1658
- sx: {
1659
- mt: 1,
1660
- display: "block"
1661
- },
1662
- children: "Conservez ce num\xE9ro pour suivre votre demande"
1663
- })]
1664
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
1665
- variant: "contained",
1666
- onClick: handleClose,
1667
- size: "large",
1668
- className: "close-success-button",
1669
- fullWidth: true,
1670
- children: "Fermer"
1671
- })]
1672
- })
1673
- })
1674
- })
1675
- });
1676
- }
1677
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Dialog, {
1678
- open: open,
1679
- onClose: handleClose,
1680
- maxWidth: "md",
1681
- fullWidth: true,
1682
- scroll: "body",
1683
- className: "reclamation-modal",
1684
- PaperProps: {
1685
- className: "modal-paper"
1686
- },
1687
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
1688
- className: "modal-header",
1689
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
1690
- display: "flex",
1691
- alignItems: "center",
1692
- gap: 2,
1693
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
1694
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
1695
- variant: "h6",
1696
- className: "header-title",
1697
- children: "Nouvelle r\xE9clamation"
1698
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Typography, {
1699
- variant: "caption",
1700
- color: "white",
1701
- children: ["Remplissez ce formulaire en ", steps.length, " \xE9tapes"]
1702
- })]
1703
- })
1704
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.IconButton, {
1705
- onClick: handleClose,
1706
- className: "close-button",
1707
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_iconsMaterial.Close, {})
1708
- })]
1709
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
1710
- className: "progress-section",
1711
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.LinearProgress, {
1712
- variant: "determinate",
1713
- value: activeStep / (steps.length - 1) * 100,
1714
- className: "progress-bar"
1715
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Stepper, {
1716
- activeStep: activeStep,
1717
- className: "stepper",
1718
- children: steps.map(label => /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Step, {
1719
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.StepLabel, {
1720
- children: label
1721
- })
1722
- }, label))
1723
- })]
1724
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.DialogContent, {
1725
- className: "modal-content",
1726
- style: {
1727
- overflow: activeStep === 1 ? "visible" : "auto"
1728
- },
1729
- children: renderStepContent()
1730
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
1731
- className: "modal-footer",
1732
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
1733
- onClick: handleBack,
1734
- disabled: activeStep === 0,
1735
- startIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_iconsMaterial.ArrowBack, {}),
1736
- className: "back-button",
1737
- children: "Retour"
1738
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
1739
- flex: 1
1740
- }), activeStep < steps.length - 1 ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
1741
- variant: "contained",
1742
- onClick: handleNext,
1743
- endIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_iconsMaterial.ArrowForward, {}),
1744
- disabled: activeStep === 0 && !canProceedStep1 || activeStep === 1 && !canProceedStep2,
1745
- className: "next-button",
1746
- children: "Suivant"
1747
- }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
1748
- variant: "contained",
1749
- onClick: handleSubmit,
1750
- disabled: !canSubmit || isLoading,
1751
- className: "submit-button",
1752
- startIcon: isLoading ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.CircularProgress, {
1753
- size: 16,
1754
- sx: {
1755
- color: "var(--primary-color, #222f67)"
1756
- }
1757
- }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_iconsMaterial.CheckCircle, {}),
1758
- children: isLoading ? "Envoi en cours..." : "Soumettre"
1759
- })]
1760
- })]
1761
- });
1762
- };
1763
- const ReclamationsList = _ref5 => {
1764
- var _selectedReclamation$, _selectedReclamation$2, _selectedReclamation$3;
1765
- let {
1766
- onClose
1767
- } = _ref5;
1768
- const queryClient = (0, _reactQuery.useQueryClient)();
1769
- const [selectedReclamation, setSelectedReclamation] = (0, _react.useState)(null);
1770
- const [detailsDialogOpen, setDetailsDialogOpen] = (0, _react.useState)(false);
1771
- const [page, setPage] = (0, _react.useState)(1);
1772
- const [search, setSearch] = (0, _react.useState)();
1773
- const [searchKey, setSearchKey] = (0, _react.useState)("");
1774
- const STATUT_REPONDUE = "REPONDUE";
1775
- const STATUT_COLOR_MAP = {
1776
- EN_ATTENTE: "#2196F3",
1777
- EN_COURS: "#FF9800",
1778
- REPONDUE: "#9C27B0",
1779
- REOUVERTE: "#FF5722",
1780
- CLOTUREE: "#4CAF50",
1781
- TRAITE: "#4CAF50"
1782
- };
1783
- const STATUT_ICON_MAP = {
1784
- EN_ATTENTE: "🕐",
1785
- EN_COURS: "⚙️",
1786
- REPONDUE: "💬",
1787
- REOUVERTE: "🔄",
1788
- CLOTUREE: "🔒"
1789
- };
1790
- const getStatusColorByCode = code => STATUT_COLOR_MAP[(code || "").toUpperCase()] || "#757575";
1791
- const [reouvreDialogOpen, setReouvreDialogOpen] = (0, _react.useState)(false);
1792
- const [reouvreDescription, setReouvreDescription] = (0, _react.useState)("");
1793
- const [reouvreFiles, setReouvreFiles] = (0, _react.useState)([]);
1794
- const reouvreFileInputRef = (0, _react.useRef)(null);
1795
- const {
1796
- data: reclamations,
1797
- isFetching,
1798
- error
1799
- } = (0, _useReclamation.useListReclamation)(page, searchKey);
1800
- const {
1801
- mutate: downloadDocument,
1802
- isLoading: isDownloading,
1803
- error: errorDownloadDocument
1804
- } = (0, _useReclamation.useDownloadDocument)();
1805
- const {
1806
- mutate: clotureReclamation,
1807
- isLoading: isCloturing
1808
- } = (0, _useReclamation.useClotureReclamation)();
1809
- const {
1810
- mutate: reouvreReclamation,
1811
- isLoading: isReouvring
1812
- } = (0, _useReclamation.useReouvreReclamation)();
1813
- const getStatusColor = statut => {
1814
- switch ((statut || "").toLowerCase()) {
1815
- case "traité":
1816
- case "cloturee":
1817
- return "#4CAF50";
1818
- case "en cours":
1819
- return "#FF9800";
1820
- case "en attente":
1821
- return "#2196F3";
1822
- case "repondue":
1823
- return "#9C27B0";
1824
- case "reouverte":
1825
- return "#FF5722";
1826
- default:
1827
- return "#757575";
1828
- }
1829
- };
1830
- const renderTextWithLinks = text => {
1831
- if (!text) return null;
1832
- const parts = text.split(/(https?:\/\/[^\s)]+)/g);
1833
- return parts.map((part, i) => /^https?:\/\//.test(part) ? /*#__PURE__*/(0, _jsxRuntime.jsx)("a", {
1834
- href: part,
1835
- target: "_blank",
1836
- rel: "noopener noreferrer",
1837
- style: {
1838
- color: "var(--primary-color, #222f67)",
1839
- wordBreak: "break-all"
1840
- },
1841
- children: part
1842
- }, i) : /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
1843
- children: part
1844
- }, i));
1845
- };
1846
- const handleReclamationClick = reclamation => {
1847
- setSelectedReclamation(reclamation);
1848
- setDetailsDialogOpen(true);
1849
- };
1850
- const handleCloseDetails = () => {
1851
- setDetailsDialogOpen(false);
1852
- setSelectedReclamation(null);
1853
- };
1854
- const handleCloturer = () => {
1855
- if (!(selectedReclamation !== null && selectedReclamation !== void 0 && selectedReclamation.id)) return;
1856
- clotureReclamation(selectedReclamation.id, {
1857
- onSuccess: () => {
1858
- queryClient.invalidateQueries("reclamations");
1859
- handleCloseDetails();
1860
- _reactToastify.toast.success("Réclamation clôturée avec succès.");
1861
- },
1862
- onError: err => {
1863
- var _err$response$data$me2, _err$response2;
1864
- const msg = (_err$response$data$me2 = (_err$response2 = err.response) === null || _err$response2 === void 0 || (_err$response2 = _err$response2.data) === null || _err$response2 === void 0 ? void 0 : _err$response2.message) !== null && _err$response$data$me2 !== void 0 ? _err$response$data$me2 : "Une erreur est survenue lors de la clôture.";
1865
- _reactToastify.toast.error(msg);
1866
- }
1867
- });
1868
- };
1869
- const handleOpenReouvreDialog = () => {
1870
- setReouvreDescription("");
1871
- setReouvreFiles([]);
1872
- setReouvreDialogOpen(true);
1873
- };
1874
- const handleCloseReouvreDialog = () => {
1875
- setReouvreDialogOpen(false);
1876
- setReouvreDescription("");
1877
- setReouvreFiles([]);
1878
- };
1879
- const handleReouvreFileSelect = e => {
1880
- const selected = Array.from(e.target.files);
1881
- setReouvreFiles(prev => [...prev, ...selected]);
1882
- e.target.value = "";
1883
- };
1884
- const handleRemoveReouvreFile = index => {
1885
- setReouvreFiles(prev => prev.filter((_, i) => i !== index));
1886
- };
1887
- const handleSubmitReouvreture = () => {
1888
- if (!(selectedReclamation !== null && selectedReclamation !== void 0 && selectedReclamation.id) || !reouvreDescription.trim()) return;
1889
- const formData = new FormData();
1890
- formData.append("description", reouvreDescription.trim());
1891
- reouvreFiles.forEach(file => formData.append("files", file));
1892
- reouvreReclamation({
1893
- id: selectedReclamation.id,
1894
- formData
1895
- }, {
1896
- onSuccess: () => {
1897
- queryClient.invalidateQueries("reclamations");
1898
- handleCloseReouvreDialog();
1899
- handleCloseDetails();
1900
- _reactToastify.toast.success("Réclamation réouverte avec succès.");
1901
- },
1902
- onError: err => {
1903
- var _err$response$data$me3, _err$response3;
1904
- const msg = (_err$response$data$me3 = (_err$response3 = err.response) === null || _err$response3 === void 0 || (_err$response3 = _err$response3.data) === null || _err$response3 === void 0 ? void 0 : _err$response3.message) !== null && _err$response$data$me3 !== void 0 ? _err$response$data$me3 : "Une erreur est survenue lors de la réouverture.";
1905
- _reactToastify.toast.error(msg);
1906
- }
1907
- });
1908
- };
1909
- const formatDate = dateString => {
1910
- const date = new Date(dateString);
1911
- return date.toLocaleDateString("fr-FR", {
1912
- day: "2-digit",
1913
- month: "2-digit",
1914
- year: "numeric",
1915
- hour: "2-digit",
1916
- minute: "2-digit"
1917
- });
1918
- };
1919
- const handleDownload = (documentGuid, documentName) => {
1920
- downloadDocument(documentGuid, {
1921
- onSuccess: res => {
1922
- if (!(res !== null && res !== void 0 && res.data) || !(res !== null && res !== void 0 && res.fileName)) {
1923
- console.error("No file data or filename received");
1924
- return;
1925
- }
1926
- const byteCharacters = atob(res.data);
1927
- const byteNumbers = new Array(byteCharacters.length);
1928
- for (let i = 0; i < byteCharacters.length; i++) {
1929
- byteNumbers[i] = byteCharacters.charCodeAt(i);
1930
- }
1931
- const byteArray = new Uint8Array(byteNumbers);
1932
- const blob = new Blob([byteArray], {
1933
- type: "application/octet-stream"
1934
- });
1935
- const link = document.createElement("a");
1936
- link.href = URL.createObjectURL(blob);
1937
- link.download = documentName;
1938
- document.body.appendChild(link);
1939
- link.click();
1940
- document.body.removeChild(link);
1941
- URL.revokeObjectURL(link.href);
1942
- },
1943
- onError: err => {
1944
- console.error("Error downloading document:", err);
1945
- }
1946
- });
1947
- };
1948
- const onSearch = () => {
1949
- setPage(1);
1950
- setSearchKey(search);
1951
- };
1952
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
1953
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
1954
- style: {
1955
- flex: 1,
1956
- display: "flex",
1957
- flexDirection: "column",
1958
- backgroundColor: "#f5f5f5",
1959
- minHeight: 0
1960
- },
1961
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
1962
- style: {
1963
- display: "flex",
1964
- justifyContent: "space-between",
1965
- alignItems: "center",
1966
- padding: "16px",
1967
- backgroundColor: "white",
1968
- borderBottom: "1px solid #e0e0e0"
1969
- },
1970
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
1971
- style: {
1972
- display: "flex",
1973
- alignItems: "center",
1974
- gap: "12px"
1975
- },
1976
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFontawesome.FontAwesomeIcon, {
1977
- icon: _freeSolidSvgIcons.faClipboardList,
1978
- style: {
1979
- color: "var(--primary-color, #222f67)",
1980
- fontSize: "20px"
1981
- }
1982
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
1983
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
1984
- component: "div",
1985
- sx: {
1986
- fontWeight: "600",
1987
- color: "#333",
1988
- fontSize: "16px",
1989
- fontFamily: WIDGET_FONT,
1990
- margin: 0,
1991
- lineHeight: "normal"
1992
- },
1993
- children: "Mes r\xE9clamations"
1994
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Typography, {
1995
- component: "div",
1996
- sx: {
1997
- color: "#999",
1998
- fontSize: "12px",
1999
- fontFamily: WIDGET_FONT,
2000
- margin: 0,
2001
- lineHeight: "normal"
2002
- },
2003
- children: [(reclamations === null || reclamations === void 0 ? void 0 : reclamations.totalElements) || 0, " r\xE9clamation(s)"]
2004
- })]
2005
- })]
2006
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
2007
- onClick: onClose,
2008
- style: {
2009
- cursor: "pointer",
2010
- color: "#666",
2011
- padding: "4px",
2012
- display: "flex",
2013
- alignItems: "center"
2014
- },
2015
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFontawesome.FontAwesomeIcon, {
2016
- icon: _freeSolidSvgIcons.faTimes,
2017
- style: {
2018
- fontSize: "16px"
2019
- }
2020
- })
2021
- })]
2022
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2023
- className: "search-fields",
2024
- style: {
2025
- display: "flex",
2026
- justifyContent: "center",
2027
- padding: "12px",
2028
- paddingBottom: "0px"
2029
- },
2030
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.TextField, {
2031
- placeholder: "R\xE9clamation / R\xE9f\xE9rence",
2032
- variant: "outlined",
2033
- size: "small",
2034
- value: search,
2035
- onChange: e => setSearch(e.target.value),
2036
- fullWidth: true,
2037
- InputLabelProps: {
2038
- style: {
2039
- fontSize: 12
2040
- }
2041
- },
2042
- sx: {
2043
- "& .MuiOutlinedInput-root.Mui-focused .MuiOutlinedInput-notchedOutline": {
2044
- borderColor: "var(--primary-color, #222f67)"
2045
- }
2046
- }
2047
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
2048
- onClick: onSearch,
2049
- variant: "contained",
2050
- sx: {
2051
- minWidth: "48px",
2052
- width: "48px",
2053
- height: "40px",
2054
- borderRadius: "5px",
2055
- backgroundColor: "var(--primary-color, #222f67)",
2056
- "&:hover": {
2057
- backgroundColor: "var(--primary-color, #222f67)",
2058
- opacity: 0.9
2059
- },
2060
- flexShrink: 0,
2061
- marginLeft: "0px",
2062
- boxShadow: "none",
2063
- padding: 0
2064
- },
2065
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_iconsMaterial.Search, {
2066
- sx: {
2067
- color: "white",
2068
- fontSize: "25px"
2069
- }
2070
- })
2071
- })]
2072
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
2073
- style: {
2074
- flex: 1,
2075
- overflowY: "auto",
2076
- padding: "8px",
2077
- minHeight: 0
2078
- },
2079
- children: isFetching ? /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
2080
- style: {
2081
- display: "flex",
2082
- justifyContent: "center",
2083
- padding: "24px"
2084
- },
2085
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.CircularProgress, {
2086
- size: 32,
2087
- sx: {
2088
- color: "var(--primary-color, #222f67)"
2089
- }
2090
- })
2091
- }) : (reclamations === null || reclamations === void 0 ? void 0 : reclamations.totalElements) === 0 ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2092
- style: {
2093
- display: "flex",
2094
- flexDirection: "column",
2095
- alignItems: "center",
2096
- justifyContent: "center",
2097
- padding: "40px 20px",
2098
- color: "#999"
2099
- },
2100
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFontawesome.FontAwesomeIcon, {
2101
- icon: _freeSolidSvgIcons.faClipboardList,
2102
- style: {
2103
- fontSize: "48px",
2104
- marginBottom: "32px"
2105
- }
2106
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
2107
- component: "div",
2108
- sx: {
2109
- fontSize: "14px",
2110
- textAlign: "center",
2111
- fontFamily: WIDGET_FONT,
2112
- lineHeight: "normal",
2113
- color: "#999"
2114
- },
2115
- children: "Aucune r\xE9clamation trouv\xE9e"
2116
- })]
2117
- }) : /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2118
- children: [((reclamations === null || reclamations === void 0 ? void 0 : reclamations.content) || []).map(reclamation => /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2119
- onClick: () => handleReclamationClick(reclamation),
2120
- style: {
2121
- backgroundColor: "white",
2122
- borderRadius: "8px",
2123
- padding: "16px",
2124
- marginBottom: "5px",
2125
- cursor: "pointer",
2126
- boxShadow: "0 1px 3px rgba(0,0,0,0.1)",
2127
- transition: "all 0.2s ease",
2128
- border: "1px solid #e0e0e0"
2129
- },
2130
- onMouseEnter: e => {
2131
- e.currentTarget.style.boxShadow = "0 4px 8px rgba(0,0,0,0.15)";
2132
- e.currentTarget.style.transform = "translateY(-2px)";
2133
- },
2134
- onMouseLeave: e => {
2135
- e.currentTarget.style.boxShadow = "0 1px 3px rgba(0,0,0,0.1)";
2136
- e.currentTarget.style.transform = "translateY(0)";
2137
- },
2138
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2139
- style: {
2140
- display: "flex",
2141
- justifyContent: "space-between",
2142
- alignItems: "center",
2143
- marginBottom: "12px"
2144
- },
2145
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
2146
- component: "div",
2147
- sx: {
2148
- fontWeight: "600",
2149
- color: "var(--primary-color, #222f67)",
2150
- fontSize: "14px",
2151
- fontFamily: WIDGET_FONT,
2152
- lineHeight: "normal"
2153
- },
2154
- children: reclamation === null || reclamation === void 0 ? void 0 : reclamation.reference
2155
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
2156
- component: "div",
2157
- sx: {
2158
- padding: "4px 12px",
2159
- borderRadius: "12px",
2160
- backgroundColor: getStatusColor(reclamation === null || reclamation === void 0 ? void 0 : reclamation.statut) + "20",
2161
- color: getStatusColor(reclamation === null || reclamation === void 0 ? void 0 : reclamation.statut),
2162
- fontSize: "11px",
2163
- fontWeight: "600",
2164
- fontFamily: WIDGET_FONT,
2165
- lineHeight: "normal"
2166
- },
2167
- children: reclamation === null || reclamation === void 0 ? void 0 : reclamation.statut
2168
- })]
2169
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
2170
- component: "div",
2171
- sx: {
2172
- fontWeight: "500",
2173
- color: "#333",
2174
- fontSize: "13px",
2175
- marginBottom: "8px",
2176
- fontFamily: WIDGET_FONT,
2177
- lineHeight: "normal"
2178
- },
2179
- children: reclamation === null || reclamation === void 0 ? void 0 : reclamation.objet
2180
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2181
- style: {
2182
- display: "flex",
2183
- justifyContent: "space-between",
2184
- alignItems: "center"
2185
- },
2186
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
2187
- component: "div",
2188
- sx: {
2189
- color: "#999",
2190
- fontSize: "11px",
2191
- fontFamily: WIDGET_FONT,
2192
- lineHeight: "normal"
2193
- },
2194
- children: formatDate(reclamation === null || reclamation === void 0 ? void 0 : reclamation.dateCreation)
2195
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Typography, {
2196
- component: "div",
2197
- sx: {
2198
- display: "flex",
2199
- alignItems: "center",
2200
- gap: "4px",
2201
- color: "var(--primary-color, #222f67)",
2202
- fontSize: "11px",
2203
- fontWeight: "500",
2204
- fontFamily: WIDGET_FONT,
2205
- lineHeight: "normal"
2206
- },
2207
- children: ["Voir d\xE9tails", /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFontawesome.FontAwesomeIcon, {
2208
- icon: _freeSolidSvgIcons.faEye
2209
- })]
2210
- })]
2211
- })]
2212
- }, reclamation === null || reclamation === void 0 ? void 0 : reclamation.id)), (reclamations === null || reclamations === void 0 ? void 0 : reclamations.totalPages) > 1 && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
2213
- style: {
2214
- display: "flex",
2215
- justifyContent: "center",
2216
- marginTop: "8px",
2217
- marginBottom: "8px"
2218
- },
2219
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Pagination, {
2220
- size: "small",
2221
- variant: "outlined",
2222
- count: (reclamations === null || reclamations === void 0 ? void 0 : reclamations.totalPages) || 0,
2223
- page: page,
2224
- onChange: (event, value) => setPage(value)
2225
- })
2226
- })]
2227
- })
2228
- })]
2229
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Dialog, {
2230
- open: detailsDialogOpen,
2231
- onClose: handleCloseDetails,
2232
- maxWidth: "sm",
2233
- fullWidth: true,
2234
- PaperProps: {
2235
- sx: {
2236
- borderRadius: 3,
2237
- boxShadow: "0 8px 32px rgba(0,0,0,0.12)"
2238
- }
2239
- },
2240
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.DialogTitle, {
2241
- sx: {
2242
- backgroundColor: "#f8f9fa",
2243
- borderBottom: "1px solid #e0e0e0",
2244
- display: "flex",
2245
- justifyContent: "space-between",
2246
- alignItems: "center",
2247
- padding: "20px 24px"
2248
- },
2249
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2250
- style: {
2251
- display: "flex",
2252
- alignItems: "center",
2253
- gap: "12px"
2254
- },
2255
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFontawesome.FontAwesomeIcon, {
2256
- icon: _freeSolidSvgIcons.faInfoCircle,
2257
- style: {
2258
- color: "var(--primary-color, #222f67)",
2259
- fontSize: "20px"
2260
- }
2261
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2262
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
2263
- component: "div",
2264
- sx: {
2265
- fontWeight: "700",
2266
- fontSize: "16px",
2267
- margin: 0
2268
- },
2269
- children: "D\xE9tails de la r\xE9clamation"
2270
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
2271
- component: "div",
2272
- sx: {
2273
- color: "#666",
2274
- fontSize: "12px",
2275
- marginTop: "3px"
2276
- },
2277
- children: selectedReclamation === null || selectedReclamation === void 0 ? void 0 : selectedReclamation.reference
2278
- })]
2279
- })]
2280
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Chip, {
2281
- label: selectedReclamation === null || selectedReclamation === void 0 ? void 0 : selectedReclamation.statut,
2282
- size: "small",
2283
- sx: {
2284
- backgroundColor: getStatusColor((selectedReclamation === null || selectedReclamation === void 0 ? void 0 : selectedReclamation.statut) || "") + "20",
2285
- color: getStatusColor((selectedReclamation === null || selectedReclamation === void 0 ? void 0 : selectedReclamation.statut) || ""),
2286
- fontWeight: 600,
2287
- fontSize: "11px"
2288
- }
2289
- })]
2290
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.DialogContent, {
2291
- sx: {
2292
- padding: "24px"
2293
- },
2294
- children: selectedReclamation && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2295
- style: {
2296
- display: "flex",
2297
- flexDirection: "column",
2298
- gap: "20px"
2299
- },
2300
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2301
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
2302
- component: "div",
2303
- sx: {
2304
- fontSize: "11px",
2305
- color: "#999",
2306
- fontWeight: "500",
2307
- marginBottom: "6px",
2308
- textTransform: "uppercase",
2309
- letterSpacing: "0.5px",
2310
- fontWeight: "500",
2311
- fontFamily: WIDGET_FONT
2312
- },
2313
- children: "Type de demande"
2314
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
2315
- component: "div",
2316
- sx: {
2317
- fontSize: "14px",
2318
- color: "#333",
2319
- fontWeight: "500",
2320
- fontFamily: WIDGET_FONT
2321
- },
2322
- children: selectedReclamation === null || selectedReclamation === void 0 ? void 0 : selectedReclamation.type
2323
- })]
2324
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2325
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
2326
- component: "div",
2327
- sx: {
2328
- fontSize: "11px",
2329
- color: "#999",
2330
- fontWeight: "500",
2331
- marginBottom: "6px",
2332
- textTransform: "uppercase",
2333
- letterSpacing: "0.5px",
2334
- fontFamily: WIDGET_FONT
2335
- },
2336
- children: "Service concern\xE9"
2337
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
2338
- component: "div",
2339
- sx: {
2340
- fontSize: "14px",
2341
- color: "#333",
2342
- fontWeight: "500",
2343
- fontFamily: WIDGET_FONT
2344
- },
2345
- children: selectedReclamation === null || selectedReclamation === void 0 ? void 0 : selectedReclamation.service
2346
- })]
2347
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2348
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
2349
- component: "div",
2350
- sx: {
2351
- fontSize: "11px",
2352
- color: "#999",
2353
- fontWeight: "500",
2354
- marginBottom: "6px",
2355
- textTransform: "uppercase",
2356
- letterSpacing: "0.5px",
2357
- fontFamily: WIDGET_FONT
2358
- },
2359
- children: "R\xE9f\xE9rence"
2360
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
2361
- component: "div",
2362
- sx: {
2363
- fontSize: "14px",
2364
- color: "#333",
2365
- fontWeight: "500",
2366
- fontFamily: WIDGET_FONT
2367
- },
2368
- children: selectedReclamation === null || selectedReclamation === void 0 ? void 0 : selectedReclamation.reference
2369
- })]
2370
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2371
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
2372
- component: "div",
2373
- sx: {
2374
- fontSize: "11px",
2375
- color: "#999",
2376
- fontWeight: "500",
2377
- marginBottom: "6px",
2378
- textTransform: "uppercase",
2379
- letterSpacing: "0.5px",
2380
- fontFamily: WIDGET_FONT
2381
- },
2382
- children: "Objet"
2383
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
2384
- component: "div",
2385
- sx: {
2386
- fontSize: "14px",
2387
- color: "#333",
2388
- fontWeight: "500",
2389
- fontFamily: WIDGET_FONT
2390
- },
2391
- children: selectedReclamation === null || selectedReclamation === void 0 ? void 0 : selectedReclamation.objet
2392
- })]
2393
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2394
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
2395
- component: "div",
2396
- sx: {
2397
- fontSize: "11px",
2398
- color: "#999",
2399
- fontWeight: "500",
2400
- marginBottom: "6px",
2401
- textTransform: "uppercase",
2402
- letterSpacing: "0.5px",
2403
- fontFamily: WIDGET_FONT
2404
- },
2405
- children: "Description"
2406
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
2407
- component: "div",
2408
- sx: {
2409
- fontSize: "14px",
2410
- color: "#333",
2411
- lineHeight: "1.6",
2412
- backgroundColor: "#f8f9fa",
2413
- padding: "12px",
2414
- borderRadius: "8px",
2415
- border: "1px solid #e0e0e0",
2416
- whiteSpace: "pre-line",
2417
- fontFamily: WIDGET_FONT
2418
- },
2419
- children: selectedReclamation === null || selectedReclamation === void 0 ? void 0 : selectedReclamation.description
2420
- })]
2421
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2422
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
2423
- component: "div",
2424
- sx: {
2425
- fontSize: "11px",
2426
- color: "#999",
2427
- fontWeight: "500",
2428
- marginBottom: "6px",
2429
- textTransform: "uppercase",
2430
- letterSpacing: "0.5px",
2431
- fontFamily: WIDGET_FONT
2432
- },
2433
- children: "Date de cr\xE9ation"
2434
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
2435
- component: "div",
2436
- sx: {
2437
- fontSize: "14px",
2438
- color: "#333",
2439
- fontWeight: "500",
2440
- fontFamily: WIDGET_FONT
2441
- },
2442
- children: formatDate(selectedReclamation === null || selectedReclamation === void 0 ? void 0 : selectedReclamation.dateCreation)
2443
- })]
2444
- }), (selectedReclamation === null || selectedReclamation === void 0 ? void 0 : selectedReclamation.documents) && (selectedReclamation === null || selectedReclamation === void 0 || (_selectedReclamation$ = selectedReclamation.documents) === null || _selectedReclamation$ === void 0 ? void 0 : _selectedReclamation$.length) > 0 && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2445
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Typography, {
2446
- component: "div",
2447
- sx: {
2448
- fontSize: "11px",
2449
- color: "#999",
2450
- fontWeight: "500",
2451
- marginBottom: "12px",
2452
- textTransform: "uppercase",
2453
- letterSpacing: "0.5px",
2454
- fontFamily: WIDGET_FONT
2455
- },
2456
- children: ["Pi\xE8ces jointes (", selectedReclamation === null || selectedReclamation === void 0 || (_selectedReclamation$2 = selectedReclamation.documents) === null || _selectedReclamation$2 === void 0 ? void 0 : _selectedReclamation$2.length, ")"]
2457
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
2458
- style: {
2459
- display: "flex",
2460
- flexDirection: "column",
2461
- gap: "8px"
2462
- },
2463
- children: selectedReclamation.documents.map((document, index) => /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2464
- style: {
2465
- display: "flex",
2466
- alignItems: "center",
2467
- gap: "12px",
2468
- padding: "12px",
2469
- backgroundColor: "#f8f9fa",
2470
- borderRadius: "8px",
2471
- border: "1px solid #e0e0e0",
2472
- cursor: isDownloading ? "not-allowed" : "pointer",
2473
- opacity: isDownloading ? 0.6 : 1,
2474
- transition: "all 0.2s ease"
2475
- },
2476
- onClick: () => !isDownloading && handleDownload(document.documentGuid, document.documentName),
2477
- onMouseEnter: e => {
2478
- if (!isDownloading) {
2479
- e.currentTarget.style.backgroundColor = "#e9ecef";
2480
- e.currentTarget.style.borderColor = "var(--primary-color, #222f67)";
2481
- }
2482
- },
2483
- onMouseLeave: e => {
2484
- if (!isDownloading) {
2485
- e.currentTarget.style.backgroundColor = "#f8f9fa";
2486
- e.currentTarget.style.borderColor = "#e0e0e0";
2487
- }
2488
- },
2489
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFontawesome.FontAwesomeIcon, {
2490
- icon: _freeSolidSvgIcons.faPaperclip,
2491
- style: {
2492
- color: "var(--primary-color, #222f67)",
2493
- fontSize: "16px"
2494
- }
2495
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2496
- style: {
2497
- flex: 1
2498
- },
2499
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
2500
- component: "div",
2501
- sx: {
2502
- fontSize: "13px",
2503
- color: "#333",
2504
- fontWeight: "500",
2505
- fontFamily: WIDGET_FONT
2506
- },
2507
- children: document.documentName
2508
- }), document.dateUpload && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Typography, {
2509
- component: "div",
2510
- sx: {
2511
- fontSize: "11px",
2512
- color: "#999",
2513
- marginTop: "2px",
2514
- fontFamily: WIDGET_FONT
2515
- },
2516
- children: ["Ajout\xE9 le ", formatDate(document.dateUpload)]
2517
- })]
2518
- }), isDownloading ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.CircularProgress, {
2519
- size: 16,
2520
- style: {
2521
- color: "var(--primary-color, #222f67)"
2522
- }
2523
- }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFontawesome.FontAwesomeIcon, {
2524
- icon: _freeSolidSvgIcons.faDownload,
2525
- style: {
2526
- color: "var(--primary-color, #222f67)",
2527
- fontSize: "14px"
2528
- }
2529
- })]
2530
- }, document.id || index))
2531
- })]
2532
- }), (selectedReclamation === null || selectedReclamation === void 0 || (_selectedReclamation$3 = selectedReclamation.statusHistories) === null || _selectedReclamation$3 === void 0 ? void 0 : _selectedReclamation$3.length) > 0 && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2533
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
2534
- style: {
2535
- fontSize: "11px",
2536
- color: "#999",
2537
- fontWeight: "600",
2538
- marginBottom: "16px",
2539
- textTransform: "uppercase",
2540
- letterSpacing: "0.5px",
2541
- fontFamily: WIDGET_FONT
2542
- },
2543
- children: "Historique des statuts"
2544
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2545
- style: {
2546
- position: "relative",
2547
- paddingLeft: "24px"
2548
- },
2549
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
2550
- style: {
2551
- position: "absolute",
2552
- left: "8px",
2553
- top: "6px",
2554
- bottom: "6px",
2555
- width: "2px",
2556
- backgroundColor: "#e0e0e0"
2557
- }
2558
- }), selectedReclamation.statusHistories.map((entry, index) => {
2559
- var _entry$documents;
2560
- const color = getStatusColorByCode(entry.statutApresCode);
2561
- const isLast = index === selectedReclamation.statusHistories.length - 1;
2562
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2563
- style: {
2564
- position: "relative",
2565
- marginBottom: isLast ? 0 : "20px"
2566
- },
2567
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
2568
- style: {
2569
- position: "absolute",
2570
- left: "-20px",
2571
- top: "4px",
2572
- width: "12px",
2573
- height: "12px",
2574
- borderRadius: "50%",
2575
- backgroundColor: color,
2576
- border: "2px solid white",
2577
- boxShadow: "0 0 0 2px ".concat(color)
2578
- }
2579
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2580
- style: {
2581
- backgroundColor: "#f8f9fa",
2582
- borderRadius: "8px",
2583
- border: "1px solid ".concat(color, "22"),
2584
- padding: "12px"
2585
- },
2586
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
2587
- style: {
2588
- display: "flex",
2589
- justifyContent: "space-between",
2590
- alignItems: "flex-start",
2591
- marginBottom: entry.commentaire ? "10px" : 0
2592
- },
2593
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2594
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2595
- style: {
2596
- display: "flex",
2597
- alignItems: "center",
2598
- gap: "6px",
2599
- marginBottom: "2px"
2600
- },
2601
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
2602
- style: {
2603
- fontSize: "11px"
2604
- },
2605
- children: STATUT_ICON_MAP[entry.statutApresCode] || "📋"
2606
- }), entry.statutAvantCode && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
2607
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
2608
- style: {
2609
- fontSize: "11px",
2610
- color: getStatusColorByCode(entry.statutAvantCode),
2611
- fontWeight: "600",
2612
- fontFamily: WIDGET_FONT
2613
- },
2614
- children: entry.statutAvantLibelle
2615
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
2616
- style: {
2617
- fontSize: "11px",
2618
- color: "#999"
2619
- },
2620
- children: "\u2192"
2621
- })]
2622
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
2623
- style: {
2624
- fontSize: "11px",
2625
- color,
2626
- fontWeight: "700",
2627
- fontFamily: WIDGET_FONT
2628
- },
2629
- children: entry.statutApresLibelle
2630
- })]
2631
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2632
- style: {
2633
- fontSize: "11px",
2634
- color: "#999",
2635
- fontFamily: WIDGET_FONT
2636
- },
2637
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
2638
- children: [entry.changedByNom ? entry.changedByNom : "Service Odoo", " \xB7 "]
2639
- }), formatDate(entry.dateChangement)]
2640
- })]
2641
- })
2642
- }), entry.commentaire && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
2643
- style: {
2644
- fontSize: "13px",
2645
- color: "#333",
2646
- lineHeight: "1.5",
2647
- fontFamily: WIDGET_FONT,
2648
- backgroundColor: "white",
2649
- padding: "8px 10px",
2650
- borderRadius: "6px",
2651
- border: "1px solid #e0e0e0",
2652
- whiteSpace: "pre-line"
2653
- },
2654
- children: entry.commentaire
2655
- }), entry.reponse && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2656
- style: {
2657
- marginTop: "8px",
2658
- fontSize: "13px",
2659
- color: "#333",
2660
- lineHeight: "1.5",
2661
- fontFamily: WIDGET_FONT,
2662
- backgroundColor: "#f0f4ff",
2663
- padding: "8px 10px",
2664
- borderRadius: "6px",
2665
- border: "1px solid #c5d0f0",
2666
- whiteSpace: "pre-line"
2667
- },
2668
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
2669
- style: {
2670
- fontSize: "11px",
2671
- fontWeight: "600",
2672
- color: "#555",
2673
- display: "block",
2674
- marginBottom: "4px"
2675
- },
2676
- children: "\uD83D\uDCAC R\xE9ponse"
2677
- }), renderTextWithLinks(entry.reponse)]
2678
- }), ((_entry$documents = entry.documents) === null || _entry$documents === void 0 ? void 0 : _entry$documents.length) > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
2679
- style: {
2680
- marginTop: "8px",
2681
- display: "flex",
2682
- flexDirection: "column",
2683
- gap: "6px"
2684
- },
2685
- children: entry.documents.map((doc, di) => /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2686
- style: {
2687
- display: "flex",
2688
- alignItems: "center",
2689
- gap: "8px",
2690
- padding: "6px 10px",
2691
- backgroundColor: "white",
2692
- borderRadius: "6px",
2693
- border: "1px solid #e0e0e0",
2694
- cursor: isDownloading ? "not-allowed" : "pointer",
2695
- opacity: isDownloading ? 0.6 : 1
2696
- },
2697
- onClick: () => !isDownloading && handleDownload(doc.documentGuid, doc.documentName),
2698
- onMouseEnter: e => {
2699
- if (!isDownloading) e.currentTarget.style.backgroundColor = "#f0f0f0";
2700
- },
2701
- onMouseLeave: e => {
2702
- if (!isDownloading) e.currentTarget.style.backgroundColor = "white";
2703
- },
2704
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFontawesome.FontAwesomeIcon, {
2705
- icon: _freeSolidSvgIcons.faPaperclip,
2706
- style: {
2707
- color: "var(--primary-color, #222f67)",
2708
- fontSize: "12px"
2709
- }
2710
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
2711
- style: {
2712
- flex: 1,
2713
- fontSize: "12px",
2714
- color: "#333",
2715
- fontFamily: WIDGET_FONT
2716
- },
2717
- children: doc.documentName
2718
- }), isDownloading ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.CircularProgress, {
2719
- size: 12,
2720
- style: {
2721
- color: "var(--primary-color, #222f67)"
2722
- }
2723
- }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFontawesome.FontAwesomeIcon, {
2724
- icon: _freeSolidSvgIcons.faDownload,
2725
- style: {
2726
- color: "var(--primary-color, #222f67)",
2727
- fontSize: "12px"
2728
- }
2729
- })]
2730
- }, doc.id || di))
2731
- })]
2732
- })]
2733
- }, entry.id || index);
2734
- })]
2735
- })]
2736
- })]
2737
- })
2738
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.DialogActions, {
2739
- sx: {
2740
- padding: "16px 24px",
2741
- borderTop: "1px solid #e0e0e0",
2742
- backgroundColor: "#f8f9fa",
2743
- gap: "8px"
2744
- },
2745
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
2746
- onClick: handleCloseDetails,
2747
- variant: "outlined",
2748
- sx: {
2749
- color: "var(--primary-color, #222f67)",
2750
- borderColor: "var(--primary-color, #222f67)",
2751
- padding: "5.5px 23px",
2752
- borderRadius: "6px",
2753
- fontWeight: "500",
2754
- fontSize: "14px",
2755
- textTransform: "none",
2756
- boxShadow: "none",
2757
- "&:hover": {
2758
- borderColor: "var(--primary-color, #222f67)",
2759
- backgroundColor: "rgba(34, 47, 103, 0.05)",
2760
- boxShadow: "none"
2761
- }
2762
- },
2763
- children: "Fermer"
2764
- }), (selectedReclamation === null || selectedReclamation === void 0 ? void 0 : selectedReclamation.statutCode) === STATUT_REPONDUE && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
2765
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
2766
- variant: "contained",
2767
- onClick: handleCloturer,
2768
- disabled: isCloturing,
2769
- sx: {
2770
- backgroundColor: "#e53935",
2771
- color: "white",
2772
- padding: "5.5px 23px",
2773
- borderRadius: "6px",
2774
- fontWeight: "500",
2775
- fontSize: "14px",
2776
- textTransform: "none",
2777
- boxShadow: "none",
2778
- "&:hover": {
2779
- backgroundColor: "#c62828",
2780
- boxShadow: "none"
2781
- },
2782
- "&:disabled": {
2783
- backgroundColor: "#ef9a9a",
2784
- boxShadow: "none"
2785
- }
2786
- },
2787
- children: isCloturing ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.CircularProgress, {
2788
- size: 16,
2789
- sx: {
2790
- color: "white"
2791
- }
2792
- }) : "Clôturer"
2793
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
2794
- variant: "contained",
2795
- onClick: handleOpenReouvreDialog,
2796
- sx: {
2797
- backgroundColor: "var(--primary-color, #222f67)",
2798
- color: "white",
2799
- padding: "5.5px 23px",
2800
- borderRadius: "6px",
2801
- fontWeight: "500",
2802
- fontSize: "14px",
2803
- textTransform: "none",
2804
- boxShadow: "none",
2805
- "&:hover": {
2806
- backgroundColor: "var(--secondary-color, #2d3d7f)",
2807
- boxShadow: "none"
2808
- }
2809
- },
2810
- children: "R\xE9ouverture"
2811
- })]
2812
- })]
2813
- })]
2814
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Dialog, {
2815
- open: reouvreDialogOpen,
2816
- onClose: handleCloseReouvreDialog,
2817
- maxWidth: "sm",
2818
- fullWidth: true,
2819
- PaperProps: {
2820
- sx: {
2821
- borderRadius: 3,
2822
- boxShadow: "0 8px 32px rgba(0,0,0,0.12)"
2823
- }
2824
- },
2825
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.DialogTitle, {
2826
- sx: {
2827
- backgroundColor: "#f8f9fa",
2828
- borderBottom: "1px solid #e0e0e0",
2829
- display: "flex",
2830
- justifyContent: "space-between",
2831
- alignItems: "center",
2832
- padding: "20px 24px"
2833
- },
2834
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2835
- style: {
2836
- display: "flex",
2837
- alignItems: "center",
2838
- gap: "12px"
2839
- },
2840
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFontawesome.FontAwesomeIcon, {
2841
- icon: _freeSolidSvgIcons.faReply,
2842
- style: {
2843
- color: "var(--primary-color, #222f67)",
2844
- fontSize: "18px"
2845
- }
2846
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2847
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
2848
- component: "div",
2849
- sx: {
2850
- fontWeight: "700",
2851
- fontSize: "16px",
2852
- margin: 0
2853
- },
2854
- children: "R\xE9ouverture de la r\xE9clamation"
2855
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
2856
- component: "div",
2857
- sx: {
2858
- color: "#666",
2859
- fontSize: "12px",
2860
- marginTop: "3px"
2861
- },
2862
- children: selectedReclamation === null || selectedReclamation === void 0 ? void 0 : selectedReclamation.reference
2863
- })]
2864
- })]
2865
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.IconButton, {
2866
- onClick: handleCloseReouvreDialog,
2867
- size: "small",
2868
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_iconsMaterial.Close, {
2869
- fontSize: "small"
2870
- })
2871
- })]
2872
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.DialogContent, {
2873
- sx: {
2874
- padding: "24px",
2875
- display: "flex",
2876
- flexDirection: "column",
2877
- gap: "20px"
2878
- },
2879
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.TextField, {
2880
- label: "Description",
2881
- placeholder: "D\xE9crivez la raison de la r\xE9ouverture...",
2882
- value: reouvreDescription,
2883
- onChange: e => setReouvreDescription(e.target.value),
2884
- multiline: true,
2885
- rows: 5,
2886
- fullWidth: true,
2887
- required: true,
2888
- variant: "outlined",
2889
- inputProps: {
2890
- maxLength: 500
2891
- },
2892
- sx: {
2893
- mt: 1,
2894
- "& .MuiOutlinedInput-root.Mui-focused .MuiOutlinedInput-notchedOutline": {
2895
- borderColor: "var(--primary-color, #222f67)"
2896
- },
2897
- "& .MuiInputLabel-root.Mui-focused": {
2898
- color: "var(--primary-color, #222f67)"
2899
- }
2900
- }
2901
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2902
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
2903
- type: "file",
2904
- ref: reouvreFileInputRef,
2905
- style: {
2906
- display: "none"
2907
- },
2908
- onChange: handleReouvreFileSelect,
2909
- accept: ".pdf,.doc,.docx,.xls,.xlsx,.jpg,.jpeg,.png,.gif",
2910
- multiple: true
2911
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
2912
- variant: "outlined",
2913
- startIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_iconsMaterial.AttachFile, {}),
2914
- onClick: () => {
2915
- var _reouvreFileInputRef$;
2916
- return (_reouvreFileInputRef$ = reouvreFileInputRef.current) === null || _reouvreFileInputRef$ === void 0 ? void 0 : _reouvreFileInputRef$.click();
2917
- },
2918
- sx: {
2919
- borderRadius: "8px",
2920
- border: "2px dashed var(--primary-color, #222f67)",
2921
- color: "var(--primary-color, #222f67)",
2922
- fontWeight: "600",
2923
- textTransform: "none",
2924
- width: "100%",
2925
- "&:hover": {
2926
- backgroundColor: "rgba(34, 47, 103, 0.05)",
2927
- borderStyle: "solid"
2928
- }
2929
- },
2930
- children: "Pi\xE8ces jointes (optionnel)"
2931
- }), reouvreFiles.length > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
2932
- sx: {
2933
- mt: 1,
2934
- display: "flex",
2935
- flexWrap: "wrap",
2936
- gap: 1
2937
- },
2938
- children: reouvreFiles.map((file, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Chip, {
2939
- icon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_iconsMaterial.AttachFile, {}),
2940
- label: file.name,
2941
- onDelete: () => handleRemoveReouvreFile(index),
2942
- sx: {
2943
- borderRadius: "8px"
2944
- },
2945
- color: "primary",
2946
- variant: "outlined"
2947
- }, index))
2948
- })]
2949
- })]
2950
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.DialogActions, {
2951
- sx: {
2952
- padding: "16px 24px",
2953
- borderTop: "1px solid #e0e0e0",
2954
- backgroundColor: "#f8f9fa",
2955
- gap: "8px"
2956
- },
2957
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
2958
- onClick: handleCloseReouvreDialog,
2959
- variant: "outlined",
2960
- sx: {
2961
- color: "var(--primary-color, #222f67)",
2962
- borderColor: "var(--primary-color, #222f67)",
2963
- padding: "5.5px 23px",
2964
- borderRadius: "6px",
2965
- fontWeight: "500",
2966
- fontSize: "14px",
2967
- textTransform: "none",
2968
- boxShadow: "none",
2969
- "&:hover": {
2970
- borderColor: "var(--primary-color, #222f67)",
2971
- backgroundColor: "rgba(34, 47, 103, 0.05)",
2972
- boxShadow: "none"
2973
- }
2974
- },
2975
- children: "Annuler"
2976
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
2977
- variant: "contained",
2978
- onClick: handleSubmitReouvreture,
2979
- disabled: !reouvreDescription.trim() || isReouvring,
2980
- sx: {
2981
- backgroundColor: "var(--primary-color, #222f67)",
2982
- color: "white",
2983
- padding: "5.5px 23px",
2984
- borderRadius: "6px",
2985
- fontWeight: "500",
2986
- fontSize: "14px",
2987
- textTransform: "none",
2988
- boxShadow: "none",
2989
- "&:hover": {
2990
- backgroundColor: "var(--secondary-color, #2d3d7f)",
2991
- boxShadow: "none"
2992
- },
2993
- "&:disabled": {
2994
- backgroundColor: "rgba(34, 47, 103, 0.4)",
2995
- boxShadow: "none"
2996
- }
2997
- },
2998
- children: isReouvring ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.CircularProgress, {
2999
- size: 16,
3000
- sx: {
3001
- color: "white"
3002
- }
3003
- }) : "Confirmer la réouverture"
3004
- })]
3005
- })]
3006
- })]
3007
- });
3008
- };
3009
- const TijariaChatbot = selectedConversation => {
3010
- const {
3011
- tijariaUrl,
3012
- apiAuthUrl,
3013
- token
3014
- } = (0, _PuiHelpWidgetContext.useHelpWidget)();
3015
- const iframeRef = (0, _react.useRef)(null);
3016
- (0, _react.useEffect)(() => {
3017
- const handleMessage = event => {
3018
- if (event.origin !== tijariaUrl) {
3019
- console.warn("Message from unauthorized origin:", event.origin);
3020
- return;
3021
- }
3022
- if (event.data && event.data.type === "TOKEN_RECEIVED") {
3023
- console.log("Token delivery confirmed by iframe:", event.data);
3024
- sessionStorage.setItem("tijaria_token", event.data.token);
3025
- }
3026
- };
3027
- window.addEventListener("message", handleMessage);
3028
- return () => window.removeEventListener("message", handleMessage);
3029
- }, []);
3030
- (0, _react.useEffect)(() => {
3031
- const iframe = iframeRef.current;
3032
- const handleLoad = () => {
3033
- iframe.contentWindow.postMessage({
3034
- type: "SET_TOKEN",
3035
- token: token,
3036
- userInfoApi: "".concat(apiAuthUrl, "/auth/keycloak/user-profile")
3037
- }, tijariaUrl);
3038
- };
3039
- iframe.addEventListener("load", handleLoad);
3040
- return () => iframe.removeEventListener("load", handleLoad);
3041
- }, []);
3042
- (0, _react.useEffect)(() => {
3043
- // console.log("selectedConversation", selectedConversation);
3044
- const iframe = iframeRef.current;
3045
- const handleSelect = () => {
3046
- iframe.contentWindow.postMessage({
3047
- type: "CONVERSATION_SELECTED",
3048
- sessionId: selectedConversation.selectedConversation || null
3049
- }, tijariaUrl);
3050
- };
3051
- iframe.addEventListener("load", handleSelect);
3052
- return () => iframe.removeEventListener("load", handleSelect);
3053
- }, [selectedConversation]);
3054
- const isExpanded = true;
3055
- return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
3056
- style: {
3057
- flex: 1,
3058
- overflow: "auto",
3059
- display: "flex",
3060
- flexDirection: "column"
3061
- },
3062
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
3063
- style: {
3064
- flex: 1,
3065
- position: "relative"
3066
- },
3067
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("iframe", {
3068
- ref: iframeRef,
3069
- id: "chatbot-iframe",
3070
- title: "TijarIA",
3071
- src: "".concat(tijariaUrl, "/assistantBot?source=PGU&expanded=").concat(isExpanded),
3072
- allow: "microphone",
3073
- sandbox: "allow-popups allow-scripts allow-same-origin",
3074
- style: {
3075
- width: "100%",
3076
- height: "90%",
3077
- border: "none",
3078
- position: "absolute",
3079
- top: 0,
3080
- left: 0
3081
- }
3082
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
3083
- onClick: () => {
3084
- const iframe = iframeRef.current;
3085
- if (iframe) {
3086
- iframe.contentWindow.postMessage({
3087
- type: "toggleSize",
3088
- isExpanded: true
3089
- }, tijariaUrl);
3090
- }
3091
- },
3092
- style: {
3093
- position: "absolute",
3094
- bottom: "20px",
3095
- left: "50%",
3096
- transform: "translateX(-50%)",
3097
- display: "flex",
3098
- flexDirection: "row",
3099
- alignItems: "center",
3100
- gap: "10px",
3101
- padding: "8px 16px",
3102
- border: "none",
3103
- backgroundColor: "transparent",
3104
- cursor: "pointer"
3105
- },
3106
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
3107
- src: _tijariaLogo.default,
3108
- alt: "Tijaria Logo",
3109
- style: {
3110
- width: "24px",
3111
- height: "24px",
3112
- objectFit: "contain",
3113
- flexShrink: 0
3114
- }
3115
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
3116
- component: "div",
3117
- sx: {
3118
- fontSize: "16px",
3119
- fontWeight: "500",
3120
- fontFamily: WIDGET_FONT,
3121
- margin: 0,
3122
- lineHeight: "normal",
3123
- color: "#495057"
3124
- },
3125
- children: "TijarIA"
3126
- })]
3127
- })]
3128
- })
3129
- });
3130
- };
3131
- const TijariaHistory = _ref6 => {
3132
- let {
3133
- onClose,
3134
- setSelectedConversation
3135
- } = _ref6;
3136
- const [conversations, setConversations] = (0, _react.useState)([]);
3137
- const [loading, setLoading] = (0, _react.useState)(true);
3138
- const [error, setError] = (0, _react.useState)(null);
3139
- (0, _react.useEffect)(() => {
3140
- fetchUserHistory();
3141
- }, []);
3142
- const fetchUserHistory = async () => {
3143
- try {
3144
- setLoading(true);
3145
- const response = await fetch("https://chatbot-dev.portnet.ma/api/user/getUserHistory", {
3146
- method: "GET",
3147
- headers: {
3148
- Authorization: "Bearer ".concat(sessionStorage.getItem("tijaria_token")),
3149
- "Content-Type": "application/json"
3150
- }
3151
- });
3152
- if (!response.ok) {
3153
- throw new Error("Erreur lors de la récupération de l'historique");
3154
- }
3155
- const data = await response.json();
3156
- setConversations(data);
3157
- setError(null);
3158
- } catch (err) {
3159
- console.error("Error fetching history:", err);
3160
- setError(err.message);
3161
- setConversations([]);
3162
- } finally {
3163
- setLoading(false);
3164
- }
3165
- };
3166
- const handleConversationClick = conversation => {
3167
- console.log(" Conversation clicked:", conversation);
3168
- setSelectedConversation(conversation.sessionId);
3169
- onClose();
3170
- };
3171
- const formatDate = dateString => {
3172
- if (!dateString) return "N/A";
3173
- const date = new Date(dateString);
3174
- return date.toLocaleDateString("fr-FR", {
3175
- day: "2-digit",
3176
- month: "2-digit",
3177
- year: "numeric",
3178
- hour: "2-digit",
3179
- minute: "2-digit"
3180
- });
3181
- };
3182
- const truncateText = function truncateText(text) {
3183
- let maxLength = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 80;
3184
- if (!text) return "";
3185
- return text.length > maxLength ? text.substring(0, maxLength) + "..." : text;
3186
- };
3187
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
3188
- style: {
3189
- flex: 1,
3190
- display: "flex",
3191
- flexDirection: "column",
3192
- backgroundColor: "#f5f5f5"
3193
- },
3194
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
3195
- style: {
3196
- display: "flex",
3197
- justifyContent: "space-between",
3198
- alignItems: "center",
3199
- padding: "16px",
3200
- backgroundColor: "white",
3201
- borderBottom: "1px solid #e0e0e0"
3202
- },
3203
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
3204
- style: {
3205
- display: "flex",
3206
- alignItems: "center",
3207
- gap: "12px"
3208
- },
3209
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFontawesome.FontAwesomeIcon, {
3210
- icon: _freeSolidSvgIcons.faComments,
3211
- style: {
3212
- color: "var(--primary-color, #222f67)",
3213
- fontSize: "20px"
3214
- }
3215
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
3216
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
3217
- component: "div",
3218
- sx: {
3219
- fontWeight: "600",
3220
- color: "#333",
3221
- fontSize: "16px",
3222
- fontFamily: WIDGET_FONT,
3223
- margin: 0,
3224
- lineHeight: "normal"
3225
- },
3226
- children: "Historique TijarIA"
3227
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
3228
- component: "div",
3229
- sx: {
3230
- color: "#999",
3231
- fontSize: "12px",
3232
- fontFamily: WIDGET_FONT,
3233
- margin: 0,
3234
- lineHeight: "normal"
3235
- },
3236
- children: loading ? "Chargement..." : "".concat(conversations.length, " conversation(s)")
3237
- })]
3238
- })]
3239
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
3240
- onClick: onClose,
3241
- style: {
3242
- cursor: "pointer",
3243
- color: "#666",
3244
- padding: "4px",
3245
- display: "flex",
3246
- alignItems: "center"
3247
- },
3248
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFontawesome.FontAwesomeIcon, {
3249
- icon: _freeSolidSvgIcons.faTimes,
3250
- style: {
3251
- fontSize: "16px"
3252
- }
3253
- })
3254
- })]
3255
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
3256
- style: {
3257
- flex: 1,
3258
- overflowY: "auto",
3259
- padding: "12px"
3260
- },
3261
- children: loading ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
3262
- style: {
3263
- display: "flex",
3264
- flexDirection: "column",
3265
- alignItems: "center",
3266
- justifyContent: "center",
3267
- padding: "40px 20px",
3268
- color: "#999"
3269
- },
3270
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
3271
- style: {
3272
- width: "40px",
3273
- height: "40px",
3274
- border: "4px solid #f3f3f3",
3275
- borderTop: "4px solid var(--primary-color, #222f67)",
3276
- borderRadius: "50%",
3277
- animation: "spin 1s linear infinite"
3278
- }
3279
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("style", {
3280
- children: "\n @keyframes spin {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n "
3281
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
3282
- component: "div",
3283
- sx: {
3284
- fontSize: "14px",
3285
- marginTop: "32px",
3286
- fontFamily: WIDGET_FONT,
3287
- lineHeight: "normal",
3288
- color: "#999"
3289
- },
3290
- children: "Chargement de l'historique..."
3291
- })]
3292
- }) : error ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
3293
- style: {
3294
- display: "flex",
3295
- flexDirection: "column",
3296
- alignItems: "center",
3297
- justifyContent: "center",
3298
- padding: "40px 20px",
3299
- color: "#dc3545"
3300
- },
3301
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFontawesome.FontAwesomeIcon, {
3302
- icon: _freeSolidSvgIcons.faWarning,
3303
- style: {
3304
- fontSize: "48px",
3305
- marginBottom: "16px"
3306
- }
3307
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
3308
- component: "div",
3309
- sx: {
3310
- fontSize: "14px",
3311
- textAlign: "center",
3312
- fontFamily: WIDGET_FONT,
3313
- margin: 0,
3314
- lineHeight: "normal"
3315
- },
3316
- children: error
3317
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
3318
- onClick: fetchUserHistory,
3319
- variant: "contained",
3320
- sx: {
3321
- marginTop: "35px",
3322
- padding: "6px 20px",
3323
- backgroundColor: "var(--primary-color, #222f67)",
3324
- color: "white",
3325
- borderRadius: "6px",
3326
- fontSize: "14px",
3327
- fontWeight: "600",
3328
- fontFamily: WIDGET_FONT,
3329
- textTransform: "none",
3330
- boxShadow: "none",
3331
- "&:hover": {
3332
- backgroundColor: "var(--primary-color, #222f67)",
3333
- opacity: 0.9,
3334
- boxShadow: "none"
3335
- }
3336
- },
3337
- children: "R\xE9essayer"
3338
- })]
3339
- }) : conversations.length === 0 ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
3340
- style: {
3341
- display: "flex",
3342
- flexDirection: "column",
3343
- alignItems: "center",
3344
- justifyContent: "center",
3345
- padding: "40px 20px",
3346
- color: "#999"
3347
- },
3348
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFontawesome.FontAwesomeIcon, {
3349
- icon: _freeSolidSvgIcons.faComments,
3350
- style: {
3351
- fontSize: "48px",
3352
- marginBottom: "32px"
3353
- }
3354
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
3355
- component: "div",
3356
- sx: {
3357
- fontSize: "14px",
3358
- textAlign: "center",
3359
- fontFamily: WIDGET_FONT,
3360
- lineHeight: "normal",
3361
- color: "#999"
3362
- },
3363
- children: "Aucune conversation trouv\xE9e"
3364
- })]
3365
- }) : conversations.map((conversation, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
3366
- onClick: () => handleConversationClick(conversation),
3367
- style: {
3368
- backgroundColor: "white",
3369
- borderRadius: "8px",
3370
- padding: "16px",
3371
- marginBottom: "12px",
3372
- cursor: "pointer",
3373
- boxShadow: "0 1px 3px rgba(0,0,0,0.1)",
3374
- transition: "all 0.2s ease",
3375
- border: "1px solid #e0e0e0"
3376
- },
3377
- onMouseEnter: e => {
3378
- e.currentTarget.style.boxShadow = "0 4px 8px rgba(0,0,0,0.15)";
3379
- e.currentTarget.style.transform = "translateY(-2px)";
3380
- },
3381
- onMouseLeave: e => {
3382
- e.currentTarget.style.boxShadow = "0 1px 3px rgba(0,0,0,0.1)";
3383
- e.currentTarget.style.transform = "translateY(0)";
3384
- },
3385
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
3386
- style: {
3387
- display: "flex",
3388
- justifyContent: "space-between",
3389
- alignItems: "center",
3390
- marginBottom: "12px"
3391
- },
3392
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
3393
- style: {
3394
- display: "flex",
3395
- alignItems: "center",
3396
- gap: "8px"
3397
- },
3398
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFontawesome.FontAwesomeIcon, {
3399
- icon: _freeSolidSvgIcons.faComments,
3400
- style: {
3401
- color: "var(--primary-color, #222f67)",
3402
- fontSize: "14px"
3403
- }
3404
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
3405
- component: "div",
3406
- sx: {
3407
- fontWeight: "600",
3408
- color: "#333",
3409
- fontSize: "13px",
3410
- fontFamily: WIDGET_FONT,
3411
- margin: 0,
3412
- lineHeight: "normal"
3413
- },
3414
- children: truncateText(conversation.title || "Aucun titre disponible")
3415
- })]
3416
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
3417
- style: {
3418
- color: "#999",
3419
- fontSize: "11px"
3420
- },
3421
- children: conversation.createdAt && formatDate(conversation.createdAt)
3422
- })]
3423
- })
3424
- }, conversation.id || index))
3425
- })]
3426
- });
3427
- };
3428
- const PuiHelpWidget = _ref7 => {
3429
- let {
3430
- showReclamation = true,
3431
- showGuides = false,
3432
- showTijaria = true,
3433
- currentProjectCode = null,
3434
- guideBaseUrl
3435
- } = _ref7;
3436
- const [dropdownOpen, setDropdownOpen] = (0, _react.useState)(false);
3437
- const [isTourActive, setIsTourActive] = (0, _react.useState)(false);
3438
- const {
3439
- guideApi
3440
- } = (0, _PuiHelpWidgetContext.useHelpWidget)();
3441
- const queryClient = (0, _reactQuery.useQueryClient)();
3442
- const toggle = () => {
3443
- setDropdownOpen(prev => !prev);
3444
- };
3445
- (0, _react.useEffect)(() => {
3446
- const openDropdown = () => {
3447
- setIsOpen(true);
3448
- setIsTourActive(true);
3449
- };
3450
- const closeDropdown = () => {
3451
- setIsOpen(false);
3452
- setIsTourActive(false);
3453
- };
3454
- window.addEventListener("open-aide-dropdown", openDropdown);
3455
- window.addEventListener("close-aide-dropdown", closeDropdown);
3456
- return () => {
3457
- window.removeEventListener("open-aide-dropdown", openDropdown);
3458
- window.removeEventListener("close-aide-dropdown", closeDropdown);
3459
- };
3460
- }, []);
3461
- const dispatch = (0, _reactRedux.useDispatch)();
3462
- const [isOpen, setIsOpen] = (0, _react.useState)(false);
3463
- const sidebarRef = (0, _react.useRef)(null);
3464
- const triggerRef = (0, _react.useRef)(null);
3465
- const firstFocusableRef = (0, _react.useRef)(null);
3466
- const contactPopoverRef = (0, _react.useRef)(null);
3467
- const firstContactFocusableRef = (0, _react.useRef)(null);
3468
- const previousContactActiveElement = (0, _react.useRef)(null);
3469
- const previousActiveElement = (0, _react.useRef)(null);
3470
- const [hoveredIndex, setHoveredIndex] = (0, _react.useState)(null);
3471
- const [activeChat, setActiveChat] = (0, _react.useState)(null);
3472
- const [infoMessages, setInfoMessages] = (0, _react.useState)([]);
3473
- const [incidentMessages, setIncidentMessages] = (0, _react.useState)([]);
3474
- const [reclamationModalOpen, setReclamationModalOpen] = (0, _react.useState)(false);
3475
- const [viewingReclamations, setViewingReclamations] = (0, _react.useState)(false);
3476
- const [viewingTijariaHistory, setViewingTijariaHistory] = (0, _react.useState)(false);
3477
- const [contactUsMenuAnchor, setContactUsMenuAnchor] = (0, _react.useState)(null);
3478
- const contactUsMenuOpen = Boolean(contactUsMenuAnchor);
3479
- const [popupPosition, setPopupPosition] = (0, _react.useState)({
3480
- x: 0,
3481
- y: 0
3482
- });
3483
- const [isDragging, setIsDragging] = (0, _react.useState)(false);
3484
- const [dragStart, setDragStart] = (0, _react.useState)({
3485
- x: 0,
3486
- y: 0
3487
- });
3488
- const [guidesPanelOpen, setGuidesPanelOpen] = (0, _react.useState)(false);
3489
- const [faqPanelOpen, setFaqPanelOpen] = (0, _react.useState)(false);
3490
- const [guideData, setGuideData] = (0, _react.useState)(null);
3491
- const [faqData, setFaqData] = (0, _react.useState)(null);
3492
- const [loadingGuide, setLoadingGuide] = (0, _react.useState)(false);
3493
- (0, _react.useEffect)(() => {
3494
- async function fetchGuideData() {
3495
- if (!showGuides || !currentProjectCode || !guidesPanelOpen) return;
3496
- try {
3497
- var _response$data;
3498
- const response = await guideApi.getGuideContent(currentProjectCode);
3499
- setGuideData(response === null || response === void 0 || (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.body);
3500
- } catch (error) {
3501
- console.error("Error loading guide data:", error);
3502
- setGuideData(null);
3503
- }
3504
- }
3505
- fetchGuideData();
3506
- }, [currentProjectCode, guidesPanelOpen, showGuides]);
3507
- (0, _react.useEffect)(() => {
3508
- async function fetchFaqData() {
3509
- if (!faqPanelOpen) return;
3510
- try {
3511
- const faqModule = await _guides.default["FAQ"];
3512
- const data = faqModule.default || faqModule;
3513
- setFaqData(data);
3514
- } catch (error) {
3515
- console.error("Error loading FAQ data:", error);
3516
- setFaqData(null);
3517
- }
3518
- }
3519
- fetchFaqData();
3520
- }, [faqPanelOpen]);
3521
- const handleGuideMenuClick = event => {
3522
- setIsOpen(false);
3523
- setGuidesPanelOpen(true);
3524
- };
3525
- const handleFaqClick = () => {
3526
- setIsOpen(false);
3527
- setFaqPanelOpen(true);
3528
- };
3529
- const handleContactUsClick = event => {
3530
- const rect = event.currentTarget.getBoundingClientRect();
3531
- setContactUsMenuAnchor(event.currentTarget);
3532
- setPopupPosition({
3533
- x: rect.left - 291,
3534
- y: rect.top
3535
- });
3536
- };
3537
- const handleContactUsMenuClose = () => {
3538
- setContactUsMenuAnchor(null);
3539
- };
3540
- const handleContactClick = () => {
3541
- window.location.href = "mailto:support@moroccotradenet.ma";
3542
- handleContactUsMenuClose();
3543
- };
3544
- const handlePdfGuideClick = async () => {
3545
- setLoadingGuide(true);
3546
- try {
3547
- var _response$data2;
3548
- const response = await guideApi.getGuideByProjectCode(currentProjectCode);
3549
- const guideData = response === null || response === void 0 || (_response$data2 = response.data) === null || _response$data2 === void 0 ? void 0 : _response$data2.body;
3550
- if (guideData !== null && guideData !== void 0 && guideData.urlFichier) {
3551
- const link = document.createElement("a");
3552
- link.href = guideData.urlFichier;
3553
- link.setAttribute("download", "");
3554
- document.body.appendChild(link);
3555
- link.click();
3556
- document.body.removeChild(link);
3557
- } else {
3558
- console.warn("No PDF guide found for project: ".concat(currentProjectCode));
3559
- }
3560
- } catch (error) {
3561
- console.error("Error fetching guide:", error);
3562
- } finally {
3563
- setLoadingGuide(false);
3564
- }
3565
- };
3566
- const handleMouseDown = e => {
3567
- if (e.target.classList.contains("draggable-handle")) {
3568
- setIsDragging(true);
3569
- setDragStart({
3570
- x: e.clientX - popupPosition.x,
3571
- y: e.clientY - popupPosition.y
3572
- });
3573
- }
3574
- };
3575
- const handleMouseMove = e => {
3576
- if (isDragging) {
3577
- setPopupPosition({
3578
- x: e.clientX - dragStart.x,
3579
- y: e.clientY - dragStart.y
3580
- });
3581
- }
3582
- };
3583
- const handleMouseUp = () => {
3584
- setIsDragging(false);
3585
- };
3586
- (0, _react.useEffect)(() => {
3587
- if (isDragging) {
3588
- document.addEventListener("mousemove", handleMouseMove);
3589
- document.addEventListener("mouseup", handleMouseUp);
3590
- return () => {
3591
- document.removeEventListener("mousemove", handleMouseMove);
3592
- document.removeEventListener("mouseup", handleMouseUp);
3593
- };
3594
- }
3595
- }, [isDragging, dragStart, popupPosition]);
3596
- (0, _react.useEffect)(() => {
3597
- if (isOpen) {
3598
- previousActiveElement.current = document.activeElement;
3599
- setTimeout(() => {
3600
- var _firstFocusableRef$cu3;
3601
- (_firstFocusableRef$cu3 = firstFocusableRef.current) === null || _firstFocusableRef$cu3 === void 0 || _firstFocusableRef$cu3.focus();
3602
- }, 100);
3603
- } else {
3604
- if (previousActiveElement.current) {
3605
- previousActiveElement.current.focus();
3606
- }
3607
- }
3608
- }, [isOpen]);
3609
- (0, _react.useEffect)(() => {
3610
- if (!isOpen) return;
3611
- const handleKeyDown = e => {
3612
- if (e.key === "Escape") {
3613
- setIsOpen(false);
3614
- return;
3615
- }
3616
- if (e.key === "Tab") {
3617
- const sidebar = sidebarRef.current;
3618
- if (!sidebar) return;
3619
- const focusableElements = sidebar.querySelectorAll('button:not([disabled]), [href]:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"]):not([disabled])');
3620
- const focusableArray = Array.from(focusableElements);
3621
- const firstElement = focusableArray[0];
3622
- const lastElement = focusableArray[focusableArray.length - 1];
3623
- if (focusableArray.length === 0) return;
3624
- if (e.shiftKey) {
3625
- if (document.activeElement === firstElement) {
3626
- lastElement.focus();
3627
- e.preventDefault();
3628
- }
3629
- } else {
3630
- if (document.activeElement === lastElement) {
3631
- firstElement.focus();
3632
- e.preventDefault();
3633
- }
3634
- }
3635
- }
3636
- };
3637
- document.addEventListener("keydown", handleKeyDown);
3638
- return () => document.removeEventListener("keydown", handleKeyDown);
3639
- }, [isOpen]);
3640
- (0, _react.useEffect)(() => {
3641
- if (isOpen) {
3642
- document.body.style.overflow = "hidden";
3643
- } else {
3644
- document.body.style.overflow = "";
3645
- }
3646
- return () => {
3647
- document.body.style.overflow = "";
3648
- };
3649
- }, [isOpen]);
3650
- (0, _react.useEffect)(() => {
3651
- if (contactUsMenuOpen) {
3652
- previousContactActiveElement.current = document.activeElement;
3653
- setTimeout(() => {
3654
- const popover = contactPopoverRef.current;
3655
- if (popover) {
3656
- const firstMenuItem = popover.querySelector('[role="menuitem"]');
3657
- if (firstMenuItem) {
3658
- firstMenuItem.focus();
3659
- }
3660
- }
3661
- }, 100);
3662
- } else {
3663
- if (previousContactActiveElement.current) {
3664
- previousContactActiveElement.current.focus();
3665
- }
3666
- }
3667
- }, [contactUsMenuOpen]);
3668
- (0, _react.useEffect)(() => {
3669
- if (!contactUsMenuOpen) return;
3670
- const handleKeyDown = e => {
3671
- if (e.key === "Escape") {
3672
- handleContactUsMenuClose();
3673
- return;
3674
- }
3675
- if (e.key === "Tab") {
3676
- const popover = contactPopoverRef.current;
3677
- if (!popover) return;
3678
- const focusableElements = popover.querySelectorAll('button:not([disabled]), [role="menuitem"]:not([disabled]), [href]:not([disabled]), input:not([disabled]), [tabindex]:not([tabindex="-1"]):not([disabled])');
3679
- const focusableArray = Array.from(focusableElements);
3680
- const firstElement = focusableArray[0];
3681
- const lastElement = focusableArray[focusableArray.length - 1];
3682
- if (focusableArray.length === 0) return;
3683
- if (e.shiftKey) {
3684
- if (document.activeElement === firstElement) {
3685
- lastElement.focus();
3686
- e.preventDefault();
3687
- }
3688
- } else {
3689
- if (document.activeElement === lastElement) {
3690
- firstElement.focus();
3691
- e.preventDefault();
3692
- }
3693
- }
3694
- }
3695
- };
3696
- document.addEventListener("keydown", handleKeyDown);
3697
- return () => document.removeEventListener("keydown", handleKeyDown);
3698
- }, [contactUsMenuOpen]);
3699
- const navigationLinks = [...(showGuides && currentProjectCode ? [{
3700
- icon: _freeSolidSvgIcons.faBook,
3701
- title: "Guides utilisateurs",
3702
- action: handleGuideMenuClick
3703
- }] : []), {
3704
- icon: _freeSolidSvgIcons.faPen,
3705
- title: "Foires aux questions",
3706
- id: "foire-aux-questions",
3707
- action: handleFaqClick
3708
- }, ...(showReclamation ? [{
3709
- icon: _freeSolidSvgIcons.faClipboardList,
3710
- title: "Mes réclamations",
3711
- id: "mes-reclamations",
3712
- action: () => {
3713
- queryClient.invalidateQueries("get_list_reclamation");
3714
- setViewingReclamations(true);
3715
- }
3716
- }, {
3717
- icon: _freeSolidSvgIcons.faBullhorn,
3718
- title: "Nouvelle réclamation",
3719
- id: "nouvelle-reclamation",
3720
- action: () => setReclamationModalOpen(true)
3721
- }] : []), {
3722
- icon: _freeSolidSvgIcons.faAddressBook,
3723
- title: "Contactez-nous",
3724
- id: "contactez-nous",
3725
- action: handleContactUsClick
3726
- },
3727
- /*{
3728
- icon: faComments,
3729
- title: "TijarIA",
3730
- action: () => {
3731
- setActiveChat(null);
3732
- setViewingReclamations(false);
3733
- },
3734
- },*/
3735
- ...(showTijaria ? [{
3736
- icon: _freeSolidSvgIcons.faCommentDots,
3737
- title: "TijarIA",
3738
- id: "tijaria",
3739
- action: () => {
3740
- setViewingTijariaHistory(false);
3741
- setViewingReclamations(false);
3742
- }
3743
- }, {
3744
- icon: _freeSolidSvgIcons.faComments,
3745
- title: "Historique TijarIA",
3746
- id: "mes-conversations",
3747
- action: () => {
3748
- setViewingTijariaHistory(true);
3749
- setViewingReclamations(false);
3750
- }
3751
- }] : [])];
3752
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
3753
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
3754
- className: "help-widget-button ".concat(isOpen ? "open" : ""),
3755
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactstrap.Button, {
3756
- ref: triggerRef,
3757
- color: "light",
3758
- className: "help-trigger",
3759
- onClick: () => setIsOpen(!isOpen),
3760
- "aria-label": "Ouvrir le centre d'aide",
3761
- "aria-expanded": isOpen,
3762
- "aria-controls": "help-sidebar",
3763
- tabIndex: 0,
3764
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
3765
- component: "div",
3766
- sx: {
3767
- fontWeight: "600",
3768
- fontSize: "14px",
3769
- color: "#282828",
3770
- fontFamily: WIDGET_FONT,
3771
- margin: 0,
3772
- padding: 0,
3773
- lineHeight: "normal"
3774
- },
3775
- children: "Besoin d'aide ?"
3776
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFontawesome.FontAwesomeIcon, {
3777
- icon: isOpen ? _freeSolidSvgIcons.faChevronLeft : _freeSolidSvgIcons.faChevronRight,
3778
- className: "arrow-icon",
3779
- "aria-hidden": "true"
3780
- })]
3781
- })
3782
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
3783
- id: "help-sidebar",
3784
- ref: sidebarRef,
3785
- className: "help-widget-sidebar ".concat(isOpen ? "open" : ""),
3786
- role: "dialog",
3787
- "aria-modal": "true",
3788
- "aria-labelledby": "help-title",
3789
- "aria-hidden": !isOpen,
3790
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactstrap.Card, {
3791
- className: "h-100 border-0 shadow-lg",
3792
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactstrap.CardBody, {
3793
- className: "p-0 d-flex flex-column",
3794
- style: {
3795
- flex: 1,
3796
- minHeight: 0
3797
- },
3798
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
3799
- style: {
3800
- paddingTop: "12px",
3801
- paddingBottom: "20px",
3802
- paddingLeft: "17px",
3803
- paddingRight: "20px",
3804
- borderBottom: "1px solid #e9ecef",
3805
- backgroundColor: "white",
3806
- display: "flex",
3807
- alignItems: "center",
3808
- justifyContent: "space-between"
3809
- },
3810
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
3811
- style: {
3812
- display: "flex",
3813
- alignItems: "center"
3814
- },
3815
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFontawesome.FontAwesomeIcon, {
3816
- icon: _freeRegularSvgIcons.faQuestionCircle,
3817
- style: {
3818
- color: "var(--primary-color, #222f67)",
3819
- fontSize: "24px",
3820
- marginRight: "8px",
3821
- flexShrink: 0
3822
- },
3823
- "aria-hidden": "true"
3824
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
3825
- id: "help-title",
3826
- component: "div",
3827
- onClick: () => setIsOpen(false),
3828
- sx: {
3829
- margin: 0,
3830
- color: "#495057",
3831
- fontWeight: "600",
3832
- fontSize: "16px",
3833
- cursor: "pointer",
3834
- userSelect: "none",
3835
- flex: 1,
3836
- lineHeight: "normal",
3837
- fontFamily: WIDGET_FONT,
3838
- "&:hover": {
3839
- color: "var(--primary-color, #222f67)"
3840
- }
3841
- },
3842
- children: "Centre d'aide"
3843
- })]
3844
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
3845
- ref: firstFocusableRef,
3846
- onClick: () => setIsOpen(false),
3847
- "aria-label": "Fermer le centre d'aide",
3848
- tabIndex: 0,
3849
- style: {
3850
- background: "none",
3851
- border: "none",
3852
- fontSize: "20px",
3853
- cursor: "pointer",
3854
- padding: "4px 8px",
3855
- color: "#6c757d",
3856
- lineHeight: 1,
3857
- borderRadius: "4px"
3858
- },
3859
- onMouseEnter: e => {
3860
- e.currentTarget.style.backgroundColor = "#f0f0f0";
3861
- },
3862
- onMouseLeave: e => {
3863
- e.currentTarget.style.backgroundColor = "transparent";
3864
- },
3865
- children: "\u2715"
3866
- })]
3867
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
3868
- style: {
3869
- padding: "15px 15px",
3870
- borderBottom: "1px solid #e9ecef",
3871
- backgroundColor: "white"
3872
- },
3873
- children: navigationLinks.map((link, index) => /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
3874
- id: link.id,
3875
- onClick: link.action,
3876
- onKeyDown: e => {
3877
- if (e.key === "Enter" || e.key === " ") {
3878
- e.preventDefault();
3879
- link.action(e);
3880
- }
3881
- },
3882
- role: "button",
3883
- tabIndex: 0,
3884
- "aria-label": link.title,
3885
- style: {
3886
- display: "flex",
3887
- alignItems: "center",
3888
- padding: "8px 12px",
3889
- marginRight: "130px",
3890
- cursor: "pointer",
3891
- transition: "all 0.2s ease",
3892
- borderRadius: "4px",
3893
- backgroundColor: hoveredIndex === index ? "#f0f0ef" : "transparent"
3894
- },
3895
- onMouseEnter: () => setHoveredIndex(index),
3896
- onMouseLeave: () => setHoveredIndex(null),
3897
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
3898
- style: {
3899
- width: "20px",
3900
- display: "flex",
3901
- justifyContent: "center",
3902
- marginRight: "10px"
3903
- },
3904
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFontawesome.FontAwesomeIcon, {
3905
- icon: link.icon,
3906
- style: {
3907
- color: hoveredIndex === index ? "var(--primary-color, #222f67)" : "#6c757d",
3908
- fontSize: "14px",
3909
- transition: "color 0.2s ease"
3910
- },
3911
- "aria-hidden": "true"
3912
- })
3913
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
3914
- component: "div",
3915
- sx: {
3916
- color: hoveredIndex === index ? "var(--primary-color, #222f67)" : "#6c757d",
3917
- fontSize: "12.2px",
3918
- fontWeight: "500",
3919
- transition: "color 0.2s ease",
3920
- lineHeight: "normal",
3921
- fontFamily: WIDGET_FONT,
3922
- margin: 0,
3923
- padding: 0
3924
- },
3925
- children: link.title
3926
- })]
3927
- }, index))
3928
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(BottomContent, {
3929
- showTijaria: showTijaria,
3930
- viewingReclamations: viewingReclamations,
3931
- viewingTijariaHistory: viewingTijariaHistory,
3932
- activeChat: activeChat,
3933
- infoMessages: infoMessages,
3934
- incidentMessages: incidentMessages,
3935
- setViewingReclamations: setViewingReclamations,
3936
- setViewingTijariaHistory: setViewingTijariaHistory,
3937
- setActiveChat: setActiveChat,
3938
- setInfoMessages: setInfoMessages,
3939
- setIncidentMessages: setIncidentMessages
3940
- })]
3941
- })
3942
- })
3943
- }), showGuides && /*#__PURE__*/(0, _jsxRuntime.jsx)(ContentPanel, {
3944
- isOpen: guidesPanelOpen,
3945
- onClose: () => {
3946
- setGuidesPanelOpen(false);
3947
- setGuideData(null);
3948
- },
3949
- contentData: guideData,
3950
- title: "Guide utilisateurs",
3951
- showDownloadButton: true,
3952
- onDownload: handlePdfGuideClick,
3953
- loadingDownload: loadingGuide,
3954
- projectCode: currentProjectCode,
3955
- guideBaseUrl: guideBaseUrl
3956
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(ContentPanel, {
3957
- isOpen: faqPanelOpen,
3958
- onClose: () => {
3959
- setFaqPanelOpen(false);
3960
- setFaqData(null);
3961
- },
3962
- contentData: faqData,
3963
- title: "Foire aux questions",
3964
- showDownloadButton: false,
3965
- showExternalLinkLabel: true,
3966
- externalLinkUrl: "https://www.portnet.ma/faq"
3967
- }), isOpen && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
3968
- className: "help-widget-overlay",
3969
- onClick: () => setIsOpen(false),
3970
- style: {
3971
- position: "fixed",
3972
- top: 0,
3973
- left: 0,
3974
- width: "100vw",
3975
- height: "100vh",
3976
- backgroundColor: "rgba(0, 0, 0, 0.3)",
3977
- zIndex: 999
3978
- }
3979
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Popover, {
3980
- open: contactUsMenuOpen,
3981
- anchorEl: contactUsMenuAnchor,
3982
- onClose: handleContactUsMenuClose,
3983
- anchorReference: "anchorPosition",
3984
- anchorPosition: {
3985
- top: popupPosition.y,
3986
- left: popupPosition.x
3987
- },
3988
- PaperProps: {
3989
- ref: contactPopoverRef,
3990
- elevation: 8,
3991
- sx: {
3992
- minWidth: 280,
3993
- borderRadius: 3,
3994
- overflow: "visible",
3995
- boxShadow: "0 8px 32px rgba(0,0,0,0.12)"
3996
- },
3997
- role: "dialog",
3998
- "aria-modal": "true",
3999
- "aria-labelledby": "contact-title"
4000
- },
4001
- TransitionProps: {
4002
- timeout: 300
4003
- },
4004
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
4005
- className: "draggable-handle",
4006
- onMouseDown: handleMouseDown,
4007
- style: {
4008
- padding: "16px 20px",
4009
- borderBottom: "1px solid #e0e0e0",
4010
- cursor: "move",
4011
- userSelect: "none",
4012
- backgroundColor: "#f8f9fa",
4013
- borderTopLeftRadius: "12px",
4014
- borderTopRightRadius: "12px",
4015
- display: "flex",
4016
- justifyContent: "center",
4017
- alignItems: "center",
4018
- position: "relative"
4019
- },
4020
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
4021
- style: {
4022
- display: "flex",
4023
- alignItems: "center",
4024
- gap: "8px"
4025
- },
4026
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
4027
- component: "div",
4028
- id: "contact-title",
4029
- sx: {
4030
- fontWeight: "600",
4031
- fontSize: "15px",
4032
- color: "#333",
4033
- fontFamily: WIDGET_FONT,
4034
- margin: 0,
4035
- padding: 0,
4036
- lineHeight: "normal"
4037
- },
4038
- children: "Contactez-nous"
4039
- })
4040
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
4041
- onClick: handleContactUsMenuClose,
4042
- "aria-label": "Fermer",
4043
- tabIndex: 0,
4044
- style: {
4045
- cursor: "pointer",
4046
- padding: "4px",
4047
- borderRadius: "4px",
4048
- display: "flex",
4049
- alignItems: "center",
4050
- justifyContent: "center",
4051
- transition: "background-color 0.2s",
4052
- position: "absolute",
4053
- right: "16px",
4054
- background: "none",
4055
- border: "none"
4056
- },
4057
- onMouseEnter: e => e.currentTarget.style.backgroundColor = "#e0e0e0",
4058
- onMouseLeave: e => e.currentTarget.style.backgroundColor = "transparent",
4059
- onFocus: e => {
4060
- e.currentTarget.style.backgroundColor = "#e0e0e0";
4061
- e.currentTarget.style.outline = "2px solid var(--primary-color, #222f67)";
4062
- e.currentTarget.style.outlineOffset = "2px";
4063
- },
4064
- onBlur: e => {
4065
- e.currentTarget.style.backgroundColor = "transparent";
4066
- e.currentTarget.style.outline = "none";
4067
- },
4068
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFontawesome.FontAwesomeIcon, {
4069
- icon: _freeSolidSvgIcons.faTimes,
4070
- style: {
4071
- fontSize: "14px",
4072
- color: "#666"
4073
- },
4074
- "aria-hidden": "true"
4075
- })
4076
- })]
4077
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
4078
- style: {
4079
- padding: "8px"
4080
- },
4081
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.MenuItem, {
4082
- onClick: () => {
4083
- window.open("tel:+212520473100", "_self");
4084
- handleContactUsMenuClose();
4085
- },
4086
- onKeyDown: e => {
4087
- if (e.key === "Enter" || e.key === " ") {
4088
- e.preventDefault();
4089
- window.open("tel:+212520473100", "_self");
4090
- handleContactUsMenuClose();
4091
- }
4092
- },
4093
- tabIndex: 0,
4094
- sx: {
4095
- borderRadius: 1,
4096
- mb: 0.5,
4097
- py: 1.5,
4098
- "&:hover": {
4099
- backgroundColor: "var(--primary-alpha-8, rgba(34, 47, 103, 0.08))"
4100
- },
4101
- "&:focus": {
4102
- backgroundColor: "var(--primary-alpha-8, rgba(34, 47, 103, 0.08))",
4103
- outline: "2px solid var(--primary-color, #222f67)",
4104
- outlineOffset: "2px"
4105
- }
4106
- },
4107
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItemIcon, {
4108
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_iconsMaterial.Phone, {
4109
- fontSize: "small",
4110
- sx: {
4111
- color: "var(--primary-color, #222f67)"
4112
- },
4113
- "aria-hidden": "true"
4114
- })
4115
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItemText, {
4116
- primary: "Assistance t\xE9l\xE9phonique",
4117
- secondary: "+212 520 47 31 00",
4118
- primaryTypographyProps: {
4119
- fontSize: "14px",
4120
- fontWeight: "500"
4121
- },
4122
- secondaryTypographyProps: {
4123
- fontSize: "12px"
4124
- }
4125
- })]
4126
- })
4127
- })]
4128
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(ReclamationFormModal, {
4129
- open: reclamationModalOpen,
4130
- onClose: () => setReclamationModalOpen(false)
4131
- })]
4132
- });
4133
- };
4134
- var _default = exports.default = PuiHelpWidget;