teraprox-ui-kit 0.1.7 → 0.1.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -32,35 +32,57 @@ var index_exports = {};
32
32
  __export(index_exports, {
33
33
  ActionButtons: () => ActionButtons,
34
34
  AddButton: () => AddButton_default,
35
+ AdvancedFilterBar: () => AdvancedFilterBar,
35
36
  ApproveAndReproveButtons: () => ApproveAndReproveButtons,
36
37
  AsyncButton: () => AsyncButton,
37
38
  AutoComplete: () => AutoComplete,
39
+ BonusButton: () => BonusButton,
40
+ ButtonWithDropdown: () => ButtonWithDropdown,
41
+ CheckBox: () => CheckBox,
38
42
  ClickToWriteField: () => ClickToWriteField,
39
43
  ColorPicker: () => ColorPicker,
40
44
  ConfigObject: () => ConfigObject,
41
45
  DeleteButton: () => DeleteButton_default,
42
46
  DeleteConfirm: () => DeleteConfirm,
47
+ ExpandableCard: () => ExpandableCard,
43
48
  FindRecursoByTagField: () => FindRecursoByTagField,
44
49
  FormField: () => FormField,
45
50
  Generic3DotMenu: () => Generic3DotMenu,
51
+ GenericChart: () => GenericChart,
46
52
  GenericDisplay: () => GenericDisplay_default,
47
53
  GenericForm: () => GenericForm_default,
54
+ GenericREchart: () => GenericREchart,
48
55
  GenericSelect: () => GenericSelect_default,
49
56
  GenericSelectOps: () => GenericSelectOps,
50
57
  IconLabelItem: () => IconLabelItem,
51
58
  IconLabelList: () => IconLabelList,
59
+ ImageViewModal: () => ImageViewModal,
60
+ JustificativaModal: () => JustificativaModal,
52
61
  LoadingButton: () => LoadingButton,
53
62
  LoadingProgress: () => LoadingProgress,
54
63
  MailSender: () => MailSender,
55
64
  MenuEvent: () => MenuEvent,
65
+ ModalBasicTemplate: () => ModalBasicTemplate,
56
66
  NavigateButton: () => NavigateButton,
67
+ NotificationBell: () => NotificationBell,
68
+ NotificationItem: () => NotificationItem,
69
+ PeriodSelector: () => PeriodSelector,
57
70
  QrCodeScanButton: () => QrCodeScanButton,
58
71
  QrReader: () => QrReader,
72
+ RecursoDisplayer: () => RecursoDisplayer,
59
73
  ResponsiveContainer: () => ResponsiveContainer_default,
74
+ ReusableTableWithModal: () => ReusableTableWithModal,
75
+ SectorSelector: () => SectorSelector,
76
+ SelectDateModal: () => SelectDateModal,
60
77
  StatusBadge: () => StatusBadge,
61
78
  StatusIndicator: () => StatusIndicator,
79
+ StatusLight: () => StatusLight,
80
+ StatusPills: () => StatusPills,
62
81
  Switch: () => Switch,
63
82
  SwitchOnClick: () => SwitchOnClick,
83
+ TextWithMore: () => TextWithMore,
84
+ TimerDisplay: () => TimerDisplay,
85
+ UnidadeMaterialForm: () => UnidadeMaterialForm,
64
86
  UploadArea: () => UploadArea,
65
87
  UuidPill: () => UuidPill_default,
66
88
  VerticalItemsDisplay: () => VerticalItemsDisplay
@@ -374,11 +396,124 @@ var AsyncButton = ({
374
396
  );
375
397
  };
376
398
 
399
+ // src/buttons/BonusButton.tsx
400
+ var import_jsx_runtime8 = require("react/jsx-runtime");
401
+ var BonusButton = ({
402
+ renderCondition = true,
403
+ onClickCallback,
404
+ label,
405
+ className = "",
406
+ ...props
407
+ }) => {
408
+ if (!renderCondition) return null;
409
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
410
+ "button",
411
+ {
412
+ className: `bonus-button ${className}`,
413
+ onClick: onClickCallback,
414
+ ...props,
415
+ children: label
416
+ }
417
+ );
418
+ };
419
+
420
+ // src/buttons/ButtonWithDropdown.tsx
421
+ var import_react_bootstrap8 = require("react-bootstrap");
422
+ var import_jsx_runtime9 = require("react/jsx-runtime");
423
+ var ButtonWithDropdown = ({
424
+ title,
425
+ onClickButton,
426
+ options,
427
+ menuVariant = "light",
428
+ variant = "primary",
429
+ toggleVariant
430
+ }) => {
431
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
432
+ import_react_bootstrap8.Dropdown,
433
+ {
434
+ as: import_react_bootstrap8.ButtonGroup,
435
+ className: "d-flex w-100",
436
+ style: { flex: 1, minWidth: 0 },
437
+ menuVariant,
438
+ children: [
439
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
440
+ import_react_bootstrap8.Button,
441
+ {
442
+ variant,
443
+ onClick: onClickButton,
444
+ className: "flex-grow-1 text-truncate",
445
+ style: { minWidth: 0 },
446
+ children: title
447
+ }
448
+ ),
449
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
450
+ import_react_bootstrap8.Dropdown.Toggle,
451
+ {
452
+ split: true,
453
+ variant: toggleVariant || variant,
454
+ id: "dropdown-split-basic",
455
+ style: {
456
+ flex: "0 0 2.5rem",
457
+ width: "2.5rem",
458
+ padding: "0",
459
+ display: "flex",
460
+ justifyContent: "center",
461
+ alignItems: "center"
462
+ }
463
+ }
464
+ ),
465
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_bootstrap8.Dropdown.Menu, { children: options.map((opt, idx) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_bootstrap8.Dropdown.Item, { onClick: opt.callback, children: opt.label }, `${opt.label}-${idx}`)) })
466
+ ]
467
+ }
468
+ );
469
+ };
470
+
471
+ // src/buttons/CheckBox.tsx
472
+ var import_react_bootstrap9 = require("react-bootstrap");
473
+ var import_ti = require("react-icons/ti");
474
+ var import_jsx_runtime10 = require("react/jsx-runtime");
475
+ var CheckBox = ({
476
+ opcoes,
477
+ isHover = false,
478
+ isCreator = false,
479
+ updateEvent,
480
+ deleteEvent,
481
+ enterEvent,
482
+ disabled = false,
483
+ className = ""
484
+ }) => {
485
+ if (isHover) {
486
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className, children: opcoes.map((opcao, index) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_react_bootstrap9.InputGroup, { style: { padding: 12, justifyItems: "center", opacity: disabled ? 0.5 : 1, pointerEvents: disabled ? "none" : "auto" }, children: [
487
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_bootstrap9.InputGroup.Checkbox, {}),
488
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
489
+ import_react_bootstrap9.Form.Control,
490
+ {
491
+ autoFocus: true,
492
+ onKeyDown: (event) => enterEvent && enterEvent(event, index, opcao),
493
+ style: { border: "none", borderBottom: "solid", borderRadius: 0, borderColor: "gray", borderWidth: "1px" },
494
+ value: isCreator ? "Nova opcao" : String(opcao.valor),
495
+ onChange: (event) => updateEvent && updateEvent(event, index)
496
+ }
497
+ ),
498
+ deleteEvent && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { style: { cursor: "pointer" }, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_ti.TiDelete, { size: "18", className: "delete text-danger", onClick: () => deleteEvent() }) })
499
+ ] }, index)) });
500
+ }
501
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className, style: { textAlign: "start" }, children: opcoes.map((opcao, index) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
502
+ import_react_bootstrap9.Form.Check,
503
+ {
504
+ disabled,
505
+ type: "checkbox",
506
+ label: `${opcao.valor}`
507
+ },
508
+ index
509
+ )) });
510
+ };
511
+
377
512
  // src/buttons/Generic3DotMenu.tsx
378
513
  var import_react5 = require("react");
379
- var import_react_bootstrap8 = require("react-bootstrap");
514
+ var import_react_bootstrap10 = require("react-bootstrap");
380
515
  var import_ci = require("react-icons/ci");
381
- var import_jsx_runtime8 = require("react/jsx-runtime");
516
+ var import_jsx_runtime11 = require("react/jsx-runtime");
382
517
  var MenuEvent = class {
383
518
  /**
384
519
  * @param label - O texto que aparecerá no botão.
@@ -415,16 +550,16 @@ var Generic3DotMenu = ({
415
550
  }
416
551
  return sections;
417
552
  }, {});
418
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
419
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_ci.CiMenuKebab, { onClick: handleShow, style: { cursor: "pointer" }, size: 25, title: tittle }),
420
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_react_bootstrap8.Modal, { show, onHide: handleClose, centered: true, children: [
421
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react_bootstrap8.Modal.Header, { closeButton: true, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react_bootstrap8.Modal.Title, { children: tittle }) }),
422
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_react_bootstrap8.Modal.Body, { children: [
423
- Object.keys(groupedEvents).length === 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "text-center text-muted", children: "Nenhuma op\xE7\xE3o dispon\xEDvel." }),
424
- Object.keys(groupedEvents).map((section, sectionIndex) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "mb-4", children: [
425
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("h6", { className: "border-bottom pb-2 mb-3", children: section !== "default" ? section : "Op\xE7\xF5es Principais" }),
426
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "d-grid gap-2", children: groupedEvents[section].map((event, index) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
427
- import_react_bootstrap8.Button,
553
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
554
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_ci.CiMenuKebab, { onClick: handleShow, style: { cursor: "pointer" }, size: 25, title: tittle }),
555
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_react_bootstrap10.Modal, { show, onHide: handleClose, centered: true, children: [
556
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_bootstrap10.Modal.Header, { closeButton: true, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_bootstrap10.Modal.Title, { children: tittle }) }),
557
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_react_bootstrap10.Modal.Body, { children: [
558
+ Object.keys(groupedEvents).length === 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "text-center text-muted", children: "Nenhuma op\xE7\xE3o dispon\xEDvel." }),
559
+ Object.keys(groupedEvents).map((section, sectionIndex) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "mb-4", children: [
560
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("h6", { className: "border-bottom pb-2 mb-3", children: section !== "default" ? section : "Op\xE7\xF5es Principais" }),
561
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "d-grid gap-2", children: groupedEvents[section].map((event, index) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
562
+ import_react_bootstrap10.Button,
428
563
  {
429
564
  variant: event.variant || "primary",
430
565
  onClick: () => {
@@ -437,28 +572,28 @@ var Generic3DotMenu = ({
437
572
  )) })
438
573
  ] }, sectionIndex))
439
574
  ] }),
440
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react_bootstrap8.Modal.Footer, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react_bootstrap8.Button, { variant: "secondary", onClick: handleClose, children: "Fechar" }) })
575
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_bootstrap10.Modal.Footer, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_bootstrap10.Button, { variant: "secondary", onClick: handleClose, children: "Fechar" }) })
441
576
  ] })
442
577
  ] });
443
578
  };
444
579
 
445
580
  // src/buttons/LoadingButton.tsx
446
- var import_react_bootstrap9 = require("react-bootstrap");
447
- var import_jsx_runtime9 = require("react/jsx-runtime");
581
+ var import_react_bootstrap11 = require("react-bootstrap");
582
+ var import_jsx_runtime12 = require("react/jsx-runtime");
448
583
  var LoadingButton = ({
449
584
  onClick,
450
585
  loading = false,
451
586
  label = "Enviar",
452
587
  variant = "primary",
453
- size = "md",
588
+ size,
454
589
  disabled = false,
455
590
  icon = null,
456
591
  className = "",
457
592
  loadingLabel = "Carregando...",
458
593
  ...props
459
594
  }) => {
460
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
461
- import_react_bootstrap9.Button,
595
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
596
+ import_react_bootstrap11.Button,
462
597
  {
463
598
  variant,
464
599
  size,
@@ -467,9 +602,9 @@ var LoadingButton = ({
467
602
  className: `loading-button ${className}`,
468
603
  style: { cursor: loading ? "not-allowed" : "pointer" },
469
604
  ...props,
470
- children: loading ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "align-items-center", children: [
471
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
472
- import_react_bootstrap9.Spinner,
605
+ children: loading ? /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "align-items-center", children: [
606
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
607
+ import_react_bootstrap11.Spinner,
473
608
  {
474
609
  as: "span",
475
610
  animation: "border",
@@ -479,18 +614,18 @@ var LoadingButton = ({
479
614
  className: "me-2"
480
615
  }
481
616
  ),
482
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { children: loadingLabel })
483
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "align-items-center", children: [
484
- icon && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "me-2 d-flex", children: icon }),
485
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { children: label })
617
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { children: loadingLabel })
618
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "align-items-center", children: [
619
+ icon && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "me-2 d-flex", children: icon }),
620
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { children: label })
486
621
  ] })
487
622
  }
488
623
  );
489
624
  };
490
625
 
491
626
  // src/buttons/NavigateButton.tsx
492
- var import_react_bootstrap10 = require("react-bootstrap");
493
- var import_jsx_runtime10 = require("react/jsx-runtime");
627
+ var import_react_bootstrap12 = require("react-bootstrap");
628
+ var import_jsx_runtime13 = require("react/jsx-runtime");
494
629
  var NavigateButton = ({
495
630
  displayName,
496
631
  path,
@@ -508,8 +643,8 @@ var NavigateButton = ({
508
643
  }
509
644
  navigator2(path, config, pageName);
510
645
  };
511
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
512
- import_react_bootstrap10.Button,
646
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
647
+ import_react_bootstrap12.Button,
513
648
  {
514
649
  style,
515
650
  variant,
@@ -521,8 +656,8 @@ var NavigateButton = ({
521
656
  };
522
657
 
523
658
  // src/buttons/StatusBadge.tsx
524
- var import_react_bootstrap11 = require("react-bootstrap");
525
- var import_jsx_runtime11 = require("react/jsx-runtime");
659
+ var import_react_bootstrap13 = require("react-bootstrap");
660
+ var import_jsx_runtime14 = require("react/jsx-runtime");
526
661
  var StatusBadge = ({
527
662
  status,
528
663
  showCheckbox = false,
@@ -539,9 +674,9 @@ var StatusBadge = ({
539
674
  CANCELED: "bg-danger text-white"
540
675
  };
541
676
  const badgeClass = statusClasses[status] || "bg-secondary text-white";
542
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "d-flex align-items-center gap-2", children: loading ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_bootstrap11.Spinner, { animation: "border", size: "sm" }) : /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
543
- showCheckbox && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
544
- import_react_bootstrap11.Form.Check,
677
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "d-flex align-items-center gap-2", children: loading ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_bootstrap13.Spinner, { animation: "border", size: "sm" }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
678
+ showCheckbox && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
679
+ import_react_bootstrap13.Form.Check,
545
680
  {
546
681
  type: "checkbox",
547
682
  checked,
@@ -549,7 +684,7 @@ var StatusBadge = ({
549
684
  className: "me-1"
550
685
  }
551
686
  ),
552
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: `badge ${badgeClass}`, children: status })
687
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: `badge ${badgeClass}`, children: status })
553
688
  ] }) });
554
689
  };
555
690
 
@@ -557,10 +692,10 @@ var StatusBadge = ({
557
692
  var import_react6 = require("react");
558
693
  var import_fa = require("react-icons/fa");
559
694
  var import_gr3 = require("react-icons/gr");
560
- var import_jsx_runtime12 = require("react/jsx-runtime");
695
+ var import_jsx_runtime15 = require("react/jsx-runtime");
561
696
  var SwitchOnClick = ({
562
697
  children,
563
- placeHolder = /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
698
+ placeHolder = /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
564
699
  "div",
565
700
  {
566
701
  className: "text-center zoom-container",
@@ -568,7 +703,7 @@ var SwitchOnClick = ({
568
703
  fontSize: "1.2rem",
569
704
  color: "#666"
570
705
  },
571
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
706
+ children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
572
707
  import_gr3.GrAddCircle,
573
708
  {
574
709
  size: 25,
@@ -601,18 +736,98 @@ var SwitchOnClick = ({
601
736
  return () => window.removeEventListener("keydown", handleEscape);
602
737
  }, []);
603
738
  if (!clicked) {
604
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { onClick: handleClick, style: { cursor: "pointer" }, children: placeHolder });
739
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { onClick: handleClick, style: { cursor: "pointer" }, children: placeHolder });
605
740
  }
606
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: `switch-on-click-container ${containerClassName}`, children: [
607
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "close-icon", onClick: handleClose, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_fa.FaTimes, { title: "Fechar" }) }),
741
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: `switch-on-click-container ${containerClassName}`, children: [
742
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "close-icon", onClick: handleClose, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_fa.FaTimes, { title: "Fechar" }) }),
608
743
  children({ handleClose })
609
744
  ] });
610
745
  };
611
746
 
747
+ // src/charts/GenericChart.tsx
748
+ var import_react_google_charts = require("react-google-charts");
749
+ var import_jsx_runtime16 = require("react/jsx-runtime");
750
+ var GenericChart = ({
751
+ chartType,
752
+ graphID,
753
+ width = "100%",
754
+ height = "400px",
755
+ columns,
756
+ rows,
757
+ chartEvents,
758
+ options,
759
+ tooltipFormatter
760
+ }) => {
761
+ let datachart = [columns, ...rows];
762
+ if (tooltipFormatter) {
763
+ datachart = datachart.map((row, index) => {
764
+ if (index === 0) return row;
765
+ const formattedTooltip = tooltipFormatter(row);
766
+ return [...row, formattedTooltip];
767
+ });
768
+ datachart[0] = [...columns, { type: "string", role: "tooltip", p: { html: true } }];
769
+ }
770
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
771
+ import_react_google_charts.Chart,
772
+ {
773
+ chartType,
774
+ options: { ...options, tooltip: { isHtml: true } },
775
+ data: datachart,
776
+ graphID,
777
+ width,
778
+ height,
779
+ chartEvents
780
+ }
781
+ );
782
+ };
783
+
784
+ // src/charts/GenericREchart.tsx
785
+ var import_recharts = require("recharts");
786
+ var import_dayjs = __toESM(require("dayjs"));
787
+ var import_jsx_runtime17 = require("react/jsx-runtime");
788
+ var GenericREchart = ({
789
+ data = [],
790
+ lines = [],
791
+ xAxisKey = "data",
792
+ showGrid = true,
793
+ showLegend = true,
794
+ showTooltip = true,
795
+ width = "100%",
796
+ height = 400,
797
+ hideYAxis,
798
+ unit,
799
+ margin = { top: 20, right: 30, left: 20, bottom: 5 },
800
+ YAxisRange = [0, "auto"]
801
+ }) => {
802
+ const sortedData = [...data].sort(
803
+ (a, b) => new Date(a[xAxisKey]).getTime() - new Date(b[xAxisKey]).getTime()
804
+ );
805
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { style: { width, height }, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_recharts.ResponsiveContainer, { width: "100%", height: "100%", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_recharts.LineChart, { data: sortedData, margin, children: [
806
+ showGrid && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_recharts.CartesianGrid, { strokeDasharray: "3 3" }),
807
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
808
+ import_recharts.XAxis,
809
+ {
810
+ dataKey: xAxisKey,
811
+ reversed: false,
812
+ tickFormatter: (tick) => (0, import_dayjs.default)(tick).format("DD/MM/YY HH:mm")
813
+ }
814
+ ),
815
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_recharts.YAxis, { domain: YAxisRange, unit, hide: hideYAxis, type: "number" }),
816
+ showTooltip && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
817
+ import_recharts.Tooltip,
818
+ {
819
+ labelFormatter: (label) => (0, import_dayjs.default)(label).format("DD/MM/YY HH:mm")
820
+ }
821
+ ),
822
+ showLegend && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_recharts.Legend, {}),
823
+ lines.map((lineCfg, idx) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_recharts.Line, { ...lineCfg }, idx))
824
+ ] }) }) });
825
+ };
826
+
612
827
  // src/containers/ResponsiveContainer.tsx
613
- var import_react_bootstrap12 = require("react-bootstrap");
614
- var import_jsx_runtime13 = require("react/jsx-runtime");
615
- var ResponsiveContainer = ({
828
+ var import_react_bootstrap14 = require("react-bootstrap");
829
+ var import_jsx_runtime18 = require("react/jsx-runtime");
830
+ var ResponsiveContainer2 = ({
616
831
  title,
617
832
  show,
618
833
  setShow,
@@ -624,22 +839,85 @@ var ResponsiveContainer = ({
624
839
  setShow(false);
625
840
  if (onClose) onClose();
626
841
  };
627
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_react_bootstrap12.Modal, { size: "lg", show, onHide: handleClose, scrollable, children: [
628
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react_bootstrap12.Modal.Header, { closeButton: true, onClick: handleClose }),
629
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react_bootstrap12.ModalBody, { children })
842
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_react_bootstrap14.Modal, { size: "lg", show, onHide: handleClose, scrollable, children: [
843
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_bootstrap14.Modal.Header, { closeButton: true, onClick: handleClose }),
844
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_bootstrap14.ModalBody, { children })
630
845
  ] });
631
846
  };
632
- var ResponsiveContainer_default = ResponsiveContainer;
847
+ var ResponsiveContainer_default = ResponsiveContainer2;
633
848
 
634
- // src/displays/UuidPill.tsx
849
+ // src/containers/ExpandableCard.tsx
635
850
  var import_react7 = require("react");
636
- var import_react_bootstrap13 = require("react-bootstrap");
637
- var import_jsx_runtime14 = require("react/jsx-runtime");
851
+ var import_react_bootstrap15 = require("react-bootstrap");
852
+ var import_fa2 = require("react-icons/fa");
853
+ var import_jsx_runtime19 = require("react/jsx-runtime");
854
+ var ExpandableCard = ({
855
+ items = [],
856
+ initialVisibleCount = 3,
857
+ expandable = true,
858
+ leftSideContent,
859
+ rightSideContent,
860
+ cardClassName = "",
861
+ cardBodyClassName = "",
862
+ cardBodyStyle,
863
+ isMobile = false
864
+ }) => {
865
+ const [expandedCard, setExpandedCard] = (0, import_react7.useState)(false);
866
+ const handleToggleExpandCard = () => {
867
+ setExpandedCard(!expandedCard);
868
+ };
869
+ const visibleItems = expandedCard ? items : items.slice(0, initialVisibleCount);
870
+ const shouldShowExpandButton = expandable && items.length > initialVisibleCount;
871
+ const renderContentWithToggle = (content) => {
872
+ return content;
873
+ };
874
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_react_bootstrap15.Card, { className: `expandable-card ${cardClassName}`, children: [
875
+ leftSideContent && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "expandable-card-left-side", children: leftSideContent }),
876
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_react_bootstrap15.Card.Body, { className: `expandable-card-body ${cardBodyClassName}`, style: cardBodyStyle, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_react_bootstrap15.ListGroup, { variant: "flush", children: [
877
+ visibleItems.map((item, index) => {
878
+ const isObject = typeof item === "object" && item !== null && "content" in item;
879
+ const itemObj = isObject ? item : { content: item };
880
+ const clickableClass = itemObj.clickable ? "expandable-card-list-item-clickable" : "";
881
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
882
+ import_react_bootstrap15.ListGroup.Item,
883
+ {
884
+ className: `expandable-card-list-item ${clickableClass}`,
885
+ children: isMobile ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "expandable-card-item", children: [
886
+ itemObj.label && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "expandable-card-item-header", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("strong", { children: itemObj.label }) }),
887
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "expandable-card-item-content", children: renderContentWithToggle(itemObj.content) })
888
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "expandable-card-item-row", children: [
889
+ itemObj.label && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("strong", { className: "expandable-card-item-label", children: [
890
+ itemObj.label,
891
+ ":"
892
+ ] }),
893
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "expandable-card-item-content", children: renderContentWithToggle(itemObj.content) })
894
+ ] })
895
+ },
896
+ index
897
+ );
898
+ }),
899
+ shouldShowExpandButton && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
900
+ import_react_bootstrap15.ListGroup.Item,
901
+ {
902
+ className: `expandable-card-toggle ${expandedCard ? "expanded" : ""}`,
903
+ onClick: handleToggleExpandCard,
904
+ children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_fa2.FaChevronDown, { className: "expandable-card-toggle-icon" })
905
+ }
906
+ )
907
+ ] }) }),
908
+ rightSideContent && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "expandable-card-right-side", children: rightSideContent })
909
+ ] });
910
+ };
911
+
912
+ // src/displays/UuidPill.tsx
913
+ var import_react8 = require("react");
914
+ var import_react_bootstrap16 = require("react-bootstrap");
915
+ var import_jsx_runtime20 = require("react/jsx-runtime");
638
916
  var UuidPill = ({ uuid, bg = "light", textColor = "dark", short = 8 }) => {
639
- const [copied, setCopied] = (0, import_react7.useState)(false);
640
- const ref = (0, import_react7.useRef)(null);
641
- const [showTooltip, setShowTooltip] = (0, import_react7.useState)(false);
642
- if (!uuid) return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "text-muted", children: "\u2014" });
917
+ const [copied, setCopied] = (0, import_react8.useState)(false);
918
+ const ref = (0, import_react8.useRef)(null);
919
+ const [showTooltip, setShowTooltip] = (0, import_react8.useState)(false);
920
+ if (!uuid) return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-muted", children: "\u2014" });
643
921
  const shortId = String(uuid).substring(0, short);
644
922
  const handleCopy = async (e) => {
645
923
  e.stopPropagation();
@@ -656,9 +934,9 @@ var UuidPill = ({ uuid, bg = "light", textColor = "dark", short = 8 }) => {
656
934
  setCopied(true);
657
935
  setTimeout(() => setCopied(false), 1500);
658
936
  };
659
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
660
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
661
- import_react_bootstrap13.Badge,
937
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
938
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
939
+ import_react_bootstrap16.Badge,
662
940
  {
663
941
  ref,
664
942
  bg,
@@ -678,19 +956,19 @@ var UuidPill = ({ uuid, bg = "light", textColor = "dark", short = 8 }) => {
678
956
  ]
679
957
  }
680
958
  ),
681
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_bootstrap13.Overlay, { target: ref.current, show: showTooltip, placement: "top", children: (props) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_bootstrap13.Tooltip, { ...props, children: copied ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { style: { color: "#6f6" }, children: "Copiado!" }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { style: { fontFamily: "monospace", fontSize: "0.75rem" }, children: [
959
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react_bootstrap16.Overlay, { target: ref.current, show: showTooltip, placement: "top", children: (props) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react_bootstrap16.Tooltip, { ...props, children: copied ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { style: { color: "#6f6" }, children: "Copiado!" }) : /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { style: { fontFamily: "monospace", fontSize: "0.75rem" }, children: [
682
960
  uuid,
683
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("br", {}),
684
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("small", { className: "text-muted", children: "Clique para copiar" })
961
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("br", {}),
962
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("small", { className: "text-muted", children: "Clique para copiar" })
685
963
  ] }) }) })
686
964
  ] });
687
965
  };
688
966
  var UuidPill_default = UuidPill;
689
967
 
690
968
  // src/displays/GenericDisplay.tsx
691
- var import_react8 = __toESM(require("react"));
692
- var import_react_bootstrap14 = require("react-bootstrap");
693
- var import_jsx_runtime15 = require("react/jsx-runtime");
969
+ var import_react9 = __toESM(require("react"));
970
+ var import_react_bootstrap17 = require("react-bootstrap");
971
+ var import_jsx_runtime21 = require("react/jsx-runtime");
694
972
  var ConfigObject = class {
695
973
  constructor(dotNotation, style, onClick, onBlur, onHideClick, hidden, mapData, additionalComponents) {
696
974
  this.dotNotation = dotNotation;
@@ -740,17 +1018,17 @@ var buildData = (obj, propertiesMap, configObjects, opn, innerArray, dispatch, i
740
1018
  const onClick = getOnClick(innerConfigs);
741
1019
  const extraComponents = getAdditionalComponentes(innerConfigs);
742
1020
  if (Array.isArray(obj)) {
743
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_react_bootstrap14.Container, { onClick, style: { ...styles }, children: [
744
- opn && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { style: { textAlign: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("strong", { children: opn }) }),
1021
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_react_bootstrap17.Container, { onClick, style: { ...styles }, children: [
1022
+ opn && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { style: { textAlign: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("strong", { children: opn }) }),
745
1023
  obj.map((o, index) => {
746
1024
  const mapCopy = [...newPropertiesMap, `[${index}]`];
747
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_bootstrap14.Row, { style: { padding: 4, ...styles }, children: buildData(o, mapCopy, configObjects, null, true, null, false, editButtonRenderer) }, index);
1025
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_react_bootstrap17.Row, { style: { padding: 4, ...styles }, children: buildData(o, mapCopy, configObjects, null, true, null, false, editButtonRenderer) }, index);
748
1026
  })
749
1027
  ] });
750
1028
  }
751
1029
  if (typeof obj === "object" && obj != null) {
752
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
753
- import_react_bootstrap14.Container,
1030
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
1031
+ import_react_bootstrap17.Container,
754
1032
  {
755
1033
  onClick,
756
1034
  style: {
@@ -762,17 +1040,17 @@ var buildData = (obj, propertiesMap, configObjects, opn, innerArray, dispatch, i
762
1040
  ...styles
763
1041
  },
764
1042
  children: [
765
- opn && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("strong", { children: opn }),
1043
+ opn && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("strong", { children: opn }),
766
1044
  Object.entries(obj).map(
767
1045
  ([key, value]) => buildData(value, newPropertiesMap, configObjects, key, false, null, false, editButtonRenderer)
768
1046
  ),
769
- extraComponents.length > 0 ? extraComponents.map((comp, i) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react8.default.Fragment, { children: comp() }, i)) : isRoot && editButtonRenderer ? editButtonRenderer(obj, opn) : null
1047
+ extraComponents.length > 0 ? extraComponents.map((comp, i) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_react9.default.Fragment, { children: comp() }, i)) : isRoot && editButtonRenderer ? editButtonRenderer(obj, opn) : null
770
1048
  ]
771
1049
  }
772
1050
  );
773
1051
  }
774
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_react_bootstrap14.Col, { children: [
775
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("strong", { children: [
1052
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_react_bootstrap17.Col, { children: [
1053
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("strong", { children: [
776
1054
  opn,
777
1055
  ": "
778
1056
  ] }),
@@ -788,7 +1066,7 @@ var GenericDisplay = ({
788
1066
  onRefresh,
789
1067
  editButtonRenderer
790
1068
  }) => {
791
- const [innerOptions, setInnerOptions] = (0, import_react8.useState)();
1069
+ const [innerOptions, setInnerOptions] = (0, import_react9.useState)();
792
1070
  const refreshFunc = () => {
793
1071
  if (loadFunc) {
794
1072
  loadFunc().then((res) => {
@@ -802,19 +1080,19 @@ var GenericDisplay = ({
802
1080
  setInnerOptions(ops);
803
1081
  }
804
1082
  };
805
- (0, import_react8.useEffect)(() => {
1083
+ (0, import_react9.useEffect)(() => {
806
1084
  if (onRefresh) {
807
1085
  onRefresh(refreshFunc);
808
1086
  } else {
809
1087
  refreshFunc();
810
1088
  }
811
1089
  }, [context]);
812
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_jsx_runtime15.Fragment, { children: innerOptions && innerOptions.map((cObj, index) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_bootstrap14.Container, { style: { padding: 4, border: "solid" }, children: buildData(cObj, [], configObjects, rootName || null, false, null, true, editButtonRenderer) }, index)) });
1090
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_jsx_runtime21.Fragment, { children: innerOptions && innerOptions.map((cObj, index) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_react_bootstrap17.Container, { style: { padding: 4, border: "solid" }, children: buildData(cObj, [], configObjects, rootName || null, false, null, true, editButtonRenderer) }, index)) });
813
1091
  };
814
1092
  var GenericDisplay_default = GenericDisplay;
815
1093
 
816
1094
  // src/displays/StatusIndicator.tsx
817
- var import_jsx_runtime16 = require("react/jsx-runtime");
1095
+ var import_jsx_runtime22 = require("react/jsx-runtime");
818
1096
  var StatusIndicator = ({
819
1097
  status,
820
1098
  count,
@@ -829,14 +1107,14 @@ var StatusIndicator = ({
829
1107
  naoAtribuida: "N\xC3O ATRIBUIDA"
830
1108
  };
831
1109
  const label = statusLabels[status] || status.toUpperCase();
832
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: `status-flag ${status} ${containerClassName}`, children: [
833
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "status-label", children: label }),
834
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "status-count", children: count })
1110
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: `status-flag ${status} ${containerClassName}`, children: [
1111
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "status-label", children: label }),
1112
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "status-count", children: count })
835
1113
  ] });
836
1114
  };
837
1115
 
838
1116
  // src/displays/VerticalItemsDisplay.tsx
839
- var import_jsx_runtime17 = require("react/jsx-runtime");
1117
+ var import_jsx_runtime23 = require("react/jsx-runtime");
840
1118
  var VerticalItemsDisplay = ({
841
1119
  item1 = "",
842
1120
  item2 = "",
@@ -844,377 +1122,119 @@ var VerticalItemsDisplay = ({
844
1122
  className = "",
845
1123
  style
846
1124
  }) => {
847
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className, style, children: [
848
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { children: item1 }),
849
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { children: item2 }),
850
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { children: item3 })
1125
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className, style, children: [
1126
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { children: item1 }),
1127
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { children: item2 }),
1128
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { children: item3 })
851
1129
  ] });
852
1130
  };
853
1131
 
854
- // src/forms/MailSender.tsx
855
- var import_react9 = require("react");
856
- var import_react_bootstrap15 = require("react-bootstrap");
857
- var import_fi2 = require("react-icons/fi");
858
- var import_jsx_runtime18 = require("react/jsx-runtime");
859
- var MailSender = ({
860
- htmlContent,
861
- companyName,
862
- onFetchEmails,
863
- onSendEmail,
864
- hide = false,
865
- renderTrigger
1132
+ // src/displays/StatusLight.tsx
1133
+ var import_jsx_runtime24 = require("react/jsx-runtime");
1134
+ var StatusLight = ({
1135
+ active = false,
1136
+ activeLightColor = "green",
1137
+ inactiveLightColor = "gray",
1138
+ size = "20px",
1139
+ className = "",
1140
+ style
866
1141
  }) => {
867
- const [opened, setOpened] = (0, import_react9.useState)(false);
868
- const [addingEmail, setAddingEmail] = (0, import_react9.useState)(false);
869
- const [selectedEmails, setSelectedEmails] = (0, import_react9.useState)([]);
870
- const [emails, setEmails] = (0, import_react9.useState)([]);
871
- const [loading, setLoading] = (0, import_react9.useState)(false);
872
- const [postLoading, setPostLoading] = (0, import_react9.useState)(false);
873
- const [customEmail, setCustomEmail] = (0, import_react9.useState)("");
874
- const [emailError, setEmailError] = (0, import_react9.useState)("");
875
- const [searchFilter, setSearchFilter] = (0, import_react9.useState)("");
876
- const handleOpen = async () => {
877
- setLoading(true);
878
- try {
879
- const data = await onFetchEmails();
880
- setEmails(data || []);
881
- setOpened(true);
882
- } catch (err) {
883
- console.error("Erro ao buscar e-mails:", err);
884
- } finally {
885
- setLoading(false);
886
- }
887
- };
888
- const mailListLinter = () => {
889
- const result = [];
890
- const seen = /* @__PURE__ */ new Set();
891
- if (emails) {
892
- for (const item of emails) {
893
- if (item.email && !seen.has(item.email)) {
894
- seen.add(item.email);
895
- result.push({ email: item.email });
896
- }
1142
+ const color = active ? activeLightColor : inactiveLightColor;
1143
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
1144
+ "div",
1145
+ {
1146
+ className,
1147
+ style: {
1148
+ backgroundColor: color,
1149
+ borderRadius: "50%",
1150
+ width: size,
1151
+ height: size,
1152
+ display: "inline-block",
1153
+ transition: "background-color 0.3s ease",
1154
+ ...style
897
1155
  }
898
1156
  }
899
- return result;
900
- };
901
- const filteredEmails = emails ? mailListLinter().filter(
902
- (email) => email.email.toLowerCase().includes(searchFilter.toLowerCase()) && !selectedEmails.some((selected) => (selected.email || selected) === email.email)
903
- ) : [];
904
- const sendEmail = async () => {
905
- const emailString = selectedEmails.map((email) => email.email ? email.email : email).join(", ");
906
- const emailData = {
907
- to: emailString,
908
- subject: `Relat\xF3rio - ${companyName}`,
909
- text: `Relat\xF3rio de processo da empresa ${companyName}`,
910
- html: htmlContent
911
- };
912
- setPostLoading(true);
913
- try {
914
- await onSendEmail(emailData);
915
- setSelectedEmails([]);
916
- setCustomEmail("");
917
- setOpened(false);
918
- } catch (err) {
919
- console.error("Erro ao enviar e-mail:", err);
920
- } finally {
921
- setPostLoading(false);
922
- }
923
- };
924
- const validateEmail = (email) => {
925
- const re = /\S+@\S+\.\S+/;
926
- return re.test(email);
1157
+ );
1158
+ };
1159
+
1160
+ // src/displays/TimerDisplay.tsx
1161
+ var import_dayjs2 = __toESM(require("dayjs"));
1162
+ var import_duration = __toESM(require("dayjs/plugin/duration"));
1163
+ var import_bi = require("react-icons/bi");
1164
+ var import_bs = require("react-icons/bs");
1165
+ var import_jsx_runtime25 = require("react/jsx-runtime");
1166
+ import_dayjs2.default.extend(import_duration.default);
1167
+ var TimerDisplay = ({
1168
+ id,
1169
+ tempo = 0,
1170
+ isStopped = false,
1171
+ pausable = false,
1172
+ playable = false,
1173
+ enableView = true,
1174
+ onPause,
1175
+ onPlay,
1176
+ emptyMessage = "Timer ainda n\xE3o iniciado."
1177
+ }) => {
1178
+ const handlePause = (e) => {
1179
+ e.stopPropagation();
1180
+ if (id && onPause) onPause(id);
927
1181
  };
928
- const handleEmailAdd = () => {
929
- if (!customEmail.trim()) {
930
- setEmailError("Por favor, digite um e-mail");
931
- return;
932
- }
933
- if (!validateEmail(customEmail)) {
934
- setEmailError("Formato de e-mail inv\xE1lido");
935
- return;
936
- }
937
- if (selectedEmails.some((email) => (email.email || email) === customEmail)) {
938
- setEmailError("Este e-mail j\xE1 foi selecionado");
939
- return;
940
- }
941
- setSelectedEmails([...selectedEmails, customEmail]);
942
- setCustomEmail("");
943
- setEmailError("");
944
- setAddingEmail(false);
1182
+ const handlePlay = (e) => {
1183
+ e.stopPropagation();
1184
+ if (id && onPlay) onPlay(id);
945
1185
  };
946
- const handleEmailRemove = (emailToRemove) => {
947
- setSelectedEmails(
948
- selectedEmails.filter(
949
- (email) => (email.email || email) !== (emailToRemove.email || emailToRemove)
950
- )
951
- );
1186
+ const formatDuration = (seconds) => {
1187
+ if (!enableView) return "- : - : -";
1188
+ const time = import_dayjs2.default.duration(seconds, "seconds");
1189
+ const days = Math.floor(time.asDays());
1190
+ const hours = time.hours().toString().padStart(2, "0");
1191
+ const minutes = time.minutes().toString().padStart(2, "0");
1192
+ const secondsRemaining = time.seconds().toString().padStart(2, "0");
1193
+ return days > 0 ? `${days}d ${hours}:${minutes}:${secondsRemaining}` : `${hours}:${minutes}:${secondsRemaining}`;
952
1194
  };
953
- if (hide) return null;
954
- if (!opened) {
955
- if (renderTrigger) {
956
- return renderTrigger({ onClick: handleOpen, loading });
957
- }
958
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_bootstrap15.Button, { disabled: loading, className: "w-100", onClick: handleOpen, children: loading ? "Carregando..." : "Enviar por E-mail" });
959
- }
960
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
961
- "div",
962
- {
963
- style: {
964
- backgroundColor: "#f8f9fa",
965
- borderRadius: "12px",
966
- overflow: "hidden",
967
- border: "1px solid #dee2e6",
968
- boxShadow: "0 4px 6px rgba(0, 0, 0, 0.1)"
969
- },
970
- children: [
971
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
972
- "div",
973
- {
974
- style: {
975
- background: "linear-gradient(135deg, #28a745 0%, #20c997 100%)",
976
- color: "white",
977
- padding: "25px"
978
- },
979
- children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "d-flex justify-content-between align-items-center", children: [
980
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { children: [
981
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("h4", { className: "mb-1", style: { fontWeight: "600", fontSize: "22px" }, children: [
982
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_fi2.FiMail, { className: "me-2", size: 20 }),
983
- "Enviar Relat\xF3rio por E-mail"
984
- ] }),
985
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("small", { style: { opacity: "0.9", fontSize: "14px" }, children: [
986
- "Selecione os destinat\xE1rios para envio do relat\xF3rio de ",
987
- companyName
988
- ] })
989
- ] }),
990
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "d-flex gap-2", children: [
991
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
992
- import_react_bootstrap15.Button,
993
- {
994
- variant: "light",
995
- onClick: sendEmail,
996
- disabled: selectedEmails.length === 0 || postLoading,
997
- style: {
998
- borderRadius: "8px",
999
- fontWeight: "600",
1000
- minWidth: "130px",
1001
- height: "40px"
1002
- },
1003
- children: postLoading ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
1004
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_bootstrap15.Spinner, { size: "sm", className: "me-2" }),
1005
- "Enviando..."
1006
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
1007
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_fi2.FiSend, { className: "me-2", size: 14 }),
1008
- "Enviar E-mail"
1009
- ] })
1010
- }
1011
- ),
1012
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1013
- import_react_bootstrap15.Button,
1014
- {
1015
- variant: "outline-light",
1016
- onClick: () => setOpened(false),
1017
- disabled: postLoading,
1018
- style: { borderRadius: "8px", width: "40px", height: "40px" },
1019
- children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_fi2.FiX, { size: 16 })
1020
- }
1021
- )
1022
- ] })
1023
- ] })
1024
- }
1025
- ),
1026
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { style: { padding: "25px" }, children: [
1027
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_bootstrap15.Card, { className: "mb-4", style: { border: "none", boxShadow: "0 2px 8px rgba(0,0,0,0.05)" }, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_react_bootstrap15.Card.Body, { style: { padding: "20px" }, children: [
1028
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_react_bootstrap15.Row, { className: "align-items-center", children: [
1029
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_react_bootstrap15.Col, { md: 6, children: [
1030
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("h6", { className: "mb-2", style: { color: "#495057", fontWeight: "600" }, children: "\u{1F527} Filtros e A\xE7\xF5es" }),
1031
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_react_bootstrap15.InputGroup, { style: { maxWidth: "300px" }, children: [
1032
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_bootstrap15.InputGroup.Text, { style: { backgroundColor: "#f8f9fa", border: "1px solid #dee2e6" }, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_fi2.FiSearch, { size: 14, color: "#6c757d" }) }),
1033
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1034
- import_react_bootstrap15.Form.Control,
1035
- {
1036
- type: "text",
1037
- placeholder: "Buscar e-mails...",
1038
- value: searchFilter,
1039
- onChange: (e) => setSearchFilter(e.target.value),
1040
- style: { border: "1px solid #dee2e6" }
1041
- }
1042
- )
1043
- ] })
1044
- ] }),
1045
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_bootstrap15.Col, { md: 6, className: "text-end", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1046
- import_react_bootstrap15.Button,
1047
- {
1048
- variant: addingEmail ? "outline-secondary" : "outline-primary",
1049
- size: "sm",
1050
- onClick: () => setAddingEmail(!addingEmail),
1051
- disabled: postLoading,
1052
- style: { borderRadius: "8px" },
1053
- children: addingEmail ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
1054
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_fi2.FiX, { className: "me-1", size: 14 }),
1055
- "Cancelar"
1056
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
1057
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_fi2.FiPlus, { className: "me-1", size: 14 }),
1058
- "E-mail Personalizado"
1059
- ] })
1060
- }
1061
- ) })
1062
- ] }),
1063
- addingEmail && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
1064
- "div",
1065
- {
1066
- style: {
1067
- marginTop: "20px",
1068
- padding: "20px",
1069
- backgroundColor: "#f8f9ff",
1070
- borderRadius: "8px",
1071
- border: "1px solid #e3f2fd"
1072
- },
1073
- children: [
1074
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("h6", { className: "mb-3", style: { color: "#1976d2", fontWeight: "600" }, children: "\u2709\uFE0F Adicionar E-mail Personalizado" }),
1075
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_react_bootstrap15.Row, { className: "align-items-end", children: [
1076
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_react_bootstrap15.Col, { md: 8, children: [
1077
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_bootstrap15.Form.Label, { style: { fontSize: "13px", color: "#6c757d", fontWeight: "500" }, children: "Endere\xE7o de E-mail" }),
1078
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1079
- import_react_bootstrap15.Form.Control,
1080
- {
1081
- type: "email",
1082
- placeholder: "exemplo@empresa.com",
1083
- value: customEmail,
1084
- onChange: (e) => {
1085
- setCustomEmail(e.target.value);
1086
- if (emailError) setEmailError("");
1087
- },
1088
- isInvalid: !!emailError,
1089
- disabled: postLoading,
1090
- style: { borderRadius: "8px" },
1091
- onKeyPress: (e) => e.key === "Enter" && handleEmailAdd()
1092
- }
1093
- ),
1094
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_bootstrap15.Form.Control.Feedback, { type: "invalid", children: emailError })
1095
- ] }),
1096
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_bootstrap15.Col, { md: 4, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
1097
- import_react_bootstrap15.Button,
1098
- {
1099
- variant: "success",
1100
- onClick: handleEmailAdd,
1101
- disabled: postLoading,
1102
- style: { borderRadius: "8px", width: "100%" },
1103
- children: [
1104
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_fi2.FiPlus, { className: "me-1", size: 14 }),
1105
- "Adicionar"
1106
- ]
1107
- }
1108
- ) })
1109
- ] })
1110
- ]
1111
- }
1112
- )
1113
- ] }) }),
1114
- selectedEmails.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_bootstrap15.Card, { className: "mb-4", style: { border: "none", boxShadow: "0 2px 8px rgba(0,0,0,0.05)" }, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_react_bootstrap15.Card.Body, { style: { padding: "20px" }, children: [
1115
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "d-flex justify-content-between align-items-center mb-3", children: [
1116
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("h6", { className: "mb-0", style: { color: "#495057", fontWeight: "600" }, children: "\u{1F4CB} Destinat\xE1rios Selecionados" }),
1117
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_react_bootstrap15.Badge, { bg: "primary", style: { fontSize: "12px", padding: "6px 12px" }, children: [
1118
- selectedEmails.length,
1119
- " selecionado",
1120
- selectedEmails.length > 1 ? "s" : ""
1121
- ] })
1122
- ] }),
1123
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "d-flex flex-wrap gap-2", children: selectedEmails.map((email, index) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
1124
- "div",
1125
- {
1126
- style: {
1127
- background: "linear-gradient(135deg, #e3f2fd 0%, #f3e5f5 100%)",
1128
- border: "1px solid #bbdefb",
1129
- borderRadius: "20px",
1130
- padding: "8px 15px",
1131
- display: "flex",
1132
- alignItems: "center",
1133
- fontSize: "14px",
1134
- fontWeight: "500"
1135
- },
1136
- children: [
1137
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_fi2.FiUser, { size: 12, className: "me-2", color: "#1976d2" }),
1138
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { children: email.email || email }),
1139
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1140
- import_react_bootstrap15.Button,
1141
- {
1142
- variant: "link",
1143
- size: "sm",
1144
- onClick: () => handleEmailRemove(email),
1145
- disabled: postLoading,
1146
- style: {
1147
- padding: "0 0 0 8px",
1148
- color: "#dc3545",
1149
- textDecoration: "none",
1150
- fontSize: "16px"
1151
- },
1152
- children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_fi2.FiX, { size: 14 })
1153
- }
1154
- )
1155
- ]
1156
- },
1157
- index
1158
- )) })
1159
- ] }) }),
1160
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_bootstrap15.Card, { style: { border: "none", boxShadow: "0 2px 8px rgba(0,0,0,0.05)" }, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_react_bootstrap15.Card.Body, { style: { padding: "20px" }, children: [
1161
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("h6", { className: "mb-3", style: { color: "#495057", fontWeight: "600" }, children: [
1162
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_fi2.FiUser, { className: "me-2", size: 16 }),
1163
- "E-mails de ",
1164
- companyName
1165
- ] }),
1166
- loading ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "text-center py-4", children: [
1167
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_bootstrap15.Spinner, {}),
1168
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "mt-2 text-muted", children: "Carregando e-mails..." })
1169
- ] }) : filteredEmails.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "text-center py-4", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "text-muted mb-0", children: searchFilter ? "Nenhum e-mail encontrado com esse filtro" : "Nenhum e-mail dispon\xEDvel" }) }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_bootstrap15.Row, { children: filteredEmails.map((email) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_bootstrap15.Col, { xs: 12, sm: 6, lg: 4, className: "mb-3", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1170
- import_react_bootstrap15.Card,
1171
- {
1172
- onClick: () => setSelectedEmails([...selectedEmails, email]),
1173
- style: {
1174
- cursor: "pointer",
1175
- border: "1px solid #e9ecef",
1176
- borderRadius: "10px",
1177
- transition: "all 0.2s ease",
1178
- backgroundColor: "#fff"
1179
- },
1180
- onMouseEnter: (e) => {
1181
- e.currentTarget.style.transform = "translateY(-2px)";
1182
- e.currentTarget.style.boxShadow = "0 4px 12px rgba(0,0,0,0.1)";
1183
- e.currentTarget.style.borderColor = "#007bff";
1184
- },
1185
- onMouseLeave: (e) => {
1186
- e.currentTarget.style.transform = "translateY(0)";
1187
- e.currentTarget.style.boxShadow = "none";
1188
- e.currentTarget.style.borderColor = "#e9ecef";
1189
- },
1190
- children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_react_bootstrap15.Card.Body, { style: { padding: "15px", textAlign: "center" }, children: [
1191
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_fi2.FiMail, { size: 20, color: "#007bff", className: "mb-2" }),
1192
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1193
- "div",
1194
- {
1195
- style: {
1196
- fontSize: "14px",
1197
- fontWeight: "500",
1198
- color: "#2c3e50",
1199
- wordBreak: "break-word"
1200
- },
1201
- children: email.email
1202
- }
1203
- )
1204
- ] })
1205
- }
1206
- ) }, email.email)) })
1207
- ] }) })
1208
- ] })
1209
- ]
1210
- }
1211
- );
1195
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "timer-display-container", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "timer-display-content", children: id ? /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
1196
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
1197
+ import_bi.BiTimer,
1198
+ {
1199
+ size: 24,
1200
+ className: "timer-icon",
1201
+ title: "Timer"
1202
+ }
1203
+ ),
1204
+ pausable && !isStopped && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
1205
+ import_bs.BsPause,
1206
+ {
1207
+ size: 20,
1208
+ className: "timer-icon-action",
1209
+ onClick: handlePause,
1210
+ title: "Pausar"
1211
+ }
1212
+ ),
1213
+ playable && !isStopped && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
1214
+ import_bs.BsPlay,
1215
+ {
1216
+ size: 20,
1217
+ className: "timer-icon-action",
1218
+ onClick: handlePlay,
1219
+ title: "Iniciar"
1220
+ }
1221
+ ),
1222
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "timer-display-time", children: formatDuration(tempo) })
1223
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "timer-display-message", children: emptyMessage }) }) });
1212
1224
  };
1213
1225
 
1226
+ // src/displays/RecursoDisplayer.tsx
1227
+ var import_react14 = require("react");
1228
+ var import_react_bootstrap19 = require("react-bootstrap");
1229
+
1230
+ // src/forms/FindRecursoByTagField.tsx
1231
+ var import_react13 = require("react");
1232
+ var import_gr4 = require("react-icons/gr");
1233
+
1214
1234
  // src/forms/AutoComplete.tsx
1215
1235
  var import_react10 = require("react");
1216
- var import_react_bootstrap16 = require("react-bootstrap");
1217
- var import_jsx_runtime19 = require("react/jsx-runtime");
1236
+ var import_react_bootstrap18 = require("react-bootstrap");
1237
+ var import_jsx_runtime26 = require("react/jsx-runtime");
1218
1238
  var AutoComplete = ({
1219
1239
  className,
1220
1240
  ops = [],
@@ -1346,7 +1366,7 @@ var AutoComplete = ({
1346
1366
  setInput(val);
1347
1367
  setHide(!canSearch && options.length === 0);
1348
1368
  };
1349
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
1369
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
1350
1370
  "div",
1351
1371
  {
1352
1372
  className,
@@ -1368,9 +1388,9 @@ var AutoComplete = ({
1368
1388
  },
1369
1389
  onMouseLeave: () => setHide(true),
1370
1390
  children: [
1371
- !hideComponent && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_react_bootstrap16.InputGroup, { children: [
1372
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_react_bootstrap16.FloatingLabel, { controlId: "floatingInput", label: title, style: { zIndex: 0, flex: 1 }, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1373
- import_react_bootstrap16.Form.Control,
1391
+ !hideComponent && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_react_bootstrap18.InputGroup, { children: [
1392
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_react_bootstrap18.FloatingLabel, { controlId: "floatingInput", label: title, style: { zIndex: 0, flex: 1 }, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
1393
+ import_react_bootstrap18.Form.Control,
1374
1394
  {
1375
1395
  autoFocus: autoFocusConfig,
1376
1396
  disabled: disableComponent || disableSelect,
@@ -1385,12 +1405,12 @@ var AutoComplete = ({
1385
1405
  type: "text"
1386
1406
  }
1387
1407
  ) }),
1388
- loading && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_react_bootstrap16.InputGroup.Text, { children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_react_bootstrap16.Spinner, { animation: "border", size: "sm" }) }),
1408
+ loading && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_react_bootstrap18.InputGroup.Text, { children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_react_bootstrap18.Spinner, { animation: "border", size: "sm" }) }),
1389
1409
  !disableComponent && (actionButton == null ? void 0 : actionButton(() => setInput(""))),
1390
1410
  !disableComponent && (actionButton2 == null ? void 0 : actionButton2(input))
1391
1411
  ] }),
1392
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1393
- import_react_bootstrap16.ListGroup,
1412
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
1413
+ import_react_bootstrap18.ListGroup,
1394
1414
  {
1395
1415
  className: "listgroup-autocomplete shadow-sm",
1396
1416
  hidden: hide || liItem.length === 0,
@@ -1404,8 +1424,8 @@ var AutoComplete = ({
1404
1424
  zIndex: 1050,
1405
1425
  backgroundColor: "#fff"
1406
1426
  },
1407
- children: (maxItems ? liItem.slice(0, maxItems) : liItem).map((li, index) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1408
- import_react_bootstrap16.ListGroup.Item,
1427
+ children: (maxItems ? liItem.slice(0, maxItems) : liItem).map((li, index) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
1428
+ import_react_bootstrap18.ListGroup.Item,
1409
1429
  {
1410
1430
  action: true,
1411
1431
  onClick: () => {
@@ -1425,93 +1445,968 @@ var AutoComplete = ({
1425
1445
  );
1426
1446
  };
1427
1447
 
1428
- // src/forms/GenericForm.tsx
1448
+ // src/qr/QrCodeScanButton.tsx
1449
+ var import_react12 = require("react");
1450
+ var import_bs2 = require("react-icons/bs");
1451
+
1452
+ // src/qr/QrReader.tsx
1453
+ var import_qr_scanner = __toESM(require("qr-scanner"));
1429
1454
  var import_react11 = require("react");
1430
- var import_react_bootstrap17 = require("react-bootstrap");
1431
- var import_jsx_runtime20 = require("react/jsx-runtime");
1432
- var GenericForm = ({ fields, onSubmit, renderCustomSelect }) => {
1433
- const [formValues, setFormValues] = (0, import_react11.useState)({});
1434
- const [errors, setErrors] = (0, import_react11.useState)({});
1435
- const handleChange = (key, value) => {
1436
- setFormValues({
1437
- ...formValues,
1438
- [key]: value
1439
- });
1440
- };
1441
- const validate = () => {
1442
- const newErrors = {};
1443
- fields.forEach((field) => {
1444
- if (field.required && !formValues[field.key]) {
1445
- newErrors[field.key] = `${field.label} \xE9 obrigat\xF3rio`;
1446
- }
1447
- });
1448
- setErrors(newErrors);
1449
- return Object.keys(newErrors).length === 0;
1455
+ var import_jsx_runtime27 = require("react/jsx-runtime");
1456
+ var QrReader = ({ callback }) => {
1457
+ const scanner = (0, import_react11.useRef)(null);
1458
+ const videoEl = (0, import_react11.useRef)(null);
1459
+ const qrBoxEl = (0, import_react11.useRef)(null);
1460
+ const [qrOn, setQrOn] = (0, import_react11.useState)(true);
1461
+ const [scannedResult, setScannedResult] = (0, import_react11.useState)("");
1462
+ const onScanSuccess = (result) => {
1463
+ setScannedResult(result.data);
1464
+ callback(result.data);
1450
1465
  };
1451
- const handleSubmit = (e) => {
1452
- e.preventDefault();
1453
- if (validate()) {
1454
- onSubmit(formValues);
1466
+ const onScanFail = (err) => {
1467
+ if (typeof err === "string" && !err.includes("No QR code found")) {
1468
+ console.error("QR Scanner Error:", err);
1455
1469
  }
1456
1470
  };
1457
- const renderField = (field) => {
1458
- const { label, key, type, options, placeholder } = field;
1459
- const value = formValues[key] || "";
1460
- switch (type) {
1461
- case "text":
1462
- case "number":
1463
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_react_bootstrap17.Form.Group, { className: "mb-3", children: [
1464
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react_bootstrap17.Form.Label, { children: label }),
1465
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
1466
- import_react_bootstrap17.Form.Control,
1467
- {
1468
- type,
1469
- placeholder,
1470
- value,
1471
- onChange: (e) => handleChange(key, e.target.value),
1472
- isInvalid: !!errors[key]
1473
- }
1474
- ),
1475
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react_bootstrap17.Form.Control.Feedback, { type: "invalid", children: errors[key] })
1476
- ] }, key);
1477
- case "select": {
1478
- const orderedOptions = (options || []).filter((opt) => opt && opt.value !== void 0 && opt.label !== void 0).sort((a, b) => a.label.localeCompare(b.label));
1479
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_react_bootstrap17.Form.Group, { className: "mb-3", children: [
1480
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react_bootstrap17.Form.Label, { children: label }),
1481
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
1482
- import_react_bootstrap17.Form.Select,
1483
- {
1484
- value,
1485
- onChange: (e) => handleChange(key, e.target.value),
1486
- isInvalid: !!errors[key],
1487
- children: [
1488
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: "", children: "Selecione..." }),
1489
- orderedOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: option.value, children: option.label }, String(option.value)))
1490
- ]
1491
- }
1492
- ),
1493
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react_bootstrap17.Form.Control.Feedback, { type: "invalid", children: errors[key] })
1494
- ] }, key);
1495
- }
1496
- case "custom-select":
1497
- if (renderCustomSelect) {
1498
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { children: [
1499
- renderCustomSelect({
1500
- label,
1501
- value,
1502
- options,
1503
- onChange: (v) => handleChange(key, v),
1504
- placeholder
1505
- }),
1506
- errors[key] && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "invalid-feedback d-block", children: errors[key] })
1507
- ] }, key);
1508
- }
1471
+ (0, import_react11.useEffect)(() => {
1472
+ if (videoEl.current && !scanner.current) {
1473
+ scanner.current = new import_qr_scanner.default(videoEl.current, onScanSuccess, {
1474
+ onDecodeError: onScanFail,
1475
+ preferredCamera: "environment",
1476
+ highlightScanRegion: true,
1477
+ highlightCodeOutline: true,
1478
+ overlay: qrBoxEl.current || void 0
1479
+ });
1480
+ scanner.current.start().then(() => setQrOn(true)).catch((err) => {
1481
+ console.error("Failed to start QR Scanner:", err);
1482
+ setQrOn(false);
1483
+ });
1484
+ }
1485
+ return () => {
1486
+ if (scanner.current) {
1487
+ scanner.current.stop();
1488
+ scanner.current.destroy();
1489
+ scanner.current = null;
1490
+ }
1491
+ };
1492
+ }, []);
1493
+ (0, import_react11.useEffect)(() => {
1494
+ if (!qrOn) {
1495
+ alert(
1496
+ "C\xE2mera est\xE1 bloqueada ou inacess\xEDvel. Por favor, habilite a c\xE2mera nas permiss\xF5es do seu navegador e recarregue a p\xE1gina."
1497
+ );
1498
+ }
1499
+ }, [qrOn]);
1500
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "qr-reader", style: { position: "relative", width: "100%", maxWidth: "500px", margin: "0 auto" }, children: [
1501
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("video", { ref: videoEl, style: { width: "100%", borderRadius: "8px" } }),
1502
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { ref: qrBoxEl, className: "qr-box" }),
1503
+ scannedResult && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
1504
+ "div",
1505
+ {
1506
+ style: {
1507
+ position: "absolute",
1508
+ top: 10,
1509
+ left: 10,
1510
+ zIndex: 10,
1511
+ background: "rgba(0,0,0,0.6)",
1512
+ color: "white",
1513
+ padding: "4px 8px",
1514
+ borderRadius: "4px",
1515
+ fontSize: "0.8rem"
1516
+ },
1517
+ children: [
1518
+ "Lido: ",
1519
+ scannedResult
1520
+ ]
1521
+ }
1522
+ )
1523
+ ] });
1524
+ };
1525
+
1526
+ // src/qr/QrCodeScanButton.tsx
1527
+ var import_jsx_runtime28 = require("react/jsx-runtime");
1528
+ var QrCodeScanButton = ({ callback, size = 25 }) => {
1529
+ const [showQr, setShowQr] = (0, import_react12.useState)(false);
1530
+ const toggleQr = () => {
1531
+ setShowQr((prev) => !prev);
1532
+ };
1533
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
1534
+ "div",
1535
+ {
1536
+ className: "hoverable-div",
1537
+ style: {
1538
+ border: "solid",
1539
+ borderTopRightRadius: "3px",
1540
+ borderBottomRightRadius: "3px",
1541
+ padding: "8px",
1542
+ borderLeft: "none",
1543
+ borderColor: "#ccc",
1544
+ borderWidth: "1px",
1545
+ cursor: "pointer",
1546
+ display: "flex",
1547
+ alignItems: "center"
1548
+ },
1549
+ onClick: toggleQr,
1550
+ children: [
1551
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_bs2.BsQrCode, { size }),
1552
+ showQr && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
1553
+ "div",
1554
+ {
1555
+ style: {
1556
+ position: "fixed",
1557
+ top: 0,
1558
+ left: 0,
1559
+ right: 0,
1560
+ bottom: 0,
1561
+ backgroundColor: "rgba(0,0,0,0.8)",
1562
+ zIndex: 9999,
1563
+ display: "flex",
1564
+ flexDirection: "column",
1565
+ alignItems: "center",
1566
+ justifyContent: "center",
1567
+ padding: "20px"
1568
+ },
1569
+ onClick: (e) => e.stopPropagation(),
1570
+ children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { style: { width: "100%", maxWidth: "500px", backgroundColor: "#fff", borderRadius: "12px", padding: "20px", position: "relative" }, children: [
1571
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
1572
+ "div",
1573
+ {
1574
+ onClick: toggleQr,
1575
+ style: { position: "absolute", top: "10px", right: "15px", fontSize: "1.5rem", cursor: "pointer", zIndex: 10001 },
1576
+ children: "\xD7"
1577
+ }
1578
+ ),
1579
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("h5", { className: "mb-3 text-center", children: "Escaneie o QR Code" }),
1580
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
1581
+ QrReader,
1582
+ {
1583
+ callback: (v) => {
1584
+ toggleQr();
1585
+ callback(v);
1586
+ }
1587
+ }
1588
+ ),
1589
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { className: "mt-3 text-muted text-center small", children: "Aponte a c\xE2mera para o c\xF3digo" })
1590
+ ] })
1591
+ }
1592
+ )
1593
+ ]
1594
+ }
1595
+ );
1596
+ };
1597
+
1598
+ // src/forms/FindRecursoByTagField.tsx
1599
+ var import_jsx_runtime29 = require("react/jsx-runtime");
1600
+ var FindRecursoByTagField = ({ callback, recursoController }) => {
1601
+ const [selectedTag, setSelectedTag] = (0, import_react13.useState)("");
1602
+ const [reachedRecurso, setReachedRecurso] = (0, import_react13.useState)(null);
1603
+ const findRecursoByTagIdHandler = async (tagId) => {
1604
+ if (!recursoController) return;
1605
+ try {
1606
+ const r = await recursoController.read("findRecursoByTagId", tagId);
1607
+ setReachedRecurso(r);
1608
+ } catch (error) {
1609
+ console.error("Erro ao buscar recurso por tag ID:", error);
1610
+ }
1611
+ };
1612
+ const findRecursoByTagDescriptionHandler = async (description) => {
1613
+ if (!recursoController) return;
1614
+ try {
1615
+ const formattedDescription = description.replace(/\s/g, "");
1616
+ const recurso = await recursoController.read(
1617
+ `recurso/findByTagDescription`,
1618
+ formattedDescription
1619
+ );
1620
+ if (!callback) {
1621
+ console.log("Recurso encontrado (sem callback):", recurso);
1622
+ } else {
1623
+ callback(recurso, true);
1624
+ }
1625
+ } catch (error) {
1626
+ console.error("Erro ao buscar recurso por descri\xE7\xE3o de tag:", error);
1627
+ }
1628
+ };
1629
+ const confirmRecursoSelectionButton = () => {
1630
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
1631
+ "div",
1632
+ {
1633
+ className: "hoverable-div",
1634
+ style: {
1635
+ border: "solid",
1636
+ borderTopRightRadius: "3px",
1637
+ borderBottomRightRadius: "3px",
1638
+ padding: "8px",
1639
+ borderLeft: "none",
1640
+ borderColor: "#ccc",
1641
+ borderWidth: "1px",
1642
+ cursor: "pointer",
1643
+ display: "flex",
1644
+ alignItems: "center"
1645
+ },
1646
+ children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
1647
+ import_gr4.GrCheckmark,
1648
+ {
1649
+ size: 25,
1650
+ onClick: () => reachedRecurso && callback(reachedRecurso, true)
1651
+ }
1652
+ )
1653
+ }
1654
+ );
1655
+ };
1656
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
1657
+ AutoComplete,
1658
+ {
1659
+ sortKey: "id",
1660
+ loadCondition: true,
1661
+ loadFunc: () => {
1662
+ var _a;
1663
+ return (_a = recursoController == null ? void 0 : recursoController.get("findActiveRecursosTags")) != null ? _a : Promise.resolve([]);
1664
+ },
1665
+ displayKey: "descricao",
1666
+ title: "Selecione ou Digite a TAG",
1667
+ actionButton: confirmRecursoSelectionButton,
1668
+ actionButton2: () => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
1669
+ QrCodeScanButton,
1670
+ {
1671
+ callback: (description) => findRecursoByTagDescriptionHandler(description)
1672
+ }
1673
+ ),
1674
+ onSelectedClick: (v) => {
1675
+ setSelectedTag(v);
1676
+ findRecursoByTagIdHandler(v.id);
1677
+ },
1678
+ value: (selectedTag == null ? void 0 : selectedTag.descricao) || ""
1679
+ }
1680
+ ) });
1681
+ };
1682
+
1683
+ // src/displays/RecursoDisplayer.tsx
1684
+ var import_jsx_runtime30 = require("react/jsx-runtime");
1685
+ var RecursoDisplayer = ({
1686
+ mode = "manutencao",
1687
+ controller,
1688
+ selectedList = [],
1689
+ onSaveRecurso,
1690
+ singleReturn = false
1691
+ }) => {
1692
+ const [selectorDisplay, setSelectorDisplay] = (0, import_react14.useState)("branch");
1693
+ const [loading, setLoading] = (0, import_react14.useState)(false);
1694
+ const [recursosProcesso, setRecursosProcesso] = (0, import_react14.useState)([]);
1695
+ const [branchesManutencao, setBranchesManutencao] = (0, import_react14.useState)([]);
1696
+ (0, import_react14.useEffect)(() => {
1697
+ let mounted = true;
1698
+ const loadInicial = async () => {
1699
+ setLoading(true);
1700
+ try {
1701
+ if (mode === "manutencao") {
1702
+ const b = await controller("arvoreEstrutural").get(`branchByBranchLevel/1`);
1703
+ if (mounted) setBranchesManutencao(b);
1704
+ } else if (mode === "processo") {
1705
+ const recs = await controller("recurso").readAll();
1706
+ if (mounted) setRecursosProcesso(Array.isArray(recs) ? recs : []);
1707
+ }
1708
+ } catch (err) {
1709
+ console.error("Erro ao carregar estrutura do RecursoDisplayer", err);
1710
+ } finally {
1711
+ if (mounted) setLoading(false);
1712
+ }
1713
+ };
1714
+ loadInicial();
1715
+ return () => {
1716
+ mounted = false;
1717
+ };
1718
+ }, [mode, controller]);
1719
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { style: { width: "100%", padding: 0 }, className: "recurso-displayer-generic", children: [
1720
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "d-flex justify-content-between align-items-center mb-3", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { children: [
1721
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("label", { className: "me-2", children: "Selecionar Recurso Por:" }),
1722
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
1723
+ import_react_bootstrap19.Button,
1724
+ {
1725
+ size: "sm",
1726
+ onClick: () => setSelectorDisplay("branch"),
1727
+ variant: selectorDisplay === "branch" ? "primary" : "outline-primary",
1728
+ className: "me-1",
1729
+ children: mode === "processo" ? "Agrupamentos" : "\xC1rvore"
1730
+ }
1731
+ ),
1732
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
1733
+ import_react_bootstrap19.Button,
1734
+ {
1735
+ size: "sm",
1736
+ onClick: () => setSelectorDisplay("TAG"),
1737
+ variant: selectorDisplay === "TAG" ? "primary" : "outline-primary",
1738
+ children: "TAG"
1739
+ }
1740
+ )
1741
+ ] }) }),
1742
+ loading && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_react_bootstrap19.Spinner, { animation: "border", size: "sm" }),
1743
+ !loading && selectorDisplay === "branch" && mode === "manutencao" && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "manutencao-tree-view", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "text-muted small italic", children: "\xC1rvore de Manuten\xE7\xE3o (Branches/Nodes em Cascata) - Implementa\xE7\xE3o Gen\xE9rica" }) }),
1744
+ !loading && selectorDisplay === "branch" && mode === "processo" && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "processo-group-view", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "text-muted small italic", children: "Lista de Agrupamentos de Processo (Raiz \xDAnica)" }) }),
1745
+ selectorDisplay === "TAG" && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
1746
+ FindRecursoByTagField,
1747
+ {
1748
+ callback: (rec, checked) => {
1749
+ onSaveRecurso([rec]);
1750
+ }
1751
+ }
1752
+ )
1753
+ ] });
1754
+ };
1755
+
1756
+ // src/filters/StatusPills.tsx
1757
+ var import_jsx_runtime31 = require("react/jsx-runtime");
1758
+ var StatusPills = ({
1759
+ statuses,
1760
+ activeKeys,
1761
+ onSelectionChange,
1762
+ multiSelect = true,
1763
+ className = ""
1764
+ }) => {
1765
+ const toggleKey = (key) => {
1766
+ const isActive = activeKeys.includes(key);
1767
+ if (multiSelect) {
1768
+ if (isActive) {
1769
+ onSelectionChange(activeKeys.filter((k) => k !== key));
1770
+ } else {
1771
+ onSelectionChange([...activeKeys, key]);
1772
+ }
1773
+ } else {
1774
+ onSelectionChange(isActive ? [] : [key]);
1775
+ }
1776
+ };
1777
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: `status-pills-container ${className}`, children: Object.entries(statuses).map(([key, meta]) => {
1778
+ const isActive = activeKeys.includes(key);
1779
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
1780
+ "button",
1781
+ {
1782
+ type: "button",
1783
+ className: `status-pill ${isActive ? "active" : ""}`,
1784
+ style: { "--status-color": meta.color },
1785
+ onClick: () => toggleKey(key),
1786
+ "aria-pressed": isActive,
1787
+ children: [
1788
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "status-pill__swatch" }),
1789
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "status-pill__label", children: meta.label }),
1790
+ meta.count !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "status-pill__count", children: meta.count })
1791
+ ]
1792
+ },
1793
+ key
1794
+ );
1795
+ }) });
1796
+ };
1797
+
1798
+ // src/filters/PeriodSelector.tsx
1799
+ var import_react15 = require("react");
1800
+ var import_react_bootstrap20 = require("react-bootstrap");
1801
+ var import_fa3 = require("react-icons/fa");
1802
+ var import_dayjs3 = __toESM(require("dayjs"));
1803
+ var import_jsx_runtime32 = require("react/jsx-runtime");
1804
+ var PeriodSelector = ({
1805
+ startDate,
1806
+ endDate,
1807
+ onStartDateChange,
1808
+ onEndDateChange,
1809
+ onPresetSelect,
1810
+ label = "Per\xEDodo",
1811
+ allowFuture = false,
1812
+ className = ""
1813
+ }) => {
1814
+ const [isExpanded, setIsExpanded] = (0, import_react15.useState)(false);
1815
+ const formatDisplayRange = (start, end) => {
1816
+ const s = (0, import_dayjs3.default)(start).format("DD/MM/YY HH:mm");
1817
+ const e = (0, import_dayjs3.default)(end).format("DD/MM/YY HH:mm");
1818
+ return `${s} at\xE9 ${e}`;
1819
+ };
1820
+ const maxDate = allowFuture ? void 0 : (0, import_dayjs3.default)().format("YYYY-MM-DDTHH:mm");
1821
+ const presets = [
1822
+ { key: "today", label: "Hoje" },
1823
+ { key: "week", label: "\xDAltima Semana" },
1824
+ { key: "fortnight", label: "Quinzena" },
1825
+ { key: "month", label: "\xDAltimo M\xEAs" },
1826
+ { key: "year", label: "\xDAltimo Ano" }
1827
+ ];
1828
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_react_bootstrap20.Card, { className: `period-selector-card ${isExpanded ? "expanded" : ""} ${className}`, children: [
1829
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "compact-row", onClick: () => setIsExpanded(!isExpanded), children: [
1830
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "d-flex align-items-center", children: [
1831
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_fa3.FaCalendarAlt, { className: "me-2 text-primary" }),
1832
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "date-range-text", children: isExpanded ? label : formatDisplayRange(startDate, endDate) })
1833
+ ] }),
1834
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "period-icon-btn", children: isExpanded ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_fa3.FaChevronUp, {}) : /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "small text-muted", children: "Editar" }) })
1835
+ ] }),
1836
+ isExpanded && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "expanded-content", children: [
1837
+ onPresetSelect && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "presets-container", children: [
1838
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "d-flex align-items-center mb-1 w-100", children: [
1839
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_fa3.FaHistory, { size: 12, className: "me-1 text-muted" }),
1840
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("small", { className: "text-muted fw-bold text-uppercase", style: { fontSize: "0.65rem" }, children: "Atalhos" })
1841
+ ] }),
1842
+ presets.map((p) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
1843
+ import_react_bootstrap20.Button,
1844
+ {
1845
+ variant: "outline-primary",
1846
+ className: "preset-btn",
1847
+ onClick: (e) => {
1848
+ e.stopPropagation();
1849
+ onPresetSelect(p.key);
1850
+ },
1851
+ children: p.label
1852
+ },
1853
+ p.key
1854
+ ))
1855
+ ] }),
1856
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "date-inputs-grid", children: [
1857
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_react_bootstrap20.Form.Group, { children: [
1858
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_react_bootstrap20.Form.Label, { className: "small text-muted", children: "In\xEDcio" }),
1859
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
1860
+ import_react_bootstrap20.Form.Control,
1861
+ {
1862
+ type: "datetime-local",
1863
+ size: "sm",
1864
+ value: startDate,
1865
+ max: maxDate,
1866
+ onChange: (e) => onStartDateChange(e.target.value)
1867
+ }
1868
+ )
1869
+ ] }),
1870
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_react_bootstrap20.Form.Group, { children: [
1871
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_react_bootstrap20.Form.Label, { className: "small text-muted", children: "Fim" }),
1872
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
1873
+ import_react_bootstrap20.Form.Control,
1874
+ {
1875
+ type: "datetime-local",
1876
+ size: "sm",
1877
+ value: endDate,
1878
+ min: startDate,
1879
+ max: maxDate,
1880
+ onChange: (e) => onEndDateChange(e.target.value)
1881
+ }
1882
+ )
1883
+ ] })
1884
+ ] }),
1885
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "mt-3 d-flex justify-content-end", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
1886
+ import_react_bootstrap20.Button,
1887
+ {
1888
+ variant: "primary",
1889
+ size: "sm",
1890
+ onClick: () => setIsExpanded(false),
1891
+ children: "Aplicar"
1892
+ }
1893
+ ) })
1894
+ ] })
1895
+ ] });
1896
+ };
1897
+
1898
+ // src/filters/AdvancedFilterBar.tsx
1899
+ var import_react16 = require("react");
1900
+ var import_react_bootstrap21 = require("react-bootstrap");
1901
+ var import_fi2 = require("react-icons/fi");
1902
+ var import_jsx_runtime33 = require("react/jsx-runtime");
1903
+ var AdvancedFilterBar = ({
1904
+ children,
1905
+ title = "Filtros e Busca",
1906
+ activeFiltersCount = 0,
1907
+ onClearAll,
1908
+ defaultExpanded = false,
1909
+ className = ""
1910
+ }) => {
1911
+ const [expanded, setExpanded] = (0, import_react16.useState)(defaultExpanded);
1912
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: `advanced-filter-bar ${className}`, children: [
1913
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
1914
+ "div",
1915
+ {
1916
+ className: "filter-bar-header",
1917
+ onClick: () => setExpanded(!expanded),
1918
+ children: [
1919
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "filter-title-group", children: [
1920
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_fi2.FiFilter, { className: "text-primary" }),
1921
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("h5", { className: "filter-title", children: title }),
1922
+ activeFiltersCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("span", { className: "filter-count-badge", children: [
1923
+ activeFiltersCount,
1924
+ " ativos"
1925
+ ] })
1926
+ ] }),
1927
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "filter-chevron", children: expanded ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_fi2.FiChevronUp, { size: 20 }) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_fi2.FiChevronDown, { size: 20 }) })
1928
+ ]
1929
+ }
1930
+ ),
1931
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react_bootstrap21.Collapse, { in: expanded, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "filter-bar-content", children: [
1932
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "filter-grid", children }),
1933
+ (onClearAll || activeFiltersCount > 0) && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "filter-actions", children: [
1934
+ onClearAll && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
1935
+ import_react_bootstrap21.Button,
1936
+ {
1937
+ variant: "link",
1938
+ className: "text-danger text-decoration-none btn-sm d-flex align-items-center",
1939
+ onClick: (e) => {
1940
+ e.stopPropagation();
1941
+ onClearAll();
1942
+ },
1943
+ children: [
1944
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_fi2.FiTrash2, { className: "me-1" }),
1945
+ "Limpar Filtros"
1946
+ ]
1947
+ }
1948
+ ),
1949
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
1950
+ import_react_bootstrap21.Button,
1951
+ {
1952
+ variant: "primary",
1953
+ size: "sm",
1954
+ onClick: () => setExpanded(false),
1955
+ children: "Aplicar Filtros"
1956
+ }
1957
+ )
1958
+ ] })
1959
+ ] }) }) })
1960
+ ] });
1961
+ };
1962
+
1963
+ // src/forms/MailSender.tsx
1964
+ var import_react17 = require("react");
1965
+ var import_react_bootstrap22 = require("react-bootstrap");
1966
+ var import_fi3 = require("react-icons/fi");
1967
+ var import_jsx_runtime34 = require("react/jsx-runtime");
1968
+ var MailSender = ({
1969
+ htmlContent,
1970
+ companyName,
1971
+ onFetchEmails,
1972
+ onSendEmail,
1973
+ hide = false,
1974
+ renderTrigger
1975
+ }) => {
1976
+ const [opened, setOpened] = (0, import_react17.useState)(false);
1977
+ const [addingEmail, setAddingEmail] = (0, import_react17.useState)(false);
1978
+ const [selectedEmails, setSelectedEmails] = (0, import_react17.useState)([]);
1979
+ const [emails, setEmails] = (0, import_react17.useState)([]);
1980
+ const [loading, setLoading] = (0, import_react17.useState)(false);
1981
+ const [postLoading, setPostLoading] = (0, import_react17.useState)(false);
1982
+ const [customEmail, setCustomEmail] = (0, import_react17.useState)("");
1983
+ const [emailError, setEmailError] = (0, import_react17.useState)("");
1984
+ const [searchFilter, setSearchFilter] = (0, import_react17.useState)("");
1985
+ const handleOpen = async () => {
1986
+ setLoading(true);
1987
+ try {
1988
+ const data = await onFetchEmails();
1989
+ setEmails(data || []);
1990
+ setOpened(true);
1991
+ } catch (err) {
1992
+ console.error("Erro ao buscar e-mails:", err);
1993
+ } finally {
1994
+ setLoading(false);
1995
+ }
1996
+ };
1997
+ const mailListLinter = () => {
1998
+ const result = [];
1999
+ const seen = /* @__PURE__ */ new Set();
2000
+ if (emails) {
2001
+ for (const item of emails) {
2002
+ if (item.email && !seen.has(item.email)) {
2003
+ seen.add(item.email);
2004
+ result.push({ email: item.email });
2005
+ }
2006
+ }
2007
+ }
2008
+ return result;
2009
+ };
2010
+ const filteredEmails = emails ? mailListLinter().filter(
2011
+ (email) => email.email.toLowerCase().includes(searchFilter.toLowerCase()) && !selectedEmails.some((selected) => (selected.email || selected) === email.email)
2012
+ ) : [];
2013
+ const sendEmail = async () => {
2014
+ const emailString = selectedEmails.map((email) => email.email ? email.email : email).join(", ");
2015
+ const emailData = {
2016
+ to: emailString,
2017
+ subject: `Relat\xF3rio - ${companyName}`,
2018
+ text: `Relat\xF3rio de processo da empresa ${companyName}`,
2019
+ html: htmlContent
2020
+ };
2021
+ setPostLoading(true);
2022
+ try {
2023
+ await onSendEmail(emailData);
2024
+ setSelectedEmails([]);
2025
+ setCustomEmail("");
2026
+ setOpened(false);
2027
+ } catch (err) {
2028
+ console.error("Erro ao enviar e-mail:", err);
2029
+ } finally {
2030
+ setPostLoading(false);
2031
+ }
2032
+ };
2033
+ const validateEmail = (email) => {
2034
+ const re = /\S+@\S+\.\S+/;
2035
+ return re.test(email);
2036
+ };
2037
+ const handleEmailAdd = () => {
2038
+ if (!customEmail.trim()) {
2039
+ setEmailError("Por favor, digite um e-mail");
2040
+ return;
2041
+ }
2042
+ if (!validateEmail(customEmail)) {
2043
+ setEmailError("Formato de e-mail inv\xE1lido");
2044
+ return;
2045
+ }
2046
+ if (selectedEmails.some((email) => (email.email || email) === customEmail)) {
2047
+ setEmailError("Este e-mail j\xE1 foi selecionado");
2048
+ return;
2049
+ }
2050
+ setSelectedEmails([...selectedEmails, customEmail]);
2051
+ setCustomEmail("");
2052
+ setEmailError("");
2053
+ setAddingEmail(false);
2054
+ };
2055
+ const handleEmailRemove = (emailToRemove) => {
2056
+ setSelectedEmails(
2057
+ selectedEmails.filter(
2058
+ (email) => (email.email || email) !== (emailToRemove.email || emailToRemove)
2059
+ )
2060
+ );
2061
+ };
2062
+ if (hide) return null;
2063
+ if (!opened) {
2064
+ if (renderTrigger) {
2065
+ return renderTrigger({ onClick: handleOpen, loading });
2066
+ }
2067
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_react_bootstrap22.Button, { disabled: loading, className: "w-100", onClick: handleOpen, children: loading ? "Carregando..." : "Enviar por E-mail" });
2068
+ }
2069
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
2070
+ "div",
2071
+ {
2072
+ style: {
2073
+ backgroundColor: "#f8f9fa",
2074
+ borderRadius: "12px",
2075
+ overflow: "hidden",
2076
+ border: "1px solid #dee2e6",
2077
+ boxShadow: "0 4px 6px rgba(0, 0, 0, 0.1)"
2078
+ },
2079
+ children: [
2080
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
2081
+ "div",
2082
+ {
2083
+ style: {
2084
+ background: "linear-gradient(135deg, #28a745 0%, #20c997 100%)",
2085
+ color: "white",
2086
+ padding: "25px"
2087
+ },
2088
+ children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "d-flex justify-content-between align-items-center", children: [
2089
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { children: [
2090
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("h4", { className: "mb-1", style: { fontWeight: "600", fontSize: "22px" }, children: [
2091
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_fi3.FiMail, { className: "me-2", size: 20 }),
2092
+ "Enviar Relat\xF3rio por E-mail"
2093
+ ] }),
2094
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("small", { style: { opacity: "0.9", fontSize: "14px" }, children: [
2095
+ "Selecione os destinat\xE1rios para envio do relat\xF3rio de ",
2096
+ companyName
2097
+ ] })
2098
+ ] }),
2099
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "d-flex gap-2", children: [
2100
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
2101
+ import_react_bootstrap22.Button,
2102
+ {
2103
+ variant: "light",
2104
+ onClick: sendEmail,
2105
+ disabled: selectedEmails.length === 0 || postLoading,
2106
+ style: {
2107
+ borderRadius: "8px",
2108
+ fontWeight: "600",
2109
+ minWidth: "130px",
2110
+ height: "40px"
2111
+ },
2112
+ children: postLoading ? /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
2113
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_react_bootstrap22.Spinner, { size: "sm", className: "me-2" }),
2114
+ "Enviando..."
2115
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
2116
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_fi3.FiSend, { className: "me-2", size: 14 }),
2117
+ "Enviar E-mail"
2118
+ ] })
2119
+ }
2120
+ ),
2121
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
2122
+ import_react_bootstrap22.Button,
2123
+ {
2124
+ variant: "outline-light",
2125
+ onClick: () => setOpened(false),
2126
+ disabled: postLoading,
2127
+ style: { borderRadius: "8px", width: "40px", height: "40px" },
2128
+ children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_fi3.FiX, { size: 16 })
2129
+ }
2130
+ )
2131
+ ] })
2132
+ ] })
2133
+ }
2134
+ ),
2135
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { style: { padding: "25px" }, children: [
2136
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_react_bootstrap22.Card, { className: "mb-4", style: { border: "none", boxShadow: "0 2px 8px rgba(0,0,0,0.05)" }, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_react_bootstrap22.Card.Body, { style: { padding: "20px" }, children: [
2137
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_react_bootstrap22.Row, { className: "align-items-center", children: [
2138
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_react_bootstrap22.Col, { md: 6, children: [
2139
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("h6", { className: "mb-2", style: { color: "#495057", fontWeight: "600" }, children: "\u{1F527} Filtros e A\xE7\xF5es" }),
2140
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_react_bootstrap22.InputGroup, { style: { maxWidth: "300px" }, children: [
2141
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_react_bootstrap22.InputGroup.Text, { style: { backgroundColor: "#f8f9fa", border: "1px solid #dee2e6" }, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_fi3.FiSearch, { size: 14, color: "#6c757d" }) }),
2142
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
2143
+ import_react_bootstrap22.Form.Control,
2144
+ {
2145
+ type: "text",
2146
+ placeholder: "Buscar e-mails...",
2147
+ value: searchFilter,
2148
+ onChange: (e) => setSearchFilter(e.target.value),
2149
+ style: { border: "1px solid #dee2e6" }
2150
+ }
2151
+ )
2152
+ ] })
2153
+ ] }),
2154
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_react_bootstrap22.Col, { md: 6, className: "text-end", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
2155
+ import_react_bootstrap22.Button,
2156
+ {
2157
+ variant: addingEmail ? "outline-secondary" : "outline-primary",
2158
+ size: "sm",
2159
+ onClick: () => setAddingEmail(!addingEmail),
2160
+ disabled: postLoading,
2161
+ style: { borderRadius: "8px" },
2162
+ children: addingEmail ? /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
2163
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_fi3.FiX, { className: "me-1", size: 14 }),
2164
+ "Cancelar"
2165
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
2166
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_fi3.FiPlus, { className: "me-1", size: 14 }),
2167
+ "E-mail Personalizado"
2168
+ ] })
2169
+ }
2170
+ ) })
2171
+ ] }),
2172
+ addingEmail && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
2173
+ "div",
2174
+ {
2175
+ style: {
2176
+ marginTop: "20px",
2177
+ padding: "20px",
2178
+ backgroundColor: "#f8f9ff",
2179
+ borderRadius: "8px",
2180
+ border: "1px solid #e3f2fd"
2181
+ },
2182
+ children: [
2183
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("h6", { className: "mb-3", style: { color: "#1976d2", fontWeight: "600" }, children: "\u2709\uFE0F Adicionar E-mail Personalizado" }),
2184
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_react_bootstrap22.Row, { className: "align-items-end", children: [
2185
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_react_bootstrap22.Col, { md: 8, children: [
2186
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_react_bootstrap22.Form.Label, { style: { fontSize: "13px", color: "#6c757d", fontWeight: "500" }, children: "Endere\xE7o de E-mail" }),
2187
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
2188
+ import_react_bootstrap22.Form.Control,
2189
+ {
2190
+ type: "email",
2191
+ placeholder: "exemplo@empresa.com",
2192
+ value: customEmail,
2193
+ onChange: (e) => {
2194
+ setCustomEmail(e.target.value);
2195
+ if (emailError) setEmailError("");
2196
+ },
2197
+ isInvalid: !!emailError,
2198
+ disabled: postLoading,
2199
+ style: { borderRadius: "8px" },
2200
+ onKeyPress: (e) => e.key === "Enter" && handleEmailAdd()
2201
+ }
2202
+ ),
2203
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_react_bootstrap22.Form.Control.Feedback, { type: "invalid", children: emailError })
2204
+ ] }),
2205
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_react_bootstrap22.Col, { md: 4, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
2206
+ import_react_bootstrap22.Button,
2207
+ {
2208
+ variant: "success",
2209
+ onClick: handleEmailAdd,
2210
+ disabled: postLoading,
2211
+ style: { borderRadius: "8px", width: "100%" },
2212
+ children: [
2213
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_fi3.FiPlus, { className: "me-1", size: 14 }),
2214
+ "Adicionar"
2215
+ ]
2216
+ }
2217
+ ) })
2218
+ ] })
2219
+ ]
2220
+ }
2221
+ )
2222
+ ] }) }),
2223
+ selectedEmails.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_react_bootstrap22.Card, { className: "mb-4", style: { border: "none", boxShadow: "0 2px 8px rgba(0,0,0,0.05)" }, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_react_bootstrap22.Card.Body, { style: { padding: "20px" }, children: [
2224
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "d-flex justify-content-between align-items-center mb-3", children: [
2225
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("h6", { className: "mb-0", style: { color: "#495057", fontWeight: "600" }, children: "\u{1F4CB} Destinat\xE1rios Selecionados" }),
2226
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_react_bootstrap22.Badge, { bg: "primary", style: { fontSize: "12px", padding: "6px 12px" }, children: [
2227
+ selectedEmails.length,
2228
+ " selecionado",
2229
+ selectedEmails.length > 1 ? "s" : ""
2230
+ ] })
2231
+ ] }),
2232
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "d-flex flex-wrap gap-2", children: selectedEmails.map((email, index) => /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
2233
+ "div",
2234
+ {
2235
+ style: {
2236
+ background: "linear-gradient(135deg, #e3f2fd 0%, #f3e5f5 100%)",
2237
+ border: "1px solid #bbdefb",
2238
+ borderRadius: "20px",
2239
+ padding: "8px 15px",
2240
+ display: "flex",
2241
+ alignItems: "center",
2242
+ fontSize: "14px",
2243
+ fontWeight: "500"
2244
+ },
2245
+ children: [
2246
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_fi3.FiUser, { size: 12, className: "me-2", color: "#1976d2" }),
2247
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { children: email.email || email }),
2248
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
2249
+ import_react_bootstrap22.Button,
2250
+ {
2251
+ variant: "link",
2252
+ size: "sm",
2253
+ onClick: () => handleEmailRemove(email),
2254
+ disabled: postLoading,
2255
+ style: {
2256
+ padding: "0 0 0 8px",
2257
+ color: "#dc3545",
2258
+ textDecoration: "none",
2259
+ fontSize: "16px"
2260
+ },
2261
+ children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_fi3.FiX, { size: 14 })
2262
+ }
2263
+ )
2264
+ ]
2265
+ },
2266
+ index
2267
+ )) })
2268
+ ] }) }),
2269
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_react_bootstrap22.Card, { style: { border: "none", boxShadow: "0 2px 8px rgba(0,0,0,0.05)" }, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_react_bootstrap22.Card.Body, { style: { padding: "20px" }, children: [
2270
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("h6", { className: "mb-3", style: { color: "#495057", fontWeight: "600" }, children: [
2271
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_fi3.FiUser, { className: "me-2", size: 16 }),
2272
+ "E-mails de ",
2273
+ companyName
2274
+ ] }),
2275
+ loading ? /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "text-center py-4", children: [
2276
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_react_bootstrap22.Spinner, {}),
2277
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("p", { className: "mt-2 text-muted", children: "Carregando e-mails..." })
2278
+ ] }) : filteredEmails.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "text-center py-4", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("p", { className: "text-muted mb-0", children: searchFilter ? "Nenhum e-mail encontrado com esse filtro" : "Nenhum e-mail dispon\xEDvel" }) }) : /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_react_bootstrap22.Row, { children: filteredEmails.map((email) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_react_bootstrap22.Col, { xs: 12, sm: 6, lg: 4, className: "mb-3", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
2279
+ import_react_bootstrap22.Card,
2280
+ {
2281
+ onClick: () => setSelectedEmails([...selectedEmails, email]),
2282
+ style: {
2283
+ cursor: "pointer",
2284
+ border: "1px solid #e9ecef",
2285
+ borderRadius: "10px",
2286
+ transition: "all 0.2s ease",
2287
+ backgroundColor: "#fff"
2288
+ },
2289
+ onMouseEnter: (e) => {
2290
+ e.currentTarget.style.transform = "translateY(-2px)";
2291
+ e.currentTarget.style.boxShadow = "0 4px 12px rgba(0,0,0,0.1)";
2292
+ e.currentTarget.style.borderColor = "#007bff";
2293
+ },
2294
+ onMouseLeave: (e) => {
2295
+ e.currentTarget.style.transform = "translateY(0)";
2296
+ e.currentTarget.style.boxShadow = "none";
2297
+ e.currentTarget.style.borderColor = "#e9ecef";
2298
+ },
2299
+ children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_react_bootstrap22.Card.Body, { style: { padding: "15px", textAlign: "center" }, children: [
2300
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_fi3.FiMail, { size: 20, color: "#007bff", className: "mb-2" }),
2301
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
2302
+ "div",
2303
+ {
2304
+ style: {
2305
+ fontSize: "14px",
2306
+ fontWeight: "500",
2307
+ color: "#2c3e50",
2308
+ wordBreak: "break-word"
2309
+ },
2310
+ children: email.email
2311
+ }
2312
+ )
2313
+ ] })
2314
+ }
2315
+ ) }, email.email)) })
2316
+ ] }) })
2317
+ ] })
2318
+ ]
2319
+ }
2320
+ );
2321
+ };
2322
+
2323
+ // src/forms/GenericForm.tsx
2324
+ var import_react18 = require("react");
2325
+ var import_react_bootstrap23 = require("react-bootstrap");
2326
+ var import_jsx_runtime35 = require("react/jsx-runtime");
2327
+ var GenericForm = ({ fields, onSubmit, renderCustomSelect }) => {
2328
+ const [formValues, setFormValues] = (0, import_react18.useState)({});
2329
+ const [errors, setErrors] = (0, import_react18.useState)({});
2330
+ const handleChange = (key, value) => {
2331
+ setFormValues({
2332
+ ...formValues,
2333
+ [key]: value
2334
+ });
2335
+ };
2336
+ const validate = () => {
2337
+ const newErrors = {};
2338
+ fields.forEach((field) => {
2339
+ if (field.required && !formValues[field.key]) {
2340
+ newErrors[field.key] = `${field.label} \xE9 obrigat\xF3rio`;
2341
+ }
2342
+ });
2343
+ setErrors(newErrors);
2344
+ return Object.keys(newErrors).length === 0;
2345
+ };
2346
+ const handleSubmit = (e) => {
2347
+ e.preventDefault();
2348
+ if (validate()) {
2349
+ onSubmit(formValues);
2350
+ }
2351
+ };
2352
+ const renderField = (field) => {
2353
+ const { label, key, type, options, placeholder } = field;
2354
+ const value = formValues[key] || "";
2355
+ switch (type) {
2356
+ case "text":
2357
+ case "number":
2358
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_react_bootstrap23.Form.Group, { className: "mb-3", children: [
2359
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_react_bootstrap23.Form.Label, { children: label }),
2360
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
2361
+ import_react_bootstrap23.Form.Control,
2362
+ {
2363
+ type,
2364
+ placeholder,
2365
+ value,
2366
+ onChange: (e) => handleChange(key, e.target.value),
2367
+ isInvalid: !!errors[key]
2368
+ }
2369
+ ),
2370
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_react_bootstrap23.Form.Control.Feedback, { type: "invalid", children: errors[key] })
2371
+ ] }, key);
2372
+ case "select": {
2373
+ const orderedOptions = (options || []).filter((opt) => opt && opt.value !== void 0 && opt.label !== void 0).sort((a, b) => a.label.localeCompare(b.label));
2374
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_react_bootstrap23.Form.Group, { className: "mb-3", children: [
2375
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_react_bootstrap23.Form.Label, { children: label }),
2376
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
2377
+ import_react_bootstrap23.Form.Select,
2378
+ {
2379
+ value,
2380
+ onChange: (e) => handleChange(key, e.target.value),
2381
+ isInvalid: !!errors[key],
2382
+ children: [
2383
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("option", { value: "", children: "Selecione..." }),
2384
+ orderedOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("option", { value: option.value, children: option.label }, String(option.value)))
2385
+ ]
2386
+ }
2387
+ ),
2388
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_react_bootstrap23.Form.Control.Feedback, { type: "invalid", children: errors[key] })
2389
+ ] }, key);
2390
+ }
2391
+ case "custom-select":
2392
+ if (renderCustomSelect) {
2393
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { children: [
2394
+ renderCustomSelect({
2395
+ label,
2396
+ value,
2397
+ options,
2398
+ onChange: (v) => handleChange(key, v),
2399
+ placeholder
2400
+ }),
2401
+ errors[key] && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "invalid-feedback d-block", children: errors[key] })
2402
+ ] }, key);
2403
+ }
1509
2404
  return null;
1510
2405
  case "date":
1511
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_react_bootstrap17.Form.Group, { className: "mb-3", children: [
1512
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react_bootstrap17.Form.Label, { children: label }),
1513
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
1514
- import_react_bootstrap17.Form.Control,
2406
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_react_bootstrap23.Form.Group, { className: "mb-3", children: [
2407
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_react_bootstrap23.Form.Label, { children: label }),
2408
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
2409
+ import_react_bootstrap23.Form.Control,
1515
2410
  {
1516
2411
  type: "date",
1517
2412
  value,
@@ -1519,23 +2414,23 @@ var GenericForm = ({ fields, onSubmit, renderCustomSelect }) => {
1519
2414
  isInvalid: !!errors[key]
1520
2415
  }
1521
2416
  ),
1522
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react_bootstrap17.Form.Control.Feedback, { type: "invalid", children: errors[key] })
2417
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_react_bootstrap23.Form.Control.Feedback, { type: "invalid", children: errors[key] })
1523
2418
  ] }, key);
1524
2419
  default:
1525
2420
  return null;
1526
2421
  }
1527
2422
  };
1528
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_react_bootstrap17.Form, { onSubmit: handleSubmit, children: [
2423
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_react_bootstrap23.Form, { onSubmit: handleSubmit, children: [
1529
2424
  fields.map((field) => renderField(field)),
1530
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "d-grid", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react_bootstrap17.Button, { variant: "primary", type: "submit", children: "Salvar" }) })
2425
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "d-grid", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_react_bootstrap23.Button, { variant: "primary", type: "submit", children: "Salvar" }) })
1531
2426
  ] });
1532
2427
  };
1533
2428
  var GenericForm_default = GenericForm;
1534
2429
 
1535
2430
  // src/forms/GenericSelect.tsx
1536
- var import_react12 = require("react");
1537
- var import_react_bootstrap18 = require("react-bootstrap");
1538
- var import_jsx_runtime21 = require("react/jsx-runtime");
2431
+ var import_react19 = require("react");
2432
+ var import_react_bootstrap24 = require("react-bootstrap");
2433
+ var import_jsx_runtime36 = require("react/jsx-runtime");
1539
2434
  var GenericSelectOps = class {
1540
2435
  constructor(noLabel, title, onChange, ops, selection, returnType, displayType, filter, filterField, valueType, loadFunc, loadCondition, actionClick, locked) {
1541
2436
  this.noLabel = noLabel;
@@ -1572,8 +2467,8 @@ var GenericSelect = ({
1572
2467
  isBold,
1573
2468
  ...restProps
1574
2469
  }) => {
1575
- const [options, setOptions] = (0, import_react12.useState)(ops || []);
1576
- (0, import_react12.useEffect)(() => {
2470
+ const [options, setOptions] = (0, import_react19.useState)(ops || []);
2471
+ (0, import_react19.useEffect)(() => {
1577
2472
  const loadFunction = async () => {
1578
2473
  if (loadCondition && loadFunc) {
1579
2474
  loadFunc().then((res) => {
@@ -1598,15 +2493,15 @@ var GenericSelect = ({
1598
2493
  }
1599
2494
  };
1600
2495
  const defaultPlaceholder = (restProps == null ? void 0 : restProps.default) || "Seleciona uma Op\xE7\xE3o";
1601
- const selectContent = /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
1602
- import_react_bootstrap18.Form.Control,
2496
+ const selectContent = /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
2497
+ import_react_bootstrap24.Form.Control,
1603
2498
  {
1604
2499
  disabled: locked,
1605
2500
  as: "select",
1606
2501
  value: selection,
1607
2502
  onChange: (event) => getTrueValue(event.target.selectedIndex),
1608
2503
  children: [
1609
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("option", { value: void 0, children: [
2504
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("option", { value: void 0, children: [
1610
2505
  "-- ",
1611
2506
  defaultPlaceholder,
1612
2507
  " --"
@@ -1615,30 +2510,30 @@ var GenericSelect = ({
1615
2510
  const val = valueType && op[valueType] || op.id || op;
1616
2511
  let fill = displayType && op[displayType] || op;
1617
2512
  if (typeof fill == "object") fill = "";
1618
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("option", { value: val, children: fill }, op.id || index);
2513
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("option", { value: val, children: fill }, op.id || index);
1619
2514
  })
1620
2515
  ]
1621
2516
  }
1622
2517
  );
1623
2518
  if (actionClick) {
1624
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
1625
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_react_bootstrap18.Form.Label, { style: { fontWeight: isBold ? "bold" : void 0 }, hidden: noLabel, children: title }),
1626
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_react_bootstrap18.InputGroup, { children: [
2519
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
2520
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_react_bootstrap24.Form.Label, { style: { fontWeight: isBold ? "bold" : void 0 }, hidden: noLabel, children: title }),
2521
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_react_bootstrap24.InputGroup, { children: [
1627
2522
  selectContent,
1628
2523
  actionClick()
1629
2524
  ] })
1630
2525
  ] });
1631
2526
  }
1632
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
1633
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_react_bootstrap18.Form.Label, { style: { fontWeight: isBold ? "bold" : void 0 }, hidden: noLabel, children: title }),
2527
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
2528
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_react_bootstrap24.Form.Label, { style: { fontWeight: isBold ? "bold" : void 0 }, hidden: noLabel, children: title }),
1634
2529
  selectContent
1635
2530
  ] });
1636
2531
  };
1637
2532
  var GenericSelect_default = GenericSelect;
1638
2533
 
1639
2534
  // src/forms/FormField.tsx
1640
- var import_react_bootstrap19 = require("react-bootstrap");
1641
- var import_jsx_runtime22 = require("react/jsx-runtime");
2535
+ var import_react_bootstrap25 = require("react-bootstrap");
2536
+ var import_jsx_runtime37 = require("react/jsx-runtime");
1642
2537
  var FormField = ({
1643
2538
  val,
1644
2539
  onValueUpdate,
@@ -1689,32 +2584,32 @@ var FormField = ({
1689
2584
  fieldProps.as = "textarea";
1690
2585
  fieldProps.rows = rows || 3;
1691
2586
  }
1692
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_react_bootstrap19.Form.Control, { ...fieldProps });
2587
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_react_bootstrap25.Form.Control, { ...fieldProps });
1693
2588
  };
1694
2589
  if (hide) return null;
1695
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
1696
- import_react_bootstrap19.Form.Group,
2590
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
2591
+ import_react_bootstrap25.Form.Group,
1697
2592
  {
1698
2593
  onFocusCapture: (e) => onFocusHandler(e.target.value),
1699
2594
  onMouseLeave: onMouseLv,
1700
2595
  onKeyDown: onKeyDownHandler,
1701
2596
  style: { marginTop: 4, marginBottom: 4, width: "100%" },
1702
2597
  children: [
1703
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_react_bootstrap19.InputGroup, { children: [
1704
- asTextArea ? renderField() : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_react_bootstrap19.FloatingLabel, { style: { zIndex: 0, flex: 1 }, label, controlId: controlId || "floatingInput", children: renderField() }),
2598
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_react_bootstrap25.InputGroup, { children: [
2599
+ asTextArea ? renderField() : /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_react_bootstrap25.FloatingLabel, { style: { zIndex: 0, flex: 1 }, label, controlId: controlId || "floatingInput", children: renderField() }),
1705
2600
  actionClick && actionClick(),
1706
2601
  actionClick2 && actionClick2()
1707
2602
  ] }),
1708
- feedback && isInvalid && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_react_bootstrap19.Form.Control.Feedback, { type: "invalid", style: { display: "block" }, children: feedback })
2603
+ feedback && isInvalid && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_react_bootstrap25.Form.Control.Feedback, { type: "invalid", style: { display: "block" }, children: feedback })
1709
2604
  ]
1710
2605
  }
1711
2606
  );
1712
2607
  };
1713
2608
 
1714
2609
  // src/forms/ClickToWriteField.tsx
1715
- var import_react13 = require("react");
1716
- var import_react_bootstrap20 = require("react-bootstrap");
1717
- var import_jsx_runtime23 = require("react/jsx-runtime");
2610
+ var import_react20 = require("react");
2611
+ var import_react_bootstrap26 = require("react-bootstrap");
2612
+ var import_jsx_runtime38 = require("react/jsx-runtime");
1718
2613
  var ClickToWriteField = ({
1719
2614
  buttonDisplay,
1720
2615
  fieldType = "text",
@@ -1730,9 +2625,9 @@ var ClickToWriteField = ({
1730
2625
  onEnterPress,
1731
2626
  cleanRef
1732
2627
  }) => {
1733
- const [showClick, setShowClick] = (0, import_react13.useState)(false);
1734
- const inputRef = (0, import_react13.useRef)(null);
1735
- (0, import_react13.useEffect)(() => {
2628
+ const [showClick, setShowClick] = (0, import_react20.useState)(false);
2629
+ const inputRef = (0, import_react20.useRef)(null);
2630
+ (0, import_react20.useEffect)(() => {
1736
2631
  if (showClick) {
1737
2632
  setTimeout(() => {
1738
2633
  if (inputRef.current) {
@@ -1761,9 +2656,9 @@ var ClickToWriteField = ({
1761
2656
  onEnterPress(inputRef);
1762
2657
  }
1763
2658
  };
1764
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { style: { display: "flex", width: "100%", margin: 0, padding: 0 }, children: [
1765
- !showClick && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
1766
- import_react_bootstrap20.Button,
2659
+ return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { style: { display: "flex", width: "100%", margin: 0, padding: 0 }, children: [
2660
+ !showClick && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
2661
+ import_react_bootstrap26.Button,
1767
2662
  {
1768
2663
  style: { flexGrow: 1 },
1769
2664
  onClick: handleShowClick,
@@ -1771,7 +2666,7 @@ var ClickToWriteField = ({
1771
2666
  children: resolveButtonDisplay()
1772
2667
  }
1773
2668
  ),
1774
- showClick && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2669
+ showClick && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
1775
2670
  FormField,
1776
2671
  {
1777
2672
  reference: inputRef,
@@ -1781,8 +2676,8 @@ var ClickToWriteField = ({
1781
2676
  label: fieldLabel,
1782
2677
  onValueUpdate: onFieldValueUpdate,
1783
2678
  onBlur: () => setShowClick(false),
1784
- actionClick: () => enableFieldActionButton ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
1785
- import_react_bootstrap20.Button,
2679
+ actionClick: () => enableFieldActionButton ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
2680
+ import_react_bootstrap26.Button,
1786
2681
  {
1787
2682
  ...fieldActionButtonProps,
1788
2683
  onClick: () => fieldActionButtonCallback(inputRef),
@@ -1795,28 +2690,28 @@ var ClickToWriteField = ({
1795
2690
  };
1796
2691
 
1797
2692
  // src/forms/ColorPicker.tsx
1798
- var import_react_bootstrap21 = require("react-bootstrap");
1799
- var import_fa2 = require("react-icons/fa");
1800
- var import_jsx_runtime24 = require("react/jsx-runtime");
2693
+ var import_react_bootstrap27 = require("react-bootstrap");
2694
+ var import_fa4 = require("react-icons/fa");
2695
+ var import_jsx_runtime39 = require("react/jsx-runtime");
1801
2696
  var ColorPicker = ({
1802
2697
  selectedColor,
1803
2698
  onColorChange,
1804
2699
  presetColors = ["#ff0000", "#ffd700", "#008000", "#0000ff", "#800080"],
1805
2700
  title = "Cor de Identifica\xE7\xE3o"
1806
2701
  }) => {
1807
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
1808
- import_react_bootstrap21.Card,
2702
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
2703
+ import_react_bootstrap27.Card,
1809
2704
  {
1810
2705
  className: "shadow-sm border-primary-hover mb-3",
1811
2706
  style: { maxWidth: "320px", transition: "0.3s" },
1812
2707
  children: [
1813
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_react_bootstrap21.Card.Header, { className: "bg-light d-flex align-items-center", children: [
1814
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_fa2.FaPalette, { className: "me-2 text-primary" }),
1815
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "fw-medium", children: title })
2708
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_react_bootstrap27.Card.Header, { className: "bg-light d-flex align-items-center", children: [
2709
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_fa4.FaPalette, { className: "me-2 text-primary" }),
2710
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { className: "fw-medium", children: title })
1816
2711
  ] }),
1817
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_react_bootstrap21.Card.Body, { children: [
1818
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_react_bootstrap21.Row, { className: "g-3 align-items-center mb-3", children: [
1819
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_react_bootstrap21.Col, { xs: "auto", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2712
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_react_bootstrap27.Card.Body, { children: [
2713
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_react_bootstrap27.Row, { className: "g-3 align-items-center mb-3", children: [
2714
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_react_bootstrap27.Col, { xs: "auto", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
1820
2715
  "div",
1821
2716
  {
1822
2717
  className: "rounded-circle shadow-sm border",
@@ -1834,8 +2729,8 @@ var ColorPicker = ({
1834
2729
  title: "Clique para abrir o seletor"
1835
2730
  }
1836
2731
  ) }),
1837
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_react_bootstrap21.Col, { children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
1838
- import_react_bootstrap21.Form.Control,
2732
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_react_bootstrap27.Col, { children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
2733
+ import_react_bootstrap27.Form.Control,
1839
2734
  {
1840
2735
  type: "color",
1841
2736
  id: "color-input-hidden",
@@ -1846,7 +2741,7 @@ var ColorPicker = ({
1846
2741
  }
1847
2742
  ) })
1848
2743
  ] }),
1849
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_react_bootstrap21.Row, { className: "g-2 justify-content-start", children: presetColors.map((cor) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_react_bootstrap21.Col, { xs: "auto", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2744
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_react_bootstrap27.Row, { className: "g-2 justify-content-start", children: presetColors.map((cor) => /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_react_bootstrap27.Col, { xs: "auto", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
1850
2745
  "div",
1851
2746
  {
1852
2747
  className: "rounded-1 shadow-sm",
@@ -1867,8 +2762,8 @@ var ColorPicker = ({
1867
2762
  };
1868
2763
 
1869
2764
  // src/forms/Switch.tsx
1870
- var import_react_bootstrap22 = require("react-bootstrap");
1871
- var import_jsx_runtime25 = require("react/jsx-runtime");
2765
+ var import_react_bootstrap28 = require("react-bootstrap");
2766
+ var import_jsx_runtime40 = require("react/jsx-runtime");
1872
2767
  var Switch = ({
1873
2768
  label,
1874
2769
  onSwitchChange,
@@ -1877,8 +2772,8 @@ var Switch = ({
1877
2772
  defaultChecked,
1878
2773
  ...props
1879
2774
  }) => {
1880
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
1881
- import_react_bootstrap22.Form.Check,
2775
+ return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
2776
+ import_react_bootstrap28.Form.Check,
1882
2777
  {
1883
2778
  ...props,
1884
2779
  disabled,
@@ -1892,17 +2787,17 @@ var Switch = ({
1892
2787
  };
1893
2788
 
1894
2789
  // src/forms/UploadArea.tsx
1895
- var import_react14 = require("react");
2790
+ var import_react21 = require("react");
1896
2791
  var import_react_dropzone = require("react-dropzone");
1897
- var import_fi3 = require("react-icons/fi");
1898
- var import_jsx_runtime26 = require("react/jsx-runtime");
2792
+ var import_fi4 = require("react-icons/fi");
2793
+ var import_jsx_runtime41 = require("react/jsx-runtime");
1899
2794
  var UploadArea = ({
1900
2795
  onFilePut,
1901
2796
  anexo,
1902
2797
  accept = { "image/jpeg": [], "image/png": [] },
1903
2798
  maxSize = 50 * 1024 * 1024
1904
2799
  }) => {
1905
- const onDrop = (0, import_react14.useCallback)(
2800
+ const onDrop = (0, import_react21.useCallback)(
1906
2801
  (acceptedFiles) => {
1907
2802
  const file = acceptedFiles[0];
1908
2803
  if (file && typeof onFilePut === "function") {
@@ -1917,7 +2812,7 @@ var UploadArea = ({
1917
2812
  accept
1918
2813
  });
1919
2814
  const hasAnexo = Boolean(anexo);
1920
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
2815
+ return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
1921
2816
  "div",
1922
2817
  {
1923
2818
  ...getRootProps(),
@@ -1926,23 +2821,23 @@ var UploadArea = ({
1926
2821
  ${hasAnexo ? "upload-has-file" : ""}
1927
2822
  `,
1928
2823
  children: [
1929
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("input", { ...getInputProps() }),
1930
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "upload-content", children: [
1931
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "upload-icon", children: hasAnexo ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_fi3.FiCheckCircle, { size: 24 }) : /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_fi3.FiUploadCloud, { size: 24 }) }),
1932
- hasAnexo ? /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
1933
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "upload-link", children: "Arquivo anexado" }),
1934
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "upload-info", children: anexo == null ? void 0 : anexo.name })
1935
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
1936
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("p", { children: [
1937
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "upload-link", children: "Adicione" }),
2824
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("input", { ...getInputProps() }),
2825
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "upload-content", children: [
2826
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { className: "upload-icon", children: hasAnexo ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_fi4.FiCheckCircle, { size: 24 }) : /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_fi4.FiUploadCloud, { size: 24 }) }),
2827
+ hasAnexo ? /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_jsx_runtime41.Fragment, { children: [
2828
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("p", { className: "upload-link", children: "Arquivo anexado" }),
2829
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("p", { className: "upload-info", children: anexo == null ? void 0 : anexo.name })
2830
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_jsx_runtime41.Fragment, { children: [
2831
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("p", { children: [
2832
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { className: "upload-link", children: "Adicione" }),
1938
2833
  " ou arraste arquivos aqui"
1939
2834
  ] }),
1940
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("p", { className: "upload-info", children: [
2835
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("p", { className: "upload-info", children: [
1941
2836
  "Formatos aceitos: ",
1942
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("b", { children: Object.keys(accept).map((t) => t.split("/")[1].toUpperCase()).join(", ") }),
2837
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("b", { children: Object.keys(accept).map((t) => t.split("/")[1].toUpperCase()).join(", ") }),
1943
2838
  " | Tamanho m\xE1ximo:",
1944
2839
  " ",
1945
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("b", { children: [
2840
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("b", { children: [
1946
2841
  (maxSize / (1024 * 1024)).toFixed(0),
1947
2842
  "MB"
1948
2843
  ] })
@@ -1954,305 +2849,807 @@ var UploadArea = ({
1954
2849
  );
1955
2850
  };
1956
2851
 
1957
- // src/forms/FindRecursoByTagField.tsx
1958
- var import_react17 = require("react");
1959
- var import_gr4 = require("react-icons/gr");
2852
+ // src/forms/SectorSelector.tsx
2853
+ var import_react22 = require("react");
2854
+ var import_react_bootstrap29 = require("react-bootstrap");
2855
+ var import_bs3 = require("react-icons/bs");
2856
+ var import_jsx_runtime42 = require("react/jsx-runtime");
2857
+ var SectorSelector = ({
2858
+ setores,
2859
+ onSectorSelect,
2860
+ selectionLabel = "Selecione o Setor",
2861
+ selectionPlaceholder = "Selecione o setor",
2862
+ hideComponent = false,
2863
+ defaultSectorName = false,
2864
+ allowAll = false
2865
+ }) => {
2866
+ const [expanded, setExpanded] = (0, import_react22.useState)(false);
2867
+ const [selectedSector, setSelectedSector] = (0, import_react22.useState)(null);
2868
+ (0, import_react22.useEffect)(() => {
2869
+ if (defaultSectorName && setores.length > 0) {
2870
+ const setor = setores.find((s) => s.nome === defaultSectorName);
2871
+ if (setor && setor.id !== (selectedSector == null ? void 0 : selectedSector.id)) {
2872
+ setSelectedSector(setor);
2873
+ }
2874
+ } else if (!defaultSectorName) {
2875
+ setSelectedSector(null);
2876
+ }
2877
+ }, [defaultSectorName, setores]);
2878
+ const handleSelectSetor = (setor) => {
2879
+ setSelectedSector(setor);
2880
+ onSectorSelect(setor);
2881
+ setExpanded(false);
2882
+ };
2883
+ const toggleExpand = () => {
2884
+ setExpanded(!expanded);
2885
+ };
2886
+ if (hideComponent) return null;
2887
+ const setorOptions = allowAll ? [{ id: "all", nome: "Todos" }, ...setores] : [...setores];
2888
+ return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_react_bootstrap29.Form.Floating, { className: "sector-selector-floating", children: [
2889
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "custom-select-container", onClick: toggleExpand, children: [
2890
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "selected-sector-label mt-1", children: (selectedSector == null ? void 0 : selectedSector.nome) || selectionPlaceholder }),
2891
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "zoom-container", children: expanded ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_bs3.BsChevronUp, {}) : /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_bs3.BsChevronDown, {}) })
2892
+ ] }),
2893
+ (selectedSector == null ? void 0 : selectedSector.nome) && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("label", { htmlFor: "floatingInputCustom", children: selectionLabel }),
2894
+ expanded && /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
2895
+ "div",
2896
+ {
2897
+ className: "custom-dropdown-menu",
2898
+ onMouseLeave: () => setExpanded(false),
2899
+ children: [
2900
+ setorOptions.sort((a, b) => a.nome.localeCompare(b.nome)).map((setor, idx) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
2901
+ "div",
2902
+ {
2903
+ className: `dropdown-option ${setor.nome === (selectedSector == null ? void 0 : selectedSector.nome) ? "selected-option" : ""}`,
2904
+ onClick: () => handleSelectSetor(setor),
2905
+ children: setor.nome === "default" ? "Nenhum" : setor.nome
2906
+ },
2907
+ idx
2908
+ )),
2909
+ setores.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "dropdown-option text-muted italic", children: "Carregando setores..." })
2910
+ ]
2911
+ }
2912
+ )
2913
+ ] });
2914
+ };
1960
2915
 
1961
- // src/qr/QrCodeScanButton.tsx
1962
- var import_react16 = require("react");
1963
- var import_bs = require("react-icons/bs");
2916
+ // src/forms/UnidadeMaterialForm.tsx
2917
+ var import_react_bootstrap30 = require("react-bootstrap");
2918
+ var import_jsx_runtime43 = require("react/jsx-runtime");
2919
+ var UnidadeMaterialForm = ({
2920
+ value,
2921
+ onMaterialSelected,
2922
+ onQuantidadeUpdate,
2923
+ onUnidadeSelected,
2924
+ onNavigateToCreateMaterial,
2925
+ onNavigateToCreateUnidade,
2926
+ loadMaterialsFunc,
2927
+ loadUnidadesFunc,
2928
+ materialLabel = "Materia Prima",
2929
+ hideMaterial = false,
2930
+ hideQuantidade = false,
2931
+ hideUnidade = false,
2932
+ className = ""
2933
+ }) => {
2934
+ var _a, _b;
2935
+ const renderNewMaterialButton = () => /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_react_bootstrap30.Button, { onClick: onNavigateToCreateMaterial, size: "sm", variant: "outline-primary", children: "Novo Material" });
2936
+ const renderNewUnidadeButton = () => /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_react_bootstrap30.Button, { onClick: onNavigateToCreateUnidade, size: "sm", variant: "outline-primary", children: "Nova Unidade" });
2937
+ return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: `unidade-material-form ${className}`, children: [
2938
+ !hideMaterial && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
2939
+ AutoComplete,
2940
+ {
2941
+ displayKey: "nome",
2942
+ value: ((_a = value == null ? void 0 : value.material) == null ? void 0 : _a.nome) || "",
2943
+ loadCondition: true,
2944
+ title: materialLabel,
2945
+ loadFunc: loadMaterialsFunc,
2946
+ onSelectedClick: onMaterialSelected,
2947
+ actionButton: onNavigateToCreateMaterial ? renderNewMaterialButton : void 0
2948
+ }
2949
+ ),
2950
+ !hideQuantidade && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
2951
+ FormField,
2952
+ {
2953
+ label: "Quantidade",
2954
+ val: value.quantidade || "",
2955
+ onValueUpdate: onQuantidadeUpdate,
2956
+ ty: "number"
2957
+ }
2958
+ ),
2959
+ !hideUnidade && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
2960
+ AutoComplete,
2961
+ {
2962
+ displayKey: "nome",
2963
+ value: ((_b = value == null ? void 0 : value.unidade) == null ? void 0 : _b.nome) || "",
2964
+ loadCondition: true,
2965
+ title: "Unidade",
2966
+ loadFunc: loadUnidadesFunc,
2967
+ onSelectedClick: onUnidadeSelected,
2968
+ actionButton: onNavigateToCreateUnidade ? renderNewUnidadeButton : void 0
2969
+ }
2970
+ )
2971
+ ] });
2972
+ };
1964
2973
 
1965
- // src/qr/QrReader.tsx
1966
- var import_qr_scanner = __toESM(require("qr-scanner"));
1967
- var import_react15 = require("react");
1968
- var import_jsx_runtime27 = require("react/jsx-runtime");
1969
- var QrReader = ({ callback }) => {
1970
- const scanner = (0, import_react15.useRef)(null);
1971
- const videoEl = (0, import_react15.useRef)(null);
1972
- const qrBoxEl = (0, import_react15.useRef)(null);
1973
- const [qrOn, setQrOn] = (0, import_react15.useState)(true);
1974
- const [scannedResult, setScannedResult] = (0, import_react15.useState)("");
1975
- const onScanSuccess = (result) => {
1976
- setScannedResult(result.data);
1977
- callback(result.data);
2974
+ // src/icons/IconLabelItem.tsx
2975
+ var import_jsx_runtime44 = require("react/jsx-runtime");
2976
+ var IconLabelItem = ({
2977
+ icon,
2978
+ label,
2979
+ containerClassName = "",
2980
+ labelClassName = "",
2981
+ onClick,
2982
+ style
2983
+ }) => {
2984
+ return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: containerClassName, onClick, style: { ...style, cursor: onClick ? "pointer" : "default" }, children: [
2985
+ icon,
2986
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: labelClassName, children: label })
2987
+ ] });
2988
+ };
2989
+
2990
+ // src/icons/IconLabelList.tsx
2991
+ var import_jsx_runtime45 = require("react/jsx-runtime");
2992
+ var IconLabelList = ({ items, className = "" }) => {
2993
+ return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: `icon-label-list ${className}`, children: items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
2994
+ IconLabelItem,
2995
+ {
2996
+ labelClassName: "icon-label",
2997
+ containerClassName: "icon-label-item",
2998
+ icon: item.icon,
2999
+ label: item.label,
3000
+ onClick: item.onClick
3001
+ },
3002
+ index
3003
+ )) });
3004
+ };
3005
+
3006
+ // src/icons/NotificationItem.tsx
3007
+ var import_react23 = require("react");
3008
+ var import_react_bootstrap31 = require("react-bootstrap");
3009
+ var import_fi5 = require("react-icons/fi");
3010
+ var import_dayjs4 = __toESM(require("dayjs"));
3011
+ var import_jsx_runtime46 = require("react/jsx-runtime");
3012
+ var NotificationItem = ({
3013
+ notification,
3014
+ onRead,
3015
+ onDismiss,
3016
+ emptyContentLabel = "Sem conte\xFAdo adicional dispon\xEDvel."
3017
+ }) => {
3018
+ const [showModal, setShowModal] = (0, import_react23.useState)(false);
3019
+ const { context, contextId, content, status, createdAt, readAt } = notification;
3020
+ const handleOpenModal = (e) => {
3021
+ e.stopPropagation();
3022
+ setShowModal(true);
1978
3023
  };
1979
- const onScanFail = (err) => {
1980
- if (typeof err === "string" && !err.includes("No QR code found")) {
1981
- console.error("QR Scanner Error:", err);
1982
- }
3024
+ const handleCloseModal = () => setShowModal(false);
3025
+ const handleReadAndClose = () => {
3026
+ onRead(notification);
3027
+ handleCloseModal();
1983
3028
  };
1984
- (0, import_react15.useEffect)(() => {
1985
- if (videoEl.current && !scanner.current) {
1986
- scanner.current = new import_qr_scanner.default(videoEl.current, onScanSuccess, {
1987
- onDecodeError: onScanFail,
1988
- preferredCamera: "environment",
1989
- highlightScanRegion: true,
1990
- highlightCodeOutline: true,
1991
- overlay: qrBoxEl.current || void 0
1992
- });
1993
- scanner.current.start().then(() => setQrOn(true)).catch((err) => {
1994
- console.error("Failed to start QR Scanner:", err);
1995
- setQrOn(false);
1996
- });
1997
- }
1998
- return () => {
1999
- if (scanner.current) {
2000
- scanner.current.stop();
2001
- scanner.current.destroy();
2002
- scanner.current = null;
2003
- }
2004
- };
2005
- }, []);
2006
- (0, import_react15.useEffect)(() => {
2007
- if (!qrOn) {
2008
- alert(
2009
- "C\xE2mera est\xE1 bloqueada ou inacess\xEDvel. Por favor, habilite a c\xE2mera nas permiss\xF5es do seu navegador e recarregue a p\xE1gina."
2010
- );
2011
- }
2012
- }, [qrOn]);
2013
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "qr-reader", style: { position: "relative", width: "100%", maxWidth: "500px", margin: "0 auto" }, children: [
2014
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("video", { ref: videoEl, style: { width: "100%", borderRadius: "8px" } }),
2015
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { ref: qrBoxEl, className: "qr-box" }),
2016
- scannedResult && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
3029
+ const handleDismiss = (e) => {
3030
+ e.stopPropagation();
3031
+ onDismiss(notification);
3032
+ };
3033
+ const displayTitle = contextId ? `${context} - ${contextId}` : context || "Notifica\xE7\xE3o";
3034
+ return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_jsx_runtime46.Fragment, { children: [
3035
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
2017
3036
  "div",
2018
3037
  {
2019
- style: {
2020
- position: "absolute",
2021
- top: 10,
2022
- left: 10,
2023
- zIndex: 10,
2024
- background: "rgba(0,0,0,0.6)",
2025
- color: "white",
2026
- padding: "4px 8px",
2027
- borderRadius: "4px",
2028
- fontSize: "0.8rem"
2029
- },
3038
+ className: `notification-item-modern ${status === "unread" ? "unread" : ""}`,
3039
+ onClick: handleOpenModal,
3040
+ children: [
3041
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: `notification-status-indicator ${status}`, children: status === "unread" ? /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_fi5.FiClock, { size: 14 }) : /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_fi5.FiCheck, { size: 14 }) }),
3042
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "notification-main-content", children: [
3043
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: "notification-header-row", children: /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "notification-title-modern", children: [
3044
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { className: "notification-context", children: context }),
3045
+ contextId && /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_jsx_runtime46.Fragment, { children: [
3046
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { className: "notification-separator", children: "/" }),
3047
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { className: "notification-context-id", children: contextId })
3048
+ ] })
3049
+ ] }) }),
3050
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: "notification-preview", children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("p", { className: "notification-content-preview", children: content || "Nova mensagem recebida" }) }),
3051
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "notification-meta", children: [
3052
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "notification-timestamp", children: [
3053
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_fi5.FiClock, { size: 12, className: "me-1" }),
3054
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("small", { children: (0, import_dayjs4.default)(createdAt).format("DD/MM/YYYY HH:mm") })
3055
+ ] }),
3056
+ readAt && /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "notification-read-time", children: [
3057
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_fi5.FiCheck, { size: 12, className: "me-1" }),
3058
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("small", { children: [
3059
+ "Lida em ",
3060
+ (0, import_dayjs4.default)(readAt).format("DD/MM HH:mm")
3061
+ ] })
3062
+ ] })
3063
+ ] })
3064
+ ] }),
3065
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: "notification-quick-actions", children: status === "unread" && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
3066
+ import_react_bootstrap31.OverlayTrigger,
3067
+ {
3068
+ placement: "top",
3069
+ overlay: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_react_bootstrap31.Tooltip, { children: "Descartar" }),
3070
+ children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
3071
+ "button",
3072
+ {
3073
+ className: "notification-action-btn notification-dismiss-btn",
3074
+ onClick: handleDismiss,
3075
+ "aria-label": "Descartar notifica\xE7\xE3o",
3076
+ children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_fi5.FiTrash2, { size: 14 })
3077
+ }
3078
+ )
3079
+ }
3080
+ ) })
3081
+ ]
3082
+ }
3083
+ ),
3084
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
3085
+ import_react_bootstrap31.Modal,
3086
+ {
3087
+ show: showModal,
3088
+ onHide: handleCloseModal,
3089
+ centered: true,
3090
+ className: "notification-modal",
3091
+ children: [
3092
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_react_bootstrap31.Modal.Header, { closeButton: true, className: "notification-modal-header", children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_react_bootstrap31.Modal.Title, { className: "notification-modal-title", children: /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "d-flex align-items-center", children: [
3093
+ status === "unread" ? /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_fi5.FiClock, { className: "me-2 text-warning" }) : /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_fi5.FiCheck, { className: "me-2 text-success" }),
3094
+ "Detalhes da Notifica\xE7\xE3o"
3095
+ ] }) }) }),
3096
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_react_bootstrap31.Modal.Body, { className: "notification-modal-body", children: /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "notification-modal-content", children: [
3097
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "notification-modal-meta", children: [
3098
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("h6", { className: "notification-modal-source", children: displayTitle }),
3099
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "notification-modal-timestamps", children: [
3100
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("small", { className: "text-muted", children: [
3101
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_fi5.FiClock, { size: 12, className: "me-1" }),
3102
+ "Criada em ",
3103
+ (0, import_dayjs4.default)(createdAt).format("DD/MM/YYYY [\xE0s] HH:mm")
3104
+ ] }),
3105
+ readAt && /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("small", { className: "text-muted ms-3", children: [
3106
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_fi5.FiCheck, { size: 12, className: "me-1" }),
3107
+ "Lida em ",
3108
+ (0, import_dayjs4.default)(readAt).format("DD/MM/YYYY [\xE0s] HH:mm")
3109
+ ] })
3110
+ ] })
3111
+ ] }),
3112
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: "notification-modal-message", children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("p", { className: "mb-0", children: content || emptyContentLabel }) })
3113
+ ] }) }),
3114
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_react_bootstrap31.Modal.Footer, { className: "notification-modal-footer", children: [
3115
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_react_bootstrap31.Button, { variant: "outline-secondary", onClick: handleCloseModal, children: "Fechar" }),
3116
+ status === "unread" && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_react_bootstrap31.Button, { variant: "primary", onClick: handleReadAndClose, children: "Marcar como lida" })
3117
+ ] })
3118
+ ]
3119
+ }
3120
+ )
3121
+ ] });
3122
+ };
3123
+
3124
+ // src/icons/NotificationBell.tsx
3125
+ var import_react_bootstrap32 = require("react-bootstrap");
3126
+ var import_fi6 = require("react-icons/fi");
3127
+ var import_jsx_runtime47 = require("react/jsx-runtime");
3128
+ var NotificationBell = ({
3129
+ notifications,
3130
+ onItemRead,
3131
+ onItemDismiss,
3132
+ onMarkAllRead,
3133
+ size = 20,
3134
+ className = ""
3135
+ }) => {
3136
+ const unreadCount = notifications.filter((n) => n.status === "unread").length;
3137
+ return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_react_bootstrap32.Dropdown, { align: "end", className: `notification-bell-dropdown ${className}`, children: [
3138
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_react_bootstrap32.Dropdown.Toggle, { as: "div", className: "position-relative cursor-pointer p-2", children: [
3139
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_fi6.FiBell, { size }),
3140
+ unreadCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
3141
+ import_react_bootstrap32.Badge,
3142
+ {
3143
+ pill: true,
3144
+ bg: "danger",
3145
+ className: "position-absolute",
3146
+ style: { top: 0, right: 0, fontSize: "0.65rem" },
3147
+ children: unreadCount > 99 ? "99+" : unreadCount
3148
+ }
3149
+ )
3150
+ ] }),
3151
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
3152
+ import_react_bootstrap32.Dropdown.Menu,
3153
+ {
3154
+ className: "shadow-lg border-0",
3155
+ style: { width: "320px", padding: 0, maxHeight: "500px", overflowY: "auto" },
2030
3156
  children: [
2031
- "Lido: ",
2032
- scannedResult
3157
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "p-3 border-bottom d-flex justify-content-between align-items-center bg-light", children: [
3158
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("h6", { className: "mb-0 fw-bold", children: "Notifica\xE7\xF5es" }),
3159
+ unreadCount > 0 && onMarkAllRead && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
3160
+ "button",
3161
+ {
3162
+ className: "btn btn-link btn-sm p-0 text-decoration-none",
3163
+ onClick: (e) => {
3164
+ e.stopPropagation();
3165
+ onMarkAllRead();
3166
+ },
3167
+ children: "Limpar tudo"
3168
+ }
3169
+ )
3170
+ ] }),
3171
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "notification-list", children: notifications.length > 0 ? notifications.sort((a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime()).map((n) => /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
3172
+ NotificationItem,
3173
+ {
3174
+ notification: n,
3175
+ onRead: onItemRead,
3176
+ onDismiss: onItemDismiss
3177
+ },
3178
+ n.id
3179
+ )) : /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "p-4 text-center text-muted", children: [
3180
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_fi6.FiBell, { size: 24, className: "mb-2 opacity-25" }),
3181
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("p", { className: "mb-0 small", children: "Nenhuma notifica\xE7\xE3o por aqui." })
3182
+ ] }) }),
3183
+ notifications.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "p-2 border-top text-center bg-light", children: /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("small", { className: "text-muted", children: [
3184
+ "Total: ",
3185
+ notifications.length,
3186
+ " notifica\xE7\xF5es"
3187
+ ] }) })
2033
3188
  ]
2034
3189
  }
2035
3190
  )
2036
3191
  ] });
2037
3192
  };
2038
3193
 
2039
- // src/qr/QrCodeScanButton.tsx
2040
- var import_jsx_runtime28 = require("react/jsx-runtime");
2041
- var QrCodeScanButton = ({ callback, size = 25 }) => {
2042
- const [showQr, setShowQr] = (0, import_react16.useState)(false);
2043
- const toggleQr = () => {
2044
- setShowQr((prev) => !prev);
3194
+ // src/modals/ModalBasicTemplate.tsx
3195
+ var import_react_bootstrap33 = require("react-bootstrap");
3196
+ var import_jsx_runtime48 = require("react/jsx-runtime");
3197
+ var ModalBasicTemplate = ({
3198
+ show,
3199
+ closeFunc,
3200
+ body,
3201
+ header,
3202
+ footer,
3203
+ props = {}
3204
+ }) => {
3205
+ const { bodyStyle, dialogStyle, ...modalProps } = props;
3206
+ const renderPart = (part) => {
3207
+ if (typeof part === "function") return part();
3208
+ return part;
2045
3209
  };
2046
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
2047
- "div",
3210
+ return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
3211
+ import_react_bootstrap33.Modal,
2048
3212
  {
2049
- className: "hoverable-div",
2050
- style: {
2051
- border: "solid",
2052
- borderTopRightRadius: "3px",
2053
- borderBottomRightRadius: "3px",
2054
- padding: "8px",
2055
- borderLeft: "none",
2056
- borderColor: "#ccc",
2057
- borderWidth: "1px",
2058
- cursor: "pointer",
2059
- display: "flex",
2060
- alignItems: "center"
2061
- },
2062
- onClick: toggleQr,
3213
+ show,
3214
+ onHide: closeFunc,
3215
+ centered: true,
3216
+ style: dialogStyle,
3217
+ ...modalProps,
2063
3218
  children: [
2064
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_bs.BsQrCode, { size }),
2065
- showQr && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
2066
- "div",
3219
+ header && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_react_bootstrap33.Modal.Header, { closeButton: true, children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_react_bootstrap33.Modal.Title, { children: renderPart(header) }) }),
3220
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_react_bootstrap33.Modal.Body, { style: bodyStyle, children: renderPart(body) }),
3221
+ footer && /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_react_bootstrap33.Modal.Footer, { children: [
3222
+ renderPart(footer),
3223
+ !footer && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_react_bootstrap33.Button, { variant: "secondary", onClick: closeFunc, children: "Fechar" })
3224
+ ] })
3225
+ ]
3226
+ }
3227
+ );
3228
+ };
3229
+ var ModalBasicTemplate_default = ModalBasicTemplate;
3230
+
3231
+ // src/modals/SelectDateModal.tsx
3232
+ var import_react24 = require("react");
3233
+ var import_react_bootstrap34 = require("react-bootstrap");
3234
+ var import_dayjs5 = __toESM(require("dayjs"));
3235
+ var import_jsx_runtime49 = require("react/jsx-runtime");
3236
+ var SelectDateModal = ({
3237
+ show,
3238
+ onClose,
3239
+ onSelect,
3240
+ title = "Selecionar Data",
3241
+ label = "Escolha a data",
3242
+ initialDate,
3243
+ allowFuture = true
3244
+ }) => {
3245
+ const [selectedDate, setSelectedDate] = (0, import_react24.useState)(
3246
+ initialDate || (0, import_dayjs5.default)().format("YYYY-MM-DDTHH:mm")
3247
+ );
3248
+ const handleConfirm = () => {
3249
+ onSelect(selectedDate);
3250
+ onClose();
3251
+ };
3252
+ return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_react_bootstrap34.Modal, { show, onHide: onClose, centered: true, size: "sm", children: [
3253
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_react_bootstrap34.Modal.Header, { closeButton: true, children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_react_bootstrap34.Modal.Title, { children: title }) }),
3254
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_react_bootstrap34.Modal.Body, { children: /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_react_bootstrap34.Form.Group, { children: [
3255
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_react_bootstrap34.Form.Label, { children: label }),
3256
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
3257
+ import_react_bootstrap34.Form.Control,
3258
+ {
3259
+ type: "datetime-local",
3260
+ value: selectedDate,
3261
+ max: allowFuture ? void 0 : (0, import_dayjs5.default)().format("YYYY-MM-DDTHH:mm"),
3262
+ onChange: (e) => setSelectedDate(e.target.value)
3263
+ }
3264
+ )
3265
+ ] }) }),
3266
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_react_bootstrap34.Modal.Footer, { children: [
3267
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_react_bootstrap34.Button, { variant: "outline-secondary", onClick: onClose, children: "Cancelar" }),
3268
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_react_bootstrap34.Button, { variant: "primary", onClick: handleConfirm, children: "Confirmar" })
3269
+ ] })
3270
+ ] });
3271
+ };
3272
+
3273
+ // src/modals/JustificativaModal.tsx
3274
+ var import_react25 = require("react");
3275
+ var import_react_bootstrap35 = require("react-bootstrap");
3276
+ var import_fa5 = require("react-icons/fa");
3277
+ var import_dayjs6 = __toESM(require("dayjs"));
3278
+ var import_jsx_runtime50 = require("react/jsx-runtime");
3279
+ var JustificativaModal = ({
3280
+ show,
3281
+ onClose,
3282
+ justificativas: initialJustificativas = [],
3283
+ currentUserId,
3284
+ currentUserName,
3285
+ onUpdateJustificativas
3286
+ }) => {
3287
+ const [localJustificativas, setLocalJustificativas] = (0, import_react25.useState)(initialJustificativas);
3288
+ const [novaDescricao, setNovaDescricao] = (0, import_react25.useState)("");
3289
+ const [editandoId, setEditandoId] = (0, import_react25.useState)(null);
3290
+ (0, import_react25.useEffect)(() => {
3291
+ setLocalJustificativas(initialJustificativas);
3292
+ }, [initialJustificativas]);
3293
+ const handleAddOrEdit = async () => {
3294
+ if (!novaDescricao.trim()) return;
3295
+ let updatedList = [];
3296
+ if (editandoId) {
3297
+ updatedList = localJustificativas.map(
3298
+ (j) => j.id === editandoId ? { ...j, descricao: novaDescricao } : j
3299
+ );
3300
+ setEditandoId(null);
3301
+ } else {
3302
+ const nova = {
3303
+ id: Math.random().toString(36).substr(2, 9),
3304
+ // Simples ID local se uuid não estiver disp.
3305
+ descricao: novaDescricao,
3306
+ user: { userId: currentUserId, firstName: currentUserName },
3307
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
3308
+ isNew: true
3309
+ };
3310
+ updatedList = [...localJustificativas, nova];
3311
+ }
3312
+ setNovaDescricao("");
3313
+ await onUpdateJustificativas(updatedList);
3314
+ setLocalJustificativas(updatedList);
3315
+ };
3316
+ const handleRemove = async (id) => {
3317
+ const updated = localJustificativas.map((j) => j.id === id ? { ...j, removed: true } : j);
3318
+ await onUpdateJustificativas(updated);
3319
+ setLocalJustificativas(updated);
3320
+ };
3321
+ const handleUndoRemove = async (id) => {
3322
+ const updated = localJustificativas.map((j) => j.id === id ? { ...j, removed: false } : j);
3323
+ await onUpdateJustificativas(updated);
3324
+ setLocalJustificativas(updated);
3325
+ };
3326
+ return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(import_react_bootstrap35.Modal, { show, onHide: onClose, centered: true, size: "lg", children: [
3327
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_react_bootstrap35.Modal.Header, { closeButton: true, children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_react_bootstrap35.Modal.Title, { children: "Justificativas / Coment\xE1rios" }) }),
3328
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(import_react_bootstrap35.Modal.Body, { children: [
3329
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(import_react_bootstrap35.Form, { className: "mb-4", children: [
3330
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(import_react_bootstrap35.Form.Group, { controlId: "justificativaInput", className: "mb-2", children: [
3331
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_react_bootstrap35.Form.Label, { className: "small text-muted fw-bold", children: "NOVO REGISTRO" }),
3332
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
3333
+ import_react_bootstrap35.Form.Control,
3334
+ {
3335
+ as: "textarea",
3336
+ rows: 2,
3337
+ value: novaDescricao,
3338
+ onChange: (e) => setNovaDescricao(e.target.value),
3339
+ placeholder: "Descreva o motivo ou informa\xE7\xE3o adicional..."
3340
+ }
3341
+ )
3342
+ ] }),
3343
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: "d-flex justify-content-end", children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_react_bootstrap35.Button, { variant: "primary", size: "sm", onClick: handleAddOrEdit, children: editandoId ? "Salvar Edi\xE7\xE3o" : "Adicionar Justificativa" }) })
3344
+ ] }),
3345
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_react_bootstrap35.ListGroup, { className: "border-0", children: localJustificativas.map((j) => {
3346
+ var _a, _b, _c;
3347
+ const isMe = ((_a = j.user) == null ? void 0 : _a.userId) === currentUserId;
3348
+ return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(
3349
+ import_react_bootstrap35.ListGroup.Item,
2067
3350
  {
3351
+ className: "border-0 px-0",
2068
3352
  style: {
2069
- position: "fixed",
2070
- top: 0,
2071
- left: 0,
2072
- right: 0,
2073
- bottom: 0,
2074
- backgroundColor: "rgba(0,0,0,0.8)",
2075
- zIndex: 9999,
3353
+ opacity: j.removed ? 0.5 : 1,
2076
3354
  display: "flex",
2077
3355
  flexDirection: "column",
2078
- alignItems: "center",
2079
- justifyContent: "center",
2080
- padding: "20px"
3356
+ alignItems: isMe ? "flex-start" : "flex-end",
3357
+ backgroundColor: "transparent"
2081
3358
  },
2082
- onClick: (e) => e.stopPropagation(),
2083
- children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { style: { width: "100%", maxWidth: "500px", backgroundColor: "#fff", borderRadius: "12px", padding: "20px", position: "relative" }, children: [
2084
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3359
+ children: [
3360
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "d-flex align-items-center mb-1", style: { width: "100%", justifyContent: isMe ? "flex-start" : "flex-end" }, children: [
3361
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: "small fw-bold text-dark me-2", children: isMe ? "Voc\xEA" : ((_b = j.user) == null ? void 0 : _b.userName) || ((_c = j.user) == null ? void 0 : _c.firstName) || "Usu\xE1rio" }),
3362
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_react_bootstrap35.Badge, { bg: "secondary", style: { fontSize: "0.65rem" }, children: (0, import_dayjs6.default)(j.createdAt).format("DD/MM [\xE0s] HH:mm") })
3363
+ ] }),
3364
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
2085
3365
  "div",
2086
3366
  {
2087
- onClick: toggleQr,
2088
- style: { position: "absolute", top: "10px", right: "15px", fontSize: "1.5rem", cursor: "pointer", zIndex: 10001 },
2089
- children: "\xD7"
3367
+ onClick: () => !j.removed && isMe && (setNovaDescricao(j.descricao), setEditandoId(j.id)),
3368
+ style: {
3369
+ maxWidth: "85%",
3370
+ alignSelf: isMe ? "flex-start" : "flex-end",
3371
+ backgroundColor: j.removed ? "#f8d7da" : isMe ? "#e3f2fd" : "#f8f9fa",
3372
+ color: "#333",
3373
+ padding: "12px 16px",
3374
+ borderRadius: "12px",
3375
+ cursor: isMe && !j.removed ? "pointer" : "default",
3376
+ textDecoration: j.removed ? "line-through" : "none",
3377
+ boxShadow: "0 1px 3px rgba(0,0,0,0.1)",
3378
+ border: isMe ? "1px solid #bbdefb" : "1px solid #e0e0e0"
3379
+ },
3380
+ children: j.descricao
2090
3381
  }
2091
3382
  ),
2092
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("h5", { className: "mb-3 text-center", children: "Escaneie o QR Code" }),
2093
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
2094
- QrReader,
3383
+ isMe && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: "mt-1 d-flex gap-2", children: j.removed ? /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_react_bootstrap35.OverlayTrigger, { placement: "top", overlay: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_react_bootstrap35.Tooltip, { children: "Desfazer" }), children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
3384
+ import_fa5.FaUndo,
2095
3385
  {
2096
- callback: (v) => {
2097
- toggleQr();
2098
- callback(v);
2099
- }
3386
+ onClick: () => handleUndoRemove(j.id),
3387
+ className: "text-success cursor-pointer",
3388
+ size: 14
2100
3389
  }
2101
- ),
2102
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { className: "mt-3 text-muted text-center small", children: "Aponte a c\xE2mera para o c\xF3digo" })
2103
- ] })
2104
- }
2105
- )
2106
- ]
3390
+ ) }) : /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_react_bootstrap35.OverlayTrigger, { placement: "top", overlay: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_react_bootstrap35.Tooltip, { children: "Remover" }), children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
3391
+ import_fa5.FaTrashAlt,
3392
+ {
3393
+ onClick: () => handleRemove(j.id),
3394
+ className: "text-danger cursor-pointer",
3395
+ size: 14
3396
+ }
3397
+ ) }) })
3398
+ ]
3399
+ },
3400
+ j.id
3401
+ );
3402
+ }) })
3403
+ ] }),
3404
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_react_bootstrap35.Modal.Footer, { children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_react_bootstrap35.Button, { variant: "outline-secondary", onClick: onClose, children: "Fechar" }) })
3405
+ ] });
3406
+ };
3407
+
3408
+ // src/modals/ImageViewModal.tsx
3409
+ var import_react26 = require("react");
3410
+ var import_react_bootstrap36 = require("react-bootstrap");
3411
+ var import_jsx_runtime51 = require("react/jsx-runtime");
3412
+ var ImageViewModal = ({
3413
+ show,
3414
+ onHide,
3415
+ imagesData = [],
3416
+ initialImageData,
3417
+ imageAltText = "Visualiza\xE7\xE3o de imagem",
3418
+ resolveImageUrl
3419
+ }) => {
3420
+ const [selectedImageKey, setSelectedImageKey] = (0, import_react26.useState)(null);
3421
+ const [imageSrc, setImageSrc] = (0, import_react26.useState)(null);
3422
+ const [currentAuthor, setCurrentAuthor] = (0, import_react26.useState)("Desconhecido");
3423
+ (0, import_react26.useEffect)(() => {
3424
+ if (show && initialImageData) {
3425
+ setSelectedImageKey(initialImageData.key);
3426
+ setCurrentAuthor(initialImageData.author || "Desconhecido");
3427
+ } else if (show && imagesData.length > 0) {
3428
+ setSelectedImageKey(imagesData[0].key);
3429
+ setCurrentAuthor(imagesData[0].author || "Desconhecido");
3430
+ }
3431
+ }, [show, initialImageData]);
3432
+ (0, import_react26.useEffect)(() => {
3433
+ if (show && selectedImageKey) {
3434
+ setImageSrc(null);
3435
+ const file = imagesData.find((f) => f.key === selectedImageKey);
3436
+ if (file == null ? void 0 : file.signedUrl) {
3437
+ setImageSrc(file.signedUrl);
3438
+ } else if (resolveImageUrl) {
3439
+ setImageSrc(resolveImageUrl(selectedImageKey));
3440
+ }
3441
+ }
3442
+ }, [show, selectedImageKey]);
3443
+ const renderImageSelector = () => {
3444
+ if (imagesData.length <= 1) return null;
3445
+ return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: "mb-3 d-flex flex-wrap justify-content-center gap-2", children: imagesData.map((img, idx) => /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
3446
+ import_react_bootstrap36.Button,
3447
+ {
3448
+ variant: selectedImageKey === img.key ? "primary" : "outline-secondary",
3449
+ size: "sm",
3450
+ onClick: () => {
3451
+ setSelectedImageKey(img.key);
3452
+ setCurrentAuthor(img.author || "Desconhecido");
3453
+ },
3454
+ children: img.dataContext ? `${img.dataContext}-${img.dataId}` : `Imagem ${idx + 1}`
3455
+ },
3456
+ idx
3457
+ )) });
3458
+ };
3459
+ const body = /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "text-center", children: [
3460
+ renderImageSelector(),
3461
+ imageSrc ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
3462
+ "img",
3463
+ {
3464
+ src: imageSrc,
3465
+ alt: imageAltText,
3466
+ className: "img-fluid rounded shadow-sm",
3467
+ style: { maxHeight: "75vh", objectFit: "contain" }
3468
+ }
3469
+ ) : /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: "p-5 text-muted", children: "Aguardando imagem..." })
3470
+ ] });
3471
+ return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
3472
+ ModalBasicTemplate_default,
3473
+ {
3474
+ header: "Visualiza\xE7\xE3o de Imagem",
3475
+ closeFunc: onHide,
3476
+ show,
3477
+ body,
3478
+ props: { size: "lg" },
3479
+ footer: () => /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "w-100 d-flex justify-content-between align-items-center", children: [
3480
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("small", { className: "text-muted", children: [
3481
+ "Enviado por: ",
3482
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("strong", { children: currentAuthor })
3483
+ ] }),
3484
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_react_bootstrap36.Button, { variant: "outline-secondary", size: "sm", onClick: onHide, children: "Fechar" })
3485
+ ] })
2107
3486
  }
2108
3487
  );
2109
3488
  };
2110
3489
 
2111
- // src/forms/FindRecursoByTagField.tsx
2112
- var import_jsx_runtime29 = require("react/jsx-runtime");
2113
- var FindRecursoByTagField = ({ callback, recursoController }) => {
2114
- const [selectedTag, setSelectedTag] = (0, import_react17.useState)("");
2115
- const [reachedRecurso, setReachedRecurso] = (0, import_react17.useState)(null);
2116
- const findRecursoByTagIdHandler = async (tagId) => {
3490
+ // src/tables/ReusableTableWithModal.tsx
3491
+ var import_react27 = require("react");
3492
+ var import_react_bootstrap37 = require("react-bootstrap");
3493
+ var import_jsx_runtime52 = require("react/jsx-runtime");
3494
+ var ReusableTableWithModal = ({
3495
+ fetchDataCallback,
3496
+ modalButtonCallback,
3497
+ configureColumnsCallback,
3498
+ headers,
3499
+ modalContent,
3500
+ confirmLabel = "Aceitar",
3501
+ onFetchData
3502
+ }) => {
3503
+ const [data, setData] = (0, import_react27.useState)([]);
3504
+ const [selectedItem, setSelectedItem] = (0, import_react27.useState)(null);
3505
+ const [showModal, setShowModal] = (0, import_react27.useState)(false);
3506
+ const [loading, setLoading] = (0, import_react27.useState)(false);
3507
+ const [tableDataRows, setTableDataRows] = (0, import_react27.useState)([]);
3508
+ const fetchData = async () => {
3509
+ setLoading(true);
2117
3510
  try {
2118
- const r = await recursoController.read("findRecursoByTagId", tagId);
2119
- setReachedRecurso(r);
3511
+ const response = await fetchDataCallback();
3512
+ onFetchData && onFetchData(response);
3513
+ setData(response);
3514
+ const items = Array.isArray(response) ? response : [response];
3515
+ const tabData = items.map((r) => configureColumnsCallback(r));
3516
+ setTableDataRows(tabData);
2120
3517
  } catch (error) {
2121
- console.error("Erro ao buscar recurso por tag ID:", error);
3518
+ console.error("Erro ao buscar dados na ReusableTable:", error);
3519
+ } finally {
3520
+ setLoading(false);
2122
3521
  }
2123
3522
  };
2124
- const findRecursoByTagDescriptionHandler = async (description) => {
2125
- try {
2126
- const formattedDescription = description.replace(/\s/g, "");
2127
- const recurso = await recursoController.read(
2128
- `recurso/findByTagDescription`,
2129
- formattedDescription
2130
- );
2131
- if (!callback) {
2132
- console.log("Recurso encontrado (sem callback):", recurso);
2133
- } else {
2134
- callback(recurso, true);
2135
- }
2136
- } catch (error) {
2137
- console.error("Erro ao buscar recurso por descri\xE7\xE3o de tag:", error);
2138
- }
3523
+ (0, import_react27.useEffect)(() => {
3524
+ fetchData();
3525
+ }, []);
3526
+ const handleRowClick = (td) => {
3527
+ setSelectedItem(td.dataObj);
3528
+ setShowModal(true);
2139
3529
  };
2140
- const confirmRecursoSelectionButton = () => {
2141
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
2142
- "div",
2143
- {
2144
- className: "hoverable-div",
2145
- style: {
2146
- border: "solid",
2147
- borderTopRightRadius: "3px",
2148
- borderBottomRightRadius: "3px",
2149
- padding: "8px",
2150
- borderLeft: "none",
2151
- borderColor: "#ccc",
2152
- borderWidth: "1px",
2153
- cursor: "pointer",
2154
- display: "flex",
2155
- alignItems: "center"
3530
+ const handleCloseModal = () => {
3531
+ setShowModal(false);
3532
+ setSelectedItem(null);
3533
+ };
3534
+ return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(import_jsx_runtime52.Fragment, { children: [
3535
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(import_react_bootstrap37.Table, { striped: true, bordered: true, hover: true, responsive: true, children: [
3536
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("tr", { children: headers.map((col, index) => /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("th", { children: col }, index)) }) }),
3537
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("tbody", { children: loading ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("td", { colSpan: headers.length, className: "text-center py-4", children: "Carregando..." }) }) : tableDataRows.length > 0 ? tableDataRows.map((td, index) => /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
3538
+ "tr",
3539
+ {
3540
+ onClick: () => handleRowClick(td),
3541
+ style: { cursor: "pointer" },
3542
+ children: td.columns.map((col, colIndex) => /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("td", { children: col || "N/A" }, colIndex))
2156
3543
  },
2157
- children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
2158
- import_gr4.GrCheckmark,
3544
+ index
3545
+ )) : /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("td", { colSpan: headers.length, className: "text-center py-4", children: "Nenhum dado encontrado." }) }) })
3546
+ ] }),
3547
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(import_react_bootstrap37.Modal, { show: showModal, onHide: handleCloseModal, centered: true, children: [
3548
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_react_bootstrap37.Modal.Header, { closeButton: true, children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_react_bootstrap37.Modal.Title, { children: "Detalhes" }) }),
3549
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_react_bootstrap37.Modal.Body, { children: selectedItem && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { children: modalContent ? modalContent(selectedItem) : "Visualizando detalhes do item." }) }),
3550
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(import_react_bootstrap37.Modal.Footer, { children: [
3551
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_react_bootstrap37.Button, { variant: "outline-secondary", onClick: handleCloseModal, children: "Fechar" }),
3552
+ modalButtonCallback && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
3553
+ import_react_bootstrap37.Button,
2159
3554
  {
2160
- size: 25,
2161
- onClick: () => reachedRecurso && callback(reachedRecurso, true)
3555
+ variant: "primary",
3556
+ onClick: () => {
3557
+ modalButtonCallback(selectedItem);
3558
+ handleCloseModal();
3559
+ },
3560
+ children: confirmLabel
2162
3561
  }
2163
3562
  )
2164
- }
2165
- );
2166
- };
2167
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
2168
- AutoComplete,
2169
- {
2170
- sortKey: "id",
2171
- loadCondition: true,
2172
- loadFunc: () => recursoController.get("findActiveRecursosTags"),
2173
- displayKey: "descricao",
2174
- title: "Selecione ou Digite a TAG",
2175
- isBold: true,
2176
- actionButton: confirmRecursoSelectionButton,
2177
- actionButton2: () => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
2178
- QrCodeScanButton,
2179
- {
2180
- callback: (description) => findRecursoByTagDescriptionHandler(description)
2181
- }
2182
- ),
2183
- onSelectedClick: (v) => {
2184
- setSelectedTag(v);
2185
- findRecursoByTagIdHandler(v.id);
2186
- },
2187
- value: (selectedTag == null ? void 0 : selectedTag.descricao) || ""
2188
- }
2189
- ) });
3563
+ ] })
3564
+ ] })
3565
+ ] });
2190
3566
  };
2191
3567
 
2192
- // src/icons/IconLabelItem.tsx
2193
- var import_jsx_runtime30 = require("react/jsx-runtime");
2194
- var IconLabelItem = ({
2195
- icon,
2196
- label,
2197
- containerClassName = "",
2198
- labelClassName = "",
2199
- onClick,
2200
- style
3568
+ // src/text/TextWithMore.tsx
3569
+ var import_react28 = require("react");
3570
+ var import_react_bootstrap38 = require("react-bootstrap");
3571
+ var import_jsx_runtime53 = require("react/jsx-runtime");
3572
+ var TextWithMore = ({
3573
+ text = "Carregando...",
3574
+ maxLength,
3575
+ moreLabel = "ver mais",
3576
+ lessLabel = "ver menos"
2201
3577
  }) => {
2202
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: containerClassName, onClick, style: { ...style, cursor: onClick ? "pointer" : "default" }, children: [
2203
- icon,
2204
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: labelClassName, children: label })
3578
+ const [expanded, setExpanded] = (0, import_react28.useState)(false);
3579
+ const handleToggleExpand = () => {
3580
+ setExpanded(!expanded);
3581
+ };
3582
+ const isTruncated = text.length > maxLength;
3583
+ const displayText = isTruncated && !expanded ? text.slice(0, maxLength) + "\u2026" : text;
3584
+ return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(import_jsx_runtime53.Fragment, { children: [
3585
+ /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: "text-with-more-content", children: displayText }),
3586
+ isTruncated && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
3587
+ import_react_bootstrap38.Button,
3588
+ {
3589
+ variant: "link",
3590
+ className: "p-0 ms-2",
3591
+ style: { fontSize: "0.85rem", textDecoration: "none" },
3592
+ onClick: handleToggleExpand,
3593
+ children: expanded ? lessLabel : moreLabel
3594
+ }
3595
+ )
2205
3596
  ] });
2206
3597
  };
2207
-
2208
- // src/icons/IconLabelList.tsx
2209
- var import_jsx_runtime31 = require("react/jsx-runtime");
2210
- var IconLabelList = ({ items, className = "" }) => {
2211
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: `icon-label-list ${className}`, children: items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
2212
- IconLabelItem,
2213
- {
2214
- labelClassName: "icon-label",
2215
- containerClassName: "icon-label-item",
2216
- icon: item.icon,
2217
- label: item.label,
2218
- onClick: item.onClick
2219
- },
2220
- index
2221
- )) });
2222
- };
2223
3598
  // Annotate the CommonJS export names for ESM import in node:
2224
3599
  0 && (module.exports = {
2225
3600
  ActionButtons,
2226
3601
  AddButton,
3602
+ AdvancedFilterBar,
2227
3603
  ApproveAndReproveButtons,
2228
3604
  AsyncButton,
2229
3605
  AutoComplete,
3606
+ BonusButton,
3607
+ ButtonWithDropdown,
3608
+ CheckBox,
2230
3609
  ClickToWriteField,
2231
3610
  ColorPicker,
2232
3611
  ConfigObject,
2233
3612
  DeleteButton,
2234
3613
  DeleteConfirm,
3614
+ ExpandableCard,
2235
3615
  FindRecursoByTagField,
2236
3616
  FormField,
2237
3617
  Generic3DotMenu,
3618
+ GenericChart,
2238
3619
  GenericDisplay,
2239
3620
  GenericForm,
3621
+ GenericREchart,
2240
3622
  GenericSelect,
2241
3623
  GenericSelectOps,
2242
3624
  IconLabelItem,
2243
3625
  IconLabelList,
3626
+ ImageViewModal,
3627
+ JustificativaModal,
2244
3628
  LoadingButton,
2245
3629
  LoadingProgress,
2246
3630
  MailSender,
2247
3631
  MenuEvent,
3632
+ ModalBasicTemplate,
2248
3633
  NavigateButton,
3634
+ NotificationBell,
3635
+ NotificationItem,
3636
+ PeriodSelector,
2249
3637
  QrCodeScanButton,
2250
3638
  QrReader,
3639
+ RecursoDisplayer,
2251
3640
  ResponsiveContainer,
3641
+ ReusableTableWithModal,
3642
+ SectorSelector,
3643
+ SelectDateModal,
2252
3644
  StatusBadge,
2253
3645
  StatusIndicator,
3646
+ StatusLight,
3647
+ StatusPills,
2254
3648
  Switch,
2255
3649
  SwitchOnClick,
3650
+ TextWithMore,
3651
+ TimerDisplay,
3652
+ UnidadeMaterialForm,
2256
3653
  UploadArea,
2257
3654
  UuidPill,
2258
3655
  VerticalItemsDisplay