@portnet/ui 5.0.23 → 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,4137 +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
- portailId = null
1259
- } = _ref4;
1260
- const [activeStep, setActiveStep] = (0, _react.useState)(0);
1261
- const [formData, setFormData] = (0, _react.useState)({
1262
- type: "",
1263
- service: "",
1264
- objet: "",
1265
- sujet: "",
1266
- files: []
1267
- });
1268
- const [submitted, setSubmitted] = (0, _react.useState)(false);
1269
- const [referenceNumber, setReferenceNumber] = (0, _react.useState)("");
1270
- const {
1271
- mutate: createReclamation,
1272
- isLoading
1273
- } = (0, _useReclamation.useCreateReclamation)(portailId);
1274
- const {
1275
- data: listServiceReclamation,
1276
- isFetching: isFetchingListServiceReclamation
1277
- } = (0, _useReclamation.useListServiceReclamation)(portailId);
1278
- const [error, setError] = (0, _react.useState)(null);
1279
- const errorRef = (0, _react.useRef)(null);
1280
- const CustomPopper = props => /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Popper, _objectSpread(_objectSpread({}, props), {}, {
1281
- placement: "bottom-start",
1282
- disablePortal: true
1283
- }));
1284
- const reclamationTypes = [{
1285
- codigo: "BESOIN_INFORMATIONS",
1286
- libelle: "Besoin d'informations"
1287
- }, {
1288
- codigo: "RECLAMATION",
1289
- libelle: "Réclamation"
1290
- }, {
1291
- codigo: "SIGNALER_INCIDENT_TECHNIQUE",
1292
- libelle: "Signaler un incident technique"
1293
- }];
1294
- const steps = ["Type de demande", "Service concerné", "Détails"];
1295
- const ALLOWED_FILE_TYPES = {
1296
- extensions: ".pdf,.doc,.docx,.xls,.xlsx,.jpg,.jpeg,.png,.gif",
1297
- 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"]
1298
- };
1299
- (0, _react.useEffect)(() => {
1300
- if (!open) {
1301
- setTimeout(() => {
1302
- setActiveStep(0);
1303
- setFormData({
1304
- type: "",
1305
- service: "",
1306
- objet: "",
1307
- sujet: "",
1308
- files: []
1309
- });
1310
- setSubmitted(false);
1311
- setReferenceNumber("");
1312
- }, 300);
1313
- }
1314
- }, [open]);
1315
- (0, _react.useEffect)(() => {
1316
- if (error && errorRef.current) {
1317
- errorRef.current.scrollIntoView({
1318
- behavior: "smooth",
1319
- block: "center"
1320
- });
1321
- }
1322
- }, [error]);
1323
- const handleNext = () => {
1324
- setActiveStep(prev => prev + 1);
1325
- };
1326
- const handleBack = () => {
1327
- setActiveStep(prev => prev - 1);
1328
- };
1329
- const handleTypeChange = value => {
1330
- setFormData(prev => _objectSpread(_objectSpread({}, prev), {}, {
1331
- type: value
1332
- }));
1333
- };
1334
- const handleServiceChange = (event, value) => {
1335
- setFormData(prev => _objectSpread(_objectSpread({}, prev), {}, {
1336
- service: value
1337
- }));
1338
- };
1339
- const handleFileSelect = event => {
1340
- const newFiles = Array.from(event.target.files);
1341
- const maxSize = 2 * 1024 * 1024;
1342
- let hasErrors = false;
1343
- let errorMessages = [];
1344
- setError(null);
1345
- const validFiles = newFiles.filter(file => {
1346
- if (!ALLOWED_FILE_TYPES.mimeTypes.includes(file.type)) {
1347
- const errorMsg = "".concat(file.name, ": Type de fichier non autoris\xE9.");
1348
- errorMessages.push(errorMsg);
1349
- hasErrors = true;
1350
- return false;
1351
- }
1352
- if (file.size > maxSize) {
1353
- const errorMsg = "".concat(file.name, ": Taille sup\xE9rieure \xE0 2 Mo.");
1354
- errorMessages.push(errorMsg);
1355
- hasErrors = true;
1356
- return false;
1357
- }
1358
- return true;
1359
- });
1360
- if (hasErrors) {
1361
- const fullError = errorMessages.join(" ");
1362
- setError(fullError);
1363
- _reactToastify.toast.error(fullError);
1364
- }
1365
- setFormData(prev => _objectSpread(_objectSpread({}, prev), {}, {
1366
- files: [...prev.files, ...validFiles]
1367
- }));
1368
- };
1369
- const removeFile = indexToRemove => {
1370
- setFormData(prev => _objectSpread(_objectSpread({}, prev), {}, {
1371
- files: prev.files.filter((_, index) => index !== indexToRemove)
1372
- }));
1373
- };
1374
- const handleSubmit = () => {
1375
- setError(null);
1376
- createReclamation(formData, {
1377
- onSuccess: res => {
1378
- setReferenceNumber(res === null || res === void 0 ? void 0 : res.reference);
1379
- setSubmitted(true);
1380
- setError(null);
1381
- },
1382
- onError: err => {
1383
- var _err$response$data$me, _err$response;
1384
- 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.";
1385
- setError(errorMessage);
1386
- _reactToastify.toast.error(errorMessage);
1387
- }
1388
- });
1389
- };
1390
- const handleClose = () => {
1391
- setError(null);
1392
- onClose();
1393
- };
1394
- const canProceedStep1 = formData.type !== "";
1395
- const canProceedStep2 = formData.service !== "";
1396
- const canSubmit = formData.objet && formData.sujet;
1397
- const renderStepContent = () => {
1398
- switch (activeStep) {
1399
- case 0:
1400
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Fade, {
1401
- in: true,
1402
- timeout: 500,
1403
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
1404
- className: "step-content",
1405
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
1406
- variant: "h5",
1407
- className: "step-title",
1408
- gutterBottom: true,
1409
- children: "Quel est le type de votre demande ?"
1410
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
1411
- variant: "body2",
1412
- color: "text.secondary",
1413
- sx: {
1414
- mb: 4
1415
- },
1416
- children: "S\xE9lectionnez le type qui correspond le mieux \xE0 votre besoin"
1417
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.FormControl, {
1418
- fullWidth: true,
1419
- variant: "outlined",
1420
- className: "type-select",
1421
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.InputLabel, {
1422
- id: "type-label",
1423
- children: "Type de demande"
1424
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Select, {
1425
- labelId: "type-label",
1426
- value: formData.type,
1427
- onChange: e => handleTypeChange(e.target.value),
1428
- label: "Type de demande",
1429
- children: reclamationTypes.map(type => /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.MenuItem, {
1430
- value: type.codigo,
1431
- children: type.libelle
1432
- }, type.codigo))
1433
- })]
1434
- })]
1435
- })
1436
- });
1437
- case 1:
1438
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Fade, {
1439
- in: true,
1440
- timeout: 500,
1441
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
1442
- className: "step-content",
1443
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
1444
- variant: "h5",
1445
- className: "step-title",
1446
- gutterBottom: true,
1447
- children: "Quel service est concern\xE9 ?"
1448
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
1449
- variant: "body2",
1450
- color: "text.secondary",
1451
- sx: {
1452
- mb: formData.type === "Besoin d'informations" ? 3 : 4
1453
- },
1454
- children: "Recherchez et s\xE9lectionnez le service appropri\xE9"
1455
- }), formData.type === "Besoin d'informations" && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Alert, {
1456
- severity: "Besoin d'informations",
1457
- icon: false,
1458
- sx: {
1459
- mb: 3,
1460
- pt: 1,
1461
- pb: 1,
1462
- borderRadius: 2,
1463
- backgroundColor: "#f5f9ff",
1464
- border: "1px solid #90caf9",
1465
- display: "flex",
1466
- flexDirection: "column",
1467
- maxWidth: 400,
1468
- mx: "auto"
1469
- },
1470
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.AlertTitle, {
1471
- sx: {
1472
- fontWeight: 600
1473
- },
1474
- children: "Besoin d'aide imm\xE9diate ?"
1475
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Typography, {
1476
- variant: "body2",
1477
- sx: {
1478
- mt: 0.5,
1479
- textAlign: "center"
1480
- },
1481
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("strong", {
1482
- children: "Assistance t\xE9l\xE9phonique: "
1483
- }), " \uD83D\uDCDE +212 520 47 31 00"]
1484
- })]
1485
- }), formData.type === "Besoin d'informations" && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
1486
- sx: {
1487
- mt: 3
1488
- }
1489
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Autocomplete, {
1490
- options: listServiceReclamation || [],
1491
- loading: isFetchingListServiceReclamation,
1492
- value: formData.service || "",
1493
- onChange: handleServiceChange,
1494
- getOptionLabel: option => (option === null || option === void 0 ? void 0 : option.libelle) || "",
1495
- renderInput: params => /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.TextField, _objectSpread(_objectSpread({}, params), {}, {
1496
- label: "Rechercher un service",
1497
- placeholder: "Commencez \xE0 taper...",
1498
- variant: "outlined",
1499
- fullWidth: true
1500
- })),
1501
- renderOption: (props, option) => /*#__PURE__*/(0, _jsxRuntime.jsx)("li", _objectSpread(_objectSpread({}, props), {}, {
1502
- className: "service-option",
1503
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
1504
- display: "flex",
1505
- alignItems: "center",
1506
- gap: 1,
1507
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
1508
- className: "service-bullet"
1509
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
1510
- children: option === null || option === void 0 ? void 0 : option.libelle
1511
- })]
1512
- })
1513
- })),
1514
- PopperComponent: CustomPopper,
1515
- noOptionsText: "Aucun service trouv\xE9",
1516
- className: "service-autocomplete"
1517
- })]
1518
- })
1519
- });
1520
- case 2:
1521
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Fade, {
1522
- in: true,
1523
- timeout: 500,
1524
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
1525
- className: "step-content details-step",
1526
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
1527
- variant: "h5",
1528
- className: "step-title",
1529
- gutterBottom: true,
1530
- children: "Compl\xE9tez votre demande"
1531
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
1532
- variant: "body2",
1533
- color: "text.secondary",
1534
- sx: {
1535
- mb: 4
1536
- },
1537
- children: "Fournissez les d\xE9tails n\xE9cessaires pour traiter votre demande"
1538
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
1539
- className: "form-fields",
1540
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.TextField, {
1541
- fullWidth: true,
1542
- required: true,
1543
- label: "Objet",
1544
- placeholder: "R\xE9sum\xE9 de votre demande",
1545
- value: formData.objet,
1546
- onChange: e => setFormData(prev => _objectSpread(_objectSpread({}, prev), {}, {
1547
- objet: e.target.value
1548
- })),
1549
- variant: "outlined",
1550
- className: "form-field"
1551
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.TextField, {
1552
- fullWidth: true,
1553
- required: true,
1554
- label: "Sujet",
1555
- placeholder: "D\xE9crivez en d\xE9tail votre demande...",
1556
- value: formData.sujet,
1557
- onChange: e => setFormData(prev => _objectSpread(_objectSpread({}, prev), {}, {
1558
- sujet: e.target.value
1559
- })),
1560
- variant: "outlined",
1561
- multiline: true,
1562
- rows: 6,
1563
- className: "form-field",
1564
- inputProps: {
1565
- maxLength: 500
1566
- }
1567
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
1568
- className: "file-upload-section",
1569
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
1570
- type: "file",
1571
- id: "file-upload",
1572
- accept: ALLOWED_FILE_TYPES.extensions,
1573
- hidden: true,
1574
- multiple: true,
1575
- onChange: handleFileSelect
1576
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
1577
- htmlFor: "file-upload",
1578
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
1579
- variant: "outlined",
1580
- component: "span",
1581
- startIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_iconsMaterial.CloudUpload, {}),
1582
- className: "upload-button",
1583
- fullWidth: true,
1584
- children: "Joindre des fichiers (optionnel)"
1585
- })
1586
- }), error && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Alert, {
1587
- ref: errorRef,
1588
- severity: "error",
1589
- onClose: () => setError(null),
1590
- style: {
1591
- marginTop: "12px"
1592
- },
1593
- children: error
1594
- }), formData.files.length > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
1595
- sx: {
1596
- mt: 2,
1597
- display: "flex",
1598
- flexWrap: "wrap",
1599
- gap: 1
1600
- },
1601
- children: formData.files.map((file, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Chip, {
1602
- icon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_iconsMaterial.AttachFile, {}),
1603
- label: file.name,
1604
- onDelete: () => removeFile(index),
1605
- className: "file-chip",
1606
- color: "primary",
1607
- variant: "outlined"
1608
- }, index))
1609
- })]
1610
- })]
1611
- })]
1612
- })
1613
- });
1614
- default:
1615
- return null;
1616
- }
1617
- };
1618
- if (submitted) {
1619
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Dialog, {
1620
- open: open,
1621
- onClose: handleClose,
1622
- maxWidth: "sm",
1623
- fullWidth: true,
1624
- className: "reclamation-modal success-modal",
1625
- PaperProps: {
1626
- className: "modal-paper"
1627
- },
1628
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.DialogContent, {
1629
- className: "success-content",
1630
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Zoom, {
1631
- in: true,
1632
- timeout: 500,
1633
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
1634
- className: "success-container",
1635
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_iconsMaterial.CheckCircle, {
1636
- className: "success-icon"
1637
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
1638
- variant: "h5",
1639
- className: "success-title",
1640
- gutterBottom: true,
1641
- children: "Demande enregistr\xE9e !"
1642
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
1643
- variant: "body1",
1644
- color: "text.secondary",
1645
- sx: {
1646
- mb: 3
1647
- },
1648
- children: "Votre demande a \xE9t\xE9 prise en charge avec succ\xE8s"
1649
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Paper, {
1650
- elevation: 3,
1651
- className: "reference-box",
1652
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
1653
- variant: "h5",
1654
- className: "reference-number",
1655
- children: referenceNumber
1656
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
1657
- variant: "caption",
1658
- color: "text.secondary",
1659
- sx: {
1660
- mt: 1,
1661
- display: "block"
1662
- },
1663
- children: "Conservez ce num\xE9ro pour suivre votre demande"
1664
- })]
1665
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
1666
- variant: "contained",
1667
- onClick: handleClose,
1668
- size: "large",
1669
- className: "close-success-button",
1670
- fullWidth: true,
1671
- children: "Fermer"
1672
- })]
1673
- })
1674
- })
1675
- })
1676
- });
1677
- }
1678
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Dialog, {
1679
- open: open,
1680
- onClose: handleClose,
1681
- maxWidth: "md",
1682
- fullWidth: true,
1683
- scroll: "body",
1684
- className: "reclamation-modal",
1685
- PaperProps: {
1686
- className: "modal-paper"
1687
- },
1688
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
1689
- className: "modal-header",
1690
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
1691
- display: "flex",
1692
- alignItems: "center",
1693
- gap: 2,
1694
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
1695
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
1696
- variant: "h6",
1697
- className: "header-title",
1698
- children: "Nouvelle r\xE9clamation"
1699
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Typography, {
1700
- variant: "caption",
1701
- color: "white",
1702
- children: ["Remplissez ce formulaire en ", steps.length, " \xE9tapes"]
1703
- })]
1704
- })
1705
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.IconButton, {
1706
- onClick: handleClose,
1707
- className: "close-button",
1708
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_iconsMaterial.Close, {})
1709
- })]
1710
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
1711
- className: "progress-section",
1712
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.LinearProgress, {
1713
- variant: "determinate",
1714
- value: activeStep / (steps.length - 1) * 100,
1715
- className: "progress-bar"
1716
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Stepper, {
1717
- activeStep: activeStep,
1718
- className: "stepper",
1719
- children: steps.map(label => /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Step, {
1720
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.StepLabel, {
1721
- children: label
1722
- })
1723
- }, label))
1724
- })]
1725
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.DialogContent, {
1726
- className: "modal-content",
1727
- style: {
1728
- overflow: activeStep === 1 ? "visible" : "auto"
1729
- },
1730
- children: renderStepContent()
1731
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
1732
- className: "modal-footer",
1733
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
1734
- onClick: handleBack,
1735
- disabled: activeStep === 0,
1736
- startIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_iconsMaterial.ArrowBack, {}),
1737
- className: "back-button",
1738
- children: "Retour"
1739
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
1740
- flex: 1
1741
- }), activeStep < steps.length - 1 ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
1742
- variant: "contained",
1743
- onClick: handleNext,
1744
- endIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_iconsMaterial.ArrowForward, {}),
1745
- disabled: activeStep === 0 && !canProceedStep1 || activeStep === 1 && !canProceedStep2,
1746
- className: "next-button",
1747
- children: "Suivant"
1748
- }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
1749
- variant: "contained",
1750
- onClick: handleSubmit,
1751
- disabled: !canSubmit || isLoading,
1752
- className: "submit-button",
1753
- startIcon: isLoading ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.CircularProgress, {
1754
- size: 16,
1755
- sx: {
1756
- color: "var(--primary-color, #222f67)"
1757
- }
1758
- }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_iconsMaterial.CheckCircle, {}),
1759
- children: isLoading ? "Envoi en cours..." : "Soumettre"
1760
- })]
1761
- })]
1762
- });
1763
- };
1764
- const ReclamationsList = _ref5 => {
1765
- var _selectedReclamation$, _selectedReclamation$2, _selectedReclamation$3;
1766
- let {
1767
- onClose
1768
- } = _ref5;
1769
- const queryClient = (0, _reactQuery.useQueryClient)();
1770
- const [selectedReclamation, setSelectedReclamation] = (0, _react.useState)(null);
1771
- const [detailsDialogOpen, setDetailsDialogOpen] = (0, _react.useState)(false);
1772
- const [page, setPage] = (0, _react.useState)(1);
1773
- const [search, setSearch] = (0, _react.useState)();
1774
- const [searchKey, setSearchKey] = (0, _react.useState)("");
1775
- const STATUT_REPONDUE = "REPONDUE";
1776
- const STATUT_COLOR_MAP = {
1777
- EN_ATTENTE: "#2196F3",
1778
- EN_COURS: "#FF9800",
1779
- REPONDUE: "#9C27B0",
1780
- REOUVERTE: "#FF5722",
1781
- CLOTUREE: "#4CAF50",
1782
- TRAITE: "#4CAF50"
1783
- };
1784
- const STATUT_ICON_MAP = {
1785
- EN_ATTENTE: "🕐",
1786
- EN_COURS: "⚙️",
1787
- REPONDUE: "💬",
1788
- REOUVERTE: "🔄",
1789
- CLOTUREE: "🔒"
1790
- };
1791
- const getStatusColorByCode = code => STATUT_COLOR_MAP[(code || "").toUpperCase()] || "#757575";
1792
- const [reouvreDialogOpen, setReouvreDialogOpen] = (0, _react.useState)(false);
1793
- const [reouvreDescription, setReouvreDescription] = (0, _react.useState)("");
1794
- const [reouvreFiles, setReouvreFiles] = (0, _react.useState)([]);
1795
- const reouvreFileInputRef = (0, _react.useRef)(null);
1796
- const {
1797
- data: reclamations,
1798
- isFetching,
1799
- error
1800
- } = (0, _useReclamation.useListReclamation)(page, searchKey);
1801
- const {
1802
- mutate: downloadDocument,
1803
- isLoading: isDownloading,
1804
- error: errorDownloadDocument
1805
- } = (0, _useReclamation.useDownloadDocument)();
1806
- const {
1807
- mutate: clotureReclamation,
1808
- isLoading: isCloturing
1809
- } = (0, _useReclamation.useClotureReclamation)();
1810
- const {
1811
- mutate: reouvreReclamation,
1812
- isLoading: isReouvring
1813
- } = (0, _useReclamation.useReouvreReclamation)();
1814
- const getStatusColor = statut => {
1815
- switch ((statut || "").toLowerCase()) {
1816
- case "traité":
1817
- case "cloturee":
1818
- return "#4CAF50";
1819
- case "en cours":
1820
- return "#FF9800";
1821
- case "en attente":
1822
- return "#2196F3";
1823
- case "repondue":
1824
- return "#9C27B0";
1825
- case "reouverte":
1826
- return "#FF5722";
1827
- default:
1828
- return "#757575";
1829
- }
1830
- };
1831
- const renderTextWithLinks = text => {
1832
- if (!text) return null;
1833
- const parts = text.split(/(https?:\/\/[^\s)]+)/g);
1834
- return parts.map((part, i) => /^https?:\/\//.test(part) ? /*#__PURE__*/(0, _jsxRuntime.jsx)("a", {
1835
- href: part,
1836
- target: "_blank",
1837
- rel: "noopener noreferrer",
1838
- style: {
1839
- color: "var(--primary-color, #222f67)",
1840
- wordBreak: "break-all"
1841
- },
1842
- children: part
1843
- }, i) : /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
1844
- children: part
1845
- }, i));
1846
- };
1847
- const handleReclamationClick = reclamation => {
1848
- setSelectedReclamation(reclamation);
1849
- setDetailsDialogOpen(true);
1850
- };
1851
- const handleCloseDetails = () => {
1852
- setDetailsDialogOpen(false);
1853
- setSelectedReclamation(null);
1854
- };
1855
- const handleCloturer = () => {
1856
- if (!(selectedReclamation !== null && selectedReclamation !== void 0 && selectedReclamation.id)) return;
1857
- clotureReclamation(selectedReclamation.id, {
1858
- onSuccess: () => {
1859
- queryClient.invalidateQueries("reclamations");
1860
- handleCloseDetails();
1861
- _reactToastify.toast.success("Réclamation clôturée avec succès.");
1862
- },
1863
- onError: err => {
1864
- var _err$response$data$me2, _err$response2;
1865
- 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.";
1866
- _reactToastify.toast.error(msg);
1867
- }
1868
- });
1869
- };
1870
- const handleOpenReouvreDialog = () => {
1871
- setReouvreDescription("");
1872
- setReouvreFiles([]);
1873
- setReouvreDialogOpen(true);
1874
- };
1875
- const handleCloseReouvreDialog = () => {
1876
- setReouvreDialogOpen(false);
1877
- setReouvreDescription("");
1878
- setReouvreFiles([]);
1879
- };
1880
- const handleReouvreFileSelect = e => {
1881
- const selected = Array.from(e.target.files);
1882
- setReouvreFiles(prev => [...prev, ...selected]);
1883
- e.target.value = "";
1884
- };
1885
- const handleRemoveReouvreFile = index => {
1886
- setReouvreFiles(prev => prev.filter((_, i) => i !== index));
1887
- };
1888
- const handleSubmitReouvreture = () => {
1889
- if (!(selectedReclamation !== null && selectedReclamation !== void 0 && selectedReclamation.id) || !reouvreDescription.trim()) return;
1890
- const formData = new FormData();
1891
- formData.append("description", reouvreDescription.trim());
1892
- reouvreFiles.forEach(file => formData.append("files", file));
1893
- reouvreReclamation({
1894
- id: selectedReclamation.id,
1895
- formData
1896
- }, {
1897
- onSuccess: () => {
1898
- queryClient.invalidateQueries("reclamations");
1899
- handleCloseReouvreDialog();
1900
- handleCloseDetails();
1901
- _reactToastify.toast.success("Réclamation réouverte avec succès.");
1902
- },
1903
- onError: err => {
1904
- var _err$response$data$me3, _err$response3;
1905
- 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.";
1906
- _reactToastify.toast.error(msg);
1907
- }
1908
- });
1909
- };
1910
- const formatDate = dateString => {
1911
- const date = new Date(dateString);
1912
- return date.toLocaleDateString("fr-FR", {
1913
- day: "2-digit",
1914
- month: "2-digit",
1915
- year: "numeric",
1916
- hour: "2-digit",
1917
- minute: "2-digit"
1918
- });
1919
- };
1920
- const handleDownload = (documentGuid, documentName) => {
1921
- downloadDocument(documentGuid, {
1922
- onSuccess: res => {
1923
- if (!(res !== null && res !== void 0 && res.data) || !(res !== null && res !== void 0 && res.fileName)) {
1924
- console.error("No file data or filename received");
1925
- return;
1926
- }
1927
- const byteCharacters = atob(res.data);
1928
- const byteNumbers = new Array(byteCharacters.length);
1929
- for (let i = 0; i < byteCharacters.length; i++) {
1930
- byteNumbers[i] = byteCharacters.charCodeAt(i);
1931
- }
1932
- const byteArray = new Uint8Array(byteNumbers);
1933
- const blob = new Blob([byteArray], {
1934
- type: "application/octet-stream"
1935
- });
1936
- const link = document.createElement("a");
1937
- link.href = URL.createObjectURL(blob);
1938
- link.download = documentName;
1939
- document.body.appendChild(link);
1940
- link.click();
1941
- document.body.removeChild(link);
1942
- URL.revokeObjectURL(link.href);
1943
- },
1944
- onError: err => {
1945
- console.error("Error downloading document:", err);
1946
- }
1947
- });
1948
- };
1949
- const onSearch = () => {
1950
- setPage(1);
1951
- setSearchKey(search);
1952
- };
1953
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
1954
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
1955
- style: {
1956
- flex: 1,
1957
- display: "flex",
1958
- flexDirection: "column",
1959
- backgroundColor: "#f5f5f5",
1960
- minHeight: 0
1961
- },
1962
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
1963
- style: {
1964
- display: "flex",
1965
- justifyContent: "space-between",
1966
- alignItems: "center",
1967
- padding: "16px",
1968
- backgroundColor: "white",
1969
- borderBottom: "1px solid #e0e0e0"
1970
- },
1971
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
1972
- style: {
1973
- display: "flex",
1974
- alignItems: "center",
1975
- gap: "12px"
1976
- },
1977
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFontawesome.FontAwesomeIcon, {
1978
- icon: _freeSolidSvgIcons.faClipboardList,
1979
- style: {
1980
- color: "var(--primary-color, #222f67)",
1981
- fontSize: "20px"
1982
- }
1983
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
1984
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
1985
- component: "div",
1986
- sx: {
1987
- fontWeight: "600",
1988
- color: "#333",
1989
- fontSize: "16px",
1990
- fontFamily: WIDGET_FONT,
1991
- margin: 0,
1992
- lineHeight: "normal"
1993
- },
1994
- children: "Mes r\xE9clamations"
1995
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Typography, {
1996
- component: "div",
1997
- sx: {
1998
- color: "#999",
1999
- fontSize: "12px",
2000
- fontFamily: WIDGET_FONT,
2001
- margin: 0,
2002
- lineHeight: "normal"
2003
- },
2004
- children: [(reclamations === null || reclamations === void 0 ? void 0 : reclamations.totalElements) || 0, " r\xE9clamation(s)"]
2005
- })]
2006
- })]
2007
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
2008
- onClick: onClose,
2009
- style: {
2010
- cursor: "pointer",
2011
- color: "#666",
2012
- padding: "4px",
2013
- display: "flex",
2014
- alignItems: "center"
2015
- },
2016
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFontawesome.FontAwesomeIcon, {
2017
- icon: _freeSolidSvgIcons.faTimes,
2018
- style: {
2019
- fontSize: "16px"
2020
- }
2021
- })
2022
- })]
2023
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2024
- className: "search-fields",
2025
- style: {
2026
- display: "flex",
2027
- justifyContent: "center",
2028
- padding: "12px",
2029
- paddingBottom: "0px"
2030
- },
2031
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.TextField, {
2032
- placeholder: "R\xE9clamation / R\xE9f\xE9rence",
2033
- variant: "outlined",
2034
- size: "small",
2035
- value: search,
2036
- onChange: e => setSearch(e.target.value),
2037
- fullWidth: true,
2038
- InputLabelProps: {
2039
- style: {
2040
- fontSize: 12
2041
- }
2042
- },
2043
- sx: {
2044
- "& .MuiOutlinedInput-root.Mui-focused .MuiOutlinedInput-notchedOutline": {
2045
- borderColor: "var(--primary-color, #222f67)"
2046
- }
2047
- }
2048
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
2049
- onClick: onSearch,
2050
- variant: "contained",
2051
- sx: {
2052
- minWidth: "48px",
2053
- width: "48px",
2054
- height: "40px",
2055
- borderRadius: "5px",
2056
- backgroundColor: "var(--primary-color, #222f67)",
2057
- "&:hover": {
2058
- backgroundColor: "var(--primary-color, #222f67)",
2059
- opacity: 0.9
2060
- },
2061
- flexShrink: 0,
2062
- marginLeft: "0px",
2063
- boxShadow: "none",
2064
- padding: 0
2065
- },
2066
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_iconsMaterial.Search, {
2067
- sx: {
2068
- color: "white",
2069
- fontSize: "25px"
2070
- }
2071
- })
2072
- })]
2073
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
2074
- style: {
2075
- flex: 1,
2076
- overflowY: "auto",
2077
- padding: "8px",
2078
- minHeight: 0
2079
- },
2080
- children: isFetching ? /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
2081
- style: {
2082
- display: "flex",
2083
- justifyContent: "center",
2084
- padding: "24px"
2085
- },
2086
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.CircularProgress, {
2087
- size: 32,
2088
- sx: {
2089
- color: "var(--primary-color, #222f67)"
2090
- }
2091
- })
2092
- }) : (reclamations === null || reclamations === void 0 ? void 0 : reclamations.totalElements) === 0 ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2093
- style: {
2094
- display: "flex",
2095
- flexDirection: "column",
2096
- alignItems: "center",
2097
- justifyContent: "center",
2098
- padding: "40px 20px",
2099
- color: "#999"
2100
- },
2101
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFontawesome.FontAwesomeIcon, {
2102
- icon: _freeSolidSvgIcons.faClipboardList,
2103
- style: {
2104
- fontSize: "48px",
2105
- marginBottom: "32px"
2106
- }
2107
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
2108
- component: "div",
2109
- sx: {
2110
- fontSize: "14px",
2111
- textAlign: "center",
2112
- fontFamily: WIDGET_FONT,
2113
- lineHeight: "normal",
2114
- color: "#999"
2115
- },
2116
- children: "Aucune r\xE9clamation trouv\xE9e"
2117
- })]
2118
- }) : /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2119
- children: [((reclamations === null || reclamations === void 0 ? void 0 : reclamations.content) || []).map(reclamation => /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2120
- onClick: () => handleReclamationClick(reclamation),
2121
- style: {
2122
- backgroundColor: "white",
2123
- borderRadius: "8px",
2124
- padding: "16px",
2125
- marginBottom: "5px",
2126
- cursor: "pointer",
2127
- boxShadow: "0 1px 3px rgba(0,0,0,0.1)",
2128
- transition: "all 0.2s ease",
2129
- border: "1px solid #e0e0e0"
2130
- },
2131
- onMouseEnter: e => {
2132
- e.currentTarget.style.boxShadow = "0 4px 8px rgba(0,0,0,0.15)";
2133
- e.currentTarget.style.transform = "translateY(-2px)";
2134
- },
2135
- onMouseLeave: e => {
2136
- e.currentTarget.style.boxShadow = "0 1px 3px rgba(0,0,0,0.1)";
2137
- e.currentTarget.style.transform = "translateY(0)";
2138
- },
2139
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2140
- style: {
2141
- display: "flex",
2142
- justifyContent: "space-between",
2143
- alignItems: "center",
2144
- marginBottom: "12px"
2145
- },
2146
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
2147
- component: "div",
2148
- sx: {
2149
- fontWeight: "600",
2150
- color: "var(--primary-color, #222f67)",
2151
- fontSize: "14px",
2152
- fontFamily: WIDGET_FONT,
2153
- lineHeight: "normal"
2154
- },
2155
- children: reclamation === null || reclamation === void 0 ? void 0 : reclamation.reference
2156
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
2157
- component: "div",
2158
- sx: {
2159
- padding: "4px 12px",
2160
- borderRadius: "12px",
2161
- backgroundColor: getStatusColor(reclamation === null || reclamation === void 0 ? void 0 : reclamation.statut) + "20",
2162
- color: getStatusColor(reclamation === null || reclamation === void 0 ? void 0 : reclamation.statut),
2163
- fontSize: "11px",
2164
- fontWeight: "600",
2165
- fontFamily: WIDGET_FONT,
2166
- lineHeight: "normal"
2167
- },
2168
- children: reclamation === null || reclamation === void 0 ? void 0 : reclamation.statut
2169
- })]
2170
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
2171
- component: "div",
2172
- sx: {
2173
- fontWeight: "500",
2174
- color: "#333",
2175
- fontSize: "13px",
2176
- marginBottom: "8px",
2177
- fontFamily: WIDGET_FONT,
2178
- lineHeight: "normal"
2179
- },
2180
- children: reclamation === null || reclamation === void 0 ? void 0 : reclamation.objet
2181
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2182
- style: {
2183
- display: "flex",
2184
- justifyContent: "space-between",
2185
- alignItems: "center"
2186
- },
2187
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
2188
- component: "div",
2189
- sx: {
2190
- color: "#999",
2191
- fontSize: "11px",
2192
- fontFamily: WIDGET_FONT,
2193
- lineHeight: "normal"
2194
- },
2195
- children: formatDate(reclamation === null || reclamation === void 0 ? void 0 : reclamation.dateCreation)
2196
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Typography, {
2197
- component: "div",
2198
- sx: {
2199
- display: "flex",
2200
- alignItems: "center",
2201
- gap: "4px",
2202
- color: "var(--primary-color, #222f67)",
2203
- fontSize: "11px",
2204
- fontWeight: "500",
2205
- fontFamily: WIDGET_FONT,
2206
- lineHeight: "normal"
2207
- },
2208
- children: ["Voir d\xE9tails", /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFontawesome.FontAwesomeIcon, {
2209
- icon: _freeSolidSvgIcons.faEye
2210
- })]
2211
- })]
2212
- })]
2213
- }, reclamation === null || reclamation === void 0 ? void 0 : reclamation.id)), (reclamations === null || reclamations === void 0 ? void 0 : reclamations.totalPages) > 1 && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
2214
- style: {
2215
- display: "flex",
2216
- justifyContent: "center",
2217
- marginTop: "8px",
2218
- marginBottom: "8px"
2219
- },
2220
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Pagination, {
2221
- size: "small",
2222
- variant: "outlined",
2223
- count: (reclamations === null || reclamations === void 0 ? void 0 : reclamations.totalPages) || 0,
2224
- page: page,
2225
- onChange: (event, value) => setPage(value)
2226
- })
2227
- })]
2228
- })
2229
- })]
2230
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Dialog, {
2231
- open: detailsDialogOpen,
2232
- onClose: handleCloseDetails,
2233
- maxWidth: "sm",
2234
- fullWidth: true,
2235
- PaperProps: {
2236
- sx: {
2237
- borderRadius: 3,
2238
- boxShadow: "0 8px 32px rgba(0,0,0,0.12)"
2239
- }
2240
- },
2241
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.DialogTitle, {
2242
- sx: {
2243
- backgroundColor: "#f8f9fa",
2244
- borderBottom: "1px solid #e0e0e0",
2245
- display: "flex",
2246
- justifyContent: "space-between",
2247
- alignItems: "center",
2248
- padding: "20px 24px"
2249
- },
2250
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2251
- style: {
2252
- display: "flex",
2253
- alignItems: "center",
2254
- gap: "12px"
2255
- },
2256
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFontawesome.FontAwesomeIcon, {
2257
- icon: _freeSolidSvgIcons.faInfoCircle,
2258
- style: {
2259
- color: "var(--primary-color, #222f67)",
2260
- fontSize: "20px"
2261
- }
2262
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2263
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
2264
- component: "div",
2265
- sx: {
2266
- fontWeight: "700",
2267
- fontSize: "16px",
2268
- margin: 0
2269
- },
2270
- children: "D\xE9tails de la r\xE9clamation"
2271
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
2272
- component: "div",
2273
- sx: {
2274
- color: "#666",
2275
- fontSize: "12px",
2276
- marginTop: "3px"
2277
- },
2278
- children: selectedReclamation === null || selectedReclamation === void 0 ? void 0 : selectedReclamation.reference
2279
- })]
2280
- })]
2281
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Chip, {
2282
- label: selectedReclamation === null || selectedReclamation === void 0 ? void 0 : selectedReclamation.statut,
2283
- size: "small",
2284
- sx: {
2285
- backgroundColor: getStatusColor((selectedReclamation === null || selectedReclamation === void 0 ? void 0 : selectedReclamation.statut) || "") + "20",
2286
- color: getStatusColor((selectedReclamation === null || selectedReclamation === void 0 ? void 0 : selectedReclamation.statut) || ""),
2287
- fontWeight: 600,
2288
- fontSize: "11px"
2289
- }
2290
- })]
2291
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.DialogContent, {
2292
- sx: {
2293
- padding: "24px"
2294
- },
2295
- children: selectedReclamation && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2296
- style: {
2297
- display: "flex",
2298
- flexDirection: "column",
2299
- gap: "20px"
2300
- },
2301
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2302
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
2303
- component: "div",
2304
- sx: {
2305
- fontSize: "11px",
2306
- color: "#999",
2307
- fontWeight: "500",
2308
- marginBottom: "6px",
2309
- textTransform: "uppercase",
2310
- letterSpacing: "0.5px",
2311
- fontWeight: "500",
2312
- fontFamily: WIDGET_FONT
2313
- },
2314
- children: "Type de demande"
2315
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
2316
- component: "div",
2317
- sx: {
2318
- fontSize: "14px",
2319
- color: "#333",
2320
- fontWeight: "500",
2321
- fontFamily: WIDGET_FONT
2322
- },
2323
- children: selectedReclamation === null || selectedReclamation === void 0 ? void 0 : selectedReclamation.type
2324
- })]
2325
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2326
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
2327
- component: "div",
2328
- sx: {
2329
- fontSize: "11px",
2330
- color: "#999",
2331
- fontWeight: "500",
2332
- marginBottom: "6px",
2333
- textTransform: "uppercase",
2334
- letterSpacing: "0.5px",
2335
- fontFamily: WIDGET_FONT
2336
- },
2337
- children: "Service concern\xE9"
2338
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
2339
- component: "div",
2340
- sx: {
2341
- fontSize: "14px",
2342
- color: "#333",
2343
- fontWeight: "500",
2344
- fontFamily: WIDGET_FONT
2345
- },
2346
- children: selectedReclamation === null || selectedReclamation === void 0 ? void 0 : selectedReclamation.service
2347
- })]
2348
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2349
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
2350
- component: "div",
2351
- sx: {
2352
- fontSize: "11px",
2353
- color: "#999",
2354
- fontWeight: "500",
2355
- marginBottom: "6px",
2356
- textTransform: "uppercase",
2357
- letterSpacing: "0.5px",
2358
- fontFamily: WIDGET_FONT
2359
- },
2360
- children: "R\xE9f\xE9rence"
2361
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
2362
- component: "div",
2363
- sx: {
2364
- fontSize: "14px",
2365
- color: "#333",
2366
- fontWeight: "500",
2367
- fontFamily: WIDGET_FONT
2368
- },
2369
- children: selectedReclamation === null || selectedReclamation === void 0 ? void 0 : selectedReclamation.reference
2370
- })]
2371
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2372
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
2373
- component: "div",
2374
- sx: {
2375
- fontSize: "11px",
2376
- color: "#999",
2377
- fontWeight: "500",
2378
- marginBottom: "6px",
2379
- textTransform: "uppercase",
2380
- letterSpacing: "0.5px",
2381
- fontFamily: WIDGET_FONT
2382
- },
2383
- children: "Objet"
2384
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
2385
- component: "div",
2386
- sx: {
2387
- fontSize: "14px",
2388
- color: "#333",
2389
- fontWeight: "500",
2390
- fontFamily: WIDGET_FONT
2391
- },
2392
- children: selectedReclamation === null || selectedReclamation === void 0 ? void 0 : selectedReclamation.objet
2393
- })]
2394
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2395
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
2396
- component: "div",
2397
- sx: {
2398
- fontSize: "11px",
2399
- color: "#999",
2400
- fontWeight: "500",
2401
- marginBottom: "6px",
2402
- textTransform: "uppercase",
2403
- letterSpacing: "0.5px",
2404
- fontFamily: WIDGET_FONT
2405
- },
2406
- children: "Description"
2407
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
2408
- component: "div",
2409
- sx: {
2410
- fontSize: "14px",
2411
- color: "#333",
2412
- lineHeight: "1.6",
2413
- backgroundColor: "#f8f9fa",
2414
- padding: "12px",
2415
- borderRadius: "8px",
2416
- border: "1px solid #e0e0e0",
2417
- whiteSpace: "pre-line",
2418
- fontFamily: WIDGET_FONT
2419
- },
2420
- children: selectedReclamation === null || selectedReclamation === void 0 ? void 0 : selectedReclamation.description
2421
- })]
2422
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2423
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
2424
- component: "div",
2425
- sx: {
2426
- fontSize: "11px",
2427
- color: "#999",
2428
- fontWeight: "500",
2429
- marginBottom: "6px",
2430
- textTransform: "uppercase",
2431
- letterSpacing: "0.5px",
2432
- fontFamily: WIDGET_FONT
2433
- },
2434
- children: "Date de cr\xE9ation"
2435
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
2436
- component: "div",
2437
- sx: {
2438
- fontSize: "14px",
2439
- color: "#333",
2440
- fontWeight: "500",
2441
- fontFamily: WIDGET_FONT
2442
- },
2443
- children: formatDate(selectedReclamation === null || selectedReclamation === void 0 ? void 0 : selectedReclamation.dateCreation)
2444
- })]
2445
- }), (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", {
2446
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Typography, {
2447
- component: "div",
2448
- sx: {
2449
- fontSize: "11px",
2450
- color: "#999",
2451
- fontWeight: "500",
2452
- marginBottom: "12px",
2453
- textTransform: "uppercase",
2454
- letterSpacing: "0.5px",
2455
- fontFamily: WIDGET_FONT
2456
- },
2457
- children: ["Pi\xE8ces jointes (", selectedReclamation === null || selectedReclamation === void 0 || (_selectedReclamation$2 = selectedReclamation.documents) === null || _selectedReclamation$2 === void 0 ? void 0 : _selectedReclamation$2.length, ")"]
2458
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
2459
- style: {
2460
- display: "flex",
2461
- flexDirection: "column",
2462
- gap: "8px"
2463
- },
2464
- children: selectedReclamation.documents.map((document, index) => /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2465
- style: {
2466
- display: "flex",
2467
- alignItems: "center",
2468
- gap: "12px",
2469
- padding: "12px",
2470
- backgroundColor: "#f8f9fa",
2471
- borderRadius: "8px",
2472
- border: "1px solid #e0e0e0",
2473
- cursor: isDownloading ? "not-allowed" : "pointer",
2474
- opacity: isDownloading ? 0.6 : 1,
2475
- transition: "all 0.2s ease"
2476
- },
2477
- onClick: () => !isDownloading && handleDownload(document.documentGuid, document.documentName),
2478
- onMouseEnter: e => {
2479
- if (!isDownloading) {
2480
- e.currentTarget.style.backgroundColor = "#e9ecef";
2481
- e.currentTarget.style.borderColor = "var(--primary-color, #222f67)";
2482
- }
2483
- },
2484
- onMouseLeave: e => {
2485
- if (!isDownloading) {
2486
- e.currentTarget.style.backgroundColor = "#f8f9fa";
2487
- e.currentTarget.style.borderColor = "#e0e0e0";
2488
- }
2489
- },
2490
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFontawesome.FontAwesomeIcon, {
2491
- icon: _freeSolidSvgIcons.faPaperclip,
2492
- style: {
2493
- color: "var(--primary-color, #222f67)",
2494
- fontSize: "16px"
2495
- }
2496
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2497
- style: {
2498
- flex: 1
2499
- },
2500
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
2501
- component: "div",
2502
- sx: {
2503
- fontSize: "13px",
2504
- color: "#333",
2505
- fontWeight: "500",
2506
- fontFamily: WIDGET_FONT
2507
- },
2508
- children: document.documentName
2509
- }), document.dateUpload && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Typography, {
2510
- component: "div",
2511
- sx: {
2512
- fontSize: "11px",
2513
- color: "#999",
2514
- marginTop: "2px",
2515
- fontFamily: WIDGET_FONT
2516
- },
2517
- children: ["Ajout\xE9 le ", formatDate(document.dateUpload)]
2518
- })]
2519
- }), isDownloading ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.CircularProgress, {
2520
- size: 16,
2521
- style: {
2522
- color: "var(--primary-color, #222f67)"
2523
- }
2524
- }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFontawesome.FontAwesomeIcon, {
2525
- icon: _freeSolidSvgIcons.faDownload,
2526
- style: {
2527
- color: "var(--primary-color, #222f67)",
2528
- fontSize: "14px"
2529
- }
2530
- })]
2531
- }, document.id || index))
2532
- })]
2533
- }), (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", {
2534
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
2535
- style: {
2536
- fontSize: "11px",
2537
- color: "#999",
2538
- fontWeight: "600",
2539
- marginBottom: "16px",
2540
- textTransform: "uppercase",
2541
- letterSpacing: "0.5px",
2542
- fontFamily: WIDGET_FONT
2543
- },
2544
- children: "Historique des statuts"
2545
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2546
- style: {
2547
- position: "relative",
2548
- paddingLeft: "24px"
2549
- },
2550
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
2551
- style: {
2552
- position: "absolute",
2553
- left: "8px",
2554
- top: "6px",
2555
- bottom: "6px",
2556
- width: "2px",
2557
- backgroundColor: "#e0e0e0"
2558
- }
2559
- }), selectedReclamation.statusHistories.map((entry, index) => {
2560
- var _entry$documents;
2561
- const color = getStatusColorByCode(entry.statutApresCode);
2562
- const isLast = index === selectedReclamation.statusHistories.length - 1;
2563
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2564
- style: {
2565
- position: "relative",
2566
- marginBottom: isLast ? 0 : "20px"
2567
- },
2568
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
2569
- style: {
2570
- position: "absolute",
2571
- left: "-20px",
2572
- top: "4px",
2573
- width: "12px",
2574
- height: "12px",
2575
- borderRadius: "50%",
2576
- backgroundColor: color,
2577
- border: "2px solid white",
2578
- boxShadow: "0 0 0 2px ".concat(color)
2579
- }
2580
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2581
- style: {
2582
- backgroundColor: "#f8f9fa",
2583
- borderRadius: "8px",
2584
- border: "1px solid ".concat(color, "22"),
2585
- padding: "12px"
2586
- },
2587
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
2588
- style: {
2589
- display: "flex",
2590
- justifyContent: "space-between",
2591
- alignItems: "flex-start",
2592
- marginBottom: entry.commentaire ? "10px" : 0
2593
- },
2594
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2595
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2596
- style: {
2597
- display: "flex",
2598
- alignItems: "center",
2599
- gap: "6px",
2600
- marginBottom: "2px"
2601
- },
2602
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
2603
- style: {
2604
- fontSize: "11px"
2605
- },
2606
- children: STATUT_ICON_MAP[entry.statutApresCode] || "📋"
2607
- }), entry.statutAvantCode && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
2608
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
2609
- style: {
2610
- fontSize: "11px",
2611
- color: getStatusColorByCode(entry.statutAvantCode),
2612
- fontWeight: "600",
2613
- fontFamily: WIDGET_FONT
2614
- },
2615
- children: entry.statutAvantLibelle
2616
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
2617
- style: {
2618
- fontSize: "11px",
2619
- color: "#999"
2620
- },
2621
- children: "\u2192"
2622
- })]
2623
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
2624
- style: {
2625
- fontSize: "11px",
2626
- color,
2627
- fontWeight: "700",
2628
- fontFamily: WIDGET_FONT
2629
- },
2630
- children: entry.statutApresLibelle
2631
- })]
2632
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2633
- style: {
2634
- fontSize: "11px",
2635
- color: "#999",
2636
- fontFamily: WIDGET_FONT
2637
- },
2638
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
2639
- children: [entry.changedByNom ? entry.changedByNom : "Service Odoo", " \xB7 "]
2640
- }), formatDate(entry.dateChangement)]
2641
- })]
2642
- })
2643
- }), entry.commentaire && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
2644
- style: {
2645
- fontSize: "13px",
2646
- color: "#333",
2647
- lineHeight: "1.5",
2648
- fontFamily: WIDGET_FONT,
2649
- backgroundColor: "white",
2650
- padding: "8px 10px",
2651
- borderRadius: "6px",
2652
- border: "1px solid #e0e0e0",
2653
- whiteSpace: "pre-line"
2654
- },
2655
- children: entry.commentaire
2656
- }), entry.reponse && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2657
- style: {
2658
- marginTop: "8px",
2659
- fontSize: "13px",
2660
- color: "#333",
2661
- lineHeight: "1.5",
2662
- fontFamily: WIDGET_FONT,
2663
- backgroundColor: "#f0f4ff",
2664
- padding: "8px 10px",
2665
- borderRadius: "6px",
2666
- border: "1px solid #c5d0f0",
2667
- whiteSpace: "pre-line"
2668
- },
2669
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
2670
- style: {
2671
- fontSize: "11px",
2672
- fontWeight: "600",
2673
- color: "#555",
2674
- display: "block",
2675
- marginBottom: "4px"
2676
- },
2677
- children: "\uD83D\uDCAC R\xE9ponse"
2678
- }), renderTextWithLinks(entry.reponse)]
2679
- }), ((_entry$documents = entry.documents) === null || _entry$documents === void 0 ? void 0 : _entry$documents.length) > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
2680
- style: {
2681
- marginTop: "8px",
2682
- display: "flex",
2683
- flexDirection: "column",
2684
- gap: "6px"
2685
- },
2686
- children: entry.documents.map((doc, di) => /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2687
- style: {
2688
- display: "flex",
2689
- alignItems: "center",
2690
- gap: "8px",
2691
- padding: "6px 10px",
2692
- backgroundColor: "white",
2693
- borderRadius: "6px",
2694
- border: "1px solid #e0e0e0",
2695
- cursor: isDownloading ? "not-allowed" : "pointer",
2696
- opacity: isDownloading ? 0.6 : 1
2697
- },
2698
- onClick: () => !isDownloading && handleDownload(doc.documentGuid, doc.documentName),
2699
- onMouseEnter: e => {
2700
- if (!isDownloading) e.currentTarget.style.backgroundColor = "#f0f0f0";
2701
- },
2702
- onMouseLeave: e => {
2703
- if (!isDownloading) e.currentTarget.style.backgroundColor = "white";
2704
- },
2705
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFontawesome.FontAwesomeIcon, {
2706
- icon: _freeSolidSvgIcons.faPaperclip,
2707
- style: {
2708
- color: "var(--primary-color, #222f67)",
2709
- fontSize: "12px"
2710
- }
2711
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
2712
- style: {
2713
- flex: 1,
2714
- fontSize: "12px",
2715
- color: "#333",
2716
- fontFamily: WIDGET_FONT
2717
- },
2718
- children: doc.documentName
2719
- }), isDownloading ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.CircularProgress, {
2720
- size: 12,
2721
- style: {
2722
- color: "var(--primary-color, #222f67)"
2723
- }
2724
- }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFontawesome.FontAwesomeIcon, {
2725
- icon: _freeSolidSvgIcons.faDownload,
2726
- style: {
2727
- color: "var(--primary-color, #222f67)",
2728
- fontSize: "12px"
2729
- }
2730
- })]
2731
- }, doc.id || di))
2732
- })]
2733
- })]
2734
- }, entry.id || index);
2735
- })]
2736
- })]
2737
- })]
2738
- })
2739
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.DialogActions, {
2740
- sx: {
2741
- padding: "16px 24px",
2742
- borderTop: "1px solid #e0e0e0",
2743
- backgroundColor: "#f8f9fa",
2744
- gap: "8px"
2745
- },
2746
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
2747
- onClick: handleCloseDetails,
2748
- variant: "outlined",
2749
- sx: {
2750
- color: "var(--primary-color, #222f67)",
2751
- borderColor: "var(--primary-color, #222f67)",
2752
- padding: "5.5px 23px",
2753
- borderRadius: "6px",
2754
- fontWeight: "500",
2755
- fontSize: "14px",
2756
- textTransform: "none",
2757
- boxShadow: "none",
2758
- "&:hover": {
2759
- borderColor: "var(--primary-color, #222f67)",
2760
- backgroundColor: "rgba(34, 47, 103, 0.05)",
2761
- boxShadow: "none"
2762
- }
2763
- },
2764
- children: "Fermer"
2765
- }), (selectedReclamation === null || selectedReclamation === void 0 ? void 0 : selectedReclamation.statutCode) === STATUT_REPONDUE && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
2766
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
2767
- variant: "contained",
2768
- onClick: handleCloturer,
2769
- disabled: isCloturing,
2770
- sx: {
2771
- backgroundColor: "#e53935",
2772
- color: "white",
2773
- padding: "5.5px 23px",
2774
- borderRadius: "6px",
2775
- fontWeight: "500",
2776
- fontSize: "14px",
2777
- textTransform: "none",
2778
- boxShadow: "none",
2779
- "&:hover": {
2780
- backgroundColor: "#c62828",
2781
- boxShadow: "none"
2782
- },
2783
- "&:disabled": {
2784
- backgroundColor: "#ef9a9a",
2785
- boxShadow: "none"
2786
- }
2787
- },
2788
- children: isCloturing ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.CircularProgress, {
2789
- size: 16,
2790
- sx: {
2791
- color: "white"
2792
- }
2793
- }) : "Clôturer"
2794
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
2795
- variant: "contained",
2796
- onClick: handleOpenReouvreDialog,
2797
- sx: {
2798
- backgroundColor: "var(--primary-color, #222f67)",
2799
- color: "white",
2800
- padding: "5.5px 23px",
2801
- borderRadius: "6px",
2802
- fontWeight: "500",
2803
- fontSize: "14px",
2804
- textTransform: "none",
2805
- boxShadow: "none",
2806
- "&:hover": {
2807
- backgroundColor: "var(--secondary-color, #2d3d7f)",
2808
- boxShadow: "none"
2809
- }
2810
- },
2811
- children: "R\xE9ouverture"
2812
- })]
2813
- })]
2814
- })]
2815
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Dialog, {
2816
- open: reouvreDialogOpen,
2817
- onClose: handleCloseReouvreDialog,
2818
- maxWidth: "sm",
2819
- fullWidth: true,
2820
- PaperProps: {
2821
- sx: {
2822
- borderRadius: 3,
2823
- boxShadow: "0 8px 32px rgba(0,0,0,0.12)"
2824
- }
2825
- },
2826
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.DialogTitle, {
2827
- sx: {
2828
- backgroundColor: "#f8f9fa",
2829
- borderBottom: "1px solid #e0e0e0",
2830
- display: "flex",
2831
- justifyContent: "space-between",
2832
- alignItems: "center",
2833
- padding: "20px 24px"
2834
- },
2835
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2836
- style: {
2837
- display: "flex",
2838
- alignItems: "center",
2839
- gap: "12px"
2840
- },
2841
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFontawesome.FontAwesomeIcon, {
2842
- icon: _freeSolidSvgIcons.faReply,
2843
- style: {
2844
- color: "var(--primary-color, #222f67)",
2845
- fontSize: "18px"
2846
- }
2847
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2848
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
2849
- component: "div",
2850
- sx: {
2851
- fontWeight: "700",
2852
- fontSize: "16px",
2853
- margin: 0
2854
- },
2855
- children: "R\xE9ouverture de la r\xE9clamation"
2856
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
2857
- component: "div",
2858
- sx: {
2859
- color: "#666",
2860
- fontSize: "12px",
2861
- marginTop: "3px"
2862
- },
2863
- children: selectedReclamation === null || selectedReclamation === void 0 ? void 0 : selectedReclamation.reference
2864
- })]
2865
- })]
2866
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.IconButton, {
2867
- onClick: handleCloseReouvreDialog,
2868
- size: "small",
2869
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_iconsMaterial.Close, {
2870
- fontSize: "small"
2871
- })
2872
- })]
2873
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.DialogContent, {
2874
- sx: {
2875
- padding: "24px",
2876
- display: "flex",
2877
- flexDirection: "column",
2878
- gap: "20px"
2879
- },
2880
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.TextField, {
2881
- label: "Description",
2882
- placeholder: "D\xE9crivez la raison de la r\xE9ouverture...",
2883
- value: reouvreDescription,
2884
- onChange: e => setReouvreDescription(e.target.value),
2885
- multiline: true,
2886
- rows: 5,
2887
- fullWidth: true,
2888
- required: true,
2889
- variant: "outlined",
2890
- inputProps: {
2891
- maxLength: 500
2892
- },
2893
- sx: {
2894
- mt: 1,
2895
- "& .MuiOutlinedInput-root.Mui-focused .MuiOutlinedInput-notchedOutline": {
2896
- borderColor: "var(--primary-color, #222f67)"
2897
- },
2898
- "& .MuiInputLabel-root.Mui-focused": {
2899
- color: "var(--primary-color, #222f67)"
2900
- }
2901
- }
2902
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2903
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
2904
- type: "file",
2905
- ref: reouvreFileInputRef,
2906
- style: {
2907
- display: "none"
2908
- },
2909
- onChange: handleReouvreFileSelect,
2910
- accept: ".pdf,.doc,.docx,.xls,.xlsx,.jpg,.jpeg,.png,.gif",
2911
- multiple: true
2912
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
2913
- variant: "outlined",
2914
- startIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_iconsMaterial.AttachFile, {}),
2915
- onClick: () => {
2916
- var _reouvreFileInputRef$;
2917
- return (_reouvreFileInputRef$ = reouvreFileInputRef.current) === null || _reouvreFileInputRef$ === void 0 ? void 0 : _reouvreFileInputRef$.click();
2918
- },
2919
- sx: {
2920
- borderRadius: "8px",
2921
- border: "2px dashed var(--primary-color, #222f67)",
2922
- color: "var(--primary-color, #222f67)",
2923
- fontWeight: "600",
2924
- textTransform: "none",
2925
- width: "100%",
2926
- "&:hover": {
2927
- backgroundColor: "rgba(34, 47, 103, 0.05)",
2928
- borderStyle: "solid"
2929
- }
2930
- },
2931
- children: "Pi\xE8ces jointes (optionnel)"
2932
- }), reouvreFiles.length > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
2933
- sx: {
2934
- mt: 1,
2935
- display: "flex",
2936
- flexWrap: "wrap",
2937
- gap: 1
2938
- },
2939
- children: reouvreFiles.map((file, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Chip, {
2940
- icon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_iconsMaterial.AttachFile, {}),
2941
- label: file.name,
2942
- onDelete: () => handleRemoveReouvreFile(index),
2943
- sx: {
2944
- borderRadius: "8px"
2945
- },
2946
- color: "primary",
2947
- variant: "outlined"
2948
- }, index))
2949
- })]
2950
- })]
2951
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.DialogActions, {
2952
- sx: {
2953
- padding: "16px 24px",
2954
- borderTop: "1px solid #e0e0e0",
2955
- backgroundColor: "#f8f9fa",
2956
- gap: "8px"
2957
- },
2958
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
2959
- onClick: handleCloseReouvreDialog,
2960
- variant: "outlined",
2961
- sx: {
2962
- color: "var(--primary-color, #222f67)",
2963
- borderColor: "var(--primary-color, #222f67)",
2964
- padding: "5.5px 23px",
2965
- borderRadius: "6px",
2966
- fontWeight: "500",
2967
- fontSize: "14px",
2968
- textTransform: "none",
2969
- boxShadow: "none",
2970
- "&:hover": {
2971
- borderColor: "var(--primary-color, #222f67)",
2972
- backgroundColor: "rgba(34, 47, 103, 0.05)",
2973
- boxShadow: "none"
2974
- }
2975
- },
2976
- children: "Annuler"
2977
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
2978
- variant: "contained",
2979
- onClick: handleSubmitReouvreture,
2980
- disabled: !reouvreDescription.trim() || isReouvring,
2981
- sx: {
2982
- backgroundColor: "var(--primary-color, #222f67)",
2983
- color: "white",
2984
- padding: "5.5px 23px",
2985
- borderRadius: "6px",
2986
- fontWeight: "500",
2987
- fontSize: "14px",
2988
- textTransform: "none",
2989
- boxShadow: "none",
2990
- "&:hover": {
2991
- backgroundColor: "var(--secondary-color, #2d3d7f)",
2992
- boxShadow: "none"
2993
- },
2994
- "&:disabled": {
2995
- backgroundColor: "rgba(34, 47, 103, 0.4)",
2996
- boxShadow: "none"
2997
- }
2998
- },
2999
- children: isReouvring ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.CircularProgress, {
3000
- size: 16,
3001
- sx: {
3002
- color: "white"
3003
- }
3004
- }) : "Confirmer la réouverture"
3005
- })]
3006
- })]
3007
- })]
3008
- });
3009
- };
3010
- const TijariaChatbot = selectedConversation => {
3011
- const {
3012
- tijariaUrl,
3013
- apiAuthUrl,
3014
- token
3015
- } = (0, _PuiHelpWidgetContext.useHelpWidget)();
3016
- const iframeRef = (0, _react.useRef)(null);
3017
- (0, _react.useEffect)(() => {
3018
- const handleMessage = event => {
3019
- if (event.origin !== tijariaUrl) {
3020
- console.warn("Message from unauthorized origin:", event.origin);
3021
- return;
3022
- }
3023
- if (event.data && event.data.type === "TOKEN_RECEIVED") {
3024
- console.log("Token delivery confirmed by iframe:", event.data);
3025
- sessionStorage.setItem("tijaria_token", event.data.token);
3026
- }
3027
- };
3028
- window.addEventListener("message", handleMessage);
3029
- return () => window.removeEventListener("message", handleMessage);
3030
- }, []);
3031
- (0, _react.useEffect)(() => {
3032
- const iframe = iframeRef.current;
3033
- const handleLoad = () => {
3034
- iframe.contentWindow.postMessage({
3035
- type: "SET_TOKEN",
3036
- token: token,
3037
- userInfoApi: "".concat(apiAuthUrl, "/auth/keycloak/user-profile")
3038
- }, tijariaUrl);
3039
- };
3040
- iframe.addEventListener("load", handleLoad);
3041
- return () => iframe.removeEventListener("load", handleLoad);
3042
- }, []);
3043
- (0, _react.useEffect)(() => {
3044
- // console.log("selectedConversation", selectedConversation);
3045
- const iframe = iframeRef.current;
3046
- const handleSelect = () => {
3047
- iframe.contentWindow.postMessage({
3048
- type: "CONVERSATION_SELECTED",
3049
- sessionId: selectedConversation.selectedConversation || null
3050
- }, tijariaUrl);
3051
- };
3052
- iframe.addEventListener("load", handleSelect);
3053
- return () => iframe.removeEventListener("load", handleSelect);
3054
- }, [selectedConversation]);
3055
- const isExpanded = true;
3056
- return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
3057
- style: {
3058
- flex: 1,
3059
- overflow: "auto",
3060
- display: "flex",
3061
- flexDirection: "column"
3062
- },
3063
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
3064
- style: {
3065
- flex: 1,
3066
- position: "relative"
3067
- },
3068
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("iframe", {
3069
- ref: iframeRef,
3070
- id: "chatbot-iframe",
3071
- title: "TijarIA",
3072
- src: "".concat(tijariaUrl, "/assistantBot?source=PGU&expanded=").concat(isExpanded),
3073
- allow: "microphone",
3074
- sandbox: "allow-popups allow-scripts allow-same-origin",
3075
- style: {
3076
- width: "100%",
3077
- height: "90%",
3078
- border: "none",
3079
- position: "absolute",
3080
- top: 0,
3081
- left: 0
3082
- }
3083
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
3084
- onClick: () => {
3085
- const iframe = iframeRef.current;
3086
- if (iframe) {
3087
- iframe.contentWindow.postMessage({
3088
- type: "toggleSize",
3089
- isExpanded: true
3090
- }, tijariaUrl);
3091
- }
3092
- },
3093
- style: {
3094
- position: "absolute",
3095
- bottom: "20px",
3096
- left: "50%",
3097
- transform: "translateX(-50%)",
3098
- display: "flex",
3099
- flexDirection: "row",
3100
- alignItems: "center",
3101
- gap: "10px",
3102
- padding: "8px 16px",
3103
- border: "none",
3104
- backgroundColor: "transparent",
3105
- cursor: "pointer"
3106
- },
3107
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
3108
- src: _tijariaLogo.default,
3109
- alt: "Tijaria Logo",
3110
- style: {
3111
- width: "24px",
3112
- height: "24px",
3113
- objectFit: "contain",
3114
- flexShrink: 0
3115
- }
3116
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
3117
- component: "div",
3118
- sx: {
3119
- fontSize: "16px",
3120
- fontWeight: "500",
3121
- fontFamily: WIDGET_FONT,
3122
- margin: 0,
3123
- lineHeight: "normal",
3124
- color: "#495057"
3125
- },
3126
- children: "TijarIA"
3127
- })]
3128
- })]
3129
- })
3130
- });
3131
- };
3132
- const TijariaHistory = _ref6 => {
3133
- let {
3134
- onClose,
3135
- setSelectedConversation
3136
- } = _ref6;
3137
- const [conversations, setConversations] = (0, _react.useState)([]);
3138
- const [loading, setLoading] = (0, _react.useState)(true);
3139
- const [error, setError] = (0, _react.useState)(null);
3140
- (0, _react.useEffect)(() => {
3141
- fetchUserHistory();
3142
- }, []);
3143
- const fetchUserHistory = async () => {
3144
- try {
3145
- setLoading(true);
3146
- const response = await fetch("https://chatbot-dev.portnet.ma/api/user/getUserHistory", {
3147
- method: "GET",
3148
- headers: {
3149
- Authorization: "Bearer ".concat(sessionStorage.getItem("tijaria_token")),
3150
- "Content-Type": "application/json"
3151
- }
3152
- });
3153
- if (!response.ok) {
3154
- throw new Error("Erreur lors de la récupération de l'historique");
3155
- }
3156
- const data = await response.json();
3157
- setConversations(data);
3158
- setError(null);
3159
- } catch (err) {
3160
- console.error("Error fetching history:", err);
3161
- setError(err.message);
3162
- setConversations([]);
3163
- } finally {
3164
- setLoading(false);
3165
- }
3166
- };
3167
- const handleConversationClick = conversation => {
3168
- console.log(" Conversation clicked:", conversation);
3169
- setSelectedConversation(conversation.sessionId);
3170
- onClose();
3171
- };
3172
- const formatDate = dateString => {
3173
- if (!dateString) return "N/A";
3174
- const date = new Date(dateString);
3175
- return date.toLocaleDateString("fr-FR", {
3176
- day: "2-digit",
3177
- month: "2-digit",
3178
- year: "numeric",
3179
- hour: "2-digit",
3180
- minute: "2-digit"
3181
- });
3182
- };
3183
- const truncateText = function truncateText(text) {
3184
- let maxLength = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 80;
3185
- if (!text) return "";
3186
- return text.length > maxLength ? text.substring(0, maxLength) + "..." : text;
3187
- };
3188
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
3189
- style: {
3190
- flex: 1,
3191
- display: "flex",
3192
- flexDirection: "column",
3193
- backgroundColor: "#f5f5f5"
3194
- },
3195
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
3196
- style: {
3197
- display: "flex",
3198
- justifyContent: "space-between",
3199
- alignItems: "center",
3200
- padding: "16px",
3201
- backgroundColor: "white",
3202
- borderBottom: "1px solid #e0e0e0"
3203
- },
3204
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
3205
- style: {
3206
- display: "flex",
3207
- alignItems: "center",
3208
- gap: "12px"
3209
- },
3210
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFontawesome.FontAwesomeIcon, {
3211
- icon: _freeSolidSvgIcons.faComments,
3212
- style: {
3213
- color: "var(--primary-color, #222f67)",
3214
- fontSize: "20px"
3215
- }
3216
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
3217
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
3218
- component: "div",
3219
- sx: {
3220
- fontWeight: "600",
3221
- color: "#333",
3222
- fontSize: "16px",
3223
- fontFamily: WIDGET_FONT,
3224
- margin: 0,
3225
- lineHeight: "normal"
3226
- },
3227
- children: "Historique TijarIA"
3228
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
3229
- component: "div",
3230
- sx: {
3231
- color: "#999",
3232
- fontSize: "12px",
3233
- fontFamily: WIDGET_FONT,
3234
- margin: 0,
3235
- lineHeight: "normal"
3236
- },
3237
- children: loading ? "Chargement..." : "".concat(conversations.length, " conversation(s)")
3238
- })]
3239
- })]
3240
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
3241
- onClick: onClose,
3242
- style: {
3243
- cursor: "pointer",
3244
- color: "#666",
3245
- padding: "4px",
3246
- display: "flex",
3247
- alignItems: "center"
3248
- },
3249
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFontawesome.FontAwesomeIcon, {
3250
- icon: _freeSolidSvgIcons.faTimes,
3251
- style: {
3252
- fontSize: "16px"
3253
- }
3254
- })
3255
- })]
3256
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
3257
- style: {
3258
- flex: 1,
3259
- overflowY: "auto",
3260
- padding: "12px"
3261
- },
3262
- children: loading ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
3263
- style: {
3264
- display: "flex",
3265
- flexDirection: "column",
3266
- alignItems: "center",
3267
- justifyContent: "center",
3268
- padding: "40px 20px",
3269
- color: "#999"
3270
- },
3271
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
3272
- style: {
3273
- width: "40px",
3274
- height: "40px",
3275
- border: "4px solid #f3f3f3",
3276
- borderTop: "4px solid var(--primary-color, #222f67)",
3277
- borderRadius: "50%",
3278
- animation: "spin 1s linear infinite"
3279
- }
3280
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("style", {
3281
- children: "\n @keyframes spin {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n "
3282
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
3283
- component: "div",
3284
- sx: {
3285
- fontSize: "14px",
3286
- marginTop: "32px",
3287
- fontFamily: WIDGET_FONT,
3288
- lineHeight: "normal",
3289
- color: "#999"
3290
- },
3291
- children: "Chargement de l'historique..."
3292
- })]
3293
- }) : error ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
3294
- style: {
3295
- display: "flex",
3296
- flexDirection: "column",
3297
- alignItems: "center",
3298
- justifyContent: "center",
3299
- padding: "40px 20px",
3300
- color: "#dc3545"
3301
- },
3302
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFontawesome.FontAwesomeIcon, {
3303
- icon: _freeSolidSvgIcons.faWarning,
3304
- style: {
3305
- fontSize: "48px",
3306
- marginBottom: "16px"
3307
- }
3308
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
3309
- component: "div",
3310
- sx: {
3311
- fontSize: "14px",
3312
- textAlign: "center",
3313
- fontFamily: WIDGET_FONT,
3314
- margin: 0,
3315
- lineHeight: "normal"
3316
- },
3317
- children: error
3318
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
3319
- onClick: fetchUserHistory,
3320
- variant: "contained",
3321
- sx: {
3322
- marginTop: "35px",
3323
- padding: "6px 20px",
3324
- backgroundColor: "var(--primary-color, #222f67)",
3325
- color: "white",
3326
- borderRadius: "6px",
3327
- fontSize: "14px",
3328
- fontWeight: "600",
3329
- fontFamily: WIDGET_FONT,
3330
- textTransform: "none",
3331
- boxShadow: "none",
3332
- "&:hover": {
3333
- backgroundColor: "var(--primary-color, #222f67)",
3334
- opacity: 0.9,
3335
- boxShadow: "none"
3336
- }
3337
- },
3338
- children: "R\xE9essayer"
3339
- })]
3340
- }) : conversations.length === 0 ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
3341
- style: {
3342
- display: "flex",
3343
- flexDirection: "column",
3344
- alignItems: "center",
3345
- justifyContent: "center",
3346
- padding: "40px 20px",
3347
- color: "#999"
3348
- },
3349
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFontawesome.FontAwesomeIcon, {
3350
- icon: _freeSolidSvgIcons.faComments,
3351
- style: {
3352
- fontSize: "48px",
3353
- marginBottom: "32px"
3354
- }
3355
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
3356
- component: "div",
3357
- sx: {
3358
- fontSize: "14px",
3359
- textAlign: "center",
3360
- fontFamily: WIDGET_FONT,
3361
- lineHeight: "normal",
3362
- color: "#999"
3363
- },
3364
- children: "Aucune conversation trouv\xE9e"
3365
- })]
3366
- }) : conversations.map((conversation, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
3367
- onClick: () => handleConversationClick(conversation),
3368
- style: {
3369
- backgroundColor: "white",
3370
- borderRadius: "8px",
3371
- padding: "16px",
3372
- marginBottom: "12px",
3373
- cursor: "pointer",
3374
- boxShadow: "0 1px 3px rgba(0,0,0,0.1)",
3375
- transition: "all 0.2s ease",
3376
- border: "1px solid #e0e0e0"
3377
- },
3378
- onMouseEnter: e => {
3379
- e.currentTarget.style.boxShadow = "0 4px 8px rgba(0,0,0,0.15)";
3380
- e.currentTarget.style.transform = "translateY(-2px)";
3381
- },
3382
- onMouseLeave: e => {
3383
- e.currentTarget.style.boxShadow = "0 1px 3px rgba(0,0,0,0.1)";
3384
- e.currentTarget.style.transform = "translateY(0)";
3385
- },
3386
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
3387
- style: {
3388
- display: "flex",
3389
- justifyContent: "space-between",
3390
- alignItems: "center",
3391
- marginBottom: "12px"
3392
- },
3393
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
3394
- style: {
3395
- display: "flex",
3396
- alignItems: "center",
3397
- gap: "8px"
3398
- },
3399
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFontawesome.FontAwesomeIcon, {
3400
- icon: _freeSolidSvgIcons.faComments,
3401
- style: {
3402
- color: "var(--primary-color, #222f67)",
3403
- fontSize: "14px"
3404
- }
3405
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
3406
- component: "div",
3407
- sx: {
3408
- fontWeight: "600",
3409
- color: "#333",
3410
- fontSize: "13px",
3411
- fontFamily: WIDGET_FONT,
3412
- margin: 0,
3413
- lineHeight: "normal"
3414
- },
3415
- children: truncateText(conversation.title || "Aucun titre disponible")
3416
- })]
3417
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
3418
- style: {
3419
- color: "#999",
3420
- fontSize: "11px"
3421
- },
3422
- children: conversation.createdAt && formatDate(conversation.createdAt)
3423
- })]
3424
- })
3425
- }, conversation.id || index))
3426
- })]
3427
- });
3428
- };
3429
- const PuiHelpWidget = _ref7 => {
3430
- let {
3431
- showReclamation = true,
3432
- showGuides = false,
3433
- showTijaria = true,
3434
- currentProjectCode = null,
3435
- guideBaseUrl,
3436
- portailId = null
3437
- } = _ref7;
3438
- const [dropdownOpen, setDropdownOpen] = (0, _react.useState)(false);
3439
- const [isTourActive, setIsTourActive] = (0, _react.useState)(false);
3440
- const {
3441
- guideApi
3442
- } = (0, _PuiHelpWidgetContext.useHelpWidget)();
3443
- const queryClient = (0, _reactQuery.useQueryClient)();
3444
- const toggle = () => {
3445
- setDropdownOpen(prev => !prev);
3446
- };
3447
- (0, _react.useEffect)(() => {
3448
- const openDropdown = () => {
3449
- setIsOpen(true);
3450
- setIsTourActive(true);
3451
- };
3452
- const closeDropdown = () => {
3453
- setIsOpen(false);
3454
- setIsTourActive(false);
3455
- };
3456
- window.addEventListener("open-aide-dropdown", openDropdown);
3457
- window.addEventListener("close-aide-dropdown", closeDropdown);
3458
- return () => {
3459
- window.removeEventListener("open-aide-dropdown", openDropdown);
3460
- window.removeEventListener("close-aide-dropdown", closeDropdown);
3461
- };
3462
- }, []);
3463
- const dispatch = (0, _reactRedux.useDispatch)();
3464
- const [isOpen, setIsOpen] = (0, _react.useState)(false);
3465
- const sidebarRef = (0, _react.useRef)(null);
3466
- const triggerRef = (0, _react.useRef)(null);
3467
- const firstFocusableRef = (0, _react.useRef)(null);
3468
- const contactPopoverRef = (0, _react.useRef)(null);
3469
- const firstContactFocusableRef = (0, _react.useRef)(null);
3470
- const previousContactActiveElement = (0, _react.useRef)(null);
3471
- const previousActiveElement = (0, _react.useRef)(null);
3472
- const [hoveredIndex, setHoveredIndex] = (0, _react.useState)(null);
3473
- const [activeChat, setActiveChat] = (0, _react.useState)(null);
3474
- const [infoMessages, setInfoMessages] = (0, _react.useState)([]);
3475
- const [incidentMessages, setIncidentMessages] = (0, _react.useState)([]);
3476
- const [reclamationModalOpen, setReclamationModalOpen] = (0, _react.useState)(false);
3477
- const [viewingReclamations, setViewingReclamations] = (0, _react.useState)(false);
3478
- const [viewingTijariaHistory, setViewingTijariaHistory] = (0, _react.useState)(false);
3479
- const [contactUsMenuAnchor, setContactUsMenuAnchor] = (0, _react.useState)(null);
3480
- const contactUsMenuOpen = Boolean(contactUsMenuAnchor);
3481
- const [popupPosition, setPopupPosition] = (0, _react.useState)({
3482
- x: 0,
3483
- y: 0
3484
- });
3485
- const [isDragging, setIsDragging] = (0, _react.useState)(false);
3486
- const [dragStart, setDragStart] = (0, _react.useState)({
3487
- x: 0,
3488
- y: 0
3489
- });
3490
- const [guidesPanelOpen, setGuidesPanelOpen] = (0, _react.useState)(false);
3491
- const [faqPanelOpen, setFaqPanelOpen] = (0, _react.useState)(false);
3492
- const [guideData, setGuideData] = (0, _react.useState)(null);
3493
- const [faqData, setFaqData] = (0, _react.useState)(null);
3494
- const [loadingGuide, setLoadingGuide] = (0, _react.useState)(false);
3495
- (0, _react.useEffect)(() => {
3496
- async function fetchGuideData() {
3497
- if (!showGuides || !currentProjectCode || !guidesPanelOpen) return;
3498
- try {
3499
- var _response$data;
3500
- const response = await guideApi.getGuideContent(currentProjectCode);
3501
- setGuideData(response === null || response === void 0 || (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.body);
3502
- } catch (error) {
3503
- console.error("Error loading guide data:", error);
3504
- setGuideData(null);
3505
- }
3506
- }
3507
- fetchGuideData();
3508
- }, [currentProjectCode, guidesPanelOpen, showGuides]);
3509
- (0, _react.useEffect)(() => {
3510
- async function fetchFaqData() {
3511
- if (!faqPanelOpen) return;
3512
- try {
3513
- const faqModule = await _guides.default["FAQ"];
3514
- const data = faqModule.default || faqModule;
3515
- setFaqData(data);
3516
- } catch (error) {
3517
- console.error("Error loading FAQ data:", error);
3518
- setFaqData(null);
3519
- }
3520
- }
3521
- fetchFaqData();
3522
- }, [faqPanelOpen]);
3523
- const handleGuideMenuClick = event => {
3524
- setIsOpen(false);
3525
- setGuidesPanelOpen(true);
3526
- };
3527
- const handleFaqClick = () => {
3528
- setIsOpen(false);
3529
- setFaqPanelOpen(true);
3530
- };
3531
- const handleContactUsClick = event => {
3532
- const rect = event.currentTarget.getBoundingClientRect();
3533
- setContactUsMenuAnchor(event.currentTarget);
3534
- setPopupPosition({
3535
- x: rect.left - 291,
3536
- y: rect.top
3537
- });
3538
- };
3539
- const handleContactUsMenuClose = () => {
3540
- setContactUsMenuAnchor(null);
3541
- };
3542
- const handleContactClick = () => {
3543
- window.location.href = "mailto:support@moroccotradenet.ma";
3544
- handleContactUsMenuClose();
3545
- };
3546
- const handlePdfGuideClick = async () => {
3547
- setLoadingGuide(true);
3548
- try {
3549
- var _response$data2;
3550
- const response = await guideApi.getGuideByProjectCode(currentProjectCode);
3551
- const guideData = response === null || response === void 0 || (_response$data2 = response.data) === null || _response$data2 === void 0 ? void 0 : _response$data2.body;
3552
- if (guideData !== null && guideData !== void 0 && guideData.urlFichier) {
3553
- const link = document.createElement("a");
3554
- link.href = guideData.urlFichier;
3555
- link.setAttribute("download", "");
3556
- document.body.appendChild(link);
3557
- link.click();
3558
- document.body.removeChild(link);
3559
- } else {
3560
- console.warn("No PDF guide found for project: ".concat(currentProjectCode));
3561
- }
3562
- } catch (error) {
3563
- console.error("Error fetching guide:", error);
3564
- } finally {
3565
- setLoadingGuide(false);
3566
- }
3567
- };
3568
- const handleMouseDown = e => {
3569
- if (e.target.classList.contains("draggable-handle")) {
3570
- setIsDragging(true);
3571
- setDragStart({
3572
- x: e.clientX - popupPosition.x,
3573
- y: e.clientY - popupPosition.y
3574
- });
3575
- }
3576
- };
3577
- const handleMouseMove = e => {
3578
- if (isDragging) {
3579
- setPopupPosition({
3580
- x: e.clientX - dragStart.x,
3581
- y: e.clientY - dragStart.y
3582
- });
3583
- }
3584
- };
3585
- const handleMouseUp = () => {
3586
- setIsDragging(false);
3587
- };
3588
- (0, _react.useEffect)(() => {
3589
- if (isDragging) {
3590
- document.addEventListener("mousemove", handleMouseMove);
3591
- document.addEventListener("mouseup", handleMouseUp);
3592
- return () => {
3593
- document.removeEventListener("mousemove", handleMouseMove);
3594
- document.removeEventListener("mouseup", handleMouseUp);
3595
- };
3596
- }
3597
- }, [isDragging, dragStart, popupPosition]);
3598
- (0, _react.useEffect)(() => {
3599
- if (isOpen) {
3600
- previousActiveElement.current = document.activeElement;
3601
- setTimeout(() => {
3602
- var _firstFocusableRef$cu3;
3603
- (_firstFocusableRef$cu3 = firstFocusableRef.current) === null || _firstFocusableRef$cu3 === void 0 || _firstFocusableRef$cu3.focus();
3604
- }, 100);
3605
- } else {
3606
- if (previousActiveElement.current) {
3607
- previousActiveElement.current.focus();
3608
- }
3609
- }
3610
- }, [isOpen]);
3611
- (0, _react.useEffect)(() => {
3612
- if (!isOpen) return;
3613
- const handleKeyDown = e => {
3614
- if (e.key === "Escape") {
3615
- setIsOpen(false);
3616
- return;
3617
- }
3618
- if (e.key === "Tab") {
3619
- const sidebar = sidebarRef.current;
3620
- if (!sidebar) return;
3621
- 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])');
3622
- const focusableArray = Array.from(focusableElements);
3623
- const firstElement = focusableArray[0];
3624
- const lastElement = focusableArray[focusableArray.length - 1];
3625
- if (focusableArray.length === 0) return;
3626
- if (e.shiftKey) {
3627
- if (document.activeElement === firstElement) {
3628
- lastElement.focus();
3629
- e.preventDefault();
3630
- }
3631
- } else {
3632
- if (document.activeElement === lastElement) {
3633
- firstElement.focus();
3634
- e.preventDefault();
3635
- }
3636
- }
3637
- }
3638
- };
3639
- document.addEventListener("keydown", handleKeyDown);
3640
- return () => document.removeEventListener("keydown", handleKeyDown);
3641
- }, [isOpen]);
3642
- (0, _react.useEffect)(() => {
3643
- if (isOpen) {
3644
- document.body.style.overflow = "hidden";
3645
- } else {
3646
- document.body.style.overflow = "";
3647
- }
3648
- return () => {
3649
- document.body.style.overflow = "";
3650
- };
3651
- }, [isOpen]);
3652
- (0, _react.useEffect)(() => {
3653
- if (contactUsMenuOpen) {
3654
- previousContactActiveElement.current = document.activeElement;
3655
- setTimeout(() => {
3656
- const popover = contactPopoverRef.current;
3657
- if (popover) {
3658
- const firstMenuItem = popover.querySelector('[role="menuitem"]');
3659
- if (firstMenuItem) {
3660
- firstMenuItem.focus();
3661
- }
3662
- }
3663
- }, 100);
3664
- } else {
3665
- if (previousContactActiveElement.current) {
3666
- previousContactActiveElement.current.focus();
3667
- }
3668
- }
3669
- }, [contactUsMenuOpen]);
3670
- (0, _react.useEffect)(() => {
3671
- if (!contactUsMenuOpen) return;
3672
- const handleKeyDown = e => {
3673
- if (e.key === "Escape") {
3674
- handleContactUsMenuClose();
3675
- return;
3676
- }
3677
- if (e.key === "Tab") {
3678
- const popover = contactPopoverRef.current;
3679
- if (!popover) return;
3680
- const focusableElements = popover.querySelectorAll('button:not([disabled]), [role="menuitem"]:not([disabled]), [href]:not([disabled]), input:not([disabled]), [tabindex]:not([tabindex="-1"]):not([disabled])');
3681
- const focusableArray = Array.from(focusableElements);
3682
- const firstElement = focusableArray[0];
3683
- const lastElement = focusableArray[focusableArray.length - 1];
3684
- if (focusableArray.length === 0) return;
3685
- if (e.shiftKey) {
3686
- if (document.activeElement === firstElement) {
3687
- lastElement.focus();
3688
- e.preventDefault();
3689
- }
3690
- } else {
3691
- if (document.activeElement === lastElement) {
3692
- firstElement.focus();
3693
- e.preventDefault();
3694
- }
3695
- }
3696
- }
3697
- };
3698
- document.addEventListener("keydown", handleKeyDown);
3699
- return () => document.removeEventListener("keydown", handleKeyDown);
3700
- }, [contactUsMenuOpen]);
3701
- const navigationLinks = [...(showGuides && currentProjectCode ? [{
3702
- icon: _freeSolidSvgIcons.faBook,
3703
- title: "Guides utilisateurs",
3704
- action: handleGuideMenuClick
3705
- }] : []), {
3706
- icon: _freeSolidSvgIcons.faPen,
3707
- title: "Foires aux questions",
3708
- id: "foire-aux-questions",
3709
- action: handleFaqClick
3710
- }, ...(showReclamation ? [{
3711
- icon: _freeSolidSvgIcons.faClipboardList,
3712
- title: "Mes réclamations",
3713
- id: "mes-reclamations",
3714
- action: () => {
3715
- queryClient.invalidateQueries("get_list_reclamation");
3716
- setViewingReclamations(true);
3717
- }
3718
- }, {
3719
- icon: _freeSolidSvgIcons.faBullhorn,
3720
- title: "Nouvelle réclamation",
3721
- id: "nouvelle-reclamation",
3722
- action: () => setReclamationModalOpen(true)
3723
- }] : []), {
3724
- icon: _freeSolidSvgIcons.faAddressBook,
3725
- title: "Contactez-nous",
3726
- id: "contactez-nous",
3727
- action: handleContactUsClick
3728
- },
3729
- /*{
3730
- icon: faComments,
3731
- title: "TijarIA",
3732
- action: () => {
3733
- setActiveChat(null);
3734
- setViewingReclamations(false);
3735
- },
3736
- },*/
3737
- ...(showTijaria ? [{
3738
- icon: _freeSolidSvgIcons.faCommentDots,
3739
- title: "TijarIA",
3740
- id: "tijaria",
3741
- action: () => {
3742
- setViewingTijariaHistory(false);
3743
- setViewingReclamations(false);
3744
- }
3745
- }, {
3746
- icon: _freeSolidSvgIcons.faComments,
3747
- title: "Historique TijarIA",
3748
- id: "mes-conversations",
3749
- action: () => {
3750
- setViewingTijariaHistory(true);
3751
- setViewingReclamations(false);
3752
- }
3753
- }] : [])];
3754
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
3755
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
3756
- className: "help-widget-button ".concat(isOpen ? "open" : ""),
3757
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactstrap.Button, {
3758
- ref: triggerRef,
3759
- color: "light",
3760
- className: "help-trigger",
3761
- onClick: () => setIsOpen(!isOpen),
3762
- "aria-label": "Ouvrir le centre d'aide",
3763
- "aria-expanded": isOpen,
3764
- "aria-controls": "help-sidebar",
3765
- tabIndex: 0,
3766
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
3767
- component: "div",
3768
- sx: {
3769
- fontWeight: "600",
3770
- fontSize: "14px",
3771
- color: "#282828",
3772
- fontFamily: WIDGET_FONT,
3773
- margin: 0,
3774
- padding: 0,
3775
- lineHeight: "normal"
3776
- },
3777
- children: "Besoin d'aide ?"
3778
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFontawesome.FontAwesomeIcon, {
3779
- icon: isOpen ? _freeSolidSvgIcons.faChevronLeft : _freeSolidSvgIcons.faChevronRight,
3780
- className: "arrow-icon",
3781
- "aria-hidden": "true"
3782
- })]
3783
- })
3784
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
3785
- id: "help-sidebar",
3786
- ref: sidebarRef,
3787
- className: "help-widget-sidebar ".concat(isOpen ? "open" : ""),
3788
- role: "dialog",
3789
- "aria-modal": "true",
3790
- "aria-labelledby": "help-title",
3791
- "aria-hidden": !isOpen,
3792
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactstrap.Card, {
3793
- className: "h-100 border-0 shadow-lg",
3794
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactstrap.CardBody, {
3795
- className: "p-0 d-flex flex-column",
3796
- style: {
3797
- flex: 1,
3798
- minHeight: 0
3799
- },
3800
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
3801
- style: {
3802
- paddingTop: "12px",
3803
- paddingBottom: "20px",
3804
- paddingLeft: "17px",
3805
- paddingRight: "20px",
3806
- borderBottom: "1px solid #e9ecef",
3807
- backgroundColor: "white",
3808
- display: "flex",
3809
- alignItems: "center",
3810
- justifyContent: "space-between"
3811
- },
3812
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
3813
- style: {
3814
- display: "flex",
3815
- alignItems: "center"
3816
- },
3817
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFontawesome.FontAwesomeIcon, {
3818
- icon: _freeRegularSvgIcons.faQuestionCircle,
3819
- style: {
3820
- color: "var(--primary-color, #222f67)",
3821
- fontSize: "24px",
3822
- marginRight: "8px",
3823
- flexShrink: 0
3824
- },
3825
- "aria-hidden": "true"
3826
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
3827
- id: "help-title",
3828
- component: "div",
3829
- onClick: () => setIsOpen(false),
3830
- sx: {
3831
- margin: 0,
3832
- color: "#495057",
3833
- fontWeight: "600",
3834
- fontSize: "16px",
3835
- cursor: "pointer",
3836
- userSelect: "none",
3837
- flex: 1,
3838
- lineHeight: "normal",
3839
- fontFamily: WIDGET_FONT,
3840
- "&:hover": {
3841
- color: "var(--primary-color, #222f67)"
3842
- }
3843
- },
3844
- children: "Centre d'aide"
3845
- })]
3846
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
3847
- ref: firstFocusableRef,
3848
- onClick: () => setIsOpen(false),
3849
- "aria-label": "Fermer le centre d'aide",
3850
- tabIndex: 0,
3851
- style: {
3852
- background: "none",
3853
- border: "none",
3854
- fontSize: "20px",
3855
- cursor: "pointer",
3856
- padding: "4px 8px",
3857
- color: "#6c757d",
3858
- lineHeight: 1,
3859
- borderRadius: "4px"
3860
- },
3861
- onMouseEnter: e => {
3862
- e.currentTarget.style.backgroundColor = "#f0f0f0";
3863
- },
3864
- onMouseLeave: e => {
3865
- e.currentTarget.style.backgroundColor = "transparent";
3866
- },
3867
- children: "\u2715"
3868
- })]
3869
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
3870
- style: {
3871
- padding: "15px 15px",
3872
- borderBottom: "1px solid #e9ecef",
3873
- backgroundColor: "white"
3874
- },
3875
- children: navigationLinks.map((link, index) => /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
3876
- id: link.id,
3877
- onClick: link.action,
3878
- onKeyDown: e => {
3879
- if (e.key === "Enter" || e.key === " ") {
3880
- e.preventDefault();
3881
- link.action(e);
3882
- }
3883
- },
3884
- role: "button",
3885
- tabIndex: 0,
3886
- "aria-label": link.title,
3887
- style: {
3888
- display: "flex",
3889
- alignItems: "center",
3890
- padding: "8px 12px",
3891
- marginRight: "130px",
3892
- cursor: "pointer",
3893
- transition: "all 0.2s ease",
3894
- borderRadius: "4px",
3895
- backgroundColor: hoveredIndex === index ? "#f0f0ef" : "transparent"
3896
- },
3897
- onMouseEnter: () => setHoveredIndex(index),
3898
- onMouseLeave: () => setHoveredIndex(null),
3899
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
3900
- style: {
3901
- width: "20px",
3902
- display: "flex",
3903
- justifyContent: "center",
3904
- marginRight: "10px"
3905
- },
3906
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFontawesome.FontAwesomeIcon, {
3907
- icon: link.icon,
3908
- style: {
3909
- color: hoveredIndex === index ? "var(--primary-color, #222f67)" : "#6c757d",
3910
- fontSize: "14px",
3911
- transition: "color 0.2s ease"
3912
- },
3913
- "aria-hidden": "true"
3914
- })
3915
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
3916
- component: "div",
3917
- sx: {
3918
- color: hoveredIndex === index ? "var(--primary-color, #222f67)" : "#6c757d",
3919
- fontSize: "12.2px",
3920
- fontWeight: "500",
3921
- transition: "color 0.2s ease",
3922
- lineHeight: "normal",
3923
- fontFamily: WIDGET_FONT,
3924
- margin: 0,
3925
- padding: 0
3926
- },
3927
- children: link.title
3928
- })]
3929
- }, index))
3930
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(BottomContent, {
3931
- showTijaria: showTijaria,
3932
- viewingReclamations: viewingReclamations,
3933
- viewingTijariaHistory: viewingTijariaHistory,
3934
- activeChat: activeChat,
3935
- infoMessages: infoMessages,
3936
- incidentMessages: incidentMessages,
3937
- setViewingReclamations: setViewingReclamations,
3938
- setViewingTijariaHistory: setViewingTijariaHistory,
3939
- setActiveChat: setActiveChat,
3940
- setInfoMessages: setInfoMessages,
3941
- setIncidentMessages: setIncidentMessages
3942
- })]
3943
- })
3944
- })
3945
- }), showGuides && /*#__PURE__*/(0, _jsxRuntime.jsx)(ContentPanel, {
3946
- isOpen: guidesPanelOpen,
3947
- onClose: () => {
3948
- setGuidesPanelOpen(false);
3949
- setGuideData(null);
3950
- },
3951
- contentData: guideData,
3952
- title: "Guide utilisateurs",
3953
- showDownloadButton: true,
3954
- onDownload: handlePdfGuideClick,
3955
- loadingDownload: loadingGuide,
3956
- projectCode: currentProjectCode,
3957
- guideBaseUrl: guideBaseUrl
3958
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(ContentPanel, {
3959
- isOpen: faqPanelOpen,
3960
- onClose: () => {
3961
- setFaqPanelOpen(false);
3962
- setFaqData(null);
3963
- },
3964
- contentData: faqData,
3965
- title: "Foire aux questions",
3966
- showDownloadButton: false,
3967
- showExternalLinkLabel: true,
3968
- externalLinkUrl: "https://www.portnet.ma/faq"
3969
- }), isOpen && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
3970
- className: "help-widget-overlay",
3971
- onClick: () => setIsOpen(false),
3972
- style: {
3973
- position: "fixed",
3974
- top: 0,
3975
- left: 0,
3976
- width: "100vw",
3977
- height: "100vh",
3978
- backgroundColor: "rgba(0, 0, 0, 0.3)",
3979
- zIndex: 999
3980
- }
3981
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Popover, {
3982
- open: contactUsMenuOpen,
3983
- anchorEl: contactUsMenuAnchor,
3984
- onClose: handleContactUsMenuClose,
3985
- anchorReference: "anchorPosition",
3986
- anchorPosition: {
3987
- top: popupPosition.y,
3988
- left: popupPosition.x
3989
- },
3990
- PaperProps: {
3991
- ref: contactPopoverRef,
3992
- elevation: 8,
3993
- sx: {
3994
- minWidth: 280,
3995
- borderRadius: 3,
3996
- overflow: "visible",
3997
- boxShadow: "0 8px 32px rgba(0,0,0,0.12)"
3998
- },
3999
- role: "dialog",
4000
- "aria-modal": "true",
4001
- "aria-labelledby": "contact-title"
4002
- },
4003
- TransitionProps: {
4004
- timeout: 300
4005
- },
4006
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
4007
- className: "draggable-handle",
4008
- onMouseDown: handleMouseDown,
4009
- style: {
4010
- padding: "16px 20px",
4011
- borderBottom: "1px solid #e0e0e0",
4012
- cursor: "move",
4013
- userSelect: "none",
4014
- backgroundColor: "#f8f9fa",
4015
- borderTopLeftRadius: "12px",
4016
- borderTopRightRadius: "12px",
4017
- display: "flex",
4018
- justifyContent: "center",
4019
- alignItems: "center",
4020
- position: "relative"
4021
- },
4022
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
4023
- style: {
4024
- display: "flex",
4025
- alignItems: "center",
4026
- gap: "8px"
4027
- },
4028
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
4029
- component: "div",
4030
- id: "contact-title",
4031
- sx: {
4032
- fontWeight: "600",
4033
- fontSize: "15px",
4034
- color: "#333",
4035
- fontFamily: WIDGET_FONT,
4036
- margin: 0,
4037
- padding: 0,
4038
- lineHeight: "normal"
4039
- },
4040
- children: "Contactez-nous"
4041
- })
4042
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
4043
- onClick: handleContactUsMenuClose,
4044
- "aria-label": "Fermer",
4045
- tabIndex: 0,
4046
- style: {
4047
- cursor: "pointer",
4048
- padding: "4px",
4049
- borderRadius: "4px",
4050
- display: "flex",
4051
- alignItems: "center",
4052
- justifyContent: "center",
4053
- transition: "background-color 0.2s",
4054
- position: "absolute",
4055
- right: "16px",
4056
- background: "none",
4057
- border: "none"
4058
- },
4059
- onMouseEnter: e => e.currentTarget.style.backgroundColor = "#e0e0e0",
4060
- onMouseLeave: e => e.currentTarget.style.backgroundColor = "transparent",
4061
- onFocus: e => {
4062
- e.currentTarget.style.backgroundColor = "#e0e0e0";
4063
- e.currentTarget.style.outline = "2px solid var(--primary-color, #222f67)";
4064
- e.currentTarget.style.outlineOffset = "2px";
4065
- },
4066
- onBlur: e => {
4067
- e.currentTarget.style.backgroundColor = "transparent";
4068
- e.currentTarget.style.outline = "none";
4069
- },
4070
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFontawesome.FontAwesomeIcon, {
4071
- icon: _freeSolidSvgIcons.faTimes,
4072
- style: {
4073
- fontSize: "14px",
4074
- color: "#666"
4075
- },
4076
- "aria-hidden": "true"
4077
- })
4078
- })]
4079
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
4080
- style: {
4081
- padding: "8px"
4082
- },
4083
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.MenuItem, {
4084
- onClick: () => {
4085
- window.open("tel:+212520473100", "_self");
4086
- handleContactUsMenuClose();
4087
- },
4088
- onKeyDown: e => {
4089
- if (e.key === "Enter" || e.key === " ") {
4090
- e.preventDefault();
4091
- window.open("tel:+212520473100", "_self");
4092
- handleContactUsMenuClose();
4093
- }
4094
- },
4095
- tabIndex: 0,
4096
- sx: {
4097
- borderRadius: 1,
4098
- mb: 0.5,
4099
- py: 1.5,
4100
- "&:hover": {
4101
- backgroundColor: "var(--primary-alpha-8, rgba(34, 47, 103, 0.08))"
4102
- },
4103
- "&:focus": {
4104
- backgroundColor: "var(--primary-alpha-8, rgba(34, 47, 103, 0.08))",
4105
- outline: "2px solid var(--primary-color, #222f67)",
4106
- outlineOffset: "2px"
4107
- }
4108
- },
4109
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItemIcon, {
4110
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_iconsMaterial.Phone, {
4111
- fontSize: "small",
4112
- sx: {
4113
- color: "var(--primary-color, #222f67)"
4114
- },
4115
- "aria-hidden": "true"
4116
- })
4117
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItemText, {
4118
- primary: "Assistance t\xE9l\xE9phonique",
4119
- secondary: "+212 520 47 31 00",
4120
- primaryTypographyProps: {
4121
- fontSize: "14px",
4122
- fontWeight: "500"
4123
- },
4124
- secondaryTypographyProps: {
4125
- fontSize: "12px"
4126
- }
4127
- })]
4128
- })
4129
- })]
4130
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(ReclamationFormModal, {
4131
- open: reclamationModalOpen,
4132
- onClose: () => setReclamationModalOpen(false),
4133
- portailId: portailId
4134
- })]
4135
- });
4136
- };
4137
- var _default = exports.default = PuiHelpWidget;