react-ecosistema-unp 1.7.17 → 1.7.19
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/lib/tables/tabla-registros/TablaRegistros.d.ts +1 -0
- package/dist/lib/tables/tabla-registros/tabla/Tabla.d.ts +1 -0
- package/dist/tables/tabla-registros/TablaRegistros.js +263 -261
- package/dist/tables/tabla-registros/tabla/Tabla.js +32 -30
- package/dist/utils/components/ProtectedRoute.js +30 -29
- package/dist/utils/components/UserRoute.js +19 -15
- package/package.json +1 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsx as s, jsxs as d } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
import { v as
|
|
4
|
-
import { a as
|
|
5
|
-
import { T as
|
|
6
|
-
import { F as
|
|
7
|
-
import { B as
|
|
8
|
-
import '../../../assets/Tabla.css';const
|
|
2
|
+
import Q, { useState as m, useEffect as S } from "react";
|
|
3
|
+
import { v as X, w as Y } from "../../../index-DDjnZyBf.js";
|
|
4
|
+
import { a as Z, b as w, c as ee, d as te } from "../../../index-D3WseyJh.js";
|
|
5
|
+
import { T as re } from "../../../Table-C5ydZooy.js";
|
|
6
|
+
import { F as se, a as oe } from "../../../FormGroup-BLpFcIN5.js";
|
|
7
|
+
import { B as ie } from "../../../Button-B87TJYml.js";
|
|
8
|
+
import '../../../assets/Tabla.css';const ge = ({
|
|
9
9
|
columns: u,
|
|
10
10
|
displayedData: f,
|
|
11
11
|
// tableData,
|
|
@@ -23,16 +23,18 @@ import '../../../assets/Tabla.css';const pe = ({
|
|
|
23
23
|
enableColumnSorter: T,
|
|
24
24
|
//
|
|
25
25
|
onSelectionChange: C,
|
|
26
|
-
enableRowSelection: h = !1
|
|
26
|
+
enableRowSelection: h = !1,
|
|
27
|
+
// Indicador para aumentar la selección de casos por gestionar
|
|
28
|
+
extendedSelection: P
|
|
27
29
|
}) => {
|
|
28
|
-
const [l,
|
|
30
|
+
const [l, U] = m({
|
|
29
31
|
key: null,
|
|
30
32
|
direction: null
|
|
31
|
-
}), [c,
|
|
32
|
-
|
|
33
|
+
}), [c, V] = m([]), [y, _] = m(null), [k, B] = m(null);
|
|
34
|
+
S(() => {
|
|
33
35
|
C == null || C(c);
|
|
34
36
|
}, [c]);
|
|
35
|
-
const
|
|
37
|
+
const W = (e, o) => {
|
|
36
38
|
const r = k || H, i = r.findIndex((p) => p.numeroRegistro === e);
|
|
37
39
|
if (i === -1) return;
|
|
38
40
|
const n = r[i], t = c.includes(e);
|
|
@@ -41,27 +43,27 @@ import '../../../assets/Tabla.css';const pe = ({
|
|
|
41
43
|
a = c.filter((p) => p !== e), a.length === 0 && (B(null), _(null));
|
|
42
44
|
else if (c.length === 0) {
|
|
43
45
|
a = [e], _(n.tipoMesa);
|
|
44
|
-
const p = n.tipoMesa,
|
|
45
|
-
B([...
|
|
46
|
+
const p = n.tipoMesa, J = r.filter((g) => g.tipoMesa === p && g.numeroRegistro !== e), j = r.filter((g) => g.tipoMesa !== p), E = r.findIndex((g) => g.numeroRegistro === e), K = j.slice(0, E), L = j.slice(E);
|
|
47
|
+
B([...K, n, ...J, ...L]);
|
|
46
48
|
} else {
|
|
47
49
|
if (y && n.tipoMesa !== y) return;
|
|
48
50
|
a = [...c, e];
|
|
49
51
|
}
|
|
50
|
-
|
|
52
|
+
V(a);
|
|
51
53
|
}, A = { i: 0 }, G = (e) => {
|
|
52
54
|
if (v) {
|
|
53
55
|
const o = e / v * 100;
|
|
54
56
|
return o <= 25 ? { backgroundColor: "#3AB34A", color: "#FFFFFF" } : o <= 50 ? { backgroundColor: "#F8EB10", color: "#000000" } : o <= 75 ? { backgroundColor: "#F79122", color: "#000000" } : { backgroundColor: "#E91720", color: "#FFFFFF" };
|
|
55
57
|
}
|
|
56
58
|
return { backgroundColor: "transparent", color: "inherit" };
|
|
57
|
-
},
|
|
59
|
+
}, $ = (e) => {
|
|
58
60
|
const { scrollTop: o, clientHeight: r, scrollHeight: i } = e.currentTarget;
|
|
59
61
|
i - o <= r + 50 && x && D((n) => {
|
|
60
62
|
const t = n + 5;
|
|
61
63
|
return t >= f.length && z(!1), Math.min(t, f.length);
|
|
62
64
|
});
|
|
63
|
-
},
|
|
64
|
-
|
|
65
|
+
}, q = (e) => {
|
|
66
|
+
U((o) => ({
|
|
65
67
|
key: e,
|
|
66
68
|
direction: o.key === e && o.direction === "asc" ? "desc" : "asc"
|
|
67
69
|
}));
|
|
@@ -82,7 +84,7 @@ import '../../../assets/Tabla.css';const pe = ({
|
|
|
82
84
|
return typeof r == "number" && typeof i == "number" ? l.direction === "asc" ? r - i : i - r : typeof r == "string" && typeof i == "string" ? l.direction === "asc" ? r.localeCompare(i) : i.localeCompare(r) : 0;
|
|
83
85
|
});
|
|
84
86
|
})(), F = k || (l.direction === "asc" || l.direction === "desc" ? H : f);
|
|
85
|
-
return /* @__PURE__ */ s("div", { className: "table_container", children: /* @__PURE__ */ s("div", { className: "table-scroll", onScroll:
|
|
87
|
+
return /* @__PURE__ */ s("div", { className: "table_container", children: /* @__PURE__ */ s("div", { className: "table-scroll", onScroll: $, children: /* @__PURE__ */ d(re, { striped: !0, hover: !0, children: [
|
|
86
88
|
/* @__PURE__ */ d("thead", { children: [
|
|
87
89
|
/* @__PURE__ */ d("tr", { children: [
|
|
88
90
|
h && /* @__PURE__ */ s("th", { className: "table-header-unp" }),
|
|
@@ -90,12 +92,12 @@ import '../../../assets/Tabla.css';const pe = ({
|
|
|
90
92
|
"th",
|
|
91
93
|
{
|
|
92
94
|
className: "table-header-unp",
|
|
93
|
-
onClick: () => (e.sorter || T) &&
|
|
95
|
+
onClick: () => (e.sorter || T) && q(e.key),
|
|
94
96
|
style: { cursor: N ? "pointer" : "default" },
|
|
95
97
|
children: [
|
|
96
98
|
e.label,
|
|
97
99
|
" ",
|
|
98
|
-
c.length == 0 && (e.sorter || T) ? l.key === e.key ? l.direction === "asc" ? /* @__PURE__ */ s(
|
|
100
|
+
c.length == 0 && (e.sorter || T) ? l.key === e.key ? l.direction === "asc" ? /* @__PURE__ */ s(Z, {}) : /* @__PURE__ */ s(w, {}) : /* @__PURE__ */ s(ee, {}) : null
|
|
99
101
|
]
|
|
100
102
|
},
|
|
101
103
|
o
|
|
@@ -103,9 +105,9 @@ import '../../../assets/Tabla.css';const pe = ({
|
|
|
103
105
|
] }),
|
|
104
106
|
c.length == 0 && N && /* @__PURE__ */ d("tr", { children: [
|
|
105
107
|
h && /* @__PURE__ */ s("th", { className: "table-header-unp" }),
|
|
106
|
-
u.map((e, o) => /* @__PURE__ */ s("th", { children: /* @__PURE__ */ d(
|
|
108
|
+
u.map((e, o) => /* @__PURE__ */ s("th", { children: /* @__PURE__ */ d(se, { className: "mx-1 position-relative", children: [
|
|
107
109
|
/* @__PURE__ */ s(
|
|
108
|
-
|
|
110
|
+
oe,
|
|
109
111
|
{
|
|
110
112
|
type: "text",
|
|
111
113
|
placeholder: `Buscar ${e.label}`,
|
|
@@ -115,7 +117,7 @@ import '../../../assets/Tabla.css';const pe = ({
|
|
|
115
117
|
}
|
|
116
118
|
),
|
|
117
119
|
R[e.key] && /* @__PURE__ */ s(
|
|
118
|
-
|
|
120
|
+
ie,
|
|
119
121
|
{
|
|
120
122
|
variant: "link",
|
|
121
123
|
size: "sm",
|
|
@@ -131,9 +133,9 @@ import '../../../assets/Tabla.css';const pe = ({
|
|
|
131
133
|
/* @__PURE__ */ d("tbody", { children: [
|
|
132
134
|
F.slice(0, I).map((e, o) => {
|
|
133
135
|
let r = !1;
|
|
134
|
-
b ? e.estadoRegistro === "en_gestion" ? r = !0 : e.estadoRegistro === "por_gestionar" && A.i < 5 && (r = !0, A.i++) : r = !0;
|
|
136
|
+
b ? e.estadoRegistro === "en_gestion" ? r = !0 : e.estadoRegistro === "por_gestionar" && A.i < (P ? 15 : 5) && (r = !0, A.i++) : r = !0;
|
|
135
137
|
const i = h && y != null && e.tipoMesa !== y, n = c.includes(e.numeroRegistro);
|
|
136
|
-
return /* @__PURE__ */ d(
|
|
138
|
+
return /* @__PURE__ */ d(Q.Fragment, { children: [
|
|
137
139
|
/* @__PURE__ */ d(
|
|
138
140
|
"tr",
|
|
139
141
|
{
|
|
@@ -151,9 +153,9 @@ import '../../../assets/Tabla.css';const pe = ({
|
|
|
151
153
|
cursor: i ? "not-allowed" : "pointer"
|
|
152
154
|
},
|
|
153
155
|
onClick: (t) => {
|
|
154
|
-
t.stopPropagation(), i ||
|
|
156
|
+
t.stopPropagation(), i || W(e.numeroRegistro);
|
|
155
157
|
},
|
|
156
|
-
children: n ? /* @__PURE__ */ s(
|
|
158
|
+
children: n ? /* @__PURE__ */ s(te, { size: 18, style: { color: "#505050ff" } }) : /* @__PURE__ */ s(X, { size: 18, style: { color: "#505050ff" } })
|
|
157
159
|
}
|
|
158
160
|
),
|
|
159
161
|
u.map((t, a) => /* @__PURE__ */ s(
|
|
@@ -206,7 +208,7 @@ import '../../../assets/Tabla.css';const pe = ({
|
|
|
206
208
|
fontWeight: "600",
|
|
207
209
|
color: o % 2 === 0 ? "#365072" : "#303D50",
|
|
208
210
|
backgroundColor: o % 2 === 0 ? "#fefefe" : "#f9fafa"
|
|
209
|
-
}, children: /* @__PURE__ */ s(
|
|
211
|
+
}, children: /* @__PURE__ */ s(Y, { style: { fontSize: "1.3rem" } }) }) }) })
|
|
210
212
|
] }, o);
|
|
211
213
|
}),
|
|
212
214
|
x && /* @__PURE__ */ s("tr", { children: /* @__PURE__ */ s("td", { colSpan: u.length, className: "text-center", children: "Cargando más datos..." }) })
|
|
@@ -214,5 +216,5 @@ import '../../../assets/Tabla.css';const pe = ({
|
|
|
214
216
|
] }) }) });
|
|
215
217
|
};
|
|
216
218
|
export {
|
|
217
|
-
|
|
219
|
+
ge as Tabla
|
|
218
220
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx as v } from "react/jsx-runtime";
|
|
2
|
-
import { useState as
|
|
3
|
-
import {
|
|
4
|
-
import { j as
|
|
5
|
-
const
|
|
6
|
-
const [
|
|
7
|
-
if ((await fetch(`${
|
|
2
|
+
import { useState as _, useEffect as S } from "react";
|
|
3
|
+
import { useLocation as U, Outlet as g } from "react-router-dom";
|
|
4
|
+
import { j as u } from "../../index-CuHybtft.js";
|
|
5
|
+
const y = () => {
|
|
6
|
+
const [p, t] = _(!1), m = U(), s = `${window.location.protocol}//${window.location.host}/`, a = `${window.location.host}`, w = async () => {
|
|
7
|
+
if ((await fetch(`${s}api-auth/auth/refresh_token/`, {
|
|
8
8
|
method: "POST",
|
|
9
9
|
headers: {
|
|
10
10
|
"Content-Type": "application/json"
|
|
@@ -14,50 +14,51 @@ const E = () => {
|
|
|
14
14
|
return !0;
|
|
15
15
|
throw new Error("Error al refrescar token de Microsoft");
|
|
16
16
|
};
|
|
17
|
-
return
|
|
18
|
-
|
|
17
|
+
return S(() => {
|
|
18
|
+
const d = async () => {
|
|
19
19
|
try {
|
|
20
|
-
if ((await fetch(`${
|
|
20
|
+
if ((await fetch(`${s}api-auth/auth/validate_jwt/`, {
|
|
21
21
|
method: "POST",
|
|
22
22
|
headers: {
|
|
23
23
|
"Content-Type": "application/json"
|
|
24
24
|
},
|
|
25
25
|
credentials: "include"
|
|
26
26
|
})).ok) {
|
|
27
|
-
const
|
|
28
|
-
if (
|
|
29
|
-
const f =
|
|
27
|
+
const i = sessionStorage.getItem("user_token");
|
|
28
|
+
if (i) {
|
|
29
|
+
const f = u(i).datos_basicos.servicios.map((e) => e.url).filter((e) => !!e), r = m.pathname, n = f.map(
|
|
30
30
|
(e) => e.startsWith("/") ? e : `/${e}`
|
|
31
|
-
),
|
|
31
|
+
), l = r.startsWith("/") ? r : `/${r}`;
|
|
32
32
|
n.some(
|
|
33
|
-
(e) =>
|
|
34
|
-
) ?
|
|
33
|
+
(e) => l.startsWith(e)
|
|
34
|
+
) ? t(!0) : (t(!1), sessionStorage.removeItem("user_token"), window.location.href = s);
|
|
35
35
|
} else
|
|
36
|
-
|
|
36
|
+
t(!1), sessionStorage.removeItem("user_token"), window.location.href = s;
|
|
37
37
|
} else
|
|
38
38
|
throw new Error("Token inválido");
|
|
39
39
|
} catch {
|
|
40
40
|
try {
|
|
41
|
-
if (await
|
|
42
|
-
const
|
|
43
|
-
if (
|
|
44
|
-
const r =
|
|
45
|
-
(
|
|
41
|
+
if (await w()) {
|
|
42
|
+
const c = sessionStorage.getItem("user_token");
|
|
43
|
+
if (c) {
|
|
44
|
+
const r = u(c).datos_basicos.servicios.map((o) => o.url).filter((o) => !!o), n = m.pathname, l = r.map(
|
|
45
|
+
(o) => o.startsWith("/") ? o : `/${o}`
|
|
46
46
|
), h = n.startsWith("/") ? n : `/${n}`;
|
|
47
|
-
|
|
48
|
-
(
|
|
49
|
-
) ?
|
|
47
|
+
l.some(
|
|
48
|
+
(o) => h.startsWith(o)
|
|
49
|
+
) ? t(!0) : (t(!1), sessionStorage.removeItem("user_token"), window.location.href = s);
|
|
50
50
|
} else
|
|
51
|
-
|
|
51
|
+
t(!1), sessionStorage.removeItem("user_token"), window.location.href = s;
|
|
52
52
|
} else
|
|
53
53
|
throw new Error("No se pudo refrescar el token.");
|
|
54
54
|
} catch {
|
|
55
|
-
sessionStorage.removeItem("user_token"), window.location.href =
|
|
55
|
+
sessionStorage.removeItem("user_token"), window.location.href = s, t(!1);
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
|
-
}
|
|
59
|
-
|
|
58
|
+
};
|
|
59
|
+
a.includes("ecosistemadesarrollo") || a.includes("ecosistemapruebas") || a.includes("ecosistemaprov") || a.includes("ecosistema") ? d() : (console.warn("ProtectedRoute is disabled in the local development environment."), t(!0));
|
|
60
|
+
}, []), p ? /* @__PURE__ */ v(g, {}) : null;
|
|
60
61
|
};
|
|
61
62
|
export {
|
|
62
|
-
|
|
63
|
+
y as ProtectedRoute
|
|
63
64
|
};
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { jsx as c } from "react/jsx-runtime";
|
|
2
|
-
import { useState as
|
|
3
|
-
import { useNavigate as
|
|
2
|
+
import { useState as d, useEffect as h } from "react";
|
|
3
|
+
import { useNavigate as u, Outlet as f } from "react-router-dom";
|
|
4
4
|
const k = () => {
|
|
5
|
-
const [
|
|
6
|
-
|
|
5
|
+
const [r, e] = d(!1), s = u(), o = `${window.location.protocol}//${window.location.host}/`, t = `${window.location.host}`;
|
|
6
|
+
if (t.includes("localhost"))
|
|
7
|
+
return console.warn("ProtectedRoute is disabled in the local development environment."), null;
|
|
8
|
+
const a = async () => {
|
|
9
|
+
if ((await fetch(`${o}api-auth/auth/refresh_token/`, {
|
|
7
10
|
method: "POST",
|
|
8
11
|
headers: {
|
|
9
12
|
"Content-Type": "application/json"
|
|
@@ -13,22 +16,22 @@ const k = () => {
|
|
|
13
16
|
return !0;
|
|
14
17
|
throw new Error("Error al refrescar token de Microsoft");
|
|
15
18
|
};
|
|
16
|
-
return
|
|
17
|
-
|
|
19
|
+
return h(() => {
|
|
20
|
+
const n = async () => {
|
|
18
21
|
try {
|
|
19
|
-
if ((await fetch(`${
|
|
22
|
+
if ((await fetch(`${o}api-auth/auth/validate_jwt/`, {
|
|
20
23
|
method: "POST",
|
|
21
24
|
headers: {
|
|
22
25
|
"Content-Type": "application/json"
|
|
23
26
|
},
|
|
24
27
|
credentials: "include"
|
|
25
28
|
})).ok)
|
|
26
|
-
|
|
29
|
+
e(!0);
|
|
27
30
|
else
|
|
28
31
|
try {
|
|
29
|
-
if (await
|
|
32
|
+
if (await a())
|
|
30
33
|
(await fetch(
|
|
31
|
-
`${
|
|
34
|
+
`${o}api-auth/auth/validate_jwt/`,
|
|
32
35
|
{
|
|
33
36
|
method: "POST",
|
|
34
37
|
headers: {
|
|
@@ -36,17 +39,18 @@ const k = () => {
|
|
|
36
39
|
},
|
|
37
40
|
credentials: "include"
|
|
38
41
|
}
|
|
39
|
-
)).ok ?
|
|
42
|
+
)).ok ? e(!0) : (sessionStorage.removeItem("user_token"), window.location.href = o, e(!1));
|
|
40
43
|
else
|
|
41
44
|
throw new Error("No se pudo refrescar el token.");
|
|
42
45
|
} catch {
|
|
43
|
-
sessionStorage.removeItem("user_token"), window.location.href = e;
|
|
46
|
+
sessionStorage.removeItem("user_token"), window.location.href = o, e(!1);
|
|
44
47
|
}
|
|
45
48
|
} catch {
|
|
46
|
-
sessionStorage.removeItem("user_token"), window.location.href = e;
|
|
49
|
+
sessionStorage.removeItem("user_token"), window.location.href = o, e(!1);
|
|
47
50
|
}
|
|
48
|
-
}
|
|
49
|
-
|
|
51
|
+
};
|
|
52
|
+
t.includes("localhost") ? (console.warn("ProtectedRoute is disabled in the local development environment."), e(!0)) : n();
|
|
53
|
+
}, [s]), r ? /* @__PURE__ */ c(f, {}) : null;
|
|
50
54
|
};
|
|
51
55
|
export {
|
|
52
56
|
k as UserRoute
|