@gen-epix/ui-client-casedb 4.1.0 → 4.2.0
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/dist/_chunks/AddCasesToEventDialog.js +98 -98
- package/dist/_chunks/AddCasesToEventDialog.js.map +1 -1
- package/dist/_chunks/CaseContentForm.js +10 -10
- package/dist/_chunks/CaseInfoDialog.js +220 -220
- package/dist/_chunks/CaseInfoDialog.js.map +1 -1
- package/dist/_chunks/CaseSetInfoDialog.js +224 -224
- package/dist/_chunks/CaseSetInfoDialog.js.map +1 -1
- package/dist/_chunks/Dashboard.js +295 -295
- package/dist/_chunks/Dashboard.js.map +1 -1
- package/dist/_chunks/FindSimilarCasesDialog.js +76 -76
- package/dist/_chunks/FindSimilarCasesDialog.js.map +1 -1
- package/dist/_chunks/LegendaItem.js.map +1 -1
- package/dist/_chunks/PanelSeparator.js +3 -3
- package/dist/_chunks/PanelSeparator.js.map +1 -1
- package/dist/_chunks/Upload.js +318 -318
- package/dist/_chunks/Upload.js.map +1 -1
- package/dist/_chunks/chunk-BV7QT456.js +1 -1
- package/dist/_chunks/chunk-BV7QT456.js.map +1 -1
- package/dist/_chunks/cloneDeep.js +1 -1
- package/dist/_chunks/cloneDeep.js.map +1 -1
- package/dist/_chunks/esm.js +3 -3
- package/dist/_chunks/esm.js.map +1 -1
- package/dist/_chunks/index.module.js +1 -1
- package/dist/_chunks/index.module.js.map +1 -1
- package/dist/_chunks/react.js +1 -1
- package/dist/_chunks/react.js.map +1 -1
- package/dist/_chunks/shallow.js +2 -2
- package/dist/_chunks/shallow.js.map +1 -1
- package/dist/_chunks/vanilla.js +1 -1
- package/dist/_chunks/vanilla.js.map +1 -1
- package/dist/_chunks/yup.js +24 -24
- package/dist/_chunks/yup.js.map +1 -1
- package/dist/components/form/fields/ArrangementEditor/index.js +30 -30
- package/dist/components/ui/CreateEventDialog/index.js +40 -40
- package/dist/components/ui/CreateEventDialog/index.js.map +1 -1
- package/dist/components/ui/SequenceDownloadDialog/index.js +22 -22
- package/dist/pages/UserEffectiveRightsTesterAdminPage/index.js +59 -59
- package/dist/pages/UserEffectiveRightsTesterAdminPage/index.js.map +1 -1
- package/package.json +68 -67
- package/dist/_chunks/index.esm.js +0 -1465
- package/dist/_chunks/index.esm.js.map +0 -1
|
@@ -6,38 +6,38 @@ import { CaseSetUtil as a } from "../utils/CaseSetUtil/index.js";
|
|
|
6
6
|
import { t as o } from "./react.js";
|
|
7
7
|
import { t as s } from "./dashboardStore.js";
|
|
8
8
|
import { t as c } from "./shallow.js";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import { n as g, r as _, t as ee } from "./DataCollectionAccessInfo.js";
|
|
9
|
+
import { t as l } from "./yup.js";
|
|
10
|
+
import { useDataCollectionOptionsQuery as u, useDataCollectionsMapQuery as d, useDataCollectionsQuery as f } from "../dataHooks/useDataCollectionsQuery/index.js";
|
|
11
|
+
import { t as p } from "./CaseContentForm.js";
|
|
12
|
+
import { useCaseRightsQuery as m } from "../dataHooks/useCaseRightsQuery/index.js";
|
|
13
|
+
import { n as h, r as g, t as _ } from "./DataCollectionAccessInfo.js";
|
|
15
14
|
import { useCaseSetCategoryMapQuery as v } from "../dataHooks/useCaseSetCategoriesQuery/index.js";
|
|
16
15
|
import { useCaseSetStatusMapQuery as y } from "../dataHooks/useCaseSetStatusesQuery/index.js";
|
|
17
16
|
import "../components/ui/CaseContentForm/index.js";
|
|
18
|
-
import { array as b, object as
|
|
19
|
-
import { t as
|
|
20
|
-
import { CaseDbCaseApi as
|
|
21
|
-
import { QueryClientService as
|
|
22
|
-
import { FORM_FIELD_DEFINITION_TYPE as
|
|
23
|
-
import { NotificationService as
|
|
24
|
-
import { Box as
|
|
25
|
-
import { use as
|
|
26
|
-
import { useTranslation as
|
|
27
|
-
import { Fragment as
|
|
28
|
-
import { ResponseHandler as
|
|
29
|
-
import { useItemQuery as
|
|
30
|
-
import { useArray as
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
34
|
-
import
|
|
35
|
-
import
|
|
36
|
-
import {
|
|
37
|
-
import
|
|
38
|
-
import
|
|
39
|
-
import {
|
|
40
|
-
import {
|
|
17
|
+
import { array as b, object as x, string as ee } from "yup";
|
|
18
|
+
import { t as S } from "i18next";
|
|
19
|
+
import { CaseDbCaseApi as C, CaseDbColType as w, CaseDbEtlStatus as T, CaseDbUploadAction as E } from "@gen-epix/api-casedb";
|
|
20
|
+
import { QueryClientService as D } from "@gen-epix/ui-client-common/classes/services/QueryClientService";
|
|
21
|
+
import { FORM_FIELD_DEFINITION_TYPE as O } from "@gen-epix/ui-core-form/models/form";
|
|
22
|
+
import { NotificationService as k } from "@gen-epix/ui-client-common/classes/services/NotificationService";
|
|
23
|
+
import { Box as A, Link as j, Table as M, TableBody as N, TableCell as P, TableHead as F, TableRow as I, Typography as L } from "@mui/material";
|
|
24
|
+
import { use as R, useCallback as z, useEffect as te, useId as ne, useMemo as B, useRef as re, useState as V } from "react";
|
|
25
|
+
import { useTranslation as H } from "react-i18next";
|
|
26
|
+
import { Fragment as U, jsx as W, jsxs as G } from "react/jsx-runtime";
|
|
27
|
+
import { ResponseHandler as K } from "@gen-epix/ui-client-common/components/ui/ResponseHandler";
|
|
28
|
+
import { useItemQuery as ie } from "@gen-epix/ui-client-common/hooks/useItemQuery";
|
|
29
|
+
import { useArray as q } from "@gen-epix/ui-core/hooks/useArray";
|
|
30
|
+
import { useForm as J } from "react-hook-form";
|
|
31
|
+
import { GenericForm as ae } from "@gen-epix/ui-core-form/components/helpers/GenericForm";
|
|
32
|
+
import { useQueryMemo as oe } from "@gen-epix/ui-client-common/hooks/useQueryMemo";
|
|
33
|
+
import { Confirmation as se } from "@gen-epix/ui-core-components/components/Confirmation";
|
|
34
|
+
import ce from "@mui/icons-material/Edit";
|
|
35
|
+
import { withDialog as Y } from "@gen-epix/ui-core-components/hoc/withDialog";
|
|
36
|
+
import { TestIdUtil as X } from "@gen-epix/ui-core/utils/TestIdUtil";
|
|
37
|
+
import le from "@mui/icons-material/Save";
|
|
38
|
+
import { FormUtil as ue } from "@gen-epix/ui-core-form/utils/FormUtil";
|
|
39
|
+
import { GenericErrorMessage as de } from "@gen-epix/ui-client-common/components/ui/GenericErrorMessage";
|
|
40
|
+
import { EpiContactDetailsDialog as fe } from "@gen-epix/ui-client-common/components/epi/EpiContactDetailsDialog";
|
|
41
41
|
import pe from "@mui/icons-material/Share";
|
|
42
42
|
import me from "@mui/icons-material/Delete";
|
|
43
43
|
import he from "@mui/icons-material/ArrowLeft";
|
|
@@ -46,81 +46,81 @@ import { useDeleteMutation as _e } from "@gen-epix/ui-client-common/hooks/useDel
|
|
|
46
46
|
import { NavLink as ve } from "@gen-epix/ui-client-common/components/ui/NavLink";
|
|
47
47
|
//#region src/components/ui/CaseInfoDialog/CaseCaseSetInfo.tsx
|
|
48
48
|
var ye = ({ caseDbCase: e, ...t }) => {
|
|
49
|
-
let r = v(), i = y(), { t: o } =
|
|
49
|
+
let r = v(), i = y(), { t: o } = H(), s = {
|
|
50
50
|
invert: !1,
|
|
51
51
|
key: "case_id",
|
|
52
52
|
members: [e.id],
|
|
53
53
|
type: "UUID_SET"
|
|
54
|
-
}, { data: c, error: l, isLoading: u } =
|
|
55
|
-
queryFn: async ({ signal: e }) => (await
|
|
56
|
-
queryKey:
|
|
54
|
+
}, { data: c, error: l, isLoading: u } = oe({
|
|
55
|
+
queryFn: async ({ signal: e }) => (await C.getInstance().caseSetMembersPostQuery(s, null, null, { signal: e })).data,
|
|
56
|
+
queryKey: D.getInstance().getGenericKey(n.CASE_SET_MEMBERS, s)
|
|
57
57
|
}), d = {
|
|
58
58
|
invert: !1,
|
|
59
59
|
key: "id",
|
|
60
60
|
members: c?.map((e) => e.case_set_id) ?? [],
|
|
61
61
|
type: "UUID_SET"
|
|
62
|
-
}, { data: f, error: p, isLoading: m } =
|
|
62
|
+
}, { data: f, error: p, isLoading: m } = oe({
|
|
63
63
|
enabled: d.members.length > 0,
|
|
64
|
-
queryFn: async ({ signal: e }) => (await
|
|
65
|
-
queryKey:
|
|
66
|
-
}), h =
|
|
67
|
-
return /* @__PURE__ */
|
|
64
|
+
queryFn: async ({ signal: e }) => (await C.getInstance().caseSetsPostQuery(d, null, null, { signal: e })).data,
|
|
65
|
+
queryKey: D.getInstance().getGenericKey(n.CASE_SETS, d)
|
|
66
|
+
}), h = q([r, i]);
|
|
67
|
+
return /* @__PURE__ */ G(A, {
|
|
68
68
|
...t,
|
|
69
|
-
children: [/* @__PURE__ */
|
|
69
|
+
children: [/* @__PURE__ */ W(L, {
|
|
70
70
|
variant: "h6",
|
|
71
71
|
children: o`Events`
|
|
72
|
-
}), /* @__PURE__ */
|
|
72
|
+
}), /* @__PURE__ */ G(K, {
|
|
73
73
|
error: l || p,
|
|
74
74
|
inlineSpinner: !0,
|
|
75
75
|
isLoading: u || m,
|
|
76
76
|
loadables: h,
|
|
77
77
|
shouldHideActionButtons: !0,
|
|
78
|
-
children: [f?.length > 0 && /* @__PURE__ */
|
|
78
|
+
children: [f?.length > 0 && /* @__PURE__ */ G(M, {
|
|
79
79
|
size: "small",
|
|
80
|
-
children: [/* @__PURE__ */
|
|
81
|
-
/* @__PURE__ */
|
|
80
|
+
children: [/* @__PURE__ */ W(F, { children: /* @__PURE__ */ G(I, { children: [
|
|
81
|
+
/* @__PURE__ */ W(P, {
|
|
82
82
|
sx: { width: "calc(100% * 1/3)" },
|
|
83
83
|
children: o`Name`
|
|
84
84
|
}),
|
|
85
|
-
/* @__PURE__ */
|
|
85
|
+
/* @__PURE__ */ W(P, {
|
|
86
86
|
sx: { width: "calc(100% * 1/3)" },
|
|
87
87
|
children: o`Category`
|
|
88
88
|
}),
|
|
89
|
-
/* @__PURE__ */
|
|
89
|
+
/* @__PURE__ */ W(P, {
|
|
90
90
|
sx: { width: "calc(100% * 1/3)" },
|
|
91
91
|
children: o`Status`
|
|
92
92
|
})
|
|
93
|
-
] }) }), /* @__PURE__ */
|
|
94
|
-
/* @__PURE__ */
|
|
93
|
+
] }) }), /* @__PURE__ */ W(N, { children: f?.map((e) => /* @__PURE__ */ G(I, { children: [
|
|
94
|
+
/* @__PURE__ */ W(P, { children: /* @__PURE__ */ W(ve, {
|
|
95
95
|
activeAsText: !0,
|
|
96
96
|
to: a.createCaseSetLink(e),
|
|
97
97
|
children: e.name
|
|
98
98
|
}) }),
|
|
99
|
-
/* @__PURE__ */
|
|
100
|
-
/* @__PURE__ */
|
|
99
|
+
/* @__PURE__ */ W(P, { children: r.map.get(e.case_set_category_id)?.name ?? o`Unknown` }),
|
|
100
|
+
/* @__PURE__ */ W(P, { children: i.map.get(e.case_set_status_id)?.name ?? o`Unknown` })
|
|
101
101
|
] }, e.id)) })]
|
|
102
|
-
}), (!f || f?.length === 0) && /* @__PURE__ */
|
|
102
|
+
}), (!f || f?.length === 0) && /* @__PURE__ */ W(A, {
|
|
103
103
|
sx: { fontStyle: "italic" },
|
|
104
104
|
children: o`None`
|
|
105
105
|
})]
|
|
106
106
|
})]
|
|
107
107
|
});
|
|
108
108
|
}, be = ({ caseDbCase: e, caseRights: t, formId: r, onFinish: i, onIsSavingChange: a, ...l }) => {
|
|
109
|
-
let u =
|
|
109
|
+
let u = R(s), d = o(u, (e) => e.completeCaseType), f = o(u, c((e) => e.mutateCachedCase)), [m, h] = V(!1), g = B(() => {
|
|
110
110
|
let e = [];
|
|
111
111
|
return t.read_col_ids.forEach((n) => {
|
|
112
112
|
t.write_col_ids.includes(n) && e.push(n);
|
|
113
113
|
}), e;
|
|
114
|
-
}, [t]), _ =
|
|
114
|
+
}, [t]), _ = z((t, r) => {
|
|
115
115
|
h(!0), a(!0), (async () => {
|
|
116
|
-
let o =
|
|
116
|
+
let o = D.getInstance().getQueryKeyDependencies([n.CASES], !0), s = k.getInstance().showNotification({
|
|
117
117
|
isLoading: !0,
|
|
118
|
-
message:
|
|
118
|
+
message: S("Saving case data"),
|
|
119
119
|
severity: "info"
|
|
120
120
|
});
|
|
121
121
|
try {
|
|
122
|
-
await
|
|
123
|
-
let n = (await
|
|
122
|
+
await D.getInstance().cancelQueries(o);
|
|
123
|
+
let n = (await C.getInstance().uploadCases({
|
|
124
124
|
case_batch: { cases: [{ case: {
|
|
125
125
|
case_type_id: d.id,
|
|
126
126
|
content: r,
|
|
@@ -128,14 +128,14 @@ var ye = ({ caseDbCase: e, ...t }) => {
|
|
|
128
128
|
id: t
|
|
129
129
|
} }] },
|
|
130
130
|
case_type_id: d.id,
|
|
131
|
-
on_exists:
|
|
131
|
+
on_exists: E.UPDATE
|
|
132
132
|
})).data;
|
|
133
|
-
if (n.status !==
|
|
134
|
-
f(e.id, e),
|
|
133
|
+
if (n.status !== T.SKIPPED && n.status !== T.SUCCESS && n.status !== T.UPDATED) throw Error("Case upload failed");
|
|
134
|
+
f(e.id, e), k.getInstance().fulfillNotification(s, S("Successfully saved case data."), "success");
|
|
135
135
|
} catch {
|
|
136
|
-
|
|
136
|
+
k.getInstance().fulfillNotification(s, S("Could not save case data."), "error");
|
|
137
137
|
} finally {
|
|
138
|
-
await
|
|
138
|
+
await D.getInstance().invalidateQueryKeys(o), h(!1), a(!1), i();
|
|
139
139
|
}
|
|
140
140
|
})();
|
|
141
141
|
}, [
|
|
@@ -145,15 +145,15 @@ var ye = ({ caseDbCase: e, ...t }) => {
|
|
|
145
145
|
i,
|
|
146
146
|
a
|
|
147
147
|
]);
|
|
148
|
-
return /* @__PURE__ */
|
|
148
|
+
return /* @__PURE__ */ G(A, {
|
|
149
149
|
...l,
|
|
150
|
-
children: [/* @__PURE__ */
|
|
150
|
+
children: [/* @__PURE__ */ W(L, {
|
|
151
151
|
variant: "h6",
|
|
152
|
-
children:
|
|
153
|
-
}), /* @__PURE__ */
|
|
152
|
+
children: S`Content`
|
|
153
|
+
}), /* @__PURE__ */ G(A, { children: [m && /* @__PURE__ */ W(ge, {
|
|
154
154
|
inline: !0,
|
|
155
|
-
label:
|
|
156
|
-
}), !
|
|
155
|
+
label: S`Saving case data`
|
|
156
|
+
}), !m && /* @__PURE__ */ W(p, {
|
|
157
157
|
caseContent: e.content,
|
|
158
158
|
caseId: e.id,
|
|
159
159
|
completeCaseType: d,
|
|
@@ -163,261 +163,261 @@ var ye = ({ caseDbCase: e, ...t }) => {
|
|
|
163
163
|
})] })]
|
|
164
164
|
});
|
|
165
165
|
}, xe = ({ caseDbCase: e, ...t }) => {
|
|
166
|
-
let { t: n } =
|
|
167
|
-
return /* @__PURE__ */
|
|
166
|
+
let { t: n } = H(), r = d(), i = q([r]);
|
|
167
|
+
return /* @__PURE__ */ G(A, {
|
|
168
168
|
...t,
|
|
169
169
|
children: [
|
|
170
|
-
/* @__PURE__ */
|
|
170
|
+
/* @__PURE__ */ W(L, {
|
|
171
171
|
variant: "h6",
|
|
172
172
|
children: n`Read-only content`
|
|
173
173
|
}),
|
|
174
|
-
!e && /* @__PURE__ */
|
|
175
|
-
/* @__PURE__ */
|
|
174
|
+
!e && /* @__PURE__ */ W(de, { error: /* @__PURE__ */ Error("Case could not be found") }),
|
|
175
|
+
/* @__PURE__ */ W(K, {
|
|
176
176
|
inlineSpinner: !0,
|
|
177
177
|
loadables: i,
|
|
178
178
|
shouldHideActionButtons: !0,
|
|
179
|
-
children: e && /* @__PURE__ */
|
|
179
|
+
children: e && /* @__PURE__ */ G(M, {
|
|
180
180
|
size: "small",
|
|
181
|
-
children: [/* @__PURE__ */
|
|
181
|
+
children: [/* @__PURE__ */ W(F, { children: /* @__PURE__ */ G(I, { children: [/* @__PURE__ */ W(P, {
|
|
182
182
|
sx: { width: "calc(100% * 1/3)" },
|
|
183
183
|
children: n`Column`
|
|
184
|
-
}), /* @__PURE__ */
|
|
184
|
+
}), /* @__PURE__ */ W(P, {
|
|
185
185
|
sx: { width: "calc(100% * 2/3)" },
|
|
186
186
|
children: n`Value`
|
|
187
|
-
})] }) }), /* @__PURE__ */
|
|
187
|
+
})] }) }), /* @__PURE__ */ W(N, { children: /* @__PURE__ */ G(I, { children: [/* @__PURE__ */ W(P, { children: n`Case id` }), /* @__PURE__ */ W(P, { children: e.id })] }) })]
|
|
188
188
|
})
|
|
189
189
|
})
|
|
190
190
|
]
|
|
191
191
|
});
|
|
192
192
|
}, Se = ({ caseDbCase: e, ...n }) => {
|
|
193
|
-
let { t: i } =
|
|
193
|
+
let { t: i } = H(), a = re(null), c = R(s), l = o(c, (e) => e.completeCaseType), u = B(() => t.getCols(l), [l]), d = z((e, t) => {
|
|
194
194
|
a.current.open({
|
|
195
195
|
organizationId: e,
|
|
196
196
|
organizationName: t
|
|
197
197
|
});
|
|
198
198
|
}, []);
|
|
199
|
-
return /* @__PURE__ */
|
|
199
|
+
return /* @__PURE__ */ G(A, {
|
|
200
200
|
...n,
|
|
201
201
|
children: [
|
|
202
|
-
/* @__PURE__ */
|
|
202
|
+
/* @__PURE__ */ W(L, {
|
|
203
203
|
variant: "h6",
|
|
204
204
|
children: i`Content`
|
|
205
205
|
}),
|
|
206
|
-
!e && /* @__PURE__ */
|
|
207
|
-
e && /* @__PURE__ */
|
|
206
|
+
!e && /* @__PURE__ */ W(de, { error: /* @__PURE__ */ Error("Case could not be found") }),
|
|
207
|
+
e && /* @__PURE__ */ G(M, {
|
|
208
208
|
size: "small",
|
|
209
|
-
children: [/* @__PURE__ */
|
|
209
|
+
children: [/* @__PURE__ */ W(F, { children: /* @__PURE__ */ G(I, { children: [/* @__PURE__ */ W(P, {
|
|
210
210
|
sx: { width: "calc(100% / 3)" },
|
|
211
211
|
children: i`Column`
|
|
212
|
-
}), /* @__PURE__ */
|
|
212
|
+
}), /* @__PURE__ */ W(P, {
|
|
213
213
|
sx: { width: "calc(100% / 3 * 2)" },
|
|
214
214
|
children: i`Value`
|
|
215
|
-
})] }) }), /* @__PURE__ */
|
|
215
|
+
})] }) }), /* @__PURE__ */ W(N, { children: u.map((t) => {
|
|
216
216
|
let n = l.ref_cols[t.ref_col_id], i = r.getRowValue(e.content, t, l);
|
|
217
|
-
return /* @__PURE__ */
|
|
217
|
+
return /* @__PURE__ */ G(I, { children: [/* @__PURE__ */ W(P, {
|
|
218
218
|
sx: { width: "calc(100% / 3)" },
|
|
219
219
|
children: t.label
|
|
220
|
-
}), /* @__PURE__ */
|
|
220
|
+
}), /* @__PURE__ */ G(P, {
|
|
221
221
|
sx: { width: "calc(100% / 3 * 2)" },
|
|
222
|
-
children: [n.col_type ===
|
|
222
|
+
children: [n.col_type === w.ORGANIZATION && !i.isMissing && /* @__PURE__ */ W(j, {
|
|
223
223
|
color: "primary",
|
|
224
224
|
onClick: () => {
|
|
225
225
|
d(e.content[t.id], i.long);
|
|
226
226
|
},
|
|
227
227
|
sx: { cursor: "pointer" },
|
|
228
228
|
children: i.long
|
|
229
|
-
}), n.col_type !==
|
|
229
|
+
}), n.col_type !== w.ORGANIZATION && /* @__PURE__ */ W(U, { children: i.long })]
|
|
230
230
|
})] }, t.id);
|
|
231
231
|
}) })]
|
|
232
232
|
}),
|
|
233
|
-
/* @__PURE__ */
|
|
233
|
+
/* @__PURE__ */ W(fe, { ref: a })
|
|
234
234
|
]
|
|
235
235
|
});
|
|
236
236
|
}, Ce = ({ ...e }) => {
|
|
237
|
-
let { t } =
|
|
238
|
-
return /* @__PURE__ */
|
|
237
|
+
let { t } = H();
|
|
238
|
+
return /* @__PURE__ */ G(A, {
|
|
239
239
|
...e,
|
|
240
|
-
children: [/* @__PURE__ */
|
|
240
|
+
children: [/* @__PURE__ */ W(L, {
|
|
241
241
|
variant: "h6",
|
|
242
242
|
children: t`Shared in`
|
|
243
|
-
}), /* @__PURE__ */
|
|
243
|
+
}), /* @__PURE__ */ W(_, {})]
|
|
244
244
|
});
|
|
245
245
|
}, we = /* @__PURE__ */ e(i(), 1), Te = ({ caseDbCase: e, formId: t, onFinish: r, onIsSavingChange: i, ...a }) => {
|
|
246
|
-
let { t: o } =
|
|
247
|
-
definition:
|
|
246
|
+
let { t: o } = H(), [s, c] = V(!1), u = h(), d = B(() => x().shape({ dataCollectionIds: b().of(ee().uuid4()).required() }), []), f = B(() => [{
|
|
247
|
+
definition: O.AUTOCOMPLETE,
|
|
248
248
|
label: o`Data collections`,
|
|
249
249
|
multiple: !0,
|
|
250
250
|
name: "dataCollectionIds",
|
|
251
|
-
options:
|
|
252
|
-
}], [o,
|
|
253
|
-
resolver:
|
|
254
|
-
values:
|
|
255
|
-
}), { handleSubmit:
|
|
251
|
+
options: u?.itemDataCollectionOptions?.[0] ?? []
|
|
252
|
+
}], [o, u]), p = B(() => ({ dataCollectionIds: u?.rights?.[0]?.shared_in_data_collection_ids ?? [] }), [u]), m = B(() => ue.createFormValues(f, p), [f, p]), g = J({
|
|
253
|
+
resolver: l(d),
|
|
254
|
+
values: m
|
|
255
|
+
}), { handleSubmit: _ } = g, v = z(({ dataCollectionIds: t }) => {
|
|
256
256
|
(async () => {
|
|
257
257
|
c(!0), i(!0);
|
|
258
|
-
let a =
|
|
258
|
+
let a = D.getInstance().getQueryKeyDependencies([n.CASE_DATA_COLLECTION_LINKS], !0), s = k.getInstance().showNotification({
|
|
259
259
|
isLoading: !0,
|
|
260
260
|
message: o("Saving case data collections"),
|
|
261
261
|
severity: "info"
|
|
262
262
|
});
|
|
263
263
|
try {
|
|
264
|
-
await
|
|
265
|
-
let n =
|
|
266
|
-
r.length > 0 && await
|
|
264
|
+
await D.getInstance().cancelQueries(a);
|
|
265
|
+
let n = u?.rights?.[0], r = (0, we.default)(t, n.shared_in_data_collection_ids), i = (0, we.default)(n.shared_in_data_collection_ids, t);
|
|
266
|
+
r.length > 0 && await C.getInstance().caseDataCollectionLinksPostSome(r.map((t) => ({
|
|
267
267
|
case_id: e.id,
|
|
268
268
|
data_collection_id: t
|
|
269
|
-
}))), i.length > 0 && await
|
|
269
|
+
}))), i.length > 0 && await C.getInstance().caseDataCollectionLinksDeleteSome(u.itemDataCollectionLinks[0]?.filter((e) => i.includes(e.data_collection_id)).map((e) => e.id).join(",")), k.getInstance().fulfillNotification(s, o("Successfully saved case data collections."), "success");
|
|
270
270
|
} catch {
|
|
271
|
-
|
|
271
|
+
k.getInstance().fulfillNotification(s, o("Could not save case data collections."), "error");
|
|
272
272
|
} finally {
|
|
273
|
-
await
|
|
273
|
+
await D.getInstance().invalidateQueryKeys(a), c(!1), i(!1), r();
|
|
274
274
|
}
|
|
275
275
|
})();
|
|
276
276
|
}, [
|
|
277
|
-
|
|
277
|
+
u,
|
|
278
278
|
e.id,
|
|
279
279
|
r,
|
|
280
280
|
i,
|
|
281
281
|
o
|
|
282
282
|
]);
|
|
283
|
-
return s ? /* @__PURE__ */
|
|
283
|
+
return s ? /* @__PURE__ */ W(ge, {
|
|
284
284
|
inline: !0,
|
|
285
285
|
label: o`Saving case data collections`
|
|
286
|
-
}) : /* @__PURE__ */
|
|
286
|
+
}) : /* @__PURE__ */ G(A, {
|
|
287
287
|
...a,
|
|
288
|
-
children: [/* @__PURE__ */
|
|
288
|
+
children: [/* @__PURE__ */ W(L, {
|
|
289
289
|
variant: "h6",
|
|
290
290
|
children: o`Data collections`
|
|
291
|
-
}), /* @__PURE__ */
|
|
292
|
-
formFieldDefinitions:
|
|
291
|
+
}), /* @__PURE__ */ W(ae, {
|
|
292
|
+
formFieldDefinitions: f,
|
|
293
293
|
formId: t,
|
|
294
|
-
formMethods:
|
|
295
|
-
onSubmit:
|
|
296
|
-
schema:
|
|
294
|
+
formMethods: g,
|
|
295
|
+
onSubmit: _(v),
|
|
296
|
+
schema: d
|
|
297
297
|
})]
|
|
298
298
|
});
|
|
299
299
|
}, Ee = /* @__PURE__ */ function(e) {
|
|
300
300
|
return e.EDIT = "EDIT", e.INFO = "INFO", e.SHARING = "SHARING", e;
|
|
301
|
-
}({}), Z =
|
|
302
|
-
let { t: a } =
|
|
303
|
-
|
|
304
|
-
}, [
|
|
305
|
-
await
|
|
306
|
-
}, [t,
|
|
301
|
+
}({}), Z = Y(({ onActionsChange: e, onClose: t, onTitleChange: r, openProps: i }) => {
|
|
302
|
+
let { t: a } = H(), l = B(() => [i.caseId], [i.caseId]), p = f(), h = d(), _ = u(), v = R(s), y = o(v, c((e) => e.fetchData)), [b, x] = V(i.initialTab ?? "INFO"), [ee, S] = V(!1), [w, T] = V(!1), [E, O] = V(!1), k = re(null), A = ne(), j = ne(), M = z(async () => {
|
|
303
|
+
S(!1), T(!1), O(!0), x("INFO"), await y(), O(!1);
|
|
304
|
+
}, [y]), N = z(async () => {
|
|
305
|
+
await M(), t();
|
|
306
|
+
}, [t, M]), P = z(() => {
|
|
307
307
|
t();
|
|
308
|
-
}, [t]), { isMutating:
|
|
309
|
-
associationQueryKeys:
|
|
308
|
+
}, [t]), { isMutating: F, mutate: I } = _e({
|
|
309
|
+
associationQueryKeys: D.getInstance().getQueryKeyDependencies([n.CASES], !0),
|
|
310
310
|
getErrorNotificationMessage: (e) => a("Unable to remove case: {{id}}.", { id: e.id }),
|
|
311
311
|
getProgressNotificationMessage: (e) => a("Deleting case: {{id}}...", { id: e.id }),
|
|
312
312
|
getSuccessNotificationMessage: (e) => a("Case: {{id}}, has been removed.", { id: e.id }),
|
|
313
|
-
onError:
|
|
314
|
-
onSuccess:
|
|
315
|
-
queryFn: async (e) => await
|
|
316
|
-
resourceQueryKey:
|
|
317
|
-
}),
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
]), { data:
|
|
313
|
+
onError: P,
|
|
314
|
+
onSuccess: N,
|
|
315
|
+
queryFn: async (e) => await C.getInstance().casesDeleteOne(e.id),
|
|
316
|
+
resourceQueryKey: D.getInstance().getGenericKey(n.CASES)
|
|
317
|
+
}), J = m(l, i.caseTypeId, !F && !E), ae = q([
|
|
318
|
+
J,
|
|
319
|
+
p,
|
|
320
|
+
h,
|
|
321
|
+
_
|
|
322
|
+
]), { data: Y, error: ue, isLoading: de } = ie({
|
|
323
323
|
baseQueryKey: n.CASES_LAZY,
|
|
324
324
|
itemId: i.caseId,
|
|
325
325
|
useQueryOptions: {
|
|
326
|
-
enabled: !
|
|
327
|
-
queryFn: async ({ signal: e }) => (await
|
|
326
|
+
enabled: !F && !E,
|
|
327
|
+
queryFn: async ({ signal: e }) => (await C.getInstance().casesGetOne(i.caseId, { signal: e })).data
|
|
328
328
|
}
|
|
329
|
-
}),
|
|
329
|
+
}), fe = B(() => ({
|
|
330
330
|
invert: !1,
|
|
331
331
|
key: "case_id",
|
|
332
|
-
members: [
|
|
332
|
+
members: [Y?.id],
|
|
333
333
|
type: "UUID_SET"
|
|
334
|
-
}), [
|
|
335
|
-
enabled: !!
|
|
336
|
-
queryFn: async ({ signal: e }) => (await
|
|
337
|
-
queryKey:
|
|
338
|
-
}), Z =
|
|
339
|
-
|
|
340
|
-
}, []), ke =
|
|
341
|
-
|
|
342
|
-
}, []), Ae =
|
|
343
|
-
|
|
344
|
-
}, []), je =
|
|
345
|
-
|
|
346
|
-
}, []), Me =
|
|
347
|
-
|
|
348
|
-
}, []), Ne =
|
|
349
|
-
|
|
350
|
-
}, []), Pe =
|
|
351
|
-
|
|
352
|
-
}, [
|
|
353
|
-
|
|
354
|
-
r(
|
|
334
|
+
}), [Y?.id]), { data: ve, error: we, isLoading: Ee } = oe({
|
|
335
|
+
enabled: !!Y,
|
|
336
|
+
queryFn: async ({ signal: e }) => (await C.getInstance().caseDataCollectionLinksPostQuery(fe, null, null, { signal: e })).data,
|
|
337
|
+
queryKey: D.getInstance().getGenericKey(n.CASE_DATA_COLLECTION_LINKS, fe)
|
|
338
|
+
}), Z = B(() => !!J.data && J.data.some((e) => e.is_full_access || e.write_col_ids.length), [J.data]), Q = B(() => !!J.data && J.data.some((e) => e.is_full_access || e.remove_data_collection_ids.length || e.add_data_collection_ids.length), [J.data]), De = z(() => !!J.data && J.data.some((e) => e.is_full_access || e.can_delete), [J]), Oe = z(() => {
|
|
339
|
+
x("EDIT");
|
|
340
|
+
}, []), ke = z(() => {
|
|
341
|
+
x("SHARING");
|
|
342
|
+
}, []), Ae = z(() => {
|
|
343
|
+
x("INFO");
|
|
344
|
+
}, []), je = z((e) => {
|
|
345
|
+
S(e);
|
|
346
|
+
}, []), Me = z((e) => {
|
|
347
|
+
T(e);
|
|
348
|
+
}, []), Ne = z(() => {
|
|
349
|
+
k.current.open();
|
|
350
|
+
}, []), Pe = z(() => {
|
|
351
|
+
I(Y);
|
|
352
|
+
}, [Y, I]), $ = ee || w;
|
|
353
|
+
te(() => {
|
|
354
|
+
r(b === "EDIT" ? a`Case information - Edit` : b === "SHARING" ? a`Case information - Share` : a`Case information`);
|
|
355
355
|
}, [
|
|
356
|
-
|
|
356
|
+
b,
|
|
357
357
|
r,
|
|
358
358
|
a
|
|
359
|
-
]),
|
|
359
|
+
]), te(() => {
|
|
360
360
|
let t = [];
|
|
361
|
-
(
|
|
362
|
-
...
|
|
361
|
+
(b === "EDIT" || b === "SHARING") && t.push({
|
|
362
|
+
...X.createAttributes("CaseInfoDialog-goBackButton"),
|
|
363
363
|
color: "primary",
|
|
364
364
|
disabled: $,
|
|
365
365
|
label: a`Go back`,
|
|
366
366
|
onClick: Ae,
|
|
367
|
-
startIcon: /* @__PURE__ */
|
|
367
|
+
startIcon: /* @__PURE__ */ W(he, {}),
|
|
368
368
|
variant: "outlined"
|
|
369
|
-
}),
|
|
370
|
-
...
|
|
369
|
+
}), b === "EDIT" && Z ? t.push({
|
|
370
|
+
...X.createAttributes("CaseInfoDialog-saveButton"),
|
|
371
371
|
color: "secondary",
|
|
372
372
|
disabled: $,
|
|
373
|
-
form:
|
|
373
|
+
form: A,
|
|
374
374
|
label: a`Save`,
|
|
375
|
-
startIcon: /* @__PURE__ */
|
|
375
|
+
startIcon: /* @__PURE__ */ W(le, {}),
|
|
376
376
|
type: "submit",
|
|
377
377
|
variant: "contained"
|
|
378
|
-
}) :
|
|
379
|
-
...
|
|
378
|
+
}) : b === "SHARING" && Q ? t.push({
|
|
379
|
+
...X.createAttributes("CaseInfoDialog-saveButton"),
|
|
380
380
|
color: "secondary",
|
|
381
381
|
disabled: $,
|
|
382
|
-
form:
|
|
382
|
+
form: j,
|
|
383
383
|
label: a`Save`,
|
|
384
|
-
startIcon: /* @__PURE__ */
|
|
384
|
+
startIcon: /* @__PURE__ */ W(le, {}),
|
|
385
385
|
type: "submit",
|
|
386
386
|
variant: "contained"
|
|
387
|
-
}) :
|
|
388
|
-
...
|
|
387
|
+
}) : b === "INFO" && (t.push({
|
|
388
|
+
...X.createAttributes("CaseSetInfoDialog-deleteButton"),
|
|
389
389
|
color: "primary",
|
|
390
390
|
disabled: !De(),
|
|
391
391
|
label: a`Delete`,
|
|
392
392
|
onClick: Ne,
|
|
393
|
-
startIcon: /* @__PURE__ */
|
|
393
|
+
startIcon: /* @__PURE__ */ W(me, {}),
|
|
394
394
|
variant: "outlined"
|
|
395
395
|
}), t.push({
|
|
396
|
-
...
|
|
396
|
+
...X.createAttributes("CaseInfoDialog-editDataCollectionsButton"),
|
|
397
397
|
color: "primary",
|
|
398
398
|
disabled: !Q,
|
|
399
399
|
label: a`Share`,
|
|
400
400
|
onClick: ke,
|
|
401
|
-
startIcon: /* @__PURE__ */
|
|
401
|
+
startIcon: /* @__PURE__ */ W(pe, {}),
|
|
402
402
|
variant: "outlined"
|
|
403
403
|
}), t.push({
|
|
404
|
-
...
|
|
404
|
+
...X.createAttributes("CaseInfoDialog-editCaseContentButton"),
|
|
405
405
|
color: "primary",
|
|
406
406
|
disabled: !Z,
|
|
407
407
|
label: a`Edit`,
|
|
408
408
|
onClick: Oe,
|
|
409
|
-
startIcon: /* @__PURE__ */
|
|
409
|
+
startIcon: /* @__PURE__ */ W(ce, {}),
|
|
410
410
|
variant: "outlined"
|
|
411
411
|
})), e(t);
|
|
412
412
|
}, [
|
|
413
413
|
e,
|
|
414
414
|
Oe,
|
|
415
415
|
a,
|
|
416
|
-
|
|
416
|
+
b,
|
|
417
417
|
Ae,
|
|
418
418
|
ke,
|
|
419
|
-
|
|
420
|
-
|
|
419
|
+
A,
|
|
420
|
+
j,
|
|
421
421
|
t,
|
|
422
422
|
$,
|
|
423
423
|
Q,
|
|
@@ -425,77 +425,77 @@ var ye = ({ caseDbCase: e, ...t }) => {
|
|
|
425
425
|
De,
|
|
426
426
|
Z
|
|
427
427
|
]);
|
|
428
|
-
let Fe =
|
|
429
|
-
createdInDataCollection:
|
|
428
|
+
let Fe = B(() => ({
|
|
429
|
+
createdInDataCollection: Y ? h.map.get(Y.created_in_data_collection_id) : void 0,
|
|
430
430
|
itemDataCollectionLinks: [ve],
|
|
431
|
-
rights:
|
|
432
|
-
userDataCollectionOptions:
|
|
433
|
-
userDataCollections:
|
|
434
|
-
userDataCollectionsMap:
|
|
431
|
+
rights: J.data,
|
|
432
|
+
userDataCollectionOptions: _.options,
|
|
433
|
+
userDataCollections: p.data,
|
|
434
|
+
userDataCollectionsMap: h.map
|
|
435
435
|
}), [
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
436
|
+
p.data,
|
|
437
|
+
h.map,
|
|
438
|
+
_.options,
|
|
439
439
|
ve,
|
|
440
|
-
|
|
441
|
-
|
|
440
|
+
J.data,
|
|
441
|
+
Y
|
|
442
442
|
]);
|
|
443
|
-
return
|
|
443
|
+
return E ? /* @__PURE__ */ W(ge, {
|
|
444
444
|
inline: !0,
|
|
445
445
|
label: a`Refreshing data`
|
|
446
|
-
}) : /* @__PURE__ */ U
|
|
447
|
-
error:
|
|
446
|
+
}) : /* @__PURE__ */ G(U, { children: [/* @__PURE__ */ W(K, {
|
|
447
|
+
error: ue || we,
|
|
448
448
|
inlineSpinner: !0,
|
|
449
|
-
isLoading:
|
|
450
|
-
loadables:
|
|
449
|
+
isLoading: de || Ee,
|
|
450
|
+
loadables: ae,
|
|
451
451
|
shouldHideActionButtons: !0,
|
|
452
|
-
children: /* @__PURE__ */
|
|
452
|
+
children: /* @__PURE__ */ G(g, {
|
|
453
453
|
caseAbac: Fe,
|
|
454
454
|
children: [
|
|
455
|
-
/* @__PURE__ */
|
|
456
|
-
caseDbCase:
|
|
455
|
+
/* @__PURE__ */ W(xe, {
|
|
456
|
+
caseDbCase: Y,
|
|
457
457
|
sx: { marginBottom: 2 }
|
|
458
458
|
}),
|
|
459
|
-
|
|
460
|
-
/* @__PURE__ */
|
|
461
|
-
/* @__PURE__ */
|
|
462
|
-
caseDbCase:
|
|
459
|
+
b === "INFO" && /* @__PURE__ */ G(U, { children: [
|
|
460
|
+
/* @__PURE__ */ W(Ce, { sx: { marginBottom: 2 } }),
|
|
461
|
+
/* @__PURE__ */ W(ye, {
|
|
462
|
+
caseDbCase: Y,
|
|
463
463
|
sx: { marginBottom: 2 }
|
|
464
464
|
}),
|
|
465
|
-
/* @__PURE__ */
|
|
466
|
-
caseDbCase:
|
|
465
|
+
/* @__PURE__ */ W(Se, {
|
|
466
|
+
caseDbCase: Y,
|
|
467
467
|
sx: { marginBottom: 2 }
|
|
468
468
|
})
|
|
469
469
|
] }),
|
|
470
|
-
|
|
471
|
-
caseDbCase:
|
|
472
|
-
caseRights:
|
|
473
|
-
formId:
|
|
474
|
-
onFinish:
|
|
470
|
+
b === "EDIT" && Z && /* @__PURE__ */ W(be, {
|
|
471
|
+
caseDbCase: Y,
|
|
472
|
+
caseRights: J.data?.[0],
|
|
473
|
+
formId: A,
|
|
474
|
+
onFinish: M,
|
|
475
475
|
onIsSavingChange: je
|
|
476
476
|
}),
|
|
477
|
-
|
|
477
|
+
b === "EDIT" && !Z && /* @__PURE__ */ W(L, {
|
|
478
478
|
variant: "body1",
|
|
479
479
|
children: a`You do not have permissions to edit this case.`
|
|
480
480
|
}),
|
|
481
|
-
|
|
482
|
-
caseDbCase:
|
|
483
|
-
formId:
|
|
484
|
-
onFinish:
|
|
481
|
+
b === "SHARING" && Q && /* @__PURE__ */ W(Te, {
|
|
482
|
+
caseDbCase: Y,
|
|
483
|
+
formId: j,
|
|
484
|
+
onFinish: M,
|
|
485
485
|
onIsSavingChange: Me
|
|
486
486
|
}),
|
|
487
|
-
|
|
487
|
+
b === "SHARING" && !Q && /* @__PURE__ */ W(L, {
|
|
488
488
|
variant: "body1",
|
|
489
489
|
children: a`You do not have permissions to share this case.`
|
|
490
490
|
})
|
|
491
491
|
]
|
|
492
492
|
})
|
|
493
|
-
}), /* @__PURE__ */
|
|
493
|
+
}), /* @__PURE__ */ W(se, {
|
|
494
494
|
body: a`Are you sure you want to delete the case?`,
|
|
495
495
|
cancelLabel: a`Cancel`,
|
|
496
496
|
confirmLabel: a`Delete`,
|
|
497
497
|
onConfirm: Pe,
|
|
498
|
-
ref:
|
|
498
|
+
ref: k,
|
|
499
499
|
title: a`Delete case?`
|
|
500
500
|
})] });
|
|
501
501
|
}, {
|