@edifice.io/collect-frontend 1.0.0 → 1.0.2

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 (114) hide show
  1. package/lib/components/AppActionHeader.d.ts +1 -0
  2. package/lib/components/AppActionHeaderContext.d.ts +11 -0
  3. package/lib/components/AppHeaderCollection.d.ts +12 -0
  4. package/lib/components/CollectApp/CollectApp.d.ts +26 -0
  5. package/lib/components/CollectApp/CollectAppContext.d.ts +13 -0
  6. package/lib/components/CollectAppActionHeader.d.ts +4 -0
  7. package/lib/components/InstructionCard.d.ts +5 -0
  8. package/lib/components/SearchBarCollect.d.ts +3 -0
  9. package/lib/components/SubmissionCard.d.ts +7 -0
  10. package/lib/config/constants.d.ts +6 -0
  11. package/lib/features/collect-form/components/CollectForm.d.ts +24 -0
  12. package/lib/features/collect-form/components/index.d.ts +3 -0
  13. package/lib/features/collect-form/hooks/index.d.ts +2 -0
  14. package/lib/features/collect-form/hooks/useCreateCollectionForm.d.ts +20 -0
  15. package/lib/features/collect-form/index.d.ts +3 -0
  16. package/lib/features/collection-actions/components/CollectionActions.d.ts +4 -0
  17. package/lib/features/collection-list/components/CollectionListTable.d.ts +1 -0
  18. package/lib/features/collection-list/components/CollectionListTableBody.d.ts +4 -0
  19. package/lib/features/collection-list/components/CollectionListTableFooter.d.ts +12 -0
  20. package/lib/features/collection-list/components/CollectionListTableHead.d.ts +1 -0
  21. package/lib/features/collection-list/hooks/useCollectionListTableBody.d.ts +7 -0
  22. package/lib/features/collection-list/hooks/useCollectionListTableHead.d.ts +12 -0
  23. package/lib/features/collection-list/hooks/useCollectionPagination.d.ts +11 -0
  24. package/lib/features/collection-list/store/collectionListStore.d.ts +26 -0
  25. package/lib/features/collection-submissions-list/components/CollectionSubmissionsList.d.ts +4 -0
  26. package/lib/features/collection-submissions-list/components/CollectionSubmissionsListMobile.d.ts +4 -0
  27. package/lib/features/collection-submissions-list/components/CollectionSubmissionsListTr.d.ts +4 -0
  28. package/lib/features/collection-submissions-list/components/CollectionSubmissionsListView.d.ts +4 -0
  29. package/lib/features/collection-submissions-list/components/CollectionSubmissionsRender.d.ts +3 -0
  30. package/lib/features/collection-submissions-list/hooks/useCollectionSubmissionsList.d.ts +10 -0
  31. package/lib/features/collection-submissions-list/store/collectionSubmissionListStore.d.ts +16 -0
  32. package/lib/features/creation-wizard/CreationWizard.d.ts +2 -0
  33. package/lib/features/creation-wizard/components/FormCreate.d.ts +7 -0
  34. package/lib/features/creation-wizard/components/Members.d.ts +9 -0
  35. package/lib/features/creation-wizard/components/WizardContext.d.ts +8 -0
  36. package/lib/features/creation-wizard/components/WizardHeader.d.ts +3 -0
  37. package/lib/features/creation-wizard/components/WizardLayout.d.ts +3 -0
  38. package/lib/features/creation-wizard/hooks/useAddMember.d.ts +15 -0
  39. package/lib/features/creation-wizard/sharing.utils.d.ts +12 -0
  40. package/lib/features/creation-wizard/store/wizardStore.d.ts +15 -0
  41. package/lib/features/dropdown-actions/components/DropdownActionTable.d.ts +7 -0
  42. package/lib/features/dropdown-actions/hooks/useDropdownActionTable.d.ts +13 -0
  43. package/lib/features/menu/components/CollectMenu.d.ts +5 -0
  44. package/lib/features/menu/components/DesktopMenu.d.ts +1 -0
  45. package/lib/features/menu/components/MenuContext.d.ts +13 -0
  46. package/lib/features/menu/components/MobileMenu.d.ts +1 -0
  47. package/lib/features/menu/store/menuStore.d.ts +20 -0
  48. package/lib/features/modal/components/DeleteCollectionModal.d.ts +3 -0
  49. package/lib/features/modal/components/InstructionModal.d.ts +4 -0
  50. package/lib/features/modal/components/UpdateSubmissionModal.d.ts +9 -0
  51. package/lib/features/modal/hooks/useDeleteCollectionModal.d.ts +5 -0
  52. package/lib/features/submission/components/SubmissionEdit.d.ts +4 -0
  53. package/lib/features/submission/components/SubmissionView.d.ts +5 -0
  54. package/lib/features/submission-actions/components/SubmissionActions.d.ts +6 -0
  55. package/lib/features/submission-list/components/SubmissionFilter.d.ts +1 -0
  56. package/lib/features/submission-list/components/SubmissionsListView.d.ts +1 -0
  57. package/lib/features/submission-list/hooks/useSubmissionPagination.d.ts +7 -0
  58. package/lib/features/submission-list/store/submissionListStore.d.ts +24 -0
  59. package/lib/hooks/useGetStatusSubmission.d.ts +12 -0
  60. package/lib/hooks/useSearch.d.ts +18 -0
  61. package/lib/hooks/useStepNavigations.d.ts +5 -0
  62. package/lib/hooks/useSubmissionForm.d.ts +12 -0
  63. package/lib/hooks/useWizard.d.ts +13 -0
  64. package/lib/i18n.d.ts +2 -0
  65. package/lib/index.d.ts +14 -1
  66. package/lib/index.js +14676 -15
  67. package/lib/main.d.ts +0 -0
  68. package/lib/models/collect.d.ts +12 -0
  69. package/lib/models/menu.d.ts +5 -0
  70. package/lib/pages/Collection.d.ts +4 -0
  71. package/lib/pages/CollectionsLayout.d.ts +2 -0
  72. package/lib/pages/CollectionsList.d.ts +3 -0
  73. package/lib/pages/FormEdit.d.ts +4 -0
  74. package/lib/pages/MembersEdit.d.ts +4 -0
  75. package/lib/pages/MineSubmission.d.ts +6 -0
  76. package/lib/pages/NotFound.d.ts +1 -0
  77. package/lib/pages/PageError.d.ts +1 -0
  78. package/lib/pages/Root.d.ts +2 -0
  79. package/lib/pages/Submission.d.ts +4 -0
  80. package/lib/pages/SubmissionList.d.ts +3 -0
  81. package/lib/providers/index.d.ts +6 -0
  82. package/lib/routes/wizard/wizard.d.ts +2 -0
  83. package/lib/services/api/collection.service.d.ts +14 -0
  84. package/lib/services/api/submission.services.d.ts +8 -0
  85. package/lib/services/api/user.service.d.ts +77 -0
  86. package/lib/services/queries/collection.queries.d.ts +76 -0
  87. package/lib/services/queries/index.d.ts +1 -0
  88. package/lib/services/queries/submission.queries.d.ts +36 -0
  89. package/lib/services/queries/user.queries.d.ts +76 -0
  90. package/lib/store/collectionActionStore.d.ts +29 -0
  91. package/lib/store/createSelectors.d.ts +10 -0
  92. package/lib/store/submissionActionStore.d.ts +32 -0
  93. package/lib/store/userActionStore.d.ts +26 -0
  94. package/lib/style.css +1 -1
  95. package/package.json +7 -6
  96. package/lib/AppHeaderCollection-CnQ2pqtl.js +0 -172
  97. package/lib/CXEL7IU7-Dei8UEaR.js +0 -42
  98. package/lib/Collection-BcJujQH9.js +0 -472
  99. package/lib/CollectionsLayout-BWau0fFT.js +0 -41
  100. package/lib/CollectionsList-DoYvRzYy.js +0 -324
  101. package/lib/DeleteCollectionModal-C8NPFHjI.js +0 -71
  102. package/lib/DropdownActionTable-CJA3djIr.js +0 -84
  103. package/lib/FormEdit-DrlhrKl6.js +0 -102
  104. package/lib/HASRA6WW-Lcj-6-Jg.js +0 -9093
  105. package/lib/I3HPI4QX-BiqSZkoI.js +0 -33
  106. package/lib/MembersEdit--SFUJ5dS.js +0 -77
  107. package/lib/Root-4Xv-j-fs.js +0 -20
  108. package/lib/SearchBarCollect-DBKaVVDV.js +0 -23
  109. package/lib/Submission-Bi1puhNG.js +0 -257
  110. package/lib/SubmissionList-BUexy8AF.js +0 -197
  111. package/lib/emptyscreen-list-collection-CWGxO4Ss.js +0 -4
  112. package/lib/index-DPvhGf6m.js +0 -3485
  113. package/lib/submission.queries-rlTI0q9h.js +0 -86
  114. package/lib/useGetStatusSubmission-DxHmLPxr.js +0 -57
@@ -1,33 +0,0 @@
1
- import { c, T as l, a as m, b as u, D as v, Q as i } from "./HASRA6WW-Lcj-6-Jg.js";
2
- import { T as d, E as f, x as e } from "./index-DPvhGf6m.js";
3
- var p = (a) => {
4
- const [r, t] = c({
5
- prefix: "TanstackQueryDevtools"
6
- }), n = d(), s = f(() => {
7
- const o = r.theme_preference || l;
8
- return o !== "system" ? o : n();
9
- });
10
- return e(i.Provider, {
11
- value: a,
12
- get children() {
13
- return e(m, {
14
- localStore: r,
15
- setLocalStore: t,
16
- get children() {
17
- return e(u.Provider, {
18
- value: s,
19
- get children() {
20
- return e(v, {
21
- localStore: r,
22
- setLocalStore: t
23
- });
24
- }
25
- });
26
- }
27
- });
28
- }
29
- });
30
- }, E = p;
31
- export {
32
- E as default
33
- };
@@ -1,77 +0,0 @@
1
- import { jsx as e, jsxs as c } from "react/jsx-runtime";
2
- import { WORKFLOW_RIGHTS as N } from "@edifice.io/collect-client-rest";
3
- import { useEdificeClient as T, useBreakpoint as v, useToast as I, useHasWorkflow as w, LoadingScreen as D, Grid as l, Flex as d, Button as u } from "@edifice.io/react";
4
- import { useTranslation as E } from "react-i18next";
5
- import { useParams as O, useNavigate as S } from "react-router-dom";
6
- import { aq as A, ar as m, ai as L, P as k, g as P, t as Q, q as R } from "./index-DPvhGf6m.js";
7
- import { a as U } from "./submission.queries-rlTI0q9h.js";
8
- const _ = (o) => async ({ params: t }) => {
9
- const s = Number(t.collectionId);
10
- return await o.ensureQueryData(Q(s)), await o.prefetchInfiniteQuery(
11
- U(s)
12
- ), null;
13
- }, q = () => {
14
- const { appCode: o } = T(), { t } = E(o), { lg: s } = v(), p = O(), r = I(), n = S(), g = w(N.COLLECTION_CREATE), h = A(), f = m.use.usersToAdd(), b = m.use.usersToDelete(), { data: i, isLoading: a } = L(
15
- Number(p.collectionId)
16
- );
17
- if (a)
18
- return /* @__PURE__ */ e(D, {});
19
- if (!g || !i) return /* @__PURE__ */ e(k, {});
20
- const C = async () => {
21
- const y = R(b, f);
22
- try {
23
- await h.mutateAsync({
24
- id: i.id,
25
- data: y
26
- }), r.success(t("collection.toast.success.collection.update.members"), {
27
- duration: 1e4,
28
- isDismissible: !0
29
- }), n(-1);
30
- } catch (x) {
31
- r.error(t("collection.toast.error.collection.update.members"), {
32
- duration: 1e4,
33
- isDismissible: !0
34
- }), console.log(x);
35
- }
36
- };
37
- return /* @__PURE__ */ c("div", { className: "w-100", 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(P, { 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: a,
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: a,
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
- q as MembersEdit,
76
- _ as loader
77
- };
@@ -1,20 +0,0 @@
1
- import { jsx as r, jsxs as t, Fragment as c } from "react/jsx-runtime";
2
- import { WORKFLOW_RIGHTS as f } from "@edifice.io/collect-client-rest";
3
- import { useEdificeClient as u, useHasWorkflow as l, LoadingScreen as m, Layout as p } from "@edifice.io/react";
4
- import { useLoaderData as L, Outlet as e, ScrollRestoration as n } from "react-router-dom";
5
- import { P as d } from "./index-DPvhGf6m.js";
6
- const g = async () => null;
7
- function E() {
8
- const { init: s } = u(), i = l(f.COLLECTION_ACCESS), o = L(), a = (o == null ? void 0 : o.header) !== !1;
9
- return s ? i ? a ? /* @__PURE__ */ t(p, { children: [
10
- /* @__PURE__ */ r(e, {}),
11
- /* @__PURE__ */ r(n, {})
12
- ] }) : /* @__PURE__ */ t(c, { children: [
13
- /* @__PURE__ */ r(e, {}),
14
- /* @__PURE__ */ r(n, {})
15
- ] }) : /* @__PURE__ */ r(d, {}) : /* @__PURE__ */ r(m, { position: !1 });
16
- }
17
- export {
18
- E as Root,
19
- g as loader
20
- };
@@ -1,23 +0,0 @@
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
- };
@@ -1,257 +0,0 @@
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 f, 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-CnQ2pqtl.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 p } from "react-i18next";
9
- import { ContribSubmissionStatus as $ } from "@edifice.io/collect-client-rest";
10
- import { u as w } from "./DropdownActionTable-CJA3djIr.js";
11
- import { c as W, u as z, s as G } from "./submission.queries-rlTI0q9h.js";
12
- import { ai as V, P as J, t as K } from "./index-DPvhGf6m.js";
13
- const I = ({
14
- collection: n,
15
- isMobile: o = !1
16
- }) => {
17
- const { appCode: i } = m(), { t } = p(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 } = p(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
- f,
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
- f,
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 } = p(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 } = p(i), e = E(), c = x(), {
141
- submissionContent: d,
142
- isUpdateSubmissionModalOpen: b,
143
- onCloseUpdateSubmissionModal: S,
144
- setSubmissionIsLoading: C
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: b,
153
- onClose: S,
154
- handleUpdateSubmission: async ({
155
- status: r,
156
- isRedirect: L
157
- }) => {
158
- try {
159
- C(!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
- C(!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
- }), b = w.use.setIsPastDeadline();
184
- return N(() => {
185
- b(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
- }, ps = () => {
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
- ps as Submission,
256
- ms as loader
257
- };
@@ -1,197 +0,0 @@
1
- import { jsx as t, Fragment as C, jsxs as r } from "react/jsx-runtime";
2
- import { useEdificeClient as x, 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 v, SubmissionStatus as N } from "@edifice.io/collect-client-rest";
5
- import { useTranslation as S } from "react-i18next";
6
- import { create as R } from "zustand";
7
- import { J as U, am as Y, v as k } from "./index-DPvhGf6m.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
- }, b = 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 } = x(), { t: s } = S(e), { filter: o, setFilter: a } = b(), i = [
23
- {
24
- label: s("collection.submissionList.filter.all"),
25
- value: "all"
26
- },
27
- {
28
- label: s("collection.submissionList.filter.toSubmit"),
29
- value: v.TO_SUBMIT
30
- },
31
- {
32
- label: s("collection.submissionList.filter.submitted"),
33
- value: v.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
- a(l === "all" ? void 0 : l);
42
- },
43
- options: i,
44
- value: o ?? "all"
45
- }
46
- ) });
47
- }, J = ({
48
- collectionToSubmit: e,
49
- onClick: s
50
- }) => {
51
- const { fromNow: o, formatDate: a } = I(), { getAvatarURL: i } = B(), { appCode: m } = x(), { t: l } = S(m), { getSubmissionStatus: c } = O(), n = e.status === N.SUBMITTED || e.status === N.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" : n ? "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" : n ? "text-green-800" : "text-orange-500"}`,
71
- children: a(e.deadline, "D")
72
- }
73
- ),
74
- /* @__PURE__ */ t(
75
- "p",
76
- {
77
- className: `caption ${d ? "text-gray-800" : n ? "text-green-800" : "text-orange-500"}`,
78
- children: a(e.deadline, "MMM")
79
- }
80
- ),
81
- /* @__PURE__ */ t(
82
- "p",
83
- {
84
- className: `caption ${d ? "text-gray-800" : n ? "text-green-800" : "text-orange-500"}`,
85
- children: a(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
- }, W = () => {
117
- var h, y;
118
- const { filter: e, search: s } = b(), o = e || void 0, a = s || void 0, { data: i, isLoading: m, fetchNextPage: l } = Y({
119
- filter: o,
120
- search: a
121
- }), c = (y = (h = i == null ? void 0 : i.pages) == null ? void 0 : h[i.pages.length - 1]) == null ? void 0 : y.meta, n = !!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: n,
126
- hasData: d,
127
- fetchNextPage: l
128
- };
129
- }, _ = () => {
130
- const { appCode: e } = x(), { t: s } = S(e), o = A(), {
131
- collectionsToSubmit: a,
132
- isLoading: i,
133
- hasMoreResources: m,
134
- hasData: l,
135
- fetchNextPage: c
136
- } = W();
137
- return i ? /* @__PURE__ */ t(M, {}) : l ? /* @__PURE__ */ r(f, { className: "w-100 p-24", "data-testid": "collect-list-submissions-grid", children: [
138
- a.map((n, u) => /* @__PURE__ */ t(f.Col, { sm: "4", md: "4", lg: "4", xl: "4", children: /* @__PURE__ */ t(
139
- J,
140
- {
141
- "data-testid": "collect-list-submissions-card",
142
- collectionToSubmit: n,
143
- onClick: () => o(
144
- `/list-collections/id/${n.collectionId}/submission/${n.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
- }, ne = async (e) => (await e.prefetchInfiniteQuery(
170
- k({
171
- search: void 0,
172
- filter: void 0
173
- })
174
- ), null), re = () => {
175
- const { lg: e } = $(), s = b(
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(_, {})
192
- ] });
193
- };
194
- export {
195
- re as SubmissionsList,
196
- ne as loader
197
- };