@edifice.io/collect-frontend 0.2.2-develop-pedago.2 → 0.2.2-develop-pedago.3.20260427130056
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
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c, T as l, P as m, a as u, D as v, Q as i } from "./HASRA6WW-
|
|
2
|
-
import {
|
|
1
|
+
import { c, T as l, P as m, a as u, D as v, Q as i } from "./HASRA6WW-BPaxT9L-.js";
|
|
2
|
+
import { l as d, m as f, n as e } from "./index-HU8ua_Ev.js";
|
|
3
3
|
var p = (a) => {
|
|
4
4
|
const [r, t] = c({
|
|
5
5
|
prefix: "TanstackQueryDevtools"
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { jsx as e, jsxs as c, Fragment as T } from "react/jsx-runtime";
|
|
2
|
+
import { WORKFLOW_RIGHTS as N } from "@edifice.io/collect-client-rest";
|
|
3
|
+
import { useEdificeClient as v, useBreakpoint as I, useToast as D, useHasWorkflow as E, LoadingScreen as O, Grid as l, Flex as d, Button as u } from "@edifice.io/react";
|
|
4
|
+
import { useTranslation as S } from "react-i18next";
|
|
5
|
+
import { useParams as w, useNavigate as A } from "react-router-dom";
|
|
6
|
+
import { h as L, i as m, e as j, P as k, M, f as P, j as Q } from "./index-HU8ua_Ev.js";
|
|
7
|
+
import { s as R } from "./submission.queries-Cr0bP5uv.js";
|
|
8
|
+
const K = (o) => async ({ params: t }) => {
|
|
9
|
+
const s = Number(t.collectionId);
|
|
10
|
+
return await o.ensureQueryData(P(s)), await o.prefetchInfiniteQuery(
|
|
11
|
+
R(s)
|
|
12
|
+
), null;
|
|
13
|
+
}, $ = () => {
|
|
14
|
+
const { appCode: o } = v(), { t } = S(o), { lg: s } = I(), p = w(), a = D(), n = A(), g = E(N.COLLECTION_CREATE), h = L(), f = m.use.usersToAdd(), b = m.use.usersToDelete(), { data: i, isLoading: r } = j(
|
|
15
|
+
Number(p.collectionId)
|
|
16
|
+
);
|
|
17
|
+
if (r)
|
|
18
|
+
return /* @__PURE__ */ e(O, {});
|
|
19
|
+
if (!g || !i) return /* @__PURE__ */ e(k, {});
|
|
20
|
+
const C = async () => {
|
|
21
|
+
const y = Q(b, f);
|
|
22
|
+
try {
|
|
23
|
+
await h.mutateAsync({
|
|
24
|
+
id: i.id,
|
|
25
|
+
data: y
|
|
26
|
+
}), a.success(t("collection.toast.success.collection.update.members"), {
|
|
27
|
+
duration: 1e4,
|
|
28
|
+
isDismissible: !0
|
|
29
|
+
}), n(-1);
|
|
30
|
+
} catch (x) {
|
|
31
|
+
a.error(t("collection.toast.error.collection.update.members"), {
|
|
32
|
+
duration: 1e4,
|
|
33
|
+
isDismissible: !0
|
|
34
|
+
}), console.log(x);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
return /* @__PURE__ */ c(T, { children: [
|
|
38
|
+
/* @__PURE__ */ e(l, { className: "flex-grow-1 gap-64 px-md-8 px-lg-48 position-relative", children: /* @__PURE__ */ e(l.Col, { sm: "4", md: "8", xl: "12", className: `${s && "ms-64"}`, children: /* @__PURE__ */ e(
|
|
39
|
+
d,
|
|
40
|
+
{
|
|
41
|
+
direction: "column",
|
|
42
|
+
gap: "16",
|
|
43
|
+
className: "h-100 py-24 pb-lg-48 pt-lg-32",
|
|
44
|
+
children: /* @__PURE__ */ e(M, { collection: i })
|
|
45
|
+
}
|
|
46
|
+
) }) }),
|
|
47
|
+
/* @__PURE__ */ c(d, { justify: "end", className: "mt-auto px-48 pb-64 gap-16", children: [
|
|
48
|
+
/* @__PURE__ */ e(
|
|
49
|
+
u,
|
|
50
|
+
{
|
|
51
|
+
variant: "outline",
|
|
52
|
+
color: "primary",
|
|
53
|
+
isLoading: r,
|
|
54
|
+
onClick: () => n(-1),
|
|
55
|
+
"data-testid": "collect-cancel-sharings-button",
|
|
56
|
+
children: t("collection.cancel")
|
|
57
|
+
}
|
|
58
|
+
),
|
|
59
|
+
/* @__PURE__ */ e(
|
|
60
|
+
u,
|
|
61
|
+
{
|
|
62
|
+
variant: "filled",
|
|
63
|
+
color: "primary",
|
|
64
|
+
isLoading: r,
|
|
65
|
+
loadingPosition: "right",
|
|
66
|
+
onClick: C,
|
|
67
|
+
"data-testid": "collect-save-sharings-button",
|
|
68
|
+
children: t("collection.members.edit.save")
|
|
69
|
+
}
|
|
70
|
+
)
|
|
71
|
+
] })
|
|
72
|
+
] });
|
|
73
|
+
};
|
|
74
|
+
export {
|
|
75
|
+
$ as MembersEdit,
|
|
76
|
+
K as loader
|
|
77
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx as o, jsxs as i } from "react/jsx-runtime";
|
|
2
|
+
import { WORKFLOW_RIGHTS as e } from "@edifice.io/collect-client-rest";
|
|
3
|
+
import { useEdificeClient as n, useHasWorkflow as s, LoadingScreen as c, Layout as f } from "@edifice.io/react";
|
|
4
|
+
import { Outlet as a, ScrollRestoration as l } from "react-router-dom";
|
|
5
|
+
import { P as m } from "./index-HU8ua_Ev.js";
|
|
6
|
+
const R = async () => null;
|
|
7
|
+
function S() {
|
|
8
|
+
const { init: r } = n(), t = s(e.COLLECTION_ACCESS);
|
|
9
|
+
return r ? t ? /* @__PURE__ */ i(f, { children: [
|
|
10
|
+
/* @__PURE__ */ o(a, {}),
|
|
11
|
+
/* @__PURE__ */ o(l, {})
|
|
12
|
+
] }) : /* @__PURE__ */ o(m, {}) : /* @__PURE__ */ o(c, { position: !1 });
|
|
13
|
+
}
|
|
14
|
+
export {
|
|
15
|
+
S as Root,
|
|
16
|
+
R as loader
|
|
17
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { useEdificeClient as o, SearchBar as s } from "@edifice.io/react";
|
|
3
|
+
import { useTranslation as l } from "react-i18next";
|
|
4
|
+
const m = ({
|
|
5
|
+
setSearch: a
|
|
6
|
+
}) => {
|
|
7
|
+
const { appCode: r } = o(), { t } = l(r);
|
|
8
|
+
return /* @__PURE__ */ e("div", { className: "w-100 search-bar-collect", children: /* @__PURE__ */ e(
|
|
9
|
+
s,
|
|
10
|
+
{
|
|
11
|
+
"data-testid": "collect-submission-list-search",
|
|
12
|
+
isVariant: !0,
|
|
13
|
+
onChange: (c) => {
|
|
14
|
+
a(c.target.value);
|
|
15
|
+
},
|
|
16
|
+
placeholder: t("collection.search.placeholder"),
|
|
17
|
+
size: "md"
|
|
18
|
+
}
|
|
19
|
+
) });
|
|
20
|
+
};
|
|
21
|
+
export {
|
|
22
|
+
m as S
|
|
23
|
+
};
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
import { jsxs as a, jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { useEdificeClient as m, Flex as l, Heading as y, IconButton as v, Modal as u, Button as C, useToast as E, useBreakpoint as O, Grid as h, LoadingScreen as P } from "@edifice.io/react";
|
|
3
|
+
import { useNavigate as x, useParams as k } from "react-router-dom";
|
|
4
|
+
import { useState as B, useEffect as N } from "react";
|
|
5
|
+
import { u as g, A as T, C as j } from "./AppHeaderCollection-CdMZTmC6.js";
|
|
6
|
+
import { Editor as U } from "@edifice.io/react/editor";
|
|
7
|
+
import { IconPinOn as A, IconRafterUp as H, IconRafterDown as Q, IconSend as F, IconTextPage as R } from "@edifice.io/react/icons";
|
|
8
|
+
import { useTranslation as b } from "react-i18next";
|
|
9
|
+
import { ContribSubmissionStatus as $ } from "@edifice.io/collect-client-rest";
|
|
10
|
+
import { u as w } from "./DropdownActionTable-BhSk2sde.js";
|
|
11
|
+
import { b as W, c as z, d as G } from "./submission.queries-Cr0bP5uv.js";
|
|
12
|
+
import { e as V, P as J, f as K } from "./index-HU8ua_Ev.js";
|
|
13
|
+
const I = ({
|
|
14
|
+
collection: n,
|
|
15
|
+
isMobile: o = !1
|
|
16
|
+
}) => {
|
|
17
|
+
const { appCode: i } = m(), { t } = b(i), [e, c] = B(!o);
|
|
18
|
+
return /* @__PURE__ */ a("div", { className: `bg-white shadow rounded-4 ${o ? "p-16" : "p-24"}`, children: [
|
|
19
|
+
/* @__PURE__ */ a(l, { justify: "between", children: [
|
|
20
|
+
/* @__PURE__ */ a(l, { gap: "8", align: "center", children: [
|
|
21
|
+
/* @__PURE__ */ s(
|
|
22
|
+
l,
|
|
23
|
+
{
|
|
24
|
+
className: "bg-secondary-200 rounded",
|
|
25
|
+
align: "center",
|
|
26
|
+
justify: "center",
|
|
27
|
+
style: { minWidth: "36px", height: "36px" },
|
|
28
|
+
children: /* @__PURE__ */ s(A, {})
|
|
29
|
+
}
|
|
30
|
+
),
|
|
31
|
+
/* @__PURE__ */ s(y, { level: "h4", headingStyle: "h4", className: "text-truncate", children: t("collection.submission.instruction.title") })
|
|
32
|
+
] }),
|
|
33
|
+
o && /* @__PURE__ */ s(
|
|
34
|
+
v,
|
|
35
|
+
{
|
|
36
|
+
"data-testid": "collect-submission-instruction-button-toggle",
|
|
37
|
+
icon: e ? /* @__PURE__ */ s(H, {}) : /* @__PURE__ */ s(Q, {}),
|
|
38
|
+
color: "tertiary",
|
|
39
|
+
onClick: () => c(!e)
|
|
40
|
+
}
|
|
41
|
+
)
|
|
42
|
+
] }),
|
|
43
|
+
/* @__PURE__ */ s("div", { className: `wrapper ${e ? "open" : ""}`, children: /* @__PURE__ */ s("div", { className: "inner", children: /* @__PURE__ */ s(
|
|
44
|
+
U,
|
|
45
|
+
{
|
|
46
|
+
content: n.content,
|
|
47
|
+
mode: "read",
|
|
48
|
+
toolbar: "none",
|
|
49
|
+
variant: "ghost"
|
|
50
|
+
}
|
|
51
|
+
) }) })
|
|
52
|
+
] });
|
|
53
|
+
}, X = ({
|
|
54
|
+
onClose: n,
|
|
55
|
+
isOpen: o,
|
|
56
|
+
handleUpdateSubmission: i
|
|
57
|
+
}) => {
|
|
58
|
+
const { appCode: t } = m(), { t: e } = b(t), c = g.use.submissionIsLoading();
|
|
59
|
+
return /* @__PURE__ */ a(
|
|
60
|
+
u,
|
|
61
|
+
{
|
|
62
|
+
id: "update-submission-modal",
|
|
63
|
+
isOpen: o,
|
|
64
|
+
onModalClose: n,
|
|
65
|
+
size: "sm",
|
|
66
|
+
children: [
|
|
67
|
+
/* @__PURE__ */ s(u.Header, { onModalClose: n, children: e("collection.modal.update.submission.title") }),
|
|
68
|
+
/* @__PURE__ */ a(u.Body, { children: [
|
|
69
|
+
/* @__PURE__ */ s("p", { children: e("collection.modal.update.submission.description.first") }),
|
|
70
|
+
/* @__PURE__ */ s("p", { children: e("collection.modal.update.submission.description.second") })
|
|
71
|
+
] }),
|
|
72
|
+
/* @__PURE__ */ a(u.Footer, { children: [
|
|
73
|
+
/* @__PURE__ */ s(
|
|
74
|
+
C,
|
|
75
|
+
{
|
|
76
|
+
"data-testid": "collect-submission-modal-button-cancel",
|
|
77
|
+
color: "tertiary",
|
|
78
|
+
variant: "ghost",
|
|
79
|
+
onClick: n,
|
|
80
|
+
children: e("collection.cancel")
|
|
81
|
+
}
|
|
82
|
+
),
|
|
83
|
+
/* @__PURE__ */ s(
|
|
84
|
+
C,
|
|
85
|
+
{
|
|
86
|
+
"data-testid": "collect-submission-modal-button-send",
|
|
87
|
+
onClick: () => i({
|
|
88
|
+
status: $.SUBMITTED,
|
|
89
|
+
isRedirect: !0
|
|
90
|
+
}),
|
|
91
|
+
leftIcon: /* @__PURE__ */ s(F, {}),
|
|
92
|
+
isLoading: c,
|
|
93
|
+
children: e("collection.modal.update.submission.button.send")
|
|
94
|
+
}
|
|
95
|
+
)
|
|
96
|
+
] })
|
|
97
|
+
]
|
|
98
|
+
}
|
|
99
|
+
);
|
|
100
|
+
}, Y = ({
|
|
101
|
+
submission: n
|
|
102
|
+
}) => {
|
|
103
|
+
const { appCode: o } = m(), { t: i } = b(o), t = w.use.isPastDeadline(), { setSubmissionData: e, hydrateSubmissionContent: c } = g((d) => ({
|
|
104
|
+
setSubmissionData: d.setSubmissionData,
|
|
105
|
+
hydrateSubmissionContent: d.hydrateSubmissionContent
|
|
106
|
+
}));
|
|
107
|
+
return N(() => {
|
|
108
|
+
c(n);
|
|
109
|
+
}, [c, n]), /* @__PURE__ */ a(l, { className: "p-24", direction: "column", gap: "16", children: [
|
|
110
|
+
/* @__PURE__ */ a(l, { gap: "8", align: "center", children: [
|
|
111
|
+
/* @__PURE__ */ s(
|
|
112
|
+
l,
|
|
113
|
+
{
|
|
114
|
+
className: "bg-secondary-200 rounded",
|
|
115
|
+
align: "center",
|
|
116
|
+
justify: "center",
|
|
117
|
+
style: { minWidth: "36px", height: "36px" },
|
|
118
|
+
children: /* @__PURE__ */ s(R, {})
|
|
119
|
+
}
|
|
120
|
+
),
|
|
121
|
+
/* @__PURE__ */ s(y, { level: "h4", headingStyle: "h4", className: "text-truncate", children: i("collection.submission.edit.title") })
|
|
122
|
+
] }),
|
|
123
|
+
/* @__PURE__ */ s("div", { className: "bg-white rounded-3", children: /* @__PURE__ */ s(
|
|
124
|
+
U,
|
|
125
|
+
{
|
|
126
|
+
"data-testid": "collect-submission-edit-content",
|
|
127
|
+
id: "submissionEdit",
|
|
128
|
+
content: n.content ?? "",
|
|
129
|
+
onContentChange: ({ editor: d }) => {
|
|
130
|
+
e(d.getHTML(), !d.isEmpty);
|
|
131
|
+
},
|
|
132
|
+
mode: t ? "read" : "edit"
|
|
133
|
+
}
|
|
134
|
+
) })
|
|
135
|
+
] });
|
|
136
|
+
}, Z = ({
|
|
137
|
+
collection: n,
|
|
138
|
+
submission: o
|
|
139
|
+
}) => {
|
|
140
|
+
const { appCode: i } = m(), { t } = b(i), e = E(), c = x(), {
|
|
141
|
+
submissionContent: d,
|
|
142
|
+
isUpdateSubmissionModalOpen: p,
|
|
143
|
+
onCloseUpdateSubmissionModal: S,
|
|
144
|
+
setSubmissionIsLoading: f
|
|
145
|
+
} = g((r) => ({
|
|
146
|
+
submissionContent: r.submissionContent,
|
|
147
|
+
isUpdateSubmissionModalOpen: r.isUpdateSubmissionModalOpen,
|
|
148
|
+
onCloseUpdateSubmissionModal: r.onCloseUpdateSubmissionModal,
|
|
149
|
+
setSubmissionIsLoading: r.setSubmissionIsLoading
|
|
150
|
+
})), D = W();
|
|
151
|
+
return {
|
|
152
|
+
isOpen: p,
|
|
153
|
+
onClose: S,
|
|
154
|
+
handleUpdateSubmission: async ({
|
|
155
|
+
status: r,
|
|
156
|
+
isRedirect: L
|
|
157
|
+
}) => {
|
|
158
|
+
try {
|
|
159
|
+
f(!0), await D.mutateAsync({
|
|
160
|
+
collectionId: n.id,
|
|
161
|
+
submissionId: o.id,
|
|
162
|
+
data: {
|
|
163
|
+
content: d,
|
|
164
|
+
status: r,
|
|
165
|
+
// FIX ME : For now, attachments are not supported in the frontend, so we send an empty array.
|
|
166
|
+
attachments: []
|
|
167
|
+
}
|
|
168
|
+
}), e.success(t("collection.toast.success.submission.update"));
|
|
169
|
+
} catch (M) {
|
|
170
|
+
console.error("Error updating submission:", M), e.error(t("collection.toast.error.submission.update"));
|
|
171
|
+
} finally {
|
|
172
|
+
f(!1), L && c("/list-submissions"), S();
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
}, _ = ({
|
|
177
|
+
collection: n,
|
|
178
|
+
submission: o
|
|
179
|
+
}) => {
|
|
180
|
+
const i = x(), { lg: t } = O(), { isOpen: e, onClose: c, handleUpdateSubmission: d } = Z({
|
|
181
|
+
collection: n,
|
|
182
|
+
submission: o
|
|
183
|
+
}), p = w.use.setIsPastDeadline();
|
|
184
|
+
return N(() => {
|
|
185
|
+
p(new Date(n.deadline) < /* @__PURE__ */ new Date());
|
|
186
|
+
}, [n.deadline]), /* @__PURE__ */ a(
|
|
187
|
+
l,
|
|
188
|
+
{
|
|
189
|
+
className: "bg-gray-200 mx-n16 flex-fill border-bottom-0 border",
|
|
190
|
+
direction: "column",
|
|
191
|
+
children: [
|
|
192
|
+
/* @__PURE__ */ s(
|
|
193
|
+
T,
|
|
194
|
+
{
|
|
195
|
+
collection: n,
|
|
196
|
+
context: j.SUBMISSION,
|
|
197
|
+
onClickBack: () => i("/list-submissions"),
|
|
198
|
+
handleUpdateSubmission: d
|
|
199
|
+
}
|
|
200
|
+
),
|
|
201
|
+
/* @__PURE__ */ a(h, { className: "flex-grow-1 p-16 gap-24", children: [
|
|
202
|
+
/* @__PURE__ */ s(
|
|
203
|
+
h.Col,
|
|
204
|
+
{
|
|
205
|
+
sm: "3",
|
|
206
|
+
md: "3",
|
|
207
|
+
lg: "3",
|
|
208
|
+
xl: "4",
|
|
209
|
+
className: "d-none d-lg-block",
|
|
210
|
+
as: "aside",
|
|
211
|
+
children: /* @__PURE__ */ s(I, { collection: n })
|
|
212
|
+
}
|
|
213
|
+
),
|
|
214
|
+
/* @__PURE__ */ a(
|
|
215
|
+
h.Col,
|
|
216
|
+
{
|
|
217
|
+
sm: "4",
|
|
218
|
+
md: "8",
|
|
219
|
+
lg: "5",
|
|
220
|
+
xl: "8",
|
|
221
|
+
className: `${t ? "cancel-gap" : ""}`,
|
|
222
|
+
children: [
|
|
223
|
+
!t && /* @__PURE__ */ s(I, { collection: n, isMobile: !0 }),
|
|
224
|
+
/* @__PURE__ */ s(Y, { submission: o })
|
|
225
|
+
]
|
|
226
|
+
}
|
|
227
|
+
)
|
|
228
|
+
] }),
|
|
229
|
+
/* @__PURE__ */ s(
|
|
230
|
+
X,
|
|
231
|
+
{
|
|
232
|
+
handleUpdateSubmission: d,
|
|
233
|
+
onClose: c,
|
|
234
|
+
isOpen: e
|
|
235
|
+
}
|
|
236
|
+
)
|
|
237
|
+
]
|
|
238
|
+
}
|
|
239
|
+
);
|
|
240
|
+
}, ms = (n) => async ({ params: o }) => {
|
|
241
|
+
const i = Number(o.collectionId), t = Number(o.submissionId);
|
|
242
|
+
return await n.ensureQueryData(
|
|
243
|
+
G(i, t)
|
|
244
|
+
), await n.ensureQueryData(K(i)), null;
|
|
245
|
+
}, bs = () => {
|
|
246
|
+
const n = k(), { isLoading: o, data: i } = z(
|
|
247
|
+
Number(n.collectionId),
|
|
248
|
+
Number(n.submissionId)
|
|
249
|
+
), { data: t, isLoading: e } = V(
|
|
250
|
+
Number(n.collectionId)
|
|
251
|
+
);
|
|
252
|
+
return o || e ? /* @__PURE__ */ s(P, {}) : !t || !i ? /* @__PURE__ */ s(J, {}) : /* @__PURE__ */ s(_, { collection: t, submission: i });
|
|
253
|
+
};
|
|
254
|
+
export {
|
|
255
|
+
bs as Submission,
|
|
256
|
+
ms as loader
|
|
257
|
+
};
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import { jsx as t, Fragment as C, jsxs as r } from "react/jsx-runtime";
|
|
2
|
+
import { useEdificeClient as b, SegmentedControl as D, useDate as I, useDirectory as B, Card as p, Flex as g, Avatar as w, Badge as F, LoadingScreen as M, EmptyScreen as E, Grid as f, Button as P, useBreakpoint as $ } from "@edifice.io/react";
|
|
3
|
+
import { S as j } from "./SearchBarCollect-DBKaVVDV.js";
|
|
4
|
+
import { CollectionStatus as N, SubmissionStatus as v } from "@edifice.io/collect-client-rest";
|
|
5
|
+
import { useTranslation as x } from "react-i18next";
|
|
6
|
+
import { create as R } from "zustand";
|
|
7
|
+
import { c as U, b as Y, d as k } from "./index-HU8ua_Ev.js";
|
|
8
|
+
import { IconRafterDown as z } from "@edifice.io/react/icons";
|
|
9
|
+
import { useNavigate as A } from "react-router-dom";
|
|
10
|
+
import { E as G } from "./emptyscreen-list-collection-CWGxO4Ss.js";
|
|
11
|
+
import { u as O } from "./useGetStatusSubmission-DxHmLPxr.js";
|
|
12
|
+
const Q = {
|
|
13
|
+
search: "",
|
|
14
|
+
filter: void 0
|
|
15
|
+
}, S = U(
|
|
16
|
+
R((e) => ({
|
|
17
|
+
...Q,
|
|
18
|
+
setFilter: (s) => e({ filter: s }),
|
|
19
|
+
setSearchSubmission: (s) => e({ search: s })
|
|
20
|
+
}))
|
|
21
|
+
), V = () => {
|
|
22
|
+
const { appCode: e } = b(), { t: s } = x(e), { filter: o, setFilter: n } = S(), i = [
|
|
23
|
+
{
|
|
24
|
+
label: s("collection.submissionList.filter.all"),
|
|
25
|
+
value: "all"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
label: s("collection.submissionList.filter.toSubmit"),
|
|
29
|
+
value: N.TO_SUBMIT
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
label: s("collection.submissionList.filter.submitted"),
|
|
33
|
+
value: N.SUBMITTED
|
|
34
|
+
}
|
|
35
|
+
];
|
|
36
|
+
return /* @__PURE__ */ t(C, { children: /* @__PURE__ */ t(
|
|
37
|
+
D,
|
|
38
|
+
{
|
|
39
|
+
"data-testid": "collect-segmented-control-submission-filter",
|
|
40
|
+
onChange: (l) => {
|
|
41
|
+
n(l === "all" ? void 0 : l);
|
|
42
|
+
},
|
|
43
|
+
options: i,
|
|
44
|
+
value: o ?? "all"
|
|
45
|
+
}
|
|
46
|
+
) });
|
|
47
|
+
}, W = ({
|
|
48
|
+
collectionToSubmit: e,
|
|
49
|
+
onClick: s
|
|
50
|
+
}) => {
|
|
51
|
+
const { fromNow: o, formatDate: n } = I(), { getAvatarURL: i } = B(), { appCode: m } = b(), { t: l } = x(m), { getSubmissionStatus: c } = O(), a = e.status === v.SUBMITTED || e.status === v.VERIFIED, u = i(e.createdBy.entId, "user"), d = new Date(e.deadline) < /* @__PURE__ */ new Date(), h = c({
|
|
52
|
+
status: e.status,
|
|
53
|
+
isPastDeadline: d,
|
|
54
|
+
isSubmissionCard: !0
|
|
55
|
+
});
|
|
56
|
+
return /* @__PURE__ */ r(p, { isSelectable: !1, onClick: s, isSelected: !1, children: [
|
|
57
|
+
/* @__PURE__ */ r(p.Body, { children: [
|
|
58
|
+
/* @__PURE__ */ r(
|
|
59
|
+
g,
|
|
60
|
+
{
|
|
61
|
+
justify: "center",
|
|
62
|
+
align: "center",
|
|
63
|
+
direction: "column",
|
|
64
|
+
className: `rounded-2 ${d ? "bg-gray-300" : a ? "bg-green-200" : "bg-orange-200"}`,
|
|
65
|
+
style: { minWidth: "80px", height: "80px" },
|
|
66
|
+
children: [
|
|
67
|
+
/* @__PURE__ */ t(
|
|
68
|
+
"p",
|
|
69
|
+
{
|
|
70
|
+
className: `h2 ${d ? "text-gray-800" : a ? "text-green-800" : "text-orange-500"}`,
|
|
71
|
+
children: n(e.deadline, "D")
|
|
72
|
+
}
|
|
73
|
+
),
|
|
74
|
+
/* @__PURE__ */ t(
|
|
75
|
+
"p",
|
|
76
|
+
{
|
|
77
|
+
className: `caption ${d ? "text-gray-800" : a ? "text-green-800" : "text-orange-500"}`,
|
|
78
|
+
children: n(e.deadline, "MMM")
|
|
79
|
+
}
|
|
80
|
+
),
|
|
81
|
+
/* @__PURE__ */ t(
|
|
82
|
+
"p",
|
|
83
|
+
{
|
|
84
|
+
className: `caption ${d ? "text-gray-800" : a ? "text-green-800" : "text-orange-500"}`,
|
|
85
|
+
children: n(e.deadline, "YYYY")
|
|
86
|
+
}
|
|
87
|
+
)
|
|
88
|
+
]
|
|
89
|
+
}
|
|
90
|
+
),
|
|
91
|
+
/* @__PURE__ */ r("div", { className: "text-truncate", children: [
|
|
92
|
+
/* @__PURE__ */ t(p.Title, { children: e.name }),
|
|
93
|
+
/* @__PURE__ */ t(p.Text, { children: /* @__PURE__ */ r("em", { children: [
|
|
94
|
+
l("collection.planned"),
|
|
95
|
+
" ",
|
|
96
|
+
o(e.createdAt)
|
|
97
|
+
] }) })
|
|
98
|
+
] })
|
|
99
|
+
] }),
|
|
100
|
+
/* @__PURE__ */ t(p.Footer, { children: /* @__PURE__ */ r(g, { className: "gap-8 text-truncate w-100", justify: "between", children: [
|
|
101
|
+
/* @__PURE__ */ r(g, { className: "gap-8", align: "center", children: [
|
|
102
|
+
/* @__PURE__ */ t(
|
|
103
|
+
w,
|
|
104
|
+
{
|
|
105
|
+
alt: e.createdBy.displayName,
|
|
106
|
+
size: "xs",
|
|
107
|
+
src: u,
|
|
108
|
+
variant: "circle"
|
|
109
|
+
}
|
|
110
|
+
),
|
|
111
|
+
/* @__PURE__ */ t("div", { className: "small text-truncate", children: e.createdBy.displayName })
|
|
112
|
+
] }),
|
|
113
|
+
/* @__PURE__ */ t(g, { className: "gap-8", align: "center", children: /* @__PURE__ */ t(F, { variant: h.variant, children: h.text }) })
|
|
114
|
+
] }) })
|
|
115
|
+
] });
|
|
116
|
+
}, _ = () => {
|
|
117
|
+
var h, y;
|
|
118
|
+
const { filter: e, search: s } = S(), o = e || void 0, n = s || void 0, { data: i, isLoading: m, fetchNextPage: l } = Y({
|
|
119
|
+
filter: o,
|
|
120
|
+
search: n
|
|
121
|
+
}), c = (y = (h = i == null ? void 0 : i.pages) == null ? void 0 : h[i.pages.length - 1]) == null ? void 0 : y.meta, a = !!c && Number(c.currentPage ?? 0) < Number(c.totalPages ?? 0), u = (i == null ? void 0 : i.pages.flatMap((L) => L.items)) ?? [], d = u.length > 0;
|
|
122
|
+
return {
|
|
123
|
+
collectionsToSubmit: u,
|
|
124
|
+
isLoading: m,
|
|
125
|
+
hasMoreResources: a,
|
|
126
|
+
hasData: d,
|
|
127
|
+
fetchNextPage: l
|
|
128
|
+
};
|
|
129
|
+
}, q = () => {
|
|
130
|
+
const { appCode: e } = b(), { t: s } = x(e), o = A(), {
|
|
131
|
+
collectionsToSubmit: n,
|
|
132
|
+
isLoading: i,
|
|
133
|
+
hasMoreResources: m,
|
|
134
|
+
hasData: l,
|
|
135
|
+
fetchNextPage: c
|
|
136
|
+
} = _();
|
|
137
|
+
return i ? /* @__PURE__ */ t(M, {}) : l ? /* @__PURE__ */ r(f, { className: "w-100 p-24", "data-testid": "collect-list-submissions-grid", children: [
|
|
138
|
+
n.map((a, u) => /* @__PURE__ */ t(f.Col, { sm: "4", md: "4", lg: "4", xl: "4", children: /* @__PURE__ */ t(
|
|
139
|
+
W,
|
|
140
|
+
{
|
|
141
|
+
"data-testid": "collect-list-submissions-card",
|
|
142
|
+
collectionToSubmit: a,
|
|
143
|
+
onClick: () => o(
|
|
144
|
+
`/list-collections/id/${a.collectionId}/submission/${a.submissionId}`
|
|
145
|
+
)
|
|
146
|
+
}
|
|
147
|
+
) }, u)),
|
|
148
|
+
m && /* @__PURE__ */ t(f.Col, { sm: "4", md: "8", lg: "12", xl: "12", children: /* @__PURE__ */ t(g, { justify: "center", children: /* @__PURE__ */ t(
|
|
149
|
+
P,
|
|
150
|
+
{
|
|
151
|
+
"data-testid": "collect-list-submissions-button-more",
|
|
152
|
+
className: "px-48",
|
|
153
|
+
type: "button",
|
|
154
|
+
color: "secondary",
|
|
155
|
+
variant: "filled",
|
|
156
|
+
rightIcon: /* @__PURE__ */ t(z, {}),
|
|
157
|
+
onClick: () => c(),
|
|
158
|
+
children: s("collection.see.more")
|
|
159
|
+
}
|
|
160
|
+
) }) })
|
|
161
|
+
] }) : /* @__PURE__ */ t("div", { className: "py-24", children: /* @__PURE__ */ t(
|
|
162
|
+
E,
|
|
163
|
+
{
|
|
164
|
+
imageSrc: G,
|
|
165
|
+
title: s("collection.collectionList.emptyScreen.title"),
|
|
166
|
+
text: s("collection.collectionList.emptyScreen.description")
|
|
167
|
+
}
|
|
168
|
+
) });
|
|
169
|
+
}, ae = async (e) => (await e.prefetchInfiniteQuery(
|
|
170
|
+
k({
|
|
171
|
+
search: void 0,
|
|
172
|
+
filter: void 0
|
|
173
|
+
})
|
|
174
|
+
), null), re = () => {
|
|
175
|
+
const { lg: e } = $(), s = S(
|
|
176
|
+
(o) => o.setSearchSubmission
|
|
177
|
+
);
|
|
178
|
+
return /* @__PURE__ */ r(C, { children: [
|
|
179
|
+
/* @__PURE__ */ r(
|
|
180
|
+
g,
|
|
181
|
+
{
|
|
182
|
+
align: e ? "center" : "start",
|
|
183
|
+
direction: e ? "row" : "column",
|
|
184
|
+
className: "bg-gray-200 px-24 py-16 gap-16",
|
|
185
|
+
children: [
|
|
186
|
+
/* @__PURE__ */ t(j, { setSearch: s }),
|
|
187
|
+
/* @__PURE__ */ t(V, {})
|
|
188
|
+
]
|
|
189
|
+
}
|
|
190
|
+
),
|
|
191
|
+
/* @__PURE__ */ t(q, {})
|
|
192
|
+
] });
|
|
193
|
+
};
|
|
194
|
+
export {
|
|
195
|
+
re as SubmissionsList,
|
|
196
|
+
ae as loader
|
|
197
|
+
};
|