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