@edifice.io/collect-frontend 1.0.11 → 1.0.12-develop.2.20261109161908
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-BPHwd0pS.js +205 -0
- package/lib/CXEL7IU7-bSp8E8Ma.js +42 -0
- package/lib/Collection-C6ys5-Bv.js +506 -0
- package/lib/CollectionsLayout-B66EiXm4.js +100 -0
- package/lib/CollectionsList-BRBbyb-s.js +324 -0
- package/lib/DeleteCollectionModal-Cw-IZLvp.js +71 -0
- package/lib/DropdownActionTable-BoodZZI9.js +84 -0
- package/lib/FormEdit-Di-Y4r45.js +111 -0
- package/lib/HASRA6WW-CE5UWlEo.js +9093 -0
- package/lib/I3HPI4QX-DcsxmYEr.js +33 -0
- package/lib/MembersEdit-WFk8DkwB.js +81 -0
- package/lib/MineSubmission-DfAVKzBY.js +27 -0
- package/lib/Root-B_xgOphI.js +20 -0
- package/lib/SearchBarCollect-DBKaVVDV.js +23 -0
- package/lib/Submission-pY2ZvgER.js +337 -0
- package/lib/SubmissionList-ZKL__RHu.js +204 -0
- package/lib/emptyscreen-list-collection-CWGxO4Ss.js +4 -0
- package/lib/index-D-6KhgeS.js +3856 -0
- package/lib/index.d.ts +1 -14
- package/lib/index.js +19 -15071
- package/lib/{components → src/components}/AppHeaderCollection.d.ts +1 -1
- package/lib/{features → src/features}/collect-form/components/CollectForm.d.ts +1 -1
- package/lib/{features → src/features}/collect-form/components/index.d.ts +1 -1
- package/lib/{features → src/features}/collect-form/hooks/useCreateCollectionForm.d.ts +1 -1
- package/lib/{features → src/features}/creation-wizard/components/FormCreate.d.ts +1 -1
- package/lib/{features → src/features}/creation-wizard/components/Members.d.ts +1 -1
- package/lib/{features → src/features}/creation-wizard/components/WizardContext.d.ts +1 -1
- package/lib/{features → src/features}/menu/store/menuStore.d.ts +1 -1
- package/lib/{hooks → src/hooks}/useSearch.d.ts +1 -1
- package/lib/{hooks → src/hooks}/useWizard.d.ts +1 -1
- package/lib/src/index.d.ts +14 -0
- package/lib/submission.queries-Dt5NuCXz.js +147 -0
- package/lib/useGetStatusSubmission-DxHmLPxr.js +57 -0
- package/package.json +5 -5
- /package/lib/{components → src/components}/AppActionHeader.d.ts +0 -0
- /package/lib/{components → src/components}/AppActionHeaderContext.d.ts +0 -0
- /package/lib/{components → src/components}/CollectApp/CollectApp.d.ts +0 -0
- /package/lib/{components → src/components}/CollectApp/CollectAppContext.d.ts +0 -0
- /package/lib/{components → src/components}/CollectAppActionHeader.d.ts +0 -0
- /package/lib/{components → src/components}/InstructionCard.d.ts +0 -0
- /package/lib/{components → src/components}/SearchBarCollect.d.ts +0 -0
- /package/lib/{components → src/components}/SubmissionCard.d.ts +0 -0
- /package/lib/{config → src/config}/constants.d.ts +0 -0
- /package/lib/{features → src/features}/collect-form/hooks/index.d.ts +0 -0
- /package/lib/{features → src/features}/collect-form/index.d.ts +0 -0
- /package/lib/{features → src/features}/collection-actions/components/CollectionActions.d.ts +0 -0
- /package/lib/{features → src/features}/collection-list/components/CollectionListTable.d.ts +0 -0
- /package/lib/{features → src/features}/collection-list/components/CollectionListTableBody.d.ts +0 -0
- /package/lib/{features → src/features}/collection-list/components/CollectionListTableFooter.d.ts +0 -0
- /package/lib/{features → src/features}/collection-list/components/CollectionListTableHead.d.ts +0 -0
- /package/lib/{features → src/features}/collection-list/hooks/useCollectionListTableBody.d.ts +0 -0
- /package/lib/{features → src/features}/collection-list/hooks/useCollectionListTableHead.d.ts +0 -0
- /package/lib/{features → src/features}/collection-list/hooks/useCollectionPagination.d.ts +0 -0
- /package/lib/{features → src/features}/collection-list/store/collectionListStore.d.ts +0 -0
- /package/lib/{features → src/features}/collection-submissions-list/components/CollectionSubmissionsList.d.ts +0 -0
- /package/lib/{features → src/features}/collection-submissions-list/components/CollectionSubmissionsListMobile.d.ts +0 -0
- /package/lib/{features → src/features}/collection-submissions-list/components/CollectionSubmissionsListTr.d.ts +0 -0
- /package/lib/{features → src/features}/collection-submissions-list/components/CollectionSubmissionsListView.d.ts +0 -0
- /package/lib/{features → src/features}/collection-submissions-list/components/CollectionSubmissionsRender.d.ts +0 -0
- /package/lib/{features → src/features}/collection-submissions-list/hooks/useCollectionSubmissionsList.d.ts +0 -0
- /package/lib/{features → src/features}/collection-submissions-list/store/collectionSubmissionListStore.d.ts +0 -0
- /package/lib/{features → src/features}/creation-wizard/CreationWizard.d.ts +0 -0
- /package/lib/{features → src/features}/creation-wizard/components/WizardHeader.d.ts +0 -0
- /package/lib/{features → src/features}/creation-wizard/components/WizardLayout.d.ts +0 -0
- /package/lib/{features → src/features}/creation-wizard/hooks/useAddMember.d.ts +0 -0
- /package/lib/{features → src/features}/creation-wizard/sharing.utils.d.ts +0 -0
- /package/lib/{features → src/features}/creation-wizard/store/wizardStore.d.ts +0 -0
- /package/lib/{features → src/features}/dropdown-actions/components/DropdownActionTable.d.ts +0 -0
- /package/lib/{features → src/features}/dropdown-actions/hooks/useDropdownActionTable.d.ts +0 -0
- /package/lib/{features → src/features}/menu/components/CollectMenu.d.ts +0 -0
- /package/lib/{features → src/features}/menu/components/DesktopMenu.d.ts +0 -0
- /package/lib/{features → src/features}/menu/components/MenuContext.d.ts +0 -0
- /package/lib/{features → src/features}/menu/components/MobileMenu.d.ts +0 -0
- /package/lib/{features → src/features}/modal/components/DeleteCollectionModal.d.ts +0 -0
- /package/lib/{features → src/features}/modal/components/InstructionModal.d.ts +0 -0
- /package/lib/{features → src/features}/modal/components/UpdateSubmissionModal.d.ts +0 -0
- /package/lib/{features → src/features}/modal/hooks/useDeleteCollectionModal.d.ts +0 -0
- /package/lib/{features → src/features}/submission/components/SubmissionEdit.d.ts +0 -0
- /package/lib/{features → src/features}/submission/components/SubmissionView.d.ts +0 -0
- /package/lib/{features → src/features}/submission-actions/components/SubmissionActions.d.ts +0 -0
- /package/lib/{features → src/features}/submission-list/components/SubmissionFilter.d.ts +0 -0
- /package/lib/{features → src/features}/submission-list/components/SubmissionsListView.d.ts +0 -0
- /package/lib/{features → src/features}/submission-list/hooks/useSubmissionPagination.d.ts +0 -0
- /package/lib/{features → src/features}/submission-list/store/submissionListStore.d.ts +0 -0
- /package/lib/{hooks → src/hooks}/useGetStatusSubmission.d.ts +0 -0
- /package/lib/{hooks → src/hooks}/useStepNavigations.d.ts +0 -0
- /package/lib/{hooks → src/hooks}/useSubmissionForm.d.ts +0 -0
- /package/lib/{i18n.d.ts → src/i18n.d.ts} +0 -0
- /package/lib/{main.d.ts → src/main.d.ts} +0 -0
- /package/lib/{models → src/models}/collect.d.ts +0 -0
- /package/lib/{models → src/models}/menu.d.ts +0 -0
- /package/lib/{pages → src/pages}/Collection.d.ts +0 -0
- /package/lib/{pages → src/pages}/CollectionsLayout.d.ts +0 -0
- /package/lib/{pages → src/pages}/CollectionsList.d.ts +0 -0
- /package/lib/{pages → src/pages}/FormEdit.d.ts +0 -0
- /package/lib/{pages → src/pages}/MembersEdit.d.ts +0 -0
- /package/lib/{pages → src/pages}/MineSubmission.d.ts +0 -0
- /package/lib/{pages → src/pages}/NotFound.d.ts +0 -0
- /package/lib/{pages → src/pages}/PageError.d.ts +0 -0
- /package/lib/{pages → src/pages}/Root.d.ts +0 -0
- /package/lib/{pages → src/pages}/Submission.d.ts +0 -0
- /package/lib/{pages → src/pages}/SubmissionList.d.ts +0 -0
- /package/lib/{providers → src/providers}/index.d.ts +0 -0
- /package/lib/{routes → src/routes}/wizard/wizard.d.ts +0 -0
- /package/lib/{services → src/services}/api/collection.service.d.ts +0 -0
- /package/lib/{services → src/services}/api/submission.services.d.ts +0 -0
- /package/lib/{services → src/services}/api/user.service.d.ts +0 -0
- /package/lib/{services → src/services}/queries/collection.queries.d.ts +0 -0
- /package/lib/{services → src/services}/queries/index.d.ts +0 -0
- /package/lib/{services → src/services}/queries/submission.queries.d.ts +0 -0
- /package/lib/{services → src/services}/queries/user.queries.d.ts +0 -0
- /package/lib/{store → src/store}/collectionActionStore.d.ts +0 -0
- /package/lib/{store → src/store}/createSelectors.d.ts +0 -0
- /package/lib/{store → src/store}/userActionStore.d.ts +0 -0
- /package/lib/{utils → src/utils}/attachment.d.ts +0 -0
- /package/lib/{utils → src/utils}/deadline.d.ts +0 -0
|
@@ -0,0 +1,506 @@
|
|
|
1
|
+
import { jsxs as l, jsx as e, Fragment as G } from "react/jsx-runtime";
|
|
2
|
+
import { SubmissionStatus as f, ManagerSubmissionStatus as B, WORKFLOW_RIGHTS as _ } from "@edifice.io/collect-client-rest";
|
|
3
|
+
import { useDirectory as P, Flex as u, Avatar as R, Badge as v, useEdificeClient as D, Heading as A, Table as C, Button as x, LoadingScreen as T, Modal as I, AddAttachments as U, Dropdown as N, useToast as K, useBreakpoint as O, useDate as Y, EmptyScreen as J, Checkbox as X, Grid as L, useHasWorkflow as Z } from "@edifice.io/react";
|
|
4
|
+
import { useNavigate as j, useParams as q } from "react-router-dom";
|
|
5
|
+
import { useState as $, useEffect as M } from "react";
|
|
6
|
+
import { A as ee, C as te } from "./AppHeaderCollection-BPHwd0pS.js";
|
|
7
|
+
import { IconUsers as se, IconRafterDown as F, IconEdit as ne, IconTextPage as ie, IconCalendarLight as oe } from "@edifice.io/react/icons";
|
|
8
|
+
import { useTranslation as w } from "react-i18next";
|
|
9
|
+
import { u as ae, a as le, s as ce } from "./submission.queries-Dt5NuCXz.js";
|
|
10
|
+
import { create as re } from "zustand";
|
|
11
|
+
import { c as de, g as ue, m as H, h as me, i as he, j as ge, P as pe, k as be } from "./index-D-6KhgeS.js";
|
|
12
|
+
import { u as W } from "./useGetStatusSubmission-DxHmLPxr.js";
|
|
13
|
+
import { u as E } from "./DropdownActionTable-BoodZZI9.js";
|
|
14
|
+
import { D as fe } from "./DeleteCollectionModal-Cw-IZLvp.js";
|
|
15
|
+
import { Editor as V } from "@edifice.io/react/editor";
|
|
16
|
+
import { E as ye } from "./emptyscreen-list-collection-CWGxO4Ss.js";
|
|
17
|
+
const Q = (t) => {
|
|
18
|
+
var h;
|
|
19
|
+
const { data: o, isLoading: n, fetchNextPage: r, hasNextPage: c } = ae(t == null ? void 0 : t.id), [a, g] = $(
|
|
20
|
+
null
|
|
21
|
+
), s = (i) => a === i.id, b = (i) => a === i.id ? "bg-gray-300" : "";
|
|
22
|
+
return {
|
|
23
|
+
submissions: ((h = o == null ? void 0 : o.pages) == null ? void 0 : h.flatMap((i) => i.items)) ?? [],
|
|
24
|
+
isLoading: n,
|
|
25
|
+
hasNextPage: c,
|
|
26
|
+
isHovered: s,
|
|
27
|
+
setHoveredSubmissionId: g,
|
|
28
|
+
getBgColor: b,
|
|
29
|
+
fetchNextPage: r
|
|
30
|
+
};
|
|
31
|
+
}, Se = re((t) => ({
|
|
32
|
+
selectedSubmissionListMenu: null,
|
|
33
|
+
setSelectedSubmissionListMenu: (o) => t({ selectedSubmissionListMenu: o })
|
|
34
|
+
})), k = de(
|
|
35
|
+
Se
|
|
36
|
+
), z = ({
|
|
37
|
+
submission: t
|
|
38
|
+
}) => {
|
|
39
|
+
const { getAvatarURL: o } = P(), { getSubmissionStatus: n } = W(), r = E.use.isPastDeadline(), c = n({
|
|
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
|
+
R,
|
|
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(
|
|
57
|
+
v,
|
|
58
|
+
{
|
|
59
|
+
"data-testid": "collection-submission-status-badge",
|
|
60
|
+
variant: c.variant,
|
|
61
|
+
children: c.text
|
|
62
|
+
}
|
|
63
|
+
)
|
|
64
|
+
] });
|
|
65
|
+
}, Ce = ({
|
|
66
|
+
collection: t
|
|
67
|
+
}) => {
|
|
68
|
+
const { appCode: o } = D(), { t: n } = w(o), {
|
|
69
|
+
setHoveredSubmissionId: r,
|
|
70
|
+
getBgColor: c,
|
|
71
|
+
submissions: a,
|
|
72
|
+
fetchNextPage: g,
|
|
73
|
+
hasNextPage: s,
|
|
74
|
+
isLoading: b
|
|
75
|
+
} = Q(t), { setSelectedSubmissionListMenu: h, selectedSubmissionListMenu: i } = k();
|
|
76
|
+
M(() => {
|
|
77
|
+
if (a.length === 0)
|
|
78
|
+
return;
|
|
79
|
+
a.some(
|
|
80
|
+
(p) => p.id === (i == null ? void 0 : i.id)
|
|
81
|
+
) || h(a[0]);
|
|
82
|
+
}, [
|
|
83
|
+
i == null ? void 0 : i.id,
|
|
84
|
+
h,
|
|
85
|
+
a
|
|
86
|
+
]);
|
|
87
|
+
const y = (m) => {
|
|
88
|
+
h(m);
|
|
89
|
+
};
|
|
90
|
+
return /* @__PURE__ */ l("div", { className: "py-24 border-end h-100 bg-white rounded-start-4", children: [
|
|
91
|
+
/* @__PURE__ */ e("div", { children: /* @__PURE__ */ l(u, { gap: "8", align: "center", className: "px-24 mb-16", children: [
|
|
92
|
+
/* @__PURE__ */ e(
|
|
93
|
+
u,
|
|
94
|
+
{
|
|
95
|
+
className: "bg-secondary-200 rounded",
|
|
96
|
+
align: "center",
|
|
97
|
+
justify: "center",
|
|
98
|
+
style: { minWidth: "36px", height: "36px" },
|
|
99
|
+
children: /* @__PURE__ */ e(se, {})
|
|
100
|
+
}
|
|
101
|
+
),
|
|
102
|
+
/* @__PURE__ */ e(A, { level: "h4", headingStyle: "h4", className: "text-truncate", children: n("collection.submissionList.title") }),
|
|
103
|
+
/* @__PURE__ */ e(
|
|
104
|
+
v,
|
|
105
|
+
{
|
|
106
|
+
"data-testid": "collection-submissions-list-count-badge",
|
|
107
|
+
variant: {
|
|
108
|
+
type: "chip"
|
|
109
|
+
},
|
|
110
|
+
children: a.length
|
|
111
|
+
}
|
|
112
|
+
)
|
|
113
|
+
] }) }),
|
|
114
|
+
b ? /* @__PURE__ */ e(T, {}) : a.length > 0 && /* @__PURE__ */ l("div", { className: "table-submissions", children: [
|
|
115
|
+
/* @__PURE__ */ e(C, { "data-testid": "collect-collection-submissions-list-table", children: /* @__PURE__ */ e(C.Tbody, { children: a.map((m) => {
|
|
116
|
+
const p = c(m);
|
|
117
|
+
return /* @__PURE__ */ e(
|
|
118
|
+
C.Tr,
|
|
119
|
+
{
|
|
120
|
+
"data-testid": "collect-collection-submissions-list-row",
|
|
121
|
+
onMouseEnter: () => r(m.id),
|
|
122
|
+
onMouseLeave: () => r(null),
|
|
123
|
+
onClick: () => y(m),
|
|
124
|
+
children: /* @__PURE__ */ e(
|
|
125
|
+
C.Td,
|
|
126
|
+
{
|
|
127
|
+
className: `p-16 c-pointer ${p} ${(i == null ? void 0 : i.id) === m.id ? "bg-secondary-200" : ""}`,
|
|
128
|
+
style: { maxWidth: 0 },
|
|
129
|
+
children: /* @__PURE__ */ e(z, { submission: m })
|
|
130
|
+
}
|
|
131
|
+
)
|
|
132
|
+
},
|
|
133
|
+
m.id
|
|
134
|
+
);
|
|
135
|
+
}) }) }),
|
|
136
|
+
s && /* @__PURE__ */ e(u, { justify: "center", className: "mt-16", children: /* @__PURE__ */ e(
|
|
137
|
+
x,
|
|
138
|
+
{
|
|
139
|
+
"data-testid": "collect-collection-submissions-list-button-more",
|
|
140
|
+
className: "px-48",
|
|
141
|
+
type: "button",
|
|
142
|
+
color: "secondary",
|
|
143
|
+
variant: "filled",
|
|
144
|
+
rightIcon: /* @__PURE__ */ e(F, {}),
|
|
145
|
+
onClick: () => g(),
|
|
146
|
+
children: n("collection.see.more")
|
|
147
|
+
}
|
|
148
|
+
) })
|
|
149
|
+
] })
|
|
150
|
+
] });
|
|
151
|
+
}, Ie = ({
|
|
152
|
+
collection: t
|
|
153
|
+
}) => {
|
|
154
|
+
const { appCode: o } = D(), { t: n } = w(o), r = j(), { isInstructionModalOpen: c, onCloseInstructionModal: a } = E((s) => ({
|
|
155
|
+
isInstructionModalOpen: s.isInstructionModalOpen,
|
|
156
|
+
onCloseInstructionModal: s.onCloseInstructionModal
|
|
157
|
+
})), g = () => {
|
|
158
|
+
a(), r(`/id/${t.id}/form`);
|
|
159
|
+
};
|
|
160
|
+
return /* @__PURE__ */ l(
|
|
161
|
+
I,
|
|
162
|
+
{
|
|
163
|
+
id: "instruction-modal",
|
|
164
|
+
isOpen: c,
|
|
165
|
+
onModalClose: a,
|
|
166
|
+
size: "lg",
|
|
167
|
+
children: [
|
|
168
|
+
/* @__PURE__ */ e(I.Header, { onModalClose: a, children: n("collection.submission.instruction.title") }),
|
|
169
|
+
/* @__PURE__ */ l(I.Body, { children: [
|
|
170
|
+
/* @__PURE__ */ e(
|
|
171
|
+
V,
|
|
172
|
+
{
|
|
173
|
+
content: t.content,
|
|
174
|
+
mode: "read",
|
|
175
|
+
toolbar: "none",
|
|
176
|
+
variant: "ghost"
|
|
177
|
+
}
|
|
178
|
+
),
|
|
179
|
+
t.attachments && /* @__PURE__ */ e(
|
|
180
|
+
U,
|
|
181
|
+
{
|
|
182
|
+
attachments: H(
|
|
183
|
+
t.attachments
|
|
184
|
+
),
|
|
185
|
+
getDownloadUrl: (s) => ue(t.id, s),
|
|
186
|
+
editMode: !1
|
|
187
|
+
}
|
|
188
|
+
)
|
|
189
|
+
] }),
|
|
190
|
+
/* @__PURE__ */ l(I.Footer, { children: [
|
|
191
|
+
/* @__PURE__ */ e(
|
|
192
|
+
x,
|
|
193
|
+
{
|
|
194
|
+
"data-testid": "collect-collection-modal-instruction-button-close",
|
|
195
|
+
color: "tertiary",
|
|
196
|
+
variant: "ghost",
|
|
197
|
+
onClick: a,
|
|
198
|
+
children: n("collection.cancel")
|
|
199
|
+
}
|
|
200
|
+
),
|
|
201
|
+
/* @__PURE__ */ e(
|
|
202
|
+
x,
|
|
203
|
+
{
|
|
204
|
+
"data-testid": "collect-collection-modal-instruction-button-edit",
|
|
205
|
+
onClick: g,
|
|
206
|
+
leftIcon: /* @__PURE__ */ e(ne, {}),
|
|
207
|
+
children: n("collection.modify")
|
|
208
|
+
}
|
|
209
|
+
)
|
|
210
|
+
] })
|
|
211
|
+
]
|
|
212
|
+
}
|
|
213
|
+
);
|
|
214
|
+
}, Ne = ({
|
|
215
|
+
collection: t
|
|
216
|
+
}) => {
|
|
217
|
+
const { appCode: o } = D(), { t: n } = w(o), { getAvatarURL: r } = P(), { submissions: c, fetchNextPage: a, hasNextPage: g, isLoading: s } = Q(t), { getSubmissionStatus: b } = W(), { setSelectedSubmissionListMenu: h, selectedSubmissionListMenu: i } = k((d) => ({
|
|
218
|
+
selectedSubmissionListMenu: d.selectedSubmissionListMenu,
|
|
219
|
+
setSelectedSubmissionListMenu: d.setSelectedSubmissionListMenu
|
|
220
|
+
})), y = E.use.isPastDeadline();
|
|
221
|
+
M(() => {
|
|
222
|
+
if (c.length === 0)
|
|
223
|
+
return;
|
|
224
|
+
c.some(
|
|
225
|
+
(S) => S.id === (i == null ? void 0 : i.id)
|
|
226
|
+
) || h(c[0] ?? null);
|
|
227
|
+
}, [
|
|
228
|
+
i == null ? void 0 : i.id,
|
|
229
|
+
h,
|
|
230
|
+
c
|
|
231
|
+
]);
|
|
232
|
+
const m = c.find((d) => d.id === (i == null ? void 0 : i.id)) ?? c[0];
|
|
233
|
+
if (!m)
|
|
234
|
+
return null;
|
|
235
|
+
const p = (d) => {
|
|
236
|
+
h(d);
|
|
237
|
+
};
|
|
238
|
+
return /* @__PURE__ */ e("div", { className: "position-relative w-100 p-8 ", children: /* @__PURE__ */ e("div", { className: "bg-white", children: s ? /* @__PURE__ */ e(T, {}) : /* @__PURE__ */ l(
|
|
239
|
+
N,
|
|
240
|
+
{
|
|
241
|
+
block: !0,
|
|
242
|
+
"data-testid": "collect-collection-submissions-list-dropdown-mobile",
|
|
243
|
+
children: [
|
|
244
|
+
/* @__PURE__ */ e(
|
|
245
|
+
N.Trigger,
|
|
246
|
+
{
|
|
247
|
+
label: /* @__PURE__ */ e(
|
|
248
|
+
z,
|
|
249
|
+
{
|
|
250
|
+
submission: m
|
|
251
|
+
},
|
|
252
|
+
m.id
|
|
253
|
+
)
|
|
254
|
+
}
|
|
255
|
+
),
|
|
256
|
+
/* @__PURE__ */ l(N.Menu, { children: [
|
|
257
|
+
c.map((d) => {
|
|
258
|
+
const S = b({
|
|
259
|
+
status: d.status,
|
|
260
|
+
isPastDeadline: y
|
|
261
|
+
});
|
|
262
|
+
return /* @__PURE__ */ e(
|
|
263
|
+
N.Item,
|
|
264
|
+
{
|
|
265
|
+
onClick: () => p(d),
|
|
266
|
+
"data-testid": "collect-collection-submissions-list-dropdown-item-mobile",
|
|
267
|
+
children: /* @__PURE__ */ l(
|
|
268
|
+
u,
|
|
269
|
+
{
|
|
270
|
+
justify: "between",
|
|
271
|
+
align: "center",
|
|
272
|
+
className: "w-100",
|
|
273
|
+
gap: "8",
|
|
274
|
+
children: [
|
|
275
|
+
/* @__PURE__ */ l(u, { align: "center", gap: "12", style: { minWidth: 0 }, children: [
|
|
276
|
+
/* @__PURE__ */ e(
|
|
277
|
+
R,
|
|
278
|
+
{
|
|
279
|
+
alt: d.createdBy.displayName,
|
|
280
|
+
size: "xs",
|
|
281
|
+
src: r(d.createdBy.entId, "user"),
|
|
282
|
+
variant: "circle"
|
|
283
|
+
}
|
|
284
|
+
),
|
|
285
|
+
/* @__PURE__ */ e("p", { className: "text-truncate", children: d.createdBy.displayName })
|
|
286
|
+
] }),
|
|
287
|
+
/* @__PURE__ */ e(v, { variant: S.variant, children: S.text })
|
|
288
|
+
]
|
|
289
|
+
}
|
|
290
|
+
)
|
|
291
|
+
},
|
|
292
|
+
d.id
|
|
293
|
+
);
|
|
294
|
+
}),
|
|
295
|
+
g && /* @__PURE__ */ e(u, { justify: "center", className: "mt-8", children: /* @__PURE__ */ e(
|
|
296
|
+
x,
|
|
297
|
+
{
|
|
298
|
+
"data-testid": "collect-collection-submissions-list-dropdown-button-more-mobile",
|
|
299
|
+
className: "px-48",
|
|
300
|
+
type: "button",
|
|
301
|
+
color: "secondary",
|
|
302
|
+
variant: "filled",
|
|
303
|
+
rightIcon: /* @__PURE__ */ e(F, {}),
|
|
304
|
+
onClick: () => a(),
|
|
305
|
+
children: n("collection.see.more")
|
|
306
|
+
}
|
|
307
|
+
) })
|
|
308
|
+
] })
|
|
309
|
+
]
|
|
310
|
+
}
|
|
311
|
+
) }) });
|
|
312
|
+
}, xe = ({
|
|
313
|
+
collectionId: t
|
|
314
|
+
}) => {
|
|
315
|
+
const { appCode: o } = D(), { t: n } = w(o), r = K(), { lg: c } = O(), [a, g] = $(!1), { selectedSubmissionListMenu: s, setSelectedSubmissionListMenu: b } = k(), h = (s == null ? void 0 : s.status) === f.VERIFIED, { formatDate: i } = Y(), y = le(), m = async (p) => {
|
|
316
|
+
if (s)
|
|
317
|
+
try {
|
|
318
|
+
g(!0), await y.mutateAsync({
|
|
319
|
+
collectionId: t,
|
|
320
|
+
submissionId: s.id,
|
|
321
|
+
data: {
|
|
322
|
+
status: p ? B.VERIFIED : B.SUBMITTED
|
|
323
|
+
}
|
|
324
|
+
}), b({
|
|
325
|
+
...s,
|
|
326
|
+
status: p ? f.VERIFIED : f.SUBMITTED
|
|
327
|
+
}), r.success(n("collection.toast.success.submission.statusUpdate"));
|
|
328
|
+
} catch (d) {
|
|
329
|
+
console.error("Error updating submission status:", d), r.error(n("collection.toast.error.submission.statusUpdate"));
|
|
330
|
+
} finally {
|
|
331
|
+
g(!1);
|
|
332
|
+
}
|
|
333
|
+
};
|
|
334
|
+
return /* @__PURE__ */ l(
|
|
335
|
+
u,
|
|
336
|
+
{
|
|
337
|
+
className: "p-24 bg-white rounded-end-4 h-100",
|
|
338
|
+
direction: "column",
|
|
339
|
+
gap: "16",
|
|
340
|
+
children: [
|
|
341
|
+
/* @__PURE__ */ l(
|
|
342
|
+
u,
|
|
343
|
+
{
|
|
344
|
+
className: "mb-16",
|
|
345
|
+
justify: "between",
|
|
346
|
+
direction: c ? "row" : "column",
|
|
347
|
+
align: c ? "center" : "start",
|
|
348
|
+
gap: "16",
|
|
349
|
+
children: [
|
|
350
|
+
/* @__PURE__ */ l(u, { gap: "8", align: "center", children: [
|
|
351
|
+
/* @__PURE__ */ e(
|
|
352
|
+
u,
|
|
353
|
+
{
|
|
354
|
+
className: "bg-secondary-200 rounded",
|
|
355
|
+
align: "center",
|
|
356
|
+
justify: "center",
|
|
357
|
+
style: { minWidth: "36px", height: "36px" },
|
|
358
|
+
children: /* @__PURE__ */ e(ie, {})
|
|
359
|
+
}
|
|
360
|
+
),
|
|
361
|
+
/* @__PURE__ */ e(A, { level: "h4", headingStyle: "h4", className: "text-truncate", children: `${n("collection.submissionRender.title")} ${s == null ? void 0 : s.createdBy.displayName}` })
|
|
362
|
+
] }),
|
|
363
|
+
/* @__PURE__ */ e(u, { justify: "end", children: s && [f.SUBMITTED, f.VERIFIED].includes(
|
|
364
|
+
s.status
|
|
365
|
+
) && /* @__PURE__ */ e(
|
|
366
|
+
v,
|
|
367
|
+
{
|
|
368
|
+
className: "lh-base",
|
|
369
|
+
style: { height: "3rem" },
|
|
370
|
+
variant: {
|
|
371
|
+
level: "info",
|
|
372
|
+
type: "notification"
|
|
373
|
+
},
|
|
374
|
+
children: /* @__PURE__ */ l(u, { align: "center", gap: "8", children: [
|
|
375
|
+
/* @__PURE__ */ e(oe, { height: 20, width: 20 }),
|
|
376
|
+
`${n("collection.submissionRender.date")} ${i(s.updatedAt)}`
|
|
377
|
+
] })
|
|
378
|
+
}
|
|
379
|
+
) })
|
|
380
|
+
]
|
|
381
|
+
}
|
|
382
|
+
),
|
|
383
|
+
s && /* @__PURE__ */ l(G, { children: [
|
|
384
|
+
/* @__PURE__ */ e(
|
|
385
|
+
V,
|
|
386
|
+
{
|
|
387
|
+
id: "submissionRead",
|
|
388
|
+
content: s.content ?? "",
|
|
389
|
+
mode: "read",
|
|
390
|
+
variant: "ghost"
|
|
391
|
+
}
|
|
392
|
+
),
|
|
393
|
+
s.attachments && /* @__PURE__ */ e(
|
|
394
|
+
U,
|
|
395
|
+
{
|
|
396
|
+
attachments: H(
|
|
397
|
+
s.attachments
|
|
398
|
+
),
|
|
399
|
+
getDownloadUrl: (p) => me(
|
|
400
|
+
t,
|
|
401
|
+
s.id,
|
|
402
|
+
p
|
|
403
|
+
),
|
|
404
|
+
editMode: !1
|
|
405
|
+
}
|
|
406
|
+
),
|
|
407
|
+
s.status === f.EMPTY ? /* @__PURE__ */ e(
|
|
408
|
+
J,
|
|
409
|
+
{
|
|
410
|
+
imageSrc: ye,
|
|
411
|
+
title: n("collection.collectionList.emptyScreen.title"),
|
|
412
|
+
text: n("collection.submissionRender.emptyScreen.description")
|
|
413
|
+
}
|
|
414
|
+
) : s.status !== f.DRAFT ? /* @__PURE__ */ e(u, { justify: "end", children: /* @__PURE__ */ e(
|
|
415
|
+
"div",
|
|
416
|
+
{
|
|
417
|
+
className: `border rounded p-8 ${h ? "bg-secondary-200 border-secondary" : ""}`,
|
|
418
|
+
children: /* @__PURE__ */ e(
|
|
419
|
+
X,
|
|
420
|
+
{
|
|
421
|
+
"data-testid": "collect-collection-submissions-list-checkbox-validate",
|
|
422
|
+
checked: h,
|
|
423
|
+
label: n("collection.submissionRender.checkbox.label"),
|
|
424
|
+
onChange: () => m(!h),
|
|
425
|
+
disabled: a
|
|
426
|
+
}
|
|
427
|
+
)
|
|
428
|
+
}
|
|
429
|
+
) }) : null
|
|
430
|
+
] })
|
|
431
|
+
]
|
|
432
|
+
}
|
|
433
|
+
);
|
|
434
|
+
}, ve = ({
|
|
435
|
+
collection: t
|
|
436
|
+
}) => {
|
|
437
|
+
const o = j(), { lg: n } = O(), r = E.use.setIsPastDeadline();
|
|
438
|
+
return M(() => {
|
|
439
|
+
r(he(t.deadline));
|
|
440
|
+
}, [t.deadline, r]), /* @__PURE__ */ l(
|
|
441
|
+
u,
|
|
442
|
+
{
|
|
443
|
+
className: "bg-gray-200 mx-n16 flex-fill border-bottom-0 border",
|
|
444
|
+
direction: "column",
|
|
445
|
+
children: [
|
|
446
|
+
/* @__PURE__ */ e(
|
|
447
|
+
ee,
|
|
448
|
+
{
|
|
449
|
+
collection: t,
|
|
450
|
+
context: te.COLLECTION,
|
|
451
|
+
onClickBack: () => o("/list-collections")
|
|
452
|
+
}
|
|
453
|
+
),
|
|
454
|
+
/* @__PURE__ */ l(L, { className: "flex-grow-1 m-16 gap-24", children: [
|
|
455
|
+
/* @__PURE__ */ e(
|
|
456
|
+
L.Col,
|
|
457
|
+
{
|
|
458
|
+
sm: "3",
|
|
459
|
+
md: "3",
|
|
460
|
+
lg: "3",
|
|
461
|
+
xl: "4",
|
|
462
|
+
className: "d-none d-lg-block",
|
|
463
|
+
as: "aside",
|
|
464
|
+
children: /* @__PURE__ */ e(Ce, { collection: t })
|
|
465
|
+
}
|
|
466
|
+
),
|
|
467
|
+
/* @__PURE__ */ l(
|
|
468
|
+
L.Col,
|
|
469
|
+
{
|
|
470
|
+
sm: "4",
|
|
471
|
+
md: "8",
|
|
472
|
+
lg: "5",
|
|
473
|
+
xl: "8",
|
|
474
|
+
className: `${n ? "cancel-gap me-0" : ""}`,
|
|
475
|
+
children: [
|
|
476
|
+
!n && /* @__PURE__ */ e(Ne, { collection: t }),
|
|
477
|
+
/* @__PURE__ */ e(xe, { collectionId: t.id })
|
|
478
|
+
]
|
|
479
|
+
}
|
|
480
|
+
)
|
|
481
|
+
] }),
|
|
482
|
+
/* @__PURE__ */ e(
|
|
483
|
+
fe,
|
|
484
|
+
{
|
|
485
|
+
onDeleteSuccess: () => o("/list-collections")
|
|
486
|
+
}
|
|
487
|
+
),
|
|
488
|
+
/* @__PURE__ */ e(Ie, { collection: t })
|
|
489
|
+
]
|
|
490
|
+
}
|
|
491
|
+
);
|
|
492
|
+
}, He = (t) => async ({ params: o }) => {
|
|
493
|
+
const n = Number(o.collectionId);
|
|
494
|
+
return await t.ensureQueryData(be(n)), await t.prefetchInfiniteQuery(
|
|
495
|
+
ce(n)
|
|
496
|
+
), null;
|
|
497
|
+
}, We = () => {
|
|
498
|
+
const t = q(), o = Z(_.COLLECTION_CREATE), { data: n, isLoading: r } = ge(
|
|
499
|
+
Number(t.collectionId)
|
|
500
|
+
);
|
|
501
|
+
return r ? /* @__PURE__ */ e(T, {}) : !o || !n ? /* @__PURE__ */ e(pe, {}) : /* @__PURE__ */ e(ve, { collection: n });
|
|
502
|
+
};
|
|
503
|
+
export {
|
|
504
|
+
We as Collection,
|
|
505
|
+
He as loader
|
|
506
|
+
};
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { jsx as e, jsxs as c } from "react/jsx-runtime";
|
|
2
|
+
import { WORKFLOW_RIGHTS as L } from "@edifice.io/collect-client-rest";
|
|
3
|
+
import { useEdificeClient as h, useHasWorkflow as T, Dropdown as p, Flex as O, useBreakpoint as N, AppHeader as b, Breadcrumb as E, Grid as C, LoadingScreen as _ } from "@edifice.io/react";
|
|
4
|
+
import { Suspense as x } from "react";
|
|
5
|
+
import { useNavigate as w, useLocation as f, Navigate as A, Outlet as R } from "react-router-dom";
|
|
6
|
+
import { u as k, M as o, a as v, A as B, C as F } from "./index-D-6KhgeS.js";
|
|
7
|
+
import { IconCollect as U, IconSubmission as H } from "@edifice.io/react/icons";
|
|
8
|
+
import { useTranslation as W } from "react-i18next";
|
|
9
|
+
const $ = () => {
|
|
10
|
+
const d = w(), { pathname: i } = f(), { appCode: r } = h(), { t: s } = W(r), a = T(L.COLLECTION_CREATE), { setSelectedMenu: u, setMobileMenuOpen: m } = k((n) => ({
|
|
11
|
+
setSelectedMenu: n.setSelectedMenu,
|
|
12
|
+
setMobileMenuOpen: n.setMobileMenuOpen
|
|
13
|
+
})), t = [
|
|
14
|
+
...a ? [
|
|
15
|
+
{
|
|
16
|
+
id: "collection",
|
|
17
|
+
label: s("collection.collection"),
|
|
18
|
+
icon: /* @__PURE__ */ e(U, {}),
|
|
19
|
+
path: "/list-collections",
|
|
20
|
+
filterMenu: o.LIST_COLLECTIONS
|
|
21
|
+
}
|
|
22
|
+
] : [],
|
|
23
|
+
{
|
|
24
|
+
id: "submission",
|
|
25
|
+
label: s("collection.submission"),
|
|
26
|
+
icon: /* @__PURE__ */ e(H, {}),
|
|
27
|
+
path: "/list-submissions",
|
|
28
|
+
filterMenu: o.LIST_SUBMISSIONS
|
|
29
|
+
}
|
|
30
|
+
], M = (() => {
|
|
31
|
+
const S = {
|
|
32
|
+
"/": o.LIST_COLLECTIONS,
|
|
33
|
+
"/list-collections": o.LIST_COLLECTIONS,
|
|
34
|
+
"/list-submissions": o.LIST_SUBMISSIONS
|
|
35
|
+
}[i] || o.LIST_SUBMISSIONS;
|
|
36
|
+
return !a && S === o.LIST_COLLECTIONS ? o.LIST_SUBMISSIONS : S;
|
|
37
|
+
})(), l = t.find(
|
|
38
|
+
(n) => n.filterMenu === M
|
|
39
|
+
), g = (n, S) => {
|
|
40
|
+
u(S), d(n);
|
|
41
|
+
};
|
|
42
|
+
return /* @__PURE__ */ e("div", { className: "position-relative w-100 p-16", children: /* @__PURE__ */ c(p, { block: !0, onToggle: (n) => m(n), children: [
|
|
43
|
+
/* @__PURE__ */ e(
|
|
44
|
+
p.Trigger,
|
|
45
|
+
{
|
|
46
|
+
label: /* @__PURE__ */ c(O, { align: "center", gap: "8", children: [
|
|
47
|
+
l == null ? void 0 : l.icon,
|
|
48
|
+
(l == null ? void 0 : l.label) || s("collection.title")
|
|
49
|
+
] })
|
|
50
|
+
}
|
|
51
|
+
),
|
|
52
|
+
/* @__PURE__ */ e(p.Menu, { children: t.map((n) => /* @__PURE__ */ e(
|
|
53
|
+
p.Item,
|
|
54
|
+
{
|
|
55
|
+
onClick: () => g(n.path, n.filterMenu),
|
|
56
|
+
icon: n.icon,
|
|
57
|
+
className: M === n.filterMenu ? "active" : "",
|
|
58
|
+
children: /* @__PURE__ */ e("span", { children: n.label })
|
|
59
|
+
},
|
|
60
|
+
n.id
|
|
61
|
+
)) })
|
|
62
|
+
] }) });
|
|
63
|
+
}, P = async () => null, Q = () => {
|
|
64
|
+
const { currentApp: d } = h(), { pathname: i } = f(), r = T(L.COLLECTION_CREATE), { header: s, showMenu: a } = v(), { lg: u } = N(), m = s !== !1, t = a !== !1, I = i === "/" || i === `/${o.LIST_COLLECTIONS}`;
|
|
65
|
+
return r !== void 0 && !r && I ? /* @__PURE__ */ e(A, { to: `/${o.LIST_SUBMISSIONS}`, replace: !0 }) : /* @__PURE__ */ c(O, { direction: "column", className: "flex-grow-1", children: [
|
|
66
|
+
m && /* @__PURE__ */ e(b, { render: () => /* @__PURE__ */ e(B, {}), children: /* @__PURE__ */ e(E, { app: d }) }),
|
|
67
|
+
/* @__PURE__ */ c(C, { className: "flex-grow-1", children: [
|
|
68
|
+
t && /* @__PURE__ */ e(
|
|
69
|
+
C.Col,
|
|
70
|
+
{
|
|
71
|
+
sm: "3",
|
|
72
|
+
md: "3",
|
|
73
|
+
lg: "2",
|
|
74
|
+
xl: "3",
|
|
75
|
+
className: "d-none d-lg-block",
|
|
76
|
+
as: "aside",
|
|
77
|
+
children: /* @__PURE__ */ e(F, {})
|
|
78
|
+
}
|
|
79
|
+
),
|
|
80
|
+
/* @__PURE__ */ c(
|
|
81
|
+
C.Col,
|
|
82
|
+
{
|
|
83
|
+
sm: "4",
|
|
84
|
+
md: "8",
|
|
85
|
+
lg: t ? "6" : "12",
|
|
86
|
+
xl: t ? "9" : "12",
|
|
87
|
+
className: `${t && u ? "cancel-gap" : ""}`,
|
|
88
|
+
children: [
|
|
89
|
+
!u && /* @__PURE__ */ e($, {}),
|
|
90
|
+
/* @__PURE__ */ e(x, { fallback: /* @__PURE__ */ e(_, {}), children: /* @__PURE__ */ e(R, {}) })
|
|
91
|
+
]
|
|
92
|
+
}
|
|
93
|
+
)
|
|
94
|
+
] })
|
|
95
|
+
] });
|
|
96
|
+
};
|
|
97
|
+
export {
|
|
98
|
+
Q as Component,
|
|
99
|
+
P as loader
|
|
100
|
+
};
|