teraprox-ui-kit 0.1.10 → 0.2.1
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.css +198 -25
- package/dist/index.d.mts +96 -30
- package/dist/index.d.ts +96 -30
- package/dist/index.js +1512 -1116
- package/dist/index.mjs +1519 -1109
- package/package.json +11 -2
package/dist/index.mjs
CHANGED
|
@@ -14,21 +14,20 @@ var AddButton = ({ callback, hiddenBool, size }) => /* @__PURE__ */ jsx(
|
|
|
14
14
|
var AddButton_default = AddButton;
|
|
15
15
|
|
|
16
16
|
// src/buttons/DeleteButton.tsx
|
|
17
|
-
import { Button as Button2 } from "react-bootstrap";
|
|
18
17
|
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
19
18
|
var DeleteButton = ({ title, onDeleteClick }) => {
|
|
20
|
-
return /* @__PURE__ */ jsx2(
|
|
19
|
+
return /* @__PURE__ */ jsx2("button", { className: "btn btn-danger", onClick: () => onDeleteClick(), children: title });
|
|
21
20
|
};
|
|
22
21
|
var DeleteButton_default = DeleteButton;
|
|
23
22
|
|
|
24
23
|
// src/buttons/ActionButtons.tsx
|
|
25
24
|
import { useState as useState2, useRef } from "react";
|
|
26
|
-
import { Button as
|
|
25
|
+
import { Button as Button3, Form as Form2, ProgressBar } from "react-bootstrap";
|
|
27
26
|
import { FiSave, FiTrash2, FiRotateCcw, FiCopy, FiChevronLeft } from "react-icons/fi";
|
|
28
27
|
|
|
29
28
|
// src/forms/DeleteConfirm.tsx
|
|
30
29
|
import { useState } from "react";
|
|
31
|
-
import { Button as
|
|
30
|
+
import { Button as Button2, Modal, Form } from "react-bootstrap";
|
|
32
31
|
import { jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
33
32
|
var DeleteConfirm = ({
|
|
34
33
|
show,
|
|
@@ -70,9 +69,9 @@ var DeleteConfirm = ({
|
|
|
70
69
|
] })
|
|
71
70
|
] }) }),
|
|
72
71
|
/* @__PURE__ */ jsxs(Modal.Footer, { children: [
|
|
73
|
-
/* @__PURE__ */ jsx3(
|
|
72
|
+
/* @__PURE__ */ jsx3(Button2, { variant: "secondary", onClick: () => onHide(false), children: "Cancelar" }),
|
|
74
73
|
/* @__PURE__ */ jsx3(
|
|
75
|
-
|
|
74
|
+
Button2,
|
|
76
75
|
{
|
|
77
76
|
variant: "danger",
|
|
78
77
|
disabled: !isConfirmEnabled(),
|
|
@@ -139,7 +138,7 @@ var ActionButtons = ({
|
|
|
139
138
|
if (useDelayedDelete) {
|
|
140
139
|
return /* @__PURE__ */ jsxs2("div", { style: { position: "relative", display: "inline-block", margin: 2 }, children: [
|
|
141
140
|
/* @__PURE__ */ jsxs2(
|
|
142
|
-
|
|
141
|
+
Button3,
|
|
143
142
|
{
|
|
144
143
|
variant: "outline-danger",
|
|
145
144
|
onMouseDown: startHold,
|
|
@@ -173,7 +172,7 @@ var ActionButtons = ({
|
|
|
173
172
|
] });
|
|
174
173
|
}
|
|
175
174
|
return /* @__PURE__ */ jsxs2(
|
|
176
|
-
|
|
175
|
+
Button3,
|
|
177
176
|
{
|
|
178
177
|
variant: "danger",
|
|
179
178
|
onClick: () => setShowConfirm(true),
|
|
@@ -198,20 +197,20 @@ var ActionButtons = ({
|
|
|
198
197
|
}
|
|
199
198
|
),
|
|
200
199
|
/* @__PURE__ */ jsxs2(Form2.Group, { className: "d-flex flex-wrap align-items-center mt-3 gap-1", children: [
|
|
201
|
-
onBack && /* @__PURE__ */ jsxs2(
|
|
200
|
+
onBack && /* @__PURE__ */ jsxs2(Button3, { variant: "outline-secondary", onClick: onBack, disabled, style: { margin: 2 }, children: [
|
|
202
201
|
/* @__PURE__ */ jsx4(FiChevronLeft, { className: "me-2" }),
|
|
203
202
|
backLabel
|
|
204
203
|
] }),
|
|
205
|
-
isEditing && onCancelEdit && /* @__PURE__ */ jsxs2(
|
|
204
|
+
isEditing && onCancelEdit && /* @__PURE__ */ jsxs2(Button3, { variant: "warning", onClick: onCancelEdit, disabled, style: { margin: 2 }, children: [
|
|
206
205
|
/* @__PURE__ */ jsx4(FiRotateCcw, { className: "me-2" }),
|
|
207
206
|
cancelEditLabel
|
|
208
207
|
] }),
|
|
209
208
|
/* @__PURE__ */ jsx4(PermissionWrapper, { children: renderDeleteButton() }),
|
|
210
|
-
onSave && /* @__PURE__ */ jsxs2(
|
|
209
|
+
onSave && /* @__PURE__ */ jsxs2(Button3, { variant: saveVariant, onClick: onSave, disabled, style: { margin: 2 }, children: [
|
|
211
210
|
/* @__PURE__ */ jsx4(FiSave, { className: "me-2" }),
|
|
212
211
|
saveLabel
|
|
213
212
|
] }),
|
|
214
|
-
isEditing && onCopy && /* @__PURE__ */ jsxs2(
|
|
213
|
+
isEditing && onCopy && /* @__PURE__ */ jsxs2(Button3, { variant: "outline-primary", onClick: onCopy, disabled, style: { margin: 2 }, children: [
|
|
215
214
|
/* @__PURE__ */ jsx4(FiCopy, { className: "me-2" }),
|
|
216
215
|
copyLabel
|
|
217
216
|
] })
|
|
@@ -221,7 +220,7 @@ var ActionButtons = ({
|
|
|
221
220
|
|
|
222
221
|
// src/buttons/ApproveAndReproveButtons.tsx
|
|
223
222
|
import { useEffect } from "react";
|
|
224
|
-
import { Button as
|
|
223
|
+
import { Button as Button4 } from "react-bootstrap";
|
|
225
224
|
import { GrCheckmark, GrClose } from "react-icons/gr";
|
|
226
225
|
import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
227
226
|
var ApproveAndReproveButtons = ({
|
|
@@ -245,14 +244,14 @@ var ApproveAndReproveButtons = ({
|
|
|
245
244
|
return /* @__PURE__ */ jsxs3("div", { children: [
|
|
246
245
|
/* @__PURE__ */ jsx5("strong", { children: headerText }),
|
|
247
246
|
/* @__PURE__ */ jsx5("br", {}),
|
|
248
|
-
/* @__PURE__ */ jsx5(
|
|
249
|
-
/* @__PURE__ */ jsx5(
|
|
247
|
+
/* @__PURE__ */ jsx5(Button4, { onClick: approveCallback, variant: "success", className: "me-1", children: approveText ? approveText : /* @__PURE__ */ jsx5(GrCheckmark, { size: buttonSize }) }),
|
|
248
|
+
/* @__PURE__ */ jsx5(Button4, { onClick: reproveCallback, variant: "danger", children: repproveText ? repproveText : /* @__PURE__ */ jsx5(GrClose, { size: buttonSize }) })
|
|
250
249
|
] });
|
|
251
250
|
};
|
|
252
251
|
|
|
253
252
|
// src/buttons/AsyncButton.tsx
|
|
254
253
|
import { useState as useState3, useRef as useRef2 } from "react";
|
|
255
|
-
import { Button as
|
|
254
|
+
import { Button as Button5 } from "react-bootstrap";
|
|
256
255
|
|
|
257
256
|
// src/progress/LoadingProgress.tsx
|
|
258
257
|
import { Spinner } from "react-bootstrap";
|
|
@@ -295,7 +294,7 @@ var AsyncButton = ({
|
|
|
295
294
|
}) => {
|
|
296
295
|
const { loading, execute } = useAsyncAction();
|
|
297
296
|
return /* @__PURE__ */ jsx7(
|
|
298
|
-
|
|
297
|
+
Button5,
|
|
299
298
|
{
|
|
300
299
|
...buttonProps,
|
|
301
300
|
onClick: () => execute(onClick),
|
|
@@ -327,7 +326,7 @@ var BonusButton = ({
|
|
|
327
326
|
};
|
|
328
327
|
|
|
329
328
|
// src/buttons/ButtonWithDropdown.tsx
|
|
330
|
-
import { Button as
|
|
329
|
+
import { Button as Button6, ButtonGroup, Dropdown } from "react-bootstrap";
|
|
331
330
|
import { jsx as jsx9, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
332
331
|
var ButtonWithDropdown = ({
|
|
333
332
|
title,
|
|
@@ -343,10 +342,9 @@ var ButtonWithDropdown = ({
|
|
|
343
342
|
as: ButtonGroup,
|
|
344
343
|
className: "d-flex w-100",
|
|
345
344
|
style: { flex: 1, minWidth: 0 },
|
|
346
|
-
menuVariant,
|
|
347
345
|
children: [
|
|
348
346
|
/* @__PURE__ */ jsx9(
|
|
349
|
-
|
|
347
|
+
Button6,
|
|
350
348
|
{
|
|
351
349
|
variant,
|
|
352
350
|
onClick: onClickButton,
|
|
@@ -371,7 +369,7 @@ var ButtonWithDropdown = ({
|
|
|
371
369
|
}
|
|
372
370
|
}
|
|
373
371
|
),
|
|
374
|
-
/* @__PURE__ */ jsx9(Dropdown.Menu, { children: options.map((opt, idx) => /* @__PURE__ */ jsx9(Dropdown.Item, { onClick: opt.callback, children: opt.label }, `${opt.label}-${idx}`)) })
|
|
372
|
+
/* @__PURE__ */ jsx9(Dropdown.Menu, { variant: menuVariant, children: options.map((opt, idx) => /* @__PURE__ */ jsx9(Dropdown.Item, { onClick: opt.callback, children: opt.label }, `${opt.label}-${idx}`)) })
|
|
375
373
|
]
|
|
376
374
|
}
|
|
377
375
|
);
|
|
@@ -420,7 +418,7 @@ var CheckBox = ({
|
|
|
420
418
|
|
|
421
419
|
// src/buttons/Generic3DotMenu.tsx
|
|
422
420
|
import { useState as useState4 } from "react";
|
|
423
|
-
import { Button as
|
|
421
|
+
import { Button as Button7, Modal as Modal2 } from "react-bootstrap";
|
|
424
422
|
import { CiMenuKebab } from "react-icons/ci";
|
|
425
423
|
import { Fragment as Fragment2, jsx as jsx11, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
426
424
|
var MenuEvent = class {
|
|
@@ -468,7 +466,7 @@ var Generic3DotMenu = ({
|
|
|
468
466
|
Object.keys(groupedEvents).map((section, sectionIndex) => /* @__PURE__ */ jsxs6("div", { className: "mb-4", children: [
|
|
469
467
|
/* @__PURE__ */ jsx11("h6", { className: "border-bottom pb-2 mb-3", children: section !== "default" ? section : "Op\xE7\xF5es Principais" }),
|
|
470
468
|
/* @__PURE__ */ jsx11("div", { className: "d-grid gap-2", children: groupedEvents[section].map((event, index) => /* @__PURE__ */ jsx11(
|
|
471
|
-
|
|
469
|
+
Button7,
|
|
472
470
|
{
|
|
473
471
|
variant: event.variant || "primary",
|
|
474
472
|
onClick: () => {
|
|
@@ -481,13 +479,13 @@ var Generic3DotMenu = ({
|
|
|
481
479
|
)) })
|
|
482
480
|
] }, sectionIndex))
|
|
483
481
|
] }),
|
|
484
|
-
/* @__PURE__ */ jsx11(Modal2.Footer, { children: /* @__PURE__ */ jsx11(
|
|
482
|
+
/* @__PURE__ */ jsx11(Modal2.Footer, { children: /* @__PURE__ */ jsx11(Button7, { variant: "secondary", onClick: handleClose, children: "Fechar" }) })
|
|
485
483
|
] })
|
|
486
484
|
] });
|
|
487
485
|
};
|
|
488
486
|
|
|
489
487
|
// src/buttons/LoadingButton.tsx
|
|
490
|
-
import { Button as
|
|
488
|
+
import { Button as Button8, Spinner as Spinner2 } from "react-bootstrap";
|
|
491
489
|
import { jsx as jsx12, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
492
490
|
var LoadingButton = ({
|
|
493
491
|
onClick,
|
|
@@ -502,7 +500,7 @@ var LoadingButton = ({
|
|
|
502
500
|
...props
|
|
503
501
|
}) => {
|
|
504
502
|
return /* @__PURE__ */ jsx12(
|
|
505
|
-
|
|
503
|
+
Button8,
|
|
506
504
|
{
|
|
507
505
|
variant,
|
|
508
506
|
size,
|
|
@@ -533,7 +531,7 @@ var LoadingButton = ({
|
|
|
533
531
|
};
|
|
534
532
|
|
|
535
533
|
// src/buttons/NavigateButton.tsx
|
|
536
|
-
import { Button as
|
|
534
|
+
import { Button as Button9 } from "react-bootstrap";
|
|
537
535
|
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
538
536
|
var NavigateButton = ({
|
|
539
537
|
displayName,
|
|
@@ -553,7 +551,7 @@ var NavigateButton = ({
|
|
|
553
551
|
navigator2(path, config, pageName);
|
|
554
552
|
};
|
|
555
553
|
return /* @__PURE__ */ jsx13(
|
|
556
|
-
|
|
554
|
+
Button9,
|
|
557
555
|
{
|
|
558
556
|
style,
|
|
559
557
|
variant,
|
|
@@ -758,7 +756,7 @@ var ResponsiveContainer2 = ({
|
|
|
758
756
|
if (onClose) onClose();
|
|
759
757
|
};
|
|
760
758
|
return /* @__PURE__ */ jsxs11(Modal3, { size: "lg", show, onHide: handleClose, scrollable, children: [
|
|
761
|
-
/* @__PURE__ */ jsx18(Modal3.Header, { closeButton: true, onClick: handleClose }),
|
|
759
|
+
/* @__PURE__ */ jsx18(Modal3.Header, { closeButton: true, onClick: handleClose, children: title && /* @__PURE__ */ jsx18(Modal3.Title, { children: title }) }),
|
|
762
760
|
/* @__PURE__ */ jsx18(ModalBody, { children })
|
|
763
761
|
] });
|
|
764
762
|
};
|
|
@@ -1009,8 +1007,71 @@ var GenericDisplay = ({
|
|
|
1009
1007
|
};
|
|
1010
1008
|
var GenericDisplay_default = GenericDisplay;
|
|
1011
1009
|
|
|
1012
|
-
// src/displays/
|
|
1010
|
+
// src/displays/BranchDropDisplay.tsx
|
|
1011
|
+
import {
|
|
1012
|
+
BranchDropDisplay,
|
|
1013
|
+
BranchDropDisplay as BranchDropDisplay2
|
|
1014
|
+
} from "@teraprox/ui-kit-sgm";
|
|
1015
|
+
|
|
1016
|
+
// src/displays/RateLimitBar.tsx
|
|
1017
|
+
import { useMemo } from "react";
|
|
1013
1018
|
import { jsx as jsx22, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
1019
|
+
function formatResetIn(windowReset) {
|
|
1020
|
+
const resetAt = new Date(windowReset).getTime();
|
|
1021
|
+
const remaining = Math.max(0, Math.round((resetAt - Date.now()) / 1e3));
|
|
1022
|
+
if (remaining <= 0) return "agora";
|
|
1023
|
+
if (remaining < 60) return `${remaining}s`;
|
|
1024
|
+
return `${Math.round(remaining / 60)}min`;
|
|
1025
|
+
}
|
|
1026
|
+
var RateLimitBar = ({ entry, label, className }) => {
|
|
1027
|
+
const pct = useMemo(() => {
|
|
1028
|
+
if (!entry || entry.limit <= 0) return 0;
|
|
1029
|
+
return Math.min(100, Math.round(entry.used / entry.limit * 100));
|
|
1030
|
+
}, [entry]);
|
|
1031
|
+
if (!entry) return null;
|
|
1032
|
+
const color = entry.exceeded || pct >= 90 ? "#dc3545" : pct >= 70 ? "#ffc107" : "#28a745";
|
|
1033
|
+
const containerStyle = {
|
|
1034
|
+
width: "100%",
|
|
1035
|
+
marginBottom: "4px"
|
|
1036
|
+
};
|
|
1037
|
+
const barTrackStyle = {
|
|
1038
|
+
height: "6px",
|
|
1039
|
+
width: "100%",
|
|
1040
|
+
backgroundColor: "#e9ecef",
|
|
1041
|
+
borderRadius: "3px",
|
|
1042
|
+
overflow: "hidden"
|
|
1043
|
+
};
|
|
1044
|
+
const barFillStyle = {
|
|
1045
|
+
height: "100%",
|
|
1046
|
+
width: `${pct}%`,
|
|
1047
|
+
backgroundColor: color,
|
|
1048
|
+
borderRadius: "3px",
|
|
1049
|
+
transition: "width 0.3s ease, background-color 0.3s ease"
|
|
1050
|
+
};
|
|
1051
|
+
const textStyle = {
|
|
1052
|
+
fontSize: "11px",
|
|
1053
|
+
color: "#6c757d",
|
|
1054
|
+
display: "flex",
|
|
1055
|
+
justifyContent: "space-between",
|
|
1056
|
+
marginBottom: "2px"
|
|
1057
|
+
};
|
|
1058
|
+
return /* @__PURE__ */ jsxs15("div", { style: containerStyle, className, children: [
|
|
1059
|
+
/* @__PURE__ */ jsxs15("div", { style: textStyle, children: [
|
|
1060
|
+
label && /* @__PURE__ */ jsx22("span", { children: label }),
|
|
1061
|
+
/* @__PURE__ */ jsxs15("span", { children: [
|
|
1062
|
+
entry.used,
|
|
1063
|
+
"/",
|
|
1064
|
+
entry.limit,
|
|
1065
|
+
" req",
|
|
1066
|
+
entry.exceeded ? " \u2014 limite atingido" : ` (reset em ${formatResetIn(entry.windowReset)})`
|
|
1067
|
+
] })
|
|
1068
|
+
] }),
|
|
1069
|
+
/* @__PURE__ */ jsx22("div", { style: barTrackStyle, children: /* @__PURE__ */ jsx22("div", { style: barFillStyle }) })
|
|
1070
|
+
] });
|
|
1071
|
+
};
|
|
1072
|
+
|
|
1073
|
+
// src/displays/StatusIndicator.tsx
|
|
1074
|
+
import { jsx as jsx23, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
1014
1075
|
var StatusIndicator = ({
|
|
1015
1076
|
status,
|
|
1016
1077
|
count,
|
|
@@ -1025,14 +1086,14 @@ var StatusIndicator = ({
|
|
|
1025
1086
|
naoAtribuida: "N\xC3O ATRIBUIDA"
|
|
1026
1087
|
};
|
|
1027
1088
|
const label = statusLabels[status] || status.toUpperCase();
|
|
1028
|
-
return /* @__PURE__ */
|
|
1029
|
-
/* @__PURE__ */
|
|
1030
|
-
/* @__PURE__ */
|
|
1089
|
+
return /* @__PURE__ */ jsxs16("div", { className: `status-flag ${status} ${containerClassName}`, children: [
|
|
1090
|
+
/* @__PURE__ */ jsx23("div", { className: "status-label", children: label }),
|
|
1091
|
+
/* @__PURE__ */ jsx23("div", { className: "status-count", children: count })
|
|
1031
1092
|
] });
|
|
1032
1093
|
};
|
|
1033
1094
|
|
|
1034
1095
|
// src/displays/VerticalItemsDisplay.tsx
|
|
1035
|
-
import { jsx as
|
|
1096
|
+
import { jsx as jsx24, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
1036
1097
|
var VerticalItemsDisplay = ({
|
|
1037
1098
|
item1 = "",
|
|
1038
1099
|
item2 = "",
|
|
@@ -1040,15 +1101,15 @@ var VerticalItemsDisplay = ({
|
|
|
1040
1101
|
className = "",
|
|
1041
1102
|
style
|
|
1042
1103
|
}) => {
|
|
1043
|
-
return /* @__PURE__ */
|
|
1044
|
-
/* @__PURE__ */
|
|
1045
|
-
/* @__PURE__ */
|
|
1046
|
-
/* @__PURE__ */
|
|
1104
|
+
return /* @__PURE__ */ jsxs17("div", { className, style, children: [
|
|
1105
|
+
/* @__PURE__ */ jsx24("div", { children: item1 }),
|
|
1106
|
+
/* @__PURE__ */ jsx24("div", { children: item2 }),
|
|
1107
|
+
/* @__PURE__ */ jsx24("div", { children: item3 })
|
|
1047
1108
|
] });
|
|
1048
1109
|
};
|
|
1049
1110
|
|
|
1050
1111
|
// src/displays/StatusLight.tsx
|
|
1051
|
-
import { jsx as
|
|
1112
|
+
import { jsx as jsx25 } from "react/jsx-runtime";
|
|
1052
1113
|
var StatusLight = ({
|
|
1053
1114
|
active = false,
|
|
1054
1115
|
activeLightColor = "green",
|
|
@@ -1058,7 +1119,7 @@ var StatusLight = ({
|
|
|
1058
1119
|
style
|
|
1059
1120
|
}) => {
|
|
1060
1121
|
const color = active ? activeLightColor : inactiveLightColor;
|
|
1061
|
-
return /* @__PURE__ */
|
|
1122
|
+
return /* @__PURE__ */ jsx25(
|
|
1062
1123
|
"div",
|
|
1063
1124
|
{
|
|
1064
1125
|
className,
|
|
@@ -1080,7 +1141,7 @@ import dayjs2 from "dayjs";
|
|
|
1080
1141
|
import duration from "dayjs/plugin/duration";
|
|
1081
1142
|
import { BiTimer } from "react-icons/bi";
|
|
1082
1143
|
import { BsPause, BsPlay } from "react-icons/bs";
|
|
1083
|
-
import { Fragment as Fragment6, jsx as
|
|
1144
|
+
import { Fragment as Fragment6, jsx as jsx26, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
1084
1145
|
dayjs2.extend(duration);
|
|
1085
1146
|
var TimerDisplay = ({
|
|
1086
1147
|
id,
|
|
@@ -1110,8 +1171,8 @@ var TimerDisplay = ({
|
|
|
1110
1171
|
const secondsRemaining = time.seconds().toString().padStart(2, "0");
|
|
1111
1172
|
return days > 0 ? `${days}d ${hours}:${minutes}:${secondsRemaining}` : `${hours}:${minutes}:${secondsRemaining}`;
|
|
1112
1173
|
};
|
|
1113
|
-
return /* @__PURE__ */
|
|
1114
|
-
/* @__PURE__ */
|
|
1174
|
+
return /* @__PURE__ */ jsx26("div", { className: "timer-display-container", children: /* @__PURE__ */ jsx26("div", { className: "timer-display-content", children: id ? /* @__PURE__ */ jsxs18(Fragment6, { children: [
|
|
1175
|
+
/* @__PURE__ */ jsx26(
|
|
1115
1176
|
BiTimer,
|
|
1116
1177
|
{
|
|
1117
1178
|
size: 24,
|
|
@@ -1119,7 +1180,7 @@ var TimerDisplay = ({
|
|
|
1119
1180
|
title: "Timer"
|
|
1120
1181
|
}
|
|
1121
1182
|
),
|
|
1122
|
-
pausable && !isStopped && /* @__PURE__ */
|
|
1183
|
+
pausable && !isStopped && /* @__PURE__ */ jsx26(
|
|
1123
1184
|
BsPause,
|
|
1124
1185
|
{
|
|
1125
1186
|
size: 20,
|
|
@@ -1128,7 +1189,7 @@ var TimerDisplay = ({
|
|
|
1128
1189
|
title: "Pausar"
|
|
1129
1190
|
}
|
|
1130
1191
|
),
|
|
1131
|
-
playable && !isStopped && /* @__PURE__ */
|
|
1192
|
+
playable && !isStopped && /* @__PURE__ */ jsx26(
|
|
1132
1193
|
BsPlay,
|
|
1133
1194
|
{
|
|
1134
1195
|
size: 20,
|
|
@@ -1137,761 +1198,685 @@ var TimerDisplay = ({
|
|
|
1137
1198
|
title: "Iniciar"
|
|
1138
1199
|
}
|
|
1139
1200
|
),
|
|
1140
|
-
/* @__PURE__ */
|
|
1141
|
-
] }) : /* @__PURE__ */
|
|
1201
|
+
/* @__PURE__ */ jsx26("span", { className: "timer-display-time", children: formatDuration(tempo) })
|
|
1202
|
+
] }) : /* @__PURE__ */ jsx26("span", { className: "timer-display-message", children: emptyMessage }) }) });
|
|
1142
1203
|
};
|
|
1143
1204
|
|
|
1144
1205
|
// src/displays/RecursoDisplayer.tsx
|
|
1145
|
-
import {
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
import { useState as useState12 } from "react";
|
|
1150
|
-
import { GrCheckmark as GrCheckmark2 } from "react-icons/gr";
|
|
1206
|
+
import {
|
|
1207
|
+
RecursoDisplayer,
|
|
1208
|
+
RecursoDisplayer as RecursoDisplayer2
|
|
1209
|
+
} from "@teraprox/ui-kit-sgm";
|
|
1151
1210
|
|
|
1152
|
-
// src/
|
|
1153
|
-
import {
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
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
|
|
1211
|
+
// src/filters/StatusPills.tsx
|
|
1212
|
+
import { jsx as jsx27, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
1213
|
+
var StatusPills = ({
|
|
1214
|
+
statuses,
|
|
1215
|
+
activeKeys,
|
|
1216
|
+
onSelectionChange,
|
|
1217
|
+
multiSelect = true,
|
|
1218
|
+
className = ""
|
|
1189
1219
|
}) => {
|
|
1190
|
-
const
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
const win = window;
|
|
1198
|
-
if (!win.__AUTO_COMPLETE_CACHE__) {
|
|
1199
|
-
win.__AUTO_COMPLETE_CACHE__ = /* @__PURE__ */ new Map();
|
|
1200
|
-
}
|
|
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])));
|
|
1206
|
-
};
|
|
1207
|
-
useEffect4(() => {
|
|
1208
|
-
setInput(value || "");
|
|
1209
|
-
}, [value]);
|
|
1210
|
-
useEffect4(() => {
|
|
1211
|
-
const sortedOptions = sortOptions(ops, sortKey);
|
|
1212
|
-
setListItem(sortedOptions);
|
|
1213
|
-
setOptions(sortedOptions);
|
|
1214
|
-
}, [ops, sortKey]);
|
|
1215
|
-
useEffect4(() => {
|
|
1216
|
-
const loadData = async () => {
|
|
1217
|
-
if (!(loadCondition && loadFunc)) return;
|
|
1218
|
-
if (lazyLoad && minChars > 0 && !showListOnFocus && (!value || String(value).length < minChars)) {
|
|
1219
|
-
return;
|
|
1220
|
-
}
|
|
1221
|
-
const key = cacheKey ? `${cacheKey}${filter ? `:${filterField}:${filter}` : ""}` : null;
|
|
1222
|
-
if (key && cacheStore.has(key)) {
|
|
1223
|
-
const cacheEntry = cacheStore.get(key);
|
|
1224
|
-
const data = cacheEntry.promise ? await cacheEntry.promise : cacheEntry.data || cacheEntry;
|
|
1225
|
-
setListItem(data);
|
|
1226
|
-
setOptions(data);
|
|
1227
|
-
triggerOnLoad(data);
|
|
1228
|
-
return;
|
|
1229
|
-
}
|
|
1230
|
-
setLoading(true);
|
|
1231
|
-
try {
|
|
1232
|
-
const requestPromise = loadFunc().then((res) => {
|
|
1233
|
-
let newOps = (res == null ? void 0 : res.content) || res;
|
|
1234
|
-
newOps = Array.isArray(newOps) ? newOps.filter((op) => op != null) : [];
|
|
1235
|
-
if (filter && filterField) {
|
|
1236
|
-
newOps = newOps.filter((op) => op[filterField] === filter);
|
|
1237
|
-
}
|
|
1238
|
-
return sortOptions(newOps, sortKey);
|
|
1239
|
-
});
|
|
1240
|
-
if (key) cacheStore.set(key, { promise: requestPromise });
|
|
1241
|
-
const sortedOptions = await requestPromise;
|
|
1242
|
-
setListItem(sortedOptions);
|
|
1243
|
-
setOptions(sortedOptions);
|
|
1244
|
-
if (key) cacheStore.set(key, { data: sortedOptions });
|
|
1245
|
-
triggerOnLoad(sortedOptions);
|
|
1246
|
-
} catch (error) {
|
|
1247
|
-
if (key) cacheStore.delete(key);
|
|
1248
|
-
setListItem([]);
|
|
1249
|
-
} finally {
|
|
1250
|
-
setLoading(false);
|
|
1220
|
+
const toggleKey = (key) => {
|
|
1221
|
+
const isActive = activeKeys.includes(key);
|
|
1222
|
+
if (multiSelect) {
|
|
1223
|
+
if (isActive) {
|
|
1224
|
+
onSelectionChange(activeKeys.filter((k) => k !== key));
|
|
1225
|
+
} else {
|
|
1226
|
+
onSelectionChange([...activeKeys, key]);
|
|
1251
1227
|
}
|
|
1252
|
-
};
|
|
1253
|
-
loadData();
|
|
1254
|
-
}, [loadCondition, filter, filterField, sortKey, cacheKey, lazyLoad, minChars, showListOnFocus]);
|
|
1255
|
-
const triggerOnLoad = (data) => {
|
|
1256
|
-
if (onLoad && !onLoaded) {
|
|
1257
|
-
setOnLoaded(true);
|
|
1258
|
-
onLoad(data);
|
|
1259
|
-
}
|
|
1260
|
-
};
|
|
1261
|
-
const keysJoinner = (li) => {
|
|
1262
|
-
if (!displayKeys || !Array.isArray(displayKeys)) return "";
|
|
1263
|
-
return displayKeys.map((key) => `${li[key]} `).join("").trim();
|
|
1264
|
-
};
|
|
1265
|
-
const getDisplayText = (item) => {
|
|
1266
|
-
if (formatationFunc) return formatationFunc(item);
|
|
1267
|
-
if (displayKey) return item[displayKey];
|
|
1268
|
-
if (displayKeys) return keysJoinner(item);
|
|
1269
|
-
return String(item);
|
|
1270
|
-
};
|
|
1271
|
-
const onFieldUpdate = (val) => {
|
|
1272
|
-
const search = val.toLowerCase();
|
|
1273
|
-
const canSearch = search.length >= minChars;
|
|
1274
|
-
if (canSearch && Array.isArray(options)) {
|
|
1275
|
-
const filtered = options.filter((item) => {
|
|
1276
|
-
const text = getDisplayText(item);
|
|
1277
|
-
return String(text).toLowerCase().includes(search);
|
|
1278
|
-
});
|
|
1279
|
-
setListItem(filtered);
|
|
1280
1228
|
} else {
|
|
1281
|
-
|
|
1229
|
+
onSelectionChange(isActive ? [] : [key]);
|
|
1282
1230
|
}
|
|
1283
|
-
onValueChanged == null ? void 0 : onValueChanged(val);
|
|
1284
|
-
setInput(val);
|
|
1285
|
-
setHide(!canSearch && options.length === 0);
|
|
1286
1231
|
};
|
|
1287
|
-
return /* @__PURE__ */
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
}
|
|
1303
|
-
if (e.key === "Enter" && onEnterKeyDown) {
|
|
1304
|
-
onEnterKeyDown(input);
|
|
1305
|
-
}
|
|
1232
|
+
return /* @__PURE__ */ jsx27("div", { className: `status-pills-container ${className}`, children: Object.entries(statuses).map(([key, meta]) => {
|
|
1233
|
+
const isActive = activeKeys.includes(key);
|
|
1234
|
+
return /* @__PURE__ */ jsxs19(
|
|
1235
|
+
"button",
|
|
1236
|
+
{
|
|
1237
|
+
type: "button",
|
|
1238
|
+
className: `status-pill ${isActive ? "active" : ""}`,
|
|
1239
|
+
style: { "--status-color": meta.color },
|
|
1240
|
+
onClick: () => toggleKey(key),
|
|
1241
|
+
"aria-pressed": isActive,
|
|
1242
|
+
children: [
|
|
1243
|
+
/* @__PURE__ */ jsx27("span", { className: "status-pill__swatch" }),
|
|
1244
|
+
/* @__PURE__ */ jsx27("span", { className: "status-pill__label", children: meta.label }),
|
|
1245
|
+
meta.count !== void 0 && /* @__PURE__ */ jsx27("span", { className: "status-pill__count", children: meta.count })
|
|
1246
|
+
]
|
|
1306
1247
|
},
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1248
|
+
key
|
|
1249
|
+
);
|
|
1250
|
+
}) });
|
|
1251
|
+
};
|
|
1252
|
+
|
|
1253
|
+
// src/filters/PeriodSelector.tsx
|
|
1254
|
+
import { useState as useState9 } from "react";
|
|
1255
|
+
import { Card as Card2, Form as Form5, Button as Button10 } from "react-bootstrap";
|
|
1256
|
+
import { FaCalendarAlt, FaChevronUp, FaHistory } from "react-icons/fa";
|
|
1257
|
+
import dayjs3 from "dayjs";
|
|
1258
|
+
import { Fragment as Fragment7, jsx as jsx28, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
1259
|
+
var PeriodSelector = ({
|
|
1260
|
+
startDate,
|
|
1261
|
+
endDate,
|
|
1262
|
+
onStartDateChange,
|
|
1263
|
+
onEndDateChange,
|
|
1264
|
+
onPresetSelect,
|
|
1265
|
+
label = "Per\xEDodo",
|
|
1266
|
+
allowFuture = false,
|
|
1267
|
+
className = ""
|
|
1268
|
+
}) => {
|
|
1269
|
+
const [isExpanded, setIsExpanded] = useState9(false);
|
|
1270
|
+
const formatDisplayRange = (start, end) => {
|
|
1271
|
+
const s = dayjs3(start).format("DD/MM/YY HH:mm");
|
|
1272
|
+
const e = dayjs3(end).format("DD/MM/YY HH:mm");
|
|
1273
|
+
return `${s} at\xE9 ${e}`;
|
|
1274
|
+
};
|
|
1275
|
+
const maxDate = allowFuture ? void 0 : dayjs3().format("YYYY-MM-DDTHH:mm");
|
|
1276
|
+
const presets = [
|
|
1277
|
+
{ key: "today", label: "Hoje" },
|
|
1278
|
+
{ key: "week", label: "\xDAltima Semana" },
|
|
1279
|
+
{ key: "fortnight", label: "Quinzena" },
|
|
1280
|
+
{ key: "month", label: "\xDAltimo M\xEAs" },
|
|
1281
|
+
{ key: "year", label: "\xDAltimo Ano" }
|
|
1282
|
+
];
|
|
1283
|
+
return /* @__PURE__ */ jsxs20(Card2, { className: `period-selector-card ${isExpanded ? "expanded" : ""} ${className}`, children: [
|
|
1284
|
+
/* @__PURE__ */ jsxs20("div", { className: "compact-row", onClick: () => setIsExpanded(!isExpanded), children: [
|
|
1285
|
+
/* @__PURE__ */ jsxs20("div", { className: "d-flex align-items-center", children: [
|
|
1286
|
+
/* @__PURE__ */ jsx28(FaCalendarAlt, { className: "me-2 text-primary" }),
|
|
1287
|
+
/* @__PURE__ */ jsx28("span", { className: "date-range-text", children: isExpanded ? label : formatDisplayRange(startDate, endDate) })
|
|
1288
|
+
] }),
|
|
1289
|
+
/* @__PURE__ */ jsx28("div", { className: "period-icon-btn", children: isExpanded ? /* @__PURE__ */ jsx28(FaChevronUp, {}) : /* @__PURE__ */ jsx28("span", { className: "small text-muted", children: "Editar" }) })
|
|
1290
|
+
] }),
|
|
1291
|
+
isExpanded && /* @__PURE__ */ jsxs20("div", { className: "expanded-content", children: [
|
|
1292
|
+
onPresetSelect && /* @__PURE__ */ jsxs20(Fragment7, { children: [
|
|
1293
|
+
/* @__PURE__ */ jsxs20("div", { className: "d-flex align-items-center mb-2", children: [
|
|
1294
|
+
/* @__PURE__ */ jsx28(FaHistory, { size: 12, className: "me-1 text-muted" }),
|
|
1295
|
+
/* @__PURE__ */ jsx28("small", { className: "text-muted fw-bold text-uppercase", style: { fontSize: "0.65rem" }, children: "Atalhos" })
|
|
1296
|
+
] }),
|
|
1297
|
+
/* @__PURE__ */ jsx28("div", { className: "presets-container", children: presets.map((p) => /* @__PURE__ */ jsx28(
|
|
1298
|
+
Button10,
|
|
1299
|
+
{
|
|
1300
|
+
variant: "outline-primary",
|
|
1301
|
+
className: "preset-btn",
|
|
1302
|
+
onClick: (e) => {
|
|
1303
|
+
e.stopPropagation();
|
|
1304
|
+
onPresetSelect(p.key);
|
|
1305
|
+
setIsExpanded(false);
|
|
1306
|
+
},
|
|
1307
|
+
children: p.label
|
|
1308
|
+
},
|
|
1309
|
+
p.key
|
|
1310
|
+
)) })
|
|
1311
|
+
] }),
|
|
1312
|
+
/* @__PURE__ */ jsxs20("div", { className: "date-inputs-grid", children: [
|
|
1313
|
+
/* @__PURE__ */ jsxs20(Form5.Group, { children: [
|
|
1314
|
+
/* @__PURE__ */ jsx28(Form5.Label, { className: "small text-muted", children: "In\xEDcio" }),
|
|
1315
|
+
/* @__PURE__ */ jsx28(
|
|
1311
1316
|
Form5.Control,
|
|
1312
1317
|
{
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
onClickCapture: () => {
|
|
1319
|
-
const canOpen = showListOnFocus && input.length >= minChars;
|
|
1320
|
-
setHide(!canOpen);
|
|
1321
|
-
},
|
|
1322
|
-
onChange: (e) => onFieldUpdate(e.currentTarget.value),
|
|
1323
|
-
type: "text"
|
|
1318
|
+
type: "datetime-local",
|
|
1319
|
+
size: "sm",
|
|
1320
|
+
value: startDate,
|
|
1321
|
+
max: maxDate,
|
|
1322
|
+
onChange: (e) => onStartDateChange(e.target.value)
|
|
1324
1323
|
}
|
|
1325
|
-
)
|
|
1326
|
-
loading && /* @__PURE__ */ jsx26(InputGroup2.Text, { children: /* @__PURE__ */ jsx26(Spinner4, { animation: "border", size: "sm" }) }),
|
|
1327
|
-
!disableComponent && (actionButton == null ? void 0 : actionButton(() => setInput(""))),
|
|
1328
|
-
!disableComponent && (actionButton2 == null ? void 0 : actionButton2(input))
|
|
1324
|
+
)
|
|
1329
1325
|
] }),
|
|
1330
|
-
/* @__PURE__ */
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
},
|
|
1357
|
-
index
|
|
1358
|
-
))
|
|
1359
|
-
}
|
|
1360
|
-
)
|
|
1361
|
-
]
|
|
1362
|
-
}
|
|
1363
|
-
);
|
|
1326
|
+
/* @__PURE__ */ jsxs20(Form5.Group, { children: [
|
|
1327
|
+
/* @__PURE__ */ jsx28(Form5.Label, { className: "small text-muted", children: "Fim" }),
|
|
1328
|
+
/* @__PURE__ */ jsx28(
|
|
1329
|
+
Form5.Control,
|
|
1330
|
+
{
|
|
1331
|
+
type: "datetime-local",
|
|
1332
|
+
size: "sm",
|
|
1333
|
+
value: endDate,
|
|
1334
|
+
min: startDate,
|
|
1335
|
+
max: maxDate,
|
|
1336
|
+
onChange: (e) => onEndDateChange(e.target.value)
|
|
1337
|
+
}
|
|
1338
|
+
)
|
|
1339
|
+
] })
|
|
1340
|
+
] }),
|
|
1341
|
+
/* @__PURE__ */ jsx28("div", { className: "mt-3 d-flex justify-content-end", children: /* @__PURE__ */ jsx28(
|
|
1342
|
+
Button10,
|
|
1343
|
+
{
|
|
1344
|
+
variant: "primary",
|
|
1345
|
+
size: "sm",
|
|
1346
|
+
onClick: () => setIsExpanded(false),
|
|
1347
|
+
children: "Aplicar"
|
|
1348
|
+
}
|
|
1349
|
+
) })
|
|
1350
|
+
] })
|
|
1351
|
+
] });
|
|
1364
1352
|
};
|
|
1365
1353
|
|
|
1366
|
-
// src/
|
|
1367
|
-
import { useState as
|
|
1368
|
-
import {
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
const [
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
callback(result.data);
|
|
1383
|
-
};
|
|
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(
|
|
1354
|
+
// src/filters/AdvancedFilterBar.tsx
|
|
1355
|
+
import { useState as useState10 } from "react";
|
|
1356
|
+
import { Collapse, Button as Button11 } from "react-bootstrap";
|
|
1357
|
+
import { FiFilter, FiChevronDown, FiChevronUp, FiTrash2 as FiTrash22 } from "react-icons/fi";
|
|
1358
|
+
import { jsx as jsx29, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
1359
|
+
var AdvancedFilterBar = ({
|
|
1360
|
+
children,
|
|
1361
|
+
title = "Filtros e Busca",
|
|
1362
|
+
activeFiltersCount = 0,
|
|
1363
|
+
onClearAll,
|
|
1364
|
+
defaultExpanded = false,
|
|
1365
|
+
className = ""
|
|
1366
|
+
}) => {
|
|
1367
|
+
const [expanded, setExpanded] = useState10(defaultExpanded);
|
|
1368
|
+
return /* @__PURE__ */ jsxs21("div", { className: `advanced-filter-bar ${className}`, children: [
|
|
1369
|
+
/* @__PURE__ */ jsxs21(
|
|
1422
1370
|
"div",
|
|
1423
1371
|
{
|
|
1424
|
-
|
|
1425
|
-
|
|
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
|
-
},
|
|
1372
|
+
className: "filter-bar-header",
|
|
1373
|
+
onClick: () => setExpanded(!expanded),
|
|
1435
1374
|
children: [
|
|
1436
|
-
"
|
|
1437
|
-
|
|
1375
|
+
/* @__PURE__ */ jsxs21("div", { className: "filter-title-group", children: [
|
|
1376
|
+
/* @__PURE__ */ jsx29(FiFilter, { className: "text-primary" }),
|
|
1377
|
+
/* @__PURE__ */ jsx29("h5", { className: "filter-title", children: title }),
|
|
1378
|
+
activeFiltersCount > 0 && /* @__PURE__ */ jsxs21("span", { className: "filter-count-badge", children: [
|
|
1379
|
+
activeFiltersCount,
|
|
1380
|
+
" ativos"
|
|
1381
|
+
] })
|
|
1382
|
+
] }),
|
|
1383
|
+
/* @__PURE__ */ jsx29("div", { className: "filter-chevron", children: expanded ? /* @__PURE__ */ jsx29(FiChevronUp, { size: 20 }) : /* @__PURE__ */ jsx29(FiChevronDown, { size: 20 }) })
|
|
1438
1384
|
]
|
|
1439
1385
|
}
|
|
1440
|
-
)
|
|
1441
|
-
|
|
1442
|
-
}
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
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",
|
|
1386
|
+
),
|
|
1387
|
+
/* @__PURE__ */ jsx29(Collapse, { in: expanded, children: /* @__PURE__ */ jsx29("div", { children: /* @__PURE__ */ jsxs21("div", { className: "filter-bar-content", children: [
|
|
1388
|
+
/* @__PURE__ */ jsx29("div", { className: "filter-grid", children }),
|
|
1389
|
+
(onClearAll || activeFiltersCount > 0) && /* @__PURE__ */ jsxs21("div", { className: "filter-actions", children: [
|
|
1390
|
+
onClearAll && /* @__PURE__ */ jsxs21(
|
|
1391
|
+
Button11,
|
|
1472
1392
|
{
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
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"
|
|
1393
|
+
variant: "link",
|
|
1394
|
+
className: "text-danger text-decoration-none btn-sm d-flex align-items-center",
|
|
1395
|
+
onClick: (e) => {
|
|
1396
|
+
e.stopPropagation();
|
|
1397
|
+
onClearAll();
|
|
1486
1398
|
},
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
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
|
-
] })
|
|
1399
|
+
children: [
|
|
1400
|
+
/* @__PURE__ */ jsx29(FiTrash22, { className: "me-1" }),
|
|
1401
|
+
"Limpar Filtros"
|
|
1402
|
+
]
|
|
1509
1403
|
}
|
|
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,
|
|
1404
|
+
),
|
|
1405
|
+
/* @__PURE__ */ jsx29(
|
|
1406
|
+
Button11,
|
|
1566
1407
|
{
|
|
1567
|
-
|
|
1568
|
-
|
|
1408
|
+
variant: "primary",
|
|
1409
|
+
size: "sm",
|
|
1410
|
+
onClick: () => setExpanded(false),
|
|
1411
|
+
children: "Aplicar Filtros"
|
|
1569
1412
|
}
|
|
1570
1413
|
)
|
|
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
|
-
) });
|
|
1414
|
+
] })
|
|
1415
|
+
] }) }) })
|
|
1416
|
+
] });
|
|
1599
1417
|
};
|
|
1600
1418
|
|
|
1601
|
-
// src/
|
|
1602
|
-
import {
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1419
|
+
// src/filters/UnifiedPeriodSelector.tsx
|
|
1420
|
+
import { useCallback, useEffect as useEffect4, useMemo as useMemo2, useState as useState11 } from "react";
|
|
1421
|
+
import { Button as Button12, Card as Card3, Col as Col3, Form as Form6, Row as Row3 } from "react-bootstrap";
|
|
1422
|
+
import {
|
|
1423
|
+
FaCalendarAlt as FaCalendarAlt2,
|
|
1424
|
+
FaChevronLeft,
|
|
1425
|
+
FaChevronRight,
|
|
1426
|
+
FaClock,
|
|
1427
|
+
FaTimesCircle
|
|
1428
|
+
} from "react-icons/fa";
|
|
1429
|
+
import dayjs4 from "dayjs";
|
|
1430
|
+
import isoWeek from "dayjs/plugin/isoWeek";
|
|
1431
|
+
import { Fragment as Fragment8, jsx as jsx30, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
1432
|
+
dayjs4.extend(isoWeek);
|
|
1433
|
+
var MONTHS = [
|
|
1434
|
+
"Jan",
|
|
1435
|
+
"Fev",
|
|
1436
|
+
"Mar",
|
|
1437
|
+
"Abr",
|
|
1438
|
+
"Mai",
|
|
1439
|
+
"Jun",
|
|
1440
|
+
"Jul",
|
|
1441
|
+
"Ago",
|
|
1442
|
+
"Set",
|
|
1443
|
+
"Out",
|
|
1444
|
+
"Nov",
|
|
1445
|
+
"Dez"
|
|
1446
|
+
];
|
|
1447
|
+
var MONTHS_FULL = [
|
|
1448
|
+
"Janeiro",
|
|
1449
|
+
"Fevereiro",
|
|
1450
|
+
"Mar\xE7o",
|
|
1451
|
+
"Abril",
|
|
1452
|
+
"Maio",
|
|
1453
|
+
"Junho",
|
|
1454
|
+
"Julho",
|
|
1455
|
+
"Agosto",
|
|
1456
|
+
"Setembro",
|
|
1457
|
+
"Outubro",
|
|
1458
|
+
"Novembro",
|
|
1459
|
+
"Dezembro"
|
|
1460
|
+
];
|
|
1461
|
+
var pad2 = (n) => String(n).padStart(2, "0");
|
|
1462
|
+
var startOfMonthISO = (year, m) => `${year}-${pad2(m + 1)}-01T00:00:00`;
|
|
1463
|
+
var endOfMonthISO = (year, m) => {
|
|
1464
|
+
const lastDay = new Date(year, m + 1, 0).getDate();
|
|
1465
|
+
return `${year}-${pad2(m + 1)}-${pad2(lastDay)}T23:59:59`;
|
|
1466
|
+
};
|
|
1467
|
+
var parseDate = (v) => {
|
|
1468
|
+
if (!v) return null;
|
|
1469
|
+
const d = new Date(v);
|
|
1470
|
+
return isNaN(d.getTime()) ? null : d;
|
|
1471
|
+
};
|
|
1472
|
+
var DEFAULT_PRESETS = [
|
|
1473
|
+
{
|
|
1474
|
+
key: "today",
|
|
1475
|
+
label: "Hoje",
|
|
1476
|
+
start: () => dayjs4().startOf("day"),
|
|
1477
|
+
end: () => dayjs4().endOf("day")
|
|
1478
|
+
},
|
|
1479
|
+
{
|
|
1480
|
+
key: "week",
|
|
1481
|
+
label: "Esta semana",
|
|
1482
|
+
start: () => dayjs4().startOf("isoWeek"),
|
|
1483
|
+
end: () => dayjs4().endOf("isoWeek")
|
|
1484
|
+
},
|
|
1485
|
+
{
|
|
1486
|
+
key: "month",
|
|
1487
|
+
label: "Este m\xEAs",
|
|
1488
|
+
start: () => dayjs4().startOf("month"),
|
|
1489
|
+
end: () => dayjs4().endOf("month")
|
|
1490
|
+
},
|
|
1491
|
+
{
|
|
1492
|
+
key: "year",
|
|
1493
|
+
label: "Este ano",
|
|
1494
|
+
start: () => dayjs4().startOf("year"),
|
|
1495
|
+
end: () => dayjs4().endOf("year")
|
|
1496
|
+
}
|
|
1497
|
+
];
|
|
1498
|
+
var TABS = [
|
|
1499
|
+
{ key: "quick", icon: /* @__PURE__ */ jsx30(FaClock, { size: 12 }), label: "R\xE1pido" },
|
|
1500
|
+
{ key: "month", icon: /* @__PURE__ */ jsx30(FaCalendarAlt2, { size: 12 }), label: "Meses" },
|
|
1501
|
+
{ key: "custom", icon: /* @__PURE__ */ jsx30(FaCalendarAlt2, { size: 12 }), label: "Per\xEDodo" }
|
|
1502
|
+
];
|
|
1503
|
+
var UnifiedPeriodSelector = ({
|
|
1504
|
+
dataInicio,
|
|
1505
|
+
dataFim,
|
|
1506
|
+
onSelect,
|
|
1507
|
+
defaultTab = "quick",
|
|
1508
|
+
allowFuture = true,
|
|
1509
|
+
quickPresets,
|
|
1510
|
+
className = "",
|
|
1511
|
+
disabled = false,
|
|
1512
|
+
compact = false
|
|
1609
1513
|
}) => {
|
|
1610
|
-
const [
|
|
1611
|
-
const [
|
|
1612
|
-
const [
|
|
1613
|
-
const [
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1514
|
+
const [activeTab, setActiveTab] = useState11(defaultTab);
|
|
1515
|
+
const [isExpanded, setIsExpanded] = useState11(!compact);
|
|
1516
|
+
const [activePresetKey, setActivePresetKey] = useState11(null);
|
|
1517
|
+
const [selectedYear, setSelectedYear] = useState11(() => {
|
|
1518
|
+
const d = parseDate(dataInicio);
|
|
1519
|
+
return d ? d.getFullYear() : (/* @__PURE__ */ new Date()).getFullYear();
|
|
1520
|
+
});
|
|
1521
|
+
const [selectedMonths, setSelectedMonths] = useState11(/* @__PURE__ */ new Set());
|
|
1522
|
+
const [lastClickedMonth, setLastClickedMonth] = useState11(null);
|
|
1523
|
+
const [customStart, setCustomStart] = useState11("");
|
|
1524
|
+
const [customEnd, setCustomEnd] = useState11("");
|
|
1525
|
+
const presets = quickPresets || DEFAULT_PRESETS;
|
|
1526
|
+
useEffect4(() => {
|
|
1527
|
+
const start = parseDate(dataInicio);
|
|
1528
|
+
const end = parseDate(dataFim);
|
|
1529
|
+
if (!start || !end) return;
|
|
1530
|
+
if (start.getFullYear() === selectedYear || end.getFullYear() === selectedYear) {
|
|
1531
|
+
const next = /* @__PURE__ */ new Set();
|
|
1532
|
+
if (start.getFullYear() === end.getFullYear() && start.getFullYear() === selectedYear) {
|
|
1533
|
+
for (let m = start.getMonth(); m <= end.getMonth(); m++) next.add(m);
|
|
1534
|
+
} else {
|
|
1535
|
+
const s = start.getFullYear() === selectedYear ? start.getMonth() : 0;
|
|
1536
|
+
const e = end.getFullYear() === selectedYear ? end.getMonth() : 11;
|
|
1537
|
+
for (let m = s; m <= e; m++) next.add(m);
|
|
1630
1538
|
}
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1539
|
+
setSelectedMonths(next);
|
|
1540
|
+
}
|
|
1541
|
+
}, [dataInicio, dataFim, selectedYear]);
|
|
1542
|
+
useEffect4(() => {
|
|
1543
|
+
if (dataInicio) setCustomStart(dayjs4(dataInicio).format("YYYY-MM-DDTHH:mm"));
|
|
1544
|
+
if (dataFim) setCustomEnd(dayjs4(dataFim).format("YYYY-MM-DDTHH:mm"));
|
|
1545
|
+
}, [dataInicio, dataFim]);
|
|
1546
|
+
const displayLabel = useMemo2(() => {
|
|
1547
|
+
const s = parseDate(dataInicio);
|
|
1548
|
+
const e = parseDate(dataFim);
|
|
1549
|
+
if (!s || !e) return "Selecione um per\xEDodo";
|
|
1550
|
+
if (activePresetKey) {
|
|
1551
|
+
const p = presets.find((pr) => pr.key === activePresetKey);
|
|
1552
|
+
if (p) return p.label;
|
|
1553
|
+
}
|
|
1554
|
+
if (s.getFullYear() === e.getFullYear() && s.getMonth() === e.getMonth() && s.getDate() === 1) {
|
|
1555
|
+
return `${MONTHS_FULL[s.getMonth()]} ${s.getFullYear()}`;
|
|
1556
|
+
}
|
|
1557
|
+
return `${dayjs4(s).format("DD/MM/YYYY")} \u2013 ${dayjs4(e).format("DD/MM/YYYY")}`;
|
|
1558
|
+
}, [dataInicio, dataFim, activePresetKey, presets]);
|
|
1559
|
+
const handlePreset = useCallback(
|
|
1560
|
+
(preset) => {
|
|
1561
|
+
if (disabled) return;
|
|
1562
|
+
setActivePresetKey(preset.key);
|
|
1563
|
+
onSelect({
|
|
1564
|
+
dataInicio: preset.start().toISOString(),
|
|
1565
|
+
dataFim: preset.end().toISOString()
|
|
1566
|
+
});
|
|
1567
|
+
},
|
|
1568
|
+
[disabled, onSelect]
|
|
1569
|
+
);
|
|
1570
|
+
const handleMonthClick = useCallback(
|
|
1571
|
+
(index, event) => {
|
|
1572
|
+
if (disabled) return;
|
|
1573
|
+
const ctrl = event.ctrlKey || event.metaKey;
|
|
1574
|
+
const shift = event.shiftKey;
|
|
1575
|
+
setSelectedMonths((prev) => {
|
|
1576
|
+
let next;
|
|
1577
|
+
if (shift && lastClickedMonth !== null) {
|
|
1578
|
+
next = /* @__PURE__ */ new Set();
|
|
1579
|
+
const start = Math.min(index, lastClickedMonth);
|
|
1580
|
+
const end = Math.max(index, lastClickedMonth);
|
|
1581
|
+
for (let m = start; m <= end; m++) next.add(m);
|
|
1582
|
+
} else if (ctrl) {
|
|
1583
|
+
next = new Set(prev);
|
|
1584
|
+
if (next.has(index)) next.delete(index);
|
|
1585
|
+
else next.add(index);
|
|
1586
|
+
} else {
|
|
1587
|
+
next = /* @__PURE__ */ new Set([index]);
|
|
1657
1588
|
}
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1589
|
+
if (next.size === 0) {
|
|
1590
|
+
onSelect({ dataInicio: "", dataFim: "" });
|
|
1591
|
+
} else {
|
|
1592
|
+
const arr = Array.from(next).sort((a, b) => a - b);
|
|
1593
|
+
const first = arr[0];
|
|
1594
|
+
const last = arr[arr.length - 1];
|
|
1595
|
+
onSelect({
|
|
1596
|
+
dataInicio: startOfMonthISO(selectedYear, first),
|
|
1597
|
+
dataFim: endOfMonthISO(selectedYear, last)
|
|
1598
|
+
});
|
|
1668
1599
|
}
|
|
1600
|
+
setActivePresetKey(null);
|
|
1601
|
+
return next;
|
|
1602
|
+
});
|
|
1603
|
+
setLastClickedMonth(index);
|
|
1604
|
+
},
|
|
1605
|
+
[disabled, lastClickedMonth, onSelect, selectedYear]
|
|
1606
|
+
);
|
|
1607
|
+
const handleYearChange = useCallback(
|
|
1608
|
+
(delta) => {
|
|
1609
|
+
const newYear = selectedYear + delta;
|
|
1610
|
+
setSelectedYear(newYear);
|
|
1611
|
+
if (selectedMonths.size > 0) {
|
|
1612
|
+
const arr = Array.from(selectedMonths).sort((a, b) => a - b);
|
|
1613
|
+
onSelect({
|
|
1614
|
+
dataInicio: startOfMonthISO(newYear, arr[0]),
|
|
1615
|
+
dataFim: endOfMonthISO(newYear, arr[arr.length - 1])
|
|
1616
|
+
});
|
|
1617
|
+
setActivePresetKey(null);
|
|
1669
1618
|
}
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
}
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
if (isActive) {
|
|
1687
|
-
onSelectionChange(activeKeys.filter((k) => k !== key));
|
|
1688
|
-
} else {
|
|
1689
|
-
onSelectionChange([...activeKeys, key]);
|
|
1619
|
+
},
|
|
1620
|
+
[selectedYear, selectedMonths, onSelect]
|
|
1621
|
+
);
|
|
1622
|
+
const quickMonthOptions = useMemo2(() => {
|
|
1623
|
+
const now = /* @__PURE__ */ new Date();
|
|
1624
|
+
const opts = [];
|
|
1625
|
+
for (let yearOffset = 0; yearOffset <= 1; yearOffset++) {
|
|
1626
|
+
const year = now.getFullYear() - yearOffset;
|
|
1627
|
+
const lastMonth = yearOffset === 0 ? now.getMonth() : 11;
|
|
1628
|
+
for (let m = lastMonth; m >= 0; m--) {
|
|
1629
|
+
opts.push({
|
|
1630
|
+
value: `${year}-${pad2(m + 1)}`,
|
|
1631
|
+
label: `${MONTHS_FULL[m]} ${year}`,
|
|
1632
|
+
year,
|
|
1633
|
+
month: m
|
|
1634
|
+
});
|
|
1690
1635
|
}
|
|
1691
|
-
} else {
|
|
1692
|
-
onSelectionChange(isActive ? [] : [key]);
|
|
1693
1636
|
}
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1637
|
+
return opts;
|
|
1638
|
+
}, []);
|
|
1639
|
+
const quickMonthValue = useMemo2(() => {
|
|
1640
|
+
const s = parseDate(dataInicio);
|
|
1641
|
+
const e = parseDate(dataFim);
|
|
1642
|
+
if (!s || !e) return "";
|
|
1643
|
+
if (s.getFullYear() === e.getFullYear() && s.getMonth() === e.getMonth() && s.getDate() === 1) {
|
|
1644
|
+
return `${s.getFullYear()}-${pad2(s.getMonth() + 1)}`;
|
|
1645
|
+
}
|
|
1646
|
+
return "";
|
|
1647
|
+
}, [dataInicio, dataFim]);
|
|
1648
|
+
const handleQuickMonthChange = useCallback(
|
|
1649
|
+
(value) => {
|
|
1650
|
+
if (disabled || !value) return;
|
|
1651
|
+
const opt = quickMonthOptions.find((o) => o.value === value);
|
|
1652
|
+
if (!opt) return;
|
|
1653
|
+
setActivePresetKey(null);
|
|
1654
|
+
setSelectedYear(opt.year);
|
|
1655
|
+
setSelectedMonths(/* @__PURE__ */ new Set([opt.month]));
|
|
1656
|
+
onSelect({
|
|
1657
|
+
dataInicio: startOfMonthISO(opt.year, opt.month),
|
|
1658
|
+
dataFim: endOfMonthISO(opt.year, opt.month)
|
|
1659
|
+
});
|
|
1660
|
+
},
|
|
1661
|
+
[disabled, onSelect, quickMonthOptions]
|
|
1662
|
+
);
|
|
1663
|
+
const handleCustomApply = useCallback(() => {
|
|
1664
|
+
if (!customStart || !customEnd) return;
|
|
1665
|
+
setActivePresetKey(null);
|
|
1666
|
+
onSelect({
|
|
1667
|
+
dataInicio: dayjs4(customStart).toISOString(),
|
|
1668
|
+
dataFim: dayjs4(customEnd).toISOString()
|
|
1669
|
+
});
|
|
1670
|
+
}, [customStart, customEnd, onSelect]);
|
|
1671
|
+
const handleClear = useCallback(() => {
|
|
1672
|
+
setSelectedMonths(/* @__PURE__ */ new Set());
|
|
1673
|
+
setActivePresetKey(null);
|
|
1674
|
+
setCustomStart("");
|
|
1675
|
+
setCustomEnd("");
|
|
1676
|
+
onSelect({ dataInicio: "", dataFim: "" });
|
|
1677
|
+
}, [onSelect]);
|
|
1678
|
+
const today = /* @__PURE__ */ new Date();
|
|
1679
|
+
const maxDateStr = allowFuture ? void 0 : dayjs4().format("YYYY-MM-DDTHH:mm");
|
|
1680
|
+
if (compact && !isExpanded) {
|
|
1681
|
+
return /* @__PURE__ */ jsx30(
|
|
1682
|
+
Card3,
|
|
1699
1683
|
{
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
"
|
|
1705
|
-
|
|
1706
|
-
/* @__PURE__ */
|
|
1707
|
-
/* @__PURE__ */
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
},
|
|
1711
|
-
key
|
|
1684
|
+
className: `ups-card ups-card--compact ${className}`,
|
|
1685
|
+
onClick: () => !disabled && setIsExpanded(true),
|
|
1686
|
+
role: "button",
|
|
1687
|
+
tabIndex: 0,
|
|
1688
|
+
children: /* @__PURE__ */ jsxs22("div", { className: "ups-compact-row", children: [
|
|
1689
|
+
/* @__PURE__ */ jsx30(FaCalendarAlt2, { className: "text-primary me-2" }),
|
|
1690
|
+
/* @__PURE__ */ jsx30("span", { className: "ups-display-label", children: displayLabel }),
|
|
1691
|
+
/* @__PURE__ */ jsx30("span", { className: "ups-edit-hint text-muted small", children: "Editar" })
|
|
1692
|
+
] })
|
|
1693
|
+
}
|
|
1712
1694
|
);
|
|
1713
|
-
}
|
|
1714
|
-
}
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
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) })
|
|
1695
|
+
}
|
|
1696
|
+
return /* @__PURE__ */ jsx30(Card3, { className: `ups-card ${className}`, children: /* @__PURE__ */ jsxs22(Card3.Body, { className: "ups-body", children: [
|
|
1697
|
+
/* @__PURE__ */ jsxs22("div", { className: "ups-header", children: [
|
|
1698
|
+
/* @__PURE__ */ jsxs22("div", { className: "d-flex align-items-center gap-2 flex-grow-1 min-w-0", children: [
|
|
1699
|
+
/* @__PURE__ */ jsx30(FaCalendarAlt2, { className: "text-primary flex-shrink-0" }),
|
|
1700
|
+
/* @__PURE__ */ jsx30("span", { className: "ups-display-label text-truncate", children: displayLabel })
|
|
1751
1701
|
] }),
|
|
1752
|
-
/* @__PURE__ */
|
|
1702
|
+
/* @__PURE__ */ jsxs22("div", { className: "d-flex align-items-center gap-1", children: [
|
|
1703
|
+
(dataInicio || dataFim) && /* @__PURE__ */ jsx30(
|
|
1704
|
+
Button12,
|
|
1705
|
+
{
|
|
1706
|
+
variant: "link",
|
|
1707
|
+
size: "sm",
|
|
1708
|
+
className: "p-0 text-muted",
|
|
1709
|
+
onClick: handleClear,
|
|
1710
|
+
title: "Limpar per\xEDodo",
|
|
1711
|
+
disabled,
|
|
1712
|
+
children: /* @__PURE__ */ jsx30(FaTimesCircle, { size: 14 })
|
|
1713
|
+
}
|
|
1714
|
+
),
|
|
1715
|
+
compact && /* @__PURE__ */ jsx30(
|
|
1716
|
+
Button12,
|
|
1717
|
+
{
|
|
1718
|
+
variant: "link",
|
|
1719
|
+
size: "sm",
|
|
1720
|
+
className: "p-0 text-muted",
|
|
1721
|
+
onClick: () => setIsExpanded(false),
|
|
1722
|
+
children: "Fechar"
|
|
1723
|
+
}
|
|
1724
|
+
)
|
|
1725
|
+
] })
|
|
1753
1726
|
] }),
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1727
|
+
/* @__PURE__ */ jsx30("div", { className: "ups-tabs", children: TABS.map((tab) => /* @__PURE__ */ jsxs22(
|
|
1728
|
+
"button",
|
|
1729
|
+
{
|
|
1730
|
+
className: `ups-tab ${activeTab === tab.key ? "ups-tab--active" : ""}`,
|
|
1731
|
+
onClick: () => setActiveTab(tab.key),
|
|
1732
|
+
disabled,
|
|
1733
|
+
children: [
|
|
1734
|
+
tab.icon,
|
|
1735
|
+
/* @__PURE__ */ jsx30("span", { children: tab.label })
|
|
1736
|
+
]
|
|
1737
|
+
},
|
|
1738
|
+
tab.key
|
|
1739
|
+
)) }),
|
|
1740
|
+
/* @__PURE__ */ jsxs22("div", { className: "ups-content", children: [
|
|
1741
|
+
activeTab === "quick" && /* @__PURE__ */ jsxs22(Fragment8, { children: [
|
|
1742
|
+
/* @__PURE__ */ jsx30("div", { className: "ups-quick-grid", children: presets.map((p) => /* @__PURE__ */ jsx30(
|
|
1761
1743
|
Button12,
|
|
1762
1744
|
{
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
},
|
|
1745
|
+
size: "sm",
|
|
1746
|
+
variant: activePresetKey === p.key ? "primary" : "outline-secondary",
|
|
1747
|
+
className: "ups-quick-btn",
|
|
1748
|
+
onClick: () => handlePreset(p),
|
|
1749
|
+
disabled,
|
|
1769
1750
|
children: p.label
|
|
1770
1751
|
},
|
|
1771
1752
|
p.key
|
|
1772
|
-
))
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
/* @__PURE__ */ jsx32(
|
|
1778
|
-
Form6.Control,
|
|
1753
|
+
)) }),
|
|
1754
|
+
/* @__PURE__ */ jsxs22("div", { className: "ups-quick-month", children: [
|
|
1755
|
+
/* @__PURE__ */ jsx30(Form6.Label, { className: "small text-muted mb-1", children: "M\xEAs exato" }),
|
|
1756
|
+
/* @__PURE__ */ jsxs22(
|
|
1757
|
+
Form6.Select,
|
|
1779
1758
|
{
|
|
1780
|
-
type: "datetime-local",
|
|
1781
1759
|
size: "sm",
|
|
1782
|
-
value:
|
|
1783
|
-
|
|
1784
|
-
|
|
1760
|
+
value: quickMonthValue,
|
|
1761
|
+
onChange: (e) => handleQuickMonthChange(e.target.value),
|
|
1762
|
+
disabled,
|
|
1763
|
+
"aria-label": "Selecionar m\xEAs exato",
|
|
1764
|
+
children: [
|
|
1765
|
+
/* @__PURE__ */ jsx30("option", { value: "", children: "Escolha um m\xEAs\u2026" }),
|
|
1766
|
+
quickMonthOptions.map((o) => /* @__PURE__ */ jsx30("option", { value: o.value, children: o.label }, o.value))
|
|
1767
|
+
]
|
|
1785
1768
|
}
|
|
1786
1769
|
)
|
|
1787
|
-
] })
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1770
|
+
] })
|
|
1771
|
+
] }),
|
|
1772
|
+
activeTab === "month" && /* @__PURE__ */ jsxs22("div", { className: "ups-month-section", children: [
|
|
1773
|
+
/* @__PURE__ */ jsxs22("div", { className: "ups-year-nav", children: [
|
|
1774
|
+
/* @__PURE__ */ jsx30(
|
|
1775
|
+
Button12,
|
|
1792
1776
|
{
|
|
1793
|
-
|
|
1777
|
+
variant: "outline-secondary",
|
|
1794
1778
|
size: "sm",
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1779
|
+
className: "ups-year-btn",
|
|
1780
|
+
onClick: () => handleYearChange(-1),
|
|
1781
|
+
disabled,
|
|
1782
|
+
children: /* @__PURE__ */ jsx30(FaChevronLeft, { size: 10 })
|
|
1783
|
+
}
|
|
1784
|
+
),
|
|
1785
|
+
/* @__PURE__ */ jsx30("span", { className: "ups-year-label", children: selectedYear }),
|
|
1786
|
+
/* @__PURE__ */ jsx30(
|
|
1787
|
+
Button12,
|
|
1788
|
+
{
|
|
1789
|
+
variant: "outline-secondary",
|
|
1790
|
+
size: "sm",
|
|
1791
|
+
className: "ups-year-btn",
|
|
1792
|
+
onClick: () => handleYearChange(1),
|
|
1793
|
+
disabled,
|
|
1794
|
+
children: /* @__PURE__ */ jsx30(FaChevronRight, { size: 10 })
|
|
1799
1795
|
}
|
|
1800
1796
|
)
|
|
1801
|
-
] })
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
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();
|
|
1797
|
+
] }),
|
|
1798
|
+
/* @__PURE__ */ jsx30("div", { className: "ups-month-grid", children: MONTHS.map((label, idx) => {
|
|
1799
|
+
const isSelected = selectedMonths.has(idx);
|
|
1800
|
+
const isCurrent = today.getFullYear() === selectedYear && today.getMonth() === idx;
|
|
1801
|
+
return /* @__PURE__ */ jsx30(
|
|
1802
|
+
"button",
|
|
1803
|
+
{
|
|
1804
|
+
className: [
|
|
1805
|
+
"ups-month-cell",
|
|
1806
|
+
isSelected && "ups-month-cell--selected",
|
|
1807
|
+
isCurrent && !isSelected && "ups-month-cell--current"
|
|
1808
|
+
].filter(Boolean).join(" "),
|
|
1809
|
+
onClick: (e) => handleMonthClick(idx, e),
|
|
1810
|
+
disabled,
|
|
1811
|
+
title: "Clique: selecionar \xB7 Shift: range \xB7 Ctrl/Cmd: multi",
|
|
1812
|
+
children: label
|
|
1860
1813
|
},
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
/* @__PURE__ */
|
|
1868
|
-
|
|
1814
|
+
idx
|
|
1815
|
+
);
|
|
1816
|
+
}) }),
|
|
1817
|
+
/* @__PURE__ */ jsx30("p", { className: "ups-month-hint text-muted", children: "Shift+clique para range \xB7 Ctrl/Cmd+clique para multi-sele\xE7\xE3o" })
|
|
1818
|
+
] }),
|
|
1819
|
+
activeTab === "custom" && /* @__PURE__ */ jsxs22("div", { className: "ups-custom-section", children: [
|
|
1820
|
+
/* @__PURE__ */ jsxs22(Row3, { className: "g-2", children: [
|
|
1821
|
+
/* @__PURE__ */ jsx30(Col3, { xs: 12, sm: 6, children: /* @__PURE__ */ jsxs22(Form6.Group, { children: [
|
|
1822
|
+
/* @__PURE__ */ jsx30(Form6.Label, { className: "small text-muted mb-1", children: "In\xEDcio" }),
|
|
1823
|
+
/* @__PURE__ */ jsx30(
|
|
1824
|
+
Form6.Control,
|
|
1825
|
+
{
|
|
1826
|
+
type: "datetime-local",
|
|
1827
|
+
size: "sm",
|
|
1828
|
+
value: customStart,
|
|
1829
|
+
max: maxDateStr,
|
|
1830
|
+
onChange: (e) => setCustomStart(e.target.value),
|
|
1831
|
+
disabled
|
|
1832
|
+
}
|
|
1833
|
+
)
|
|
1834
|
+
] }) }),
|
|
1835
|
+
/* @__PURE__ */ jsx30(Col3, { xs: 12, sm: 6, children: /* @__PURE__ */ jsxs22(Form6.Group, { children: [
|
|
1836
|
+
/* @__PURE__ */ jsx30(Form6.Label, { className: "small text-muted mb-1", children: "Fim" }),
|
|
1837
|
+
/* @__PURE__ */ jsx30(
|
|
1838
|
+
Form6.Control,
|
|
1839
|
+
{
|
|
1840
|
+
type: "datetime-local",
|
|
1841
|
+
size: "sm",
|
|
1842
|
+
value: customEnd,
|
|
1843
|
+
min: customStart,
|
|
1844
|
+
max: maxDateStr,
|
|
1845
|
+
onChange: (e) => setCustomEnd(e.target.value),
|
|
1846
|
+
disabled
|
|
1847
|
+
}
|
|
1848
|
+
)
|
|
1849
|
+
] }) })
|
|
1850
|
+
] }),
|
|
1851
|
+
/* @__PURE__ */ jsx30("div", { className: "d-flex justify-content-end mt-2", children: /* @__PURE__ */ jsx30(
|
|
1852
|
+
Button12,
|
|
1869
1853
|
{
|
|
1870
1854
|
variant: "primary",
|
|
1871
1855
|
size: "sm",
|
|
1872
|
-
onClick:
|
|
1873
|
-
|
|
1856
|
+
onClick: handleCustomApply,
|
|
1857
|
+
disabled: disabled || !customStart || !customEnd,
|
|
1858
|
+
children: "Aplicar"
|
|
1874
1859
|
}
|
|
1875
|
-
)
|
|
1860
|
+
) })
|
|
1876
1861
|
] })
|
|
1877
|
-
] })
|
|
1878
|
-
] });
|
|
1862
|
+
] })
|
|
1863
|
+
] }) });
|
|
1879
1864
|
};
|
|
1880
1865
|
|
|
1881
1866
|
// src/forms/MailSender.tsx
|
|
1882
|
-
import { useState as
|
|
1867
|
+
import { useState as useState12 } from "react";
|
|
1883
1868
|
import {
|
|
1884
|
-
Button as
|
|
1885
|
-
Card as
|
|
1886
|
-
Col as
|
|
1869
|
+
Button as Button13,
|
|
1870
|
+
Card as Card4,
|
|
1871
|
+
Col as Col4,
|
|
1887
1872
|
Form as Form7,
|
|
1888
|
-
Row as
|
|
1889
|
-
Spinner as
|
|
1873
|
+
Row as Row4,
|
|
1874
|
+
Spinner as Spinner4,
|
|
1890
1875
|
Badge as Badge2,
|
|
1891
|
-
InputGroup as
|
|
1876
|
+
InputGroup as InputGroup2
|
|
1892
1877
|
} from "react-bootstrap";
|
|
1893
1878
|
import { FiMail, FiSearch, FiUser, FiX, FiPlus, FiSend } from "react-icons/fi";
|
|
1894
|
-
import { Fragment as
|
|
1879
|
+
import { Fragment as Fragment9, jsx as jsx31, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
1895
1880
|
var MailSender = ({
|
|
1896
1881
|
htmlContent,
|
|
1897
1882
|
companyName,
|
|
@@ -1900,15 +1885,15 @@ var MailSender = ({
|
|
|
1900
1885
|
hide = false,
|
|
1901
1886
|
renderTrigger
|
|
1902
1887
|
}) => {
|
|
1903
|
-
const [opened, setOpened] =
|
|
1904
|
-
const [addingEmail, setAddingEmail] =
|
|
1905
|
-
const [selectedEmails, setSelectedEmails] =
|
|
1906
|
-
const [emails, setEmails] =
|
|
1907
|
-
const [loading, setLoading] =
|
|
1908
|
-
const [postLoading, setPostLoading] =
|
|
1909
|
-
const [customEmail, setCustomEmail] =
|
|
1910
|
-
const [emailError, setEmailError] =
|
|
1911
|
-
const [searchFilter, setSearchFilter] =
|
|
1888
|
+
const [opened, setOpened] = useState12(false);
|
|
1889
|
+
const [addingEmail, setAddingEmail] = useState12(false);
|
|
1890
|
+
const [selectedEmails, setSelectedEmails] = useState12([]);
|
|
1891
|
+
const [emails, setEmails] = useState12([]);
|
|
1892
|
+
const [loading, setLoading] = useState12(false);
|
|
1893
|
+
const [postLoading, setPostLoading] = useState12(false);
|
|
1894
|
+
const [customEmail, setCustomEmail] = useState12("");
|
|
1895
|
+
const [emailError, setEmailError] = useState12("");
|
|
1896
|
+
const [searchFilter, setSearchFilter] = useState12("");
|
|
1912
1897
|
const handleOpen = async () => {
|
|
1913
1898
|
setLoading(true);
|
|
1914
1899
|
try {
|
|
@@ -1991,9 +1976,9 @@ var MailSender = ({
|
|
|
1991
1976
|
if (renderTrigger) {
|
|
1992
1977
|
return renderTrigger({ onClick: handleOpen, loading });
|
|
1993
1978
|
}
|
|
1994
|
-
return /* @__PURE__ */
|
|
1979
|
+
return /* @__PURE__ */ jsx31(Button13, { disabled: loading, className: "w-100", onClick: handleOpen, children: loading ? "Carregando..." : "Enviar por E-mail" });
|
|
1995
1980
|
}
|
|
1996
|
-
return /* @__PURE__ */
|
|
1981
|
+
return /* @__PURE__ */ jsxs23(
|
|
1997
1982
|
"div",
|
|
1998
1983
|
{
|
|
1999
1984
|
style: {
|
|
@@ -2004,7 +1989,7 @@ var MailSender = ({
|
|
|
2004
1989
|
boxShadow: "0 4px 6px rgba(0, 0, 0, 0.1)"
|
|
2005
1990
|
},
|
|
2006
1991
|
children: [
|
|
2007
|
-
/* @__PURE__ */
|
|
1992
|
+
/* @__PURE__ */ jsx31(
|
|
2008
1993
|
"div",
|
|
2009
1994
|
{
|
|
2010
1995
|
style: {
|
|
@@ -2012,20 +1997,20 @@ var MailSender = ({
|
|
|
2012
1997
|
color: "white",
|
|
2013
1998
|
padding: "25px"
|
|
2014
1999
|
},
|
|
2015
|
-
children: /* @__PURE__ */
|
|
2016
|
-
/* @__PURE__ */
|
|
2017
|
-
/* @__PURE__ */
|
|
2018
|
-
/* @__PURE__ */
|
|
2000
|
+
children: /* @__PURE__ */ jsxs23("div", { className: "d-flex justify-content-between align-items-center", children: [
|
|
2001
|
+
/* @__PURE__ */ jsxs23("div", { children: [
|
|
2002
|
+
/* @__PURE__ */ jsxs23("h4", { className: "mb-1", style: { fontWeight: "600", fontSize: "22px" }, children: [
|
|
2003
|
+
/* @__PURE__ */ jsx31(FiMail, { className: "me-2", size: 20 }),
|
|
2019
2004
|
"Enviar Relat\xF3rio por E-mail"
|
|
2020
2005
|
] }),
|
|
2021
|
-
/* @__PURE__ */
|
|
2006
|
+
/* @__PURE__ */ jsxs23("small", { style: { opacity: "0.9", fontSize: "14px" }, children: [
|
|
2022
2007
|
"Selecione os destinat\xE1rios para envio do relat\xF3rio de ",
|
|
2023
2008
|
companyName
|
|
2024
2009
|
] })
|
|
2025
2010
|
] }),
|
|
2026
|
-
/* @__PURE__ */
|
|
2027
|
-
/* @__PURE__ */
|
|
2028
|
-
|
|
2011
|
+
/* @__PURE__ */ jsxs23("div", { className: "d-flex gap-2", children: [
|
|
2012
|
+
/* @__PURE__ */ jsx31(
|
|
2013
|
+
Button13,
|
|
2029
2014
|
{
|
|
2030
2015
|
variant: "light",
|
|
2031
2016
|
onClick: sendEmail,
|
|
@@ -2036,37 +2021,37 @@ var MailSender = ({
|
|
|
2036
2021
|
minWidth: "130px",
|
|
2037
2022
|
height: "40px"
|
|
2038
2023
|
},
|
|
2039
|
-
children: postLoading ? /* @__PURE__ */
|
|
2040
|
-
/* @__PURE__ */
|
|
2024
|
+
children: postLoading ? /* @__PURE__ */ jsxs23(Fragment9, { children: [
|
|
2025
|
+
/* @__PURE__ */ jsx31(Spinner4, { size: "sm", className: "me-2" }),
|
|
2041
2026
|
"Enviando..."
|
|
2042
|
-
] }) : /* @__PURE__ */
|
|
2043
|
-
/* @__PURE__ */
|
|
2027
|
+
] }) : /* @__PURE__ */ jsxs23(Fragment9, { children: [
|
|
2028
|
+
/* @__PURE__ */ jsx31(FiSend, { className: "me-2", size: 14 }),
|
|
2044
2029
|
"Enviar E-mail"
|
|
2045
2030
|
] })
|
|
2046
2031
|
}
|
|
2047
2032
|
),
|
|
2048
|
-
/* @__PURE__ */
|
|
2049
|
-
|
|
2033
|
+
/* @__PURE__ */ jsx31(
|
|
2034
|
+
Button13,
|
|
2050
2035
|
{
|
|
2051
2036
|
variant: "outline-light",
|
|
2052
2037
|
onClick: () => setOpened(false),
|
|
2053
2038
|
disabled: postLoading,
|
|
2054
2039
|
style: { borderRadius: "8px", width: "40px", height: "40px" },
|
|
2055
|
-
children: /* @__PURE__ */
|
|
2040
|
+
children: /* @__PURE__ */ jsx31(FiX, { size: 16 })
|
|
2056
2041
|
}
|
|
2057
2042
|
)
|
|
2058
2043
|
] })
|
|
2059
2044
|
] })
|
|
2060
2045
|
}
|
|
2061
2046
|
),
|
|
2062
|
-
/* @__PURE__ */
|
|
2063
|
-
/* @__PURE__ */
|
|
2064
|
-
/* @__PURE__ */
|
|
2065
|
-
/* @__PURE__ */
|
|
2066
|
-
/* @__PURE__ */
|
|
2067
|
-
/* @__PURE__ */
|
|
2068
|
-
/* @__PURE__ */
|
|
2069
|
-
/* @__PURE__ */
|
|
2047
|
+
/* @__PURE__ */ jsxs23("div", { style: { padding: "25px" }, children: [
|
|
2048
|
+
/* @__PURE__ */ jsx31(Card4, { className: "mb-4", style: { border: "none", boxShadow: "0 2px 8px rgba(0,0,0,0.05)" }, children: /* @__PURE__ */ jsxs23(Card4.Body, { style: { padding: "20px" }, children: [
|
|
2049
|
+
/* @__PURE__ */ jsxs23(Row4, { className: "align-items-center", children: [
|
|
2050
|
+
/* @__PURE__ */ jsxs23(Col4, { md: 6, children: [
|
|
2051
|
+
/* @__PURE__ */ jsx31("h6", { className: "mb-2", style: { color: "#495057", fontWeight: "600" }, children: "\u{1F527} Filtros e A\xE7\xF5es" }),
|
|
2052
|
+
/* @__PURE__ */ jsxs23(InputGroup2, { style: { maxWidth: "300px" }, children: [
|
|
2053
|
+
/* @__PURE__ */ jsx31(InputGroup2.Text, { style: { backgroundColor: "#f8f9fa", border: "1px solid #dee2e6" }, children: /* @__PURE__ */ jsx31(FiSearch, { size: 14, color: "#6c757d" }) }),
|
|
2054
|
+
/* @__PURE__ */ jsx31(
|
|
2070
2055
|
Form7.Control,
|
|
2071
2056
|
{
|
|
2072
2057
|
type: "text",
|
|
@@ -2078,25 +2063,25 @@ var MailSender = ({
|
|
|
2078
2063
|
)
|
|
2079
2064
|
] })
|
|
2080
2065
|
] }),
|
|
2081
|
-
/* @__PURE__ */
|
|
2082
|
-
|
|
2066
|
+
/* @__PURE__ */ jsx31(Col4, { md: 6, className: "text-end", children: /* @__PURE__ */ jsx31(
|
|
2067
|
+
Button13,
|
|
2083
2068
|
{
|
|
2084
2069
|
variant: addingEmail ? "outline-secondary" : "outline-primary",
|
|
2085
2070
|
size: "sm",
|
|
2086
2071
|
onClick: () => setAddingEmail(!addingEmail),
|
|
2087
2072
|
disabled: postLoading,
|
|
2088
2073
|
style: { borderRadius: "8px" },
|
|
2089
|
-
children: addingEmail ? /* @__PURE__ */
|
|
2090
|
-
/* @__PURE__ */
|
|
2074
|
+
children: addingEmail ? /* @__PURE__ */ jsxs23(Fragment9, { children: [
|
|
2075
|
+
/* @__PURE__ */ jsx31(FiX, { className: "me-1", size: 14 }),
|
|
2091
2076
|
"Cancelar"
|
|
2092
|
-
] }) : /* @__PURE__ */
|
|
2093
|
-
/* @__PURE__ */
|
|
2077
|
+
] }) : /* @__PURE__ */ jsxs23(Fragment9, { children: [
|
|
2078
|
+
/* @__PURE__ */ jsx31(FiPlus, { className: "me-1", size: 14 }),
|
|
2094
2079
|
"E-mail Personalizado"
|
|
2095
2080
|
] })
|
|
2096
2081
|
}
|
|
2097
2082
|
) })
|
|
2098
2083
|
] }),
|
|
2099
|
-
addingEmail && /* @__PURE__ */
|
|
2084
|
+
addingEmail && /* @__PURE__ */ jsxs23(
|
|
2100
2085
|
"div",
|
|
2101
2086
|
{
|
|
2102
2087
|
style: {
|
|
@@ -2107,11 +2092,11 @@ var MailSender = ({
|
|
|
2107
2092
|
border: "1px solid #e3f2fd"
|
|
2108
2093
|
},
|
|
2109
2094
|
children: [
|
|
2110
|
-
/* @__PURE__ */
|
|
2111
|
-
/* @__PURE__ */
|
|
2112
|
-
/* @__PURE__ */
|
|
2113
|
-
/* @__PURE__ */
|
|
2114
|
-
/* @__PURE__ */
|
|
2095
|
+
/* @__PURE__ */ jsx31("h6", { className: "mb-3", style: { color: "#1976d2", fontWeight: "600" }, children: "\u2709\uFE0F Adicionar E-mail Personalizado" }),
|
|
2096
|
+
/* @__PURE__ */ jsxs23(Row4, { className: "align-items-end", children: [
|
|
2097
|
+
/* @__PURE__ */ jsxs23(Col4, { md: 8, children: [
|
|
2098
|
+
/* @__PURE__ */ jsx31(Form7.Label, { style: { fontSize: "13px", color: "#6c757d", fontWeight: "500" }, children: "Endere\xE7o de E-mail" }),
|
|
2099
|
+
/* @__PURE__ */ jsx31(
|
|
2115
2100
|
Form7.Control,
|
|
2116
2101
|
{
|
|
2117
2102
|
type: "email",
|
|
@@ -2127,17 +2112,17 @@ var MailSender = ({
|
|
|
2127
2112
|
onKeyPress: (e) => e.key === "Enter" && handleEmailAdd()
|
|
2128
2113
|
}
|
|
2129
2114
|
),
|
|
2130
|
-
/* @__PURE__ */
|
|
2115
|
+
/* @__PURE__ */ jsx31(Form7.Control.Feedback, { type: "invalid", children: emailError })
|
|
2131
2116
|
] }),
|
|
2132
|
-
/* @__PURE__ */
|
|
2133
|
-
|
|
2117
|
+
/* @__PURE__ */ jsx31(Col4, { md: 4, children: /* @__PURE__ */ jsxs23(
|
|
2118
|
+
Button13,
|
|
2134
2119
|
{
|
|
2135
2120
|
variant: "success",
|
|
2136
2121
|
onClick: handleEmailAdd,
|
|
2137
2122
|
disabled: postLoading,
|
|
2138
2123
|
style: { borderRadius: "8px", width: "100%" },
|
|
2139
2124
|
children: [
|
|
2140
|
-
/* @__PURE__ */
|
|
2125
|
+
/* @__PURE__ */ jsx31(FiPlus, { className: "me-1", size: 14 }),
|
|
2141
2126
|
"Adicionar"
|
|
2142
2127
|
]
|
|
2143
2128
|
}
|
|
@@ -2147,16 +2132,16 @@ var MailSender = ({
|
|
|
2147
2132
|
}
|
|
2148
2133
|
)
|
|
2149
2134
|
] }) }),
|
|
2150
|
-
selectedEmails.length > 0 && /* @__PURE__ */
|
|
2151
|
-
/* @__PURE__ */
|
|
2152
|
-
/* @__PURE__ */
|
|
2153
|
-
/* @__PURE__ */
|
|
2135
|
+
selectedEmails.length > 0 && /* @__PURE__ */ jsx31(Card4, { className: "mb-4", style: { border: "none", boxShadow: "0 2px 8px rgba(0,0,0,0.05)" }, children: /* @__PURE__ */ jsxs23(Card4.Body, { style: { padding: "20px" }, children: [
|
|
2136
|
+
/* @__PURE__ */ jsxs23("div", { className: "d-flex justify-content-between align-items-center mb-3", children: [
|
|
2137
|
+
/* @__PURE__ */ jsx31("h6", { className: "mb-0", style: { color: "#495057", fontWeight: "600" }, children: "\u{1F4CB} Destinat\xE1rios Selecionados" }),
|
|
2138
|
+
/* @__PURE__ */ jsxs23(Badge2, { bg: "primary", style: { fontSize: "12px", padding: "6px 12px" }, children: [
|
|
2154
2139
|
selectedEmails.length,
|
|
2155
2140
|
" selecionado",
|
|
2156
2141
|
selectedEmails.length > 1 ? "s" : ""
|
|
2157
2142
|
] })
|
|
2158
2143
|
] }),
|
|
2159
|
-
/* @__PURE__ */
|
|
2144
|
+
/* @__PURE__ */ jsx31("div", { className: "d-flex flex-wrap gap-2", children: selectedEmails.map((email, index) => /* @__PURE__ */ jsxs23(
|
|
2160
2145
|
"div",
|
|
2161
2146
|
{
|
|
2162
2147
|
style: {
|
|
@@ -2170,10 +2155,10 @@ var MailSender = ({
|
|
|
2170
2155
|
fontWeight: "500"
|
|
2171
2156
|
},
|
|
2172
2157
|
children: [
|
|
2173
|
-
/* @__PURE__ */
|
|
2174
|
-
/* @__PURE__ */
|
|
2175
|
-
/* @__PURE__ */
|
|
2176
|
-
|
|
2158
|
+
/* @__PURE__ */ jsx31(FiUser, { size: 12, className: "me-2", color: "#1976d2" }),
|
|
2159
|
+
/* @__PURE__ */ jsx31("span", { children: email.email || email }),
|
|
2160
|
+
/* @__PURE__ */ jsx31(
|
|
2161
|
+
Button13,
|
|
2177
2162
|
{
|
|
2178
2163
|
variant: "link",
|
|
2179
2164
|
size: "sm",
|
|
@@ -2185,7 +2170,7 @@ var MailSender = ({
|
|
|
2185
2170
|
textDecoration: "none",
|
|
2186
2171
|
fontSize: "16px"
|
|
2187
2172
|
},
|
|
2188
|
-
children: /* @__PURE__ */
|
|
2173
|
+
children: /* @__PURE__ */ jsx31(FiX, { size: 14 })
|
|
2189
2174
|
}
|
|
2190
2175
|
)
|
|
2191
2176
|
]
|
|
@@ -2193,67 +2178,301 @@ var MailSender = ({
|
|
|
2193
2178
|
index
|
|
2194
2179
|
)) })
|
|
2195
2180
|
] }) }),
|
|
2196
|
-
/* @__PURE__ */
|
|
2197
|
-
/* @__PURE__ */
|
|
2198
|
-
/* @__PURE__ */
|
|
2181
|
+
/* @__PURE__ */ jsx31(Card4, { style: { border: "none", boxShadow: "0 2px 8px rgba(0,0,0,0.05)" }, children: /* @__PURE__ */ jsxs23(Card4.Body, { style: { padding: "20px" }, children: [
|
|
2182
|
+
/* @__PURE__ */ jsxs23("h6", { className: "mb-3", style: { color: "#495057", fontWeight: "600" }, children: [
|
|
2183
|
+
/* @__PURE__ */ jsx31(FiUser, { className: "me-2", size: 16 }),
|
|
2199
2184
|
"E-mails de ",
|
|
2200
2185
|
companyName
|
|
2201
2186
|
] }),
|
|
2202
|
-
loading ? /* @__PURE__ */
|
|
2203
|
-
/* @__PURE__ */
|
|
2204
|
-
/* @__PURE__ */
|
|
2205
|
-
] }) : filteredEmails.length === 0 ? /* @__PURE__ */
|
|
2206
|
-
|
|
2187
|
+
loading ? /* @__PURE__ */ jsxs23("div", { className: "text-center py-4", children: [
|
|
2188
|
+
/* @__PURE__ */ jsx31(Spinner4, {}),
|
|
2189
|
+
/* @__PURE__ */ jsx31("p", { className: "mt-2 text-muted", children: "Carregando e-mails..." })
|
|
2190
|
+
] }) : filteredEmails.length === 0 ? /* @__PURE__ */ jsx31("div", { className: "text-center py-4", children: /* @__PURE__ */ jsx31("p", { className: "text-muted mb-0", children: searchFilter ? "Nenhum e-mail encontrado com esse filtro" : "Nenhum e-mail dispon\xEDvel" }) }) : /* @__PURE__ */ jsx31(Row4, { children: filteredEmails.map((email) => /* @__PURE__ */ jsx31(Col4, { xs: 12, sm: 6, lg: 4, className: "mb-3", children: /* @__PURE__ */ jsx31(
|
|
2191
|
+
Card4,
|
|
2192
|
+
{
|
|
2193
|
+
onClick: () => setSelectedEmails([...selectedEmails, email]),
|
|
2194
|
+
style: {
|
|
2195
|
+
cursor: "pointer",
|
|
2196
|
+
border: "1px solid #e9ecef",
|
|
2197
|
+
borderRadius: "10px",
|
|
2198
|
+
transition: "all 0.2s ease",
|
|
2199
|
+
backgroundColor: "#fff"
|
|
2200
|
+
},
|
|
2201
|
+
onMouseEnter: (e) => {
|
|
2202
|
+
e.currentTarget.style.transform = "translateY(-2px)";
|
|
2203
|
+
e.currentTarget.style.boxShadow = "0 4px 12px rgba(0,0,0,0.1)";
|
|
2204
|
+
e.currentTarget.style.borderColor = "#007bff";
|
|
2205
|
+
},
|
|
2206
|
+
onMouseLeave: (e) => {
|
|
2207
|
+
e.currentTarget.style.transform = "translateY(0)";
|
|
2208
|
+
e.currentTarget.style.boxShadow = "none";
|
|
2209
|
+
e.currentTarget.style.borderColor = "#e9ecef";
|
|
2210
|
+
},
|
|
2211
|
+
children: /* @__PURE__ */ jsxs23(Card4.Body, { style: { padding: "15px", textAlign: "center" }, children: [
|
|
2212
|
+
/* @__PURE__ */ jsx31(FiMail, { size: 20, color: "#007bff", className: "mb-2" }),
|
|
2213
|
+
/* @__PURE__ */ jsx31(
|
|
2214
|
+
"div",
|
|
2215
|
+
{
|
|
2216
|
+
style: {
|
|
2217
|
+
fontSize: "14px",
|
|
2218
|
+
fontWeight: "500",
|
|
2219
|
+
color: "#2c3e50",
|
|
2220
|
+
wordBreak: "break-word"
|
|
2221
|
+
},
|
|
2222
|
+
children: email.email
|
|
2223
|
+
}
|
|
2224
|
+
)
|
|
2225
|
+
] })
|
|
2226
|
+
}
|
|
2227
|
+
) }, email.email)) })
|
|
2228
|
+
] }) })
|
|
2229
|
+
] })
|
|
2230
|
+
]
|
|
2231
|
+
}
|
|
2232
|
+
);
|
|
2233
|
+
};
|
|
2234
|
+
|
|
2235
|
+
// src/forms/AutoComplete.tsx
|
|
2236
|
+
import { useEffect as useEffect5, useMemo as useMemo3, useState as useState13 } from "react";
|
|
2237
|
+
import { FloatingLabel, Form as Form8, InputGroup as InputGroup3, ListGroup as ListGroup2, Spinner as Spinner5 } from "react-bootstrap";
|
|
2238
|
+
import { Fragment as Fragment10, jsx as jsx32, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
2239
|
+
var AutoComplete = ({
|
|
2240
|
+
className,
|
|
2241
|
+
ops = [],
|
|
2242
|
+
sortKey,
|
|
2243
|
+
displayKey,
|
|
2244
|
+
displayKeys,
|
|
2245
|
+
onValueChanged,
|
|
2246
|
+
onSelectedClick,
|
|
2247
|
+
value,
|
|
2248
|
+
actionButton,
|
|
2249
|
+
actionButton2,
|
|
2250
|
+
placeH,
|
|
2251
|
+
title,
|
|
2252
|
+
filter,
|
|
2253
|
+
filterField,
|
|
2254
|
+
loadFunc,
|
|
2255
|
+
loadCondition,
|
|
2256
|
+
onBlurEvent,
|
|
2257
|
+
formatationFunc,
|
|
2258
|
+
onEscKeyDown,
|
|
2259
|
+
onEnterKeyDown,
|
|
2260
|
+
margT,
|
|
2261
|
+
margB,
|
|
2262
|
+
hideComponent,
|
|
2263
|
+
disableComponent = false,
|
|
2264
|
+
disableSelect = false,
|
|
2265
|
+
autoFocusConfig,
|
|
2266
|
+
onLoad,
|
|
2267
|
+
cacheKey,
|
|
2268
|
+
minChars = 0,
|
|
2269
|
+
maxItems,
|
|
2270
|
+
showListOnFocus = true,
|
|
2271
|
+
lazyLoad = false,
|
|
2272
|
+
labelPosition = "top"
|
|
2273
|
+
}) => {
|
|
2274
|
+
const [liItem, setListItem] = useState13([]);
|
|
2275
|
+
const [options, setOptions] = useState13([]);
|
|
2276
|
+
const [input, setInput] = useState13("");
|
|
2277
|
+
const [hide, setHide] = useState13(true);
|
|
2278
|
+
const [onLoaded, setOnLoaded] = useState13(false);
|
|
2279
|
+
const [loading, setLoading] = useState13(false);
|
|
2280
|
+
const cacheStore = useMemo3(() => {
|
|
2281
|
+
const win = window;
|
|
2282
|
+
if (!win.__AUTO_COMPLETE_CACHE__) {
|
|
2283
|
+
win.__AUTO_COMPLETE_CACHE__ = /* @__PURE__ */ new Map();
|
|
2284
|
+
}
|
|
2285
|
+
return win.__AUTO_COMPLETE_CACHE__;
|
|
2286
|
+
}, []);
|
|
2287
|
+
const sortOptions = (data, key) => {
|
|
2288
|
+
if (!key || !Array.isArray(data)) return data;
|
|
2289
|
+
return [...data].sort((a, b) => String(a[key]).localeCompare(String(b[key])));
|
|
2290
|
+
};
|
|
2291
|
+
useEffect5(() => {
|
|
2292
|
+
setInput(value || "");
|
|
2293
|
+
}, [value]);
|
|
2294
|
+
useEffect5(() => {
|
|
2295
|
+
if (!Array.isArray(ops) || ops.length === 0) return;
|
|
2296
|
+
const sortedOptions = sortOptions(ops, sortKey);
|
|
2297
|
+
setListItem(sortedOptions);
|
|
2298
|
+
setOptions(sortedOptions);
|
|
2299
|
+
}, [ops, sortKey]);
|
|
2300
|
+
useEffect5(() => {
|
|
2301
|
+
const loadData = async () => {
|
|
2302
|
+
if (!(loadCondition && loadFunc)) return;
|
|
2303
|
+
if (lazyLoad && minChars > 0 && !showListOnFocus && (!value || String(value).length < minChars)) {
|
|
2304
|
+
return;
|
|
2305
|
+
}
|
|
2306
|
+
const key = cacheKey ? `${cacheKey}${filter ? `:${filterField}:${filter}` : ""}` : null;
|
|
2307
|
+
if (key && cacheStore.has(key)) {
|
|
2308
|
+
const cacheEntry = cacheStore.get(key);
|
|
2309
|
+
const data = cacheEntry.promise ? await cacheEntry.promise : cacheEntry.data || cacheEntry;
|
|
2310
|
+
setListItem(data);
|
|
2311
|
+
setOptions(data);
|
|
2312
|
+
triggerOnLoad(data);
|
|
2313
|
+
return;
|
|
2314
|
+
}
|
|
2315
|
+
setLoading(true);
|
|
2316
|
+
try {
|
|
2317
|
+
const requestPromise = loadFunc().then((res) => {
|
|
2318
|
+
let newOps = (res == null ? void 0 : res.content) || res;
|
|
2319
|
+
newOps = Array.isArray(newOps) ? newOps.filter((op) => op != null) : [];
|
|
2320
|
+
if (filter && filterField) {
|
|
2321
|
+
newOps = newOps.filter((op) => op[filterField] === filter);
|
|
2322
|
+
}
|
|
2323
|
+
return sortOptions(newOps, sortKey);
|
|
2324
|
+
});
|
|
2325
|
+
if (key) cacheStore.set(key, { promise: requestPromise });
|
|
2326
|
+
const sortedOptions = await requestPromise;
|
|
2327
|
+
setListItem(sortedOptions);
|
|
2328
|
+
setOptions(sortedOptions);
|
|
2329
|
+
if (key) cacheStore.set(key, { data: sortedOptions });
|
|
2330
|
+
triggerOnLoad(sortedOptions);
|
|
2331
|
+
} catch (error) {
|
|
2332
|
+
if (key) cacheStore.delete(key);
|
|
2333
|
+
setListItem([]);
|
|
2334
|
+
} finally {
|
|
2335
|
+
setLoading(false);
|
|
2336
|
+
}
|
|
2337
|
+
};
|
|
2338
|
+
loadData();
|
|
2339
|
+
}, [loadCondition, filter, filterField, sortKey, cacheKey, lazyLoad, minChars, showListOnFocus]);
|
|
2340
|
+
const triggerOnLoad = (data) => {
|
|
2341
|
+
if (onLoad && !onLoaded) {
|
|
2342
|
+
setOnLoaded(true);
|
|
2343
|
+
onLoad(data);
|
|
2344
|
+
}
|
|
2345
|
+
};
|
|
2346
|
+
const keysJoinner = (li) => {
|
|
2347
|
+
if (!displayKeys || !Array.isArray(displayKeys)) return "";
|
|
2348
|
+
return displayKeys.map((key) => `${li[key]} `).join("").trim();
|
|
2349
|
+
};
|
|
2350
|
+
const getDisplayText = (item) => {
|
|
2351
|
+
if (formatationFunc) return formatationFunc(item);
|
|
2352
|
+
if (displayKey) return item[displayKey];
|
|
2353
|
+
if (displayKeys) return keysJoinner(item);
|
|
2354
|
+
return String(item);
|
|
2355
|
+
};
|
|
2356
|
+
const onFieldUpdate = (val) => {
|
|
2357
|
+
const search = val.toLowerCase();
|
|
2358
|
+
const canSearch = search.length >= minChars;
|
|
2359
|
+
if (canSearch && Array.isArray(options)) {
|
|
2360
|
+
const filtered = options.filter((item) => {
|
|
2361
|
+
const text = getDisplayText(item);
|
|
2362
|
+
return String(text).toLowerCase().includes(search);
|
|
2363
|
+
});
|
|
2364
|
+
setListItem(filtered);
|
|
2365
|
+
} else {
|
|
2366
|
+
setListItem(options || []);
|
|
2367
|
+
}
|
|
2368
|
+
onValueChanged == null ? void 0 : onValueChanged(val);
|
|
2369
|
+
setInput(val);
|
|
2370
|
+
setHide(!canSearch && options.length === 0);
|
|
2371
|
+
};
|
|
2372
|
+
return /* @__PURE__ */ jsxs24(
|
|
2373
|
+
"div",
|
|
2374
|
+
{
|
|
2375
|
+
className,
|
|
2376
|
+
style: { marginTop: margT != null ? margT : 4, marginBottom: margB != null ? margB : 4, position: "relative" },
|
|
2377
|
+
onBlur: (e) => {
|
|
2378
|
+
setTimeout(() => {
|
|
2379
|
+
onBlurEvent == null ? void 0 : onBlurEvent(e, input);
|
|
2380
|
+
setHide(true);
|
|
2381
|
+
}, 200);
|
|
2382
|
+
},
|
|
2383
|
+
onKeyDown: (e) => {
|
|
2384
|
+
if (e.key === "Escape") {
|
|
2385
|
+
setHide(true);
|
|
2386
|
+
onEscKeyDown == null ? void 0 : onEscKeyDown();
|
|
2387
|
+
}
|
|
2388
|
+
if (e.key === "Enter" && onEnterKeyDown) {
|
|
2389
|
+
onEnterKeyDown(input);
|
|
2390
|
+
}
|
|
2391
|
+
},
|
|
2392
|
+
onMouseLeave: () => setHide(true),
|
|
2393
|
+
children: [
|
|
2394
|
+
!hideComponent && /* @__PURE__ */ jsxs24(Fragment10, { children: [
|
|
2395
|
+
labelPosition === "top" && title && /* @__PURE__ */ jsx32(Form8.Label, { className: "fw-semibold small mb-1", children: title }),
|
|
2396
|
+
/* @__PURE__ */ jsxs24(InputGroup3, { children: [
|
|
2397
|
+
labelPosition === "floating" ? /* @__PURE__ */ jsx32(FloatingLabel, { controlId: "floatingInput", label: title, style: { zIndex: 0, flex: 1 }, children: /* @__PURE__ */ jsx32(
|
|
2398
|
+
Form8.Control,
|
|
2207
2399
|
{
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
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";
|
|
2400
|
+
autoFocus: autoFocusConfig,
|
|
2401
|
+
disabled: disableComponent || disableSelect,
|
|
2402
|
+
placeholder: placeH,
|
|
2403
|
+
autoComplete: "off",
|
|
2404
|
+
value: input,
|
|
2405
|
+
onClickCapture: () => {
|
|
2406
|
+
const canOpen = showListOnFocus && input.length >= minChars;
|
|
2407
|
+
setHide(!canOpen);
|
|
2220
2408
|
},
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2409
|
+
onChange: (e) => onFieldUpdate(e.currentTarget.value),
|
|
2410
|
+
type: "text"
|
|
2411
|
+
}
|
|
2412
|
+
) }) : /* @__PURE__ */ jsx32(
|
|
2413
|
+
Form8.Control,
|
|
2414
|
+
{
|
|
2415
|
+
autoFocus: autoFocusConfig,
|
|
2416
|
+
disabled: disableComponent || disableSelect,
|
|
2417
|
+
placeholder: placeH || title,
|
|
2418
|
+
autoComplete: "off",
|
|
2419
|
+
value: input,
|
|
2420
|
+
onClickCapture: () => {
|
|
2421
|
+
const canOpen = showListOnFocus && input.length >= minChars;
|
|
2422
|
+
setHide(!canOpen);
|
|
2225
2423
|
},
|
|
2226
|
-
|
|
2227
|
-
|
|
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
|
-
] })
|
|
2424
|
+
onChange: (e) => onFieldUpdate(e.currentTarget.value),
|
|
2425
|
+
type: "text"
|
|
2241
2426
|
}
|
|
2242
|
-
)
|
|
2243
|
-
|
|
2244
|
-
|
|
2427
|
+
),
|
|
2428
|
+
loading && /* @__PURE__ */ jsx32(InputGroup3.Text, { children: /* @__PURE__ */ jsx32(Spinner5, { animation: "border", size: "sm" }) }),
|
|
2429
|
+
!disableComponent && (actionButton == null ? void 0 : actionButton(() => setInput(""))),
|
|
2430
|
+
!disableComponent && (actionButton2 == null ? void 0 : actionButton2(input))
|
|
2431
|
+
] })
|
|
2432
|
+
] }),
|
|
2433
|
+
/* @__PURE__ */ jsx32(
|
|
2434
|
+
ListGroup2,
|
|
2435
|
+
{
|
|
2436
|
+
className: "listgroup-autocomplete shadow-sm",
|
|
2437
|
+
hidden: hide || liItem.length === 0,
|
|
2438
|
+
style: {
|
|
2439
|
+
position: "absolute",
|
|
2440
|
+
top: "100%",
|
|
2441
|
+
left: 0,
|
|
2442
|
+
width: "100%",
|
|
2443
|
+
maxHeight: "250px",
|
|
2444
|
+
overflowY: "auto",
|
|
2445
|
+
zIndex: 1050,
|
|
2446
|
+
backgroundColor: "#fff"
|
|
2447
|
+
},
|
|
2448
|
+
children: (maxItems ? liItem.slice(0, maxItems) : liItem).map((li, index) => /* @__PURE__ */ jsx32(
|
|
2449
|
+
ListGroup2.Item,
|
|
2450
|
+
{
|
|
2451
|
+
action: true,
|
|
2452
|
+
onClick: () => {
|
|
2453
|
+
const text = getDisplayText(li);
|
|
2454
|
+
setInput(text);
|
|
2455
|
+
onSelectedClick(li, index, liItem);
|
|
2456
|
+
setHide(true);
|
|
2457
|
+
},
|
|
2458
|
+
children: getDisplayText(li)
|
|
2459
|
+
},
|
|
2460
|
+
index
|
|
2461
|
+
))
|
|
2462
|
+
}
|
|
2463
|
+
)
|
|
2245
2464
|
]
|
|
2246
2465
|
}
|
|
2247
2466
|
);
|
|
2248
2467
|
};
|
|
2249
2468
|
|
|
2250
2469
|
// src/forms/GenericForm.tsx
|
|
2251
|
-
import { useState as
|
|
2252
|
-
import { Button as
|
|
2253
|
-
import { jsx as
|
|
2470
|
+
import { useState as useState14 } from "react";
|
|
2471
|
+
import { Button as Button14, Form as Form9 } from "react-bootstrap";
|
|
2472
|
+
import { jsx as jsx33, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
2254
2473
|
var GenericForm = ({ fields, onSubmit, renderCustomSelect }) => {
|
|
2255
|
-
const [formValues, setFormValues] =
|
|
2256
|
-
const [errors, setErrors] =
|
|
2474
|
+
const [formValues, setFormValues] = useState14({});
|
|
2475
|
+
const [errors, setErrors] = useState14({});
|
|
2257
2476
|
const handleChange = (key, value) => {
|
|
2258
2477
|
setFormValues({
|
|
2259
2478
|
...formValues,
|
|
@@ -2282,10 +2501,10 @@ var GenericForm = ({ fields, onSubmit, renderCustomSelect }) => {
|
|
|
2282
2501
|
switch (type) {
|
|
2283
2502
|
case "text":
|
|
2284
2503
|
case "number":
|
|
2285
|
-
return /* @__PURE__ */
|
|
2286
|
-
/* @__PURE__ */
|
|
2287
|
-
/* @__PURE__ */
|
|
2288
|
-
|
|
2504
|
+
return /* @__PURE__ */ jsxs25(Form9.Group, { className: "mb-3", children: [
|
|
2505
|
+
/* @__PURE__ */ jsx33(Form9.Label, { children: label }),
|
|
2506
|
+
/* @__PURE__ */ jsx33(
|
|
2507
|
+
Form9.Control,
|
|
2289
2508
|
{
|
|
2290
2509
|
type,
|
|
2291
2510
|
placeholder,
|
|
@@ -2294,30 +2513,30 @@ var GenericForm = ({ fields, onSubmit, renderCustomSelect }) => {
|
|
|
2294
2513
|
isInvalid: !!errors[key]
|
|
2295
2514
|
}
|
|
2296
2515
|
),
|
|
2297
|
-
/* @__PURE__ */
|
|
2516
|
+
/* @__PURE__ */ jsx33(Form9.Control.Feedback, { type: "invalid", children: errors[key] })
|
|
2298
2517
|
] }, key);
|
|
2299
2518
|
case "select": {
|
|
2300
2519
|
const orderedOptions = (options || []).filter((opt) => opt && opt.value !== void 0 && opt.label !== void 0).sort((a, b) => a.label.localeCompare(b.label));
|
|
2301
|
-
return /* @__PURE__ */
|
|
2302
|
-
/* @__PURE__ */
|
|
2303
|
-
/* @__PURE__ */
|
|
2304
|
-
|
|
2520
|
+
return /* @__PURE__ */ jsxs25(Form9.Group, { className: "mb-3", children: [
|
|
2521
|
+
/* @__PURE__ */ jsx33(Form9.Label, { children: label }),
|
|
2522
|
+
/* @__PURE__ */ jsxs25(
|
|
2523
|
+
Form9.Select,
|
|
2305
2524
|
{
|
|
2306
2525
|
value,
|
|
2307
2526
|
onChange: (e) => handleChange(key, e.target.value),
|
|
2308
2527
|
isInvalid: !!errors[key],
|
|
2309
2528
|
children: [
|
|
2310
|
-
/* @__PURE__ */
|
|
2311
|
-
orderedOptions.map((option) => /* @__PURE__ */
|
|
2529
|
+
/* @__PURE__ */ jsx33("option", { value: "", children: "Selecione..." }),
|
|
2530
|
+
orderedOptions.map((option) => /* @__PURE__ */ jsx33("option", { value: option.value, children: option.label }, String(option.value)))
|
|
2312
2531
|
]
|
|
2313
2532
|
}
|
|
2314
2533
|
),
|
|
2315
|
-
/* @__PURE__ */
|
|
2534
|
+
/* @__PURE__ */ jsx33(Form9.Control.Feedback, { type: "invalid", children: errors[key] })
|
|
2316
2535
|
] }, key);
|
|
2317
2536
|
}
|
|
2318
2537
|
case "custom-select":
|
|
2319
2538
|
if (renderCustomSelect) {
|
|
2320
|
-
return /* @__PURE__ */
|
|
2539
|
+
return /* @__PURE__ */ jsxs25("div", { children: [
|
|
2321
2540
|
renderCustomSelect({
|
|
2322
2541
|
label,
|
|
2323
2542
|
value,
|
|
@@ -2325,15 +2544,15 @@ var GenericForm = ({ fields, onSubmit, renderCustomSelect }) => {
|
|
|
2325
2544
|
onChange: (v) => handleChange(key, v),
|
|
2326
2545
|
placeholder
|
|
2327
2546
|
}),
|
|
2328
|
-
errors[key] && /* @__PURE__ */
|
|
2547
|
+
errors[key] && /* @__PURE__ */ jsx33("div", { className: "invalid-feedback d-block", children: errors[key] })
|
|
2329
2548
|
] }, key);
|
|
2330
2549
|
}
|
|
2331
2550
|
return null;
|
|
2332
2551
|
case "date":
|
|
2333
|
-
return /* @__PURE__ */
|
|
2334
|
-
/* @__PURE__ */
|
|
2335
|
-
/* @__PURE__ */
|
|
2336
|
-
|
|
2552
|
+
return /* @__PURE__ */ jsxs25(Form9.Group, { className: "mb-3", children: [
|
|
2553
|
+
/* @__PURE__ */ jsx33(Form9.Label, { children: label }),
|
|
2554
|
+
/* @__PURE__ */ jsx33(
|
|
2555
|
+
Form9.Control,
|
|
2337
2556
|
{
|
|
2338
2557
|
type: "date",
|
|
2339
2558
|
value,
|
|
@@ -2341,23 +2560,23 @@ var GenericForm = ({ fields, onSubmit, renderCustomSelect }) => {
|
|
|
2341
2560
|
isInvalid: !!errors[key]
|
|
2342
2561
|
}
|
|
2343
2562
|
),
|
|
2344
|
-
/* @__PURE__ */
|
|
2563
|
+
/* @__PURE__ */ jsx33(Form9.Control.Feedback, { type: "invalid", children: errors[key] })
|
|
2345
2564
|
] }, key);
|
|
2346
2565
|
default:
|
|
2347
2566
|
return null;
|
|
2348
2567
|
}
|
|
2349
2568
|
};
|
|
2350
|
-
return /* @__PURE__ */
|
|
2569
|
+
return /* @__PURE__ */ jsxs25(Form9, { onSubmit: handleSubmit, children: [
|
|
2351
2570
|
fields.map((field) => renderField(field)),
|
|
2352
|
-
/* @__PURE__ */
|
|
2571
|
+
/* @__PURE__ */ jsx33("div", { className: "d-grid", children: /* @__PURE__ */ jsx33(Button14, { variant: "primary", type: "submit", children: "Salvar" }) })
|
|
2353
2572
|
] });
|
|
2354
2573
|
};
|
|
2355
2574
|
var GenericForm_default = GenericForm;
|
|
2356
2575
|
|
|
2357
2576
|
// src/forms/GenericSelect.tsx
|
|
2358
|
-
import { useEffect as
|
|
2359
|
-
import { Form as
|
|
2360
|
-
import { Fragment as
|
|
2577
|
+
import { useEffect as useEffect6, useState as useState15 } from "react";
|
|
2578
|
+
import { Form as Form10, InputGroup as InputGroup4 } from "react-bootstrap";
|
|
2579
|
+
import { Fragment as Fragment11, jsx as jsx34, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
2361
2580
|
var GenericSelectOps = class {
|
|
2362
2581
|
constructor(noLabel, title, onChange, ops, selection, returnType, displayType, filter, filterField, valueType, loadFunc, loadCondition, actionClick, locked) {
|
|
2363
2582
|
this.noLabel = noLabel;
|
|
@@ -2394,8 +2613,8 @@ var GenericSelect = ({
|
|
|
2394
2613
|
isBold,
|
|
2395
2614
|
...restProps
|
|
2396
2615
|
}) => {
|
|
2397
|
-
const [options, setOptions] =
|
|
2398
|
-
|
|
2616
|
+
const [options, setOptions] = useState15(ops || []);
|
|
2617
|
+
useEffect6(() => {
|
|
2399
2618
|
const loadFunction = async () => {
|
|
2400
2619
|
if (loadCondition && loadFunc) {
|
|
2401
2620
|
loadFunc().then((res) => {
|
|
@@ -2420,15 +2639,15 @@ var GenericSelect = ({
|
|
|
2420
2639
|
}
|
|
2421
2640
|
};
|
|
2422
2641
|
const defaultPlaceholder = (restProps == null ? void 0 : restProps.default) || "Seleciona uma Op\xE7\xE3o";
|
|
2423
|
-
const selectContent = /* @__PURE__ */
|
|
2424
|
-
|
|
2642
|
+
const selectContent = /* @__PURE__ */ jsxs26(
|
|
2643
|
+
Form10.Control,
|
|
2425
2644
|
{
|
|
2426
2645
|
disabled: locked,
|
|
2427
2646
|
as: "select",
|
|
2428
2647
|
value: selection,
|
|
2429
2648
|
onChange: (event) => getTrueValue(event.target.selectedIndex),
|
|
2430
2649
|
children: [
|
|
2431
|
-
/* @__PURE__ */
|
|
2650
|
+
/* @__PURE__ */ jsxs26("option", { value: void 0, children: [
|
|
2432
2651
|
"-- ",
|
|
2433
2652
|
defaultPlaceholder,
|
|
2434
2653
|
" --"
|
|
@@ -2437,35 +2656,36 @@ var GenericSelect = ({
|
|
|
2437
2656
|
const val = valueType && op[valueType] || op.id || op;
|
|
2438
2657
|
let fill = displayType && op[displayType] || op;
|
|
2439
2658
|
if (typeof fill == "object") fill = "";
|
|
2440
|
-
return /* @__PURE__ */
|
|
2659
|
+
return /* @__PURE__ */ jsx34("option", { value: val, children: fill }, op.id || index);
|
|
2441
2660
|
})
|
|
2442
2661
|
]
|
|
2443
2662
|
}
|
|
2444
2663
|
);
|
|
2445
2664
|
if (actionClick) {
|
|
2446
|
-
return /* @__PURE__ */
|
|
2447
|
-
/* @__PURE__ */
|
|
2448
|
-
/* @__PURE__ */
|
|
2665
|
+
return /* @__PURE__ */ jsxs26(Fragment11, { children: [
|
|
2666
|
+
/* @__PURE__ */ jsx34(Form10.Label, { style: { fontWeight: isBold ? "bold" : void 0 }, hidden: noLabel, children: title }),
|
|
2667
|
+
/* @__PURE__ */ jsxs26(InputGroup4, { children: [
|
|
2449
2668
|
selectContent,
|
|
2450
2669
|
actionClick()
|
|
2451
2670
|
] })
|
|
2452
2671
|
] });
|
|
2453
2672
|
}
|
|
2454
|
-
return /* @__PURE__ */
|
|
2455
|
-
/* @__PURE__ */
|
|
2673
|
+
return /* @__PURE__ */ jsxs26(Fragment11, { children: [
|
|
2674
|
+
/* @__PURE__ */ jsx34(Form10.Label, { style: { fontWeight: isBold ? "bold" : void 0 }, hidden: noLabel, children: title }),
|
|
2456
2675
|
selectContent
|
|
2457
2676
|
] });
|
|
2458
2677
|
};
|
|
2459
2678
|
var GenericSelect_default = GenericSelect;
|
|
2460
2679
|
|
|
2461
2680
|
// src/forms/FormField.tsx
|
|
2462
|
-
import { FloatingLabel as FloatingLabel2, Form as
|
|
2463
|
-
import { jsx as
|
|
2681
|
+
import { FloatingLabel as FloatingLabel2, Form as Form11, InputGroup as InputGroup5 } from "react-bootstrap";
|
|
2682
|
+
import { jsx as jsx35, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
2464
2683
|
var FormField = ({
|
|
2465
2684
|
val,
|
|
2466
2685
|
onValueUpdate,
|
|
2467
2686
|
onBlur,
|
|
2468
2687
|
label,
|
|
2688
|
+
labelPosition = "top",
|
|
2469
2689
|
ty,
|
|
2470
2690
|
actionClick,
|
|
2471
2691
|
actionClick2,
|
|
@@ -2511,32 +2731,35 @@ var FormField = ({
|
|
|
2511
2731
|
fieldProps.as = "textarea";
|
|
2512
2732
|
fieldProps.rows = rows || 3;
|
|
2513
2733
|
}
|
|
2514
|
-
return /* @__PURE__ */
|
|
2734
|
+
return /* @__PURE__ */ jsx35(Form11.Control, { ...fieldProps });
|
|
2515
2735
|
};
|
|
2516
2736
|
if (hide) return null;
|
|
2517
|
-
|
|
2518
|
-
|
|
2737
|
+
const useFloating = labelPosition === "floating" && !asTextArea;
|
|
2738
|
+
return /* @__PURE__ */ jsxs27(
|
|
2739
|
+
Form11.Group,
|
|
2519
2740
|
{
|
|
2520
2741
|
onFocusCapture: (e) => onFocusHandler(e.target.value),
|
|
2521
2742
|
onMouseLeave: onMouseLv,
|
|
2522
2743
|
onKeyDown: onKeyDownHandler,
|
|
2523
2744
|
style: { marginTop: 4, marginBottom: 4, width: "100%" },
|
|
2745
|
+
controlId: !useFloating ? controlId : void 0,
|
|
2524
2746
|
children: [
|
|
2525
|
-
/* @__PURE__ */
|
|
2526
|
-
|
|
2747
|
+
!useFloating && label && /* @__PURE__ */ jsx35(Form11.Label, { className: "fw-semibold small mb-1", children: label }),
|
|
2748
|
+
/* @__PURE__ */ jsxs27(InputGroup5, { children: [
|
|
2749
|
+
useFloating ? /* @__PURE__ */ jsx35(FloatingLabel2, { style: { zIndex: 0, flex: 1 }, label, controlId: controlId || "floatingInput", children: renderField() }) : renderField(),
|
|
2527
2750
|
actionClick && actionClick(),
|
|
2528
2751
|
actionClick2 && actionClick2()
|
|
2529
2752
|
] }),
|
|
2530
|
-
feedback && isInvalid && /* @__PURE__ */
|
|
2753
|
+
feedback && isInvalid && /* @__PURE__ */ jsx35(Form11.Control.Feedback, { type: "invalid", style: { display: "block" }, children: feedback })
|
|
2531
2754
|
]
|
|
2532
2755
|
}
|
|
2533
2756
|
);
|
|
2534
2757
|
};
|
|
2535
2758
|
|
|
2536
2759
|
// src/forms/ClickToWriteField.tsx
|
|
2537
|
-
import { useState as
|
|
2538
|
-
import { Button as
|
|
2539
|
-
import { jsx as
|
|
2760
|
+
import { useState as useState16, useEffect as useEffect7, useRef as useRef4 } from "react";
|
|
2761
|
+
import { Button as Button15 } from "react-bootstrap";
|
|
2762
|
+
import { jsx as jsx36, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
2540
2763
|
var ClickToWriteField = ({
|
|
2541
2764
|
buttonDisplay,
|
|
2542
2765
|
fieldType = "text",
|
|
@@ -2552,9 +2775,9 @@ var ClickToWriteField = ({
|
|
|
2552
2775
|
onEnterPress,
|
|
2553
2776
|
cleanRef
|
|
2554
2777
|
}) => {
|
|
2555
|
-
const [showClick, setShowClick] =
|
|
2556
|
-
const inputRef =
|
|
2557
|
-
|
|
2778
|
+
const [showClick, setShowClick] = useState16(false);
|
|
2779
|
+
const inputRef = useRef4(null);
|
|
2780
|
+
useEffect7(() => {
|
|
2558
2781
|
if (showClick) {
|
|
2559
2782
|
setTimeout(() => {
|
|
2560
2783
|
if (inputRef.current) {
|
|
@@ -2583,9 +2806,9 @@ var ClickToWriteField = ({
|
|
|
2583
2806
|
onEnterPress(inputRef);
|
|
2584
2807
|
}
|
|
2585
2808
|
};
|
|
2586
|
-
return /* @__PURE__ */
|
|
2587
|
-
!showClick && /* @__PURE__ */
|
|
2588
|
-
|
|
2809
|
+
return /* @__PURE__ */ jsxs28("div", { style: { display: "flex", width: "100%", margin: 0, padding: 0 }, children: [
|
|
2810
|
+
!showClick && /* @__PURE__ */ jsx36(
|
|
2811
|
+
Button15,
|
|
2589
2812
|
{
|
|
2590
2813
|
style: { flexGrow: 1 },
|
|
2591
2814
|
onClick: handleShowClick,
|
|
@@ -2593,7 +2816,7 @@ var ClickToWriteField = ({
|
|
|
2593
2816
|
children: resolveButtonDisplay()
|
|
2594
2817
|
}
|
|
2595
2818
|
),
|
|
2596
|
-
showClick && /* @__PURE__ */
|
|
2819
|
+
showClick && /* @__PURE__ */ jsx36(
|
|
2597
2820
|
FormField,
|
|
2598
2821
|
{
|
|
2599
2822
|
reference: inputRef,
|
|
@@ -2603,8 +2826,8 @@ var ClickToWriteField = ({
|
|
|
2603
2826
|
label: fieldLabel,
|
|
2604
2827
|
onValueUpdate: onFieldValueUpdate,
|
|
2605
2828
|
onBlur: () => setShowClick(false),
|
|
2606
|
-
actionClick: () => enableFieldActionButton ? /* @__PURE__ */
|
|
2607
|
-
|
|
2829
|
+
actionClick: () => enableFieldActionButton ? /* @__PURE__ */ jsx36(
|
|
2830
|
+
Button15,
|
|
2608
2831
|
{
|
|
2609
2832
|
...fieldActionButtonProps,
|
|
2610
2833
|
onClick: () => fieldActionButtonCallback(inputRef),
|
|
@@ -2617,35 +2840,43 @@ var ClickToWriteField = ({
|
|
|
2617
2840
|
};
|
|
2618
2841
|
|
|
2619
2842
|
// src/forms/ColorPicker.tsx
|
|
2620
|
-
import { Card as
|
|
2843
|
+
import { Card as Card5, Form as Form12, Row as Row5, Col as Col5 } from "react-bootstrap";
|
|
2621
2844
|
import { FaPalette } from "react-icons/fa";
|
|
2622
|
-
import { jsx as
|
|
2845
|
+
import { jsx as jsx37, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
2623
2846
|
var ColorPicker = ({
|
|
2624
2847
|
selectedColor,
|
|
2625
2848
|
onColorChange,
|
|
2849
|
+
defaultColor,
|
|
2850
|
+
setCor,
|
|
2626
2851
|
presetColors = ["#ff0000", "#ffd700", "#008000", "#0000ff", "#800080"],
|
|
2627
2852
|
title = "Cor de Identifica\xE7\xE3o"
|
|
2628
2853
|
}) => {
|
|
2629
|
-
|
|
2630
|
-
|
|
2854
|
+
var _a, _b;
|
|
2855
|
+
const safeSelectedColor = (_b = (_a = selectedColor != null ? selectedColor : defaultColor) != null ? _a : presetColors[0]) != null ? _b : "#000000";
|
|
2856
|
+
const handleColorChange = (color) => {
|
|
2857
|
+
onColorChange == null ? void 0 : onColorChange(color);
|
|
2858
|
+
setCor == null ? void 0 : setCor(color);
|
|
2859
|
+
};
|
|
2860
|
+
return /* @__PURE__ */ jsxs29(
|
|
2861
|
+
Card5,
|
|
2631
2862
|
{
|
|
2632
2863
|
className: "shadow-sm border-primary-hover mb-3",
|
|
2633
2864
|
style: { maxWidth: "320px", transition: "0.3s" },
|
|
2634
2865
|
children: [
|
|
2635
|
-
/* @__PURE__ */
|
|
2636
|
-
/* @__PURE__ */
|
|
2637
|
-
/* @__PURE__ */
|
|
2866
|
+
/* @__PURE__ */ jsxs29(Card5.Header, { className: "bg-light d-flex align-items-center", children: [
|
|
2867
|
+
/* @__PURE__ */ jsx37(FaPalette, { className: "me-2 text-primary" }),
|
|
2868
|
+
/* @__PURE__ */ jsx37("span", { className: "fw-medium", children: title })
|
|
2638
2869
|
] }),
|
|
2639
|
-
/* @__PURE__ */
|
|
2640
|
-
/* @__PURE__ */
|
|
2641
|
-
/* @__PURE__ */
|
|
2870
|
+
/* @__PURE__ */ jsxs29(Card5.Body, { children: [
|
|
2871
|
+
/* @__PURE__ */ jsxs29(Row5, { className: "g-3 align-items-center mb-3", children: [
|
|
2872
|
+
/* @__PURE__ */ jsx37(Col5, { xs: "auto", children: /* @__PURE__ */ jsx37(
|
|
2642
2873
|
"div",
|
|
2643
2874
|
{
|
|
2644
2875
|
className: "rounded-circle shadow-sm border",
|
|
2645
2876
|
style: {
|
|
2646
2877
|
width: "40px",
|
|
2647
2878
|
height: "40px",
|
|
2648
|
-
backgroundColor:
|
|
2879
|
+
backgroundColor: safeSelectedColor,
|
|
2649
2880
|
cursor: "pointer",
|
|
2650
2881
|
border: "2px solid #dee2e6"
|
|
2651
2882
|
},
|
|
@@ -2656,19 +2887,19 @@ var ColorPicker = ({
|
|
|
2656
2887
|
title: "Clique para abrir o seletor"
|
|
2657
2888
|
}
|
|
2658
2889
|
) }),
|
|
2659
|
-
/* @__PURE__ */
|
|
2660
|
-
|
|
2890
|
+
/* @__PURE__ */ jsx37(Col5, { children: /* @__PURE__ */ jsx37(
|
|
2891
|
+
Form12.Control,
|
|
2661
2892
|
{
|
|
2662
2893
|
type: "color",
|
|
2663
2894
|
id: "color-input-hidden",
|
|
2664
|
-
value:
|
|
2665
|
-
onChange: (e) =>
|
|
2895
|
+
value: safeSelectedColor,
|
|
2896
|
+
onChange: (e) => handleColorChange(e.target.value),
|
|
2666
2897
|
className: "form-control-color-lg",
|
|
2667
2898
|
style: { width: "100%", height: "40px", cursor: "pointer" }
|
|
2668
2899
|
}
|
|
2669
2900
|
) })
|
|
2670
2901
|
] }),
|
|
2671
|
-
/* @__PURE__ */
|
|
2902
|
+
/* @__PURE__ */ jsx37(Row5, { className: "g-2 justify-content-start", children: presetColors.map((cor) => /* @__PURE__ */ jsx37(Col5, { xs: "auto", children: /* @__PURE__ */ jsx37(
|
|
2672
2903
|
"div",
|
|
2673
2904
|
{
|
|
2674
2905
|
className: "rounded-1 shadow-sm",
|
|
@@ -2677,9 +2908,9 @@ var ColorPicker = ({
|
|
|
2677
2908
|
height: "28px",
|
|
2678
2909
|
backgroundColor: cor,
|
|
2679
2910
|
cursor: "pointer",
|
|
2680
|
-
border: cor.toLowerCase() ===
|
|
2911
|
+
border: cor.toLowerCase() === safeSelectedColor.toLowerCase() ? "2px solid #0d6efd" : "1px solid #dee2e6"
|
|
2681
2912
|
},
|
|
2682
|
-
onClick: () =>
|
|
2913
|
+
onClick: () => handleColorChange(cor)
|
|
2683
2914
|
}
|
|
2684
2915
|
) }, cor)) })
|
|
2685
2916
|
] })
|
|
@@ -2689,8 +2920,8 @@ var ColorPicker = ({
|
|
|
2689
2920
|
};
|
|
2690
2921
|
|
|
2691
2922
|
// src/forms/Switch.tsx
|
|
2692
|
-
import { Form as
|
|
2693
|
-
import { jsx as
|
|
2923
|
+
import { Form as Form13 } from "react-bootstrap";
|
|
2924
|
+
import { jsx as jsx38 } from "react/jsx-runtime";
|
|
2694
2925
|
var Switch = ({
|
|
2695
2926
|
label,
|
|
2696
2927
|
onSwitchChange,
|
|
@@ -2699,8 +2930,8 @@ var Switch = ({
|
|
|
2699
2930
|
defaultChecked,
|
|
2700
2931
|
...props
|
|
2701
2932
|
}) => {
|
|
2702
|
-
return /* @__PURE__ */
|
|
2703
|
-
|
|
2933
|
+
return /* @__PURE__ */ jsx38(
|
|
2934
|
+
Form13.Check,
|
|
2704
2935
|
{
|
|
2705
2936
|
...props,
|
|
2706
2937
|
disabled,
|
|
@@ -2714,17 +2945,17 @@ var Switch = ({
|
|
|
2714
2945
|
};
|
|
2715
2946
|
|
|
2716
2947
|
// src/forms/UploadArea.tsx
|
|
2717
|
-
import { useCallback } from "react";
|
|
2948
|
+
import { useCallback as useCallback2 } from "react";
|
|
2718
2949
|
import { useDropzone } from "react-dropzone";
|
|
2719
2950
|
import { FiUploadCloud, FiCheckCircle } from "react-icons/fi";
|
|
2720
|
-
import { Fragment as
|
|
2951
|
+
import { Fragment as Fragment12, jsx as jsx39, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
2721
2952
|
var UploadArea = ({
|
|
2722
2953
|
onFilePut,
|
|
2723
2954
|
anexo,
|
|
2724
2955
|
accept = { "image/jpeg": [], "image/png": [] },
|
|
2725
2956
|
maxSize = 50 * 1024 * 1024
|
|
2726
2957
|
}) => {
|
|
2727
|
-
const onDrop =
|
|
2958
|
+
const onDrop = useCallback2(
|
|
2728
2959
|
(acceptedFiles) => {
|
|
2729
2960
|
const file = acceptedFiles[0];
|
|
2730
2961
|
if (file && typeof onFilePut === "function") {
|
|
@@ -2739,7 +2970,7 @@ var UploadArea = ({
|
|
|
2739
2970
|
accept
|
|
2740
2971
|
});
|
|
2741
2972
|
const hasAnexo = Boolean(anexo);
|
|
2742
|
-
return /* @__PURE__ */
|
|
2973
|
+
return /* @__PURE__ */ jsxs30(
|
|
2743
2974
|
"div",
|
|
2744
2975
|
{
|
|
2745
2976
|
...getRootProps(),
|
|
@@ -2748,23 +2979,23 @@ var UploadArea = ({
|
|
|
2748
2979
|
${hasAnexo ? "upload-has-file" : ""}
|
|
2749
2980
|
`,
|
|
2750
2981
|
children: [
|
|
2751
|
-
/* @__PURE__ */
|
|
2752
|
-
/* @__PURE__ */
|
|
2753
|
-
/* @__PURE__ */
|
|
2754
|
-
hasAnexo ? /* @__PURE__ */
|
|
2755
|
-
/* @__PURE__ */
|
|
2756
|
-
/* @__PURE__ */
|
|
2757
|
-
] }) : /* @__PURE__ */
|
|
2758
|
-
/* @__PURE__ */
|
|
2759
|
-
/* @__PURE__ */
|
|
2982
|
+
/* @__PURE__ */ jsx39("input", { ...getInputProps() }),
|
|
2983
|
+
/* @__PURE__ */ jsxs30("div", { className: "upload-content", children: [
|
|
2984
|
+
/* @__PURE__ */ jsx39("span", { className: "upload-icon", children: hasAnexo ? /* @__PURE__ */ jsx39(FiCheckCircle, { size: 24 }) : /* @__PURE__ */ jsx39(FiUploadCloud, { size: 24 }) }),
|
|
2985
|
+
hasAnexo ? /* @__PURE__ */ jsxs30(Fragment12, { children: [
|
|
2986
|
+
/* @__PURE__ */ jsx39("p", { className: "upload-link", children: "Arquivo anexado" }),
|
|
2987
|
+
/* @__PURE__ */ jsx39("p", { className: "upload-info", children: anexo == null ? void 0 : anexo.name })
|
|
2988
|
+
] }) : /* @__PURE__ */ jsxs30(Fragment12, { children: [
|
|
2989
|
+
/* @__PURE__ */ jsxs30("p", { children: [
|
|
2990
|
+
/* @__PURE__ */ jsx39("span", { className: "upload-link", children: "Adicione" }),
|
|
2760
2991
|
" ou arraste arquivos aqui"
|
|
2761
2992
|
] }),
|
|
2762
|
-
/* @__PURE__ */
|
|
2993
|
+
/* @__PURE__ */ jsxs30("p", { className: "upload-info", children: [
|
|
2763
2994
|
"Formatos aceitos: ",
|
|
2764
|
-
/* @__PURE__ */
|
|
2995
|
+
/* @__PURE__ */ jsx39("b", { children: Object.keys(accept).map((t) => t.split("/")[1].toUpperCase()).join(", ") }),
|
|
2765
2996
|
" | Tamanho m\xE1ximo:",
|
|
2766
2997
|
" ",
|
|
2767
|
-
/* @__PURE__ */
|
|
2998
|
+
/* @__PURE__ */ jsxs30("b", { children: [
|
|
2768
2999
|
(maxSize / (1024 * 1024)).toFixed(0),
|
|
2769
3000
|
"MB"
|
|
2770
3001
|
] })
|
|
@@ -2776,11 +3007,22 @@ var UploadArea = ({
|
|
|
2776
3007
|
);
|
|
2777
3008
|
};
|
|
2778
3009
|
|
|
3010
|
+
// src/index.ts
|
|
3011
|
+
import {
|
|
3012
|
+
AnexoManager
|
|
3013
|
+
} from "@teraprox/ui-kit-core";
|
|
3014
|
+
|
|
3015
|
+
// src/forms/FindRecursoByTagField.tsx
|
|
3016
|
+
import {
|
|
3017
|
+
FindRecursoByTagField,
|
|
3018
|
+
FindRecursoByTagField as FindRecursoByTagField2
|
|
3019
|
+
} from "@teraprox/ui-kit-sgm";
|
|
3020
|
+
|
|
2779
3021
|
// src/forms/SectorSelector.tsx
|
|
2780
|
-
import { useState as
|
|
2781
|
-
import { Form as
|
|
3022
|
+
import { useState as useState17, useEffect as useEffect8 } from "react";
|
|
3023
|
+
import { Form as Form14 } from "react-bootstrap";
|
|
2782
3024
|
import { BsChevronDown, BsChevronUp } from "react-icons/bs";
|
|
2783
|
-
import { jsx as
|
|
3025
|
+
import { jsx as jsx40, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
2784
3026
|
var SectorSelector = ({
|
|
2785
3027
|
setores,
|
|
2786
3028
|
onSectorSelect,
|
|
@@ -2790,9 +3032,9 @@ var SectorSelector = ({
|
|
|
2790
3032
|
defaultSectorName = false,
|
|
2791
3033
|
allowAll = false
|
|
2792
3034
|
}) => {
|
|
2793
|
-
const [expanded, setExpanded] =
|
|
2794
|
-
const [selectedSector, setSelectedSector] =
|
|
2795
|
-
|
|
3035
|
+
const [expanded, setExpanded] = useState17(false);
|
|
3036
|
+
const [selectedSector, setSelectedSector] = useState17(null);
|
|
3037
|
+
useEffect8(() => {
|
|
2796
3038
|
if (defaultSectorName && setores.length > 0) {
|
|
2797
3039
|
const setor = setores.find((s) => s.nome === defaultSectorName);
|
|
2798
3040
|
if (setor && setor.id !== (selectedSector == null ? void 0 : selectedSector.id)) {
|
|
@@ -2812,19 +3054,19 @@ var SectorSelector = ({
|
|
|
2812
3054
|
};
|
|
2813
3055
|
if (hideComponent) return null;
|
|
2814
3056
|
const setorOptions = allowAll ? [{ id: "all", nome: "Todos" }, ...setores] : [...setores];
|
|
2815
|
-
return /* @__PURE__ */
|
|
2816
|
-
/* @__PURE__ */
|
|
2817
|
-
/* @__PURE__ */
|
|
2818
|
-
/* @__PURE__ */
|
|
3057
|
+
return /* @__PURE__ */ jsxs31(Form14.Floating, { className: "sector-selector-floating", children: [
|
|
3058
|
+
/* @__PURE__ */ jsxs31("div", { className: "custom-select-container", onClick: toggleExpand, children: [
|
|
3059
|
+
/* @__PURE__ */ jsx40("span", { className: "selected-sector-label mt-1", children: (selectedSector == null ? void 0 : selectedSector.nome) || selectionPlaceholder }),
|
|
3060
|
+
/* @__PURE__ */ jsx40("div", { className: "zoom-container", children: expanded ? /* @__PURE__ */ jsx40(BsChevronUp, {}) : /* @__PURE__ */ jsx40(BsChevronDown, {}) })
|
|
2819
3061
|
] }),
|
|
2820
|
-
(selectedSector == null ? void 0 : selectedSector.nome) && /* @__PURE__ */
|
|
2821
|
-
expanded && /* @__PURE__ */
|
|
3062
|
+
(selectedSector == null ? void 0 : selectedSector.nome) && /* @__PURE__ */ jsx40("label", { htmlFor: "floatingInputCustom", children: selectionLabel }),
|
|
3063
|
+
expanded && /* @__PURE__ */ jsxs31(
|
|
2822
3064
|
"div",
|
|
2823
3065
|
{
|
|
2824
3066
|
className: "custom-dropdown-menu",
|
|
2825
3067
|
onMouseLeave: () => setExpanded(false),
|
|
2826
3068
|
children: [
|
|
2827
|
-
setorOptions.sort((a, b) => a.nome.localeCompare(b.nome)).map((setor, idx) => /* @__PURE__ */
|
|
3069
|
+
setorOptions.sort((a, b) => a.nome.localeCompare(b.nome)).map((setor, idx) => /* @__PURE__ */ jsx40(
|
|
2828
3070
|
"div",
|
|
2829
3071
|
{
|
|
2830
3072
|
className: `dropdown-option ${setor.nome === (selectedSector == null ? void 0 : selectedSector.nome) ? "selected-option" : ""}`,
|
|
@@ -2833,7 +3075,7 @@ var SectorSelector = ({
|
|
|
2833
3075
|
},
|
|
2834
3076
|
idx
|
|
2835
3077
|
)),
|
|
2836
|
-
setores.length === 0 && /* @__PURE__ */
|
|
3078
|
+
setores.length === 0 && /* @__PURE__ */ jsx40("div", { className: "dropdown-option text-muted italic", children: "Carregando setores..." })
|
|
2837
3079
|
]
|
|
2838
3080
|
}
|
|
2839
3081
|
)
|
|
@@ -2841,8 +3083,8 @@ var SectorSelector = ({
|
|
|
2841
3083
|
};
|
|
2842
3084
|
|
|
2843
3085
|
// src/forms/UnidadeMaterialForm.tsx
|
|
2844
|
-
import { Button as
|
|
2845
|
-
import { jsx as
|
|
3086
|
+
import { Button as Button16 } from "react-bootstrap";
|
|
3087
|
+
import { jsx as jsx41, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
2846
3088
|
var UnidadeMaterialForm = ({
|
|
2847
3089
|
value,
|
|
2848
3090
|
onMaterialSelected,
|
|
@@ -2858,11 +3100,11 @@ var UnidadeMaterialForm = ({
|
|
|
2858
3100
|
hideUnidade = false,
|
|
2859
3101
|
className = ""
|
|
2860
3102
|
}) => {
|
|
2861
|
-
var _a, _b;
|
|
2862
|
-
const renderNewMaterialButton = () => /* @__PURE__ */
|
|
2863
|
-
const renderNewUnidadeButton = () => /* @__PURE__ */
|
|
2864
|
-
return /* @__PURE__ */
|
|
2865
|
-
!hideMaterial && /* @__PURE__ */
|
|
3103
|
+
var _a, _b, _c;
|
|
3104
|
+
const renderNewMaterialButton = () => /* @__PURE__ */ jsx41(Button16, { onClick: onNavigateToCreateMaterial, size: "sm", variant: "outline-primary", children: "Novo Material" });
|
|
3105
|
+
const renderNewUnidadeButton = () => /* @__PURE__ */ jsx41(Button16, { onClick: onNavigateToCreateUnidade, size: "sm", variant: "outline-primary", children: "Nova Unidade" });
|
|
3106
|
+
return /* @__PURE__ */ jsxs32("div", { className: `unidade-material-form ${className}`, children: [
|
|
3107
|
+
!hideMaterial && /* @__PURE__ */ jsx41(
|
|
2866
3108
|
AutoComplete,
|
|
2867
3109
|
{
|
|
2868
3110
|
displayKey: "nome",
|
|
@@ -2874,20 +3116,20 @@ var UnidadeMaterialForm = ({
|
|
|
2874
3116
|
actionButton: onNavigateToCreateMaterial ? renderNewMaterialButton : void 0
|
|
2875
3117
|
}
|
|
2876
3118
|
),
|
|
2877
|
-
!hideQuantidade && /* @__PURE__ */
|
|
3119
|
+
!hideQuantidade && /* @__PURE__ */ jsx41(
|
|
2878
3120
|
FormField,
|
|
2879
3121
|
{
|
|
2880
3122
|
label: "Quantidade",
|
|
2881
|
-
val: value.quantidade
|
|
3123
|
+
val: (_b = value == null ? void 0 : value.quantidade) != null ? _b : "",
|
|
2882
3124
|
onValueUpdate: onQuantidadeUpdate,
|
|
2883
3125
|
ty: "number"
|
|
2884
3126
|
}
|
|
2885
3127
|
),
|
|
2886
|
-
!hideUnidade && /* @__PURE__ */
|
|
3128
|
+
!hideUnidade && /* @__PURE__ */ jsx41(
|
|
2887
3129
|
AutoComplete,
|
|
2888
3130
|
{
|
|
2889
3131
|
displayKey: "nome",
|
|
2890
|
-
value: ((
|
|
3132
|
+
value: ((_c = value == null ? void 0 : value.unidade) == null ? void 0 : _c.nome) || "",
|
|
2891
3133
|
loadCondition: true,
|
|
2892
3134
|
title: "Unidade",
|
|
2893
3135
|
loadFunc: loadUnidadesFunc,
|
|
@@ -2899,7 +3141,7 @@ var UnidadeMaterialForm = ({
|
|
|
2899
3141
|
};
|
|
2900
3142
|
|
|
2901
3143
|
// src/icons/IconLabelItem.tsx
|
|
2902
|
-
import { jsx as
|
|
3144
|
+
import { jsx as jsx42, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
2903
3145
|
var IconLabelItem = ({
|
|
2904
3146
|
icon,
|
|
2905
3147
|
label,
|
|
@@ -2908,16 +3150,16 @@ var IconLabelItem = ({
|
|
|
2908
3150
|
onClick,
|
|
2909
3151
|
style
|
|
2910
3152
|
}) => {
|
|
2911
|
-
return /* @__PURE__ */
|
|
3153
|
+
return /* @__PURE__ */ jsxs33("div", { className: containerClassName, onClick, style: { ...style, cursor: onClick ? "pointer" : "default" }, children: [
|
|
2912
3154
|
icon,
|
|
2913
|
-
/* @__PURE__ */
|
|
3155
|
+
/* @__PURE__ */ jsx42("span", { className: labelClassName, children: label })
|
|
2914
3156
|
] });
|
|
2915
3157
|
};
|
|
2916
3158
|
|
|
2917
3159
|
// src/icons/IconLabelList.tsx
|
|
2918
|
-
import { jsx as
|
|
3160
|
+
import { jsx as jsx43 } from "react/jsx-runtime";
|
|
2919
3161
|
var IconLabelList = ({ items, className = "" }) => {
|
|
2920
|
-
return /* @__PURE__ */
|
|
3162
|
+
return /* @__PURE__ */ jsx43("div", { className: `icon-label-list ${className}`, children: items.map((item, index) => /* @__PURE__ */ jsx43(
|
|
2921
3163
|
IconLabelItem,
|
|
2922
3164
|
{
|
|
2923
3165
|
labelClassName: "icon-label",
|
|
@@ -2931,18 +3173,18 @@ var IconLabelList = ({ items, className = "" }) => {
|
|
|
2931
3173
|
};
|
|
2932
3174
|
|
|
2933
3175
|
// src/icons/NotificationItem.tsx
|
|
2934
|
-
import { useState as
|
|
2935
|
-
import { Modal as Modal4, Button as
|
|
3176
|
+
import { useState as useState18 } from "react";
|
|
3177
|
+
import { Modal as Modal4, Button as Button17, OverlayTrigger, Tooltip as Tooltip3 } from "react-bootstrap";
|
|
2936
3178
|
import { FiClock, FiCheck, FiTrash2 as FiTrash23 } from "react-icons/fi";
|
|
2937
|
-
import
|
|
2938
|
-
import { Fragment as
|
|
3179
|
+
import dayjs5 from "dayjs";
|
|
3180
|
+
import { Fragment as Fragment13, jsx as jsx44, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
2939
3181
|
var NotificationItem = ({
|
|
2940
3182
|
notification,
|
|
2941
3183
|
onRead,
|
|
2942
3184
|
onDismiss,
|
|
2943
3185
|
emptyContentLabel = "Sem conte\xFAdo adicional dispon\xEDvel."
|
|
2944
3186
|
}) => {
|
|
2945
|
-
const [showModal, setShowModal] =
|
|
3187
|
+
const [showModal, setShowModal] = useState18(false);
|
|
2946
3188
|
const { context, contextId, content, status, createdAt, readAt } = notification;
|
|
2947
3189
|
const handleOpenModal = (e) => {
|
|
2948
3190
|
e.stopPropagation();
|
|
@@ -2958,49 +3200,49 @@ var NotificationItem = ({
|
|
|
2958
3200
|
onDismiss(notification);
|
|
2959
3201
|
};
|
|
2960
3202
|
const displayTitle = contextId ? `${context} - ${contextId}` : context || "Notifica\xE7\xE3o";
|
|
2961
|
-
return /* @__PURE__ */
|
|
2962
|
-
/* @__PURE__ */
|
|
3203
|
+
return /* @__PURE__ */ jsxs34(Fragment13, { children: [
|
|
3204
|
+
/* @__PURE__ */ jsxs34(
|
|
2963
3205
|
"div",
|
|
2964
3206
|
{
|
|
2965
3207
|
className: `notification-item-modern ${status === "unread" ? "unread" : ""}`,
|
|
2966
3208
|
onClick: handleOpenModal,
|
|
2967
3209
|
children: [
|
|
2968
|
-
/* @__PURE__ */
|
|
2969
|
-
/* @__PURE__ */
|
|
2970
|
-
/* @__PURE__ */
|
|
2971
|
-
/* @__PURE__ */
|
|
2972
|
-
contextId && /* @__PURE__ */
|
|
2973
|
-
/* @__PURE__ */
|
|
2974
|
-
/* @__PURE__ */
|
|
3210
|
+
/* @__PURE__ */ jsx44("div", { className: `notification-status-indicator ${status}`, children: status === "unread" ? /* @__PURE__ */ jsx44(FiClock, { size: 14 }) : /* @__PURE__ */ jsx44(FiCheck, { size: 14 }) }),
|
|
3211
|
+
/* @__PURE__ */ jsxs34("div", { className: "notification-main-content", children: [
|
|
3212
|
+
/* @__PURE__ */ jsx44("div", { className: "notification-header-row", children: /* @__PURE__ */ jsxs34("div", { className: "notification-title-modern", children: [
|
|
3213
|
+
/* @__PURE__ */ jsx44("span", { className: "notification-context", children: context }),
|
|
3214
|
+
contextId && /* @__PURE__ */ jsxs34(Fragment13, { children: [
|
|
3215
|
+
/* @__PURE__ */ jsx44("span", { className: "notification-separator", children: "/" }),
|
|
3216
|
+
/* @__PURE__ */ jsx44("span", { className: "notification-context-id", children: contextId })
|
|
2975
3217
|
] })
|
|
2976
3218
|
] }) }),
|
|
2977
|
-
/* @__PURE__ */
|
|
2978
|
-
/* @__PURE__ */
|
|
2979
|
-
/* @__PURE__ */
|
|
2980
|
-
/* @__PURE__ */
|
|
2981
|
-
/* @__PURE__ */
|
|
3219
|
+
/* @__PURE__ */ jsx44("div", { className: "notification-preview", children: /* @__PURE__ */ jsx44("p", { className: "notification-content-preview", children: content || "Nova mensagem recebida" }) }),
|
|
3220
|
+
/* @__PURE__ */ jsxs34("div", { className: "notification-meta", children: [
|
|
3221
|
+
/* @__PURE__ */ jsxs34("div", { className: "notification-timestamp", children: [
|
|
3222
|
+
/* @__PURE__ */ jsx44(FiClock, { size: 12, className: "me-1" }),
|
|
3223
|
+
/* @__PURE__ */ jsx44("small", { children: dayjs5(createdAt).format("DD/MM/YYYY HH:mm") })
|
|
2982
3224
|
] }),
|
|
2983
|
-
readAt && /* @__PURE__ */
|
|
2984
|
-
/* @__PURE__ */
|
|
2985
|
-
/* @__PURE__ */
|
|
3225
|
+
readAt && /* @__PURE__ */ jsxs34("div", { className: "notification-read-time", children: [
|
|
3226
|
+
/* @__PURE__ */ jsx44(FiCheck, { size: 12, className: "me-1" }),
|
|
3227
|
+
/* @__PURE__ */ jsxs34("small", { children: [
|
|
2986
3228
|
"Lida em ",
|
|
2987
|
-
|
|
3229
|
+
dayjs5(readAt).format("DD/MM HH:mm")
|
|
2988
3230
|
] })
|
|
2989
3231
|
] })
|
|
2990
3232
|
] })
|
|
2991
3233
|
] }),
|
|
2992
|
-
/* @__PURE__ */
|
|
3234
|
+
/* @__PURE__ */ jsx44("div", { className: "notification-quick-actions", children: status === "unread" && /* @__PURE__ */ jsx44(
|
|
2993
3235
|
OverlayTrigger,
|
|
2994
3236
|
{
|
|
2995
3237
|
placement: "top",
|
|
2996
|
-
overlay: /* @__PURE__ */
|
|
2997
|
-
children: /* @__PURE__ */
|
|
3238
|
+
overlay: /* @__PURE__ */ jsx44(Tooltip3, { children: "Descartar" }),
|
|
3239
|
+
children: /* @__PURE__ */ jsx44(
|
|
2998
3240
|
"button",
|
|
2999
3241
|
{
|
|
3000
3242
|
className: "notification-action-btn notification-dismiss-btn",
|
|
3001
3243
|
onClick: handleDismiss,
|
|
3002
3244
|
"aria-label": "Descartar notifica\xE7\xE3o",
|
|
3003
|
-
children: /* @__PURE__ */
|
|
3245
|
+
children: /* @__PURE__ */ jsx44(FiTrash23, { size: 14 })
|
|
3004
3246
|
}
|
|
3005
3247
|
)
|
|
3006
3248
|
}
|
|
@@ -3008,7 +3250,7 @@ var NotificationItem = ({
|
|
|
3008
3250
|
]
|
|
3009
3251
|
}
|
|
3010
3252
|
),
|
|
3011
|
-
/* @__PURE__ */
|
|
3253
|
+
/* @__PURE__ */ jsxs34(
|
|
3012
3254
|
Modal4,
|
|
3013
3255
|
{
|
|
3014
3256
|
show: showModal,
|
|
@@ -3016,31 +3258,31 @@ var NotificationItem = ({
|
|
|
3016
3258
|
centered: true,
|
|
3017
3259
|
className: "notification-modal",
|
|
3018
3260
|
children: [
|
|
3019
|
-
/* @__PURE__ */
|
|
3020
|
-
status === "unread" ? /* @__PURE__ */
|
|
3261
|
+
/* @__PURE__ */ jsx44(Modal4.Header, { closeButton: true, className: "notification-modal-header", children: /* @__PURE__ */ jsx44(Modal4.Title, { className: "notification-modal-title", children: /* @__PURE__ */ jsxs34("div", { className: "d-flex align-items-center", children: [
|
|
3262
|
+
status === "unread" ? /* @__PURE__ */ jsx44(FiClock, { className: "me-2 text-warning" }) : /* @__PURE__ */ jsx44(FiCheck, { className: "me-2 text-success" }),
|
|
3021
3263
|
"Detalhes da Notifica\xE7\xE3o"
|
|
3022
3264
|
] }) }) }),
|
|
3023
|
-
/* @__PURE__ */
|
|
3024
|
-
/* @__PURE__ */
|
|
3025
|
-
/* @__PURE__ */
|
|
3026
|
-
/* @__PURE__ */
|
|
3027
|
-
/* @__PURE__ */
|
|
3028
|
-
/* @__PURE__ */
|
|
3265
|
+
/* @__PURE__ */ jsx44(Modal4.Body, { className: "notification-modal-body", children: /* @__PURE__ */ jsxs34("div", { className: "notification-modal-content", children: [
|
|
3266
|
+
/* @__PURE__ */ jsxs34("div", { className: "notification-modal-meta", children: [
|
|
3267
|
+
/* @__PURE__ */ jsx44("h6", { className: "notification-modal-source", children: displayTitle }),
|
|
3268
|
+
/* @__PURE__ */ jsxs34("div", { className: "notification-modal-timestamps", children: [
|
|
3269
|
+
/* @__PURE__ */ jsxs34("small", { className: "text-muted", children: [
|
|
3270
|
+
/* @__PURE__ */ jsx44(FiClock, { size: 12, className: "me-1" }),
|
|
3029
3271
|
"Criada em ",
|
|
3030
|
-
|
|
3272
|
+
dayjs5(createdAt).format("DD/MM/YYYY [\xE0s] HH:mm")
|
|
3031
3273
|
] }),
|
|
3032
|
-
readAt && /* @__PURE__ */
|
|
3033
|
-
/* @__PURE__ */
|
|
3274
|
+
readAt && /* @__PURE__ */ jsxs34("small", { className: "text-muted ms-3", children: [
|
|
3275
|
+
/* @__PURE__ */ jsx44(FiCheck, { size: 12, className: "me-1" }),
|
|
3034
3276
|
"Lida em ",
|
|
3035
|
-
|
|
3277
|
+
dayjs5(readAt).format("DD/MM/YYYY [\xE0s] HH:mm")
|
|
3036
3278
|
] })
|
|
3037
3279
|
] })
|
|
3038
3280
|
] }),
|
|
3039
|
-
/* @__PURE__ */
|
|
3281
|
+
/* @__PURE__ */ jsx44("div", { className: "notification-modal-message", children: /* @__PURE__ */ jsx44("p", { className: "mb-0", children: content || emptyContentLabel }) })
|
|
3040
3282
|
] }) }),
|
|
3041
|
-
/* @__PURE__ */
|
|
3042
|
-
/* @__PURE__ */
|
|
3043
|
-
status === "unread" && /* @__PURE__ */
|
|
3283
|
+
/* @__PURE__ */ jsxs34(Modal4.Footer, { className: "notification-modal-footer", children: [
|
|
3284
|
+
/* @__PURE__ */ jsx44(Button17, { variant: "outline-secondary", onClick: handleCloseModal, children: "Fechar" }),
|
|
3285
|
+
status === "unread" && /* @__PURE__ */ jsx44(Button17, { variant: "primary", onClick: handleReadAndClose, children: "Marcar como lida" })
|
|
3044
3286
|
] })
|
|
3045
3287
|
]
|
|
3046
3288
|
}
|
|
@@ -3051,7 +3293,7 @@ var NotificationItem = ({
|
|
|
3051
3293
|
// src/icons/NotificationBell.tsx
|
|
3052
3294
|
import { Dropdown as Dropdown2, Badge as Badge3 } from "react-bootstrap";
|
|
3053
3295
|
import { FiBell } from "react-icons/fi";
|
|
3054
|
-
import { jsx as
|
|
3296
|
+
import { jsx as jsx45, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
3055
3297
|
var NotificationBell = ({
|
|
3056
3298
|
notifications,
|
|
3057
3299
|
onItemRead,
|
|
@@ -3061,10 +3303,10 @@ var NotificationBell = ({
|
|
|
3061
3303
|
className = ""
|
|
3062
3304
|
}) => {
|
|
3063
3305
|
const unreadCount = notifications.filter((n) => n.status === "unread").length;
|
|
3064
|
-
return /* @__PURE__ */
|
|
3065
|
-
/* @__PURE__ */
|
|
3066
|
-
/* @__PURE__ */
|
|
3067
|
-
unreadCount > 0 && /* @__PURE__ */
|
|
3306
|
+
return /* @__PURE__ */ jsxs35(Dropdown2, { align: "end", className: `notification-bell-dropdown ${className}`, children: [
|
|
3307
|
+
/* @__PURE__ */ jsxs35(Dropdown2.Toggle, { as: "div", className: "position-relative cursor-pointer p-2", children: [
|
|
3308
|
+
/* @__PURE__ */ jsx45(FiBell, { size }),
|
|
3309
|
+
unreadCount > 0 && /* @__PURE__ */ jsx45(
|
|
3068
3310
|
Badge3,
|
|
3069
3311
|
{
|
|
3070
3312
|
pill: true,
|
|
@@ -3075,15 +3317,15 @@ var NotificationBell = ({
|
|
|
3075
3317
|
}
|
|
3076
3318
|
)
|
|
3077
3319
|
] }),
|
|
3078
|
-
/* @__PURE__ */
|
|
3320
|
+
/* @__PURE__ */ jsxs35(
|
|
3079
3321
|
Dropdown2.Menu,
|
|
3080
3322
|
{
|
|
3081
3323
|
className: "shadow-lg border-0",
|
|
3082
3324
|
style: { width: "320px", padding: 0, maxHeight: "500px", overflowY: "auto" },
|
|
3083
3325
|
children: [
|
|
3084
|
-
/* @__PURE__ */
|
|
3085
|
-
/* @__PURE__ */
|
|
3086
|
-
unreadCount > 0 && onMarkAllRead && /* @__PURE__ */
|
|
3326
|
+
/* @__PURE__ */ jsxs35("div", { className: "p-3 border-bottom d-flex justify-content-between align-items-center bg-light", children: [
|
|
3327
|
+
/* @__PURE__ */ jsx45("h6", { className: "mb-0 fw-bold", children: "Notifica\xE7\xF5es" }),
|
|
3328
|
+
unreadCount > 0 && onMarkAllRead && /* @__PURE__ */ jsx45(
|
|
3087
3329
|
"button",
|
|
3088
3330
|
{
|
|
3089
3331
|
className: "btn btn-link btn-sm p-0 text-decoration-none",
|
|
@@ -3095,7 +3337,7 @@ var NotificationBell = ({
|
|
|
3095
3337
|
}
|
|
3096
3338
|
)
|
|
3097
3339
|
] }),
|
|
3098
|
-
/* @__PURE__ */
|
|
3340
|
+
/* @__PURE__ */ jsx45("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__ */ jsx45(
|
|
3099
3341
|
NotificationItem,
|
|
3100
3342
|
{
|
|
3101
3343
|
notification: n,
|
|
@@ -3103,11 +3345,11 @@ var NotificationBell = ({
|
|
|
3103
3345
|
onDismiss: onItemDismiss
|
|
3104
3346
|
},
|
|
3105
3347
|
n.id
|
|
3106
|
-
)) : /* @__PURE__ */
|
|
3107
|
-
/* @__PURE__ */
|
|
3108
|
-
/* @__PURE__ */
|
|
3348
|
+
)) : /* @__PURE__ */ jsxs35("div", { className: "p-4 text-center text-muted", children: [
|
|
3349
|
+
/* @__PURE__ */ jsx45(FiBell, { size: 24, className: "mb-2 opacity-25" }),
|
|
3350
|
+
/* @__PURE__ */ jsx45("p", { className: "mb-0 small", children: "Nenhuma notifica\xE7\xE3o por aqui." })
|
|
3109
3351
|
] }) }),
|
|
3110
|
-
notifications.length > 0 && /* @__PURE__ */
|
|
3352
|
+
notifications.length > 0 && /* @__PURE__ */ jsx45("div", { className: "p-2 border-top text-center bg-light", children: /* @__PURE__ */ jsxs35("small", { className: "text-muted", children: [
|
|
3111
3353
|
"Total: ",
|
|
3112
3354
|
notifications.length,
|
|
3113
3355
|
" notifica\xE7\xF5es"
|
|
@@ -3119,8 +3361,8 @@ var NotificationBell = ({
|
|
|
3119
3361
|
};
|
|
3120
3362
|
|
|
3121
3363
|
// src/modals/ModalBasicTemplate.tsx
|
|
3122
|
-
import { Modal as Modal5, Button as
|
|
3123
|
-
import { jsx as
|
|
3364
|
+
import { Modal as Modal5, Button as Button18 } from "react-bootstrap";
|
|
3365
|
+
import { jsx as jsx46, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
3124
3366
|
var ModalBasicTemplate = ({
|
|
3125
3367
|
show,
|
|
3126
3368
|
closeFunc,
|
|
@@ -3134,7 +3376,7 @@ var ModalBasicTemplate = ({
|
|
|
3134
3376
|
if (typeof part === "function") return part();
|
|
3135
3377
|
return part;
|
|
3136
3378
|
};
|
|
3137
|
-
return /* @__PURE__ */
|
|
3379
|
+
return /* @__PURE__ */ jsxs36(
|
|
3138
3380
|
Modal5,
|
|
3139
3381
|
{
|
|
3140
3382
|
show,
|
|
@@ -3143,11 +3385,11 @@ var ModalBasicTemplate = ({
|
|
|
3143
3385
|
style: dialogStyle,
|
|
3144
3386
|
...modalProps,
|
|
3145
3387
|
children: [
|
|
3146
|
-
header && /* @__PURE__ */
|
|
3147
|
-
/* @__PURE__ */
|
|
3148
|
-
footer && /* @__PURE__ */
|
|
3388
|
+
header && /* @__PURE__ */ jsx46(Modal5.Header, { closeButton: true, children: /* @__PURE__ */ jsx46(Modal5.Title, { children: renderPart(header) }) }),
|
|
3389
|
+
/* @__PURE__ */ jsx46(Modal5.Body, { style: bodyStyle, children: renderPart(body) }),
|
|
3390
|
+
footer && /* @__PURE__ */ jsxs36(Modal5.Footer, { children: [
|
|
3149
3391
|
renderPart(footer),
|
|
3150
|
-
!footer && /* @__PURE__ */
|
|
3392
|
+
!footer && /* @__PURE__ */ jsx46(Button18, { variant: "secondary", onClick: closeFunc, children: "Fechar" })
|
|
3151
3393
|
] })
|
|
3152
3394
|
]
|
|
3153
3395
|
}
|
|
@@ -3156,10 +3398,10 @@ var ModalBasicTemplate = ({
|
|
|
3156
3398
|
var ModalBasicTemplate_default = ModalBasicTemplate;
|
|
3157
3399
|
|
|
3158
3400
|
// src/modals/SelectDateModal.tsx
|
|
3159
|
-
import { useState as
|
|
3160
|
-
import { Modal as Modal6, Button as
|
|
3161
|
-
import
|
|
3162
|
-
import { jsx as
|
|
3401
|
+
import { useState as useState19 } from "react";
|
|
3402
|
+
import { Modal as Modal6, Button as Button19, Form as Form15 } from "react-bootstrap";
|
|
3403
|
+
import dayjs6 from "dayjs";
|
|
3404
|
+
import { jsx as jsx47, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
3163
3405
|
var SelectDateModal = ({
|
|
3164
3406
|
show,
|
|
3165
3407
|
onClose,
|
|
@@ -3169,40 +3411,40 @@ var SelectDateModal = ({
|
|
|
3169
3411
|
initialDate,
|
|
3170
3412
|
allowFuture = true
|
|
3171
3413
|
}) => {
|
|
3172
|
-
const [selectedDate, setSelectedDate] =
|
|
3173
|
-
initialDate ||
|
|
3414
|
+
const [selectedDate, setSelectedDate] = useState19(
|
|
3415
|
+
initialDate || dayjs6().format("YYYY-MM-DDTHH:mm")
|
|
3174
3416
|
);
|
|
3175
3417
|
const handleConfirm = () => {
|
|
3176
3418
|
onSelect(selectedDate);
|
|
3177
3419
|
onClose();
|
|
3178
3420
|
};
|
|
3179
|
-
return /* @__PURE__ */
|
|
3180
|
-
/* @__PURE__ */
|
|
3181
|
-
/* @__PURE__ */
|
|
3182
|
-
/* @__PURE__ */
|
|
3183
|
-
/* @__PURE__ */
|
|
3184
|
-
|
|
3421
|
+
return /* @__PURE__ */ jsxs37(Modal6, { show, onHide: onClose, centered: true, size: "sm", children: [
|
|
3422
|
+
/* @__PURE__ */ jsx47(Modal6.Header, { closeButton: true, children: /* @__PURE__ */ jsx47(Modal6.Title, { children: title }) }),
|
|
3423
|
+
/* @__PURE__ */ jsx47(Modal6.Body, { children: /* @__PURE__ */ jsxs37(Form15.Group, { children: [
|
|
3424
|
+
/* @__PURE__ */ jsx47(Form15.Label, { children: label }),
|
|
3425
|
+
/* @__PURE__ */ jsx47(
|
|
3426
|
+
Form15.Control,
|
|
3185
3427
|
{
|
|
3186
3428
|
type: "datetime-local",
|
|
3187
3429
|
value: selectedDate,
|
|
3188
|
-
max: allowFuture ? void 0 :
|
|
3430
|
+
max: allowFuture ? void 0 : dayjs6().format("YYYY-MM-DDTHH:mm"),
|
|
3189
3431
|
onChange: (e) => setSelectedDate(e.target.value)
|
|
3190
3432
|
}
|
|
3191
3433
|
)
|
|
3192
3434
|
] }) }),
|
|
3193
|
-
/* @__PURE__ */
|
|
3194
|
-
/* @__PURE__ */
|
|
3195
|
-
/* @__PURE__ */
|
|
3435
|
+
/* @__PURE__ */ jsxs37(Modal6.Footer, { children: [
|
|
3436
|
+
/* @__PURE__ */ jsx47(Button19, { variant: "outline-secondary", onClick: onClose, children: "Cancelar" }),
|
|
3437
|
+
/* @__PURE__ */ jsx47(Button19, { variant: "primary", onClick: handleConfirm, children: "Confirmar" })
|
|
3196
3438
|
] })
|
|
3197
3439
|
] });
|
|
3198
3440
|
};
|
|
3199
3441
|
|
|
3200
3442
|
// src/modals/JustificativaModal.tsx
|
|
3201
|
-
import { useState as
|
|
3202
|
-
import { Modal as Modal7, Button as
|
|
3443
|
+
import { useState as useState20, useEffect as useEffect9 } from "react";
|
|
3444
|
+
import { Modal as Modal7, Button as Button20, Form as Form16, ListGroup as ListGroup3, Badge as Badge4, OverlayTrigger as OverlayTrigger2, Tooltip as Tooltip4 } from "react-bootstrap";
|
|
3203
3445
|
import { FaTrashAlt, FaUndo } from "react-icons/fa";
|
|
3204
|
-
import
|
|
3205
|
-
import { jsx as
|
|
3446
|
+
import dayjs7 from "dayjs";
|
|
3447
|
+
import { jsx as jsx48, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
3206
3448
|
var JustificativaModal = ({
|
|
3207
3449
|
show,
|
|
3208
3450
|
onClose,
|
|
@@ -3211,10 +3453,10 @@ var JustificativaModal = ({
|
|
|
3211
3453
|
currentUserName,
|
|
3212
3454
|
onUpdateJustificativas
|
|
3213
3455
|
}) => {
|
|
3214
|
-
const [localJustificativas, setLocalJustificativas] =
|
|
3215
|
-
const [novaDescricao, setNovaDescricao] =
|
|
3216
|
-
const [editandoId, setEditandoId] =
|
|
3217
|
-
|
|
3456
|
+
const [localJustificativas, setLocalJustificativas] = useState20(initialJustificativas);
|
|
3457
|
+
const [novaDescricao, setNovaDescricao] = useState20("");
|
|
3458
|
+
const [editandoId, setEditandoId] = useState20(null);
|
|
3459
|
+
useEffect9(() => {
|
|
3218
3460
|
setLocalJustificativas(initialJustificativas);
|
|
3219
3461
|
}, [initialJustificativas]);
|
|
3220
3462
|
const handleAddOrEdit = async () => {
|
|
@@ -3250,14 +3492,14 @@ var JustificativaModal = ({
|
|
|
3250
3492
|
await onUpdateJustificativas(updated);
|
|
3251
3493
|
setLocalJustificativas(updated);
|
|
3252
3494
|
};
|
|
3253
|
-
return /* @__PURE__ */
|
|
3254
|
-
/* @__PURE__ */
|
|
3255
|
-
/* @__PURE__ */
|
|
3256
|
-
/* @__PURE__ */
|
|
3257
|
-
/* @__PURE__ */
|
|
3258
|
-
/* @__PURE__ */
|
|
3259
|
-
/* @__PURE__ */
|
|
3260
|
-
|
|
3495
|
+
return /* @__PURE__ */ jsxs38(Modal7, { show, onHide: onClose, centered: true, size: "lg", children: [
|
|
3496
|
+
/* @__PURE__ */ jsx48(Modal7.Header, { closeButton: true, children: /* @__PURE__ */ jsx48(Modal7.Title, { children: "Justificativas / Coment\xE1rios" }) }),
|
|
3497
|
+
/* @__PURE__ */ jsxs38(Modal7.Body, { children: [
|
|
3498
|
+
/* @__PURE__ */ jsxs38(Form16, { className: "mb-4", children: [
|
|
3499
|
+
/* @__PURE__ */ jsxs38(Form16.Group, { controlId: "justificativaInput", className: "mb-2", children: [
|
|
3500
|
+
/* @__PURE__ */ jsx48(Form16.Label, { className: "small text-muted fw-bold", children: "NOVO REGISTRO" }),
|
|
3501
|
+
/* @__PURE__ */ jsx48(
|
|
3502
|
+
Form16.Control,
|
|
3261
3503
|
{
|
|
3262
3504
|
as: "textarea",
|
|
3263
3505
|
rows: 2,
|
|
@@ -3267,12 +3509,12 @@ var JustificativaModal = ({
|
|
|
3267
3509
|
}
|
|
3268
3510
|
)
|
|
3269
3511
|
] }),
|
|
3270
|
-
/* @__PURE__ */
|
|
3512
|
+
/* @__PURE__ */ jsx48("div", { className: "d-flex justify-content-end", children: /* @__PURE__ */ jsx48(Button20, { variant: "primary", size: "sm", onClick: handleAddOrEdit, children: editandoId ? "Salvar Edi\xE7\xE3o" : "Adicionar Justificativa" }) })
|
|
3271
3513
|
] }),
|
|
3272
|
-
/* @__PURE__ */
|
|
3514
|
+
/* @__PURE__ */ jsx48(ListGroup3, { className: "border-0", children: localJustificativas.map((j) => {
|
|
3273
3515
|
var _a, _b, _c;
|
|
3274
3516
|
const isMe = ((_a = j.user) == null ? void 0 : _a.userId) === currentUserId;
|
|
3275
|
-
return /* @__PURE__ */
|
|
3517
|
+
return /* @__PURE__ */ jsxs38(
|
|
3276
3518
|
ListGroup3.Item,
|
|
3277
3519
|
{
|
|
3278
3520
|
className: "border-0 px-0",
|
|
@@ -3284,11 +3526,11 @@ var JustificativaModal = ({
|
|
|
3284
3526
|
backgroundColor: "transparent"
|
|
3285
3527
|
},
|
|
3286
3528
|
children: [
|
|
3287
|
-
/* @__PURE__ */
|
|
3288
|
-
/* @__PURE__ */
|
|
3289
|
-
/* @__PURE__ */
|
|
3529
|
+
/* @__PURE__ */ jsxs38("div", { className: "d-flex align-items-center mb-1", style: { width: "100%", justifyContent: isMe ? "flex-start" : "flex-end" }, children: [
|
|
3530
|
+
/* @__PURE__ */ jsx48("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" }),
|
|
3531
|
+
/* @__PURE__ */ jsx48(Badge4, { bg: "secondary", style: { fontSize: "0.65rem" }, children: dayjs7(j.createdAt).format("DD/MM [\xE0s] HH:mm") })
|
|
3290
3532
|
] }),
|
|
3291
|
-
/* @__PURE__ */
|
|
3533
|
+
/* @__PURE__ */ jsx48(
|
|
3292
3534
|
"div",
|
|
3293
3535
|
{
|
|
3294
3536
|
onClick: () => !j.removed && isMe && (setNovaDescricao(j.descricao), setEditandoId(j.id)),
|
|
@@ -3307,14 +3549,14 @@ var JustificativaModal = ({
|
|
|
3307
3549
|
children: j.descricao
|
|
3308
3550
|
}
|
|
3309
3551
|
),
|
|
3310
|
-
isMe && /* @__PURE__ */
|
|
3552
|
+
isMe && /* @__PURE__ */ jsx48("div", { className: "mt-1 d-flex gap-2", children: j.removed ? /* @__PURE__ */ jsx48(OverlayTrigger2, { placement: "top", overlay: /* @__PURE__ */ jsx48(Tooltip4, { children: "Desfazer" }), children: /* @__PURE__ */ jsx48(
|
|
3311
3553
|
FaUndo,
|
|
3312
3554
|
{
|
|
3313
3555
|
onClick: () => handleUndoRemove(j.id),
|
|
3314
3556
|
className: "text-success cursor-pointer",
|
|
3315
3557
|
size: 14
|
|
3316
3558
|
}
|
|
3317
|
-
) }) : /* @__PURE__ */
|
|
3559
|
+
) }) : /* @__PURE__ */ jsx48(OverlayTrigger2, { placement: "top", overlay: /* @__PURE__ */ jsx48(Tooltip4, { children: "Remover" }), children: /* @__PURE__ */ jsx48(
|
|
3318
3560
|
FaTrashAlt,
|
|
3319
3561
|
{
|
|
3320
3562
|
onClick: () => handleRemove(j.id),
|
|
@@ -3328,14 +3570,14 @@ var JustificativaModal = ({
|
|
|
3328
3570
|
);
|
|
3329
3571
|
}) })
|
|
3330
3572
|
] }),
|
|
3331
|
-
/* @__PURE__ */
|
|
3573
|
+
/* @__PURE__ */ jsx48(Modal7.Footer, { children: /* @__PURE__ */ jsx48(Button20, { variant: "outline-secondary", onClick: onClose, children: "Fechar" }) })
|
|
3332
3574
|
] });
|
|
3333
3575
|
};
|
|
3334
3576
|
|
|
3335
3577
|
// src/modals/ImageViewModal.tsx
|
|
3336
|
-
import { useState as
|
|
3337
|
-
import { Button as
|
|
3338
|
-
import { jsx as
|
|
3578
|
+
import { useState as useState21, useEffect as useEffect10 } from "react";
|
|
3579
|
+
import { Button as Button21 } from "react-bootstrap";
|
|
3580
|
+
import { jsx as jsx49, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
3339
3581
|
var ImageViewModal = ({
|
|
3340
3582
|
show,
|
|
3341
3583
|
onHide,
|
|
@@ -3344,10 +3586,10 @@ var ImageViewModal = ({
|
|
|
3344
3586
|
imageAltText = "Visualiza\xE7\xE3o de imagem",
|
|
3345
3587
|
resolveImageUrl
|
|
3346
3588
|
}) => {
|
|
3347
|
-
const [selectedImageKey, setSelectedImageKey] =
|
|
3348
|
-
const [imageSrc, setImageSrc] =
|
|
3349
|
-
const [currentAuthor, setCurrentAuthor] =
|
|
3350
|
-
|
|
3589
|
+
const [selectedImageKey, setSelectedImageKey] = useState21(null);
|
|
3590
|
+
const [imageSrc, setImageSrc] = useState21(null);
|
|
3591
|
+
const [currentAuthor, setCurrentAuthor] = useState21("Desconhecido");
|
|
3592
|
+
useEffect10(() => {
|
|
3351
3593
|
if (show && initialImageData) {
|
|
3352
3594
|
setSelectedImageKey(initialImageData.key);
|
|
3353
3595
|
setCurrentAuthor(initialImageData.author || "Desconhecido");
|
|
@@ -3356,7 +3598,7 @@ var ImageViewModal = ({
|
|
|
3356
3598
|
setCurrentAuthor(imagesData[0].author || "Desconhecido");
|
|
3357
3599
|
}
|
|
3358
3600
|
}, [show, initialImageData]);
|
|
3359
|
-
|
|
3601
|
+
useEffect10(() => {
|
|
3360
3602
|
if (show && selectedImageKey) {
|
|
3361
3603
|
setImageSrc(null);
|
|
3362
3604
|
const file = imagesData.find((f) => f.key === selectedImageKey);
|
|
@@ -3369,8 +3611,8 @@ var ImageViewModal = ({
|
|
|
3369
3611
|
}, [show, selectedImageKey]);
|
|
3370
3612
|
const renderImageSelector = () => {
|
|
3371
3613
|
if (imagesData.length <= 1) return null;
|
|
3372
|
-
return /* @__PURE__ */
|
|
3373
|
-
|
|
3614
|
+
return /* @__PURE__ */ jsx49("div", { className: "mb-3 d-flex flex-wrap justify-content-center gap-2", children: imagesData.map((img, idx) => /* @__PURE__ */ jsx49(
|
|
3615
|
+
Button21,
|
|
3374
3616
|
{
|
|
3375
3617
|
variant: selectedImageKey === img.key ? "primary" : "outline-secondary",
|
|
3376
3618
|
size: "sm",
|
|
@@ -3383,9 +3625,9 @@ var ImageViewModal = ({
|
|
|
3383
3625
|
idx
|
|
3384
3626
|
)) });
|
|
3385
3627
|
};
|
|
3386
|
-
const body = /* @__PURE__ */
|
|
3628
|
+
const body = /* @__PURE__ */ jsxs39("div", { className: "text-center", children: [
|
|
3387
3629
|
renderImageSelector(),
|
|
3388
|
-
imageSrc ? /* @__PURE__ */
|
|
3630
|
+
imageSrc ? /* @__PURE__ */ jsx49(
|
|
3389
3631
|
"img",
|
|
3390
3632
|
{
|
|
3391
3633
|
src: imageSrc,
|
|
@@ -3393,9 +3635,9 @@ var ImageViewModal = ({
|
|
|
3393
3635
|
className: "img-fluid rounded shadow-sm",
|
|
3394
3636
|
style: { maxHeight: "75vh", objectFit: "contain" }
|
|
3395
3637
|
}
|
|
3396
|
-
) : /* @__PURE__ */
|
|
3638
|
+
) : /* @__PURE__ */ jsx49("div", { className: "p-5 text-muted", children: "Aguardando imagem..." })
|
|
3397
3639
|
] });
|
|
3398
|
-
return /* @__PURE__ */
|
|
3640
|
+
return /* @__PURE__ */ jsx49(
|
|
3399
3641
|
ModalBasicTemplate_default,
|
|
3400
3642
|
{
|
|
3401
3643
|
header: "Visualiza\xE7\xE3o de Imagem",
|
|
@@ -3403,21 +3645,169 @@ var ImageViewModal = ({
|
|
|
3403
3645
|
show,
|
|
3404
3646
|
body,
|
|
3405
3647
|
props: { size: "lg" },
|
|
3406
|
-
footer: () => /* @__PURE__ */
|
|
3407
|
-
/* @__PURE__ */
|
|
3648
|
+
footer: () => /* @__PURE__ */ jsxs39("div", { className: "w-100 d-flex justify-content-between align-items-center", children: [
|
|
3649
|
+
/* @__PURE__ */ jsxs39("small", { className: "text-muted", children: [
|
|
3408
3650
|
"Enviado por: ",
|
|
3409
|
-
/* @__PURE__ */
|
|
3651
|
+
/* @__PURE__ */ jsx49("strong", { children: currentAuthor })
|
|
3410
3652
|
] }),
|
|
3411
|
-
/* @__PURE__ */
|
|
3653
|
+
/* @__PURE__ */ jsx49(Button21, { variant: "outline-secondary", size: "sm", onClick: onHide, children: "Fechar" })
|
|
3412
3654
|
] })
|
|
3413
3655
|
}
|
|
3414
3656
|
);
|
|
3415
3657
|
};
|
|
3416
3658
|
|
|
3659
|
+
// src/qr/QrReader.tsx
|
|
3660
|
+
import QrScanner from "qr-scanner";
|
|
3661
|
+
import { useEffect as useEffect11, useRef as useRef5, useState as useState22 } from "react";
|
|
3662
|
+
import { jsx as jsx50, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
3663
|
+
var QrReader = ({ callback }) => {
|
|
3664
|
+
const scanner = useRef5(null);
|
|
3665
|
+
const videoEl = useRef5(null);
|
|
3666
|
+
const qrBoxEl = useRef5(null);
|
|
3667
|
+
const [qrOn, setQrOn] = useState22(true);
|
|
3668
|
+
const [scannedResult, setScannedResult] = useState22("");
|
|
3669
|
+
const onScanSuccess = (result) => {
|
|
3670
|
+
setScannedResult(result.data);
|
|
3671
|
+
callback(result.data);
|
|
3672
|
+
};
|
|
3673
|
+
const onScanFail = (err) => {
|
|
3674
|
+
if (typeof err === "string" && !err.includes("No QR code found")) {
|
|
3675
|
+
console.error("QR Scanner Error:", err);
|
|
3676
|
+
}
|
|
3677
|
+
};
|
|
3678
|
+
useEffect11(() => {
|
|
3679
|
+
if (videoEl.current && !scanner.current) {
|
|
3680
|
+
scanner.current = new QrScanner(videoEl.current, onScanSuccess, {
|
|
3681
|
+
onDecodeError: onScanFail,
|
|
3682
|
+
preferredCamera: "environment",
|
|
3683
|
+
highlightScanRegion: true,
|
|
3684
|
+
highlightCodeOutline: true,
|
|
3685
|
+
overlay: qrBoxEl.current || void 0
|
|
3686
|
+
});
|
|
3687
|
+
scanner.current.start().then(() => setQrOn(true)).catch((err) => {
|
|
3688
|
+
console.error("Failed to start QR Scanner:", err);
|
|
3689
|
+
setQrOn(false);
|
|
3690
|
+
});
|
|
3691
|
+
}
|
|
3692
|
+
return () => {
|
|
3693
|
+
if (scanner.current) {
|
|
3694
|
+
scanner.current.stop();
|
|
3695
|
+
scanner.current.destroy();
|
|
3696
|
+
scanner.current = null;
|
|
3697
|
+
}
|
|
3698
|
+
};
|
|
3699
|
+
}, []);
|
|
3700
|
+
useEffect11(() => {
|
|
3701
|
+
if (!qrOn) {
|
|
3702
|
+
alert(
|
|
3703
|
+
"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."
|
|
3704
|
+
);
|
|
3705
|
+
}
|
|
3706
|
+
}, [qrOn]);
|
|
3707
|
+
return /* @__PURE__ */ jsxs40("div", { className: "qr-reader", style: { position: "relative", width: "100%", maxWidth: "500px", margin: "0 auto" }, children: [
|
|
3708
|
+
/* @__PURE__ */ jsx50("video", { ref: videoEl, style: { width: "100%", borderRadius: "8px" } }),
|
|
3709
|
+
/* @__PURE__ */ jsx50("div", { ref: qrBoxEl, className: "qr-box" }),
|
|
3710
|
+
scannedResult && /* @__PURE__ */ jsxs40(
|
|
3711
|
+
"div",
|
|
3712
|
+
{
|
|
3713
|
+
style: {
|
|
3714
|
+
position: "absolute",
|
|
3715
|
+
top: 10,
|
|
3716
|
+
left: 10,
|
|
3717
|
+
zIndex: 10,
|
|
3718
|
+
background: "rgba(0,0,0,0.6)",
|
|
3719
|
+
color: "white",
|
|
3720
|
+
padding: "4px 8px",
|
|
3721
|
+
borderRadius: "4px",
|
|
3722
|
+
fontSize: "0.8rem"
|
|
3723
|
+
},
|
|
3724
|
+
children: [
|
|
3725
|
+
"Lido: ",
|
|
3726
|
+
scannedResult
|
|
3727
|
+
]
|
|
3728
|
+
}
|
|
3729
|
+
)
|
|
3730
|
+
] });
|
|
3731
|
+
};
|
|
3732
|
+
|
|
3733
|
+
// src/qr/QrCodeScanButton.tsx
|
|
3734
|
+
import { useState as useState23 } from "react";
|
|
3735
|
+
import { BsQrCode } from "react-icons/bs";
|
|
3736
|
+
import { jsx as jsx51, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
3737
|
+
var QrCodeScanButton = ({ callback, size = 25 }) => {
|
|
3738
|
+
const [showQr, setShowQr] = useState23(false);
|
|
3739
|
+
const toggleQr = () => {
|
|
3740
|
+
setShowQr((prev) => !prev);
|
|
3741
|
+
};
|
|
3742
|
+
return /* @__PURE__ */ jsxs41(
|
|
3743
|
+
"div",
|
|
3744
|
+
{
|
|
3745
|
+
className: "hoverable-div",
|
|
3746
|
+
style: {
|
|
3747
|
+
border: "solid",
|
|
3748
|
+
borderTopRightRadius: "3px",
|
|
3749
|
+
borderBottomRightRadius: "3px",
|
|
3750
|
+
padding: "8px",
|
|
3751
|
+
borderLeft: "none",
|
|
3752
|
+
borderColor: "#ccc",
|
|
3753
|
+
borderWidth: "1px",
|
|
3754
|
+
cursor: "pointer",
|
|
3755
|
+
display: "flex",
|
|
3756
|
+
alignItems: "center"
|
|
3757
|
+
},
|
|
3758
|
+
onClick: toggleQr,
|
|
3759
|
+
children: [
|
|
3760
|
+
/* @__PURE__ */ jsx51(BsQrCode, { size }),
|
|
3761
|
+
showQr && /* @__PURE__ */ jsx51(
|
|
3762
|
+
"div",
|
|
3763
|
+
{
|
|
3764
|
+
style: {
|
|
3765
|
+
position: "fixed",
|
|
3766
|
+
top: 0,
|
|
3767
|
+
left: 0,
|
|
3768
|
+
right: 0,
|
|
3769
|
+
bottom: 0,
|
|
3770
|
+
backgroundColor: "rgba(0,0,0,0.8)",
|
|
3771
|
+
zIndex: 9999,
|
|
3772
|
+
display: "flex",
|
|
3773
|
+
flexDirection: "column",
|
|
3774
|
+
alignItems: "center",
|
|
3775
|
+
justifyContent: "center",
|
|
3776
|
+
padding: "20px"
|
|
3777
|
+
},
|
|
3778
|
+
onClick: (e) => e.stopPropagation(),
|
|
3779
|
+
children: /* @__PURE__ */ jsxs41("div", { style: { width: "100%", maxWidth: "500px", backgroundColor: "#fff", borderRadius: "12px", padding: "20px", position: "relative" }, children: [
|
|
3780
|
+
/* @__PURE__ */ jsx51(
|
|
3781
|
+
"div",
|
|
3782
|
+
{
|
|
3783
|
+
onClick: toggleQr,
|
|
3784
|
+
style: { position: "absolute", top: "10px", right: "15px", fontSize: "1.5rem", cursor: "pointer", zIndex: 10001 },
|
|
3785
|
+
children: "\xD7"
|
|
3786
|
+
}
|
|
3787
|
+
),
|
|
3788
|
+
/* @__PURE__ */ jsx51("h5", { className: "mb-3 text-center", children: "Escaneie o QR Code" }),
|
|
3789
|
+
/* @__PURE__ */ jsx51(
|
|
3790
|
+
QrReader,
|
|
3791
|
+
{
|
|
3792
|
+
callback: (v) => {
|
|
3793
|
+
toggleQr();
|
|
3794
|
+
callback(v);
|
|
3795
|
+
}
|
|
3796
|
+
}
|
|
3797
|
+
),
|
|
3798
|
+
/* @__PURE__ */ jsx51("p", { className: "mt-3 text-muted text-center small", children: "Aponte a c\xE2mera para o c\xF3digo" })
|
|
3799
|
+
] })
|
|
3800
|
+
}
|
|
3801
|
+
)
|
|
3802
|
+
]
|
|
3803
|
+
}
|
|
3804
|
+
);
|
|
3805
|
+
};
|
|
3806
|
+
|
|
3417
3807
|
// src/tables/ReusableTableWithModal.tsx
|
|
3418
|
-
import { useState as
|
|
3419
|
-
import { Table, Button as
|
|
3420
|
-
import { Fragment as
|
|
3808
|
+
import { useState as useState24, useEffect as useEffect12 } from "react";
|
|
3809
|
+
import { Table, Button as Button22, Modal as Modal8 } from "react-bootstrap";
|
|
3810
|
+
import { Fragment as Fragment14, jsx as jsx52, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
3421
3811
|
var ReusableTableWithModal = ({
|
|
3422
3812
|
fetchDataCallback,
|
|
3423
3813
|
modalButtonCallback,
|
|
@@ -3427,11 +3817,11 @@ var ReusableTableWithModal = ({
|
|
|
3427
3817
|
confirmLabel = "Aceitar",
|
|
3428
3818
|
onFetchData
|
|
3429
3819
|
}) => {
|
|
3430
|
-
const [data, setData] =
|
|
3431
|
-
const [selectedItem, setSelectedItem] =
|
|
3432
|
-
const [showModal, setShowModal] =
|
|
3433
|
-
const [loading, setLoading] =
|
|
3434
|
-
const [tableDataRows, setTableDataRows] =
|
|
3820
|
+
const [data, setData] = useState24([]);
|
|
3821
|
+
const [selectedItem, setSelectedItem] = useState24(null);
|
|
3822
|
+
const [showModal, setShowModal] = useState24(false);
|
|
3823
|
+
const [loading, setLoading] = useState24(false);
|
|
3824
|
+
const [tableDataRows, setTableDataRows] = useState24([]);
|
|
3435
3825
|
const fetchData = async () => {
|
|
3436
3826
|
setLoading(true);
|
|
3437
3827
|
try {
|
|
@@ -3458,8 +3848,8 @@ var ReusableTableWithModal = ({
|
|
|
3458
3848
|
setShowModal(false);
|
|
3459
3849
|
setSelectedItem(null);
|
|
3460
3850
|
};
|
|
3461
|
-
return /* @__PURE__ */
|
|
3462
|
-
/* @__PURE__ */
|
|
3851
|
+
return /* @__PURE__ */ jsxs42(Fragment14, { children: [
|
|
3852
|
+
/* @__PURE__ */ jsxs42(Table, { striped: true, bordered: true, hover: true, responsive: true, children: [
|
|
3463
3853
|
/* @__PURE__ */ jsx52("thead", { children: /* @__PURE__ */ jsx52("tr", { children: headers.map((col, index) => /* @__PURE__ */ jsx52("th", { children: col }, index)) }) }),
|
|
3464
3854
|
/* @__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
3855
|
"tr",
|
|
@@ -3471,13 +3861,13 @@ var ReusableTableWithModal = ({
|
|
|
3471
3861
|
index
|
|
3472
3862
|
)) : /* @__PURE__ */ jsx52("tr", { children: /* @__PURE__ */ jsx52("td", { colSpan: headers.length, className: "text-center py-4", children: "Nenhum dado encontrado." }) }) })
|
|
3473
3863
|
] }),
|
|
3474
|
-
/* @__PURE__ */
|
|
3864
|
+
/* @__PURE__ */ jsxs42(Modal8, { show: showModal, onHide: handleCloseModal, centered: true, children: [
|
|
3475
3865
|
/* @__PURE__ */ jsx52(Modal8.Header, { closeButton: true, children: /* @__PURE__ */ jsx52(Modal8.Title, { children: "Detalhes" }) }),
|
|
3476
3866
|
/* @__PURE__ */ jsx52(Modal8.Body, { children: selectedItem && /* @__PURE__ */ jsx52("div", { children: modalContent ? modalContent(selectedItem) : "Visualizando detalhes do item." }) }),
|
|
3477
|
-
/* @__PURE__ */
|
|
3478
|
-
/* @__PURE__ */ jsx52(
|
|
3867
|
+
/* @__PURE__ */ jsxs42(Modal8.Footer, { children: [
|
|
3868
|
+
/* @__PURE__ */ jsx52(Button22, { variant: "outline-secondary", onClick: handleCloseModal, children: "Fechar" }),
|
|
3479
3869
|
modalButtonCallback && /* @__PURE__ */ jsx52(
|
|
3480
|
-
|
|
3870
|
+
Button22,
|
|
3481
3871
|
{
|
|
3482
3872
|
variant: "primary",
|
|
3483
3873
|
onClick: () => {
|
|
@@ -3493,25 +3883,25 @@ var ReusableTableWithModal = ({
|
|
|
3493
3883
|
};
|
|
3494
3884
|
|
|
3495
3885
|
// src/text/TextWithMore.tsx
|
|
3496
|
-
import { useState as
|
|
3497
|
-
import { Button as
|
|
3498
|
-
import { Fragment as
|
|
3886
|
+
import { useState as useState25 } from "react";
|
|
3887
|
+
import { Button as Button23 } from "react-bootstrap";
|
|
3888
|
+
import { Fragment as Fragment15, jsx as jsx53, jsxs as jsxs43 } from "react/jsx-runtime";
|
|
3499
3889
|
var TextWithMore = ({
|
|
3500
3890
|
text = "Carregando...",
|
|
3501
3891
|
maxLength,
|
|
3502
3892
|
moreLabel = "ver mais",
|
|
3503
3893
|
lessLabel = "ver menos"
|
|
3504
3894
|
}) => {
|
|
3505
|
-
const [expanded, setExpanded] =
|
|
3895
|
+
const [expanded, setExpanded] = useState25(false);
|
|
3506
3896
|
const handleToggleExpand = () => {
|
|
3507
3897
|
setExpanded(!expanded);
|
|
3508
3898
|
};
|
|
3509
3899
|
const isTruncated = text.length > maxLength;
|
|
3510
3900
|
const displayText = isTruncated && !expanded ? text.slice(0, maxLength) + "\u2026" : text;
|
|
3511
|
-
return /* @__PURE__ */
|
|
3901
|
+
return /* @__PURE__ */ jsxs43(Fragment15, { children: [
|
|
3512
3902
|
/* @__PURE__ */ jsx53("span", { className: "text-with-more-content", children: displayText }),
|
|
3513
3903
|
isTruncated && /* @__PURE__ */ jsx53(
|
|
3514
|
-
|
|
3904
|
+
Button23,
|
|
3515
3905
|
{
|
|
3516
3906
|
variant: "link",
|
|
3517
3907
|
className: "p-0 ms-2",
|
|
@@ -3522,15 +3912,30 @@ var TextWithMore = ({
|
|
|
3522
3912
|
)
|
|
3523
3913
|
] });
|
|
3524
3914
|
};
|
|
3915
|
+
|
|
3916
|
+
// src/index.ts
|
|
3917
|
+
import {
|
|
3918
|
+
CalculoCorrecao,
|
|
3919
|
+
CalculadoraCorrecaoModal,
|
|
3920
|
+
UnidadeMaterialCard,
|
|
3921
|
+
TarefaUnidadeForm,
|
|
3922
|
+
FrequenciaFormV2,
|
|
3923
|
+
CampoDeVerificacaoV2
|
|
3924
|
+
} from "@teraprox/ui-kit-sgp";
|
|
3525
3925
|
export {
|
|
3526
3926
|
ActionButtons,
|
|
3527
3927
|
AddButton_default as AddButton,
|
|
3528
3928
|
AdvancedFilterBar,
|
|
3929
|
+
AnexoManager,
|
|
3529
3930
|
ApproveAndReproveButtons,
|
|
3530
3931
|
AsyncButton,
|
|
3531
3932
|
AutoComplete,
|
|
3532
3933
|
BonusButton,
|
|
3934
|
+
BranchDropDisplay,
|
|
3533
3935
|
ButtonWithDropdown,
|
|
3936
|
+
CalculadoraCorrecaoModal,
|
|
3937
|
+
CalculoCorrecao,
|
|
3938
|
+
CampoDeVerificacaoV2,
|
|
3534
3939
|
CheckBox,
|
|
3535
3940
|
ClickToWriteField,
|
|
3536
3941
|
ColorPicker,
|
|
@@ -3540,6 +3945,7 @@ export {
|
|
|
3540
3945
|
ExpandableCard,
|
|
3541
3946
|
FindRecursoByTagField,
|
|
3542
3947
|
FormField,
|
|
3948
|
+
FrequenciaFormV2,
|
|
3543
3949
|
Generic3DotMenu,
|
|
3544
3950
|
GenericChart,
|
|
3545
3951
|
GenericDisplay_default as GenericDisplay,
|
|
@@ -3562,6 +3968,7 @@ export {
|
|
|
3562
3968
|
PeriodSelector,
|
|
3563
3969
|
QrCodeScanButton,
|
|
3564
3970
|
QrReader,
|
|
3971
|
+
RateLimitBar,
|
|
3565
3972
|
RecursoDisplayer,
|
|
3566
3973
|
ResponsiveContainer_default as ResponsiveContainer,
|
|
3567
3974
|
ReusableTableWithModal,
|
|
@@ -3573,9 +3980,12 @@ export {
|
|
|
3573
3980
|
StatusPills,
|
|
3574
3981
|
Switch,
|
|
3575
3982
|
SwitchOnClick,
|
|
3983
|
+
TarefaUnidadeForm,
|
|
3576
3984
|
TextWithMore,
|
|
3577
3985
|
TimerDisplay,
|
|
3986
|
+
UnidadeMaterialCard,
|
|
3578
3987
|
UnidadeMaterialForm,
|
|
3988
|
+
UnifiedPeriodSelector,
|
|
3579
3989
|
UploadArea,
|
|
3580
3990
|
UuidPill_default as UuidPill,
|
|
3581
3991
|
VerticalItemsDisplay
|