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.mjs CHANGED
@@ -305,11 +305,124 @@ var AsyncButton = ({
305
305
  );
306
306
  };
307
307
 
308
+ // src/buttons/BonusButton.tsx
309
+ import { jsx as jsx8 } from "react/jsx-runtime";
310
+ var BonusButton = ({
311
+ renderCondition = true,
312
+ onClickCallback,
313
+ label,
314
+ className = "",
315
+ ...props
316
+ }) => {
317
+ if (!renderCondition) return null;
318
+ return /* @__PURE__ */ jsx8(
319
+ "button",
320
+ {
321
+ className: `bonus-button ${className}`,
322
+ onClick: onClickCallback,
323
+ ...props,
324
+ children: label
325
+ }
326
+ );
327
+ };
328
+
329
+ // src/buttons/ButtonWithDropdown.tsx
330
+ import { Button as Button7, ButtonGroup, Dropdown } from "react-bootstrap";
331
+ import { jsx as jsx9, jsxs as jsxs4 } from "react/jsx-runtime";
332
+ var ButtonWithDropdown = ({
333
+ title,
334
+ onClickButton,
335
+ options,
336
+ menuVariant = "light",
337
+ variant = "primary",
338
+ toggleVariant
339
+ }) => {
340
+ return /* @__PURE__ */ jsxs4(
341
+ Dropdown,
342
+ {
343
+ as: ButtonGroup,
344
+ className: "d-flex w-100",
345
+ style: { flex: 1, minWidth: 0 },
346
+ menuVariant,
347
+ children: [
348
+ /* @__PURE__ */ jsx9(
349
+ Button7,
350
+ {
351
+ variant,
352
+ onClick: onClickButton,
353
+ className: "flex-grow-1 text-truncate",
354
+ style: { minWidth: 0 },
355
+ children: title
356
+ }
357
+ ),
358
+ /* @__PURE__ */ jsx9(
359
+ Dropdown.Toggle,
360
+ {
361
+ split: true,
362
+ variant: toggleVariant || variant,
363
+ id: "dropdown-split-basic",
364
+ style: {
365
+ flex: "0 0 2.5rem",
366
+ width: "2.5rem",
367
+ padding: "0",
368
+ display: "flex",
369
+ justifyContent: "center",
370
+ alignItems: "center"
371
+ }
372
+ }
373
+ ),
374
+ /* @__PURE__ */ jsx9(Dropdown.Menu, { children: options.map((opt, idx) => /* @__PURE__ */ jsx9(Dropdown.Item, { onClick: opt.callback, children: opt.label }, `${opt.label}-${idx}`)) })
375
+ ]
376
+ }
377
+ );
378
+ };
379
+
380
+ // src/buttons/CheckBox.tsx
381
+ import { Form as Form3, InputGroup } from "react-bootstrap";
382
+ import { TiDelete } from "react-icons/ti";
383
+ import { jsx as jsx10, jsxs as jsxs5 } from "react/jsx-runtime";
384
+ var CheckBox = ({
385
+ opcoes,
386
+ isHover = false,
387
+ isCreator = false,
388
+ updateEvent,
389
+ deleteEvent,
390
+ enterEvent,
391
+ disabled = false,
392
+ className = ""
393
+ }) => {
394
+ if (isHover) {
395
+ return /* @__PURE__ */ jsx10("div", { className, children: opcoes.map((opcao, index) => /* @__PURE__ */ jsxs5(InputGroup, { style: { padding: 12, justifyItems: "center", opacity: disabled ? 0.5 : 1, pointerEvents: disabled ? "none" : "auto" }, children: [
396
+ /* @__PURE__ */ jsx10(InputGroup.Checkbox, {}),
397
+ /* @__PURE__ */ jsx10(
398
+ Form3.Control,
399
+ {
400
+ autoFocus: true,
401
+ onKeyDown: (event) => enterEvent && enterEvent(event, index, opcao),
402
+ style: { border: "none", borderBottom: "solid", borderRadius: 0, borderColor: "gray", borderWidth: "1px" },
403
+ value: isCreator ? "Nova opcao" : String(opcao.valor),
404
+ onChange: (event) => updateEvent && updateEvent(event, index)
405
+ }
406
+ ),
407
+ deleteEvent && /* @__PURE__ */ jsx10("span", { style: { cursor: "pointer" }, children: /* @__PURE__ */ jsx10(TiDelete, { size: "18", className: "delete text-danger", onClick: () => deleteEvent() }) })
408
+ ] }, index)) });
409
+ }
410
+ return /* @__PURE__ */ jsx10("div", { className, style: { textAlign: "start" }, children: opcoes.map((opcao, index) => /* @__PURE__ */ jsx10(
411
+ Form3.Check,
412
+ {
413
+ disabled,
414
+ type: "checkbox",
415
+ label: `${opcao.valor}`
416
+ },
417
+ index
418
+ )) });
419
+ };
420
+
308
421
  // src/buttons/Generic3DotMenu.tsx
309
422
  import { useState as useState4 } from "react";
310
- import { Button as Button7, Modal as Modal2 } from "react-bootstrap";
423
+ import { Button as Button8, Modal as Modal2 } from "react-bootstrap";
311
424
  import { CiMenuKebab } from "react-icons/ci";
312
- import { Fragment as Fragment2, jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
425
+ import { Fragment as Fragment2, jsx as jsx11, jsxs as jsxs6 } from "react/jsx-runtime";
313
426
  var MenuEvent = class {
314
427
  /**
315
428
  * @param label - O texto que aparecerá no botão.
@@ -346,16 +459,16 @@ var Generic3DotMenu = ({
346
459
  }
347
460
  return sections;
348
461
  }, {});
349
- return /* @__PURE__ */ jsxs4(Fragment2, { children: [
350
- /* @__PURE__ */ jsx8(CiMenuKebab, { onClick: handleShow, style: { cursor: "pointer" }, size: 25, title: tittle }),
351
- /* @__PURE__ */ jsxs4(Modal2, { show, onHide: handleClose, centered: true, children: [
352
- /* @__PURE__ */ jsx8(Modal2.Header, { closeButton: true, children: /* @__PURE__ */ jsx8(Modal2.Title, { children: tittle }) }),
353
- /* @__PURE__ */ jsxs4(Modal2.Body, { children: [
354
- Object.keys(groupedEvents).length === 0 && /* @__PURE__ */ jsx8("div", { className: "text-center text-muted", children: "Nenhuma op\xE7\xE3o dispon\xEDvel." }),
355
- Object.keys(groupedEvents).map((section, sectionIndex) => /* @__PURE__ */ jsxs4("div", { className: "mb-4", children: [
356
- /* @__PURE__ */ jsx8("h6", { className: "border-bottom pb-2 mb-3", children: section !== "default" ? section : "Op\xE7\xF5es Principais" }),
357
- /* @__PURE__ */ jsx8("div", { className: "d-grid gap-2", children: groupedEvents[section].map((event, index) => /* @__PURE__ */ jsx8(
358
- Button7,
462
+ return /* @__PURE__ */ jsxs6(Fragment2, { children: [
463
+ /* @__PURE__ */ jsx11(CiMenuKebab, { onClick: handleShow, style: { cursor: "pointer" }, size: 25, title: tittle }),
464
+ /* @__PURE__ */ jsxs6(Modal2, { show, onHide: handleClose, centered: true, children: [
465
+ /* @__PURE__ */ jsx11(Modal2.Header, { closeButton: true, children: /* @__PURE__ */ jsx11(Modal2.Title, { children: tittle }) }),
466
+ /* @__PURE__ */ jsxs6(Modal2.Body, { children: [
467
+ Object.keys(groupedEvents).length === 0 && /* @__PURE__ */ jsx11("div", { className: "text-center text-muted", children: "Nenhuma op\xE7\xE3o dispon\xEDvel." }),
468
+ Object.keys(groupedEvents).map((section, sectionIndex) => /* @__PURE__ */ jsxs6("div", { className: "mb-4", children: [
469
+ /* @__PURE__ */ jsx11("h6", { className: "border-bottom pb-2 mb-3", children: section !== "default" ? section : "Op\xE7\xF5es Principais" }),
470
+ /* @__PURE__ */ jsx11("div", { className: "d-grid gap-2", children: groupedEvents[section].map((event, index) => /* @__PURE__ */ jsx11(
471
+ Button8,
359
472
  {
360
473
  variant: event.variant || "primary",
361
474
  onClick: () => {
@@ -368,28 +481,28 @@ var Generic3DotMenu = ({
368
481
  )) })
369
482
  ] }, sectionIndex))
370
483
  ] }),
371
- /* @__PURE__ */ jsx8(Modal2.Footer, { children: /* @__PURE__ */ jsx8(Button7, { variant: "secondary", onClick: handleClose, children: "Fechar" }) })
484
+ /* @__PURE__ */ jsx11(Modal2.Footer, { children: /* @__PURE__ */ jsx11(Button8, { variant: "secondary", onClick: handleClose, children: "Fechar" }) })
372
485
  ] })
373
486
  ] });
374
487
  };
375
488
 
376
489
  // src/buttons/LoadingButton.tsx
377
- import { Button as Button8, Spinner as Spinner2 } from "react-bootstrap";
378
- import { jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
490
+ import { Button as Button9, Spinner as Spinner2 } from "react-bootstrap";
491
+ import { jsx as jsx12, jsxs as jsxs7 } from "react/jsx-runtime";
379
492
  var LoadingButton = ({
380
493
  onClick,
381
494
  loading = false,
382
495
  label = "Enviar",
383
496
  variant = "primary",
384
- size = "md",
497
+ size,
385
498
  disabled = false,
386
499
  icon = null,
387
500
  className = "",
388
501
  loadingLabel = "Carregando...",
389
502
  ...props
390
503
  }) => {
391
- return /* @__PURE__ */ jsx9(
392
- Button8,
504
+ return /* @__PURE__ */ jsx12(
505
+ Button9,
393
506
  {
394
507
  variant,
395
508
  size,
@@ -398,8 +511,8 @@ var LoadingButton = ({
398
511
  className: `loading-button ${className}`,
399
512
  style: { cursor: loading ? "not-allowed" : "pointer" },
400
513
  ...props,
401
- children: loading ? /* @__PURE__ */ jsxs5("div", { className: "align-items-center", children: [
402
- /* @__PURE__ */ jsx9(
514
+ children: loading ? /* @__PURE__ */ jsxs7("div", { className: "align-items-center", children: [
515
+ /* @__PURE__ */ jsx12(
403
516
  Spinner2,
404
517
  {
405
518
  as: "span",
@@ -410,18 +523,18 @@ var LoadingButton = ({
410
523
  className: "me-2"
411
524
  }
412
525
  ),
413
- /* @__PURE__ */ jsx9("span", { children: loadingLabel })
414
- ] }) : /* @__PURE__ */ jsxs5("div", { className: "align-items-center", children: [
415
- icon && /* @__PURE__ */ jsx9("span", { className: "me-2 d-flex", children: icon }),
416
- /* @__PURE__ */ jsx9("span", { children: label })
526
+ /* @__PURE__ */ jsx12("span", { children: loadingLabel })
527
+ ] }) : /* @__PURE__ */ jsxs7("div", { className: "align-items-center", children: [
528
+ icon && /* @__PURE__ */ jsx12("span", { className: "me-2 d-flex", children: icon }),
529
+ /* @__PURE__ */ jsx12("span", { children: label })
417
530
  ] })
418
531
  }
419
532
  );
420
533
  };
421
534
 
422
535
  // src/buttons/NavigateButton.tsx
423
- import { Button as Button9 } from "react-bootstrap";
424
- import { jsx as jsx10 } from "react/jsx-runtime";
536
+ import { Button as Button10 } from "react-bootstrap";
537
+ import { jsx as jsx13 } from "react/jsx-runtime";
425
538
  var NavigateButton = ({
426
539
  displayName,
427
540
  path,
@@ -439,8 +552,8 @@ var NavigateButton = ({
439
552
  }
440
553
  navigator2(path, config, pageName);
441
554
  };
442
- return /* @__PURE__ */ jsx10(
443
- Button9,
555
+ return /* @__PURE__ */ jsx13(
556
+ Button10,
444
557
  {
445
558
  style,
446
559
  variant,
@@ -452,8 +565,8 @@ var NavigateButton = ({
452
565
  };
453
566
 
454
567
  // src/buttons/StatusBadge.tsx
455
- import { Form as Form3, Spinner as Spinner3 } from "react-bootstrap";
456
- import { Fragment as Fragment3, jsx as jsx11, jsxs as jsxs6 } from "react/jsx-runtime";
568
+ import { Form as Form4, Spinner as Spinner3 } from "react-bootstrap";
569
+ import { Fragment as Fragment3, jsx as jsx14, jsxs as jsxs8 } from "react/jsx-runtime";
457
570
  var StatusBadge = ({
458
571
  status,
459
572
  showCheckbox = false,
@@ -470,9 +583,9 @@ var StatusBadge = ({
470
583
  CANCELED: "bg-danger text-white"
471
584
  };
472
585
  const badgeClass = statusClasses[status] || "bg-secondary text-white";
473
- return /* @__PURE__ */ jsx11("div", { className: "d-flex align-items-center gap-2", children: loading ? /* @__PURE__ */ jsx11(Spinner3, { animation: "border", size: "sm" }) : /* @__PURE__ */ jsxs6(Fragment3, { children: [
474
- showCheckbox && /* @__PURE__ */ jsx11(
475
- Form3.Check,
586
+ return /* @__PURE__ */ jsx14("div", { className: "d-flex align-items-center gap-2", children: loading ? /* @__PURE__ */ jsx14(Spinner3, { animation: "border", size: "sm" }) : /* @__PURE__ */ jsxs8(Fragment3, { children: [
587
+ showCheckbox && /* @__PURE__ */ jsx14(
588
+ Form4.Check,
476
589
  {
477
590
  type: "checkbox",
478
591
  checked,
@@ -480,7 +593,7 @@ var StatusBadge = ({
480
593
  className: "me-1"
481
594
  }
482
595
  ),
483
- /* @__PURE__ */ jsx11("span", { className: `badge ${badgeClass}`, children: status })
596
+ /* @__PURE__ */ jsx14("span", { className: `badge ${badgeClass}`, children: status })
484
597
  ] }) });
485
598
  };
486
599
 
@@ -488,10 +601,10 @@ var StatusBadge = ({
488
601
  import { useEffect as useEffect2, useState as useState5 } from "react";
489
602
  import { FaTimes } from "react-icons/fa";
490
603
  import { GrAddCircle } from "react-icons/gr";
491
- import { jsx as jsx12, jsxs as jsxs7 } from "react/jsx-runtime";
604
+ import { jsx as jsx15, jsxs as jsxs9 } from "react/jsx-runtime";
492
605
  var SwitchOnClick = ({
493
606
  children,
494
- placeHolder = /* @__PURE__ */ jsx12(
607
+ placeHolder = /* @__PURE__ */ jsx15(
495
608
  "div",
496
609
  {
497
610
  className: "text-center zoom-container",
@@ -499,7 +612,7 @@ var SwitchOnClick = ({
499
612
  fontSize: "1.2rem",
500
613
  color: "#666"
501
614
  },
502
- children: /* @__PURE__ */ jsx12(
615
+ children: /* @__PURE__ */ jsx15(
503
616
  GrAddCircle,
504
617
  {
505
618
  size: 25,
@@ -532,18 +645,107 @@ var SwitchOnClick = ({
532
645
  return () => window.removeEventListener("keydown", handleEscape);
533
646
  }, []);
534
647
  if (!clicked) {
535
- return /* @__PURE__ */ jsx12("div", { onClick: handleClick, style: { cursor: "pointer" }, children: placeHolder });
648
+ return /* @__PURE__ */ jsx15("div", { onClick: handleClick, style: { cursor: "pointer" }, children: placeHolder });
536
649
  }
537
- return /* @__PURE__ */ jsxs7("div", { className: `switch-on-click-container ${containerClassName}`, children: [
538
- /* @__PURE__ */ jsx12("div", { className: "close-icon", onClick: handleClose, children: /* @__PURE__ */ jsx12(FaTimes, { title: "Fechar" }) }),
650
+ return /* @__PURE__ */ jsxs9("div", { className: `switch-on-click-container ${containerClassName}`, children: [
651
+ /* @__PURE__ */ jsx15("div", { className: "close-icon", onClick: handleClose, children: /* @__PURE__ */ jsx15(FaTimes, { title: "Fechar" }) }),
539
652
  children({ handleClose })
540
653
  ] });
541
654
  };
542
655
 
656
+ // src/charts/GenericChart.tsx
657
+ import { Chart } from "react-google-charts";
658
+ import { jsx as jsx16 } from "react/jsx-runtime";
659
+ var GenericChart = ({
660
+ chartType,
661
+ graphID,
662
+ width = "100%",
663
+ height = "400px",
664
+ columns,
665
+ rows,
666
+ chartEvents,
667
+ options,
668
+ tooltipFormatter
669
+ }) => {
670
+ let datachart = [columns, ...rows];
671
+ if (tooltipFormatter) {
672
+ datachart = datachart.map((row, index) => {
673
+ if (index === 0) return row;
674
+ const formattedTooltip = tooltipFormatter(row);
675
+ return [...row, formattedTooltip];
676
+ });
677
+ datachart[0] = [...columns, { type: "string", role: "tooltip", p: { html: true } }];
678
+ }
679
+ return /* @__PURE__ */ jsx16(
680
+ Chart,
681
+ {
682
+ chartType,
683
+ options: { ...options, tooltip: { isHtml: true } },
684
+ data: datachart,
685
+ graphID,
686
+ width,
687
+ height,
688
+ chartEvents
689
+ }
690
+ );
691
+ };
692
+
693
+ // src/charts/GenericREchart.tsx
694
+ import {
695
+ ResponsiveContainer,
696
+ LineChart,
697
+ Line,
698
+ XAxis,
699
+ YAxis,
700
+ CartesianGrid,
701
+ Tooltip,
702
+ Legend
703
+ } from "recharts";
704
+ import dayjs from "dayjs";
705
+ import { jsx as jsx17, jsxs as jsxs10 } from "react/jsx-runtime";
706
+ var GenericREchart = ({
707
+ data = [],
708
+ lines = [],
709
+ xAxisKey = "data",
710
+ showGrid = true,
711
+ showLegend = true,
712
+ showTooltip = true,
713
+ width = "100%",
714
+ height = 400,
715
+ hideYAxis,
716
+ unit,
717
+ margin = { top: 20, right: 30, left: 20, bottom: 5 },
718
+ YAxisRange = [0, "auto"]
719
+ }) => {
720
+ const sortedData = [...data].sort(
721
+ (a, b) => new Date(a[xAxisKey]).getTime() - new Date(b[xAxisKey]).getTime()
722
+ );
723
+ return /* @__PURE__ */ jsx17("div", { style: { width, height }, children: /* @__PURE__ */ jsx17(ResponsiveContainer, { width: "100%", height: "100%", children: /* @__PURE__ */ jsxs10(LineChart, { data: sortedData, margin, children: [
724
+ showGrid && /* @__PURE__ */ jsx17(CartesianGrid, { strokeDasharray: "3 3" }),
725
+ /* @__PURE__ */ jsx17(
726
+ XAxis,
727
+ {
728
+ dataKey: xAxisKey,
729
+ reversed: false,
730
+ tickFormatter: (tick) => dayjs(tick).format("DD/MM/YY HH:mm")
731
+ }
732
+ ),
733
+ /* @__PURE__ */ jsx17(YAxis, { domain: YAxisRange, unit, hide: hideYAxis, type: "number" }),
734
+ showTooltip && /* @__PURE__ */ jsx17(
735
+ Tooltip,
736
+ {
737
+ labelFormatter: (label) => dayjs(label).format("DD/MM/YY HH:mm")
738
+ }
739
+ ),
740
+ showLegend && /* @__PURE__ */ jsx17(Legend, {}),
741
+ lines.map((lineCfg, idx) => /* @__PURE__ */ jsx17(Line, { ...lineCfg }, idx))
742
+ ] }) }) });
743
+ };
744
+
543
745
  // src/containers/ResponsiveContainer.tsx
544
746
  import { Modal as Modal3, ModalBody } from "react-bootstrap";
545
- import { jsx as jsx13, jsxs as jsxs8 } from "react/jsx-runtime";
546
- var ResponsiveContainer = ({
747
+ import { jsx as jsx18, jsxs as jsxs11 } from "react/jsx-runtime";
748
+ var ResponsiveContainer2 = ({
547
749
  title,
548
750
  show,
549
751
  setShow,
@@ -555,22 +757,85 @@ var ResponsiveContainer = ({
555
757
  setShow(false);
556
758
  if (onClose) onClose();
557
759
  };
558
- return /* @__PURE__ */ jsxs8(Modal3, { size: "lg", show, onHide: handleClose, scrollable, children: [
559
- /* @__PURE__ */ jsx13(Modal3.Header, { closeButton: true, onClick: handleClose }),
560
- /* @__PURE__ */ jsx13(ModalBody, { children })
760
+ return /* @__PURE__ */ jsxs11(Modal3, { size: "lg", show, onHide: handleClose, scrollable, children: [
761
+ /* @__PURE__ */ jsx18(Modal3.Header, { closeButton: true, onClick: handleClose }),
762
+ /* @__PURE__ */ jsx18(ModalBody, { children })
763
+ ] });
764
+ };
765
+ var ResponsiveContainer_default = ResponsiveContainer2;
766
+
767
+ // src/containers/ExpandableCard.tsx
768
+ import { useState as useState6 } from "react";
769
+ import { Card, ListGroup } from "react-bootstrap";
770
+ import { FaChevronDown } from "react-icons/fa";
771
+ import { jsx as jsx19, jsxs as jsxs12 } from "react/jsx-runtime";
772
+ var ExpandableCard = ({
773
+ items = [],
774
+ initialVisibleCount = 3,
775
+ expandable = true,
776
+ leftSideContent,
777
+ rightSideContent,
778
+ cardClassName = "",
779
+ cardBodyClassName = "",
780
+ cardBodyStyle,
781
+ isMobile = false
782
+ }) => {
783
+ const [expandedCard, setExpandedCard] = useState6(false);
784
+ const handleToggleExpandCard = () => {
785
+ setExpandedCard(!expandedCard);
786
+ };
787
+ const visibleItems = expandedCard ? items : items.slice(0, initialVisibleCount);
788
+ const shouldShowExpandButton = expandable && items.length > initialVisibleCount;
789
+ const renderContentWithToggle = (content) => {
790
+ return content;
791
+ };
792
+ return /* @__PURE__ */ jsxs12(Card, { className: `expandable-card ${cardClassName}`, children: [
793
+ leftSideContent && /* @__PURE__ */ jsx19("div", { className: "expandable-card-left-side", children: leftSideContent }),
794
+ /* @__PURE__ */ jsx19(Card.Body, { className: `expandable-card-body ${cardBodyClassName}`, style: cardBodyStyle, children: /* @__PURE__ */ jsxs12(ListGroup, { variant: "flush", children: [
795
+ visibleItems.map((item, index) => {
796
+ const isObject = typeof item === "object" && item !== null && "content" in item;
797
+ const itemObj = isObject ? item : { content: item };
798
+ const clickableClass = itemObj.clickable ? "expandable-card-list-item-clickable" : "";
799
+ return /* @__PURE__ */ jsx19(
800
+ ListGroup.Item,
801
+ {
802
+ className: `expandable-card-list-item ${clickableClass}`,
803
+ children: isMobile ? /* @__PURE__ */ jsxs12("div", { className: "expandable-card-item", children: [
804
+ itemObj.label && /* @__PURE__ */ jsx19("div", { className: "expandable-card-item-header", children: /* @__PURE__ */ jsx19("strong", { children: itemObj.label }) }),
805
+ /* @__PURE__ */ jsx19("div", { className: "expandable-card-item-content", children: renderContentWithToggle(itemObj.content) })
806
+ ] }) : /* @__PURE__ */ jsxs12("div", { className: "expandable-card-item-row", children: [
807
+ itemObj.label && /* @__PURE__ */ jsxs12("strong", { className: "expandable-card-item-label", children: [
808
+ itemObj.label,
809
+ ":"
810
+ ] }),
811
+ /* @__PURE__ */ jsx19("span", { className: "expandable-card-item-content", children: renderContentWithToggle(itemObj.content) })
812
+ ] })
813
+ },
814
+ index
815
+ );
816
+ }),
817
+ shouldShowExpandButton && /* @__PURE__ */ jsx19(
818
+ ListGroup.Item,
819
+ {
820
+ className: `expandable-card-toggle ${expandedCard ? "expanded" : ""}`,
821
+ onClick: handleToggleExpandCard,
822
+ children: /* @__PURE__ */ jsx19(FaChevronDown, { className: "expandable-card-toggle-icon" })
823
+ }
824
+ )
825
+ ] }) }),
826
+ rightSideContent && /* @__PURE__ */ jsx19("div", { className: "expandable-card-right-side", children: rightSideContent })
561
827
  ] });
562
828
  };
563
- var ResponsiveContainer_default = ResponsiveContainer;
564
829
 
565
830
  // src/displays/UuidPill.tsx
566
- import { useState as useState6, useRef as useRef3 } from "react";
567
- import { Badge, Overlay, Tooltip } from "react-bootstrap";
568
- import { Fragment as Fragment4, jsx as jsx14, jsxs as jsxs9 } from "react/jsx-runtime";
831
+ import { useState as useState7, useRef as useRef3 } from "react";
832
+ import { Badge, Overlay, Tooltip as Tooltip2 } from "react-bootstrap";
833
+ import { Fragment as Fragment4, jsx as jsx20, jsxs as jsxs13 } from "react/jsx-runtime";
569
834
  var UuidPill = ({ uuid, bg = "light", textColor = "dark", short = 8 }) => {
570
- const [copied, setCopied] = useState6(false);
835
+ const [copied, setCopied] = useState7(false);
571
836
  const ref = useRef3(null);
572
- const [showTooltip, setShowTooltip] = useState6(false);
573
- if (!uuid) return /* @__PURE__ */ jsx14("span", { className: "text-muted", children: "\u2014" });
837
+ const [showTooltip, setShowTooltip] = useState7(false);
838
+ if (!uuid) return /* @__PURE__ */ jsx20("span", { className: "text-muted", children: "\u2014" });
574
839
  const shortId = String(uuid).substring(0, short);
575
840
  const handleCopy = async (e) => {
576
841
  e.stopPropagation();
@@ -587,8 +852,8 @@ var UuidPill = ({ uuid, bg = "light", textColor = "dark", short = 8 }) => {
587
852
  setCopied(true);
588
853
  setTimeout(() => setCopied(false), 1500);
589
854
  };
590
- return /* @__PURE__ */ jsxs9(Fragment4, { children: [
591
- /* @__PURE__ */ jsxs9(
855
+ return /* @__PURE__ */ jsxs13(Fragment4, { children: [
856
+ /* @__PURE__ */ jsxs13(
592
857
  Badge,
593
858
  {
594
859
  ref,
@@ -609,19 +874,19 @@ var UuidPill = ({ uuid, bg = "light", textColor = "dark", short = 8 }) => {
609
874
  ]
610
875
  }
611
876
  ),
612
- /* @__PURE__ */ jsx14(Overlay, { target: ref.current, show: showTooltip, placement: "top", children: (props) => /* @__PURE__ */ jsx14(Tooltip, { ...props, children: copied ? /* @__PURE__ */ jsx14("span", { style: { color: "#6f6" }, children: "Copiado!" }) : /* @__PURE__ */ jsxs9("span", { style: { fontFamily: "monospace", fontSize: "0.75rem" }, children: [
877
+ /* @__PURE__ */ jsx20(Overlay, { target: ref.current, show: showTooltip, placement: "top", children: (props) => /* @__PURE__ */ jsx20(Tooltip2, { ...props, children: copied ? /* @__PURE__ */ jsx20("span", { style: { color: "#6f6" }, children: "Copiado!" }) : /* @__PURE__ */ jsxs13("span", { style: { fontFamily: "monospace", fontSize: "0.75rem" }, children: [
613
878
  uuid,
614
- /* @__PURE__ */ jsx14("br", {}),
615
- /* @__PURE__ */ jsx14("small", { className: "text-muted", children: "Clique para copiar" })
879
+ /* @__PURE__ */ jsx20("br", {}),
880
+ /* @__PURE__ */ jsx20("small", { className: "text-muted", children: "Clique para copiar" })
616
881
  ] }) }) })
617
882
  ] });
618
883
  };
619
884
  var UuidPill_default = UuidPill;
620
885
 
621
886
  // src/displays/GenericDisplay.tsx
622
- import React8, { useState as useState7, useEffect as useEffect3 } from "react";
887
+ import React9, { useState as useState8, useEffect as useEffect3 } from "react";
623
888
  import { Col, Container, Row } from "react-bootstrap";
624
- import { Fragment as Fragment5, jsx as jsx15, jsxs as jsxs10 } from "react/jsx-runtime";
889
+ import { Fragment as Fragment5, jsx as jsx21, jsxs as jsxs14 } from "react/jsx-runtime";
625
890
  var ConfigObject = class {
626
891
  constructor(dotNotation, style, onClick, onBlur, onHideClick, hidden, mapData, additionalComponents) {
627
892
  this.dotNotation = dotNotation;
@@ -671,16 +936,16 @@ var buildData = (obj, propertiesMap, configObjects, opn, innerArray, dispatch, i
671
936
  const onClick = getOnClick(innerConfigs);
672
937
  const extraComponents = getAdditionalComponentes(innerConfigs);
673
938
  if (Array.isArray(obj)) {
674
- return /* @__PURE__ */ jsxs10(Container, { onClick, style: { ...styles }, children: [
675
- opn && /* @__PURE__ */ jsx15("div", { style: { textAlign: "center" }, children: /* @__PURE__ */ jsx15("strong", { children: opn }) }),
939
+ return /* @__PURE__ */ jsxs14(Container, { onClick, style: { ...styles }, children: [
940
+ opn && /* @__PURE__ */ jsx21("div", { style: { textAlign: "center" }, children: /* @__PURE__ */ jsx21("strong", { children: opn }) }),
676
941
  obj.map((o, index) => {
677
942
  const mapCopy = [...newPropertiesMap, `[${index}]`];
678
- return /* @__PURE__ */ jsx15(Row, { style: { padding: 4, ...styles }, children: buildData(o, mapCopy, configObjects, null, true, null, false, editButtonRenderer) }, index);
943
+ return /* @__PURE__ */ jsx21(Row, { style: { padding: 4, ...styles }, children: buildData(o, mapCopy, configObjects, null, true, null, false, editButtonRenderer) }, index);
679
944
  })
680
945
  ] });
681
946
  }
682
947
  if (typeof obj === "object" && obj != null) {
683
- return /* @__PURE__ */ jsxs10(
948
+ return /* @__PURE__ */ jsxs14(
684
949
  Container,
685
950
  {
686
951
  onClick,
@@ -693,17 +958,17 @@ var buildData = (obj, propertiesMap, configObjects, opn, innerArray, dispatch, i
693
958
  ...styles
694
959
  },
695
960
  children: [
696
- opn && /* @__PURE__ */ jsx15("strong", { children: opn }),
961
+ opn && /* @__PURE__ */ jsx21("strong", { children: opn }),
697
962
  Object.entries(obj).map(
698
963
  ([key, value]) => buildData(value, newPropertiesMap, configObjects, key, false, null, false, editButtonRenderer)
699
964
  ),
700
- extraComponents.length > 0 ? extraComponents.map((comp, i) => /* @__PURE__ */ jsx15(React8.Fragment, { children: comp() }, i)) : isRoot && editButtonRenderer ? editButtonRenderer(obj, opn) : null
965
+ extraComponents.length > 0 ? extraComponents.map((comp, i) => /* @__PURE__ */ jsx21(React9.Fragment, { children: comp() }, i)) : isRoot && editButtonRenderer ? editButtonRenderer(obj, opn) : null
701
966
  ]
702
967
  }
703
968
  );
704
969
  }
705
- return /* @__PURE__ */ jsxs10(Col, { children: [
706
- /* @__PURE__ */ jsxs10("strong", { children: [
970
+ return /* @__PURE__ */ jsxs14(Col, { children: [
971
+ /* @__PURE__ */ jsxs14("strong", { children: [
707
972
  opn,
708
973
  ": "
709
974
  ] }),
@@ -719,7 +984,7 @@ var GenericDisplay = ({
719
984
  onRefresh,
720
985
  editButtonRenderer
721
986
  }) => {
722
- const [innerOptions, setInnerOptions] = useState7();
987
+ const [innerOptions, setInnerOptions] = useState8();
723
988
  const refreshFunc = () => {
724
989
  if (loadFunc) {
725
990
  loadFunc().then((res) => {
@@ -740,12 +1005,12 @@ var GenericDisplay = ({
740
1005
  refreshFunc();
741
1006
  }
742
1007
  }, [context]);
743
- return /* @__PURE__ */ jsx15(Fragment5, { children: innerOptions && innerOptions.map((cObj, index) => /* @__PURE__ */ jsx15(Container, { style: { padding: 4, border: "solid" }, children: buildData(cObj, [], configObjects, rootName || null, false, null, true, editButtonRenderer) }, index)) });
1008
+ return /* @__PURE__ */ jsx21(Fragment5, { children: innerOptions && innerOptions.map((cObj, index) => /* @__PURE__ */ jsx21(Container, { style: { padding: 4, border: "solid" }, children: buildData(cObj, [], configObjects, rootName || null, false, null, true, editButtonRenderer) }, index)) });
744
1009
  };
745
1010
  var GenericDisplay_default = GenericDisplay;
746
1011
 
747
1012
  // src/displays/StatusIndicator.tsx
748
- import { jsx as jsx16, jsxs as jsxs11 } from "react/jsx-runtime";
1013
+ import { jsx as jsx22, jsxs as jsxs15 } from "react/jsx-runtime";
749
1014
  var StatusIndicator = ({
750
1015
  status,
751
1016
  count,
@@ -760,14 +1025,14 @@ var StatusIndicator = ({
760
1025
  naoAtribuida: "N\xC3O ATRIBUIDA"
761
1026
  };
762
1027
  const label = statusLabels[status] || status.toUpperCase();
763
- return /* @__PURE__ */ jsxs11("div", { className: `status-flag ${status} ${containerClassName}`, children: [
764
- /* @__PURE__ */ jsx16("div", { className: "status-label", children: label }),
765
- /* @__PURE__ */ jsx16("div", { className: "status-count", children: count })
1028
+ return /* @__PURE__ */ jsxs15("div", { className: `status-flag ${status} ${containerClassName}`, children: [
1029
+ /* @__PURE__ */ jsx22("div", { className: "status-label", children: label }),
1030
+ /* @__PURE__ */ jsx22("div", { className: "status-count", children: count })
766
1031
  ] });
767
1032
  };
768
1033
 
769
1034
  // src/displays/VerticalItemsDisplay.tsx
770
- import { jsx as jsx17, jsxs as jsxs12 } from "react/jsx-runtime";
1035
+ import { jsx as jsx23, jsxs as jsxs16 } from "react/jsx-runtime";
771
1036
  var VerticalItemsDisplay = ({
772
1037
  item1 = "",
773
1038
  item2 = "",
@@ -775,436 +1040,169 @@ var VerticalItemsDisplay = ({
775
1040
  className = "",
776
1041
  style
777
1042
  }) => {
778
- return /* @__PURE__ */ jsxs12("div", { className, style, children: [
779
- /* @__PURE__ */ jsx17("div", { children: item1 }),
780
- /* @__PURE__ */ jsx17("div", { children: item2 }),
781
- /* @__PURE__ */ jsx17("div", { children: item3 })
1043
+ return /* @__PURE__ */ jsxs16("div", { className, style, children: [
1044
+ /* @__PURE__ */ jsx23("div", { children: item1 }),
1045
+ /* @__PURE__ */ jsx23("div", { children: item2 }),
1046
+ /* @__PURE__ */ jsx23("div", { children: item3 })
782
1047
  ] });
783
1048
  };
784
1049
 
785
- // src/forms/MailSender.tsx
786
- import { useState as useState8 } from "react";
787
- import {
788
- Button as Button10,
789
- Card,
790
- Col as Col2,
791
- Form as Form4,
792
- Row as Row2,
793
- Spinner as Spinner4,
794
- Badge as Badge2,
795
- InputGroup
796
- } from "react-bootstrap";
797
- import { FiMail, FiSearch, FiUser, FiX, FiPlus, FiSend } from "react-icons/fi";
798
- import { Fragment as Fragment6, jsx as jsx18, jsxs as jsxs13 } from "react/jsx-runtime";
799
- var MailSender = ({
800
- htmlContent,
801
- companyName,
802
- onFetchEmails,
803
- onSendEmail,
804
- hide = false,
805
- renderTrigger
1050
+ // src/displays/StatusLight.tsx
1051
+ import { jsx as jsx24 } from "react/jsx-runtime";
1052
+ var StatusLight = ({
1053
+ active = false,
1054
+ activeLightColor = "green",
1055
+ inactiveLightColor = "gray",
1056
+ size = "20px",
1057
+ className = "",
1058
+ style
806
1059
  }) => {
807
- const [opened, setOpened] = useState8(false);
808
- const [addingEmail, setAddingEmail] = useState8(false);
809
- const [selectedEmails, setSelectedEmails] = useState8([]);
810
- const [emails, setEmails] = useState8([]);
811
- const [loading, setLoading] = useState8(false);
812
- const [postLoading, setPostLoading] = useState8(false);
813
- const [customEmail, setCustomEmail] = useState8("");
814
- const [emailError, setEmailError] = useState8("");
815
- const [searchFilter, setSearchFilter] = useState8("");
816
- const handleOpen = async () => {
817
- setLoading(true);
818
- try {
819
- const data = await onFetchEmails();
820
- setEmails(data || []);
821
- setOpened(true);
822
- } catch (err) {
823
- console.error("Erro ao buscar e-mails:", err);
824
- } finally {
825
- setLoading(false);
826
- }
827
- };
828
- const mailListLinter = () => {
829
- const result = [];
830
- const seen = /* @__PURE__ */ new Set();
831
- if (emails) {
832
- for (const item of emails) {
833
- if (item.email && !seen.has(item.email)) {
834
- seen.add(item.email);
835
- result.push({ email: item.email });
836
- }
1060
+ const color = active ? activeLightColor : inactiveLightColor;
1061
+ return /* @__PURE__ */ jsx24(
1062
+ "div",
1063
+ {
1064
+ className,
1065
+ style: {
1066
+ backgroundColor: color,
1067
+ borderRadius: "50%",
1068
+ width: size,
1069
+ height: size,
1070
+ display: "inline-block",
1071
+ transition: "background-color 0.3s ease",
1072
+ ...style
837
1073
  }
838
1074
  }
839
- return result;
1075
+ );
1076
+ };
1077
+
1078
+ // src/displays/TimerDisplay.tsx
1079
+ import dayjs2 from "dayjs";
1080
+ import duration from "dayjs/plugin/duration";
1081
+ import { BiTimer } from "react-icons/bi";
1082
+ import { BsPause, BsPlay } from "react-icons/bs";
1083
+ import { Fragment as Fragment6, jsx as jsx25, jsxs as jsxs17 } from "react/jsx-runtime";
1084
+ dayjs2.extend(duration);
1085
+ var TimerDisplay = ({
1086
+ id,
1087
+ tempo = 0,
1088
+ isStopped = false,
1089
+ pausable = false,
1090
+ playable = false,
1091
+ enableView = true,
1092
+ onPause,
1093
+ onPlay,
1094
+ emptyMessage = "Timer ainda n\xE3o iniciado."
1095
+ }) => {
1096
+ const handlePause = (e) => {
1097
+ e.stopPropagation();
1098
+ if (id && onPause) onPause(id);
840
1099
  };
841
- const filteredEmails = emails ? mailListLinter().filter(
842
- (email) => email.email.toLowerCase().includes(searchFilter.toLowerCase()) && !selectedEmails.some((selected) => (selected.email || selected) === email.email)
843
- ) : [];
844
- const sendEmail = async () => {
845
- const emailString = selectedEmails.map((email) => email.email ? email.email : email).join(", ");
846
- const emailData = {
847
- to: emailString,
848
- subject: `Relat\xF3rio - ${companyName}`,
849
- text: `Relat\xF3rio de processo da empresa ${companyName}`,
850
- html: htmlContent
851
- };
852
- setPostLoading(true);
853
- try {
854
- await onSendEmail(emailData);
855
- setSelectedEmails([]);
856
- setCustomEmail("");
857
- setOpened(false);
858
- } catch (err) {
859
- console.error("Erro ao enviar e-mail:", err);
860
- } finally {
861
- setPostLoading(false);
862
- }
1100
+ const handlePlay = (e) => {
1101
+ e.stopPropagation();
1102
+ if (id && onPlay) onPlay(id);
863
1103
  };
864
- const validateEmail = (email) => {
865
- const re = /\S+@\S+\.\S+/;
866
- return re.test(email);
1104
+ const formatDuration = (seconds) => {
1105
+ if (!enableView) return "- : - : -";
1106
+ const time = dayjs2.duration(seconds, "seconds");
1107
+ const days = Math.floor(time.asDays());
1108
+ const hours = time.hours().toString().padStart(2, "0");
1109
+ const minutes = time.minutes().toString().padStart(2, "0");
1110
+ const secondsRemaining = time.seconds().toString().padStart(2, "0");
1111
+ return days > 0 ? `${days}d ${hours}:${minutes}:${secondsRemaining}` : `${hours}:${minutes}:${secondsRemaining}`;
867
1112
  };
868
- const handleEmailAdd = () => {
869
- if (!customEmail.trim()) {
870
- setEmailError("Por favor, digite um e-mail");
871
- return;
872
- }
873
- if (!validateEmail(customEmail)) {
874
- setEmailError("Formato de e-mail inv\xE1lido");
875
- return;
876
- }
877
- if (selectedEmails.some((email) => (email.email || email) === customEmail)) {
878
- setEmailError("Este e-mail j\xE1 foi selecionado");
879
- return;
1113
+ return /* @__PURE__ */ jsx25("div", { className: "timer-display-container", children: /* @__PURE__ */ jsx25("div", { className: "timer-display-content", children: id ? /* @__PURE__ */ jsxs17(Fragment6, { children: [
1114
+ /* @__PURE__ */ jsx25(
1115
+ BiTimer,
1116
+ {
1117
+ size: 24,
1118
+ className: "timer-icon",
1119
+ title: "Timer"
1120
+ }
1121
+ ),
1122
+ pausable && !isStopped && /* @__PURE__ */ jsx25(
1123
+ BsPause,
1124
+ {
1125
+ size: 20,
1126
+ className: "timer-icon-action",
1127
+ onClick: handlePause,
1128
+ title: "Pausar"
1129
+ }
1130
+ ),
1131
+ playable && !isStopped && /* @__PURE__ */ jsx25(
1132
+ BsPlay,
1133
+ {
1134
+ size: 20,
1135
+ className: "timer-icon-action",
1136
+ onClick: handlePlay,
1137
+ title: "Iniciar"
1138
+ }
1139
+ ),
1140
+ /* @__PURE__ */ jsx25("span", { className: "timer-display-time", children: formatDuration(tempo) })
1141
+ ] }) : /* @__PURE__ */ jsx25("span", { className: "timer-display-message", children: emptyMessage }) }) });
1142
+ };
1143
+
1144
+ // src/displays/RecursoDisplayer.tsx
1145
+ import { useState as useState13, useEffect as useEffect6 } from "react";
1146
+ import { Button as Button11, Spinner as Spinner5 } from "react-bootstrap";
1147
+
1148
+ // src/forms/FindRecursoByTagField.tsx
1149
+ import { useState as useState12 } from "react";
1150
+ import { GrCheckmark as GrCheckmark2 } from "react-icons/gr";
1151
+
1152
+ // src/forms/AutoComplete.tsx
1153
+ import { useEffect as useEffect4, useMemo, useState as useState9 } from "react";
1154
+ import { FloatingLabel, Form as Form5, InputGroup as InputGroup2, ListGroup as ListGroup2, Spinner as Spinner4 } from "react-bootstrap";
1155
+ import { jsx as jsx26, jsxs as jsxs18 } from "react/jsx-runtime";
1156
+ var AutoComplete = ({
1157
+ className,
1158
+ ops = [],
1159
+ sortKey,
1160
+ displayKey,
1161
+ displayKeys,
1162
+ onValueChanged,
1163
+ onSelectedClick,
1164
+ value,
1165
+ actionButton,
1166
+ actionButton2,
1167
+ placeH,
1168
+ title,
1169
+ filter,
1170
+ filterField,
1171
+ loadFunc,
1172
+ loadCondition,
1173
+ onBlurEvent,
1174
+ formatationFunc,
1175
+ onEscKeyDown,
1176
+ onEnterKeyDown,
1177
+ margT,
1178
+ margB,
1179
+ hideComponent,
1180
+ disableComponent = false,
1181
+ disableSelect = false,
1182
+ autoFocusConfig,
1183
+ onLoad,
1184
+ cacheKey,
1185
+ minChars = 0,
1186
+ maxItems,
1187
+ showListOnFocus = true,
1188
+ lazyLoad = false
1189
+ }) => {
1190
+ const [liItem, setListItem] = useState9([]);
1191
+ const [options, setOptions] = useState9([]);
1192
+ const [input, setInput] = useState9("");
1193
+ const [hide, setHide] = useState9(true);
1194
+ const [onLoaded, setOnLoaded] = useState9(false);
1195
+ const [loading, setLoading] = useState9(false);
1196
+ const cacheStore = useMemo(() => {
1197
+ const win = window;
1198
+ if (!win.__AUTO_COMPLETE_CACHE__) {
1199
+ win.__AUTO_COMPLETE_CACHE__ = /* @__PURE__ */ new Map();
880
1200
  }
881
- setSelectedEmails([...selectedEmails, customEmail]);
882
- setCustomEmail("");
883
- setEmailError("");
884
- setAddingEmail(false);
885
- };
886
- const handleEmailRemove = (emailToRemove) => {
887
- setSelectedEmails(
888
- selectedEmails.filter(
889
- (email) => (email.email || email) !== (emailToRemove.email || emailToRemove)
890
- )
891
- );
892
- };
893
- if (hide) return null;
894
- if (!opened) {
895
- if (renderTrigger) {
896
- return renderTrigger({ onClick: handleOpen, loading });
897
- }
898
- return /* @__PURE__ */ jsx18(Button10, { disabled: loading, className: "w-100", onClick: handleOpen, children: loading ? "Carregando..." : "Enviar por E-mail" });
899
- }
900
- return /* @__PURE__ */ jsxs13(
901
- "div",
902
- {
903
- style: {
904
- backgroundColor: "#f8f9fa",
905
- borderRadius: "12px",
906
- overflow: "hidden",
907
- border: "1px solid #dee2e6",
908
- boxShadow: "0 4px 6px rgba(0, 0, 0, 0.1)"
909
- },
910
- children: [
911
- /* @__PURE__ */ jsx18(
912
- "div",
913
- {
914
- style: {
915
- background: "linear-gradient(135deg, #28a745 0%, #20c997 100%)",
916
- color: "white",
917
- padding: "25px"
918
- },
919
- children: /* @__PURE__ */ jsxs13("div", { className: "d-flex justify-content-between align-items-center", children: [
920
- /* @__PURE__ */ jsxs13("div", { children: [
921
- /* @__PURE__ */ jsxs13("h4", { className: "mb-1", style: { fontWeight: "600", fontSize: "22px" }, children: [
922
- /* @__PURE__ */ jsx18(FiMail, { className: "me-2", size: 20 }),
923
- "Enviar Relat\xF3rio por E-mail"
924
- ] }),
925
- /* @__PURE__ */ jsxs13("small", { style: { opacity: "0.9", fontSize: "14px" }, children: [
926
- "Selecione os destinat\xE1rios para envio do relat\xF3rio de ",
927
- companyName
928
- ] })
929
- ] }),
930
- /* @__PURE__ */ jsxs13("div", { className: "d-flex gap-2", children: [
931
- /* @__PURE__ */ jsx18(
932
- Button10,
933
- {
934
- variant: "light",
935
- onClick: sendEmail,
936
- disabled: selectedEmails.length === 0 || postLoading,
937
- style: {
938
- borderRadius: "8px",
939
- fontWeight: "600",
940
- minWidth: "130px",
941
- height: "40px"
942
- },
943
- children: postLoading ? /* @__PURE__ */ jsxs13(Fragment6, { children: [
944
- /* @__PURE__ */ jsx18(Spinner4, { size: "sm", className: "me-2" }),
945
- "Enviando..."
946
- ] }) : /* @__PURE__ */ jsxs13(Fragment6, { children: [
947
- /* @__PURE__ */ jsx18(FiSend, { className: "me-2", size: 14 }),
948
- "Enviar E-mail"
949
- ] })
950
- }
951
- ),
952
- /* @__PURE__ */ jsx18(
953
- Button10,
954
- {
955
- variant: "outline-light",
956
- onClick: () => setOpened(false),
957
- disabled: postLoading,
958
- style: { borderRadius: "8px", width: "40px", height: "40px" },
959
- children: /* @__PURE__ */ jsx18(FiX, { size: 16 })
960
- }
961
- )
962
- ] })
963
- ] })
964
- }
965
- ),
966
- /* @__PURE__ */ jsxs13("div", { style: { padding: "25px" }, children: [
967
- /* @__PURE__ */ jsx18(Card, { className: "mb-4", style: { border: "none", boxShadow: "0 2px 8px rgba(0,0,0,0.05)" }, children: /* @__PURE__ */ jsxs13(Card.Body, { style: { padding: "20px" }, children: [
968
- /* @__PURE__ */ jsxs13(Row2, { className: "align-items-center", children: [
969
- /* @__PURE__ */ jsxs13(Col2, { md: 6, children: [
970
- /* @__PURE__ */ jsx18("h6", { className: "mb-2", style: { color: "#495057", fontWeight: "600" }, children: "\u{1F527} Filtros e A\xE7\xF5es" }),
971
- /* @__PURE__ */ jsxs13(InputGroup, { style: { maxWidth: "300px" }, children: [
972
- /* @__PURE__ */ jsx18(InputGroup.Text, { style: { backgroundColor: "#f8f9fa", border: "1px solid #dee2e6" }, children: /* @__PURE__ */ jsx18(FiSearch, { size: 14, color: "#6c757d" }) }),
973
- /* @__PURE__ */ jsx18(
974
- Form4.Control,
975
- {
976
- type: "text",
977
- placeholder: "Buscar e-mails...",
978
- value: searchFilter,
979
- onChange: (e) => setSearchFilter(e.target.value),
980
- style: { border: "1px solid #dee2e6" }
981
- }
982
- )
983
- ] })
984
- ] }),
985
- /* @__PURE__ */ jsx18(Col2, { md: 6, className: "text-end", children: /* @__PURE__ */ jsx18(
986
- Button10,
987
- {
988
- variant: addingEmail ? "outline-secondary" : "outline-primary",
989
- size: "sm",
990
- onClick: () => setAddingEmail(!addingEmail),
991
- disabled: postLoading,
992
- style: { borderRadius: "8px" },
993
- children: addingEmail ? /* @__PURE__ */ jsxs13(Fragment6, { children: [
994
- /* @__PURE__ */ jsx18(FiX, { className: "me-1", size: 14 }),
995
- "Cancelar"
996
- ] }) : /* @__PURE__ */ jsxs13(Fragment6, { children: [
997
- /* @__PURE__ */ jsx18(FiPlus, { className: "me-1", size: 14 }),
998
- "E-mail Personalizado"
999
- ] })
1000
- }
1001
- ) })
1002
- ] }),
1003
- addingEmail && /* @__PURE__ */ jsxs13(
1004
- "div",
1005
- {
1006
- style: {
1007
- marginTop: "20px",
1008
- padding: "20px",
1009
- backgroundColor: "#f8f9ff",
1010
- borderRadius: "8px",
1011
- border: "1px solid #e3f2fd"
1012
- },
1013
- children: [
1014
- /* @__PURE__ */ jsx18("h6", { className: "mb-3", style: { color: "#1976d2", fontWeight: "600" }, children: "\u2709\uFE0F Adicionar E-mail Personalizado" }),
1015
- /* @__PURE__ */ jsxs13(Row2, { className: "align-items-end", children: [
1016
- /* @__PURE__ */ jsxs13(Col2, { md: 8, children: [
1017
- /* @__PURE__ */ jsx18(Form4.Label, { style: { fontSize: "13px", color: "#6c757d", fontWeight: "500" }, children: "Endere\xE7o de E-mail" }),
1018
- /* @__PURE__ */ jsx18(
1019
- Form4.Control,
1020
- {
1021
- type: "email",
1022
- placeholder: "exemplo@empresa.com",
1023
- value: customEmail,
1024
- onChange: (e) => {
1025
- setCustomEmail(e.target.value);
1026
- if (emailError) setEmailError("");
1027
- },
1028
- isInvalid: !!emailError,
1029
- disabled: postLoading,
1030
- style: { borderRadius: "8px" },
1031
- onKeyPress: (e) => e.key === "Enter" && handleEmailAdd()
1032
- }
1033
- ),
1034
- /* @__PURE__ */ jsx18(Form4.Control.Feedback, { type: "invalid", children: emailError })
1035
- ] }),
1036
- /* @__PURE__ */ jsx18(Col2, { md: 4, children: /* @__PURE__ */ jsxs13(
1037
- Button10,
1038
- {
1039
- variant: "success",
1040
- onClick: handleEmailAdd,
1041
- disabled: postLoading,
1042
- style: { borderRadius: "8px", width: "100%" },
1043
- children: [
1044
- /* @__PURE__ */ jsx18(FiPlus, { className: "me-1", size: 14 }),
1045
- "Adicionar"
1046
- ]
1047
- }
1048
- ) })
1049
- ] })
1050
- ]
1051
- }
1052
- )
1053
- ] }) }),
1054
- selectedEmails.length > 0 && /* @__PURE__ */ jsx18(Card, { className: "mb-4", style: { border: "none", boxShadow: "0 2px 8px rgba(0,0,0,0.05)" }, children: /* @__PURE__ */ jsxs13(Card.Body, { style: { padding: "20px" }, children: [
1055
- /* @__PURE__ */ jsxs13("div", { className: "d-flex justify-content-between align-items-center mb-3", children: [
1056
- /* @__PURE__ */ jsx18("h6", { className: "mb-0", style: { color: "#495057", fontWeight: "600" }, children: "\u{1F4CB} Destinat\xE1rios Selecionados" }),
1057
- /* @__PURE__ */ jsxs13(Badge2, { bg: "primary", style: { fontSize: "12px", padding: "6px 12px" }, children: [
1058
- selectedEmails.length,
1059
- " selecionado",
1060
- selectedEmails.length > 1 ? "s" : ""
1061
- ] })
1062
- ] }),
1063
- /* @__PURE__ */ jsx18("div", { className: "d-flex flex-wrap gap-2", children: selectedEmails.map((email, index) => /* @__PURE__ */ jsxs13(
1064
- "div",
1065
- {
1066
- style: {
1067
- background: "linear-gradient(135deg, #e3f2fd 0%, #f3e5f5 100%)",
1068
- border: "1px solid #bbdefb",
1069
- borderRadius: "20px",
1070
- padding: "8px 15px",
1071
- display: "flex",
1072
- alignItems: "center",
1073
- fontSize: "14px",
1074
- fontWeight: "500"
1075
- },
1076
- children: [
1077
- /* @__PURE__ */ jsx18(FiUser, { size: 12, className: "me-2", color: "#1976d2" }),
1078
- /* @__PURE__ */ jsx18("span", { children: email.email || email }),
1079
- /* @__PURE__ */ jsx18(
1080
- Button10,
1081
- {
1082
- variant: "link",
1083
- size: "sm",
1084
- onClick: () => handleEmailRemove(email),
1085
- disabled: postLoading,
1086
- style: {
1087
- padding: "0 0 0 8px",
1088
- color: "#dc3545",
1089
- textDecoration: "none",
1090
- fontSize: "16px"
1091
- },
1092
- children: /* @__PURE__ */ jsx18(FiX, { size: 14 })
1093
- }
1094
- )
1095
- ]
1096
- },
1097
- index
1098
- )) })
1099
- ] }) }),
1100
- /* @__PURE__ */ jsx18(Card, { style: { border: "none", boxShadow: "0 2px 8px rgba(0,0,0,0.05)" }, children: /* @__PURE__ */ jsxs13(Card.Body, { style: { padding: "20px" }, children: [
1101
- /* @__PURE__ */ jsxs13("h6", { className: "mb-3", style: { color: "#495057", fontWeight: "600" }, children: [
1102
- /* @__PURE__ */ jsx18(FiUser, { className: "me-2", size: 16 }),
1103
- "E-mails de ",
1104
- companyName
1105
- ] }),
1106
- loading ? /* @__PURE__ */ jsxs13("div", { className: "text-center py-4", children: [
1107
- /* @__PURE__ */ jsx18(Spinner4, {}),
1108
- /* @__PURE__ */ jsx18("p", { className: "mt-2 text-muted", children: "Carregando e-mails..." })
1109
- ] }) : filteredEmails.length === 0 ? /* @__PURE__ */ jsx18("div", { className: "text-center py-4", children: /* @__PURE__ */ jsx18("p", { className: "text-muted mb-0", children: searchFilter ? "Nenhum e-mail encontrado com esse filtro" : "Nenhum e-mail dispon\xEDvel" }) }) : /* @__PURE__ */ jsx18(Row2, { children: filteredEmails.map((email) => /* @__PURE__ */ jsx18(Col2, { xs: 12, sm: 6, lg: 4, className: "mb-3", children: /* @__PURE__ */ jsx18(
1110
- Card,
1111
- {
1112
- onClick: () => setSelectedEmails([...selectedEmails, email]),
1113
- style: {
1114
- cursor: "pointer",
1115
- border: "1px solid #e9ecef",
1116
- borderRadius: "10px",
1117
- transition: "all 0.2s ease",
1118
- backgroundColor: "#fff"
1119
- },
1120
- onMouseEnter: (e) => {
1121
- e.currentTarget.style.transform = "translateY(-2px)";
1122
- e.currentTarget.style.boxShadow = "0 4px 12px rgba(0,0,0,0.1)";
1123
- e.currentTarget.style.borderColor = "#007bff";
1124
- },
1125
- onMouseLeave: (e) => {
1126
- e.currentTarget.style.transform = "translateY(0)";
1127
- e.currentTarget.style.boxShadow = "none";
1128
- e.currentTarget.style.borderColor = "#e9ecef";
1129
- },
1130
- children: /* @__PURE__ */ jsxs13(Card.Body, { style: { padding: "15px", textAlign: "center" }, children: [
1131
- /* @__PURE__ */ jsx18(FiMail, { size: 20, color: "#007bff", className: "mb-2" }),
1132
- /* @__PURE__ */ jsx18(
1133
- "div",
1134
- {
1135
- style: {
1136
- fontSize: "14px",
1137
- fontWeight: "500",
1138
- color: "#2c3e50",
1139
- wordBreak: "break-word"
1140
- },
1141
- children: email.email
1142
- }
1143
- )
1144
- ] })
1145
- }
1146
- ) }, email.email)) })
1147
- ] }) })
1148
- ] })
1149
- ]
1150
- }
1151
- );
1152
- };
1153
-
1154
- // src/forms/AutoComplete.tsx
1155
- import { useEffect as useEffect4, useMemo, useState as useState9 } from "react";
1156
- import { FloatingLabel, Form as Form5, InputGroup as InputGroup2, ListGroup, Spinner as Spinner5 } from "react-bootstrap";
1157
- import { jsx as jsx19, jsxs as jsxs14 } from "react/jsx-runtime";
1158
- var AutoComplete = ({
1159
- className,
1160
- ops = [],
1161
- sortKey,
1162
- displayKey,
1163
- displayKeys,
1164
- onValueChanged,
1165
- onSelectedClick,
1166
- value,
1167
- actionButton,
1168
- actionButton2,
1169
- placeH,
1170
- title,
1171
- filter,
1172
- filterField,
1173
- loadFunc,
1174
- loadCondition,
1175
- onBlurEvent,
1176
- formatationFunc,
1177
- onEscKeyDown,
1178
- onEnterKeyDown,
1179
- margT,
1180
- margB,
1181
- hideComponent,
1182
- disableComponent = false,
1183
- disableSelect = false,
1184
- autoFocusConfig,
1185
- onLoad,
1186
- cacheKey,
1187
- minChars = 0,
1188
- maxItems,
1189
- showListOnFocus = true,
1190
- lazyLoad = false
1191
- }) => {
1192
- const [liItem, setListItem] = useState9([]);
1193
- const [options, setOptions] = useState9([]);
1194
- const [input, setInput] = useState9("");
1195
- const [hide, setHide] = useState9(true);
1196
- const [onLoaded, setOnLoaded] = useState9(false);
1197
- const [loading, setLoading] = useState9(false);
1198
- const cacheStore = useMemo(() => {
1199
- const win = window;
1200
- if (!win.__AUTO_COMPLETE_CACHE__) {
1201
- win.__AUTO_COMPLETE_CACHE__ = /* @__PURE__ */ new Map();
1202
- }
1203
- return win.__AUTO_COMPLETE_CACHE__;
1204
- }, []);
1205
- const sortOptions = (data, key) => {
1206
- if (!key || !Array.isArray(data)) return data;
1207
- return [...data].sort((a, b) => String(a[key]).localeCompare(String(b[key])));
1201
+ return win.__AUTO_COMPLETE_CACHE__;
1202
+ }, []);
1203
+ const sortOptions = (data, key) => {
1204
+ if (!key || !Array.isArray(data)) return data;
1205
+ return [...data].sort((a, b) => String(a[key]).localeCompare(String(b[key])));
1208
1206
  };
1209
1207
  useEffect4(() => {
1210
1208
  setInput(value || "");
@@ -1286,7 +1284,7 @@ var AutoComplete = ({
1286
1284
  setInput(val);
1287
1285
  setHide(!canSearch && options.length === 0);
1288
1286
  };
1289
- return /* @__PURE__ */ jsxs14(
1287
+ return /* @__PURE__ */ jsxs18(
1290
1288
  "div",
1291
1289
  {
1292
1290
  className,
@@ -1308,8 +1306,8 @@ var AutoComplete = ({
1308
1306
  },
1309
1307
  onMouseLeave: () => setHide(true),
1310
1308
  children: [
1311
- !hideComponent && /* @__PURE__ */ jsxs14(InputGroup2, { children: [
1312
- /* @__PURE__ */ jsx19(FloatingLabel, { controlId: "floatingInput", label: title, style: { zIndex: 0, flex: 1 }, children: /* @__PURE__ */ jsx19(
1309
+ !hideComponent && /* @__PURE__ */ jsxs18(InputGroup2, { children: [
1310
+ /* @__PURE__ */ jsx26(FloatingLabel, { controlId: "floatingInput", label: title, style: { zIndex: 0, flex: 1 }, children: /* @__PURE__ */ jsx26(
1313
1311
  Form5.Control,
1314
1312
  {
1315
1313
  autoFocus: autoFocusConfig,
@@ -1325,12 +1323,12 @@ var AutoComplete = ({
1325
1323
  type: "text"
1326
1324
  }
1327
1325
  ) }),
1328
- loading && /* @__PURE__ */ jsx19(InputGroup2.Text, { children: /* @__PURE__ */ jsx19(Spinner5, { animation: "border", size: "sm" }) }),
1326
+ loading && /* @__PURE__ */ jsx26(InputGroup2.Text, { children: /* @__PURE__ */ jsx26(Spinner4, { animation: "border", size: "sm" }) }),
1329
1327
  !disableComponent && (actionButton == null ? void 0 : actionButton(() => setInput(""))),
1330
1328
  !disableComponent && (actionButton2 == null ? void 0 : actionButton2(input))
1331
1329
  ] }),
1332
- /* @__PURE__ */ jsx19(
1333
- ListGroup,
1330
+ /* @__PURE__ */ jsx26(
1331
+ ListGroup2,
1334
1332
  {
1335
1333
  className: "listgroup-autocomplete shadow-sm",
1336
1334
  hidden: hide || liItem.length === 0,
@@ -1344,8 +1342,8 @@ var AutoComplete = ({
1344
1342
  zIndex: 1050,
1345
1343
  backgroundColor: "#fff"
1346
1344
  },
1347
- children: (maxItems ? liItem.slice(0, maxItems) : liItem).map((li, index) => /* @__PURE__ */ jsx19(
1348
- ListGroup.Item,
1345
+ children: (maxItems ? liItem.slice(0, maxItems) : liItem).map((li, index) => /* @__PURE__ */ jsx26(
1346
+ ListGroup2.Item,
1349
1347
  {
1350
1348
  action: true,
1351
1349
  onClick: () => {
@@ -1365,22 +1363,906 @@ var AutoComplete = ({
1365
1363
  );
1366
1364
  };
1367
1365
 
1368
- // src/forms/GenericForm.tsx
1369
- import { useState as useState10 } from "react";
1370
- import { Button as Button11, Form as Form6 } from "react-bootstrap";
1371
- import { jsx as jsx20, jsxs as jsxs15 } from "react/jsx-runtime";
1372
- var GenericForm = ({ fields, onSubmit, renderCustomSelect }) => {
1373
- const [formValues, setFormValues] = useState10({});
1374
- const [errors, setErrors] = useState10({});
1375
- const handleChange = (key, value) => {
1376
- setFormValues({
1377
- ...formValues,
1378
- [key]: value
1379
- });
1366
+ // src/qr/QrCodeScanButton.tsx
1367
+ import { useState as useState11 } from "react";
1368
+ import { BsQrCode } from "react-icons/bs";
1369
+
1370
+ // src/qr/QrReader.tsx
1371
+ import QrScanner from "qr-scanner";
1372
+ import { useEffect as useEffect5, useRef as useRef4, useState as useState10 } from "react";
1373
+ import { jsx as jsx27, jsxs as jsxs19 } from "react/jsx-runtime";
1374
+ var QrReader = ({ callback }) => {
1375
+ const scanner = useRef4(null);
1376
+ const videoEl = useRef4(null);
1377
+ const qrBoxEl = useRef4(null);
1378
+ const [qrOn, setQrOn] = useState10(true);
1379
+ const [scannedResult, setScannedResult] = useState10("");
1380
+ const onScanSuccess = (result) => {
1381
+ setScannedResult(result.data);
1382
+ callback(result.data);
1380
1383
  };
1381
- const validate = () => {
1382
- const newErrors = {};
1383
- fields.forEach((field) => {
1384
+ const onScanFail = (err) => {
1385
+ if (typeof err === "string" && !err.includes("No QR code found")) {
1386
+ console.error("QR Scanner Error:", err);
1387
+ }
1388
+ };
1389
+ useEffect5(() => {
1390
+ if (videoEl.current && !scanner.current) {
1391
+ scanner.current = new QrScanner(videoEl.current, onScanSuccess, {
1392
+ onDecodeError: onScanFail,
1393
+ preferredCamera: "environment",
1394
+ highlightScanRegion: true,
1395
+ highlightCodeOutline: true,
1396
+ overlay: qrBoxEl.current || void 0
1397
+ });
1398
+ scanner.current.start().then(() => setQrOn(true)).catch((err) => {
1399
+ console.error("Failed to start QR Scanner:", err);
1400
+ setQrOn(false);
1401
+ });
1402
+ }
1403
+ return () => {
1404
+ if (scanner.current) {
1405
+ scanner.current.stop();
1406
+ scanner.current.destroy();
1407
+ scanner.current = null;
1408
+ }
1409
+ };
1410
+ }, []);
1411
+ useEffect5(() => {
1412
+ if (!qrOn) {
1413
+ alert(
1414
+ "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."
1415
+ );
1416
+ }
1417
+ }, [qrOn]);
1418
+ return /* @__PURE__ */ jsxs19("div", { className: "qr-reader", style: { position: "relative", width: "100%", maxWidth: "500px", margin: "0 auto" }, children: [
1419
+ /* @__PURE__ */ jsx27("video", { ref: videoEl, style: { width: "100%", borderRadius: "8px" } }),
1420
+ /* @__PURE__ */ jsx27("div", { ref: qrBoxEl, className: "qr-box" }),
1421
+ scannedResult && /* @__PURE__ */ jsxs19(
1422
+ "div",
1423
+ {
1424
+ style: {
1425
+ position: "absolute",
1426
+ top: 10,
1427
+ left: 10,
1428
+ zIndex: 10,
1429
+ background: "rgba(0,0,0,0.6)",
1430
+ color: "white",
1431
+ padding: "4px 8px",
1432
+ borderRadius: "4px",
1433
+ fontSize: "0.8rem"
1434
+ },
1435
+ children: [
1436
+ "Lido: ",
1437
+ scannedResult
1438
+ ]
1439
+ }
1440
+ )
1441
+ ] });
1442
+ };
1443
+
1444
+ // src/qr/QrCodeScanButton.tsx
1445
+ import { jsx as jsx28, jsxs as jsxs20 } from "react/jsx-runtime";
1446
+ var QrCodeScanButton = ({ callback, size = 25 }) => {
1447
+ const [showQr, setShowQr] = useState11(false);
1448
+ const toggleQr = () => {
1449
+ setShowQr((prev) => !prev);
1450
+ };
1451
+ return /* @__PURE__ */ jsxs20(
1452
+ "div",
1453
+ {
1454
+ className: "hoverable-div",
1455
+ style: {
1456
+ border: "solid",
1457
+ borderTopRightRadius: "3px",
1458
+ borderBottomRightRadius: "3px",
1459
+ padding: "8px",
1460
+ borderLeft: "none",
1461
+ borderColor: "#ccc",
1462
+ borderWidth: "1px",
1463
+ cursor: "pointer",
1464
+ display: "flex",
1465
+ alignItems: "center"
1466
+ },
1467
+ onClick: toggleQr,
1468
+ children: [
1469
+ /* @__PURE__ */ jsx28(BsQrCode, { size }),
1470
+ showQr && /* @__PURE__ */ jsx28(
1471
+ "div",
1472
+ {
1473
+ style: {
1474
+ position: "fixed",
1475
+ top: 0,
1476
+ left: 0,
1477
+ right: 0,
1478
+ bottom: 0,
1479
+ backgroundColor: "rgba(0,0,0,0.8)",
1480
+ zIndex: 9999,
1481
+ display: "flex",
1482
+ flexDirection: "column",
1483
+ alignItems: "center",
1484
+ justifyContent: "center",
1485
+ padding: "20px"
1486
+ },
1487
+ onClick: (e) => e.stopPropagation(),
1488
+ children: /* @__PURE__ */ jsxs20("div", { style: { width: "100%", maxWidth: "500px", backgroundColor: "#fff", borderRadius: "12px", padding: "20px", position: "relative" }, children: [
1489
+ /* @__PURE__ */ jsx28(
1490
+ "div",
1491
+ {
1492
+ onClick: toggleQr,
1493
+ style: { position: "absolute", top: "10px", right: "15px", fontSize: "1.5rem", cursor: "pointer", zIndex: 10001 },
1494
+ children: "\xD7"
1495
+ }
1496
+ ),
1497
+ /* @__PURE__ */ jsx28("h5", { className: "mb-3 text-center", children: "Escaneie o QR Code" }),
1498
+ /* @__PURE__ */ jsx28(
1499
+ QrReader,
1500
+ {
1501
+ callback: (v) => {
1502
+ toggleQr();
1503
+ callback(v);
1504
+ }
1505
+ }
1506
+ ),
1507
+ /* @__PURE__ */ jsx28("p", { className: "mt-3 text-muted text-center small", children: "Aponte a c\xE2mera para o c\xF3digo" })
1508
+ ] })
1509
+ }
1510
+ )
1511
+ ]
1512
+ }
1513
+ );
1514
+ };
1515
+
1516
+ // src/forms/FindRecursoByTagField.tsx
1517
+ import { jsx as jsx29 } from "react/jsx-runtime";
1518
+ var FindRecursoByTagField = ({ callback, recursoController }) => {
1519
+ const [selectedTag, setSelectedTag] = useState12("");
1520
+ const [reachedRecurso, setReachedRecurso] = useState12(null);
1521
+ const findRecursoByTagIdHandler = async (tagId) => {
1522
+ if (!recursoController) return;
1523
+ try {
1524
+ const r = await recursoController.read("findRecursoByTagId", tagId);
1525
+ setReachedRecurso(r);
1526
+ } catch (error) {
1527
+ console.error("Erro ao buscar recurso por tag ID:", error);
1528
+ }
1529
+ };
1530
+ const findRecursoByTagDescriptionHandler = async (description) => {
1531
+ if (!recursoController) return;
1532
+ try {
1533
+ const formattedDescription = description.replace(/\s/g, "");
1534
+ const recurso = await recursoController.read(
1535
+ `recurso/findByTagDescription`,
1536
+ formattedDescription
1537
+ );
1538
+ if (!callback) {
1539
+ console.log("Recurso encontrado (sem callback):", recurso);
1540
+ } else {
1541
+ callback(recurso, true);
1542
+ }
1543
+ } catch (error) {
1544
+ console.error("Erro ao buscar recurso por descri\xE7\xE3o de tag:", error);
1545
+ }
1546
+ };
1547
+ const confirmRecursoSelectionButton = () => {
1548
+ return /* @__PURE__ */ jsx29(
1549
+ "div",
1550
+ {
1551
+ className: "hoverable-div",
1552
+ style: {
1553
+ border: "solid",
1554
+ borderTopRightRadius: "3px",
1555
+ borderBottomRightRadius: "3px",
1556
+ padding: "8px",
1557
+ borderLeft: "none",
1558
+ borderColor: "#ccc",
1559
+ borderWidth: "1px",
1560
+ cursor: "pointer",
1561
+ display: "flex",
1562
+ alignItems: "center"
1563
+ },
1564
+ children: /* @__PURE__ */ jsx29(
1565
+ GrCheckmark2,
1566
+ {
1567
+ size: 25,
1568
+ onClick: () => reachedRecurso && callback(reachedRecurso, true)
1569
+ }
1570
+ )
1571
+ }
1572
+ );
1573
+ };
1574
+ return /* @__PURE__ */ jsx29("div", { children: /* @__PURE__ */ jsx29(
1575
+ AutoComplete,
1576
+ {
1577
+ sortKey: "id",
1578
+ loadCondition: true,
1579
+ loadFunc: () => {
1580
+ var _a;
1581
+ return (_a = recursoController == null ? void 0 : recursoController.get("findActiveRecursosTags")) != null ? _a : Promise.resolve([]);
1582
+ },
1583
+ displayKey: "descricao",
1584
+ title: "Selecione ou Digite a TAG",
1585
+ actionButton: confirmRecursoSelectionButton,
1586
+ actionButton2: () => /* @__PURE__ */ jsx29(
1587
+ QrCodeScanButton,
1588
+ {
1589
+ callback: (description) => findRecursoByTagDescriptionHandler(description)
1590
+ }
1591
+ ),
1592
+ onSelectedClick: (v) => {
1593
+ setSelectedTag(v);
1594
+ findRecursoByTagIdHandler(v.id);
1595
+ },
1596
+ value: (selectedTag == null ? void 0 : selectedTag.descricao) || ""
1597
+ }
1598
+ ) });
1599
+ };
1600
+
1601
+ // src/displays/RecursoDisplayer.tsx
1602
+ import { jsx as jsx30, jsxs as jsxs21 } from "react/jsx-runtime";
1603
+ var RecursoDisplayer = ({
1604
+ mode = "manutencao",
1605
+ controller,
1606
+ selectedList = [],
1607
+ onSaveRecurso,
1608
+ singleReturn = false
1609
+ }) => {
1610
+ const [selectorDisplay, setSelectorDisplay] = useState13("branch");
1611
+ const [loading, setLoading] = useState13(false);
1612
+ const [recursosProcesso, setRecursosProcesso] = useState13([]);
1613
+ const [branchesManutencao, setBranchesManutencao] = useState13([]);
1614
+ useEffect6(() => {
1615
+ let mounted = true;
1616
+ const loadInicial = async () => {
1617
+ setLoading(true);
1618
+ try {
1619
+ if (mode === "manutencao") {
1620
+ const b = await controller("arvoreEstrutural").get(`branchByBranchLevel/1`);
1621
+ if (mounted) setBranchesManutencao(b);
1622
+ } else if (mode === "processo") {
1623
+ const recs = await controller("recurso").readAll();
1624
+ if (mounted) setRecursosProcesso(Array.isArray(recs) ? recs : []);
1625
+ }
1626
+ } catch (err) {
1627
+ console.error("Erro ao carregar estrutura do RecursoDisplayer", err);
1628
+ } finally {
1629
+ if (mounted) setLoading(false);
1630
+ }
1631
+ };
1632
+ loadInicial();
1633
+ return () => {
1634
+ mounted = false;
1635
+ };
1636
+ }, [mode, controller]);
1637
+ return /* @__PURE__ */ jsxs21("div", { style: { width: "100%", padding: 0 }, className: "recurso-displayer-generic", children: [
1638
+ /* @__PURE__ */ jsx30("div", { className: "d-flex justify-content-between align-items-center mb-3", children: /* @__PURE__ */ jsxs21("div", { children: [
1639
+ /* @__PURE__ */ jsx30("label", { className: "me-2", children: "Selecionar Recurso Por:" }),
1640
+ /* @__PURE__ */ jsx30(
1641
+ Button11,
1642
+ {
1643
+ size: "sm",
1644
+ onClick: () => setSelectorDisplay("branch"),
1645
+ variant: selectorDisplay === "branch" ? "primary" : "outline-primary",
1646
+ className: "me-1",
1647
+ children: mode === "processo" ? "Agrupamentos" : "\xC1rvore"
1648
+ }
1649
+ ),
1650
+ /* @__PURE__ */ jsx30(
1651
+ Button11,
1652
+ {
1653
+ size: "sm",
1654
+ onClick: () => setSelectorDisplay("TAG"),
1655
+ variant: selectorDisplay === "TAG" ? "primary" : "outline-primary",
1656
+ children: "TAG"
1657
+ }
1658
+ )
1659
+ ] }) }),
1660
+ loading && /* @__PURE__ */ jsx30(Spinner5, { animation: "border", size: "sm" }),
1661
+ !loading && selectorDisplay === "branch" && mode === "manutencao" && /* @__PURE__ */ jsx30("div", { className: "manutencao-tree-view", children: /* @__PURE__ */ jsx30("div", { className: "text-muted small italic", children: "\xC1rvore de Manuten\xE7\xE3o (Branches/Nodes em Cascata) - Implementa\xE7\xE3o Gen\xE9rica" }) }),
1662
+ !loading && selectorDisplay === "branch" && mode === "processo" && /* @__PURE__ */ jsx30("div", { className: "processo-group-view", children: /* @__PURE__ */ jsx30("div", { className: "text-muted small italic", children: "Lista de Agrupamentos de Processo (Raiz \xDAnica)" }) }),
1663
+ selectorDisplay === "TAG" && /* @__PURE__ */ jsx30(
1664
+ FindRecursoByTagField,
1665
+ {
1666
+ callback: (rec, checked) => {
1667
+ onSaveRecurso([rec]);
1668
+ }
1669
+ }
1670
+ )
1671
+ ] });
1672
+ };
1673
+
1674
+ // src/filters/StatusPills.tsx
1675
+ import { jsx as jsx31, jsxs as jsxs22 } from "react/jsx-runtime";
1676
+ var StatusPills = ({
1677
+ statuses,
1678
+ activeKeys,
1679
+ onSelectionChange,
1680
+ multiSelect = true,
1681
+ className = ""
1682
+ }) => {
1683
+ const toggleKey = (key) => {
1684
+ const isActive = activeKeys.includes(key);
1685
+ if (multiSelect) {
1686
+ if (isActive) {
1687
+ onSelectionChange(activeKeys.filter((k) => k !== key));
1688
+ } else {
1689
+ onSelectionChange([...activeKeys, key]);
1690
+ }
1691
+ } else {
1692
+ onSelectionChange(isActive ? [] : [key]);
1693
+ }
1694
+ };
1695
+ return /* @__PURE__ */ jsx31("div", { className: `status-pills-container ${className}`, children: Object.entries(statuses).map(([key, meta]) => {
1696
+ const isActive = activeKeys.includes(key);
1697
+ return /* @__PURE__ */ jsxs22(
1698
+ "button",
1699
+ {
1700
+ type: "button",
1701
+ className: `status-pill ${isActive ? "active" : ""}`,
1702
+ style: { "--status-color": meta.color },
1703
+ onClick: () => toggleKey(key),
1704
+ "aria-pressed": isActive,
1705
+ children: [
1706
+ /* @__PURE__ */ jsx31("span", { className: "status-pill__swatch" }),
1707
+ /* @__PURE__ */ jsx31("span", { className: "status-pill__label", children: meta.label }),
1708
+ meta.count !== void 0 && /* @__PURE__ */ jsx31("span", { className: "status-pill__count", children: meta.count })
1709
+ ]
1710
+ },
1711
+ key
1712
+ );
1713
+ }) });
1714
+ };
1715
+
1716
+ // src/filters/PeriodSelector.tsx
1717
+ import { useState as useState14 } from "react";
1718
+ import { Card as Card2, Form as Form6, Button as Button12 } from "react-bootstrap";
1719
+ import { FaCalendarAlt, FaChevronUp, FaHistory } from "react-icons/fa";
1720
+ import dayjs3 from "dayjs";
1721
+ import { jsx as jsx32, jsxs as jsxs23 } from "react/jsx-runtime";
1722
+ var PeriodSelector = ({
1723
+ startDate,
1724
+ endDate,
1725
+ onStartDateChange,
1726
+ onEndDateChange,
1727
+ onPresetSelect,
1728
+ label = "Per\xEDodo",
1729
+ allowFuture = false,
1730
+ className = ""
1731
+ }) => {
1732
+ const [isExpanded, setIsExpanded] = useState14(false);
1733
+ const formatDisplayRange = (start, end) => {
1734
+ const s = dayjs3(start).format("DD/MM/YY HH:mm");
1735
+ const e = dayjs3(end).format("DD/MM/YY HH:mm");
1736
+ return `${s} at\xE9 ${e}`;
1737
+ };
1738
+ const maxDate = allowFuture ? void 0 : dayjs3().format("YYYY-MM-DDTHH:mm");
1739
+ const presets = [
1740
+ { key: "today", label: "Hoje" },
1741
+ { key: "week", label: "\xDAltima Semana" },
1742
+ { key: "fortnight", label: "Quinzena" },
1743
+ { key: "month", label: "\xDAltimo M\xEAs" },
1744
+ { key: "year", label: "\xDAltimo Ano" }
1745
+ ];
1746
+ return /* @__PURE__ */ jsxs23(Card2, { className: `period-selector-card ${isExpanded ? "expanded" : ""} ${className}`, children: [
1747
+ /* @__PURE__ */ jsxs23("div", { className: "compact-row", onClick: () => setIsExpanded(!isExpanded), children: [
1748
+ /* @__PURE__ */ jsxs23("div", { className: "d-flex align-items-center", children: [
1749
+ /* @__PURE__ */ jsx32(FaCalendarAlt, { className: "me-2 text-primary" }),
1750
+ /* @__PURE__ */ jsx32("span", { className: "date-range-text", children: isExpanded ? label : formatDisplayRange(startDate, endDate) })
1751
+ ] }),
1752
+ /* @__PURE__ */ jsx32("div", { className: "period-icon-btn", children: isExpanded ? /* @__PURE__ */ jsx32(FaChevronUp, {}) : /* @__PURE__ */ jsx32("span", { className: "small text-muted", children: "Editar" }) })
1753
+ ] }),
1754
+ isExpanded && /* @__PURE__ */ jsxs23("div", { className: "expanded-content", children: [
1755
+ onPresetSelect && /* @__PURE__ */ jsxs23("div", { className: "presets-container", children: [
1756
+ /* @__PURE__ */ jsxs23("div", { className: "d-flex align-items-center mb-1 w-100", children: [
1757
+ /* @__PURE__ */ jsx32(FaHistory, { size: 12, className: "me-1 text-muted" }),
1758
+ /* @__PURE__ */ jsx32("small", { className: "text-muted fw-bold text-uppercase", style: { fontSize: "0.65rem" }, children: "Atalhos" })
1759
+ ] }),
1760
+ presets.map((p) => /* @__PURE__ */ jsx32(
1761
+ Button12,
1762
+ {
1763
+ variant: "outline-primary",
1764
+ className: "preset-btn",
1765
+ onClick: (e) => {
1766
+ e.stopPropagation();
1767
+ onPresetSelect(p.key);
1768
+ },
1769
+ children: p.label
1770
+ },
1771
+ p.key
1772
+ ))
1773
+ ] }),
1774
+ /* @__PURE__ */ jsxs23("div", { className: "date-inputs-grid", children: [
1775
+ /* @__PURE__ */ jsxs23(Form6.Group, { children: [
1776
+ /* @__PURE__ */ jsx32(Form6.Label, { className: "small text-muted", children: "In\xEDcio" }),
1777
+ /* @__PURE__ */ jsx32(
1778
+ Form6.Control,
1779
+ {
1780
+ type: "datetime-local",
1781
+ size: "sm",
1782
+ value: startDate,
1783
+ max: maxDate,
1784
+ onChange: (e) => onStartDateChange(e.target.value)
1785
+ }
1786
+ )
1787
+ ] }),
1788
+ /* @__PURE__ */ jsxs23(Form6.Group, { children: [
1789
+ /* @__PURE__ */ jsx32(Form6.Label, { className: "small text-muted", children: "Fim" }),
1790
+ /* @__PURE__ */ jsx32(
1791
+ Form6.Control,
1792
+ {
1793
+ type: "datetime-local",
1794
+ size: "sm",
1795
+ value: endDate,
1796
+ min: startDate,
1797
+ max: maxDate,
1798
+ onChange: (e) => onEndDateChange(e.target.value)
1799
+ }
1800
+ )
1801
+ ] })
1802
+ ] }),
1803
+ /* @__PURE__ */ jsx32("div", { className: "mt-3 d-flex justify-content-end", children: /* @__PURE__ */ jsx32(
1804
+ Button12,
1805
+ {
1806
+ variant: "primary",
1807
+ size: "sm",
1808
+ onClick: () => setIsExpanded(false),
1809
+ children: "Aplicar"
1810
+ }
1811
+ ) })
1812
+ ] })
1813
+ ] });
1814
+ };
1815
+
1816
+ // src/filters/AdvancedFilterBar.tsx
1817
+ import { useState as useState15 } from "react";
1818
+ import { Collapse, Button as Button13 } from "react-bootstrap";
1819
+ import { FiFilter, FiChevronDown, FiChevronUp, FiTrash2 as FiTrash22 } from "react-icons/fi";
1820
+ import { jsx as jsx33, jsxs as jsxs24 } from "react/jsx-runtime";
1821
+ var AdvancedFilterBar = ({
1822
+ children,
1823
+ title = "Filtros e Busca",
1824
+ activeFiltersCount = 0,
1825
+ onClearAll,
1826
+ defaultExpanded = false,
1827
+ className = ""
1828
+ }) => {
1829
+ const [expanded, setExpanded] = useState15(defaultExpanded);
1830
+ return /* @__PURE__ */ jsxs24("div", { className: `advanced-filter-bar ${className}`, children: [
1831
+ /* @__PURE__ */ jsxs24(
1832
+ "div",
1833
+ {
1834
+ className: "filter-bar-header",
1835
+ onClick: () => setExpanded(!expanded),
1836
+ children: [
1837
+ /* @__PURE__ */ jsxs24("div", { className: "filter-title-group", children: [
1838
+ /* @__PURE__ */ jsx33(FiFilter, { className: "text-primary" }),
1839
+ /* @__PURE__ */ jsx33("h5", { className: "filter-title", children: title }),
1840
+ activeFiltersCount > 0 && /* @__PURE__ */ jsxs24("span", { className: "filter-count-badge", children: [
1841
+ activeFiltersCount,
1842
+ " ativos"
1843
+ ] })
1844
+ ] }),
1845
+ /* @__PURE__ */ jsx33("div", { className: "filter-chevron", children: expanded ? /* @__PURE__ */ jsx33(FiChevronUp, { size: 20 }) : /* @__PURE__ */ jsx33(FiChevronDown, { size: 20 }) })
1846
+ ]
1847
+ }
1848
+ ),
1849
+ /* @__PURE__ */ jsx33(Collapse, { in: expanded, children: /* @__PURE__ */ jsx33("div", { children: /* @__PURE__ */ jsxs24("div", { className: "filter-bar-content", children: [
1850
+ /* @__PURE__ */ jsx33("div", { className: "filter-grid", children }),
1851
+ (onClearAll || activeFiltersCount > 0) && /* @__PURE__ */ jsxs24("div", { className: "filter-actions", children: [
1852
+ onClearAll && /* @__PURE__ */ jsxs24(
1853
+ Button13,
1854
+ {
1855
+ variant: "link",
1856
+ className: "text-danger text-decoration-none btn-sm d-flex align-items-center",
1857
+ onClick: (e) => {
1858
+ e.stopPropagation();
1859
+ onClearAll();
1860
+ },
1861
+ children: [
1862
+ /* @__PURE__ */ jsx33(FiTrash22, { className: "me-1" }),
1863
+ "Limpar Filtros"
1864
+ ]
1865
+ }
1866
+ ),
1867
+ /* @__PURE__ */ jsx33(
1868
+ Button13,
1869
+ {
1870
+ variant: "primary",
1871
+ size: "sm",
1872
+ onClick: () => setExpanded(false),
1873
+ children: "Aplicar Filtros"
1874
+ }
1875
+ )
1876
+ ] })
1877
+ ] }) }) })
1878
+ ] });
1879
+ };
1880
+
1881
+ // src/forms/MailSender.tsx
1882
+ import { useState as useState16 } from "react";
1883
+ import {
1884
+ Button as Button14,
1885
+ Card as Card3,
1886
+ Col as Col3,
1887
+ Form as Form7,
1888
+ Row as Row3,
1889
+ Spinner as Spinner6,
1890
+ Badge as Badge2,
1891
+ InputGroup as InputGroup3
1892
+ } from "react-bootstrap";
1893
+ import { FiMail, FiSearch, FiUser, FiX, FiPlus, FiSend } from "react-icons/fi";
1894
+ import { Fragment as Fragment7, jsx as jsx34, jsxs as jsxs25 } from "react/jsx-runtime";
1895
+ var MailSender = ({
1896
+ htmlContent,
1897
+ companyName,
1898
+ onFetchEmails,
1899
+ onSendEmail,
1900
+ hide = false,
1901
+ renderTrigger
1902
+ }) => {
1903
+ const [opened, setOpened] = useState16(false);
1904
+ const [addingEmail, setAddingEmail] = useState16(false);
1905
+ const [selectedEmails, setSelectedEmails] = useState16([]);
1906
+ const [emails, setEmails] = useState16([]);
1907
+ const [loading, setLoading] = useState16(false);
1908
+ const [postLoading, setPostLoading] = useState16(false);
1909
+ const [customEmail, setCustomEmail] = useState16("");
1910
+ const [emailError, setEmailError] = useState16("");
1911
+ const [searchFilter, setSearchFilter] = useState16("");
1912
+ const handleOpen = async () => {
1913
+ setLoading(true);
1914
+ try {
1915
+ const data = await onFetchEmails();
1916
+ setEmails(data || []);
1917
+ setOpened(true);
1918
+ } catch (err) {
1919
+ console.error("Erro ao buscar e-mails:", err);
1920
+ } finally {
1921
+ setLoading(false);
1922
+ }
1923
+ };
1924
+ const mailListLinter = () => {
1925
+ const result = [];
1926
+ const seen = /* @__PURE__ */ new Set();
1927
+ if (emails) {
1928
+ for (const item of emails) {
1929
+ if (item.email && !seen.has(item.email)) {
1930
+ seen.add(item.email);
1931
+ result.push({ email: item.email });
1932
+ }
1933
+ }
1934
+ }
1935
+ return result;
1936
+ };
1937
+ const filteredEmails = emails ? mailListLinter().filter(
1938
+ (email) => email.email.toLowerCase().includes(searchFilter.toLowerCase()) && !selectedEmails.some((selected) => (selected.email || selected) === email.email)
1939
+ ) : [];
1940
+ const sendEmail = async () => {
1941
+ const emailString = selectedEmails.map((email) => email.email ? email.email : email).join(", ");
1942
+ const emailData = {
1943
+ to: emailString,
1944
+ subject: `Relat\xF3rio - ${companyName}`,
1945
+ text: `Relat\xF3rio de processo da empresa ${companyName}`,
1946
+ html: htmlContent
1947
+ };
1948
+ setPostLoading(true);
1949
+ try {
1950
+ await onSendEmail(emailData);
1951
+ setSelectedEmails([]);
1952
+ setCustomEmail("");
1953
+ setOpened(false);
1954
+ } catch (err) {
1955
+ console.error("Erro ao enviar e-mail:", err);
1956
+ } finally {
1957
+ setPostLoading(false);
1958
+ }
1959
+ };
1960
+ const validateEmail = (email) => {
1961
+ const re = /\S+@\S+\.\S+/;
1962
+ return re.test(email);
1963
+ };
1964
+ const handleEmailAdd = () => {
1965
+ if (!customEmail.trim()) {
1966
+ setEmailError("Por favor, digite um e-mail");
1967
+ return;
1968
+ }
1969
+ if (!validateEmail(customEmail)) {
1970
+ setEmailError("Formato de e-mail inv\xE1lido");
1971
+ return;
1972
+ }
1973
+ if (selectedEmails.some((email) => (email.email || email) === customEmail)) {
1974
+ setEmailError("Este e-mail j\xE1 foi selecionado");
1975
+ return;
1976
+ }
1977
+ setSelectedEmails([...selectedEmails, customEmail]);
1978
+ setCustomEmail("");
1979
+ setEmailError("");
1980
+ setAddingEmail(false);
1981
+ };
1982
+ const handleEmailRemove = (emailToRemove) => {
1983
+ setSelectedEmails(
1984
+ selectedEmails.filter(
1985
+ (email) => (email.email || email) !== (emailToRemove.email || emailToRemove)
1986
+ )
1987
+ );
1988
+ };
1989
+ if (hide) return null;
1990
+ if (!opened) {
1991
+ if (renderTrigger) {
1992
+ return renderTrigger({ onClick: handleOpen, loading });
1993
+ }
1994
+ return /* @__PURE__ */ jsx34(Button14, { disabled: loading, className: "w-100", onClick: handleOpen, children: loading ? "Carregando..." : "Enviar por E-mail" });
1995
+ }
1996
+ return /* @__PURE__ */ jsxs25(
1997
+ "div",
1998
+ {
1999
+ style: {
2000
+ backgroundColor: "#f8f9fa",
2001
+ borderRadius: "12px",
2002
+ overflow: "hidden",
2003
+ border: "1px solid #dee2e6",
2004
+ boxShadow: "0 4px 6px rgba(0, 0, 0, 0.1)"
2005
+ },
2006
+ children: [
2007
+ /* @__PURE__ */ jsx34(
2008
+ "div",
2009
+ {
2010
+ style: {
2011
+ background: "linear-gradient(135deg, #28a745 0%, #20c997 100%)",
2012
+ color: "white",
2013
+ padding: "25px"
2014
+ },
2015
+ children: /* @__PURE__ */ jsxs25("div", { className: "d-flex justify-content-between align-items-center", children: [
2016
+ /* @__PURE__ */ jsxs25("div", { children: [
2017
+ /* @__PURE__ */ jsxs25("h4", { className: "mb-1", style: { fontWeight: "600", fontSize: "22px" }, children: [
2018
+ /* @__PURE__ */ jsx34(FiMail, { className: "me-2", size: 20 }),
2019
+ "Enviar Relat\xF3rio por E-mail"
2020
+ ] }),
2021
+ /* @__PURE__ */ jsxs25("small", { style: { opacity: "0.9", fontSize: "14px" }, children: [
2022
+ "Selecione os destinat\xE1rios para envio do relat\xF3rio de ",
2023
+ companyName
2024
+ ] })
2025
+ ] }),
2026
+ /* @__PURE__ */ jsxs25("div", { className: "d-flex gap-2", children: [
2027
+ /* @__PURE__ */ jsx34(
2028
+ Button14,
2029
+ {
2030
+ variant: "light",
2031
+ onClick: sendEmail,
2032
+ disabled: selectedEmails.length === 0 || postLoading,
2033
+ style: {
2034
+ borderRadius: "8px",
2035
+ fontWeight: "600",
2036
+ minWidth: "130px",
2037
+ height: "40px"
2038
+ },
2039
+ children: postLoading ? /* @__PURE__ */ jsxs25(Fragment7, { children: [
2040
+ /* @__PURE__ */ jsx34(Spinner6, { size: "sm", className: "me-2" }),
2041
+ "Enviando..."
2042
+ ] }) : /* @__PURE__ */ jsxs25(Fragment7, { children: [
2043
+ /* @__PURE__ */ jsx34(FiSend, { className: "me-2", size: 14 }),
2044
+ "Enviar E-mail"
2045
+ ] })
2046
+ }
2047
+ ),
2048
+ /* @__PURE__ */ jsx34(
2049
+ Button14,
2050
+ {
2051
+ variant: "outline-light",
2052
+ onClick: () => setOpened(false),
2053
+ disabled: postLoading,
2054
+ style: { borderRadius: "8px", width: "40px", height: "40px" },
2055
+ children: /* @__PURE__ */ jsx34(FiX, { size: 16 })
2056
+ }
2057
+ )
2058
+ ] })
2059
+ ] })
2060
+ }
2061
+ ),
2062
+ /* @__PURE__ */ jsxs25("div", { style: { padding: "25px" }, children: [
2063
+ /* @__PURE__ */ jsx34(Card3, { className: "mb-4", style: { border: "none", boxShadow: "0 2px 8px rgba(0,0,0,0.05)" }, children: /* @__PURE__ */ jsxs25(Card3.Body, { style: { padding: "20px" }, children: [
2064
+ /* @__PURE__ */ jsxs25(Row3, { className: "align-items-center", children: [
2065
+ /* @__PURE__ */ jsxs25(Col3, { md: 6, children: [
2066
+ /* @__PURE__ */ jsx34("h6", { className: "mb-2", style: { color: "#495057", fontWeight: "600" }, children: "\u{1F527} Filtros e A\xE7\xF5es" }),
2067
+ /* @__PURE__ */ jsxs25(InputGroup3, { style: { maxWidth: "300px" }, children: [
2068
+ /* @__PURE__ */ jsx34(InputGroup3.Text, { style: { backgroundColor: "#f8f9fa", border: "1px solid #dee2e6" }, children: /* @__PURE__ */ jsx34(FiSearch, { size: 14, color: "#6c757d" }) }),
2069
+ /* @__PURE__ */ jsx34(
2070
+ Form7.Control,
2071
+ {
2072
+ type: "text",
2073
+ placeholder: "Buscar e-mails...",
2074
+ value: searchFilter,
2075
+ onChange: (e) => setSearchFilter(e.target.value),
2076
+ style: { border: "1px solid #dee2e6" }
2077
+ }
2078
+ )
2079
+ ] })
2080
+ ] }),
2081
+ /* @__PURE__ */ jsx34(Col3, { md: 6, className: "text-end", children: /* @__PURE__ */ jsx34(
2082
+ Button14,
2083
+ {
2084
+ variant: addingEmail ? "outline-secondary" : "outline-primary",
2085
+ size: "sm",
2086
+ onClick: () => setAddingEmail(!addingEmail),
2087
+ disabled: postLoading,
2088
+ style: { borderRadius: "8px" },
2089
+ children: addingEmail ? /* @__PURE__ */ jsxs25(Fragment7, { children: [
2090
+ /* @__PURE__ */ jsx34(FiX, { className: "me-1", size: 14 }),
2091
+ "Cancelar"
2092
+ ] }) : /* @__PURE__ */ jsxs25(Fragment7, { children: [
2093
+ /* @__PURE__ */ jsx34(FiPlus, { className: "me-1", size: 14 }),
2094
+ "E-mail Personalizado"
2095
+ ] })
2096
+ }
2097
+ ) })
2098
+ ] }),
2099
+ addingEmail && /* @__PURE__ */ jsxs25(
2100
+ "div",
2101
+ {
2102
+ style: {
2103
+ marginTop: "20px",
2104
+ padding: "20px",
2105
+ backgroundColor: "#f8f9ff",
2106
+ borderRadius: "8px",
2107
+ border: "1px solid #e3f2fd"
2108
+ },
2109
+ children: [
2110
+ /* @__PURE__ */ jsx34("h6", { className: "mb-3", style: { color: "#1976d2", fontWeight: "600" }, children: "\u2709\uFE0F Adicionar E-mail Personalizado" }),
2111
+ /* @__PURE__ */ jsxs25(Row3, { className: "align-items-end", children: [
2112
+ /* @__PURE__ */ jsxs25(Col3, { md: 8, children: [
2113
+ /* @__PURE__ */ jsx34(Form7.Label, { style: { fontSize: "13px", color: "#6c757d", fontWeight: "500" }, children: "Endere\xE7o de E-mail" }),
2114
+ /* @__PURE__ */ jsx34(
2115
+ Form7.Control,
2116
+ {
2117
+ type: "email",
2118
+ placeholder: "exemplo@empresa.com",
2119
+ value: customEmail,
2120
+ onChange: (e) => {
2121
+ setCustomEmail(e.target.value);
2122
+ if (emailError) setEmailError("");
2123
+ },
2124
+ isInvalid: !!emailError,
2125
+ disabled: postLoading,
2126
+ style: { borderRadius: "8px" },
2127
+ onKeyPress: (e) => e.key === "Enter" && handleEmailAdd()
2128
+ }
2129
+ ),
2130
+ /* @__PURE__ */ jsx34(Form7.Control.Feedback, { type: "invalid", children: emailError })
2131
+ ] }),
2132
+ /* @__PURE__ */ jsx34(Col3, { md: 4, children: /* @__PURE__ */ jsxs25(
2133
+ Button14,
2134
+ {
2135
+ variant: "success",
2136
+ onClick: handleEmailAdd,
2137
+ disabled: postLoading,
2138
+ style: { borderRadius: "8px", width: "100%" },
2139
+ children: [
2140
+ /* @__PURE__ */ jsx34(FiPlus, { className: "me-1", size: 14 }),
2141
+ "Adicionar"
2142
+ ]
2143
+ }
2144
+ ) })
2145
+ ] })
2146
+ ]
2147
+ }
2148
+ )
2149
+ ] }) }),
2150
+ selectedEmails.length > 0 && /* @__PURE__ */ jsx34(Card3, { className: "mb-4", style: { border: "none", boxShadow: "0 2px 8px rgba(0,0,0,0.05)" }, children: /* @__PURE__ */ jsxs25(Card3.Body, { style: { padding: "20px" }, children: [
2151
+ /* @__PURE__ */ jsxs25("div", { className: "d-flex justify-content-between align-items-center mb-3", children: [
2152
+ /* @__PURE__ */ jsx34("h6", { className: "mb-0", style: { color: "#495057", fontWeight: "600" }, children: "\u{1F4CB} Destinat\xE1rios Selecionados" }),
2153
+ /* @__PURE__ */ jsxs25(Badge2, { bg: "primary", style: { fontSize: "12px", padding: "6px 12px" }, children: [
2154
+ selectedEmails.length,
2155
+ " selecionado",
2156
+ selectedEmails.length > 1 ? "s" : ""
2157
+ ] })
2158
+ ] }),
2159
+ /* @__PURE__ */ jsx34("div", { className: "d-flex flex-wrap gap-2", children: selectedEmails.map((email, index) => /* @__PURE__ */ jsxs25(
2160
+ "div",
2161
+ {
2162
+ style: {
2163
+ background: "linear-gradient(135deg, #e3f2fd 0%, #f3e5f5 100%)",
2164
+ border: "1px solid #bbdefb",
2165
+ borderRadius: "20px",
2166
+ padding: "8px 15px",
2167
+ display: "flex",
2168
+ alignItems: "center",
2169
+ fontSize: "14px",
2170
+ fontWeight: "500"
2171
+ },
2172
+ children: [
2173
+ /* @__PURE__ */ jsx34(FiUser, { size: 12, className: "me-2", color: "#1976d2" }),
2174
+ /* @__PURE__ */ jsx34("span", { children: email.email || email }),
2175
+ /* @__PURE__ */ jsx34(
2176
+ Button14,
2177
+ {
2178
+ variant: "link",
2179
+ size: "sm",
2180
+ onClick: () => handleEmailRemove(email),
2181
+ disabled: postLoading,
2182
+ style: {
2183
+ padding: "0 0 0 8px",
2184
+ color: "#dc3545",
2185
+ textDecoration: "none",
2186
+ fontSize: "16px"
2187
+ },
2188
+ children: /* @__PURE__ */ jsx34(FiX, { size: 14 })
2189
+ }
2190
+ )
2191
+ ]
2192
+ },
2193
+ index
2194
+ )) })
2195
+ ] }) }),
2196
+ /* @__PURE__ */ jsx34(Card3, { style: { border: "none", boxShadow: "0 2px 8px rgba(0,0,0,0.05)" }, children: /* @__PURE__ */ jsxs25(Card3.Body, { style: { padding: "20px" }, children: [
2197
+ /* @__PURE__ */ jsxs25("h6", { className: "mb-3", style: { color: "#495057", fontWeight: "600" }, children: [
2198
+ /* @__PURE__ */ jsx34(FiUser, { className: "me-2", size: 16 }),
2199
+ "E-mails de ",
2200
+ companyName
2201
+ ] }),
2202
+ loading ? /* @__PURE__ */ jsxs25("div", { className: "text-center py-4", children: [
2203
+ /* @__PURE__ */ jsx34(Spinner6, {}),
2204
+ /* @__PURE__ */ jsx34("p", { className: "mt-2 text-muted", children: "Carregando e-mails..." })
2205
+ ] }) : filteredEmails.length === 0 ? /* @__PURE__ */ jsx34("div", { className: "text-center py-4", children: /* @__PURE__ */ jsx34("p", { className: "text-muted mb-0", children: searchFilter ? "Nenhum e-mail encontrado com esse filtro" : "Nenhum e-mail dispon\xEDvel" }) }) : /* @__PURE__ */ jsx34(Row3, { children: filteredEmails.map((email) => /* @__PURE__ */ jsx34(Col3, { xs: 12, sm: 6, lg: 4, className: "mb-3", children: /* @__PURE__ */ jsx34(
2206
+ Card3,
2207
+ {
2208
+ onClick: () => setSelectedEmails([...selectedEmails, email]),
2209
+ style: {
2210
+ cursor: "pointer",
2211
+ border: "1px solid #e9ecef",
2212
+ borderRadius: "10px",
2213
+ transition: "all 0.2s ease",
2214
+ backgroundColor: "#fff"
2215
+ },
2216
+ onMouseEnter: (e) => {
2217
+ e.currentTarget.style.transform = "translateY(-2px)";
2218
+ e.currentTarget.style.boxShadow = "0 4px 12px rgba(0,0,0,0.1)";
2219
+ e.currentTarget.style.borderColor = "#007bff";
2220
+ },
2221
+ onMouseLeave: (e) => {
2222
+ e.currentTarget.style.transform = "translateY(0)";
2223
+ e.currentTarget.style.boxShadow = "none";
2224
+ e.currentTarget.style.borderColor = "#e9ecef";
2225
+ },
2226
+ children: /* @__PURE__ */ jsxs25(Card3.Body, { style: { padding: "15px", textAlign: "center" }, children: [
2227
+ /* @__PURE__ */ jsx34(FiMail, { size: 20, color: "#007bff", className: "mb-2" }),
2228
+ /* @__PURE__ */ jsx34(
2229
+ "div",
2230
+ {
2231
+ style: {
2232
+ fontSize: "14px",
2233
+ fontWeight: "500",
2234
+ color: "#2c3e50",
2235
+ wordBreak: "break-word"
2236
+ },
2237
+ children: email.email
2238
+ }
2239
+ )
2240
+ ] })
2241
+ }
2242
+ ) }, email.email)) })
2243
+ ] }) })
2244
+ ] })
2245
+ ]
2246
+ }
2247
+ );
2248
+ };
2249
+
2250
+ // src/forms/GenericForm.tsx
2251
+ import { useState as useState17 } from "react";
2252
+ import { Button as Button15, Form as Form8 } from "react-bootstrap";
2253
+ import { jsx as jsx35, jsxs as jsxs26 } from "react/jsx-runtime";
2254
+ var GenericForm = ({ fields, onSubmit, renderCustomSelect }) => {
2255
+ const [formValues, setFormValues] = useState17({});
2256
+ const [errors, setErrors] = useState17({});
2257
+ const handleChange = (key, value) => {
2258
+ setFormValues({
2259
+ ...formValues,
2260
+ [key]: value
2261
+ });
2262
+ };
2263
+ const validate = () => {
2264
+ const newErrors = {};
2265
+ fields.forEach((field) => {
1384
2266
  if (field.required && !formValues[field.key]) {
1385
2267
  newErrors[field.key] = `${field.label} \xE9 obrigat\xF3rio`;
1386
2268
  }
@@ -1400,10 +2282,10 @@ var GenericForm = ({ fields, onSubmit, renderCustomSelect }) => {
1400
2282
  switch (type) {
1401
2283
  case "text":
1402
2284
  case "number":
1403
- return /* @__PURE__ */ jsxs15(Form6.Group, { className: "mb-3", children: [
1404
- /* @__PURE__ */ jsx20(Form6.Label, { children: label }),
1405
- /* @__PURE__ */ jsx20(
1406
- Form6.Control,
2285
+ return /* @__PURE__ */ jsxs26(Form8.Group, { className: "mb-3", children: [
2286
+ /* @__PURE__ */ jsx35(Form8.Label, { children: label }),
2287
+ /* @__PURE__ */ jsx35(
2288
+ Form8.Control,
1407
2289
  {
1408
2290
  type,
1409
2291
  placeholder,
@@ -1412,30 +2294,30 @@ var GenericForm = ({ fields, onSubmit, renderCustomSelect }) => {
1412
2294
  isInvalid: !!errors[key]
1413
2295
  }
1414
2296
  ),
1415
- /* @__PURE__ */ jsx20(Form6.Control.Feedback, { type: "invalid", children: errors[key] })
2297
+ /* @__PURE__ */ jsx35(Form8.Control.Feedback, { type: "invalid", children: errors[key] })
1416
2298
  ] }, key);
1417
2299
  case "select": {
1418
2300
  const orderedOptions = (options || []).filter((opt) => opt && opt.value !== void 0 && opt.label !== void 0).sort((a, b) => a.label.localeCompare(b.label));
1419
- return /* @__PURE__ */ jsxs15(Form6.Group, { className: "mb-3", children: [
1420
- /* @__PURE__ */ jsx20(Form6.Label, { children: label }),
1421
- /* @__PURE__ */ jsxs15(
1422
- Form6.Select,
2301
+ return /* @__PURE__ */ jsxs26(Form8.Group, { className: "mb-3", children: [
2302
+ /* @__PURE__ */ jsx35(Form8.Label, { children: label }),
2303
+ /* @__PURE__ */ jsxs26(
2304
+ Form8.Select,
1423
2305
  {
1424
2306
  value,
1425
2307
  onChange: (e) => handleChange(key, e.target.value),
1426
2308
  isInvalid: !!errors[key],
1427
2309
  children: [
1428
- /* @__PURE__ */ jsx20("option", { value: "", children: "Selecione..." }),
1429
- orderedOptions.map((option) => /* @__PURE__ */ jsx20("option", { value: option.value, children: option.label }, String(option.value)))
2310
+ /* @__PURE__ */ jsx35("option", { value: "", children: "Selecione..." }),
2311
+ orderedOptions.map((option) => /* @__PURE__ */ jsx35("option", { value: option.value, children: option.label }, String(option.value)))
1430
2312
  ]
1431
2313
  }
1432
2314
  ),
1433
- /* @__PURE__ */ jsx20(Form6.Control.Feedback, { type: "invalid", children: errors[key] })
2315
+ /* @__PURE__ */ jsx35(Form8.Control.Feedback, { type: "invalid", children: errors[key] })
1434
2316
  ] }, key);
1435
2317
  }
1436
2318
  case "custom-select":
1437
2319
  if (renderCustomSelect) {
1438
- return /* @__PURE__ */ jsxs15("div", { children: [
2320
+ return /* @__PURE__ */ jsxs26("div", { children: [
1439
2321
  renderCustomSelect({
1440
2322
  label,
1441
2323
  value,
@@ -1443,15 +2325,15 @@ var GenericForm = ({ fields, onSubmit, renderCustomSelect }) => {
1443
2325
  onChange: (v) => handleChange(key, v),
1444
2326
  placeholder
1445
2327
  }),
1446
- errors[key] && /* @__PURE__ */ jsx20("div", { className: "invalid-feedback d-block", children: errors[key] })
2328
+ errors[key] && /* @__PURE__ */ jsx35("div", { className: "invalid-feedback d-block", children: errors[key] })
1447
2329
  ] }, key);
1448
2330
  }
1449
2331
  return null;
1450
2332
  case "date":
1451
- return /* @__PURE__ */ jsxs15(Form6.Group, { className: "mb-3", children: [
1452
- /* @__PURE__ */ jsx20(Form6.Label, { children: label }),
1453
- /* @__PURE__ */ jsx20(
1454
- Form6.Control,
2333
+ return /* @__PURE__ */ jsxs26(Form8.Group, { className: "mb-3", children: [
2334
+ /* @__PURE__ */ jsx35(Form8.Label, { children: label }),
2335
+ /* @__PURE__ */ jsx35(
2336
+ Form8.Control,
1455
2337
  {
1456
2338
  type: "date",
1457
2339
  value,
@@ -1459,23 +2341,23 @@ var GenericForm = ({ fields, onSubmit, renderCustomSelect }) => {
1459
2341
  isInvalid: !!errors[key]
1460
2342
  }
1461
2343
  ),
1462
- /* @__PURE__ */ jsx20(Form6.Control.Feedback, { type: "invalid", children: errors[key] })
2344
+ /* @__PURE__ */ jsx35(Form8.Control.Feedback, { type: "invalid", children: errors[key] })
1463
2345
  ] }, key);
1464
2346
  default:
1465
2347
  return null;
1466
2348
  }
1467
2349
  };
1468
- return /* @__PURE__ */ jsxs15(Form6, { onSubmit: handleSubmit, children: [
2350
+ return /* @__PURE__ */ jsxs26(Form8, { onSubmit: handleSubmit, children: [
1469
2351
  fields.map((field) => renderField(field)),
1470
- /* @__PURE__ */ jsx20("div", { className: "d-grid", children: /* @__PURE__ */ jsx20(Button11, { variant: "primary", type: "submit", children: "Salvar" }) })
2352
+ /* @__PURE__ */ jsx35("div", { className: "d-grid", children: /* @__PURE__ */ jsx35(Button15, { variant: "primary", type: "submit", children: "Salvar" }) })
1471
2353
  ] });
1472
2354
  };
1473
2355
  var GenericForm_default = GenericForm;
1474
2356
 
1475
2357
  // src/forms/GenericSelect.tsx
1476
- import { useEffect as useEffect5, useState as useState11 } from "react";
1477
- import { Form as Form7, InputGroup as InputGroup3 } from "react-bootstrap";
1478
- import { Fragment as Fragment7, jsx as jsx21, jsxs as jsxs16 } from "react/jsx-runtime";
2358
+ import { useEffect as useEffect7, useState as useState18 } from "react";
2359
+ import { Form as Form9, InputGroup as InputGroup4 } from "react-bootstrap";
2360
+ import { Fragment as Fragment8, jsx as jsx36, jsxs as jsxs27 } from "react/jsx-runtime";
1479
2361
  var GenericSelectOps = class {
1480
2362
  constructor(noLabel, title, onChange, ops, selection, returnType, displayType, filter, filterField, valueType, loadFunc, loadCondition, actionClick, locked) {
1481
2363
  this.noLabel = noLabel;
@@ -1512,8 +2394,8 @@ var GenericSelect = ({
1512
2394
  isBold,
1513
2395
  ...restProps
1514
2396
  }) => {
1515
- const [options, setOptions] = useState11(ops || []);
1516
- useEffect5(() => {
2397
+ const [options, setOptions] = useState18(ops || []);
2398
+ useEffect7(() => {
1517
2399
  const loadFunction = async () => {
1518
2400
  if (loadCondition && loadFunc) {
1519
2401
  loadFunc().then((res) => {
@@ -1538,15 +2420,15 @@ var GenericSelect = ({
1538
2420
  }
1539
2421
  };
1540
2422
  const defaultPlaceholder = (restProps == null ? void 0 : restProps.default) || "Seleciona uma Op\xE7\xE3o";
1541
- const selectContent = /* @__PURE__ */ jsxs16(
1542
- Form7.Control,
2423
+ const selectContent = /* @__PURE__ */ jsxs27(
2424
+ Form9.Control,
1543
2425
  {
1544
2426
  disabled: locked,
1545
2427
  as: "select",
1546
2428
  value: selection,
1547
2429
  onChange: (event) => getTrueValue(event.target.selectedIndex),
1548
2430
  children: [
1549
- /* @__PURE__ */ jsxs16("option", { value: void 0, children: [
2431
+ /* @__PURE__ */ jsxs27("option", { value: void 0, children: [
1550
2432
  "-- ",
1551
2433
  defaultPlaceholder,
1552
2434
  " --"
@@ -1555,30 +2437,30 @@ var GenericSelect = ({
1555
2437
  const val = valueType && op[valueType] || op.id || op;
1556
2438
  let fill = displayType && op[displayType] || op;
1557
2439
  if (typeof fill == "object") fill = "";
1558
- return /* @__PURE__ */ jsx21("option", { value: val, children: fill }, op.id || index);
2440
+ return /* @__PURE__ */ jsx36("option", { value: val, children: fill }, op.id || index);
1559
2441
  })
1560
2442
  ]
1561
2443
  }
1562
2444
  );
1563
2445
  if (actionClick) {
1564
- return /* @__PURE__ */ jsxs16(Fragment7, { children: [
1565
- /* @__PURE__ */ jsx21(Form7.Label, { style: { fontWeight: isBold ? "bold" : void 0 }, hidden: noLabel, children: title }),
1566
- /* @__PURE__ */ jsxs16(InputGroup3, { children: [
2446
+ return /* @__PURE__ */ jsxs27(Fragment8, { children: [
2447
+ /* @__PURE__ */ jsx36(Form9.Label, { style: { fontWeight: isBold ? "bold" : void 0 }, hidden: noLabel, children: title }),
2448
+ /* @__PURE__ */ jsxs27(InputGroup4, { children: [
1567
2449
  selectContent,
1568
2450
  actionClick()
1569
2451
  ] })
1570
2452
  ] });
1571
2453
  }
1572
- return /* @__PURE__ */ jsxs16(Fragment7, { children: [
1573
- /* @__PURE__ */ jsx21(Form7.Label, { style: { fontWeight: isBold ? "bold" : void 0 }, hidden: noLabel, children: title }),
2454
+ return /* @__PURE__ */ jsxs27(Fragment8, { children: [
2455
+ /* @__PURE__ */ jsx36(Form9.Label, { style: { fontWeight: isBold ? "bold" : void 0 }, hidden: noLabel, children: title }),
1574
2456
  selectContent
1575
2457
  ] });
1576
2458
  };
1577
2459
  var GenericSelect_default = GenericSelect;
1578
2460
 
1579
2461
  // src/forms/FormField.tsx
1580
- import { FloatingLabel as FloatingLabel2, Form as Form8, InputGroup as InputGroup4 } from "react-bootstrap";
1581
- import { jsx as jsx22, jsxs as jsxs17 } from "react/jsx-runtime";
2462
+ import { FloatingLabel as FloatingLabel2, Form as Form10, InputGroup as InputGroup5 } from "react-bootstrap";
2463
+ import { jsx as jsx37, jsxs as jsxs28 } from "react/jsx-runtime";
1582
2464
  var FormField = ({
1583
2465
  val,
1584
2466
  onValueUpdate,
@@ -1629,32 +2511,32 @@ var FormField = ({
1629
2511
  fieldProps.as = "textarea";
1630
2512
  fieldProps.rows = rows || 3;
1631
2513
  }
1632
- return /* @__PURE__ */ jsx22(Form8.Control, { ...fieldProps });
2514
+ return /* @__PURE__ */ jsx37(Form10.Control, { ...fieldProps });
1633
2515
  };
1634
2516
  if (hide) return null;
1635
- return /* @__PURE__ */ jsxs17(
1636
- Form8.Group,
2517
+ return /* @__PURE__ */ jsxs28(
2518
+ Form10.Group,
1637
2519
  {
1638
2520
  onFocusCapture: (e) => onFocusHandler(e.target.value),
1639
2521
  onMouseLeave: onMouseLv,
1640
2522
  onKeyDown: onKeyDownHandler,
1641
2523
  style: { marginTop: 4, marginBottom: 4, width: "100%" },
1642
2524
  children: [
1643
- /* @__PURE__ */ jsxs17(InputGroup4, { children: [
1644
- asTextArea ? renderField() : /* @__PURE__ */ jsx22(FloatingLabel2, { style: { zIndex: 0, flex: 1 }, label, controlId: controlId || "floatingInput", children: renderField() }),
2525
+ /* @__PURE__ */ jsxs28(InputGroup5, { children: [
2526
+ asTextArea ? renderField() : /* @__PURE__ */ jsx37(FloatingLabel2, { style: { zIndex: 0, flex: 1 }, label, controlId: controlId || "floatingInput", children: renderField() }),
1645
2527
  actionClick && actionClick(),
1646
2528
  actionClick2 && actionClick2()
1647
2529
  ] }),
1648
- feedback && isInvalid && /* @__PURE__ */ jsx22(Form8.Control.Feedback, { type: "invalid", style: { display: "block" }, children: feedback })
2530
+ feedback && isInvalid && /* @__PURE__ */ jsx37(Form10.Control.Feedback, { type: "invalid", style: { display: "block" }, children: feedback })
1649
2531
  ]
1650
2532
  }
1651
2533
  );
1652
2534
  };
1653
2535
 
1654
2536
  // src/forms/ClickToWriteField.tsx
1655
- import { useState as useState12, useEffect as useEffect6, useRef as useRef4 } from "react";
1656
- import { Button as Button12 } from "react-bootstrap";
1657
- import { jsx as jsx23, jsxs as jsxs18 } from "react/jsx-runtime";
2537
+ import { useState as useState19, useEffect as useEffect8, useRef as useRef5 } from "react";
2538
+ import { Button as Button16 } from "react-bootstrap";
2539
+ import { jsx as jsx38, jsxs as jsxs29 } from "react/jsx-runtime";
1658
2540
  var ClickToWriteField = ({
1659
2541
  buttonDisplay,
1660
2542
  fieldType = "text",
@@ -1670,9 +2552,9 @@ var ClickToWriteField = ({
1670
2552
  onEnterPress,
1671
2553
  cleanRef
1672
2554
  }) => {
1673
- const [showClick, setShowClick] = useState12(false);
1674
- const inputRef = useRef4(null);
1675
- useEffect6(() => {
2555
+ const [showClick, setShowClick] = useState19(false);
2556
+ const inputRef = useRef5(null);
2557
+ useEffect8(() => {
1676
2558
  if (showClick) {
1677
2559
  setTimeout(() => {
1678
2560
  if (inputRef.current) {
@@ -1701,9 +2583,9 @@ var ClickToWriteField = ({
1701
2583
  onEnterPress(inputRef);
1702
2584
  }
1703
2585
  };
1704
- return /* @__PURE__ */ jsxs18("div", { style: { display: "flex", width: "100%", margin: 0, padding: 0 }, children: [
1705
- !showClick && /* @__PURE__ */ jsx23(
1706
- Button12,
2586
+ return /* @__PURE__ */ jsxs29("div", { style: { display: "flex", width: "100%", margin: 0, padding: 0 }, children: [
2587
+ !showClick && /* @__PURE__ */ jsx38(
2588
+ Button16,
1707
2589
  {
1708
2590
  style: { flexGrow: 1 },
1709
2591
  onClick: handleShowClick,
@@ -1711,7 +2593,7 @@ var ClickToWriteField = ({
1711
2593
  children: resolveButtonDisplay()
1712
2594
  }
1713
2595
  ),
1714
- showClick && /* @__PURE__ */ jsx23(
2596
+ showClick && /* @__PURE__ */ jsx38(
1715
2597
  FormField,
1716
2598
  {
1717
2599
  reference: inputRef,
@@ -1721,8 +2603,8 @@ var ClickToWriteField = ({
1721
2603
  label: fieldLabel,
1722
2604
  onValueUpdate: onFieldValueUpdate,
1723
2605
  onBlur: () => setShowClick(false),
1724
- actionClick: () => enableFieldActionButton ? /* @__PURE__ */ jsx23(
1725
- Button12,
2606
+ actionClick: () => enableFieldActionButton ? /* @__PURE__ */ jsx38(
2607
+ Button16,
1726
2608
  {
1727
2609
  ...fieldActionButtonProps,
1728
2610
  onClick: () => fieldActionButtonCallback(inputRef),
@@ -1735,28 +2617,28 @@ var ClickToWriteField = ({
1735
2617
  };
1736
2618
 
1737
2619
  // src/forms/ColorPicker.tsx
1738
- import { Card as Card2, Form as Form9, Row as Row3, Col as Col3 } from "react-bootstrap";
2620
+ import { Card as Card4, Form as Form11, Row as Row4, Col as Col4 } from "react-bootstrap";
1739
2621
  import { FaPalette } from "react-icons/fa";
1740
- import { jsx as jsx24, jsxs as jsxs19 } from "react/jsx-runtime";
2622
+ import { jsx as jsx39, jsxs as jsxs30 } from "react/jsx-runtime";
1741
2623
  var ColorPicker = ({
1742
2624
  selectedColor,
1743
2625
  onColorChange,
1744
2626
  presetColors = ["#ff0000", "#ffd700", "#008000", "#0000ff", "#800080"],
1745
2627
  title = "Cor de Identifica\xE7\xE3o"
1746
2628
  }) => {
1747
- return /* @__PURE__ */ jsxs19(
1748
- Card2,
2629
+ return /* @__PURE__ */ jsxs30(
2630
+ Card4,
1749
2631
  {
1750
2632
  className: "shadow-sm border-primary-hover mb-3",
1751
2633
  style: { maxWidth: "320px", transition: "0.3s" },
1752
2634
  children: [
1753
- /* @__PURE__ */ jsxs19(Card2.Header, { className: "bg-light d-flex align-items-center", children: [
1754
- /* @__PURE__ */ jsx24(FaPalette, { className: "me-2 text-primary" }),
1755
- /* @__PURE__ */ jsx24("span", { className: "fw-medium", children: title })
2635
+ /* @__PURE__ */ jsxs30(Card4.Header, { className: "bg-light d-flex align-items-center", children: [
2636
+ /* @__PURE__ */ jsx39(FaPalette, { className: "me-2 text-primary" }),
2637
+ /* @__PURE__ */ jsx39("span", { className: "fw-medium", children: title })
1756
2638
  ] }),
1757
- /* @__PURE__ */ jsxs19(Card2.Body, { children: [
1758
- /* @__PURE__ */ jsxs19(Row3, { className: "g-3 align-items-center mb-3", children: [
1759
- /* @__PURE__ */ jsx24(Col3, { xs: "auto", children: /* @__PURE__ */ jsx24(
2639
+ /* @__PURE__ */ jsxs30(Card4.Body, { children: [
2640
+ /* @__PURE__ */ jsxs30(Row4, { className: "g-3 align-items-center mb-3", children: [
2641
+ /* @__PURE__ */ jsx39(Col4, { xs: "auto", children: /* @__PURE__ */ jsx39(
1760
2642
  "div",
1761
2643
  {
1762
2644
  className: "rounded-circle shadow-sm border",
@@ -1774,8 +2656,8 @@ var ColorPicker = ({
1774
2656
  title: "Clique para abrir o seletor"
1775
2657
  }
1776
2658
  ) }),
1777
- /* @__PURE__ */ jsx24(Col3, { children: /* @__PURE__ */ jsx24(
1778
- Form9.Control,
2659
+ /* @__PURE__ */ jsx39(Col4, { children: /* @__PURE__ */ jsx39(
2660
+ Form11.Control,
1779
2661
  {
1780
2662
  type: "color",
1781
2663
  id: "color-input-hidden",
@@ -1786,7 +2668,7 @@ var ColorPicker = ({
1786
2668
  }
1787
2669
  ) })
1788
2670
  ] }),
1789
- /* @__PURE__ */ jsx24(Row3, { className: "g-2 justify-content-start", children: presetColors.map((cor) => /* @__PURE__ */ jsx24(Col3, { xs: "auto", children: /* @__PURE__ */ jsx24(
2671
+ /* @__PURE__ */ jsx39(Row4, { className: "g-2 justify-content-start", children: presetColors.map((cor) => /* @__PURE__ */ jsx39(Col4, { xs: "auto", children: /* @__PURE__ */ jsx39(
1790
2672
  "div",
1791
2673
  {
1792
2674
  className: "rounded-1 shadow-sm",
@@ -1807,8 +2689,8 @@ var ColorPicker = ({
1807
2689
  };
1808
2690
 
1809
2691
  // src/forms/Switch.tsx
1810
- import { Form as Form10 } from "react-bootstrap";
1811
- import { jsx as jsx25 } from "react/jsx-runtime";
2692
+ import { Form as Form12 } from "react-bootstrap";
2693
+ import { jsx as jsx40 } from "react/jsx-runtime";
1812
2694
  var Switch = ({
1813
2695
  label,
1814
2696
  onSwitchChange,
@@ -1817,8 +2699,8 @@ var Switch = ({
1817
2699
  defaultChecked,
1818
2700
  ...props
1819
2701
  }) => {
1820
- return /* @__PURE__ */ jsx25(
1821
- Form10.Check,
2702
+ return /* @__PURE__ */ jsx40(
2703
+ Form12.Check,
1822
2704
  {
1823
2705
  ...props,
1824
2706
  disabled,
@@ -1835,7 +2717,7 @@ var Switch = ({
1835
2717
  import { useCallback } from "react";
1836
2718
  import { useDropzone } from "react-dropzone";
1837
2719
  import { FiUploadCloud, FiCheckCircle } from "react-icons/fi";
1838
- import { Fragment as Fragment8, jsx as jsx26, jsxs as jsxs20 } from "react/jsx-runtime";
2720
+ import { Fragment as Fragment9, jsx as jsx41, jsxs as jsxs31 } from "react/jsx-runtime";
1839
2721
  var UploadArea = ({
1840
2722
  onFilePut,
1841
2723
  anexo,
@@ -1857,7 +2739,7 @@ var UploadArea = ({
1857
2739
  accept
1858
2740
  });
1859
2741
  const hasAnexo = Boolean(anexo);
1860
- return /* @__PURE__ */ jsxs20(
2742
+ return /* @__PURE__ */ jsxs31(
1861
2743
  "div",
1862
2744
  {
1863
2745
  ...getRootProps(),
@@ -1866,23 +2748,23 @@ var UploadArea = ({
1866
2748
  ${hasAnexo ? "upload-has-file" : ""}
1867
2749
  `,
1868
2750
  children: [
1869
- /* @__PURE__ */ jsx26("input", { ...getInputProps() }),
1870
- /* @__PURE__ */ jsxs20("div", { className: "upload-content", children: [
1871
- /* @__PURE__ */ jsx26("span", { className: "upload-icon", children: hasAnexo ? /* @__PURE__ */ jsx26(FiCheckCircle, { size: 24 }) : /* @__PURE__ */ jsx26(FiUploadCloud, { size: 24 }) }),
1872
- hasAnexo ? /* @__PURE__ */ jsxs20(Fragment8, { children: [
1873
- /* @__PURE__ */ jsx26("p", { className: "upload-link", children: "Arquivo anexado" }),
1874
- /* @__PURE__ */ jsx26("p", { className: "upload-info", children: anexo == null ? void 0 : anexo.name })
1875
- ] }) : /* @__PURE__ */ jsxs20(Fragment8, { children: [
1876
- /* @__PURE__ */ jsxs20("p", { children: [
1877
- /* @__PURE__ */ jsx26("span", { className: "upload-link", children: "Adicione" }),
2751
+ /* @__PURE__ */ jsx41("input", { ...getInputProps() }),
2752
+ /* @__PURE__ */ jsxs31("div", { className: "upload-content", children: [
2753
+ /* @__PURE__ */ jsx41("span", { className: "upload-icon", children: hasAnexo ? /* @__PURE__ */ jsx41(FiCheckCircle, { size: 24 }) : /* @__PURE__ */ jsx41(FiUploadCloud, { size: 24 }) }),
2754
+ hasAnexo ? /* @__PURE__ */ jsxs31(Fragment9, { children: [
2755
+ /* @__PURE__ */ jsx41("p", { className: "upload-link", children: "Arquivo anexado" }),
2756
+ /* @__PURE__ */ jsx41("p", { className: "upload-info", children: anexo == null ? void 0 : anexo.name })
2757
+ ] }) : /* @__PURE__ */ jsxs31(Fragment9, { children: [
2758
+ /* @__PURE__ */ jsxs31("p", { children: [
2759
+ /* @__PURE__ */ jsx41("span", { className: "upload-link", children: "Adicione" }),
1878
2760
  " ou arraste arquivos aqui"
1879
2761
  ] }),
1880
- /* @__PURE__ */ jsxs20("p", { className: "upload-info", children: [
2762
+ /* @__PURE__ */ jsxs31("p", { className: "upload-info", children: [
1881
2763
  "Formatos aceitos: ",
1882
- /* @__PURE__ */ jsx26("b", { children: Object.keys(accept).map((t) => t.split("/")[1].toUpperCase()).join(", ") }),
2764
+ /* @__PURE__ */ jsx41("b", { children: Object.keys(accept).map((t) => t.split("/")[1].toUpperCase()).join(", ") }),
1883
2765
  " | Tamanho m\xE1ximo:",
1884
2766
  " ",
1885
- /* @__PURE__ */ jsxs20("b", { children: [
2767
+ /* @__PURE__ */ jsxs31("b", { children: [
1886
2768
  (maxSize / (1024 * 1024)).toFixed(0),
1887
2769
  "MB"
1888
2770
  ] })
@@ -1894,304 +2776,806 @@ var UploadArea = ({
1894
2776
  );
1895
2777
  };
1896
2778
 
1897
- // src/forms/FindRecursoByTagField.tsx
1898
- import { useState as useState15 } from "react";
1899
- import { GrCheckmark as GrCheckmark2 } from "react-icons/gr";
2779
+ // src/forms/SectorSelector.tsx
2780
+ import { useState as useState20, useEffect as useEffect9 } from "react";
2781
+ import { Form as Form13 } from "react-bootstrap";
2782
+ import { BsChevronDown, BsChevronUp } from "react-icons/bs";
2783
+ import { jsx as jsx42, jsxs as jsxs32 } from "react/jsx-runtime";
2784
+ var SectorSelector = ({
2785
+ setores,
2786
+ onSectorSelect,
2787
+ selectionLabel = "Selecione o Setor",
2788
+ selectionPlaceholder = "Selecione o setor",
2789
+ hideComponent = false,
2790
+ defaultSectorName = false,
2791
+ allowAll = false
2792
+ }) => {
2793
+ const [expanded, setExpanded] = useState20(false);
2794
+ const [selectedSector, setSelectedSector] = useState20(null);
2795
+ useEffect9(() => {
2796
+ if (defaultSectorName && setores.length > 0) {
2797
+ const setor = setores.find((s) => s.nome === defaultSectorName);
2798
+ if (setor && setor.id !== (selectedSector == null ? void 0 : selectedSector.id)) {
2799
+ setSelectedSector(setor);
2800
+ }
2801
+ } else if (!defaultSectorName) {
2802
+ setSelectedSector(null);
2803
+ }
2804
+ }, [defaultSectorName, setores]);
2805
+ const handleSelectSetor = (setor) => {
2806
+ setSelectedSector(setor);
2807
+ onSectorSelect(setor);
2808
+ setExpanded(false);
2809
+ };
2810
+ const toggleExpand = () => {
2811
+ setExpanded(!expanded);
2812
+ };
2813
+ if (hideComponent) return null;
2814
+ const setorOptions = allowAll ? [{ id: "all", nome: "Todos" }, ...setores] : [...setores];
2815
+ return /* @__PURE__ */ jsxs32(Form13.Floating, { className: "sector-selector-floating", children: [
2816
+ /* @__PURE__ */ jsxs32("div", { className: "custom-select-container", onClick: toggleExpand, children: [
2817
+ /* @__PURE__ */ jsx42("span", { className: "selected-sector-label mt-1", children: (selectedSector == null ? void 0 : selectedSector.nome) || selectionPlaceholder }),
2818
+ /* @__PURE__ */ jsx42("div", { className: "zoom-container", children: expanded ? /* @__PURE__ */ jsx42(BsChevronUp, {}) : /* @__PURE__ */ jsx42(BsChevronDown, {}) })
2819
+ ] }),
2820
+ (selectedSector == null ? void 0 : selectedSector.nome) && /* @__PURE__ */ jsx42("label", { htmlFor: "floatingInputCustom", children: selectionLabel }),
2821
+ expanded && /* @__PURE__ */ jsxs32(
2822
+ "div",
2823
+ {
2824
+ className: "custom-dropdown-menu",
2825
+ onMouseLeave: () => setExpanded(false),
2826
+ children: [
2827
+ setorOptions.sort((a, b) => a.nome.localeCompare(b.nome)).map((setor, idx) => /* @__PURE__ */ jsx42(
2828
+ "div",
2829
+ {
2830
+ className: `dropdown-option ${setor.nome === (selectedSector == null ? void 0 : selectedSector.nome) ? "selected-option" : ""}`,
2831
+ onClick: () => handleSelectSetor(setor),
2832
+ children: setor.nome === "default" ? "Nenhum" : setor.nome
2833
+ },
2834
+ idx
2835
+ )),
2836
+ setores.length === 0 && /* @__PURE__ */ jsx42("div", { className: "dropdown-option text-muted italic", children: "Carregando setores..." })
2837
+ ]
2838
+ }
2839
+ )
2840
+ ] });
2841
+ };
1900
2842
 
1901
- // src/qr/QrCodeScanButton.tsx
1902
- import { useState as useState14 } from "react";
1903
- import { BsQrCode } from "react-icons/bs";
2843
+ // src/forms/UnidadeMaterialForm.tsx
2844
+ import { Button as Button17 } from "react-bootstrap";
2845
+ import { jsx as jsx43, jsxs as jsxs33 } from "react/jsx-runtime";
2846
+ var UnidadeMaterialForm = ({
2847
+ value,
2848
+ onMaterialSelected,
2849
+ onQuantidadeUpdate,
2850
+ onUnidadeSelected,
2851
+ onNavigateToCreateMaterial,
2852
+ onNavigateToCreateUnidade,
2853
+ loadMaterialsFunc,
2854
+ loadUnidadesFunc,
2855
+ materialLabel = "Materia Prima",
2856
+ hideMaterial = false,
2857
+ hideQuantidade = false,
2858
+ hideUnidade = false,
2859
+ className = ""
2860
+ }) => {
2861
+ var _a, _b;
2862
+ const renderNewMaterialButton = () => /* @__PURE__ */ jsx43(Button17, { onClick: onNavigateToCreateMaterial, size: "sm", variant: "outline-primary", children: "Novo Material" });
2863
+ const renderNewUnidadeButton = () => /* @__PURE__ */ jsx43(Button17, { onClick: onNavigateToCreateUnidade, size: "sm", variant: "outline-primary", children: "Nova Unidade" });
2864
+ return /* @__PURE__ */ jsxs33("div", { className: `unidade-material-form ${className}`, children: [
2865
+ !hideMaterial && /* @__PURE__ */ jsx43(
2866
+ AutoComplete,
2867
+ {
2868
+ displayKey: "nome",
2869
+ value: ((_a = value == null ? void 0 : value.material) == null ? void 0 : _a.nome) || "",
2870
+ loadCondition: true,
2871
+ title: materialLabel,
2872
+ loadFunc: loadMaterialsFunc,
2873
+ onSelectedClick: onMaterialSelected,
2874
+ actionButton: onNavigateToCreateMaterial ? renderNewMaterialButton : void 0
2875
+ }
2876
+ ),
2877
+ !hideQuantidade && /* @__PURE__ */ jsx43(
2878
+ FormField,
2879
+ {
2880
+ label: "Quantidade",
2881
+ val: value.quantidade || "",
2882
+ onValueUpdate: onQuantidadeUpdate,
2883
+ ty: "number"
2884
+ }
2885
+ ),
2886
+ !hideUnidade && /* @__PURE__ */ jsx43(
2887
+ AutoComplete,
2888
+ {
2889
+ displayKey: "nome",
2890
+ value: ((_b = value == null ? void 0 : value.unidade) == null ? void 0 : _b.nome) || "",
2891
+ loadCondition: true,
2892
+ title: "Unidade",
2893
+ loadFunc: loadUnidadesFunc,
2894
+ onSelectedClick: onUnidadeSelected,
2895
+ actionButton: onNavigateToCreateUnidade ? renderNewUnidadeButton : void 0
2896
+ }
2897
+ )
2898
+ ] });
2899
+ };
1904
2900
 
1905
- // src/qr/QrReader.tsx
1906
- import QrScanner from "qr-scanner";
1907
- import { useEffect as useEffect7, useRef as useRef5, useState as useState13 } from "react";
1908
- import { jsx as jsx27, jsxs as jsxs21 } from "react/jsx-runtime";
1909
- var QrReader = ({ callback }) => {
1910
- const scanner = useRef5(null);
1911
- const videoEl = useRef5(null);
1912
- const qrBoxEl = useRef5(null);
1913
- const [qrOn, setQrOn] = useState13(true);
1914
- const [scannedResult, setScannedResult] = useState13("");
1915
- const onScanSuccess = (result) => {
1916
- setScannedResult(result.data);
1917
- callback(result.data);
2901
+ // src/icons/IconLabelItem.tsx
2902
+ import { jsx as jsx44, jsxs as jsxs34 } from "react/jsx-runtime";
2903
+ var IconLabelItem = ({
2904
+ icon,
2905
+ label,
2906
+ containerClassName = "",
2907
+ labelClassName = "",
2908
+ onClick,
2909
+ style
2910
+ }) => {
2911
+ return /* @__PURE__ */ jsxs34("div", { className: containerClassName, onClick, style: { ...style, cursor: onClick ? "pointer" : "default" }, children: [
2912
+ icon,
2913
+ /* @__PURE__ */ jsx44("span", { className: labelClassName, children: label })
2914
+ ] });
2915
+ };
2916
+
2917
+ // src/icons/IconLabelList.tsx
2918
+ import { jsx as jsx45 } from "react/jsx-runtime";
2919
+ var IconLabelList = ({ items, className = "" }) => {
2920
+ return /* @__PURE__ */ jsx45("div", { className: `icon-label-list ${className}`, children: items.map((item, index) => /* @__PURE__ */ jsx45(
2921
+ IconLabelItem,
2922
+ {
2923
+ labelClassName: "icon-label",
2924
+ containerClassName: "icon-label-item",
2925
+ icon: item.icon,
2926
+ label: item.label,
2927
+ onClick: item.onClick
2928
+ },
2929
+ index
2930
+ )) });
2931
+ };
2932
+
2933
+ // src/icons/NotificationItem.tsx
2934
+ import { useState as useState21 } from "react";
2935
+ import { Modal as Modal4, Button as Button18, OverlayTrigger, Tooltip as Tooltip3 } from "react-bootstrap";
2936
+ import { FiClock, FiCheck, FiTrash2 as FiTrash23 } from "react-icons/fi";
2937
+ import dayjs4 from "dayjs";
2938
+ import { Fragment as Fragment10, jsx as jsx46, jsxs as jsxs35 } from "react/jsx-runtime";
2939
+ var NotificationItem = ({
2940
+ notification,
2941
+ onRead,
2942
+ onDismiss,
2943
+ emptyContentLabel = "Sem conte\xFAdo adicional dispon\xEDvel."
2944
+ }) => {
2945
+ const [showModal, setShowModal] = useState21(false);
2946
+ const { context, contextId, content, status, createdAt, readAt } = notification;
2947
+ const handleOpenModal = (e) => {
2948
+ e.stopPropagation();
2949
+ setShowModal(true);
1918
2950
  };
1919
- const onScanFail = (err) => {
1920
- if (typeof err === "string" && !err.includes("No QR code found")) {
1921
- console.error("QR Scanner Error:", err);
1922
- }
2951
+ const handleCloseModal = () => setShowModal(false);
2952
+ const handleReadAndClose = () => {
2953
+ onRead(notification);
2954
+ handleCloseModal();
1923
2955
  };
1924
- useEffect7(() => {
1925
- if (videoEl.current && !scanner.current) {
1926
- scanner.current = new QrScanner(videoEl.current, onScanSuccess, {
1927
- onDecodeError: onScanFail,
1928
- preferredCamera: "environment",
1929
- highlightScanRegion: true,
1930
- highlightCodeOutline: true,
1931
- overlay: qrBoxEl.current || void 0
1932
- });
1933
- scanner.current.start().then(() => setQrOn(true)).catch((err) => {
1934
- console.error("Failed to start QR Scanner:", err);
1935
- setQrOn(false);
1936
- });
1937
- }
1938
- return () => {
1939
- if (scanner.current) {
1940
- scanner.current.stop();
1941
- scanner.current.destroy();
1942
- scanner.current = null;
1943
- }
1944
- };
1945
- }, []);
1946
- useEffect7(() => {
1947
- if (!qrOn) {
1948
- alert(
1949
- "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."
1950
- );
1951
- }
1952
- }, [qrOn]);
1953
- return /* @__PURE__ */ jsxs21("div", { className: "qr-reader", style: { position: "relative", width: "100%", maxWidth: "500px", margin: "0 auto" }, children: [
1954
- /* @__PURE__ */ jsx27("video", { ref: videoEl, style: { width: "100%", borderRadius: "8px" } }),
1955
- /* @__PURE__ */ jsx27("div", { ref: qrBoxEl, className: "qr-box" }),
1956
- scannedResult && /* @__PURE__ */ jsxs21(
2956
+ const handleDismiss = (e) => {
2957
+ e.stopPropagation();
2958
+ onDismiss(notification);
2959
+ };
2960
+ const displayTitle = contextId ? `${context} - ${contextId}` : context || "Notifica\xE7\xE3o";
2961
+ return /* @__PURE__ */ jsxs35(Fragment10, { children: [
2962
+ /* @__PURE__ */ jsxs35(
1957
2963
  "div",
1958
2964
  {
1959
- style: {
1960
- position: "absolute",
1961
- top: 10,
1962
- left: 10,
1963
- zIndex: 10,
1964
- background: "rgba(0,0,0,0.6)",
1965
- color: "white",
1966
- padding: "4px 8px",
1967
- borderRadius: "4px",
1968
- fontSize: "0.8rem"
1969
- },
2965
+ className: `notification-item-modern ${status === "unread" ? "unread" : ""}`,
2966
+ onClick: handleOpenModal,
2967
+ children: [
2968
+ /* @__PURE__ */ jsx46("div", { className: `notification-status-indicator ${status}`, children: status === "unread" ? /* @__PURE__ */ jsx46(FiClock, { size: 14 }) : /* @__PURE__ */ jsx46(FiCheck, { size: 14 }) }),
2969
+ /* @__PURE__ */ jsxs35("div", { className: "notification-main-content", children: [
2970
+ /* @__PURE__ */ jsx46("div", { className: "notification-header-row", children: /* @__PURE__ */ jsxs35("div", { className: "notification-title-modern", children: [
2971
+ /* @__PURE__ */ jsx46("span", { className: "notification-context", children: context }),
2972
+ contextId && /* @__PURE__ */ jsxs35(Fragment10, { children: [
2973
+ /* @__PURE__ */ jsx46("span", { className: "notification-separator", children: "/" }),
2974
+ /* @__PURE__ */ jsx46("span", { className: "notification-context-id", children: contextId })
2975
+ ] })
2976
+ ] }) }),
2977
+ /* @__PURE__ */ jsx46("div", { className: "notification-preview", children: /* @__PURE__ */ jsx46("p", { className: "notification-content-preview", children: content || "Nova mensagem recebida" }) }),
2978
+ /* @__PURE__ */ jsxs35("div", { className: "notification-meta", children: [
2979
+ /* @__PURE__ */ jsxs35("div", { className: "notification-timestamp", children: [
2980
+ /* @__PURE__ */ jsx46(FiClock, { size: 12, className: "me-1" }),
2981
+ /* @__PURE__ */ jsx46("small", { children: dayjs4(createdAt).format("DD/MM/YYYY HH:mm") })
2982
+ ] }),
2983
+ readAt && /* @__PURE__ */ jsxs35("div", { className: "notification-read-time", children: [
2984
+ /* @__PURE__ */ jsx46(FiCheck, { size: 12, className: "me-1" }),
2985
+ /* @__PURE__ */ jsxs35("small", { children: [
2986
+ "Lida em ",
2987
+ dayjs4(readAt).format("DD/MM HH:mm")
2988
+ ] })
2989
+ ] })
2990
+ ] })
2991
+ ] }),
2992
+ /* @__PURE__ */ jsx46("div", { className: "notification-quick-actions", children: status === "unread" && /* @__PURE__ */ jsx46(
2993
+ OverlayTrigger,
2994
+ {
2995
+ placement: "top",
2996
+ overlay: /* @__PURE__ */ jsx46(Tooltip3, { children: "Descartar" }),
2997
+ children: /* @__PURE__ */ jsx46(
2998
+ "button",
2999
+ {
3000
+ className: "notification-action-btn notification-dismiss-btn",
3001
+ onClick: handleDismiss,
3002
+ "aria-label": "Descartar notifica\xE7\xE3o",
3003
+ children: /* @__PURE__ */ jsx46(FiTrash23, { size: 14 })
3004
+ }
3005
+ )
3006
+ }
3007
+ ) })
3008
+ ]
3009
+ }
3010
+ ),
3011
+ /* @__PURE__ */ jsxs35(
3012
+ Modal4,
3013
+ {
3014
+ show: showModal,
3015
+ onHide: handleCloseModal,
3016
+ centered: true,
3017
+ className: "notification-modal",
1970
3018
  children: [
1971
- "Lido: ",
1972
- scannedResult
3019
+ /* @__PURE__ */ jsx46(Modal4.Header, { closeButton: true, className: "notification-modal-header", children: /* @__PURE__ */ jsx46(Modal4.Title, { className: "notification-modal-title", children: /* @__PURE__ */ jsxs35("div", { className: "d-flex align-items-center", children: [
3020
+ status === "unread" ? /* @__PURE__ */ jsx46(FiClock, { className: "me-2 text-warning" }) : /* @__PURE__ */ jsx46(FiCheck, { className: "me-2 text-success" }),
3021
+ "Detalhes da Notifica\xE7\xE3o"
3022
+ ] }) }) }),
3023
+ /* @__PURE__ */ jsx46(Modal4.Body, { className: "notification-modal-body", children: /* @__PURE__ */ jsxs35("div", { className: "notification-modal-content", children: [
3024
+ /* @__PURE__ */ jsxs35("div", { className: "notification-modal-meta", children: [
3025
+ /* @__PURE__ */ jsx46("h6", { className: "notification-modal-source", children: displayTitle }),
3026
+ /* @__PURE__ */ jsxs35("div", { className: "notification-modal-timestamps", children: [
3027
+ /* @__PURE__ */ jsxs35("small", { className: "text-muted", children: [
3028
+ /* @__PURE__ */ jsx46(FiClock, { size: 12, className: "me-1" }),
3029
+ "Criada em ",
3030
+ dayjs4(createdAt).format("DD/MM/YYYY [\xE0s] HH:mm")
3031
+ ] }),
3032
+ readAt && /* @__PURE__ */ jsxs35("small", { className: "text-muted ms-3", children: [
3033
+ /* @__PURE__ */ jsx46(FiCheck, { size: 12, className: "me-1" }),
3034
+ "Lida em ",
3035
+ dayjs4(readAt).format("DD/MM/YYYY [\xE0s] HH:mm")
3036
+ ] })
3037
+ ] })
3038
+ ] }),
3039
+ /* @__PURE__ */ jsx46("div", { className: "notification-modal-message", children: /* @__PURE__ */ jsx46("p", { className: "mb-0", children: content || emptyContentLabel }) })
3040
+ ] }) }),
3041
+ /* @__PURE__ */ jsxs35(Modal4.Footer, { className: "notification-modal-footer", children: [
3042
+ /* @__PURE__ */ jsx46(Button18, { variant: "outline-secondary", onClick: handleCloseModal, children: "Fechar" }),
3043
+ status === "unread" && /* @__PURE__ */ jsx46(Button18, { variant: "primary", onClick: handleReadAndClose, children: "Marcar como lida" })
3044
+ ] })
1973
3045
  ]
1974
3046
  }
1975
3047
  )
1976
3048
  ] });
1977
3049
  };
1978
3050
 
1979
- // src/qr/QrCodeScanButton.tsx
1980
- import { jsx as jsx28, jsxs as jsxs22 } from "react/jsx-runtime";
1981
- var QrCodeScanButton = ({ callback, size = 25 }) => {
1982
- const [showQr, setShowQr] = useState14(false);
1983
- const toggleQr = () => {
1984
- setShowQr((prev) => !prev);
3051
+ // src/icons/NotificationBell.tsx
3052
+ import { Dropdown as Dropdown2, Badge as Badge3 } from "react-bootstrap";
3053
+ import { FiBell } from "react-icons/fi";
3054
+ import { jsx as jsx47, jsxs as jsxs36 } from "react/jsx-runtime";
3055
+ var NotificationBell = ({
3056
+ notifications,
3057
+ onItemRead,
3058
+ onItemDismiss,
3059
+ onMarkAllRead,
3060
+ size = 20,
3061
+ className = ""
3062
+ }) => {
3063
+ const unreadCount = notifications.filter((n) => n.status === "unread").length;
3064
+ return /* @__PURE__ */ jsxs36(Dropdown2, { align: "end", className: `notification-bell-dropdown ${className}`, children: [
3065
+ /* @__PURE__ */ jsxs36(Dropdown2.Toggle, { as: "div", className: "position-relative cursor-pointer p-2", children: [
3066
+ /* @__PURE__ */ jsx47(FiBell, { size }),
3067
+ unreadCount > 0 && /* @__PURE__ */ jsx47(
3068
+ Badge3,
3069
+ {
3070
+ pill: true,
3071
+ bg: "danger",
3072
+ className: "position-absolute",
3073
+ style: { top: 0, right: 0, fontSize: "0.65rem" },
3074
+ children: unreadCount > 99 ? "99+" : unreadCount
3075
+ }
3076
+ )
3077
+ ] }),
3078
+ /* @__PURE__ */ jsxs36(
3079
+ Dropdown2.Menu,
3080
+ {
3081
+ className: "shadow-lg border-0",
3082
+ style: { width: "320px", padding: 0, maxHeight: "500px", overflowY: "auto" },
3083
+ children: [
3084
+ /* @__PURE__ */ jsxs36("div", { className: "p-3 border-bottom d-flex justify-content-between align-items-center bg-light", children: [
3085
+ /* @__PURE__ */ jsx47("h6", { className: "mb-0 fw-bold", children: "Notifica\xE7\xF5es" }),
3086
+ unreadCount > 0 && onMarkAllRead && /* @__PURE__ */ jsx47(
3087
+ "button",
3088
+ {
3089
+ className: "btn btn-link btn-sm p-0 text-decoration-none",
3090
+ onClick: (e) => {
3091
+ e.stopPropagation();
3092
+ onMarkAllRead();
3093
+ },
3094
+ children: "Limpar tudo"
3095
+ }
3096
+ )
3097
+ ] }),
3098
+ /* @__PURE__ */ jsx47("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__ */ jsx47(
3099
+ NotificationItem,
3100
+ {
3101
+ notification: n,
3102
+ onRead: onItemRead,
3103
+ onDismiss: onItemDismiss
3104
+ },
3105
+ n.id
3106
+ )) : /* @__PURE__ */ jsxs36("div", { className: "p-4 text-center text-muted", children: [
3107
+ /* @__PURE__ */ jsx47(FiBell, { size: 24, className: "mb-2 opacity-25" }),
3108
+ /* @__PURE__ */ jsx47("p", { className: "mb-0 small", children: "Nenhuma notifica\xE7\xE3o por aqui." })
3109
+ ] }) }),
3110
+ notifications.length > 0 && /* @__PURE__ */ jsx47("div", { className: "p-2 border-top text-center bg-light", children: /* @__PURE__ */ jsxs36("small", { className: "text-muted", children: [
3111
+ "Total: ",
3112
+ notifications.length,
3113
+ " notifica\xE7\xF5es"
3114
+ ] }) })
3115
+ ]
3116
+ }
3117
+ )
3118
+ ] });
3119
+ };
3120
+
3121
+ // src/modals/ModalBasicTemplate.tsx
3122
+ import { Modal as Modal5, Button as Button19 } from "react-bootstrap";
3123
+ import { jsx as jsx48, jsxs as jsxs37 } from "react/jsx-runtime";
3124
+ var ModalBasicTemplate = ({
3125
+ show,
3126
+ closeFunc,
3127
+ body,
3128
+ header,
3129
+ footer,
3130
+ props = {}
3131
+ }) => {
3132
+ const { bodyStyle, dialogStyle, ...modalProps } = props;
3133
+ const renderPart = (part) => {
3134
+ if (typeof part === "function") return part();
3135
+ return part;
1985
3136
  };
1986
- return /* @__PURE__ */ jsxs22(
1987
- "div",
3137
+ return /* @__PURE__ */ jsxs37(
3138
+ Modal5,
1988
3139
  {
1989
- className: "hoverable-div",
1990
- style: {
1991
- border: "solid",
1992
- borderTopRightRadius: "3px",
1993
- borderBottomRightRadius: "3px",
1994
- padding: "8px",
1995
- borderLeft: "none",
1996
- borderColor: "#ccc",
1997
- borderWidth: "1px",
1998
- cursor: "pointer",
1999
- display: "flex",
2000
- alignItems: "center"
2001
- },
2002
- onClick: toggleQr,
3140
+ show,
3141
+ onHide: closeFunc,
3142
+ centered: true,
3143
+ style: dialogStyle,
3144
+ ...modalProps,
2003
3145
  children: [
2004
- /* @__PURE__ */ jsx28(BsQrCode, { size }),
2005
- showQr && /* @__PURE__ */ jsx28(
2006
- "div",
3146
+ header && /* @__PURE__ */ jsx48(Modal5.Header, { closeButton: true, children: /* @__PURE__ */ jsx48(Modal5.Title, { children: renderPart(header) }) }),
3147
+ /* @__PURE__ */ jsx48(Modal5.Body, { style: bodyStyle, children: renderPart(body) }),
3148
+ footer && /* @__PURE__ */ jsxs37(Modal5.Footer, { children: [
3149
+ renderPart(footer),
3150
+ !footer && /* @__PURE__ */ jsx48(Button19, { variant: "secondary", onClick: closeFunc, children: "Fechar" })
3151
+ ] })
3152
+ ]
3153
+ }
3154
+ );
3155
+ };
3156
+ var ModalBasicTemplate_default = ModalBasicTemplate;
3157
+
3158
+ // src/modals/SelectDateModal.tsx
3159
+ import { useState as useState22 } from "react";
3160
+ import { Modal as Modal6, Button as Button20, Form as Form14 } from "react-bootstrap";
3161
+ import dayjs5 from "dayjs";
3162
+ import { jsx as jsx49, jsxs as jsxs38 } from "react/jsx-runtime";
3163
+ var SelectDateModal = ({
3164
+ show,
3165
+ onClose,
3166
+ onSelect,
3167
+ title = "Selecionar Data",
3168
+ label = "Escolha a data",
3169
+ initialDate,
3170
+ allowFuture = true
3171
+ }) => {
3172
+ const [selectedDate, setSelectedDate] = useState22(
3173
+ initialDate || dayjs5().format("YYYY-MM-DDTHH:mm")
3174
+ );
3175
+ const handleConfirm = () => {
3176
+ onSelect(selectedDate);
3177
+ onClose();
3178
+ };
3179
+ return /* @__PURE__ */ jsxs38(Modal6, { show, onHide: onClose, centered: true, size: "sm", children: [
3180
+ /* @__PURE__ */ jsx49(Modal6.Header, { closeButton: true, children: /* @__PURE__ */ jsx49(Modal6.Title, { children: title }) }),
3181
+ /* @__PURE__ */ jsx49(Modal6.Body, { children: /* @__PURE__ */ jsxs38(Form14.Group, { children: [
3182
+ /* @__PURE__ */ jsx49(Form14.Label, { children: label }),
3183
+ /* @__PURE__ */ jsx49(
3184
+ Form14.Control,
3185
+ {
3186
+ type: "datetime-local",
3187
+ value: selectedDate,
3188
+ max: allowFuture ? void 0 : dayjs5().format("YYYY-MM-DDTHH:mm"),
3189
+ onChange: (e) => setSelectedDate(e.target.value)
3190
+ }
3191
+ )
3192
+ ] }) }),
3193
+ /* @__PURE__ */ jsxs38(Modal6.Footer, { children: [
3194
+ /* @__PURE__ */ jsx49(Button20, { variant: "outline-secondary", onClick: onClose, children: "Cancelar" }),
3195
+ /* @__PURE__ */ jsx49(Button20, { variant: "primary", onClick: handleConfirm, children: "Confirmar" })
3196
+ ] })
3197
+ ] });
3198
+ };
3199
+
3200
+ // src/modals/JustificativaModal.tsx
3201
+ import { useState as useState23, useEffect as useEffect10 } from "react";
3202
+ import { Modal as Modal7, Button as Button21, Form as Form15, ListGroup as ListGroup3, Badge as Badge4, OverlayTrigger as OverlayTrigger2, Tooltip as Tooltip4 } from "react-bootstrap";
3203
+ import { FaTrashAlt, FaUndo } from "react-icons/fa";
3204
+ import dayjs6 from "dayjs";
3205
+ import { jsx as jsx50, jsxs as jsxs39 } from "react/jsx-runtime";
3206
+ var JustificativaModal = ({
3207
+ show,
3208
+ onClose,
3209
+ justificativas: initialJustificativas = [],
3210
+ currentUserId,
3211
+ currentUserName,
3212
+ onUpdateJustificativas
3213
+ }) => {
3214
+ const [localJustificativas, setLocalJustificativas] = useState23(initialJustificativas);
3215
+ const [novaDescricao, setNovaDescricao] = useState23("");
3216
+ const [editandoId, setEditandoId] = useState23(null);
3217
+ useEffect10(() => {
3218
+ setLocalJustificativas(initialJustificativas);
3219
+ }, [initialJustificativas]);
3220
+ const handleAddOrEdit = async () => {
3221
+ if (!novaDescricao.trim()) return;
3222
+ let updatedList = [];
3223
+ if (editandoId) {
3224
+ updatedList = localJustificativas.map(
3225
+ (j) => j.id === editandoId ? { ...j, descricao: novaDescricao } : j
3226
+ );
3227
+ setEditandoId(null);
3228
+ } else {
3229
+ const nova = {
3230
+ id: Math.random().toString(36).substr(2, 9),
3231
+ // Simples ID local se uuid não estiver disp.
3232
+ descricao: novaDescricao,
3233
+ user: { userId: currentUserId, firstName: currentUserName },
3234
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
3235
+ isNew: true
3236
+ };
3237
+ updatedList = [...localJustificativas, nova];
3238
+ }
3239
+ setNovaDescricao("");
3240
+ await onUpdateJustificativas(updatedList);
3241
+ setLocalJustificativas(updatedList);
3242
+ };
3243
+ const handleRemove = async (id) => {
3244
+ const updated = localJustificativas.map((j) => j.id === id ? { ...j, removed: true } : j);
3245
+ await onUpdateJustificativas(updated);
3246
+ setLocalJustificativas(updated);
3247
+ };
3248
+ const handleUndoRemove = async (id) => {
3249
+ const updated = localJustificativas.map((j) => j.id === id ? { ...j, removed: false } : j);
3250
+ await onUpdateJustificativas(updated);
3251
+ setLocalJustificativas(updated);
3252
+ };
3253
+ return /* @__PURE__ */ jsxs39(Modal7, { show, onHide: onClose, centered: true, size: "lg", children: [
3254
+ /* @__PURE__ */ jsx50(Modal7.Header, { closeButton: true, children: /* @__PURE__ */ jsx50(Modal7.Title, { children: "Justificativas / Coment\xE1rios" }) }),
3255
+ /* @__PURE__ */ jsxs39(Modal7.Body, { children: [
3256
+ /* @__PURE__ */ jsxs39(Form15, { className: "mb-4", children: [
3257
+ /* @__PURE__ */ jsxs39(Form15.Group, { controlId: "justificativaInput", className: "mb-2", children: [
3258
+ /* @__PURE__ */ jsx50(Form15.Label, { className: "small text-muted fw-bold", children: "NOVO REGISTRO" }),
3259
+ /* @__PURE__ */ jsx50(
3260
+ Form15.Control,
3261
+ {
3262
+ as: "textarea",
3263
+ rows: 2,
3264
+ value: novaDescricao,
3265
+ onChange: (e) => setNovaDescricao(e.target.value),
3266
+ placeholder: "Descreva o motivo ou informa\xE7\xE3o adicional..."
3267
+ }
3268
+ )
3269
+ ] }),
3270
+ /* @__PURE__ */ jsx50("div", { className: "d-flex justify-content-end", children: /* @__PURE__ */ jsx50(Button21, { variant: "primary", size: "sm", onClick: handleAddOrEdit, children: editandoId ? "Salvar Edi\xE7\xE3o" : "Adicionar Justificativa" }) })
3271
+ ] }),
3272
+ /* @__PURE__ */ jsx50(ListGroup3, { className: "border-0", children: localJustificativas.map((j) => {
3273
+ var _a, _b, _c;
3274
+ const isMe = ((_a = j.user) == null ? void 0 : _a.userId) === currentUserId;
3275
+ return /* @__PURE__ */ jsxs39(
3276
+ ListGroup3.Item,
2007
3277
  {
3278
+ className: "border-0 px-0",
2008
3279
  style: {
2009
- position: "fixed",
2010
- top: 0,
2011
- left: 0,
2012
- right: 0,
2013
- bottom: 0,
2014
- backgroundColor: "rgba(0,0,0,0.8)",
2015
- zIndex: 9999,
3280
+ opacity: j.removed ? 0.5 : 1,
2016
3281
  display: "flex",
2017
3282
  flexDirection: "column",
2018
- alignItems: "center",
2019
- justifyContent: "center",
2020
- padding: "20px"
3283
+ alignItems: isMe ? "flex-start" : "flex-end",
3284
+ backgroundColor: "transparent"
2021
3285
  },
2022
- onClick: (e) => e.stopPropagation(),
2023
- children: /* @__PURE__ */ jsxs22("div", { style: { width: "100%", maxWidth: "500px", backgroundColor: "#fff", borderRadius: "12px", padding: "20px", position: "relative" }, children: [
2024
- /* @__PURE__ */ jsx28(
3286
+ children: [
3287
+ /* @__PURE__ */ jsxs39("div", { className: "d-flex align-items-center mb-1", style: { width: "100%", justifyContent: isMe ? "flex-start" : "flex-end" }, children: [
3288
+ /* @__PURE__ */ jsx50("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" }),
3289
+ /* @__PURE__ */ jsx50(Badge4, { bg: "secondary", style: { fontSize: "0.65rem" }, children: dayjs6(j.createdAt).format("DD/MM [\xE0s] HH:mm") })
3290
+ ] }),
3291
+ /* @__PURE__ */ jsx50(
2025
3292
  "div",
2026
3293
  {
2027
- onClick: toggleQr,
2028
- style: { position: "absolute", top: "10px", right: "15px", fontSize: "1.5rem", cursor: "pointer", zIndex: 10001 },
2029
- children: "\xD7"
3294
+ onClick: () => !j.removed && isMe && (setNovaDescricao(j.descricao), setEditandoId(j.id)),
3295
+ style: {
3296
+ maxWidth: "85%",
3297
+ alignSelf: isMe ? "flex-start" : "flex-end",
3298
+ backgroundColor: j.removed ? "#f8d7da" : isMe ? "#e3f2fd" : "#f8f9fa",
3299
+ color: "#333",
3300
+ padding: "12px 16px",
3301
+ borderRadius: "12px",
3302
+ cursor: isMe && !j.removed ? "pointer" : "default",
3303
+ textDecoration: j.removed ? "line-through" : "none",
3304
+ boxShadow: "0 1px 3px rgba(0,0,0,0.1)",
3305
+ border: isMe ? "1px solid #bbdefb" : "1px solid #e0e0e0"
3306
+ },
3307
+ children: j.descricao
2030
3308
  }
2031
3309
  ),
2032
- /* @__PURE__ */ jsx28("h5", { className: "mb-3 text-center", children: "Escaneie o QR Code" }),
2033
- /* @__PURE__ */ jsx28(
2034
- QrReader,
3310
+ isMe && /* @__PURE__ */ jsx50("div", { className: "mt-1 d-flex gap-2", children: j.removed ? /* @__PURE__ */ jsx50(OverlayTrigger2, { placement: "top", overlay: /* @__PURE__ */ jsx50(Tooltip4, { children: "Desfazer" }), children: /* @__PURE__ */ jsx50(
3311
+ FaUndo,
2035
3312
  {
2036
- callback: (v) => {
2037
- toggleQr();
2038
- callback(v);
2039
- }
3313
+ onClick: () => handleUndoRemove(j.id),
3314
+ className: "text-success cursor-pointer",
3315
+ size: 14
2040
3316
  }
2041
- ),
2042
- /* @__PURE__ */ jsx28("p", { className: "mt-3 text-muted text-center small", children: "Aponte a c\xE2mera para o c\xF3digo" })
2043
- ] })
2044
- }
2045
- )
2046
- ]
3317
+ ) }) : /* @__PURE__ */ jsx50(OverlayTrigger2, { placement: "top", overlay: /* @__PURE__ */ jsx50(Tooltip4, { children: "Remover" }), children: /* @__PURE__ */ jsx50(
3318
+ FaTrashAlt,
3319
+ {
3320
+ onClick: () => handleRemove(j.id),
3321
+ className: "text-danger cursor-pointer",
3322
+ size: 14
3323
+ }
3324
+ ) }) })
3325
+ ]
3326
+ },
3327
+ j.id
3328
+ );
3329
+ }) })
3330
+ ] }),
3331
+ /* @__PURE__ */ jsx50(Modal7.Footer, { children: /* @__PURE__ */ jsx50(Button21, { variant: "outline-secondary", onClick: onClose, children: "Fechar" }) })
3332
+ ] });
3333
+ };
3334
+
3335
+ // src/modals/ImageViewModal.tsx
3336
+ import { useState as useState24, useEffect as useEffect11 } from "react";
3337
+ import { Button as Button22 } from "react-bootstrap";
3338
+ import { jsx as jsx51, jsxs as jsxs40 } from "react/jsx-runtime";
3339
+ var ImageViewModal = ({
3340
+ show,
3341
+ onHide,
3342
+ imagesData = [],
3343
+ initialImageData,
3344
+ imageAltText = "Visualiza\xE7\xE3o de imagem",
3345
+ resolveImageUrl
3346
+ }) => {
3347
+ const [selectedImageKey, setSelectedImageKey] = useState24(null);
3348
+ const [imageSrc, setImageSrc] = useState24(null);
3349
+ const [currentAuthor, setCurrentAuthor] = useState24("Desconhecido");
3350
+ useEffect11(() => {
3351
+ if (show && initialImageData) {
3352
+ setSelectedImageKey(initialImageData.key);
3353
+ setCurrentAuthor(initialImageData.author || "Desconhecido");
3354
+ } else if (show && imagesData.length > 0) {
3355
+ setSelectedImageKey(imagesData[0].key);
3356
+ setCurrentAuthor(imagesData[0].author || "Desconhecido");
3357
+ }
3358
+ }, [show, initialImageData]);
3359
+ useEffect11(() => {
3360
+ if (show && selectedImageKey) {
3361
+ setImageSrc(null);
3362
+ const file = imagesData.find((f) => f.key === selectedImageKey);
3363
+ if (file == null ? void 0 : file.signedUrl) {
3364
+ setImageSrc(file.signedUrl);
3365
+ } else if (resolveImageUrl) {
3366
+ setImageSrc(resolveImageUrl(selectedImageKey));
3367
+ }
3368
+ }
3369
+ }, [show, selectedImageKey]);
3370
+ const renderImageSelector = () => {
3371
+ if (imagesData.length <= 1) return null;
3372
+ return /* @__PURE__ */ jsx51("div", { className: "mb-3 d-flex flex-wrap justify-content-center gap-2", children: imagesData.map((img, idx) => /* @__PURE__ */ jsx51(
3373
+ Button22,
3374
+ {
3375
+ variant: selectedImageKey === img.key ? "primary" : "outline-secondary",
3376
+ size: "sm",
3377
+ onClick: () => {
3378
+ setSelectedImageKey(img.key);
3379
+ setCurrentAuthor(img.author || "Desconhecido");
3380
+ },
3381
+ children: img.dataContext ? `${img.dataContext}-${img.dataId}` : `Imagem ${idx + 1}`
3382
+ },
3383
+ idx
3384
+ )) });
3385
+ };
3386
+ const body = /* @__PURE__ */ jsxs40("div", { className: "text-center", children: [
3387
+ renderImageSelector(),
3388
+ imageSrc ? /* @__PURE__ */ jsx51(
3389
+ "img",
3390
+ {
3391
+ src: imageSrc,
3392
+ alt: imageAltText,
3393
+ className: "img-fluid rounded shadow-sm",
3394
+ style: { maxHeight: "75vh", objectFit: "contain" }
3395
+ }
3396
+ ) : /* @__PURE__ */ jsx51("div", { className: "p-5 text-muted", children: "Aguardando imagem..." })
3397
+ ] });
3398
+ return /* @__PURE__ */ jsx51(
3399
+ ModalBasicTemplate_default,
3400
+ {
3401
+ header: "Visualiza\xE7\xE3o de Imagem",
3402
+ closeFunc: onHide,
3403
+ show,
3404
+ body,
3405
+ props: { size: "lg" },
3406
+ footer: () => /* @__PURE__ */ jsxs40("div", { className: "w-100 d-flex justify-content-between align-items-center", children: [
3407
+ /* @__PURE__ */ jsxs40("small", { className: "text-muted", children: [
3408
+ "Enviado por: ",
3409
+ /* @__PURE__ */ jsx51("strong", { children: currentAuthor })
3410
+ ] }),
3411
+ /* @__PURE__ */ jsx51(Button22, { variant: "outline-secondary", size: "sm", onClick: onHide, children: "Fechar" })
3412
+ ] })
2047
3413
  }
2048
3414
  );
2049
3415
  };
2050
3416
 
2051
- // src/forms/FindRecursoByTagField.tsx
2052
- import { jsx as jsx29 } from "react/jsx-runtime";
2053
- var FindRecursoByTagField = ({ callback, recursoController }) => {
2054
- const [selectedTag, setSelectedTag] = useState15("");
2055
- const [reachedRecurso, setReachedRecurso] = useState15(null);
2056
- const findRecursoByTagIdHandler = async (tagId) => {
3417
+ // src/tables/ReusableTableWithModal.tsx
3418
+ import { useState as useState25, useEffect as useEffect12 } from "react";
3419
+ import { Table, Button as Button23, Modal as Modal8 } from "react-bootstrap";
3420
+ import { Fragment as Fragment11, jsx as jsx52, jsxs as jsxs41 } from "react/jsx-runtime";
3421
+ var ReusableTableWithModal = ({
3422
+ fetchDataCallback,
3423
+ modalButtonCallback,
3424
+ configureColumnsCallback,
3425
+ headers,
3426
+ modalContent,
3427
+ confirmLabel = "Aceitar",
3428
+ onFetchData
3429
+ }) => {
3430
+ const [data, setData] = useState25([]);
3431
+ const [selectedItem, setSelectedItem] = useState25(null);
3432
+ const [showModal, setShowModal] = useState25(false);
3433
+ const [loading, setLoading] = useState25(false);
3434
+ const [tableDataRows, setTableDataRows] = useState25([]);
3435
+ const fetchData = async () => {
3436
+ setLoading(true);
2057
3437
  try {
2058
- const r = await recursoController.read("findRecursoByTagId", tagId);
2059
- setReachedRecurso(r);
3438
+ const response = await fetchDataCallback();
3439
+ onFetchData && onFetchData(response);
3440
+ setData(response);
3441
+ const items = Array.isArray(response) ? response : [response];
3442
+ const tabData = items.map((r) => configureColumnsCallback(r));
3443
+ setTableDataRows(tabData);
2060
3444
  } catch (error) {
2061
- console.error("Erro ao buscar recurso por tag ID:", error);
3445
+ console.error("Erro ao buscar dados na ReusableTable:", error);
3446
+ } finally {
3447
+ setLoading(false);
2062
3448
  }
2063
3449
  };
2064
- const findRecursoByTagDescriptionHandler = async (description) => {
2065
- try {
2066
- const formattedDescription = description.replace(/\s/g, "");
2067
- const recurso = await recursoController.read(
2068
- `recurso/findByTagDescription`,
2069
- formattedDescription
2070
- );
2071
- if (!callback) {
2072
- console.log("Recurso encontrado (sem callback):", recurso);
2073
- } else {
2074
- callback(recurso, true);
2075
- }
2076
- } catch (error) {
2077
- console.error("Erro ao buscar recurso por descri\xE7\xE3o de tag:", error);
2078
- }
3450
+ useEffect12(() => {
3451
+ fetchData();
3452
+ }, []);
3453
+ const handleRowClick = (td) => {
3454
+ setSelectedItem(td.dataObj);
3455
+ setShowModal(true);
2079
3456
  };
2080
- const confirmRecursoSelectionButton = () => {
2081
- return /* @__PURE__ */ jsx29(
2082
- "div",
2083
- {
2084
- className: "hoverable-div",
2085
- style: {
2086
- border: "solid",
2087
- borderTopRightRadius: "3px",
2088
- borderBottomRightRadius: "3px",
2089
- padding: "8px",
2090
- borderLeft: "none",
2091
- borderColor: "#ccc",
2092
- borderWidth: "1px",
2093
- cursor: "pointer",
2094
- display: "flex",
2095
- alignItems: "center"
3457
+ const handleCloseModal = () => {
3458
+ setShowModal(false);
3459
+ setSelectedItem(null);
3460
+ };
3461
+ return /* @__PURE__ */ jsxs41(Fragment11, { children: [
3462
+ /* @__PURE__ */ jsxs41(Table, { striped: true, bordered: true, hover: true, responsive: true, children: [
3463
+ /* @__PURE__ */ jsx52("thead", { children: /* @__PURE__ */ jsx52("tr", { children: headers.map((col, index) => /* @__PURE__ */ jsx52("th", { children: col }, index)) }) }),
3464
+ /* @__PURE__ */ jsx52("tbody", { children: loading ? /* @__PURE__ */ jsx52("tr", { children: /* @__PURE__ */ jsx52("td", { colSpan: headers.length, className: "text-center py-4", children: "Carregando..." }) }) : tableDataRows.length > 0 ? tableDataRows.map((td, index) => /* @__PURE__ */ jsx52(
3465
+ "tr",
3466
+ {
3467
+ onClick: () => handleRowClick(td),
3468
+ style: { cursor: "pointer" },
3469
+ children: td.columns.map((col, colIndex) => /* @__PURE__ */ jsx52("td", { children: col || "N/A" }, colIndex))
2096
3470
  },
2097
- children: /* @__PURE__ */ jsx29(
2098
- GrCheckmark2,
3471
+ index
3472
+ )) : /* @__PURE__ */ jsx52("tr", { children: /* @__PURE__ */ jsx52("td", { colSpan: headers.length, className: "text-center py-4", children: "Nenhum dado encontrado." }) }) })
3473
+ ] }),
3474
+ /* @__PURE__ */ jsxs41(Modal8, { show: showModal, onHide: handleCloseModal, centered: true, children: [
3475
+ /* @__PURE__ */ jsx52(Modal8.Header, { closeButton: true, children: /* @__PURE__ */ jsx52(Modal8.Title, { children: "Detalhes" }) }),
3476
+ /* @__PURE__ */ jsx52(Modal8.Body, { children: selectedItem && /* @__PURE__ */ jsx52("div", { children: modalContent ? modalContent(selectedItem) : "Visualizando detalhes do item." }) }),
3477
+ /* @__PURE__ */ jsxs41(Modal8.Footer, { children: [
3478
+ /* @__PURE__ */ jsx52(Button23, { variant: "outline-secondary", onClick: handleCloseModal, children: "Fechar" }),
3479
+ modalButtonCallback && /* @__PURE__ */ jsx52(
3480
+ Button23,
2099
3481
  {
2100
- size: 25,
2101
- onClick: () => reachedRecurso && callback(reachedRecurso, true)
3482
+ variant: "primary",
3483
+ onClick: () => {
3484
+ modalButtonCallback(selectedItem);
3485
+ handleCloseModal();
3486
+ },
3487
+ children: confirmLabel
2102
3488
  }
2103
3489
  )
2104
- }
2105
- );
2106
- };
2107
- return /* @__PURE__ */ jsx29("div", { children: /* @__PURE__ */ jsx29(
2108
- AutoComplete,
2109
- {
2110
- sortKey: "id",
2111
- loadCondition: true,
2112
- loadFunc: () => recursoController.get("findActiveRecursosTags"),
2113
- displayKey: "descricao",
2114
- title: "Selecione ou Digite a TAG",
2115
- isBold: true,
2116
- actionButton: confirmRecursoSelectionButton,
2117
- actionButton2: () => /* @__PURE__ */ jsx29(
2118
- QrCodeScanButton,
2119
- {
2120
- callback: (description) => findRecursoByTagDescriptionHandler(description)
2121
- }
2122
- ),
2123
- onSelectedClick: (v) => {
2124
- setSelectedTag(v);
2125
- findRecursoByTagIdHandler(v.id);
2126
- },
2127
- value: (selectedTag == null ? void 0 : selectedTag.descricao) || ""
2128
- }
2129
- ) });
3490
+ ] })
3491
+ ] })
3492
+ ] });
2130
3493
  };
2131
3494
 
2132
- // src/icons/IconLabelItem.tsx
2133
- import { jsx as jsx30, jsxs as jsxs23 } from "react/jsx-runtime";
2134
- var IconLabelItem = ({
2135
- icon,
2136
- label,
2137
- containerClassName = "",
2138
- labelClassName = "",
2139
- onClick,
2140
- style
3495
+ // src/text/TextWithMore.tsx
3496
+ import { useState as useState26 } from "react";
3497
+ import { Button as Button24 } from "react-bootstrap";
3498
+ import { Fragment as Fragment12, jsx as jsx53, jsxs as jsxs42 } from "react/jsx-runtime";
3499
+ var TextWithMore = ({
3500
+ text = "Carregando...",
3501
+ maxLength,
3502
+ moreLabel = "ver mais",
3503
+ lessLabel = "ver menos"
2141
3504
  }) => {
2142
- return /* @__PURE__ */ jsxs23("div", { className: containerClassName, onClick, style: { ...style, cursor: onClick ? "pointer" : "default" }, children: [
2143
- icon,
2144
- /* @__PURE__ */ jsx30("span", { className: labelClassName, children: label })
3505
+ const [expanded, setExpanded] = useState26(false);
3506
+ const handleToggleExpand = () => {
3507
+ setExpanded(!expanded);
3508
+ };
3509
+ const isTruncated = text.length > maxLength;
3510
+ const displayText = isTruncated && !expanded ? text.slice(0, maxLength) + "\u2026" : text;
3511
+ return /* @__PURE__ */ jsxs42(Fragment12, { children: [
3512
+ /* @__PURE__ */ jsx53("span", { className: "text-with-more-content", children: displayText }),
3513
+ isTruncated && /* @__PURE__ */ jsx53(
3514
+ Button24,
3515
+ {
3516
+ variant: "link",
3517
+ className: "p-0 ms-2",
3518
+ style: { fontSize: "0.85rem", textDecoration: "none" },
3519
+ onClick: handleToggleExpand,
3520
+ children: expanded ? lessLabel : moreLabel
3521
+ }
3522
+ )
2145
3523
  ] });
2146
3524
  };
2147
-
2148
- // src/icons/IconLabelList.tsx
2149
- import { jsx as jsx31 } from "react/jsx-runtime";
2150
- var IconLabelList = ({ items, className = "" }) => {
2151
- return /* @__PURE__ */ jsx31("div", { className: `icon-label-list ${className}`, children: items.map((item, index) => /* @__PURE__ */ jsx31(
2152
- IconLabelItem,
2153
- {
2154
- labelClassName: "icon-label",
2155
- containerClassName: "icon-label-item",
2156
- icon: item.icon,
2157
- label: item.label,
2158
- onClick: item.onClick
2159
- },
2160
- index
2161
- )) });
2162
- };
2163
3525
  export {
2164
3526
  ActionButtons,
2165
3527
  AddButton_default as AddButton,
3528
+ AdvancedFilterBar,
2166
3529
  ApproveAndReproveButtons,
2167
3530
  AsyncButton,
2168
3531
  AutoComplete,
3532
+ BonusButton,
3533
+ ButtonWithDropdown,
3534
+ CheckBox,
2169
3535
  ClickToWriteField,
2170
3536
  ColorPicker,
2171
3537
  ConfigObject,
2172
3538
  DeleteButton_default as DeleteButton,
2173
3539
  DeleteConfirm,
3540
+ ExpandableCard,
2174
3541
  FindRecursoByTagField,
2175
3542
  FormField,
2176
3543
  Generic3DotMenu,
3544
+ GenericChart,
2177
3545
  GenericDisplay_default as GenericDisplay,
2178
3546
  GenericForm_default as GenericForm,
3547
+ GenericREchart,
2179
3548
  GenericSelect_default as GenericSelect,
2180
3549
  GenericSelectOps,
2181
3550
  IconLabelItem,
2182
3551
  IconLabelList,
3552
+ ImageViewModal,
3553
+ JustificativaModal,
2183
3554
  LoadingButton,
2184
3555
  LoadingProgress,
2185
3556
  MailSender,
2186
3557
  MenuEvent,
3558
+ ModalBasicTemplate,
2187
3559
  NavigateButton,
3560
+ NotificationBell,
3561
+ NotificationItem,
3562
+ PeriodSelector,
2188
3563
  QrCodeScanButton,
2189
3564
  QrReader,
3565
+ RecursoDisplayer,
2190
3566
  ResponsiveContainer_default as ResponsiveContainer,
3567
+ ReusableTableWithModal,
3568
+ SectorSelector,
3569
+ SelectDateModal,
2191
3570
  StatusBadge,
2192
3571
  StatusIndicator,
3572
+ StatusLight,
3573
+ StatusPills,
2193
3574
  Switch,
2194
3575
  SwitchOnClick,
3576
+ TextWithMore,
3577
+ TimerDisplay,
3578
+ UnidadeMaterialForm,
2195
3579
  UploadArea,
2196
3580
  UuidPill_default as UuidPill,
2197
3581
  VerticalItemsDisplay