@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.
Files changed (36) hide show
  1. package/lib/AppHeaderCollection-CdMZTmC6.js +170 -0
  2. package/lib/{CXEL7IU7-DVs75C4a.js → CXEL7IU7-BLUeaFt5.js} +2 -2
  3. package/lib/Collection-CUCjNGrr.js +472 -0
  4. package/lib/CollectionsLayout-DVYmui3o.js +187 -0
  5. package/lib/CollectionsList-Ba1LoCCN.js +310 -0
  6. package/lib/DeleteCollectionModal-CtmfiR2H.js +71 -0
  7. package/lib/DropdownActionTable-BhSk2sde.js +84 -0
  8. package/lib/FormEdit-DZFkw7z9.js +102 -0
  9. package/lib/{HASRA6WW-qb64R1U-.js → HASRA6WW-BPaxT9L-.js} +269 -269
  10. package/lib/{I3HPI4QX-DhV4n2OZ.js → I3HPI4QX-BuVHGkjY.js} +2 -2
  11. package/lib/MembersEdit-CblCChDS.js +77 -0
  12. package/lib/Root--z47Brfh.js +17 -0
  13. package/lib/SearchBarCollect-DBKaVVDV.js +23 -0
  14. package/lib/Submission-AzDGz_dM.js +257 -0
  15. package/lib/SubmissionList-Db_nRSqg.js +197 -0
  16. package/lib/index-HU8ua_Ev.js +3297 -0
  17. package/lib/index.js +7 -43
  18. package/lib/{submission.queries-CslqTzEP.js → submission.queries-Cr0bP5uv.js} +20 -17
  19. package/lib/useGetStatusSubmission-DxHmLPxr.js +57 -0
  20. package/package.json +1 -1
  21. package/lib/AppHeaderCollection-Bglbw6q9.js +0 -188
  22. package/lib/Collection-DYHQunUI.js +0 -463
  23. package/lib/CollectionsLayout-CPYEwl1X.js +0 -361
  24. package/lib/CollectionsList-Inb9z2nB.js +0 -315
  25. package/lib/DeleteCollectionModal-Dzsn2899.js +0 -112
  26. package/lib/DropdownActionTable-BLHrdk4t.js +0 -83
  27. package/lib/FormEdit-CwVhj3_4.js +0 -96
  28. package/lib/MathsModal-D8rTl0Sb.js +0 -42
  29. package/lib/MembersEdit-DDj8IWMX.js +0 -72
  30. package/lib/Root-DbGwe5v1.js +0 -13
  31. package/lib/SearchBarCollect-BAnLCwAC.js +0 -21
  32. package/lib/Submission-DUcQiBve.js +0 -249
  33. package/lib/SubmissionList-DjQ0x7eD.js +0 -695
  34. package/lib/heic-to-DuZ6uPPi.js +0 -72
  35. package/lib/index-Dt9ykSDF.js +0 -171658
  36. package/lib/useGetStatusSubmission-D77F1XUy.js +0 -55
@@ -0,0 +1,170 @@
1
+ import { jsxs as c, jsx as o } from "react/jsx-runtime";
2
+ import { useEdificeClient as m, Flex as r, Button as u, IconButton as I, useBreakpoint as f, useDate as S, Badge as g } from "@edifice.io/react";
3
+ import { IconPinOn as O, IconOptions as y, IconSave as L, IconSend as v, IconArrowLeft as M, IconCalendarLight as N } from "@edifice.io/react/icons";
4
+ import { useTranslation as p } from "react-i18next";
5
+ import { u as b, D as w } from "./DropdownActionTable-BhSk2sde.js";
6
+ import { ContribSubmissionStatus as x } from "@edifice.io/collect-client-rest";
7
+ import { create as A } from "zustand";
8
+ import { c as H } from "./index-HU8ua_Ev.js";
9
+ const D = ({
10
+ collection: n
11
+ }) => {
12
+ const { appCode: t } = m(), { t: i } = p(t), e = b.use.onOpenInstructionModal();
13
+ return /* @__PURE__ */ c(r, { gap: "16", justify: "end", children: [
14
+ /* @__PURE__ */ o(
15
+ u,
16
+ {
17
+ "data-testid": "collect-collection-actions-button-instruction",
18
+ variant: "outline",
19
+ color: "primary",
20
+ leftIcon: /* @__PURE__ */ o(O, {}),
21
+ onClick: e,
22
+ children: i("collection.appHeaderCollection.collection.button.instruction")
23
+ }
24
+ ),
25
+ /* @__PURE__ */ o(w, { collectionId: n.id, isCollection: !0, children: (l) => /* @__PURE__ */ o(
26
+ I,
27
+ {
28
+ ...l,
29
+ className: "icon-button-hover-no-transition bg-white",
30
+ type: "button",
31
+ "aria-label": "label",
32
+ "data-testid": "collect-collection-actions-button-options",
33
+ color: "primary",
34
+ variant: "outline",
35
+ icon: /* @__PURE__ */ o(y, {})
36
+ }
37
+ ) })
38
+ ] });
39
+ }, k = A((n) => ({
40
+ submissionId: null,
41
+ submissionContent: "",
42
+ isUpdateSubmissionModalOpen: !1,
43
+ submissionHasContent: !1,
44
+ submissionIsLoading: !1,
45
+ onOpenUpdateSubmissionModal: () => n({ isUpdateSubmissionModalOpen: !0 }),
46
+ onCloseUpdateSubmissionModal: () => n({ isUpdateSubmissionModalOpen: !1 }),
47
+ setSubmissionData: (t, i) => n({ submissionContent: t, submissionHasContent: i }),
48
+ setSubmissionIsLoading: (t) => n({ submissionIsLoading: t }),
49
+ hydrateSubmissionContent: (t) => n((i) => i.submissionId === t.id ? i : {
50
+ submissionId: t.id,
51
+ submissionContent: t.content || ""
52
+ })
53
+ })), B = H(
54
+ k
55
+ ), T = ({
56
+ handleUpdateSubmission: n
57
+ }) => {
58
+ const { appCode: t } = m(), { t: i } = p(t), e = b.use.isPastDeadline(), {
59
+ submissionHasContent: l,
60
+ submissionIsLoading: d,
61
+ onOpenUpdateSubmissionModal: a
62
+ } = B((s) => ({
63
+ onOpenUpdateSubmissionModal: s.onOpenUpdateSubmissionModal,
64
+ submissionHasContent: s.submissionHasContent,
65
+ submissionIsLoading: s.submissionIsLoading
66
+ }));
67
+ return /* @__PURE__ */ c(r, { gap: "16", justify: "end", children: [
68
+ /* @__PURE__ */ o(
69
+ u,
70
+ {
71
+ "data-testid": "collect-submission-app-header-actions-draft-button",
72
+ variant: "outline",
73
+ color: "primary",
74
+ leftIcon: /* @__PURE__ */ o(L, {}),
75
+ disabled: e,
76
+ isLoading: d,
77
+ onClick: () => n == null ? void 0 : n({
78
+ status: x.DRAFT
79
+ }),
80
+ children: i("collection.appHeaderSubmission.submission.button.draft")
81
+ }
82
+ ),
83
+ /* @__PURE__ */ o(
84
+ u,
85
+ {
86
+ "data-testid": "collect-submission-app-header-actions-send-button",
87
+ variant: "filled",
88
+ color: "primary",
89
+ leftIcon: /* @__PURE__ */ o(v, {}),
90
+ disabled: e || !l,
91
+ onClick: () => a(),
92
+ children: i("collection.appHeaderSubmission.submission.button.send")
93
+ }
94
+ )
95
+ ] });
96
+ };
97
+ var C = /* @__PURE__ */ ((n) => (n.COLLECTION = "COLLECTION", n.SUBMISSION = "SUBMISSION", n))(C || {});
98
+ const W = ({
99
+ collection: n,
100
+ onClickBack: t,
101
+ context: i,
102
+ handleUpdateSubmission: e
103
+ }) => {
104
+ const { appCode: l } = m(), { t: d } = p(l), { lg: a, md: s } = f(), { formatDate: h } = S();
105
+ return /* @__PURE__ */ c("div", { className: `py-16 border-bottom bg-white ${s ? "px-48" : "px-16"}`, children: [
106
+ /* @__PURE__ */ o(r, { align: "center", gap: "8", children: /* @__PURE__ */ o(
107
+ u,
108
+ {
109
+ "data-testid": "collect-submission-app-header-button-back",
110
+ className: "text-gray-700",
111
+ color: "tertiary",
112
+ leftIcon: /* @__PURE__ */ o(M, { width: 20, height: 20 }),
113
+ type: "button",
114
+ variant: "ghost",
115
+ size: "sm",
116
+ onClick: t,
117
+ children: d("collection.back")
118
+ }
119
+ ) }),
120
+ /* @__PURE__ */ c(
121
+ r,
122
+ {
123
+ className: "w-100 mt-24",
124
+ justify: "between",
125
+ align: a ? "center" : "end",
126
+ gap: "12",
127
+ direction: a ? "row" : "column",
128
+ children: [
129
+ /* @__PURE__ */ c(
130
+ "div",
131
+ {
132
+ className: `${s && "d-flex"} ${!a && "w-100"}`,
133
+ style: { maxWidth: a ? "70%" : "100%" },
134
+ children: [
135
+ /* @__PURE__ */ o(
136
+ "h2",
137
+ {
138
+ className: `text-truncate ${s ? "me-12" : "mb-12 text-truncate-2"}`,
139
+ children: n.name
140
+ }
141
+ ),
142
+ /* @__PURE__ */ o(
143
+ g,
144
+ {
145
+ className: "lh-base",
146
+ style: { height: "3rem" },
147
+ variant: {
148
+ level: "info",
149
+ type: "notification"
150
+ },
151
+ children: /* @__PURE__ */ c(r, { align: "center", gap: "8", children: [
152
+ /* @__PURE__ */ o(N, { height: 20, width: 20 }),
153
+ `${d("collection.appHeaderCollection.deadline")} ${h(n.deadline)}`
154
+ ] })
155
+ }
156
+ )
157
+ ]
158
+ }
159
+ ),
160
+ i === C.COLLECTION ? /* @__PURE__ */ o(D, { collection: n }) : /* @__PURE__ */ o(T, { handleUpdateSubmission: e })
161
+ ]
162
+ }
163
+ )
164
+ ] });
165
+ };
166
+ export {
167
+ W as A,
168
+ C,
169
+ B as u
170
+ };
@@ -1,5 +1,5 @@
1
- import { c as s, T as c, P as u, a as i, b as m, C as P, Q as d } from "./HASRA6WW-qb64R1U-.js";
2
- import { aP as v, aQ as C, aR as e } from "./index-Dt9ykSDF.js";
1
+ import { c as s, T as c, P as u, a as i, b as m, C as P, Q as d } from "./HASRA6WW-BPaxT9L-.js";
2
+ import { l as v, m as C, n as e } from "./index-HU8ua_Ev.js";
3
3
  var h = (t) => {
4
4
  const [r, o] = s({
5
5
  prefix: "TanstackQueryDevtools"
@@ -0,0 +1,472 @@
1
+ import { jsxs as l, jsx as e, Fragment as Q } from "react/jsx-runtime";
2
+ import { SubmissionStatus as f, ManagerSubmissionStatus as M, WORKFLOW_RIGHTS as z } from "@edifice.io/collect-client-rest";
3
+ import { useDirectory as R, Flex as u, Avatar as P, Badge as v, useEdificeClient as w, Heading as O, Table as C, Button as x, LoadingScreen as T, Modal as I, Dropdown as N, useToast as G, useBreakpoint as j, useDate as _, EmptyScreen as K, Checkbox as Y, Grid as L, useHasWorkflow as J } from "@edifice.io/react";
4
+ import { useNavigate as $, useParams as X } from "react-router-dom";
5
+ import { useState as A, useEffect as k } from "react";
6
+ import { A as Z, C as q } from "./AppHeaderCollection-CdMZTmC6.js";
7
+ import { IconUsers as ee, IconRafterDown as U, IconEdit as te, IconTextPage as se, IconCalendarLight as ne } from "@edifice.io/react/icons";
8
+ import { useTranslation as D } from "react-i18next";
9
+ import { u as ie, a as oe, s as ae } from "./submission.queries-Cr0bP5uv.js";
10
+ import { create as ce } from "zustand";
11
+ import { c as le, e as re, P as de, f as ue } from "./index-HU8ua_Ev.js";
12
+ import { u as F } from "./useGetStatusSubmission-DxHmLPxr.js";
13
+ import { u as E } from "./DropdownActionTable-BhSk2sde.js";
14
+ import { D as me } from "./DeleteCollectionModal-CtmfiR2H.js";
15
+ import { Editor as H } from "@edifice.io/react/editor";
16
+ import { E as he } from "./emptyscreen-list-collection-CWGxO4Ss.js";
17
+ const W = (t) => {
18
+ var h;
19
+ const { data: o, isLoading: s, fetchNextPage: r, hasNextPage: c } = ie(t == null ? void 0 : t.id), [a, g] = A(
20
+ null
21
+ ), i = (n) => a === n.id, b = (n) => a === n.id ? "bg-gray-300" : "";
22
+ return {
23
+ submissions: ((h = o == null ? void 0 : o.pages) == null ? void 0 : h.flatMap((n) => n.items)) ?? [],
24
+ isLoading: s,
25
+ hasNextPage: c,
26
+ isHovered: i,
27
+ setHoveredSubmissionId: g,
28
+ getBgColor: b,
29
+ fetchNextPage: r
30
+ };
31
+ }, ge = ce((t) => ({
32
+ selectedSubmissionListMenu: null,
33
+ setSelectedSubmissionListMenu: (o) => t({ selectedSubmissionListMenu: o })
34
+ })), B = le(
35
+ ge
36
+ ), V = ({
37
+ submission: t
38
+ }) => {
39
+ const { getAvatarURL: o } = R(), { getSubmissionStatus: s } = F(), r = E.use.isPastDeadline(), c = s({
40
+ status: t.status,
41
+ isPastDeadline: r
42
+ }), a = o(t.createdBy.entId, "user");
43
+ return /* @__PURE__ */ l(u, { justify: "between", align: "center", className: "w-100", gap: "8", children: [
44
+ /* @__PURE__ */ l(u, { align: "center", gap: "12", style: { minWidth: 0 }, children: [
45
+ /* @__PURE__ */ e(
46
+ P,
47
+ {
48
+ alt: t.createdBy.displayName,
49
+ size: "xs",
50
+ src: a,
51
+ variant: "circle"
52
+ }
53
+ ),
54
+ /* @__PURE__ */ e("p", { className: "text-truncate", children: t.createdBy.displayName })
55
+ ] }),
56
+ /* @__PURE__ */ e(v, { variant: c.variant, children: c.text })
57
+ ] });
58
+ }, pe = ({
59
+ collection: t
60
+ }) => {
61
+ const { appCode: o } = w(), { t: s } = D(o), {
62
+ setHoveredSubmissionId: r,
63
+ getBgColor: c,
64
+ submissions: a,
65
+ fetchNextPage: g,
66
+ hasNextPage: i,
67
+ isLoading: b
68
+ } = W(t), { setSelectedSubmissionListMenu: h, selectedSubmissionListMenu: n } = B();
69
+ k(() => {
70
+ if (a.length === 0)
71
+ return;
72
+ a.some(
73
+ (p) => p.id === (n == null ? void 0 : n.id)
74
+ ) || h(a[0]);
75
+ }, [
76
+ n == null ? void 0 : n.id,
77
+ h,
78
+ a
79
+ ]);
80
+ const y = (m) => {
81
+ h(m);
82
+ };
83
+ return /* @__PURE__ */ l("div", { className: "py-24 border-end h-100 bg-white rounded-start-4", children: [
84
+ /* @__PURE__ */ e("div", { children: /* @__PURE__ */ l(u, { gap: "8", align: "center", className: "px-24 mb-16", children: [
85
+ /* @__PURE__ */ e(
86
+ u,
87
+ {
88
+ className: "bg-secondary-200 rounded",
89
+ align: "center",
90
+ justify: "center",
91
+ style: { minWidth: "36px", height: "36px" },
92
+ children: /* @__PURE__ */ e(ee, {})
93
+ }
94
+ ),
95
+ /* @__PURE__ */ e(O, { level: "h4", headingStyle: "h4", className: "text-truncate", children: s("collection.submissionList.title") }),
96
+ /* @__PURE__ */ e(
97
+ v,
98
+ {
99
+ variant: {
100
+ type: "chip"
101
+ },
102
+ children: a.length
103
+ }
104
+ )
105
+ ] }) }),
106
+ b ? /* @__PURE__ */ e(T, {}) : a.length > 0 && /* @__PURE__ */ l("div", { className: "table-submissions", children: [
107
+ /* @__PURE__ */ e(C, { "data-testid": "collect-collection-submissions-list-table", children: /* @__PURE__ */ e(C.Tbody, { children: a.map((m) => {
108
+ const p = c(m);
109
+ return /* @__PURE__ */ e(
110
+ C.Tr,
111
+ {
112
+ "data-testid": "collect-collection-submissions-list-row",
113
+ onMouseEnter: () => r(m.id),
114
+ onMouseLeave: () => r(null),
115
+ onClick: () => y(m),
116
+ children: /* @__PURE__ */ e(
117
+ C.Td,
118
+ {
119
+ className: `p-16 c-pointer ${p} ${(n == null ? void 0 : n.id) === m.id ? "bg-secondary-200" : ""}`,
120
+ style: { maxWidth: 0 },
121
+ children: /* @__PURE__ */ e(V, { submission: m })
122
+ }
123
+ )
124
+ },
125
+ m.id
126
+ );
127
+ }) }) }),
128
+ i && /* @__PURE__ */ e(u, { justify: "center", className: "mt-16", children: /* @__PURE__ */ e(
129
+ x,
130
+ {
131
+ "data-testid": "collect-collection-submissions-list-button-more",
132
+ className: "px-48",
133
+ type: "button",
134
+ color: "secondary",
135
+ variant: "filled",
136
+ rightIcon: /* @__PURE__ */ e(U, {}),
137
+ onClick: () => g(),
138
+ children: s("collection.see.more")
139
+ }
140
+ ) })
141
+ ] })
142
+ ] });
143
+ }, be = ({
144
+ collection: t
145
+ }) => {
146
+ const { appCode: o } = w(), { t: s } = D(o), r = $(), { isInstructionModalOpen: c, onCloseInstructionModal: a } = E((i) => ({
147
+ isInstructionModalOpen: i.isInstructionModalOpen,
148
+ onCloseInstructionModal: i.onCloseInstructionModal
149
+ })), g = () => {
150
+ a(), r(`/id/${t.id}/form`);
151
+ };
152
+ return /* @__PURE__ */ l(
153
+ I,
154
+ {
155
+ id: "instruction-modal",
156
+ isOpen: c,
157
+ onModalClose: a,
158
+ size: "lg",
159
+ children: [
160
+ /* @__PURE__ */ e(I.Header, { onModalClose: a, children: s("collection.submission.instruction.title") }),
161
+ /* @__PURE__ */ e(I.Body, { children: /* @__PURE__ */ e(
162
+ H,
163
+ {
164
+ content: t.content,
165
+ mode: "read",
166
+ toolbar: "none",
167
+ variant: "ghost"
168
+ }
169
+ ) }),
170
+ /* @__PURE__ */ l(I.Footer, { children: [
171
+ /* @__PURE__ */ e(
172
+ x,
173
+ {
174
+ "data-testid": "collect-collection-modal-instruction-button-close",
175
+ color: "tertiary",
176
+ variant: "ghost",
177
+ onClick: a,
178
+ children: s("collection.cancel")
179
+ }
180
+ ),
181
+ /* @__PURE__ */ e(
182
+ x,
183
+ {
184
+ "data-testid": "collect-collection-modal-instruction-button-edit",
185
+ onClick: g,
186
+ leftIcon: /* @__PURE__ */ e(te, {}),
187
+ children: s("collection.modify")
188
+ }
189
+ )
190
+ ] })
191
+ ]
192
+ }
193
+ );
194
+ }, fe = ({
195
+ collection: t
196
+ }) => {
197
+ const { appCode: o } = w(), { t: s } = D(o), { getAvatarURL: r } = R(), { submissions: c, fetchNextPage: a, hasNextPage: g, isLoading: i } = W(t), { getSubmissionStatus: b } = F(), { setSelectedSubmissionListMenu: h, selectedSubmissionListMenu: n } = B((d) => ({
198
+ selectedSubmissionListMenu: d.selectedSubmissionListMenu,
199
+ setSelectedSubmissionListMenu: d.setSelectedSubmissionListMenu
200
+ })), y = E.use.isPastDeadline();
201
+ k(() => {
202
+ if (c.length === 0)
203
+ return;
204
+ c.some(
205
+ (S) => S.id === (n == null ? void 0 : n.id)
206
+ ) || h(c[0] ?? null);
207
+ }, [
208
+ n == null ? void 0 : n.id,
209
+ h,
210
+ c
211
+ ]);
212
+ const m = c.find((d) => d.id === (n == null ? void 0 : n.id)) ?? c[0];
213
+ if (!m)
214
+ return null;
215
+ const p = (d) => {
216
+ h(d);
217
+ };
218
+ return /* @__PURE__ */ e("div", { className: "position-relative w-100 p-8 ", children: /* @__PURE__ */ e("div", { className: "bg-white", children: i ? /* @__PURE__ */ e(T, {}) : /* @__PURE__ */ l(
219
+ N,
220
+ {
221
+ block: !0,
222
+ "data-testid": "collect-collection-submissions-list-dropdown-mobile",
223
+ children: [
224
+ /* @__PURE__ */ e(
225
+ N.Trigger,
226
+ {
227
+ label: /* @__PURE__ */ e(
228
+ V,
229
+ {
230
+ submission: m
231
+ },
232
+ m.id
233
+ )
234
+ }
235
+ ),
236
+ /* @__PURE__ */ l(N.Menu, { children: [
237
+ c.map((d) => {
238
+ const S = b({
239
+ status: d.status,
240
+ isPastDeadline: y
241
+ });
242
+ return /* @__PURE__ */ e(
243
+ N.Item,
244
+ {
245
+ onClick: () => p(d),
246
+ "data-testid": "collect-collection-submissions-list-dropdown-item-mobile",
247
+ children: /* @__PURE__ */ l(
248
+ u,
249
+ {
250
+ justify: "between",
251
+ align: "center",
252
+ className: "w-100",
253
+ gap: "8",
254
+ children: [
255
+ /* @__PURE__ */ l(u, { align: "center", gap: "12", style: { minWidth: 0 }, children: [
256
+ /* @__PURE__ */ e(
257
+ P,
258
+ {
259
+ alt: d.createdBy.displayName,
260
+ size: "xs",
261
+ src: r(d.createdBy.entId, "user"),
262
+ variant: "circle"
263
+ }
264
+ ),
265
+ /* @__PURE__ */ e("p", { className: "text-truncate", children: d.createdBy.displayName })
266
+ ] }),
267
+ /* @__PURE__ */ e(v, { variant: S.variant, children: S.text })
268
+ ]
269
+ }
270
+ )
271
+ },
272
+ d.id
273
+ );
274
+ }),
275
+ g && /* @__PURE__ */ e(u, { justify: "center", className: "mt-8", children: /* @__PURE__ */ e(
276
+ x,
277
+ {
278
+ "data-testid": "collect-collection-submissions-list-dropdown-button-more-mobile",
279
+ className: "px-48",
280
+ type: "button",
281
+ color: "secondary",
282
+ variant: "filled",
283
+ rightIcon: /* @__PURE__ */ e(U, {}),
284
+ onClick: () => a(),
285
+ children: s("collection.see.more")
286
+ }
287
+ ) })
288
+ ] })
289
+ ]
290
+ }
291
+ ) }) });
292
+ }, ye = ({
293
+ collectionId: t
294
+ }) => {
295
+ const { appCode: o } = w(), { t: s } = D(o), r = G(), { lg: c } = j(), [a, g] = A(!1), { selectedSubmissionListMenu: i, setSelectedSubmissionListMenu: b } = B(), h = (i == null ? void 0 : i.status) === f.VERIFIED, { formatDate: n } = _(), y = oe(), m = async (p) => {
296
+ if (i)
297
+ try {
298
+ g(!0), await y.mutateAsync({
299
+ collectionId: t,
300
+ submissionId: i.id,
301
+ data: {
302
+ status: p ? M.VERIFIED : M.SUBMITTED
303
+ }
304
+ }), b({
305
+ ...i,
306
+ status: p ? f.VERIFIED : f.SUBMITTED
307
+ }), r.success(s("collection.toast.success.submission.statusUpdate"));
308
+ } catch (d) {
309
+ console.error("Error updating submission status:", d), r.error(s("collection.toast.error.submission.statusUpdate"));
310
+ } finally {
311
+ g(!1);
312
+ }
313
+ };
314
+ return /* @__PURE__ */ l(
315
+ u,
316
+ {
317
+ className: "p-24 bg-white rounded-end-4 h-100",
318
+ direction: "column",
319
+ gap: "16",
320
+ children: [
321
+ /* @__PURE__ */ l(
322
+ u,
323
+ {
324
+ className: "mb-16",
325
+ justify: "between",
326
+ direction: c ? "row" : "column",
327
+ align: c ? "center" : "start",
328
+ gap: "16",
329
+ children: [
330
+ /* @__PURE__ */ l(u, { gap: "8", align: "center", children: [
331
+ /* @__PURE__ */ e(
332
+ u,
333
+ {
334
+ className: "bg-secondary-200 rounded",
335
+ align: "center",
336
+ justify: "center",
337
+ style: { minWidth: "36px", height: "36px" },
338
+ children: /* @__PURE__ */ e(se, {})
339
+ }
340
+ ),
341
+ /* @__PURE__ */ e(O, { level: "h4", headingStyle: "h4", className: "text-truncate", children: `${s("collection.submissionRender.title")} ${i == null ? void 0 : i.createdBy.displayName}` })
342
+ ] }),
343
+ /* @__PURE__ */ e(u, { justify: "end", children: i && [f.SUBMITTED, f.VERIFIED].includes(
344
+ i.status
345
+ ) && /* @__PURE__ */ e(
346
+ v,
347
+ {
348
+ className: "lh-base",
349
+ style: { height: "3rem" },
350
+ variant: {
351
+ level: "info",
352
+ type: "notification"
353
+ },
354
+ children: /* @__PURE__ */ l(u, { align: "center", gap: "8", children: [
355
+ /* @__PURE__ */ e(ne, { height: 20, width: 20 }),
356
+ `${s("collection.submissionRender.date")} ${n(i.updatedAt)}`
357
+ ] })
358
+ }
359
+ ) })
360
+ ]
361
+ }
362
+ ),
363
+ i && /* @__PURE__ */ l(Q, { children: [
364
+ /* @__PURE__ */ e(
365
+ H,
366
+ {
367
+ id: "submissionRead",
368
+ content: i.content ?? "",
369
+ mode: "read",
370
+ variant: "ghost"
371
+ }
372
+ ),
373
+ i.status === f.EMPTY ? /* @__PURE__ */ e(
374
+ K,
375
+ {
376
+ imageSrc: he,
377
+ title: s("collection.collectionList.emptyScreen.title"),
378
+ text: s("collection.submissionRender.emptyScreen.description")
379
+ }
380
+ ) : i.status !== f.DRAFT ? /* @__PURE__ */ e(u, { justify: "end", children: /* @__PURE__ */ e(
381
+ "div",
382
+ {
383
+ className: `border rounded p-8 ${h ? "bg-secondary-200 border-secondary" : ""}`,
384
+ children: /* @__PURE__ */ e(
385
+ Y,
386
+ {
387
+ "data-testid": "collect-collection-submissions-list-checkbox-validate",
388
+ checked: h,
389
+ label: s("collection.submissionRender.checkbox.label"),
390
+ onChange: () => m(!h),
391
+ disabled: a
392
+ }
393
+ )
394
+ }
395
+ ) }) : null
396
+ ] })
397
+ ]
398
+ }
399
+ );
400
+ }, Se = ({
401
+ collection: t
402
+ }) => {
403
+ const o = $(), { lg: s } = j(), r = E.use.setIsPastDeadline();
404
+ return r(new Date(t.deadline) < /* @__PURE__ */ new Date()), k(() => {
405
+ r(new Date(t.deadline) < /* @__PURE__ */ new Date());
406
+ }, [t.deadline]), /* @__PURE__ */ l(
407
+ u,
408
+ {
409
+ className: "bg-gray-200 mx-n16 flex-fill border-bottom-0 border",
410
+ direction: "column",
411
+ children: [
412
+ /* @__PURE__ */ e(
413
+ Z,
414
+ {
415
+ collection: t,
416
+ context: q.COLLECTION,
417
+ onClickBack: () => o("/list-collections")
418
+ }
419
+ ),
420
+ /* @__PURE__ */ l(L, { className: "flex-grow-1 m-16 gap-24", children: [
421
+ /* @__PURE__ */ e(
422
+ L.Col,
423
+ {
424
+ sm: "3",
425
+ md: "3",
426
+ lg: "3",
427
+ xl: "4",
428
+ className: "d-none d-lg-block",
429
+ as: "aside",
430
+ children: /* @__PURE__ */ e(pe, { collection: t })
431
+ }
432
+ ),
433
+ /* @__PURE__ */ l(
434
+ L.Col,
435
+ {
436
+ sm: "4",
437
+ md: "8",
438
+ lg: "5",
439
+ xl: "8",
440
+ className: `${s ? "cancel-gap me-0" : ""}`,
441
+ children: [
442
+ !s && /* @__PURE__ */ e(fe, { collection: t }),
443
+ /* @__PURE__ */ e(ye, { collectionId: t.id })
444
+ ]
445
+ }
446
+ )
447
+ ] }),
448
+ /* @__PURE__ */ e(
449
+ me,
450
+ {
451
+ onDeleteSuccess: () => o("/list-collections")
452
+ }
453
+ ),
454
+ /* @__PURE__ */ e(be, { collection: t })
455
+ ]
456
+ }
457
+ );
458
+ }, je = (t) => async ({ params: o }) => {
459
+ const s = Number(o.collectionId);
460
+ return await t.ensureQueryData(ue(s)), await t.prefetchInfiniteQuery(
461
+ ae(s)
462
+ ), null;
463
+ }, $e = () => {
464
+ const t = X(), o = J(z.COLLECTION_CREATE), { data: s, isLoading: r } = re(
465
+ Number(t.collectionId)
466
+ );
467
+ return r ? /* @__PURE__ */ e(T, {}) : !o || !s ? /* @__PURE__ */ e(de, {}) : /* @__PURE__ */ e(Se, { collection: s });
468
+ };
469
+ export {
470
+ $e as Collection,
471
+ je as loader
472
+ };