@edifice.io/collect-frontend 0.2.2-develop-pedago.2 → 0.2.2-develop-pedago.3
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/lib/AppHeaderCollection-CdMZTmC6.js +170 -0
- package/lib/{CXEL7IU7-DVs75C4a.js → CXEL7IU7-BLUeaFt5.js} +2 -2
- package/lib/Collection-CUCjNGrr.js +472 -0
- package/lib/CollectionsLayout-DVYmui3o.js +187 -0
- package/lib/CollectionsList-Ba1LoCCN.js +310 -0
- package/lib/DeleteCollectionModal-CtmfiR2H.js +71 -0
- package/lib/DropdownActionTable-BhSk2sde.js +84 -0
- package/lib/FormEdit-DZFkw7z9.js +102 -0
- package/lib/{HASRA6WW-qb64R1U-.js → HASRA6WW-BPaxT9L-.js} +269 -269
- package/lib/{I3HPI4QX-DhV4n2OZ.js → I3HPI4QX-BuVHGkjY.js} +2 -2
- package/lib/MembersEdit-CblCChDS.js +77 -0
- package/lib/Root--z47Brfh.js +17 -0
- package/lib/SearchBarCollect-DBKaVVDV.js +23 -0
- package/lib/Submission-AzDGz_dM.js +257 -0
- package/lib/SubmissionList-Db_nRSqg.js +197 -0
- package/lib/index-HU8ua_Ev.js +3297 -0
- package/lib/index.js +7 -43
- package/lib/{submission.queries-CslqTzEP.js → submission.queries-Cr0bP5uv.js} +20 -17
- package/lib/useGetStatusSubmission-DxHmLPxr.js +57 -0
- package/package.json +1 -1
- package/lib/AppHeaderCollection-Bglbw6q9.js +0 -188
- package/lib/Collection-DYHQunUI.js +0 -463
- package/lib/CollectionsLayout-CPYEwl1X.js +0 -361
- package/lib/CollectionsList-Inb9z2nB.js +0 -315
- package/lib/DeleteCollectionModal-Dzsn2899.js +0 -112
- package/lib/DropdownActionTable-BLHrdk4t.js +0 -83
- package/lib/FormEdit-CwVhj3_4.js +0 -96
- package/lib/MathsModal-D8rTl0Sb.js +0 -42
- package/lib/MembersEdit-DDj8IWMX.js +0 -72
- package/lib/Root-DbGwe5v1.js +0 -13
- package/lib/SearchBarCollect-BAnLCwAC.js +0 -21
- package/lib/Submission-DUcQiBve.js +0 -249
- package/lib/SubmissionList-DjQ0x7eD.js +0 -695
- package/lib/heic-to-DuZ6uPPi.js +0 -72
- package/lib/index-Dt9ykSDF.js +0 -171658
- package/lib/useGetStatusSubmission-D77F1XUy.js +0 -55
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import { jsxs as s, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { WORKFLOW_RIGHTS as C } from "@edifice.io/collect-client-rest";
|
|
3
|
+
import { useEdificeClient as L, useHasWorkflow as T, Button as _, Menu as h, Tree as k, Dropdown as m, Flex as E, useBreakpoint as R, AppHeader as w, Breadcrumb as U, Grid as M, LoadingScreen as A } from "@edifice.io/react";
|
|
4
|
+
import { Suspense as y } from "react";
|
|
5
|
+
import { useNavigate as N, useLocation as f, Navigate as F, Outlet as H } from "react-router-dom";
|
|
6
|
+
import { IconDepositeInbox as $, IconPlus as j, IconSubmission as v, IconCollect as x } from "@edifice.io/react/icons";
|
|
7
|
+
import { useTranslation as b } from "react-i18next";
|
|
8
|
+
import { create as D } from "zustand";
|
|
9
|
+
import { c as W } from "./index-HU8ua_Ev.js";
|
|
10
|
+
function G() {
|
|
11
|
+
const { appCode: i } = L(), { t: l } = b(i), r = N(), c = T(C.COLLECTION_CREATE);
|
|
12
|
+
return /* @__PURE__ */ s("div", { className: "d-flex flex-fill align-items-center justify-content-end gap-12 align-self-end", children: [
|
|
13
|
+
/* @__PURE__ */ e(
|
|
14
|
+
_,
|
|
15
|
+
{
|
|
16
|
+
type: "button",
|
|
17
|
+
color: "primary",
|
|
18
|
+
variant: "outline",
|
|
19
|
+
leftIcon: /* @__PURE__ */ e($, {}),
|
|
20
|
+
onClick: () => {
|
|
21
|
+
},
|
|
22
|
+
children: l("collection.appHeaderAction.button.toCollection")
|
|
23
|
+
}
|
|
24
|
+
),
|
|
25
|
+
c && /* @__PURE__ */ e(
|
|
26
|
+
_,
|
|
27
|
+
{
|
|
28
|
+
"data-testid": "collect-collection-app-header-create-collection-button",
|
|
29
|
+
type: "button",
|
|
30
|
+
color: "primary",
|
|
31
|
+
leftIcon: /* @__PURE__ */ e(j, {}),
|
|
32
|
+
onClick: () => r("/create/form"),
|
|
33
|
+
children: l("collection.appHeaderAction.button.newCollection")
|
|
34
|
+
}
|
|
35
|
+
)
|
|
36
|
+
] });
|
|
37
|
+
}
|
|
38
|
+
const t = {
|
|
39
|
+
LIST_COLLECTIONS: "list-collections",
|
|
40
|
+
LIST_SUBMISSIONS: "list-submissions"
|
|
41
|
+
}, K = D((i) => ({
|
|
42
|
+
mobileMenuOpen: !1,
|
|
43
|
+
selectedMenu: "list-collections",
|
|
44
|
+
setMobileMenuOpen: (l) => i({ mobileMenuOpen: l }),
|
|
45
|
+
setSelectedMenu: (l) => i({ selectedMenu: l })
|
|
46
|
+
})), B = W(K), P = () => {
|
|
47
|
+
const i = N(), { pathname: l } = f(), { appCode: r } = L(), { t: c } = b(r), a = B.use.setSelectedMenu(), d = T(C.COLLECTION_CREATE), O = [
|
|
48
|
+
...d ? [
|
|
49
|
+
{
|
|
50
|
+
id: t.LIST_COLLECTIONS,
|
|
51
|
+
name: c("collection.collection")
|
|
52
|
+
}
|
|
53
|
+
] : [],
|
|
54
|
+
{
|
|
55
|
+
id: t.LIST_SUBMISSIONS,
|
|
56
|
+
name: c("collection.submission")
|
|
57
|
+
}
|
|
58
|
+
], S = (o) => {
|
|
59
|
+
switch (o) {
|
|
60
|
+
case t.LIST_COLLECTIONS:
|
|
61
|
+
return /* @__PURE__ */ e(x, {});
|
|
62
|
+
case t.LIST_SUBMISSIONS:
|
|
63
|
+
return /* @__PURE__ */ e(v, {});
|
|
64
|
+
default:
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
}, g = (o) => {
|
|
68
|
+
a(o), i(`/${o}`);
|
|
69
|
+
}, u = () => {
|
|
70
|
+
const p = {
|
|
71
|
+
"/": t.LIST_COLLECTIONS,
|
|
72
|
+
"/list-collections": t.LIST_COLLECTIONS,
|
|
73
|
+
"/list-submissions": t.LIST_SUBMISSIONS
|
|
74
|
+
}[l] || null;
|
|
75
|
+
return !d && p === t.LIST_COLLECTIONS ? t.LIST_SUBMISSIONS : p;
|
|
76
|
+
};
|
|
77
|
+
return /* @__PURE__ */ s("div", { className: "border-end p-16 h-100 ps-0", children: [
|
|
78
|
+
/* @__PURE__ */ e("p", { className: "caption text-uppercase fw-semibold text-gray-700", children: c("collection.title") }),
|
|
79
|
+
/* @__PURE__ */ s(h, { label: c("collection.title"), children: [
|
|
80
|
+
/* @__PURE__ */ e(h.Item, { children: /* @__PURE__ */ e("div", { className: "treeview ps-16 pt-16", children: /* @__PURE__ */ e(
|
|
81
|
+
k,
|
|
82
|
+
{
|
|
83
|
+
nodes: O,
|
|
84
|
+
selectedNodeId: u(),
|
|
85
|
+
showIcon: !1,
|
|
86
|
+
renderNode: ({ node: o }) => /* @__PURE__ */ s("div", { className: "d-flex align-items-center gap-8", children: [
|
|
87
|
+
S(o.id),
|
|
88
|
+
/* @__PURE__ */ e("span", { children: o.name })
|
|
89
|
+
] }),
|
|
90
|
+
onTreeItemClick: g
|
|
91
|
+
}
|
|
92
|
+
) }) }),
|
|
93
|
+
/* @__PURE__ */ e(h.Item, { children: /* @__PURE__ */ e("div", { className: "separator-dashed w-100 mt-12 my-12" }) })
|
|
94
|
+
] })
|
|
95
|
+
] });
|
|
96
|
+
}, q = () => {
|
|
97
|
+
const i = N(), { pathname: l } = f(), { appCode: r } = L(), { t: c } = b(r), a = T(C.COLLECTION_CREATE), { setSelectedMenu: d, setMobileMenuOpen: O } = B((n) => ({
|
|
98
|
+
setSelectedMenu: n.setSelectedMenu,
|
|
99
|
+
setMobileMenuOpen: n.setMobileMenuOpen
|
|
100
|
+
})), S = [
|
|
101
|
+
...a ? [
|
|
102
|
+
{
|
|
103
|
+
id: "collection",
|
|
104
|
+
label: c("collection.collection"),
|
|
105
|
+
icon: /* @__PURE__ */ e(x, {}),
|
|
106
|
+
path: "/list-collections",
|
|
107
|
+
filterMenu: t.LIST_COLLECTIONS
|
|
108
|
+
}
|
|
109
|
+
] : [],
|
|
110
|
+
{
|
|
111
|
+
id: "submission",
|
|
112
|
+
label: c("collection.submission"),
|
|
113
|
+
icon: /* @__PURE__ */ e(v, {}),
|
|
114
|
+
path: "/list-submissions",
|
|
115
|
+
filterMenu: t.LIST_SUBMISSIONS
|
|
116
|
+
}
|
|
117
|
+
], u = (() => {
|
|
118
|
+
const I = {
|
|
119
|
+
"/": t.LIST_COLLECTIONS,
|
|
120
|
+
"/list-collections": t.LIST_COLLECTIONS,
|
|
121
|
+
"/list-submissions": t.LIST_SUBMISSIONS
|
|
122
|
+
}[l] || t.LIST_SUBMISSIONS;
|
|
123
|
+
return !a && I === t.LIST_COLLECTIONS ? t.LIST_SUBMISSIONS : I;
|
|
124
|
+
})(), o = S.find(
|
|
125
|
+
(n) => n.filterMenu === u
|
|
126
|
+
), p = (n, I) => {
|
|
127
|
+
d(I), i(n);
|
|
128
|
+
};
|
|
129
|
+
return /* @__PURE__ */ e("div", { className: "position-relative w-100 p-16", children: /* @__PURE__ */ s(m, { block: !0, onToggle: (n) => O(n), children: [
|
|
130
|
+
/* @__PURE__ */ e(
|
|
131
|
+
m.Trigger,
|
|
132
|
+
{
|
|
133
|
+
label: /* @__PURE__ */ s(E, { align: "center", gap: "8", children: [
|
|
134
|
+
o == null ? void 0 : o.icon,
|
|
135
|
+
(o == null ? void 0 : o.label) || c("collection.title")
|
|
136
|
+
] })
|
|
137
|
+
}
|
|
138
|
+
),
|
|
139
|
+
/* @__PURE__ */ e(m.Menu, { children: S.map((n) => /* @__PURE__ */ e(
|
|
140
|
+
m.Item,
|
|
141
|
+
{
|
|
142
|
+
onClick: () => p(n.path, n.filterMenu),
|
|
143
|
+
icon: n.icon,
|
|
144
|
+
className: u === n.filterMenu ? "active" : "",
|
|
145
|
+
children: /* @__PURE__ */ e("span", { children: n.label })
|
|
146
|
+
},
|
|
147
|
+
n.id
|
|
148
|
+
)) })
|
|
149
|
+
] }) });
|
|
150
|
+
}, ne = async () => null, oe = () => {
|
|
151
|
+
const { currentApp: i } = L(), { lg: l } = R(), { pathname: r } = f(), c = T(C.COLLECTION_CREATE), a = r === "/" || r === `/${t.LIST_COLLECTIONS}`;
|
|
152
|
+
return c !== void 0 && !c && a ? /* @__PURE__ */ e(F, { to: `/${t.LIST_SUBMISSIONS}`, replace: !0 }) : /* @__PURE__ */ s(E, { direction: "column", className: "flex-grow-1", children: [
|
|
153
|
+
/* @__PURE__ */ e(w, { render: G, children: /* @__PURE__ */ e(U, { app: i }) }),
|
|
154
|
+
/* @__PURE__ */ s(M, { className: "flex-grow-1", children: [
|
|
155
|
+
/* @__PURE__ */ e(
|
|
156
|
+
M.Col,
|
|
157
|
+
{
|
|
158
|
+
sm: "3",
|
|
159
|
+
md: "3",
|
|
160
|
+
lg: "2",
|
|
161
|
+
xl: "3",
|
|
162
|
+
className: "d-none d-lg-block",
|
|
163
|
+
as: "aside",
|
|
164
|
+
children: /* @__PURE__ */ e(P, {})
|
|
165
|
+
}
|
|
166
|
+
),
|
|
167
|
+
/* @__PURE__ */ s(
|
|
168
|
+
M.Col,
|
|
169
|
+
{
|
|
170
|
+
sm: "4",
|
|
171
|
+
md: "8",
|
|
172
|
+
lg: "6",
|
|
173
|
+
xl: "9",
|
|
174
|
+
className: `${l ? "cancel-gap" : ""}`,
|
|
175
|
+
children: [
|
|
176
|
+
!l && /* @__PURE__ */ e(q, {}),
|
|
177
|
+
/* @__PURE__ */ e(y, { fallback: /* @__PURE__ */ e(A, {}), children: /* @__PURE__ */ e(H, {}) })
|
|
178
|
+
]
|
|
179
|
+
}
|
|
180
|
+
)
|
|
181
|
+
] })
|
|
182
|
+
] });
|
|
183
|
+
};
|
|
184
|
+
export {
|
|
185
|
+
oe as Component,
|
|
186
|
+
ne as loader
|
|
187
|
+
};
|
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
import { jsx as e, Fragment as T, jsxs as u } from "react/jsx-runtime";
|
|
2
|
+
import { useState as D, useMemo as L, useCallback as B, useEffect as E } from "react";
|
|
3
|
+
import { S as A } from "./SearchBarCollect-DBKaVVDV.js";
|
|
4
|
+
import { c as F, u as M, W as O, a as R } from "./index-HU8ua_Ev.js";
|
|
5
|
+
import { useDate as $, Table as m, Flex as I, Badge as k, IconButton as S, useEdificeClient as v, EmptyScreen as G, LoadingScreen as j } from "@edifice.io/react";
|
|
6
|
+
import { useTranslation as N } from "react-i18next";
|
|
7
|
+
import { E as Q } from "./emptyscreen-list-collection-CWGxO4Ss.js";
|
|
8
|
+
import { D as W } from "./DeleteCollectionModal-CtmfiR2H.js";
|
|
9
|
+
import { SortDirection as b, CollectionSortField as y } from "@edifice.io/collect-client-rest";
|
|
10
|
+
import { create as _ } from "zustand";
|
|
11
|
+
import { IconOptions as H, IconRafterLeft as z, IconRafterRight as K, IconListOrder as U, IconArrowUp as Y, IconArrowDown as Z } from "@edifice.io/react/icons";
|
|
12
|
+
import { t as q } from "i18next";
|
|
13
|
+
import { useNavigate as J } from "react-router-dom";
|
|
14
|
+
import { D as V } from "./DropdownActionTable-BhSk2sde.js";
|
|
15
|
+
const X = {
|
|
16
|
+
search: "",
|
|
17
|
+
sortBy: y.DEADLINE,
|
|
18
|
+
sortDirection: b.DESC
|
|
19
|
+
}, x = F(
|
|
20
|
+
_((n) => ({
|
|
21
|
+
...X,
|
|
22
|
+
setSearch: (o) => n({ search: o }),
|
|
23
|
+
setFilters: (o) => n(o),
|
|
24
|
+
setSortCollectionList: (o, a) => n({ sortBy: o, sortDirection: a })
|
|
25
|
+
}))
|
|
26
|
+
), ee = () => {
|
|
27
|
+
const { search: n, sortBy: o, sortDirection: a } = x(), { data: r, fetchNextPage: d, hasNextPage: s, isFetchingNextPage: i, isLoading: g } = M({
|
|
28
|
+
search: n || void 0,
|
|
29
|
+
sortBy: o,
|
|
30
|
+
sortDirection: a
|
|
31
|
+
}), [t, l] = D(1), c = L(() => {
|
|
32
|
+
var C, p;
|
|
33
|
+
const h = (C = r == null ? void 0 : r.pages) == null ? void 0 : C[r.pages.length - 1];
|
|
34
|
+
return ((p = h == null ? void 0 : h.meta) == null ? void 0 : p.totalPages) ?? 1;
|
|
35
|
+
}, [r]), f = L(() => {
|
|
36
|
+
var h;
|
|
37
|
+
if ((h = r == null ? void 0 : r.pages) != null && h.length)
|
|
38
|
+
return r.pages.find((C) => {
|
|
39
|
+
var p;
|
|
40
|
+
return ((p = C.meta) == null ? void 0 : p.currentPage) === t;
|
|
41
|
+
}) ?? r.pages[t - 1];
|
|
42
|
+
}, [r, t]);
|
|
43
|
+
return {
|
|
44
|
+
items: (f == null ? void 0 : f.items) ?? [],
|
|
45
|
+
page: t,
|
|
46
|
+
totalPages: c,
|
|
47
|
+
isLoading: g,
|
|
48
|
+
isFetchingNextPage: i,
|
|
49
|
+
handlePagePrevious: () => {
|
|
50
|
+
l((h) => Math.max(1, h - 1));
|
|
51
|
+
},
|
|
52
|
+
handlePageNext: async () => {
|
|
53
|
+
var p;
|
|
54
|
+
if (t >= c || i) return;
|
|
55
|
+
const h = t + 1;
|
|
56
|
+
!((p = r == null ? void 0 : r.pages) == null ? void 0 : p.some(
|
|
57
|
+
(w) => {
|
|
58
|
+
var P;
|
|
59
|
+
return ((P = w.meta) == null ? void 0 : P.currentPage) === h;
|
|
60
|
+
}
|
|
61
|
+
)) && s && await d(), l(h);
|
|
62
|
+
},
|
|
63
|
+
canGoPrevious: t > 1,
|
|
64
|
+
canGoNext: t < c
|
|
65
|
+
};
|
|
66
|
+
}, te = () => {
|
|
67
|
+
const [n, o] = D(
|
|
68
|
+
null
|
|
69
|
+
);
|
|
70
|
+
return {
|
|
71
|
+
isHovered: (s) => n === s.id,
|
|
72
|
+
setHoveredCollectionId: o,
|
|
73
|
+
getBgColor: (s) => n === s.id ? "bg-gray-300" : "",
|
|
74
|
+
getColorByPercentage: (s, i) => {
|
|
75
|
+
if (i === 0) return "danger";
|
|
76
|
+
const g = s / i * 100;
|
|
77
|
+
return g >= 0 && g < 33 ? "danger" : g >= 33 && g < 66 ? "warning" : g >= 66 && g <= 100 ? "success" : "warning";
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
}, oe = ({
|
|
81
|
+
collections: n
|
|
82
|
+
}) => {
|
|
83
|
+
const { fromNow: o, formatDate: a } = $(), r = J(), {
|
|
84
|
+
isHovered: d,
|
|
85
|
+
setHoveredCollectionId: s,
|
|
86
|
+
getBgColor: i,
|
|
87
|
+
getColorByPercentage: g
|
|
88
|
+
} = te();
|
|
89
|
+
return /* @__PURE__ */ e(T, { children: n.map((t, l) => {
|
|
90
|
+
const c = i(t);
|
|
91
|
+
return /* @__PURE__ */ u(
|
|
92
|
+
m.Tr,
|
|
93
|
+
{
|
|
94
|
+
"data-testid": "collect-collection-list-row",
|
|
95
|
+
onMouseEnter: () => s(t.id),
|
|
96
|
+
onMouseLeave: () => s(null),
|
|
97
|
+
children: [
|
|
98
|
+
/* @__PURE__ */ e(m.Td, { className: c, style: { maxWidth: "350px" }, children: /* @__PURE__ */ e(I, { align: "center", gap: "8", children: /* @__PURE__ */ e(
|
|
99
|
+
"span",
|
|
100
|
+
{
|
|
101
|
+
className: "fw-bold text-truncate c-pointer",
|
|
102
|
+
"data-testid": "collect-collection-list-row-name",
|
|
103
|
+
onClick: () => {
|
|
104
|
+
r(`/list-collections/id/${t.id}`);
|
|
105
|
+
},
|
|
106
|
+
children: t.name
|
|
107
|
+
}
|
|
108
|
+
) }) }),
|
|
109
|
+
/* @__PURE__ */ e(m.Td, { className: c, children: /* @__PURE__ */ e("em", { className: "text-gray-700", children: o(t.createdAt) }) }),
|
|
110
|
+
/* @__PURE__ */ e(m.Td, { className: c, children: a(t.deadline, "short") }),
|
|
111
|
+
/* @__PURE__ */ e(m.Td, { className: c, children: /* @__PURE__ */ u(
|
|
112
|
+
k,
|
|
113
|
+
{
|
|
114
|
+
variant: {
|
|
115
|
+
type: "notification",
|
|
116
|
+
level: g(
|
|
117
|
+
t.contribCount,
|
|
118
|
+
t.submissionCount
|
|
119
|
+
)
|
|
120
|
+
},
|
|
121
|
+
className: "fw-normal",
|
|
122
|
+
children: [
|
|
123
|
+
t.contribCount,
|
|
124
|
+
" / ",
|
|
125
|
+
t.submissionCount
|
|
126
|
+
]
|
|
127
|
+
}
|
|
128
|
+
) }),
|
|
129
|
+
/* @__PURE__ */ e(m.Td, { className: c, children: /* @__PURE__ */ e(V, { collectionId: t.id, children: (f) => /* @__PURE__ */ e(
|
|
130
|
+
S,
|
|
131
|
+
{
|
|
132
|
+
...f,
|
|
133
|
+
"data-testid": "collect-collection-list-row-actions",
|
|
134
|
+
className: "icon-button-hover-no-transition bg-white",
|
|
135
|
+
type: "button",
|
|
136
|
+
"aria-label": q("collection.table.th.action"),
|
|
137
|
+
color: "tertiary",
|
|
138
|
+
variant: "filled",
|
|
139
|
+
icon: /* @__PURE__ */ e(H, {}),
|
|
140
|
+
style: {
|
|
141
|
+
visibility: d(t) ? "visible" : "hidden"
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
) }) })
|
|
145
|
+
]
|
|
146
|
+
},
|
|
147
|
+
`${t == null ? void 0 : t.id}-${l}`
|
|
148
|
+
);
|
|
149
|
+
}) });
|
|
150
|
+
}, re = ({
|
|
151
|
+
page: n,
|
|
152
|
+
totalPages: o,
|
|
153
|
+
canGoPrevious: a,
|
|
154
|
+
canGoNext: r,
|
|
155
|
+
isLoading: d = !1,
|
|
156
|
+
isFetchingNextPage: s = !1,
|
|
157
|
+
onPagePrevious: i,
|
|
158
|
+
onPageNext: g
|
|
159
|
+
}) => /* @__PURE__ */ u(I, { justify: "center", align: "center", gap: "8", children: [
|
|
160
|
+
/* @__PURE__ */ e(
|
|
161
|
+
S,
|
|
162
|
+
{
|
|
163
|
+
variant: "ghost",
|
|
164
|
+
color: "tertiary",
|
|
165
|
+
icon: /* @__PURE__ */ e(z, {}),
|
|
166
|
+
disabled: !a || d,
|
|
167
|
+
onClick: i
|
|
168
|
+
}
|
|
169
|
+
),
|
|
170
|
+
/* @__PURE__ */ u("span", { "aria-label": `Page ${n} of ${o}`, children: [
|
|
171
|
+
n,
|
|
172
|
+
" / ",
|
|
173
|
+
o
|
|
174
|
+
] }),
|
|
175
|
+
/* @__PURE__ */ e(
|
|
176
|
+
S,
|
|
177
|
+
{
|
|
178
|
+
variant: "ghost",
|
|
179
|
+
color: "tertiary",
|
|
180
|
+
icon: /* @__PURE__ */ e(K, {}),
|
|
181
|
+
disabled: !r || d || s,
|
|
182
|
+
onClick: g
|
|
183
|
+
}
|
|
184
|
+
)
|
|
185
|
+
] }), ne = () => {
|
|
186
|
+
const { appCode: n } = v(), { t: o } = N(n), { sortBy: a, sortDirection: r, setSortCollectionList: d } = x((l) => ({
|
|
187
|
+
sortBy: l.sortBy,
|
|
188
|
+
sortDirection: l.sortDirection,
|
|
189
|
+
setSortCollectionList: l.setSortCollectionList
|
|
190
|
+
})), s = [
|
|
191
|
+
{
|
|
192
|
+
label: o("collection.table.th.collect"),
|
|
193
|
+
sortField: y.NAME
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
label: o("collection.table.th.date"),
|
|
197
|
+
sortField: y.CREATION_DATE
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
label: o("collection.table.th.deadline"),
|
|
201
|
+
sortField: y.DEADLINE
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
label: o("collection.table.th.render")
|
|
205
|
+
// FIXME: No sort field for render, we should add one in the backend
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
label: o("collection.table.th.action")
|
|
209
|
+
}
|
|
210
|
+
], i = (l) => l.sortField && l.sortField === a, g = (l) => {
|
|
211
|
+
let c = /* @__PURE__ */ e(U, { width: 16, height: 16 });
|
|
212
|
+
return i(l) && (r === b.ASC ? c = /* @__PURE__ */ e(Y, {}) : c = /* @__PURE__ */ e(Z, {})), c;
|
|
213
|
+
}, t = B(
|
|
214
|
+
(l) => {
|
|
215
|
+
let c = b.ASC;
|
|
216
|
+
a === l && r === b.ASC && (c = b.DESC), d(l, c);
|
|
217
|
+
},
|
|
218
|
+
[a, r, d]
|
|
219
|
+
);
|
|
220
|
+
return {
|
|
221
|
+
listHeads: s,
|
|
222
|
+
getSortIcon: g,
|
|
223
|
+
handleSort: t,
|
|
224
|
+
isSortActive: i
|
|
225
|
+
};
|
|
226
|
+
}, ie = () => {
|
|
227
|
+
const { listHeads: n, getSortIcon: o, handleSort: a, isSortActive: r } = ne(), { appCode: d } = v(), { t: s } = N(d);
|
|
228
|
+
return n.map((i) => /* @__PURE__ */ u(
|
|
229
|
+
m.Th,
|
|
230
|
+
{
|
|
231
|
+
className: i.sortField ? void 0 : "align-content-center text-center",
|
|
232
|
+
children: [
|
|
233
|
+
s(i.label),
|
|
234
|
+
i.sortField && /* @__PURE__ */ e(
|
|
235
|
+
S,
|
|
236
|
+
{
|
|
237
|
+
variant: "ghost",
|
|
238
|
+
color: "tertiary",
|
|
239
|
+
size: "sm",
|
|
240
|
+
className: `members-table-sort-btn ms-4 ${r(i) ? "text-gray-800" : "text-gray-600"}`,
|
|
241
|
+
icon: o(i),
|
|
242
|
+
onClick: () => a(i.sortField)
|
|
243
|
+
}
|
|
244
|
+
)
|
|
245
|
+
]
|
|
246
|
+
},
|
|
247
|
+
i.label
|
|
248
|
+
));
|
|
249
|
+
}, se = () => {
|
|
250
|
+
const { appCode: n } = v(), { t: o } = N(n), {
|
|
251
|
+
items: a,
|
|
252
|
+
page: r,
|
|
253
|
+
totalPages: d,
|
|
254
|
+
isLoading: s,
|
|
255
|
+
isFetchingNextPage: i,
|
|
256
|
+
handlePagePrevious: g,
|
|
257
|
+
handlePageNext: t,
|
|
258
|
+
canGoPrevious: l,
|
|
259
|
+
canGoNext: c
|
|
260
|
+
} = ee();
|
|
261
|
+
return a.length === 0 && !s ? /* @__PURE__ */ e("div", { className: "py-24", children: /* @__PURE__ */ e(
|
|
262
|
+
G,
|
|
263
|
+
{
|
|
264
|
+
imageSrc: Q,
|
|
265
|
+
title: o("collection.collectionList.emptyScreen.title"),
|
|
266
|
+
text: o("collection.collectionList.emptyScreen.description")
|
|
267
|
+
}
|
|
268
|
+
) }) : /* @__PURE__ */ u(
|
|
269
|
+
"div",
|
|
270
|
+
{
|
|
271
|
+
className: "table-collections",
|
|
272
|
+
"data-testid": "collect-collection-list-table",
|
|
273
|
+
children: [
|
|
274
|
+
/* @__PURE__ */ u(m, { children: [
|
|
275
|
+
/* @__PURE__ */ e(m.Thead, { children: /* @__PURE__ */ e(m.Tr, { children: /* @__PURE__ */ e(ie, {}) }) }),
|
|
276
|
+
/* @__PURE__ */ u(m.Tbody, { children: [
|
|
277
|
+
s && /* @__PURE__ */ e(m.Tr, { children: /* @__PURE__ */ e("td", { colSpan: 5, children: /* @__PURE__ */ e(j, {}) }) }),
|
|
278
|
+
/* @__PURE__ */ e(oe, { collections: a }),
|
|
279
|
+
d !== void 0 && d >= 1 && /* @__PURE__ */ e(m.Tr, { children: /* @__PURE__ */ e("td", { colSpan: 5, children: /* @__PURE__ */ e(
|
|
280
|
+
re,
|
|
281
|
+
{
|
|
282
|
+
page: r,
|
|
283
|
+
totalPages: d,
|
|
284
|
+
canGoPrevious: l,
|
|
285
|
+
canGoNext: c,
|
|
286
|
+
isLoading: s,
|
|
287
|
+
isFetchingNextPage: i,
|
|
288
|
+
onPagePrevious: g,
|
|
289
|
+
onPageNext: t
|
|
290
|
+
}
|
|
291
|
+
) }) })
|
|
292
|
+
] })
|
|
293
|
+
] }),
|
|
294
|
+
/* @__PURE__ */ e(W, {})
|
|
295
|
+
]
|
|
296
|
+
}
|
|
297
|
+
);
|
|
298
|
+
}, Pe = async (n) => (await n.prefetchInfiniteQuery(R({})), null), Le = () => {
|
|
299
|
+
const n = x((o) => o.setSearch);
|
|
300
|
+
return E(() => {
|
|
301
|
+
localStorage.removeItem(O);
|
|
302
|
+
}, []), /* @__PURE__ */ u(T, { children: [
|
|
303
|
+
/* @__PURE__ */ e("div", { className: "bg-gray-200 px-24 py-16", children: /* @__PURE__ */ e(A, { setSearch: n }) }),
|
|
304
|
+
/* @__PURE__ */ e(se, {})
|
|
305
|
+
] });
|
|
306
|
+
};
|
|
307
|
+
export {
|
|
308
|
+
Le as CollectionsList,
|
|
309
|
+
Pe as loader
|
|
310
|
+
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { jsxs as s, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { useEdificeClient as m, useToast as f, Modal as d, Button as C } from "@edifice.io/react";
|
|
3
|
+
import { IconDelete as h } from "@edifice.io/react/icons";
|
|
4
|
+
import { useTranslation as p } from "react-i18next";
|
|
5
|
+
import { g as M } from "./index-HU8ua_Ev.js";
|
|
6
|
+
import { u as D } from "./DropdownActionTable-BhSk2sde.js";
|
|
7
|
+
const y = () => {
|
|
8
|
+
const { appCode: r } = m(), { t: n } = p(r), e = f(), a = M(), { isDeleteModalOpen: l, onCloseDeleteModal: c, deleteCollectionId: i } = D((o) => ({
|
|
9
|
+
isDeleteModalOpen: o.isDeleteModalOpen,
|
|
10
|
+
onCloseDeleteModal: o.onCloseDeleteModal,
|
|
11
|
+
deleteCollectionId: o.deleteCollectionId
|
|
12
|
+
}));
|
|
13
|
+
return {
|
|
14
|
+
isOpen: l,
|
|
15
|
+
onClose: c,
|
|
16
|
+
handleDeleteCollection: async (o) => {
|
|
17
|
+
if (i != null)
|
|
18
|
+
try {
|
|
19
|
+
await a.mutateAsync(i), e.success(n("collection.toast.success.collection.delete")), o == null || o();
|
|
20
|
+
} catch (u) {
|
|
21
|
+
console.error("Error deleting collection:", u), e.error(n("collection.toast.error.collection.delete"));
|
|
22
|
+
} finally {
|
|
23
|
+
c();
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
}, k = ({
|
|
28
|
+
onDeleteSuccess: r
|
|
29
|
+
}) => {
|
|
30
|
+
const { appCode: n } = m(), { t: e } = p(n), { isOpen: a, onClose: l, handleDeleteCollection: c } = y(), i = async () => {
|
|
31
|
+
await c(r);
|
|
32
|
+
};
|
|
33
|
+
return /* @__PURE__ */ s(
|
|
34
|
+
d,
|
|
35
|
+
{
|
|
36
|
+
id: "delete-confirmation-modal",
|
|
37
|
+
isOpen: a,
|
|
38
|
+
onModalClose: l,
|
|
39
|
+
size: "sm",
|
|
40
|
+
children: [
|
|
41
|
+
/* @__PURE__ */ t(d.Header, { onModalClose: l, children: e("collection.modal.delete.title") }),
|
|
42
|
+
/* @__PURE__ */ t(d.Body, { children: e("collection.modal.delete.description") }),
|
|
43
|
+
/* @__PURE__ */ s(d.Footer, { children: [
|
|
44
|
+
/* @__PURE__ */ t(
|
|
45
|
+
C,
|
|
46
|
+
{
|
|
47
|
+
"data-testid": "collect-collection-delete-modal-button-cancel",
|
|
48
|
+
color: "tertiary",
|
|
49
|
+
variant: "ghost",
|
|
50
|
+
onClick: l,
|
|
51
|
+
children: e("collection.cancel")
|
|
52
|
+
}
|
|
53
|
+
),
|
|
54
|
+
/* @__PURE__ */ t(
|
|
55
|
+
C,
|
|
56
|
+
{
|
|
57
|
+
"data-testid": "collect-collection-delete-modal-button-delete",
|
|
58
|
+
color: "danger",
|
|
59
|
+
onClick: i,
|
|
60
|
+
leftIcon: /* @__PURE__ */ t(h, {}),
|
|
61
|
+
children: e("collection.delete")
|
|
62
|
+
}
|
|
63
|
+
)
|
|
64
|
+
] })
|
|
65
|
+
]
|
|
66
|
+
}
|
|
67
|
+
);
|
|
68
|
+
};
|
|
69
|
+
export {
|
|
70
|
+
k as D
|
|
71
|
+
};
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { jsx as n, Fragment as c, jsxs as r } from "react/jsx-runtime";
|
|
2
|
+
import { useEdificeClient as p, useHasWorkflow as m, Dropdown as s } from "@edifice.io/react";
|
|
3
|
+
import { Fragment as u } from "react";
|
|
4
|
+
import { WORKFLOW_RIGHTS as f } from "@edifice.io/collect-client-rest";
|
|
5
|
+
import { IconExternalLink as I, IconEdit as h, IconShare as O, IconDelete as w } from "@edifice.io/react/icons";
|
|
6
|
+
import { useTranslation as D } from "react-i18next";
|
|
7
|
+
import { useNavigate as C } from "react-router-dom";
|
|
8
|
+
import { create as b } from "zustand";
|
|
9
|
+
import { c as M } from "./index-HU8ua_Ev.js";
|
|
10
|
+
const T = b((e) => ({
|
|
11
|
+
isDeleteModalOpen: !1,
|
|
12
|
+
deleteCollectionId: null,
|
|
13
|
+
isInstructionModalOpen: !1,
|
|
14
|
+
isPastDeadline: !1,
|
|
15
|
+
onOpenDeleteModal: (t) => e({ isDeleteModalOpen: !0, deleteCollectionId: t }),
|
|
16
|
+
onCloseDeleteModal: () => e({ isDeleteModalOpen: !1, deleteCollectionId: null }),
|
|
17
|
+
onOpenInstructionModal: () => e({ isInstructionModalOpen: !0 }),
|
|
18
|
+
onCloseInstructionModal: () => e({ isInstructionModalOpen: !1 }),
|
|
19
|
+
setIsPastDeadline: (t) => e({ isPastDeadline: t })
|
|
20
|
+
})), g = M(
|
|
21
|
+
T
|
|
22
|
+
), E = (e, t) => {
|
|
23
|
+
const { appCode: d } = p(), { t: l } = D(d), a = C(), o = m(f.COLLECTION_CREATE), i = g.use.onOpenDeleteModal();
|
|
24
|
+
return { dropdownOptions: [
|
|
25
|
+
{
|
|
26
|
+
label: l("collection.table.dropdown.open"),
|
|
27
|
+
action: () => a(`/list-collections/id/${e}`),
|
|
28
|
+
icon: /* @__PURE__ */ n(I, {}),
|
|
29
|
+
hidden: t,
|
|
30
|
+
dataTestId: "collect-dropdown-action-open"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
label: l("collection.table.dropdown.edit"),
|
|
34
|
+
action: () => a(`/id/${e}/form`),
|
|
35
|
+
icon: /* @__PURE__ */ n(h, {}),
|
|
36
|
+
hidden: !o,
|
|
37
|
+
dataTestId: "collect-dropdown-action-edit"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
label: l("collection.table.dropdown.share"),
|
|
41
|
+
action: () => a(`/id/${e}/members`),
|
|
42
|
+
icon: /* @__PURE__ */ n(O, {}),
|
|
43
|
+
hidden: !o,
|
|
44
|
+
dataTestId: "collect-dropdown-action-share"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
label: l("collection.table.dropdown.delete"),
|
|
48
|
+
action: () => i(e),
|
|
49
|
+
icon: /* @__PURE__ */ n(w, {}),
|
|
50
|
+
className: "text-danger",
|
|
51
|
+
hidden: !o,
|
|
52
|
+
dataTestId: "collect-dropdown-action-share"
|
|
53
|
+
}
|
|
54
|
+
] };
|
|
55
|
+
}, W = ({
|
|
56
|
+
collectionId: e,
|
|
57
|
+
isCollection: t = !1,
|
|
58
|
+
children: d
|
|
59
|
+
}) => {
|
|
60
|
+
const { dropdownOptions: l } = E(
|
|
61
|
+
e,
|
|
62
|
+
t
|
|
63
|
+
);
|
|
64
|
+
return /* @__PURE__ */ n(c, { children: /* @__PURE__ */ n(s, { children: (a) => /* @__PURE__ */ r(c, { children: [
|
|
65
|
+
d(a),
|
|
66
|
+
/* @__PURE__ */ n(s.Menu, { children: l.map((o, i) => /* @__PURE__ */ n(u, { children: !o.hidden && /* @__PURE__ */ r(
|
|
67
|
+
s.Item,
|
|
68
|
+
{
|
|
69
|
+
"data-testid": o.dataTestId,
|
|
70
|
+
className: o.className,
|
|
71
|
+
onClick: o.action,
|
|
72
|
+
children: [
|
|
73
|
+
o.icon,
|
|
74
|
+
o.label
|
|
75
|
+
]
|
|
76
|
+
},
|
|
77
|
+
o.label
|
|
78
|
+
) }, i)) })
|
|
79
|
+
] }) }) });
|
|
80
|
+
};
|
|
81
|
+
export {
|
|
82
|
+
W as D,
|
|
83
|
+
g as u
|
|
84
|
+
};
|