@amsom-habitat/ui 2.20.6 → 2.20.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/ui.js CHANGED
@@ -1,16 +1,2044 @@
1
- import { a as s, l as o, f as e, h as A, A as l, d as t, j as r, k as i, n as d, i as n, m as p, e as S, A as g } from "./index-DW6kT0Fx.js";
1
+ import { FontAwesomeIcon as D } from "@fortawesome/vue-fontawesome";
2
+ import { library as M } from "@fortawesome/fontawesome-svg-core";
3
+ import { faTimes as Q, faCheck as W, faCamera as X, faTrash as R, faArrowRight as $, faArrowLeft as ee, faEye as q, faEyeSlash as K, faArrowDownWideShort as te, faArrowUpShortWide as se, faPlus as le, faAnglesLeft as ie, faAngleLeft as ne, faAngleRight as oe, faAnglesRight as ae, faCloudArrowDown as re, faTriangleExclamation as de, faCloudArrowUp as ce, faPaperclip as ue, faFileCirclePlus as me } from "@fortawesome/free-solid-svg-icons";
4
+ import { resolveComponent as x, createBlock as k, openBlock as n, Teleport as fe, createElementVNode as o, createElementBlock as r, createCommentVNode as h, normalizeStyle as _, normalizeClass as f, withModifiers as w, renderSlot as I, toDisplayString as p, Fragment as y, renderList as C, createTextVNode as A, useCssVars as he, createVNode as b, withCtx as z, withDirectives as N, vModelCheckbox as E, vShow as ge } from "vue";
5
+ import { isImage as j, resizeImage as G, handleFile as J, base64ToBlob as pe, openFileBlob as ye, downloadBlob as be, imageToPDF as Se, openFileBase64 as xe, isPdf as ke } from "@amsom-habitat/file-utils";
6
+ import { VueDraggableNext as we } from "vue-draggable-next";
7
+ import P from "moment-timezone";
8
+ import { unixToDateString as Ce } from "@amsom-habitat/date-utils";
9
+ import _e from "pdf-merger-js";
10
+ const ve = (s, e) => {
11
+ const t = s.__vccOpts || s;
12
+ for (const [u, i] of e)
13
+ t[u] = i;
14
+ return t;
15
+ };
16
+ M.add(Q);
17
+ const Pe = {
18
+ name: "AmsomModalComponent",
19
+ components: {
20
+ FontAwesomeIcon: D
21
+ },
22
+ props: {
23
+ closeOption: {
24
+ type: Boolean,
25
+ default: !1
26
+ },
27
+ size: {
28
+ type: String,
29
+ default: "md",
30
+ validator(s) {
31
+ return ["xxs", "xs", "sm", "md", "lg", "xl"].includes(s);
32
+ }
33
+ },
34
+ position: {
35
+ type: String,
36
+ default: "center",
37
+ validator(s) {
38
+ return ["top", "center", "bottom"].includes(s);
39
+ }
40
+ },
41
+ title: {
42
+ type: String,
43
+ default: ""
44
+ },
45
+ reducible: {
46
+ type: Boolean,
47
+ default: !1
48
+ },
49
+ classTitle: {
50
+ type: String,
51
+ default: "h4 text-center"
52
+ }
53
+ },
54
+ emits: ["close"],
55
+ data() {
56
+ return {
57
+ alreadyHidden: !1,
58
+ modalId: this.$options.modalManager.generateModalId(),
59
+ reduced: !1,
60
+ mouseDownOnBackdrop: !1
61
+ };
62
+ },
63
+ // Gestionnaire global des modales ouvertes
64
+ // Utilise un array pour maintenir l'ordre d'ouverture et fermer la bonne modal avec ESC
65
+ modalManager: {
66
+ openModals: [],
67
+ baseZIndex: 1e4,
68
+ // Z-index de base pour les modals - au-dessus de Bootstrap (max ~1090) et Overlay
69
+ zIndexIncrement: 10,
70
+ // Incrément de z-index entre chaque modal
71
+ modalCounter: 0,
72
+ // Compteur pour générer des IDs uniques
73
+ // Configuration des tailles de modal
74
+ sizes: {
75
+ xxs: "col-12 col-md-3",
76
+ xs: "col-12 col-md-4",
77
+ sm: "col-12 col-md-6",
78
+ md: "col-12 col-md-8",
79
+ lg: "col-12 col-md-10",
80
+ xl: "col-12"
81
+ },
82
+ generateModalId() {
83
+ return `modal-${Date.now()}-${++this.modalCounter}`;
84
+ },
85
+ register(s) {
86
+ this.openModals.push(s);
87
+ },
88
+ unregister(s) {
89
+ const e = this.openModals.indexOf(s);
90
+ e > -1 && this.openModals.splice(e, 1);
91
+ },
92
+ getTopModal() {
93
+ return this.openModals[this.openModals.length - 1];
94
+ },
95
+ clear() {
96
+ this.openModals.length = 0;
97
+ }
98
+ },
99
+ computed: {
100
+ // Z-index dynamique basé sur l'ordre d'ouverture
101
+ modalZIndex() {
102
+ const s = this.$options.modalManager.openModals.indexOf(this.modalId);
103
+ return this.$options.modalManager.baseZIndex + (s >= 0 ? s * this.$options.modalManager.zIndexIncrement : 0);
104
+ },
105
+ // Dimension de la modal
106
+ modalSize() {
107
+ return this.$options.modalManager.sizes[this.size] || this.$options.modalManager.sizes.md;
108
+ },
109
+ // Alignement vertical de la modal
110
+ alignmentClass() {
111
+ return {
112
+ top: "flex-start",
113
+ center: "center",
114
+ bottom: "flex-end"
115
+ }[this.position] || "center";
116
+ }
117
+ },
118
+ mounted() {
119
+ this.$options.modalManager.register(this.modalId), this.$options.modalManager.openModals.length === 1 && this.lockBodyScroll(), this.closeOption && document.addEventListener("keydown", this.closeEsc);
120
+ },
121
+ beforeUnmount() {
122
+ this.$options.modalManager.unregister(this.modalId), this.$options.modalManager.openModals.length === 0 && this.unlockBodyScroll(), this.closeOption && document.removeEventListener("keydown", this.closeEsc);
123
+ },
124
+ methods: {
125
+ lockBodyScroll() {
126
+ if (window.getComputedStyle(document.body).overflow === "hidden") {
127
+ this.alreadyHidden = !0;
128
+ return;
129
+ }
130
+ document.body.style.overflow = "hidden";
131
+ },
132
+ unlockBodyScroll() {
133
+ this.alreadyHidden || (document.body.style.overflow = "");
134
+ },
135
+ // Gestion du mousedown sur le backdrop pour tracker où commence le clic
136
+ handleBackdropMouseDown(s) {
137
+ s.target === s.currentTarget && (this.mouseDownOnBackdrop = !0);
138
+ },
139
+ // Gestion du mousedown sur la modal pour tracker le début
140
+ handleModalMouseDown() {
141
+ this.mouseDownOnBackdrop = !1;
142
+ },
143
+ // Gestion du mouseup sur la modal pour empêcher la fermeture
144
+ handleModalMouseUp() {
145
+ this.mouseDownOnBackdrop = !1;
146
+ },
147
+ // Gestion du clic sur le backdrop (arrière-plan)
148
+ handleBackdropClick(s) {
149
+ s.target === s.currentTarget && this.mouseDownOnBackdrop && this.closeOption && this.$emit("close"), this.mouseDownOnBackdrop = !1;
150
+ },
151
+ // Fermeture de la modal avec la touche echap
152
+ closeEsc(s) {
153
+ s.key === "Escape" && this.$options.modalManager.getTopModal() === this.modalId && this.$emit("close");
154
+ }
155
+ }
156
+ }, Ie = ["id"], De = { class: "amsom-modal-body mt-2" }, Me = /* @__PURE__ */ o("p", null, " Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante. ", -1), Be = {
157
+ key: 0,
158
+ class: "position-fixed bottom-0 end-0 mb-3 me-3"
159
+ }, Ae = {
160
+ key: 0,
161
+ class: "position-fixed bottom-0 end-0 mb-3 me-3"
162
+ };
163
+ function Te(s, e, t, u, i, l) {
164
+ const c = x("font-awesome-icon");
165
+ return n(), k(fe, { to: "body" }, [
166
+ o("div", {
167
+ class: f(["p-2 m-0 bg-black bg-opacity-25 position-fixed overflow-y-auto", { "d-none": i.reduced }]),
168
+ style: _({
169
+ zIndex: l.modalZIndex,
170
+ inset: 0
171
+ }),
172
+ onMousedown: e[7] || (e[7] = (...d) => l.handleBackdropMouseDown && l.handleBackdropMouseDown(...d)),
173
+ onClick: e[8] || (e[8] = (...d) => l.handleBackdropClick && l.handleBackdropClick(...d))
174
+ }, [
175
+ o("div", {
176
+ class: "d-flex justify-content-center",
177
+ style: _({
178
+ minHeight: "100%",
179
+ alignItems: l.alignmentClass,
180
+ paddingTop: t.position === "center" ? "2rem" : "1rem",
181
+ paddingBottom: t.position === "center" ? "2rem" : "1rem"
182
+ }),
183
+ onMousedown: e[4] || (e[4] = (...d) => l.handleBackdropMouseDown && l.handleBackdropMouseDown(...d)),
184
+ onClick: e[5] || (e[5] = (...d) => l.handleBackdropClick && l.handleBackdropClick(...d))
185
+ }, [
186
+ o("div", {
187
+ id: i.modalId,
188
+ class: f(["container-fluid bg-white rounded-4 p-3 position-relative d-flex flex-column", l.modalSize]),
189
+ style: {
190
+ minHeight: "auto",
191
+ maxHeight: "none"
192
+ },
193
+ onClick: e[1] || (e[1] = w(() => {
194
+ }, ["stop"])),
195
+ onMousedown: e[2] || (e[2] = (...d) => l.handleModalMouseDown && l.handleModalMouseDown(...d)),
196
+ onMouseup: e[3] || (e[3] = (...d) => l.handleModalMouseUp && l.handleModalMouseUp(...d))
197
+ }, [
198
+ t.closeOption ? (n(), k(c, {
199
+ key: 0,
200
+ icon: "fa-solid fa-times",
201
+ role: "button",
202
+ class: "position-absolute top-0 end-0 m-3 translate-middle-y",
203
+ size: "lg",
204
+ onClick: e[0] || (e[0] = (d) => s.$emit("close"))
205
+ })) : h("", !0),
206
+ o("div", De, [
207
+ I(s.$slots, "title", {}, () => [
208
+ t.title ? (n(), r("div", {
209
+ key: 0,
210
+ class: f(t.classTitle)
211
+ }, p(t.title), 3)) : h("", !0)
212
+ ]),
213
+ I(s.$slots, "default", {}, () => [
214
+ Me
215
+ ])
216
+ ])
217
+ ], 42, Ie)
218
+ ], 36),
219
+ t.reducible ? (n(), r("div", Be, [
220
+ o("button", {
221
+ class: "btn btn-primary",
222
+ onClick: e[6] || (e[6] = (d) => i.reduced = !i.reduced)
223
+ }, " Réduire la fenêtre ")
224
+ ])) : h("", !0)
225
+ ], 38),
226
+ t.reducible && i.reduced ? (n(), r("div", Ae, [
227
+ o("button", {
228
+ class: "btn btn-primary",
229
+ onClick: e[9] || (e[9] = (d) => i.reduced = !i.reduced)
230
+ }, " Restaurer la fenêtre ")
231
+ ])) : h("", !0)
232
+ ]);
233
+ }
234
+ const ze = /* @__PURE__ */ ve(Pe, [["render", Te]]), v = (s, e) => {
235
+ const t = s.__vccOpts || s;
236
+ for (const [u, i] of e)
237
+ t[u] = i;
238
+ return t;
239
+ }, Fe = {
240
+ name: "AmsomCard",
241
+ props: {
242
+ //string or null
243
+ title: {
244
+ type: String,
245
+ default: null
246
+ },
247
+ bgImage: {
248
+ type: String,
249
+ default: null
250
+ },
251
+ bgOpacity: {
252
+ type: Number,
253
+ default: 0.25,
254
+ validator: (s) => s >= 0 && s <= 1
255
+ },
256
+ bubbleTitle: {
257
+ type: Boolean,
258
+ default: !1
259
+ },
260
+ bubbleTitleClass: {
261
+ type: String,
262
+ default: "bg-primary text-white"
263
+ },
264
+ noBody: {
265
+ type: Boolean,
266
+ default: !1
267
+ },
268
+ header: {
269
+ type: Boolean,
270
+ default: !1
271
+ },
272
+ headerClass: {
273
+ type: String,
274
+ default: ""
275
+ },
276
+ cardClass: {
277
+ type: String,
278
+ default: ""
279
+ },
280
+ cardStyle: {
281
+ type: String,
282
+ default: ""
283
+ },
284
+ footer: {
285
+ type: Boolean,
286
+ default: !1
287
+ },
288
+ footerClass: {
289
+ type: String,
290
+ default: ""
291
+ }
292
+ }
293
+ }, Le = { class: "position-relative" }, Ne = {
294
+ key: 0,
295
+ class: "card-title"
296
+ }, je = ["src"];
297
+ function qe(s, e, t, u, i, l) {
298
+ return n(), r("div", Le, [
299
+ t.header ? (n(), r("div", {
300
+ key: 0,
301
+ class: f(["card card-header", t.headerClass])
302
+ }, [
303
+ I(s.$slots, "header")
304
+ ], 2)) : h("", !0),
305
+ o("div", {
306
+ class: f(["card position-relative h-100", [
307
+ {
308
+ "rounded-top-0": t.header,
309
+ "rounded-bottom-0": t.footer
310
+ },
311
+ t.cardClass
312
+ ]])
313
+ }, [
314
+ o("div", {
315
+ class: "position-relative overflow-y-auto h-100",
316
+ style: _(t.cardStyle)
317
+ }, [
318
+ o("div", {
319
+ class: f([
320
+ {
321
+ "card-body": !t.noBody
322
+ }
323
+ ]),
324
+ style: { position: "relative", "z-index": "1" }
325
+ }, [
326
+ I(s.$slots, "title", {}, () => [
327
+ t.title && !t.bubbleTitle ? (n(), r("h4", Ne, p(t.title), 1)) : h("", !0)
328
+ ]),
329
+ I(s.$slots, "default")
330
+ ], 2)
331
+ ], 4),
332
+ t.bgImage ? (n(), r("img", {
333
+ key: 0,
334
+ src: t.bgImage,
335
+ class: f(["img img-fluid bg-white object-fit-cover h-100 w-100 position-absolute top-0 start-0", [
336
+ {
337
+ "rounded-top-0": t.header,
338
+ "rounded-bottom-0": t.footer
339
+ }
340
+ ]]),
341
+ alt: "Image de fond du widget",
342
+ style: _({
343
+ opacity: t.bgOpacity,
344
+ zIndex: 0,
345
+ borderRadius: "inherit"
346
+ })
347
+ }, null, 14, je)) : h("", !0)
348
+ ], 2),
349
+ t.title && t.bubbleTitle ? (n(), r("span", {
350
+ key: 1,
351
+ id: "bubble-title",
352
+ class: f(["position-absolute top-0 start-0 translate-middle-y rounded-pill shadow px-1", t.bubbleTitleClass]),
353
+ style: { "z-index": "2" }
354
+ }, p(t.title), 3)) : h("", !0),
355
+ t.footer ? (n(), r("div", {
356
+ key: 2,
357
+ class: f(["card card-footer", t.footerClass])
358
+ }, [
359
+ I(s.$slots, "footer")
360
+ ], 2)) : h("", !0)
361
+ ]);
362
+ }
363
+ const Ve = /* @__PURE__ */ v(Fe, [["render", qe]]), Ee = {
364
+ name: "AmsomOverlay",
365
+ props: {
366
+ loading: {
367
+ type: Boolean,
368
+ default: !1,
369
+ required: !0
370
+ },
371
+ opacity: {
372
+ type: Number,
373
+ default: 60,
374
+ required: !1,
375
+ validator: (s) => s >= 0 && s <= 100
376
+ }
377
+ }
378
+ }, He = { class: "position-relative" };
379
+ function Oe(s, e, t, u, i, l) {
380
+ return n(), r("div", He, [
381
+ t.loading ? (n(), r("div", {
382
+ key: 0,
383
+ class: "position-absolute w-100 h-100 d-flex align-items-center justify-content-center rounded",
384
+ style: _({
385
+ backgroundColor: "rgba(193, 193, 193," + t.opacity / 100 + ")",
386
+ boxShadow: "inset 0 0 0 10px rgba(193, 193, 193, 0.5)",
387
+ zIndex: 1090
388
+ })
389
+ }, [...e[0] || (e[0] = [
390
+ o("div", {
391
+ class: "spinner-border text-primary position-sticky sticky-top",
392
+ role: "status"
393
+ }, [
394
+ o("span", { class: "sr-only visually-hidden" }, "Chargement...")
395
+ ], -1)
396
+ ])], 4)) : h("", !0),
397
+ I(s.$slots, "default", {}, () => [
398
+ e[1] || (e[1] = o("p", null, " Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante. ", -1))
399
+ ])
400
+ ]);
401
+ }
402
+ const Z = /* @__PURE__ */ v(Ee, [["render", Oe]]);
403
+ M.add(W);
404
+ const Ye = {
405
+ name: "WorkflowAssuranceBlock",
406
+ components: {
407
+ FontAwesomeIcon: D
408
+ },
409
+ props: {
410
+ steps: {
411
+ type: Array,
412
+ required: !0,
413
+ default: () => [
414
+ {
415
+ numero: 1,
416
+ texte: "Step 1"
417
+ },
418
+ {
419
+ numero: 2,
420
+ texte: "Step 2"
421
+ },
422
+ {
423
+ numero: 3,
424
+ texte: "Step 3"
425
+ }
426
+ ]
427
+ },
428
+ currentStep: {
429
+ type: Number,
430
+ required: !1,
431
+ default: 1
432
+ },
433
+ size: {
434
+ type: String,
435
+ required: !1,
436
+ default: "md"
437
+ },
438
+ checkPassedStep: {
439
+ type: Boolean,
440
+ required: !1,
441
+ default: !0
442
+ },
443
+ passedStepBgColor: {
444
+ type: String,
445
+ required: !1,
446
+ default: "success"
447
+ },
448
+ currentStepBgColor: {
449
+ type: String,
450
+ required: !1,
451
+ default: "primary"
452
+ },
453
+ futureStepBgColor: {
454
+ type: String,
455
+ required: !1,
456
+ default: "secondary"
457
+ },
458
+ passedStepCss: {
459
+ type: String,
460
+ required: !1,
461
+ default: "text-white"
462
+ },
463
+ currentStepCss: {
464
+ type: String,
465
+ required: !1,
466
+ default: "text-white fw-bold"
467
+ },
468
+ futureStepCss: {
469
+ type: String,
470
+ required: !1,
471
+ default: "text-white"
472
+ },
473
+ passedStepTextCss: {
474
+ type: String,
475
+ required: !1,
476
+ default: "white"
477
+ },
478
+ currentStepTextCss: {
479
+ type: String,
480
+ required: !1,
481
+ default: "white"
482
+ },
483
+ futureStepTextCss: {
484
+ type: String,
485
+ required: !1,
486
+ default: "white"
487
+ },
488
+ hideText: {
489
+ type: Boolean,
490
+ required: !1,
491
+ default: !1
492
+ }
493
+ },
494
+ emits: ["clickStep"],
495
+ computed: {
496
+ fontSize() {
497
+ return this.bubbleSize / 2;
498
+ },
499
+ bubbleSize() {
500
+ switch (this.size) {
501
+ case "sm":
502
+ return 2;
503
+ case "lg":
504
+ return 4;
505
+ default:
506
+ return 3;
507
+ }
508
+ }
509
+ }
510
+ }, Ue = { class: "d-flex flex-column align-items-center" }, We = ["onClick"], Re = {
511
+ key: 0,
512
+ class: "line h-100",
513
+ style: { height: "30px", "min-height": "30px" }
514
+ };
515
+ function Ke(s, e, t, u, i, l) {
516
+ const c = x("font-awesome-icon");
517
+ return n(!0), r(y, null, C(t.steps, (d, m) => (n(), r("div", {
518
+ key: d.numero,
519
+ class: "d-flex mb-1"
520
+ }, [
521
+ o("div", Ue, [
522
+ o("div", {
523
+ style: _({
524
+ width: l.bubbleSize + "rem",
525
+ minHeight: l.bubbleSize + "rem",
526
+ height: l.bubbleSize + "rem",
527
+ lineHeight: l.bubbleSize + "rem",
528
+ fontSize: l.fontSize + "rem"
529
+ }),
530
+ class: f(["d-inline-block rounded-circle text-center mb-1", [
531
+ "bg-" + (m + 1 < t.currentStep ? t.passedStepBgColor : m + 1 === t.currentStep ? t.currentStepBgColor : t.futureStepBgColor),
532
+ m + 1 < t.currentStep ? t.passedStepCss : m + 1 === t.currentStep ? t.currentStepCss : t.futureStepCss
533
+ ]]),
534
+ onClick: (a) => s.$emit("clickStep", d.numero)
535
+ }, [
536
+ m + 1 < t.currentStep && t.checkPassedStep ? (n(), k(c, {
537
+ key: 0,
538
+ icon: ["fas", "check"]
539
+ })) : (n(), r(y, { key: 1 }, [
540
+ A(p(d.numero), 1)
541
+ ], 64))
542
+ ], 14, We),
543
+ m < t.steps.length - 1 ? (n(), r("div", Re)) : h("", !0)
544
+ ]),
545
+ t.hideText ? h("", !0) : (n(), r("span", {
546
+ key: 0,
547
+ class: f(["ms-1", [m + 1 < t.currentStep ? t.passedStepTextCss : m + 1 === t.currentStep ? t.currentStepTextCss : t.futureStepTextCss]]),
548
+ style: _({
549
+ minHeight: l.bubbleSize + "rem",
550
+ lineHeight: l.bubbleSize + "rem"
551
+ })
552
+ }, [
553
+ I(s.$slots, "stepContent", { step: d }, () => [
554
+ A(p(d.texte), 1)
555
+ ], !0)
556
+ ], 6))
557
+ ]))), 128);
558
+ }
559
+ const Hs = /* @__PURE__ */ v(Ye, [["render", Ke], ["__scopeId", "data-v-5eab4376"]]);
560
+ M.add(W);
561
+ const V = {
562
+ name: "AmsomHorizontalStepper",
563
+ components: {
564
+ FontAwesomeIcon: D
565
+ },
566
+ props: {
567
+ currentStep: {
568
+ type: Number,
569
+ required: !0,
570
+ default: 1
571
+ },
572
+ steps: {
573
+ type: Array,
574
+ required: !0,
575
+ default: () => [
576
+ {
577
+ numero: 1,
578
+ texte: "Step 1"
579
+ },
580
+ {
581
+ numero: 2,
582
+ texte: "Step 2"
583
+ },
584
+ {
585
+ numero: 3,
586
+ texte: "Step 3"
587
+ }
588
+ ]
589
+ },
590
+ size: {
591
+ type: String,
592
+ required: !1,
593
+ default: "md",
594
+ validator: function(s) {
595
+ return ["sm", "md", "lg"].indexOf(s) !== -1;
596
+ }
597
+ },
598
+ checkPassedStep: {
599
+ type: Boolean,
600
+ required: !1,
601
+ default: !0
602
+ },
603
+ passedStepBgColor: {
604
+ type: String,
605
+ required: !1,
606
+ default: "success"
607
+ },
608
+ currentStepBgColor: {
609
+ type: String,
610
+ required: !1,
611
+ default: "primary"
612
+ },
613
+ futureStepBgColor: {
614
+ type: String,
615
+ required: !1,
616
+ default: "secondary"
617
+ },
618
+ passedStepCss: {
619
+ type: String,
620
+ required: !1,
621
+ default: "text-white"
622
+ },
623
+ currentStepCss: {
624
+ type: String,
625
+ required: !1,
626
+ default: "text-white fw-bold"
627
+ },
628
+ futureStepCss: {
629
+ type: String,
630
+ required: !1,
631
+ default: "text-white"
632
+ },
633
+ passedStepTextCss: {
634
+ type: String,
635
+ required: !1,
636
+ default: ""
637
+ },
638
+ currentStepTextCss: {
639
+ type: String,
640
+ required: !1,
641
+ default: "fw-bold"
642
+ },
643
+ futureStepTextCss: {
644
+ type: String,
645
+ required: !1,
646
+ default: ""
647
+ },
648
+ hideText: {
649
+ type: Boolean,
650
+ required: !1,
651
+ default: !1
652
+ }
653
+ },
654
+ emits: ["clickStep"],
655
+ computed: {
656
+ fontSizeText() {
657
+ return this.bubbleSize / 2.5;
658
+ },
659
+ fontSizeStep() {
660
+ return this.bubbleSize / 2;
661
+ },
662
+ bubbleSize() {
663
+ switch (this.size) {
664
+ case "sm":
665
+ return 2;
666
+ case "lg":
667
+ return 4;
668
+ default:
669
+ return 3;
670
+ }
671
+ },
672
+ passedStepBgColorCss() {
673
+ return "var(--bs-" + this.passedStepBgColor + ")";
674
+ },
675
+ futureStepBgColorCss() {
676
+ return "var(--bs-" + this.futureStepBgColor + ")";
677
+ },
678
+ currentStepBgColorCss() {
679
+ return "var(--bs-" + this.currentStepBgColor + ")";
680
+ },
681
+ lineTopCss() {
682
+ return "calc(" + this.bubbleSize + "/ 2)";
683
+ }
684
+ }
685
+ }, H = () => {
686
+ he((s) => ({
687
+ v31536048: s.futureStepBgColorCss,
688
+ dac29eac: s.bubbleSize + "rem",
689
+ a3a0806e: s.passedStepBgColorCss,
690
+ de0182ca: s.fontSizeStep + "rem"
691
+ }));
692
+ }, O = V.setup;
693
+ V.setup = O ? (s, e) => (H(), O(s, e)) : H;
694
+ const Ge = { class: "d-flex justify-content-between" }, Je = ["role", "onClick"];
695
+ function Ze(s, e, t, u, i, l) {
696
+ const c = x("font-awesome-icon");
697
+ return n(), r("div", Ge, [
698
+ (n(!0), r(y, null, C(t.steps, (d, m) => (n(), r("div", {
699
+ key: d.numero,
700
+ role: d.numero < t.currentStep ? "button" : "none",
701
+ class: f(["stepper-item", [
702
+ {
703
+ active: d.numero === t.currentStep,
704
+ completed: d.numero < t.currentStep
705
+ }
706
+ ]]),
707
+ onClick: (a) => s.$emit("clickStep", d.numero)
708
+ }, [
709
+ o("div", {
710
+ class: f(["step-counter", [
711
+ "bg-" + (m + 1 < t.currentStep ? t.passedStepBgColor : m + 1 === t.currentStep ? t.currentStepBgColor : t.futureStepBgColor),
712
+ m + 1 < t.currentStep ? t.passedStepCss : m + 1 === t.currentStep ? t.currentStepCss : t.futureStepCss
713
+ ]]),
714
+ style: _({ fontSize: l.fontSizeStep + "rem" })
715
+ }, [
716
+ m + 1 < t.currentStep && t.checkPassedStep ? (n(), k(c, {
717
+ key: 0,
718
+ icon: ["fas", "check"]
719
+ })) : (n(), r(y, { key: 1 }, [
720
+ A(p(d.numero), 1)
721
+ ], 64))
722
+ ], 6),
723
+ t.hideText ? h("", !0) : (n(), r("div", {
724
+ key: 0,
725
+ class: f(["step-name", [m + 1 < t.currentStep ? t.passedStepTextCss : m + 1 === t.currentStep ? t.currentStepTextCss : t.futureStepTextCss]]),
726
+ style: _({ fontSize: l.fontSizeText + "rem" })
727
+ }, p(d.texte), 7))
728
+ ], 10, Je))), 128))
729
+ ]);
730
+ }
731
+ const Os = /* @__PURE__ */ v(V, [["render", Ze]]);
732
+ M.add(X, R, $, ee);
733
+ const Qe = {
734
+ name: "PhotoComponent",
735
+ components: {
736
+ AmsomModal: ze,
737
+ FontAwesomeIcon: D
738
+ },
739
+ props: {
740
+ images: {
741
+ type: Array,
742
+ default: () => []
743
+ },
744
+ imageSizeWidth: {
745
+ type: String,
746
+ default: "50px"
747
+ },
748
+ imageSizeHeight: {
749
+ type: String,
750
+ default: "50px"
751
+ },
752
+ imagesLimit: {
753
+ type: Number,
754
+ default: -1
755
+ },
756
+ capture: {
757
+ type: String,
758
+ default: "file"
759
+ }
760
+ },
761
+ emits: ["update:images"],
762
+ data() {
763
+ return {
764
+ showModal: !1,
765
+ selectedPhotoIndex: 0
766
+ };
767
+ },
768
+ computed: {
769
+ canAddImage() {
770
+ return this.imagesLimit === -1 ? !0 : this.imagesLimit !== -1 && this.images.length < this.imagesLimit;
771
+ }
772
+ },
773
+ methods: {
774
+ triggerFileInput() {
775
+ this.$refs.fileInput.click();
776
+ },
777
+ openPhoto(s) {
778
+ this.selectedPhotoIndex = this.images.findIndex((e) => e === s), this.showModal = !0;
779
+ },
780
+ closeModal() {
781
+ this.showModal = !1;
782
+ },
783
+ changeIndex(s) {
784
+ s === 0 ? this.selectedPhotoIndex = this.selectedPhotoIndex === 0 ? 0 : this.selectedPhotoIndex - 1 : this.selectedPhotoIndex = this.selectedPhotoIndex === this.images.length - 1 ? 0 : this.selectedPhotoIndex + 1;
785
+ },
786
+ deleteImage() {
787
+ this.$emit(
788
+ "update:images",
789
+ this.images.filter((s, e) => e !== this.selectedPhotoIndex)
790
+ ), this.images.length - 1 === 0 ? this.closeModal() : this.changeIndex(0);
791
+ },
792
+ getDataFiles(s) {
793
+ let e = s.target.files;
794
+ if (e) {
795
+ this.imagesLimit !== -1 && (e = Array.from(e), e = e.slice(0, this.imagesLimit));
796
+ for (let t of e)
797
+ j(t) && G({ file: t, maxWidth: this.maxWidth, maxHeigth: this.maxHeigth }).then((u) => {
798
+ J(pe(u), t.type.split("/")[1]).then((i) => {
799
+ i.nomFichier = t.name, this.$emit("update:images", [...this.images, i]);
800
+ });
801
+ });
802
+ }
803
+ }
804
+ }
805
+ }, Xe = { class: "border border-1 border-grey rounded-4 p-2 d-flex align-items-center" }, $e = ["disabled"], et = ["capture"], tt = {
806
+ key: 0,
807
+ class: "d-flex overflow-x-auto w-100"
808
+ }, st = ["onClick"], lt = ["src", "alt"], it = {
809
+ key: 1,
810
+ class: "fs-7"
811
+ }, nt = { class: "row w-100 mx-auto" }, ot = { class: "col-12 mb-3" }, at = ["src", "alt"], rt = { class: "col-12 d-flex justify-content-center" };
812
+ function dt(s, e, t, u, i, l) {
813
+ const c = x("font-awesome-icon"), d = x("amsom-modal");
814
+ return n(), r("div", Xe, [
815
+ o("button", {
816
+ type: "button",
817
+ class: "btn rounded-4 me-1 d-flex justify-content-center align-items-center",
818
+ style: _({
819
+ width: t.imageSizeWidth,
820
+ minWidth: t.imageSizeWidth,
821
+ height: t.imageSizeHeight,
822
+ minHeight: t.imageSizeHeight,
823
+ backgroundColor: "#a4a228"
824
+ }),
825
+ disabled: !l.canAddImage,
826
+ onClick: e[2] || (e[2] = (...m) => l.triggerFileInput && l.triggerFileInput(...m))
827
+ }, [
828
+ b(c, {
829
+ icon: "fa-solid fa-camera",
830
+ size: "lg",
831
+ class: "text-white"
832
+ }),
833
+ t.capture === "file" ? (n(), r("input", {
834
+ key: 0,
835
+ id: "file",
836
+ ref: "fileInput",
837
+ type: "file",
838
+ class: "form-control",
839
+ accept: "image/*",
840
+ style: { display: "none" },
841
+ multiple: "",
842
+ onInput: e[0] || (e[0] = (...m) => l.getDataFiles && l.getDataFiles(...m))
843
+ }, null, 544)) : (n(), r("input", {
844
+ key: 1,
845
+ id: "file",
846
+ ref: "fileInput",
847
+ type: "file",
848
+ class: "form-control",
849
+ style: { display: "none" },
850
+ accept: "image/*",
851
+ multiple: "",
852
+ capture: t.capture,
853
+ onInput: e[1] || (e[1] = (...m) => l.getDataFiles && l.getDataFiles(...m))
854
+ }, null, 40, et))
855
+ ], 12, $e),
856
+ t.images.length > 0 ? (n(), r("div", tt, [
857
+ (n(!0), r(y, null, C(t.images, (m) => (n(), r("button", {
858
+ key: m,
859
+ type: "button",
860
+ class: "btn p-0 mx-1 rounded-1",
861
+ style: _({
862
+ minWidth: t.imageSizeWidth,
863
+ width: t.imageSizeWidth,
864
+ minHeight: t.imageSizeHeight,
865
+ height: t.imageSizeHeight
866
+ }),
867
+ onClick: (a) => l.openPhoto(m)
868
+ }, [
869
+ o("img", {
870
+ src: "data:" + (m == null ? void 0 : m.type) + ";base64," + (m == null ? void 0 : m.file),
871
+ class: "h-100 w-100 rounded-1",
872
+ alt: m == null ? void 0 : m.nomFichier
873
+ }, null, 8, lt)
874
+ ], 12, st))), 128))
875
+ ])) : (n(), r("div", it, " Ajouter une image ")),
876
+ i.showModal ? (n(), k(d, {
877
+ key: 2,
878
+ size: "sm",
879
+ "close-option": "",
880
+ onClose: l.closeModal
881
+ }, {
882
+ default: z(() => {
883
+ var m, a, g;
884
+ return [
885
+ o("div", nt, [
886
+ o("div", ot, [
887
+ o("img", {
888
+ src: "data:" + ((m = t.images[i.selectedPhotoIndex]) == null ? void 0 : m.type) + ";base64," + ((a = t.images[i.selectedPhotoIndex]) == null ? void 0 : a.file),
889
+ alt: (g = t.images[i.selectedPhotoIndex]) == null ? void 0 : g.nomFichier,
890
+ class: "h-100 w-100"
891
+ }, null, 8, at)
892
+ ]),
893
+ o("div", rt, [
894
+ o("button", {
895
+ type: "button",
896
+ class: "btn btn-primary mx-1",
897
+ onClick: e[3] || (e[3] = (S) => l.changeIndex(0))
898
+ }, [
899
+ b(c, {
900
+ icon: "fa-arrow-left",
901
+ size: "lg"
902
+ })
903
+ ]),
904
+ o("button", {
905
+ type: "button",
906
+ class: "btn btn-primary mx-1",
907
+ onClick: e[4] || (e[4] = (S) => l.changeIndex(1))
908
+ }, [
909
+ b(c, {
910
+ icon: "fa-arrow-right",
911
+ size: "lg"
912
+ })
913
+ ]),
914
+ o("button", {
915
+ type: "button",
916
+ class: "btn btn-danger ms-auto",
917
+ onClick: e[5] || (e[5] = (...S) => l.deleteImage && l.deleteImage(...S))
918
+ }, [
919
+ b(c, {
920
+ icon: "fa-trash",
921
+ size: "lg"
922
+ })
923
+ ])
924
+ ])
925
+ ])
926
+ ];
927
+ }),
928
+ _: 1
929
+ }, 8, ["onClose"])) : h("", !0)
930
+ ]);
931
+ }
932
+ const Ys = /* @__PURE__ */ v(Qe, [["render", dt]]);
933
+ function ct(s, e, t = !1, u = !1) {
934
+ return s && s.sort((i, l) => {
935
+ const c = new RegExp("(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)?$");
936
+ if (c.test(i[e]) && c.test(l[e]))
937
+ switch (i[e].replace(/\d+/g, (g) => +g + 1e5).localeCompare(l[e].replace(/\d+/g, (g) => +g + 1e5))) {
938
+ case 1:
939
+ return t ? 1 : -1;
940
+ case -1:
941
+ return t ? -1 : 1;
942
+ case 0:
943
+ return 0;
944
+ default:
945
+ return 0;
946
+ }
947
+ if (!isNaN(i[e]) && !isNaN(l[e]))
948
+ return t ? parseFloat(i[e]) - parseFloat(l[e]) : parseFloat(l[e]) - parseFloat(i[e]);
949
+ if (!i[e] && l[e])
950
+ return t ? u ? 1 : -1 : u ? -1 : 1;
951
+ if (i[e] && !l[e])
952
+ return t ? u ? -1 : 1 : u ? 1 : -1;
953
+ if (!i[e] && !l[e])
954
+ return 0;
955
+ if (P(i[e], "DD/MM/YYYY").isValid() || P(l[e], "DD/MM/YYYY").isValid())
956
+ return t ? P(i[e], "DD/MM/YYYY").unix() - P(l[e], "DD/MM/YYYY").unix() : P(l[e], "DD/MM/YYYY").unix() - P(i[e], "DD/MM/YYYY").unix();
957
+ let d = (typeof i[e] == "string" || typeof l[e] == "string") && i[e] ? i[e].toString().toLowerCase() : i[e], m = (typeof i[e] == "string" || typeof l[e] == "string") && l[e] ? l[e].toString().toLowerCase() : l[e];
958
+ return d > m ? t ? 1 : -1 : m > d ? t ? -1 : 1 : 0;
959
+ });
960
+ }
961
+ function L(s, e = !0) {
962
+ if (!s) return null;
963
+ let t = s.toString().normalize("NFD").replace(/[\u0300-\u036f]/g, "");
964
+ return e ? t.toLowerCase() : t;
965
+ }
966
+ function Y(s, e = "DD/MM/YYYY") {
967
+ return P.unix(s).isValid() ? P.unix(s).format(e) : s;
968
+ }
969
+ function U(s, e) {
970
+ let t = F(s);
971
+ if (!t)
972
+ t = {
973
+ columns: e
974
+ };
975
+ else if (!t.columns)
976
+ t.columns = e;
977
+ else {
978
+ let u = e.filter(function(l) {
979
+ return !t.columns.some(function(c) {
980
+ return c.id === l.id;
981
+ });
982
+ });
983
+ t.columns = t.columns.concat(u);
984
+ let i = t.columns.filter(function(l) {
985
+ return !e.some(function(c) {
986
+ return l.id === c.id;
987
+ });
988
+ });
989
+ t.columns = t.columns.filter(function(l) {
990
+ return !i.some(function(c) {
991
+ return l.id === c.id;
992
+ });
993
+ }), t.columns.filter((l) => {
994
+ for (let c of e)
995
+ c.id === l.id && c.libelle !== l.libelle && (l.libelle = c.libelle);
996
+ });
997
+ }
998
+ T(s, t);
999
+ }
1000
+ function ut(s, e, t = null) {
1001
+ let u = F(s);
1002
+ u ? t && !u[t] && (u[t] = e) : t ? (u = {}, u[t] = e) : u = e, T(s, u);
1003
+ }
1004
+ function F(s) {
1005
+ return JSON.parse(window.localStorage.getItem(s));
1006
+ }
1007
+ function T(s, e, t = null) {
1008
+ let u = F(s);
1009
+ return t ? u[t] = e : u = e, window.localStorage.setItem(s, JSON.stringify(u));
1010
+ }
1011
+ M.add(q, K, te, se, R, le);
1012
+ const mt = {
1013
+ name: "TableDraggableComponent",
1014
+ components: { VueDraggableNext: we, FontAwesomeIcon: D },
1015
+ props: {
1016
+ defaultColumns: {
1017
+ type: Array,
1018
+ require: !0,
1019
+ default: null
1020
+ },
1021
+ localStorageItemName: {
1022
+ type: String,
1023
+ default: null
1024
+ },
1025
+ tdItemsList: {
1026
+ type: [Array, Object],
1027
+ require: !0,
1028
+ default: null
1029
+ },
1030
+ search: {
1031
+ type: String,
1032
+ default: null
1033
+ },
1034
+ pickedDate: {
1035
+ type: Array,
1036
+ default: null
1037
+ },
1038
+ columnNameDateFilter: {
1039
+ type: Array,
1040
+ default: null
1041
+ },
1042
+ maxItemPerPage: {
1043
+ type: Number,
1044
+ default: 10
1045
+ },
1046
+ clickable: {
1047
+ type: Boolean,
1048
+ default: !1
1049
+ },
1050
+ showModifyColumnsBtn: {
1051
+ type: Boolean,
1052
+ default: !1
1053
+ },
1054
+ ghostClass: {
1055
+ type: String,
1056
+ default: "bg-success"
1057
+ },
1058
+ lineEditMode: {
1059
+ type: Boolean,
1060
+ default: !1
1061
+ }
1062
+ },
1063
+ emits: ["changeSubject", "updateSelectedItems", "lineEditModeAddNewLine", "lineEditModeDeleteLine"],
1064
+ data() {
1065
+ return {
1066
+ checkAllCheckBox: !1,
1067
+ sortKey: null,
1068
+ sortAsc: !1,
1069
+ currentPage: 1,
1070
+ selectedItems: [],
1071
+ currentHeaderSort: null,
1072
+ headerEditMode: !1,
1073
+ totalPages: null,
1074
+ // Default values
1075
+ columns: this.copyDefaultColumns(),
1076
+ maxItemsPerPage: this.getDefaultMaxItemPerPage(),
1077
+ forceTableUpdateIndex: 0
1078
+ };
1079
+ },
1080
+ computed: {
1081
+ currentDisplayPagination() {
1082
+ let s = [];
1083
+ return this.totalPages <= 1 ? s : (this.currentPage === 1 ? s = [1, 2, 3] : this.currentPage === this.totalPages ? s = [this.totalPages - 2, this.totalPages - 1, this.totalPages] : s = [this.currentPage - 1, this.currentPage, this.currentPage + 1], s.filter((e) => e >= 1 && e <= this.totalPages));
1084
+ },
1085
+ items() {
1086
+ return this.tdItemsList ? this.tdItemsList : [];
1087
+ },
1088
+ filtereditems() {
1089
+ if (!this.items) return this.items;
1090
+ let s = L(this.search), e, t;
1091
+ return this.pickedDate && this.pickedDate[0] && this.pickedDate[1] && (e = P(this.pickedDate[0]).set({ hour: 0, minute: 0 }).unix(), t = P(this.pickedDate[1]).set({ hour: 23, minute: 59 }).unix()), this.items.filter((u) => {
1092
+ let i = this.filterBy(u, s);
1093
+ if (e && t && this.columnNameDateFilter && this.columnNameDateFilter.length > 0 && this.columnNameDateFilter.some((c) => {
1094
+ const d = this.columns.find((m) => m.id === c);
1095
+ return d && d.show === !0;
1096
+ })) {
1097
+ let c = this.columnNameDateFilter.some((d) => {
1098
+ const m = this.columns.find((a) => a.id === d);
1099
+ if (u[d] && m.show === !0) {
1100
+ let a = parseInt(u[d]);
1101
+ return a >= e && a <= t;
1102
+ }
1103
+ return !1;
1104
+ });
1105
+ return i && c;
1106
+ }
1107
+ return i;
1108
+ });
1109
+ },
1110
+ showeditems() {
1111
+ const s = this.filtereditems.slice((this.currentPage - 1) * this.maxItemsPerPage, this.currentPage * this.maxItemsPerPage);
1112
+ return !this.sortKey || !this.filtereditems ? s : ct(s, this.sortKey, this.sortAsc);
1113
+ }
1114
+ },
1115
+ watch: {
1116
+ headerEditMode(s) {
1117
+ s ? this.maxItemsPerPage = 5 : this.maxItemsPerPage = this.getDefaultMaxItemPerPage();
1118
+ },
1119
+ filtereditems: function(s) {
1120
+ this.currentPage = 1, this.totalPages = this.newTotalPage(s.length);
1121
+ },
1122
+ maxItemPerPage: function(s) {
1123
+ this.maxItemsPerPage = s, this.localStorageItemName !== null && T(this.localStorageItemName, s, "maxItemPerPage"), this.currentPage = 1, this.totalPages = this.newTotalPage(this.filtereditems.length);
1124
+ },
1125
+ columns: function(s) {
1126
+ this.localStorageItemName !== null && T(this.localStorageItemName, s, "columns"), this.forceTableUpdateIndex += 1;
1127
+ },
1128
+ showeditems: function() {
1129
+ this.checkAllCheckBox = this.showeditems.every((s) => this.selectedItems.includes(s.id));
1130
+ }
1131
+ },
1132
+ mounted() {
1133
+ if (this.localStorageItemName !== null) {
1134
+ U(this.localStorageItemName, this.columns), ut(this.localStorageItemName, this.maxItemPerPage, "maxItemPerPage");
1135
+ let s = F(this.localStorageItemName);
1136
+ this.maxItemsPerPage = s.maxItemPerPage, this.columns = s.columns;
1137
+ }
1138
+ this.totalPages = this.newTotalPage(this.filtereditems.length);
1139
+ },
1140
+ methods: {
1141
+ unixToDateString: Y,
1142
+ newTotalPage(s) {
1143
+ return Math.ceil(s / this.maxItemsPerPage);
1144
+ },
1145
+ lineStateClass(s) {
1146
+ return s === "add" ? "addLineState text-success" : s === "delete" ? "deleteLineState text-danger" : s === "update" ? "updateLineState text-warning" : "";
1147
+ },
1148
+ checkItem(s) {
1149
+ this.selectedItems.includes(s) ? this.selectedItems = this.selectedItems.filter((e) => e !== s) : this.selectedItems.push(s), this.checkAllCheckBox ? this.checkAllCheckBox = !1 : this.showeditems.every((e) => this.selectedItems.includes(e.id)) && (this.checkAllCheckBox = !0), this.$emit("updateSelectedItems", this.selectedItems);
1150
+ },
1151
+ toggleAllCheckBox() {
1152
+ const s = this.showeditems.map((e) => e.id);
1153
+ this.checkAllCheckBox ? (this.selectedItems = this.selectedItems.filter((e) => !s.includes(e)), this.checkAllCheckBox = !1) : (this.selectedItems = [.../* @__PURE__ */ new Set([...this.selectedItems, ...s])], this.checkAllCheckBox = !0), this.$emit("updateSelectedItems", this.selectedItems);
1154
+ },
1155
+ updateCurrentSort(s) {
1156
+ this.currentHeaderSort && (this.currentHeaderSort.isSorted = !1), s.isSorted = !0, this.currentHeaderSort = s, this.updateSortitems(s.id);
1157
+ },
1158
+ checkMove(s) {
1159
+ return s.draggedContext.index !== 0 && s.relatedContext.index !== 0;
1160
+ },
1161
+ filterBy(s, e) {
1162
+ for (const t of this.columns) {
1163
+ if (t.show && s[t.id] && L(s[t.id]).includes(e))
1164
+ return !0;
1165
+ if (t.show && t.id.startsWith("date") && s[t.id] && L(Y(s[t.id])).includes(e))
1166
+ return !0;
1167
+ }
1168
+ return !e;
1169
+ },
1170
+ getDefaultMaxItemPerPage() {
1171
+ return this.maxItemPerPage;
1172
+ },
1173
+ copyDefaultColumns() {
1174
+ return JSON.parse(JSON.stringify(this.defaultColumns));
1175
+ },
1176
+ updateSortitems(s) {
1177
+ if (!this.items) return this.items;
1178
+ this.sortKey === s ? this.sortAsc = !this.sortAsc : this.sortAsc = !0, this.sortKey = s, this.$forceUpdate();
1179
+ },
1180
+ selectSubject(s) {
1181
+ this.$emit("changeSubject", s);
1182
+ },
1183
+ saveTablePreferences() {
1184
+ this.localStorageItemName !== null && T(this.localStorageItemName, this.columns, "columns"), this.headerEditMode = !1;
1185
+ },
1186
+ resetTablePreferences() {
1187
+ this.columns = this.copyDefaultColumns(), this.localStorageItemName !== null && U(this.localStorageItemName, this.columns), this.headerEditMode = !1;
1188
+ },
1189
+ editTablePreferences() {
1190
+ this.headerEditMode = !0;
1191
+ }
1192
+ }
1193
+ }, ft = {
1194
+ key: 0,
1195
+ class: "my-3 text-center"
1196
+ }, ht = { class: "row mb-3 overflow-x-auto" }, gt = { class: "col-12" }, pt = {
1197
+ key: 1,
1198
+ class: "bg-secondary",
1199
+ scope: "col"
1200
+ }, yt = {
1201
+ key: 0,
1202
+ class: "position-absolute start-50 translate-middle",
1203
+ style: { top: "25px" }
1204
+ }, bt = { class: "d-inline-flex text-nowrap" }, St = { class: "my-auto" }, xt = {
1205
+ key: 0,
1206
+ class: "ms-2 float-end"
1207
+ }, kt = { key: 0 }, wt = ["colspan"], Ct = ["onClick"], _t = ["onClick"], vt = ["id", "value"], Pt = ["onClick"], It = { class: "row mb-2" }, Dt = {
1208
+ key: 0,
1209
+ class: "col"
1210
+ }, Mt = { class: "m-0 pagination pagination-sm" }, Bt = { class: "page-item hoverable" }, At = { class: "page-item hoverable" }, Tt = ["onClick"], zt = { class: "page-item hoverable" }, Ft = { class: "page-item hoverable" }, Lt = {
1211
+ key: 1,
1212
+ class: "col d-flex justify-content-end"
1213
+ }, Nt = { class: "d-flex mb-1" }, jt = {
1214
+ key: 0,
1215
+ class: "d-flex"
1216
+ };
1217
+ function qt(s, e, t, u, i, l) {
1218
+ var m;
1219
+ const c = x("font-awesome-icon"), d = x("vue-draggable-next");
1220
+ return n(), r(y, null, [
1221
+ t.lineEditMode ? (n(), r("div", ft, [
1222
+ o("button", {
1223
+ type: "button",
1224
+ class: "btn btn-success rounded-5 m-0 p-0",
1225
+ style: { height: "45px", width: "45px" },
1226
+ onClick: e[0] || (e[0] = (a) => s.$emit("lineEditModeAddNewLine"))
1227
+ }, [
1228
+ b(c, {
1229
+ icon: "fa-solid fa-plus",
1230
+ size: "xl"
1231
+ })
1232
+ ])
1233
+ ])) : h("", !0),
1234
+ o("div", ht, [
1235
+ o("div", gt, [
1236
+ (n(), r("table", {
1237
+ id: "table-draggable",
1238
+ key: i.forceTableUpdateIndex,
1239
+ class: "table table-striped table-hover table-responsive overflow-hidden table-bordered align-middle border-1 border-top border-bottom",
1240
+ style: { "border-radius": "10px !important", "border-collapse": "separate", "border-spacing": "0" }
1241
+ }, [
1242
+ o("thead", null, [
1243
+ b(d, {
1244
+ modelValue: i.columns,
1245
+ "onUpdate:modelValue": e[4] || (e[4] = (a) => i.columns = a),
1246
+ "ghost-class": t.ghostClass,
1247
+ "drag-class": t.ghostClass,
1248
+ tag: "tr",
1249
+ move: l.checkMove,
1250
+ group: "columns"
1251
+ }, {
1252
+ default: z(() => [
1253
+ (n(!0), r(y, null, C(i.columns, (a) => (n(), r(y, {
1254
+ key: a.id
1255
+ }, [
1256
+ a.id === "checkBox" ? (n(), r("th", {
1257
+ key: 0,
1258
+ class: "text-center bg-secondary",
1259
+ scope: "col",
1260
+ onClick: e[3] || (e[3] = w((...g) => l.toggleAllCheckBox && l.toggleAllCheckBox(...g), ["stop"]))
1261
+ }, [
1262
+ N(o("input", {
1263
+ id: "checkBoxSelectAll",
1264
+ "onUpdate:modelValue": e[1] || (e[1] = (g) => i.checkAllCheckBox = g),
1265
+ class: "form-check-input",
1266
+ type: "checkbox",
1267
+ onClick: e[2] || (e[2] = w((...g) => l.toggleAllCheckBox && l.toggleAllCheckBox(...g), ["stop"]))
1268
+ }, null, 512), [
1269
+ [E, i.checkAllCheckBox]
1270
+ ])
1271
+ ])) : a.id === "deleteButton" && t.lineEditMode ? (n(), r("th", pt)) : a.show || i.headerEditMode ? (n(), r("th", {
1272
+ key: 2,
1273
+ scope: "col",
1274
+ class: f(["text-white bg-secondary hoverable position-relative text-center", [
1275
+ {
1276
+ "table-danger": !a.show,
1277
+ "pt-5": i.headerEditMode
1278
+ }
1279
+ ]])
1280
+ }, [
1281
+ i.headerEditMode ? (n(), r("div", yt, [
1282
+ a.show ? (n(), k(c, {
1283
+ key: 0,
1284
+ icon: "fa-solid fa-eye",
1285
+ class: "fa-xl",
1286
+ onClick: (g) => a.show = !1
1287
+ }, null, 8, ["onClick"])) : (n(), k(c, {
1288
+ key: 1,
1289
+ icon: "fa-solid fa-eye-slash",
1290
+ class: "fa-xl",
1291
+ onClick: (g) => a.show = !0
1292
+ }, null, 8, ["onClick"]))
1293
+ ])) : h("", !0),
1294
+ o("div", bt, [
1295
+ o("span", St, p(a.libelle), 1),
1296
+ a.isSortable ? (n(), r("div", xt, [
1297
+ b(c, {
1298
+ icon: i.sortKey !== a.id || i.sortKey === a.id && !i.sortAsc ? "fa-solid fa-arrow-down-wide-short" : "fa-solid fa-arrow-up-short-wide",
1299
+ onClick: (g) => l.updateCurrentSort(a)
1300
+ }, null, 8, ["icon", "onClick"])
1301
+ ])) : h("", !0)
1302
+ ])
1303
+ ], 2)) : h("", !0)
1304
+ ], 64))), 128))
1305
+ ]),
1306
+ _: 1
1307
+ }, 8, ["modelValue", "ghost-class", "drag-class", "move"])
1308
+ ]),
1309
+ o("tbody", null, [
1310
+ ((m = l.showeditems) == null ? void 0 : m.length) === 0 ? (n(), r("tr", kt, [
1311
+ o("th", {
1312
+ colspan: i.columns.length,
1313
+ class: "text-center"
1314
+ }, [...e[14] || (e[14] = [
1315
+ o("span", { class: "text-danger fs-5" }, "Aucune valeur", -1)
1316
+ ])], 8, wt)
1317
+ ])) : (n(!0), r(y, { key: 1 }, C(l.showeditems, (a, g) => (n(), r("tr", {
1318
+ key: a.id,
1319
+ class: f({ hoverable: t.clickable }),
1320
+ onClick: (S) => t.clickable ? l.selectSubject(a) : null
1321
+ }, [
1322
+ (n(!0), r(y, null, C(i.columns, (S) => (n(), r(y, {
1323
+ key: S.id
1324
+ }, [
1325
+ S.id === "checkBox" ? (n(), r("td", {
1326
+ key: 0,
1327
+ class: f(["text-center", [a.lineState ? l.lineStateClass(a.lineState) : ""]]),
1328
+ onClick: w((B) => l.checkItem(a.id), ["stop"])
1329
+ }, [
1330
+ N(o("input", {
1331
+ id: `checkbox-${g}`,
1332
+ "onUpdate:modelValue": e[5] || (e[5] = (B) => i.selectedItems = B),
1333
+ type: "checkbox",
1334
+ class: "form-check-input hoverable",
1335
+ value: a.id,
1336
+ onClick: e[6] || (e[6] = w(() => {
1337
+ }, ["stop"]))
1338
+ }, null, 8, vt), [
1339
+ [E, i.selectedItems]
1340
+ ])
1341
+ ], 10, _t)) : S.id === "deleteButton" && t.lineEditMode ? (n(), r("td", {
1342
+ key: 1,
1343
+ class: f([[a.lineState ? l.lineStateClass(a.lineState) : ""], "text-center py-0"])
1344
+ }, [
1345
+ o("button", {
1346
+ type: "button",
1347
+ class: "btn btn-danger",
1348
+ onClick: (B) => s.$emit("lineEditModeDeleteLine", a.id)
1349
+ }, [
1350
+ b(c, {
1351
+ icon: "fa-solid fa-trash",
1352
+ size: "lg"
1353
+ })
1354
+ ], 8, Pt)
1355
+ ], 2)) : S.show || i.headerEditMode ? (n(), r("td", {
1356
+ key: 2,
1357
+ class: f([[S.show ? "" : "table-danger", S.isSorted ? "bg-gray-200" : "", a.lineState ? l.lineStateClass(a.lineState) : ""], "text-center text-nowrap"])
1358
+ }, [
1359
+ I(s.$slots, "tableBodyTd", {
1360
+ header: S,
1361
+ item: a
1362
+ }, void 0, !0)
1363
+ ], 2)) : h("", !0)
1364
+ ], 64))), 128))
1365
+ ], 10, Ct))), 128))
1366
+ ])
1367
+ ]))
1368
+ ])
1369
+ ]),
1370
+ o("div", It, [
1371
+ i.totalPages && i.totalPages > 1 ? (n(), r("div", Dt, [
1372
+ o("ul", Mt, [
1373
+ o("li", Bt, [
1374
+ o("a", {
1375
+ class: f(["page-link", { disabled: i.currentPage === 1 }]),
1376
+ onClick: e[7] || (e[7] = (a) => i.currentPage = 1)
1377
+ }, " « ", 2)
1378
+ ]),
1379
+ o("li", At, [
1380
+ o("a", {
1381
+ class: f(["page-link", { disabled: i.currentPage === 1 }]),
1382
+ onClick: e[8] || (e[8] = (a) => i.currentPage -= 1)
1383
+ }, " < ", 2)
1384
+ ]),
1385
+ (n(!0), r(y, null, C(l.currentDisplayPagination, (a) => (n(), r("li", {
1386
+ key: a,
1387
+ class: f(["page-item hoverable", { active: i.currentPage === a }])
1388
+ }, [
1389
+ o("a", {
1390
+ class: "page-link",
1391
+ onClick: (g) => i.currentPage = a
1392
+ }, p(a), 9, Tt)
1393
+ ], 2))), 128)),
1394
+ o("li", zt, [
1395
+ o("a", {
1396
+ class: f(["page-link", { disabled: i.currentPage === i.totalPages }]),
1397
+ onClick: e[9] || (e[9] = (a) => i.currentPage += 1)
1398
+ }, " > ", 2)
1399
+ ]),
1400
+ o("li", Ft, [
1401
+ o("a", {
1402
+ class: f(["page-link", { disabled: i.currentPage === i.totalPages }]),
1403
+ onClick: e[10] || (e[10] = (a) => i.currentPage = i.totalPages)
1404
+ }, " » ", 2)
1405
+ ])
1406
+ ])
1407
+ ])) : h("", !0),
1408
+ t.showModifyColumnsBtn ? (n(), r("div", Lt, [
1409
+ o("div", Nt, [
1410
+ i.headerEditMode ? (n(), r("div", jt, [
1411
+ o("button", {
1412
+ id: "btn-save-table",
1413
+ class: "btn btn-sm btn-success d-flex justify-content-center align-items-center ms-auto me-2",
1414
+ type: "button",
1415
+ onClick: e[11] || (e[11] = (...a) => l.saveTablePreferences && l.saveTablePreferences(...a))
1416
+ }, " Sauvegarder "),
1417
+ o("button", {
1418
+ id: "btn-reset-table",
1419
+ class: "btn btn-sm btn-outline-danger d-flex justify-content-center align-items-center",
1420
+ type: "button",
1421
+ onClick: e[12] || (e[12] = (...a) => l.resetTablePreferences && l.resetTablePreferences(...a))
1422
+ }, " Réinitialiser le tableau ")
1423
+ ])) : (n(), r("button", {
1424
+ key: 1,
1425
+ id: "btn-edit-table",
1426
+ class: "btn btn-sm btn-outline-secondary d-flex justify-content-center align-items-center fs-7 p-1 rounded-3",
1427
+ type: "button",
1428
+ onClick: e[13] || (e[13] = (...a) => l.editTablePreferences && l.editTablePreferences(...a))
1429
+ }, " Modifier colonnes "))
1430
+ ])
1431
+ ])) : h("", !0)
1432
+ ])
1433
+ ], 64);
1434
+ }
1435
+ const Us = /* @__PURE__ */ v(mt, [["render", qt], ["__scopeId", "data-v-6b16b420"]]);
1436
+ M.add(ie, ne, oe, ae);
1437
+ const Vt = {
1438
+ name: "AmsomPagination",
1439
+ components: {
1440
+ FontAwesomeIcon: D
1441
+ },
1442
+ props: {
1443
+ modelValue: {
1444
+ type: Number,
1445
+ required: !0
1446
+ },
1447
+ totalPages: {
1448
+ type: Number,
1449
+ required: !0
1450
+ },
1451
+ totalDisplayPages: {
1452
+ type: Number,
1453
+ default: 5
1454
+ }
1455
+ },
1456
+ emits: ["update:modelValue"],
1457
+ methods: {
1458
+ goNextPage() {
1459
+ this.goToPage(this.modelValue + 1);
1460
+ },
1461
+ goPreviousPage() {
1462
+ this.goToPage(this.modelValue - 1);
1463
+ },
1464
+ goFirstPage() {
1465
+ this.goToPage(1);
1466
+ },
1467
+ goLastPage() {
1468
+ this.goToPage(this.totalPages);
1469
+ },
1470
+ goToPage(s) {
1471
+ this.$emit("update:modelValue", s);
1472
+ }
1473
+ },
1474
+ computed: {
1475
+ toDisplayPagination() {
1476
+ let s = [];
1477
+ if (this.totalPages <= this.totalDisplayPages)
1478
+ s = this.totalPages;
1479
+ else {
1480
+ let e, t;
1481
+ this.totalDisplayPages % 2 === 0 ? (e = this.modelValue - Math.floor(this.totalDisplayPages / 2) + 1, t = this.modelValue + Math.floor(this.totalDisplayPages / 2)) : (e = this.modelValue - Math.floor(this.totalDisplayPages / 2), t = this.modelValue + Math.floor(this.totalDisplayPages / 2)), e < 1 && (e = 1, t = this.totalDisplayPages), t > this.totalPages && (t = this.totalPages, e = this.totalPages - this.totalDisplayPages + 1);
1482
+ for (let u = e; u <= t; u++)
1483
+ s.push(u);
1484
+ }
1485
+ return s;
1486
+ }
1487
+ }
1488
+ }, Et = {
1489
+ key: 0,
1490
+ class: "w-100 user-select-none"
1491
+ }, Ht = { class: "pagination pagination mb-0" }, Ot = { class: "page-item" }, Yt = { class: "page-item" }, Ut = ["onClick"], Wt = { class: "page-item" }, Rt = { class: "page-item" };
1492
+ function Kt(s, e, t, u, i, l) {
1493
+ const c = x("font-awesome-icon");
1494
+ return t.totalPages && t.totalPages > 1 ? (n(), r("div", Et, [
1495
+ o("ul", Ht, [
1496
+ o("li", Ot, [
1497
+ o("span", {
1498
+ role: "button",
1499
+ class: f(["page-link", { disabled: t.modelValue === 1 }]),
1500
+ onClick: e[0] || (e[0] = (...d) => l.goFirstPage && l.goFirstPage(...d))
1501
+ }, [
1502
+ b(c, { icon: "fa-angles-left" })
1503
+ ], 2)
1504
+ ]),
1505
+ o("li", Yt, [
1506
+ o("span", {
1507
+ role: "button",
1508
+ class: f(["page-link", { disabled: t.modelValue === 1 }]),
1509
+ onClick: e[1] || (e[1] = (...d) => l.goPreviousPage && l.goPreviousPage(...d))
1510
+ }, [
1511
+ b(c, { icon: "fa-angle-left" })
1512
+ ], 2)
1513
+ ]),
1514
+ (n(!0), r(y, null, C(l.toDisplayPagination, (d) => (n(), r("li", {
1515
+ key: d,
1516
+ class: f(["page-item", { active: t.modelValue === d }])
1517
+ }, [
1518
+ o("span", {
1519
+ role: "button",
1520
+ class: "page-link",
1521
+ onClick: (m) => l.goToPage(d)
1522
+ }, p(d), 9, Ut)
1523
+ ], 2))), 128)),
1524
+ o("li", Wt, [
1525
+ o("span", {
1526
+ role: "button",
1527
+ class: f(["page-link", { disabled: t.modelValue === t.totalPages }]),
1528
+ onClick: e[2] || (e[2] = (...d) => l.goNextPage && l.goNextPage(...d))
1529
+ }, [
1530
+ b(c, { icon: "fa-angle-right" })
1531
+ ], 2)
1532
+ ]),
1533
+ o("li", Rt, [
1534
+ o("span", {
1535
+ role: "button",
1536
+ class: f(["page-link", { disabled: t.modelValue === t.totalPages }]),
1537
+ onClick: e[3] || (e[3] = (...d) => l.goLastPage && l.goLastPage(...d))
1538
+ }, [
1539
+ b(c, { icon: "fa-angles-right" })
1540
+ ], 2)
1541
+ ])
1542
+ ])
1543
+ ])) : h("", !0);
1544
+ }
1545
+ const Ws = /* @__PURE__ */ v(Vt, [["render", Kt]]), Gt = {
1546
+ name: "AmsomSkeleton",
1547
+ props: {
1548
+ /**
1549
+ * @type {Array}
1550
+ * @description Nombre et taille (col-*) des placeholders
1551
+ * @default [8, 10, 12]
1552
+ */
1553
+ config: {
1554
+ type: Array,
1555
+ default: () => [8, 10, 12]
1556
+ },
1557
+ rowClass: {
1558
+ type: String,
1559
+ default: ""
1560
+ },
1561
+ loaderClass: {
1562
+ type: String,
1563
+ default: "text-gray rounded-2"
1564
+ }
1565
+ }
1566
+ };
1567
+ function Jt(s, e, t, u, i, l) {
1568
+ return n(), r("div", {
1569
+ class: f(["container row placeholder-wave", t.rowClass])
1570
+ }, [
1571
+ (n(!0), r(y, null, C(t.config, (c, d) => (n(), r("div", {
1572
+ key: d,
1573
+ class: f(["placeholder mt-1", [t.loaderClass, "col-" + c]])
1574
+ }, null, 2))), 128))
1575
+ ], 2);
1576
+ }
1577
+ const Zt = /* @__PURE__ */ v(Gt, [["render", Jt]]);
1578
+ M.add(re, q);
1579
+ const Qt = {
1580
+ name: "AmsomDocumentList",
1581
+ components: {
1582
+ AmsomSkeleton: Zt,
1583
+ AmsomOverlay: Z,
1584
+ AmsomCard: Ve,
1585
+ FontAwesomeIcon: D
1586
+ },
1587
+ props: {
1588
+ title: {
1589
+ type: String,
1590
+ default: "Mes documents"
1591
+ },
1592
+ loading: {
1593
+ type: Boolean,
1594
+ default: !1
1595
+ },
1596
+ documentList: {
1597
+ type: Array,
1598
+ required: !0,
1599
+ validator: (s) => s.every((e) => e.categorie && e.dateFichier)
1600
+ },
1601
+ anonym: {
1602
+ type: Boolean,
1603
+ default: !1
1604
+ },
1605
+ getDocumentBlob: {
1606
+ type: Function,
1607
+ required: !0
1608
+ },
1609
+ clickAction: {
1610
+ type: String,
1611
+ default: "download",
1612
+ validator: (s) => ["download", "view"].includes(s)
1613
+ }
1614
+ },
1615
+ data() {
1616
+ return {
1617
+ processing: !1
1618
+ };
1619
+ },
1620
+ methods: {
1621
+ unixToDateString: Ce,
1622
+ handleClick(s, e) {
1623
+ this.clickAction === "download" ? this.downloadFile(s, e) : this.viewFile(s);
1624
+ },
1625
+ async downloadFile(s, e) {
1626
+ this.processing = !0;
1627
+ let t = this.anonym ? "Document " + (e + 1) : (s == null ? void 0 : s.titre) ?? "Document", u = await this.getDocumentBlob(s);
1628
+ be(u, t), this.processing = !1;
1629
+ },
1630
+ async viewFile(s) {
1631
+ this.processing = !0;
1632
+ let e = await this.getDocumentBlob(s);
1633
+ ye(e), this.processing = !1;
1634
+ }
1635
+ }
1636
+ }, Xt = { key: 0 }, $t = { class: "d-flex justify-content-between text-primary" }, es = { class: "mb-0" }, ts = { class: "mb-0" }, ss = ["onClick"], ls = {
1637
+ role: "button",
1638
+ class: "d-flex justify-content-between align-items-center p-2 px-3 text-secondary"
1639
+ }, is = { key: 0 }, ns = { key: 1 };
1640
+ function os(s, e, t, u, i, l) {
1641
+ const c = x("amsom-skeleton"), d = x("font-awesome-icon"), m = x("amsom-card"), a = x("amsom-overlay");
1642
+ return n(), k(a, { loading: i.processing }, {
1643
+ default: z(() => [
1644
+ b(m, null, {
1645
+ default: z(() => {
1646
+ var g;
1647
+ return [
1648
+ o("h5", null, p(t.title), 1),
1649
+ t.loading ? (n(), r(y, { key: 0 }, [
1650
+ b(c, {
1651
+ config: [3, 3],
1652
+ "row-class": "justify-content-between"
1653
+ }),
1654
+ b(c, { config: [12] })
1655
+ ], 64)) : (n(), r(y, { key: 1 }, [
1656
+ (g = t.documentList) != null && g.length ? (n(!0), r(y, { key: 1 }, C(t.documentList, (S, B) => (n(), r("div", {
1657
+ key: B,
1658
+ class: "document-item pt-2"
1659
+ }, [
1660
+ o("div", $t, [
1661
+ o("p", es, p(S.categorie), 1),
1662
+ o("p", ts, p(l.unixToDateString(S.dateFichier)), 1)
1663
+ ]),
1664
+ o("div", {
1665
+ class: "bg-primary bg-opacity-25 mt-0 rounded-3",
1666
+ onClick: (As) => l.handleClick(S, B)
1667
+ }, [
1668
+ o("div", ls, [
1669
+ t.anonym ? (n(), r("strong", ns, "Document " + p(B + 1), 1)) : (n(), r("strong", is, p(S.titre), 1)),
1670
+ t.clickAction === "download" ? (n(), k(d, {
1671
+ key: 2,
1672
+ icon: "fa-solid fa-cloud-arrow-down"
1673
+ })) : t.clickAction === "view" ? (n(), k(d, {
1674
+ key: 3,
1675
+ icon: "fa-solid fa-eye"
1676
+ })) : h("", !0)
1677
+ ])
1678
+ ], 8, ss)
1679
+ ]))), 128)) : (n(), r("div", Xt, [...e[0] || (e[0] = [
1680
+ o("p", null, "Aucun document", -1)
1681
+ ])]))
1682
+ ], 64))
1683
+ ];
1684
+ }),
1685
+ _: 1
1686
+ })
1687
+ ]),
1688
+ _: 1
1689
+ }, 8, ["loading"]);
1690
+ }
1691
+ const Rs = /* @__PURE__ */ v(Qt, [["render", os]]);
1692
+ M.add(de, q, K, ce, ue, me);
1693
+ const as = window.File_native ?? window.File, rs = {
1694
+ name: "AmsomUploadFile",
1695
+ components: { FontAwesomeIcon: D, AmsomOverlay: Z },
1696
+ props: ["name", "pjName", "fileName", "subText", "title", "required", "label", "modelValue", "gedFile", "readStatus", "readOnly", "rejectStatus", "clickFileHandler"],
1697
+ /*
1698
+ * name: Nom technique de la pj
1699
+ * pjName: Nom de la Pj à afficher pour l'utilisateur
1700
+ * fileName : Nom du fichier
1701
+ * subText: indication complémentaire pour l'utilisateur
1702
+ * title : Titre qui s'affiche au dessus de la pj lorsqu'elle est renseignée
1703
+ * required: Indique si la pj est obligatoire
1704
+ * label: Label du champ
1705
+ */
1706
+ data() {
1707
+ return {
1708
+ fileToUpload: [],
1709
+ fileLoading: !1,
1710
+ finalFile: null,
1711
+ fileDragged: !1
1712
+ };
1713
+ },
1714
+ computed: {},
1715
+ watch: {
1716
+ gedFile: function() {
1717
+ this.handleGedFile();
1718
+ },
1719
+ fileName: function(s) {
1720
+ this.finalFile !== null && (this.finalFile.name = s, this.emitFile());
1721
+ }
1722
+ },
1723
+ mounted() {
1724
+ var s;
1725
+ (s = this.modelValue) != null && s.file ? this.finalFile = this.modelValue : this.gedFile && this.handleGedFile();
1726
+ },
1727
+ //todo a voir avec antoine
1728
+ // unmounted() {
1729
+ // this.deletePj()
1730
+ // },
1731
+ methods: {
1732
+ clickAddPj() {
1733
+ document.getElementById("fileUpload-" + this.name).click();
1734
+ },
1735
+ handleGedFile() {
1736
+ this.fileToUpload = [this.gedFile], this.uploadImage();
1737
+ },
1738
+ async addPj(s) {
1739
+ this.fileDragged = !1;
1740
+ const e = s.dataTransfer ? [...s.dataTransfer.files] : [...s.target.files];
1741
+ let t = !0;
1742
+ for (let u of e)
1743
+ if (!await j(u) && !await ke(u)) {
1744
+ t = !1;
1745
+ break;
1746
+ }
1747
+ if (!t) {
1748
+ alert("Les documents doivent être de type PDF et/ou des images"), document.getElementById("input-pj-" + this.name).value = null;
1749
+ return;
1750
+ }
1751
+ this.fileToUpload.push(...e), this.uploadImage();
1752
+ },
1753
+ clickFile(s) {
1754
+ this.clickFileHandler ? this.clickFileHandler(s) : this.openFile(s);
1755
+ },
1756
+ openFile(s) {
1757
+ if (!s) {
1758
+ alert("Aucun fichier");
1759
+ return;
1760
+ }
1761
+ xe(s);
1762
+ },
1763
+ async uploadImage() {
1764
+ this.$emit("fileLoading", !0), this.fileLoading = !0;
1765
+ let s = new _e(), e = this.fileToUpload;
1766
+ for (let l of e)
1767
+ if (await j(l)) {
1768
+ let c = await G({
1769
+ file: l,
1770
+ maxWidth: 795,
1771
+ maxHeigth: 1125
1772
+ }), d = Se(c);
1773
+ await s.add(d);
1774
+ } else
1775
+ await s.add(l);
1776
+ let t = await s.saveAsBlob(), u = new as([t], "doc.pdf", {
1777
+ type: "application/pdf"
1778
+ }), i = await J(u, "pdf");
1779
+ i.name = this.fileName, this.finalFile = i, this.emitFile(), this.$emit("fileLoading", !1), this.fileLoading = !1;
1780
+ },
1781
+ emitFile() {
1782
+ this.$emit("update:modelValue", this.finalFile);
1783
+ },
1784
+ deletePj() {
1785
+ this.finalFile = null, this.emitFile(), this.$emit("deleteFile"), this.fileToUpload = [];
1786
+ }
1787
+ }
1788
+ }, ds = { class: "position-relative" }, cs = ["id"], us = ["id", "for"], ms = { class: "" }, fs = { class: "flex-grow-1" }, hs = { class: "fs-6 fw-bold" }, gs = {
1789
+ class: "text-primary form-text fst-italic",
1790
+ style: { "font-size": "smaller" }
1791
+ }, ps = ["id", "required", "name"], ys = {
1792
+ key: 1,
1793
+ class: "w-100"
1794
+ }, bs = {
1795
+ key: 0,
1796
+ class: "text-decoration-underline"
1797
+ }, Ss = { class: "p-2 d-flex align-items-center" }, xs = {
1798
+ key: 3,
1799
+ class: "text-muted"
1800
+ }, ks = {
1801
+ key: 0,
1802
+ class: "me-2"
1803
+ }, ws = ["id"], Cs = ["id"], _s = { key: 1 }, vs = ["id"];
1804
+ function Ps(s, e, t, u, i, l) {
1805
+ const c = x("font-awesome-icon"), d = x("amsom-overlay");
1806
+ return n(), k(d, { loading: i.fileLoading }, {
1807
+ default: z(() => {
1808
+ var m;
1809
+ return [
1810
+ o("div", ds, [
1811
+ (m = i.finalFile) != null && m.file ? (n(), r("div", ys, [
1812
+ t.title ? (n(), r("h5", bs, p(t.title), 1)) : h("", !0),
1813
+ o("div", Ss, [
1814
+ o("div", {
1815
+ role: "button",
1816
+ class: "hoverable flex-grow-1",
1817
+ onClick: e[8] || (e[8] = (a) => l.clickFile(i.finalFile.file))
1818
+ }, [
1819
+ t.rejectStatus ? (n(), k(c, {
1820
+ key: 0,
1821
+ icon: "fa-solid fa-exclamation-triangle",
1822
+ class: "text-danger me-1"
1823
+ })) : h("", !0),
1824
+ t.readStatus === "read" ? (n(), k(c, {
1825
+ key: 1,
1826
+ icon: "fa-solid fa-eye",
1827
+ class: "text-amsom-green me-1"
1828
+ })) : h("", !0),
1829
+ t.readStatus === "unread" ? (n(), k(c, {
1830
+ key: 2,
1831
+ icon: "fa-solid fa-eye-slash",
1832
+ class: "text-warning me-1"
1833
+ })) : h("", !0),
1834
+ b(c, { icon: "fa-solid fa-solid fa-paperclip" }),
1835
+ A(" " + p(t.pjName), 1),
1836
+ i.fileToUpload.length > 1 ? (n(), r("small", xs, " (" + p(i.fileToUpload.length) + " Fichiers)", 1)) : h("", !0)
1837
+ ]),
1838
+ t.readOnly ? h("", !0) : N((n(), r("div", ks, [
1839
+ o("input", {
1840
+ id: "fileUpload-" + t.name,
1841
+ type: "file",
1842
+ style: { opacity: "0", position: "absolute", top: "0", "z-index": "-1" },
1843
+ accept: "image/png, image/jpeg, application/pdf",
1844
+ hidden: "",
1845
+ multiple: "",
1846
+ onChange: e[9] || (e[9] = (...a) => l.addPj && l.addPj(...a))
1847
+ }, null, 40, ws),
1848
+ o("button", {
1849
+ id: "add-field-" + t.name,
1850
+ type: "button",
1851
+ class: "btn btn-primary rounded-5 fs-7 py-0 me-1",
1852
+ onClick: e[10] || (e[10] = (...a) => l.clickAddPj && l.clickAddPj(...a))
1853
+ }, [
1854
+ b(c, {
1855
+ icon: "fa-solid fa-file-circle-plus",
1856
+ class: "me-1"
1857
+ }),
1858
+ e[14] || (e[14] = o("span", null, [
1859
+ A(" Ajouter"),
1860
+ o("span", { class: "d-none d-md-block" }, " un document")
1861
+ ], -1))
1862
+ ], 8, Cs)
1863
+ ], 512)), [
1864
+ [ge, i.fileToUpload.length > 0]
1865
+ ]),
1866
+ t.readOnly ? h("", !0) : (n(), r("div", _s, [
1867
+ o("button", {
1868
+ id: "delete-all-pj-" + t.name,
1869
+ type: "button",
1870
+ class: "btn btn-link text-danger hoverable text-decoration-underline p-0",
1871
+ onClick: e[11] || (e[11] = (...a) => l.deletePj && l.deletePj(...a))
1872
+ }, " Supprimer ", 8, vs)
1873
+ ]))
1874
+ ])
1875
+ ])) : (n(), r("div", {
1876
+ key: 0,
1877
+ id: "input-group-pj-" + t.name,
1878
+ role: "group"
1879
+ }, [
1880
+ o("label", {
1881
+ id: "label-pj-" + t.name,
1882
+ for: "input-pj-" + t.name,
1883
+ role: "button",
1884
+ class: f(["m-0 px-1 py-2 d-block text-center text-secondary rounded-4 border-2 pj-label", { "border border-solid shadow": i.fileDragged }]),
1885
+ style: { "border-color": "var(--bs-gray-400)", "border-style": "dashed" },
1886
+ onDrop: e[1] || (e[1] = w((...a) => l.addPj && l.addPj(...a), ["prevent", "stop"])),
1887
+ onDrag: e[2] || (e[2] = w(() => {
1888
+ }, ["prevent", "stop"])),
1889
+ onDragstart: e[3] || (e[3] = w((a) => i.fileDragged = !0, ["prevent", "stop"])),
1890
+ onDragend: e[4] || (e[4] = w((a) => i.fileDragged = !1, ["prevent", "stop"])),
1891
+ onDragover: e[5] || (e[5] = w((a) => i.fileDragged = !0, ["prevent", "stop"])),
1892
+ onDragenter: e[6] || (e[6] = w((a) => i.fileDragged = !0, ["prevent", "stop"])),
1893
+ onDragleave: e[7] || (e[7] = w((a) => i.fileDragged = !1, ["prevent", "stop"]))
1894
+ }, [
1895
+ o("div", ms, [
1896
+ b(c, {
1897
+ icon: ["fas", "cloud-arrow-up"],
1898
+ size: "3x",
1899
+ "beat-fade": i.fileDragged
1900
+ }, null, 8, ["beat-fade"])
1901
+ ]),
1902
+ o("div", fs, [
1903
+ o("div", hs, p(t.label ?? t.pjName), 1),
1904
+ o("small", gs, p(t.subText), 1),
1905
+ e[12] || (e[12] = o("hr", { class: "mx-auto w-50 m-0 mb-1" }, null, -1)),
1906
+ e[13] || (e[13] = o("small", {
1907
+ class: "d-block text-muted",
1908
+ style: { "font-size": "0.8em" }
1909
+ }, [
1910
+ o("u", null, "Glissez"),
1911
+ A(" vos fichiers ici ou "),
1912
+ o("u", null, "cliquez"),
1913
+ A(" pour les sélectionner ")
1914
+ ], -1))
1915
+ ]),
1916
+ o("input", {
1917
+ id: "input-pj-" + t.name,
1918
+ class: "form-control",
1919
+ type: "file",
1920
+ style: { opacity: "0", position: "absolute", top: "0", "z-index": "-1" },
1921
+ accept: "image/png, image/jpeg, application/pdf",
1922
+ multiple: "",
1923
+ required: t.required,
1924
+ name: "pj" + t.name,
1925
+ onChange: e[0] || (e[0] = (...a) => l.addPj && l.addPj(...a))
1926
+ }, null, 40, ps)
1927
+ ], 42, us)
1928
+ ], 8, cs))
1929
+ ])
1930
+ ];
1931
+ }),
1932
+ _: 1
1933
+ }, 8, ["loading"]);
1934
+ }
1935
+ const Ks = /* @__PURE__ */ v(rs, [["render", Ps]]), Is = {
1936
+ name: "SliderSwitch",
1937
+ props: {
1938
+ listSection: {
1939
+ type: Array,
1940
+ default: () => [
1941
+ { id: 1, name: "Slider 1" },
1942
+ { id: 2, name: "Slider 2" },
1943
+ { id: 3, name: "Slider 3" }
1944
+ ]
1945
+ },
1946
+ containerClass: {
1947
+ type: String,
1948
+ default: "bg-secondary-subtle"
1949
+ },
1950
+ itemClass: {
1951
+ type: String,
1952
+ default: "fs-6"
1953
+ },
1954
+ bubbleClass: {
1955
+ type: String,
1956
+ default: "bg-light"
1957
+ },
1958
+ modelValue: {
1959
+ type: Number,
1960
+ default: 1
1961
+ },
1962
+ disabled: {
1963
+ type: Boolean,
1964
+ default: !1
1965
+ }
1966
+ },
1967
+ emits: ["update:modelValue"],
1968
+ mounted() {
1969
+ this.updateSliderPosition(), window.addEventListener("resize", this.handleResize);
1970
+ },
1971
+ beforeUnmount() {
1972
+ window.removeEventListener("resize", this.handleResize);
1973
+ },
1974
+ methods: {
1975
+ updateSliderPosition() {
1976
+ this.$nextTick(() => {
1977
+ const s = this.$el.querySelector(`#switch-section-${this.modelValue}`);
1978
+ if (!s) {
1979
+ const t = this.$el.querySelector("#switch-section-1");
1980
+ if (!t) return;
1981
+ const u = this.$el.querySelector(".slider");
1982
+ if (!u) return;
1983
+ u.style.width = `${t.offsetWidth}px`, u.style.height = `${t.offsetHeight}px`, u.style.left = `${t.offsetLeft}px`;
1984
+ return;
1985
+ }
1986
+ const e = this.$el.querySelector(".slider");
1987
+ e && (e.style.width = `${s.offsetWidth}px`, e.style.height = `${s.offsetHeight}px`, e.style.left = `${s.offsetLeft}px`);
1988
+ });
1989
+ },
1990
+ handleResize() {
1991
+ this.updateSliderPosition();
1992
+ },
1993
+ switchSection(s) {
1994
+ if (this.disabled) return;
1995
+ this.$emit("update:modelValue", s);
1996
+ const e = this.$el.querySelector(".slider"), t = this.$el.querySelector(`#switch-section-${s}`);
1997
+ e.style.width = t.clientWidth + "px", e.style.left = t.offsetLeft + "px";
1998
+ }
1999
+ }
2000
+ }, Ds = {
2001
+ class: "d-flex align-items-center justify-content-center mb-2 w-100 p-0",
2002
+ style: { "border-radius": "1em" }
2003
+ }, Ms = ["id", "onClick"];
2004
+ function Bs(s, e, t, u, i, l) {
2005
+ return n(), r("div", Ds, [
2006
+ o("ul", {
2007
+ id: "switch-section",
2008
+ class: f(["d-flex justify-content-center rounded-5 p-2 m-0 position-relative w-100", [t.containerClass, { disabled: t.disabled }]])
2009
+ }, [
2010
+ (n(!0), r(y, null, C(t.listSection, (c) => (n(), r("li", {
2011
+ id: "switch-section-" + c.id,
2012
+ key: c.id,
2013
+ class: f(["rounded-5 px-4 py-2 w-100 text-center", [
2014
+ t.itemClass,
2015
+ {
2016
+ hoverable: !t.disabled,
2017
+ "cursor-not-allowed": t.disabled
2018
+ }
2019
+ ]]),
2020
+ role: "button",
2021
+ onClick: (d) => l.switchSection(c.id)
2022
+ }, p(c.name), 11, Ms))), 128)),
2023
+ o("span", {
2024
+ class: f(["slider position-absolute", t.bubbleClass])
2025
+ }, null, 2)
2026
+ ], 2)
2027
+ ]);
2028
+ }
2029
+ const Gs = /* @__PURE__ */ v(Is, [["render", Bs], ["__scopeId", "data-v-02559b82"]]);
2
2030
  export {
3
- s as AmsomCard,
4
- o as AmsomDocumentList,
5
- e as AmsomHorizontalStepper,
6
- A as AmsomImage,
7
- l as AmsomModal,
8
- t as AmsomOverlay,
9
- r as AmsomPagination,
10
- i as AmsomSkeleton,
11
- d as AmsomSliderSwitch,
12
- n as AmsomTableDraggable,
13
- p as AmsomUploadFile,
14
- S as AmsomVerticalStepper,
15
- g as default
2031
+ Ve as AmsomCard,
2032
+ Rs as AmsomDocumentList,
2033
+ Os as AmsomHorizontalStepper,
2034
+ Ys as AmsomImage,
2035
+ ze as AmsomModal,
2036
+ Z as AmsomOverlay,
2037
+ Ws as AmsomPagination,
2038
+ Zt as AmsomSkeleton,
2039
+ Gs as AmsomSliderSwitch,
2040
+ Us as AmsomTableDraggable,
2041
+ Ks as AmsomUploadFile,
2042
+ Hs as AmsomVerticalStepper,
2043
+ ze as default
16
2044
  };