@argusoft/medplat-core 1.0.23 → 1.0.24

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 (47) hide show
  1. package/dist/AddMenuConfiguration-m3R8FDhj.js +5570 -0
  2. package/dist/AddMenuConfiguration-m3R8FDhj.js.map +1 -0
  3. package/dist/AddMenuConfiguration.css +1 -1
  4. package/dist/{ChangePasswordModalCore-DONyFFlx.js → ChangePasswordModalCore-Czu7OZe6.js} +954 -951
  5. package/dist/ChangePasswordModalCore-Czu7OZe6.js.map +1 -0
  6. package/dist/{ConditionConfig-C3rF2wXU.js → ConditionConfig-BECSbvY2.js} +2 -2
  7. package/dist/{ConditionConfig-C3rF2wXU.js.map → ConditionConfig-BECSbvY2.js.map} +1 -1
  8. package/dist/FhirRawResourceList-ZZFd7gTX.js +550 -0
  9. package/dist/FhirRawResourceList-ZZFd7gTX.js.map +1 -0
  10. package/dist/FhirServerList-Dkq7Kbes.js +116 -0
  11. package/dist/FhirServerList-Dkq7Kbes.js.map +1 -0
  12. package/dist/FhirServerProfile-CUOwC6Wb.js +253 -0
  13. package/dist/FhirServerProfile-CUOwC6Wb.js.map +1 -0
  14. package/dist/FhirServerWizard-Db6Hm4bQ.js +161 -0
  15. package/dist/FhirServerWizard-Db6Hm4bQ.js.map +1 -0
  16. package/dist/{ImmunizationConfigurationBase-CTBoSuSz.js → ImmunizationConfigurationBase-BevKZx_l.js} +386 -302
  17. package/dist/ImmunizationConfigurationBase-BevKZx_l.js.map +1 -0
  18. package/dist/{ManageEventConfiguration-BntUc_YI.js → ManageEventConfiguration-CBi2KMB1.js} +4 -4
  19. package/dist/{ManageEventConfiguration-BntUc_YI.js.map → ManageEventConfiguration-CBi2KMB1.js.map} +1 -1
  20. package/dist/{ManageUser-Gv38VHMu.js → ManageUser-BnEPFSPT.js} +110 -110
  21. package/dist/{ManageUser-Gv38VHMu.js.map → ManageUser-BnEPFSPT.js.map} +1 -1
  22. package/dist/{MobileMenuManagement-CV6QCeos.js → MobileMenuManagement-CVAKyKDa.js} +33 -32
  23. package/dist/MobileMenuManagement-CVAKyKDa.js.map +1 -0
  24. package/dist/{MobileTypeEventConfigModal-BNjZ8pnq.js → MobileTypeEventConfigModal-C34AN-IJ.js} +2 -2
  25. package/dist/{MobileTypeEventConfigModal-BNjZ8pnq.js.map → MobileTypeEventConfigModal-C34AN-IJ.js.map} +1 -1
  26. package/dist/{OtherTypeEventConfigModal-DiVhWDpG.js → OtherTypeEventConfigModal-BYjMFl0-.js} +93 -93
  27. package/dist/OtherTypeEventConfigModal-BYjMFl0-.js.map +1 -0
  28. package/dist/ServerFormFields-SLghoZ2z.js +136 -0
  29. package/dist/ServerFormFields-SLghoZ2z.js.map +1 -0
  30. package/dist/SyncDialog-BRGpHOE4.js +130 -0
  31. package/dist/SyncDialog-BRGpHOE4.js.map +1 -0
  32. package/dist/{TypeConfiguration-CupQxH9Y.js → TypeConfiguration-Bs5WkIa2.js} +2 -2
  33. package/dist/{TypeConfiguration-CupQxH9Y.js.map → TypeConfiguration-Bs5WkIa2.js.map} +1 -1
  34. package/dist/dashboardLayoutUtils-Bt5HA96J.js +265 -0
  35. package/dist/dashboardLayoutUtils-Bt5HA96J.js.map +1 -0
  36. package/dist/index.css +1 -1
  37. package/dist/index.js +190 -134
  38. package/dist/index.js.map +1 -1
  39. package/dist/permissions-DEWACxJN.js +308 -0
  40. package/dist/permissions-DEWACxJN.js.map +1 -0
  41. package/package.json +1 -1
  42. package/dist/AddMenuConfiguration-DsnY0Rws.js +0 -2237
  43. package/dist/AddMenuConfiguration-DsnY0Rws.js.map +0 -1
  44. package/dist/ChangePasswordModalCore-DONyFFlx.js.map +0 -1
  45. package/dist/ImmunizationConfigurationBase-CTBoSuSz.js.map +0 -1
  46. package/dist/MobileMenuManagement-CV6QCeos.js.map +0 -1
  47. package/dist/OtherTypeEventConfigModal-DiVhWDpG.js.map +0 -1
@@ -0,0 +1,550 @@
1
+ import { jsxs as r, jsx as e, Fragment as Ye } from "react/jsx-runtime";
2
+ import { useState as l, useEffect as U, useCallback as j, useRef as Ue } from "react";
3
+ import { useParams as Je, useNavigate as Ve } from "react-router";
4
+ import { Drawer as qe, Box as g, Stack as h, Typography as c, IconButton as _, Divider as Oe, CircularProgress as J, Accordion as Ie, AccordionSummary as Pe, Chip as ke, AccordionDetails as Te, Tooltip as Y, Paper as Ze, Button as W, Menu as Ke, MenuItem as I, ListItemIcon as re, ListItemText as ne, TextField as Qe, InputAdornment as Xe, FormControl as te, InputLabel as se, Select as ie, LinearProgress as eo, TableHead as oo, TableRow as ae, TableCell as x, TableBody as ro, Skeleton as no, TablePagination as to } from "@mui/material";
5
+ import so from "@mui/icons-material/ArrowBackRounded";
6
+ import io from "@mui/icons-material/RefreshRounded";
7
+ import ao from "@mui/icons-material/CloudDownloadRounded";
8
+ import Fe from "@mui/icons-material/SettingsSuggestRounded";
9
+ import $ from "@mui/icons-material/ReplayRounded";
10
+ import lo from "@mui/icons-material/PlayArrowRounded";
11
+ import co from "@mui/icons-material/BoltRounded";
12
+ import ce from "@mui/icons-material/ExpandMoreRounded";
13
+ import po from "@mui/icons-material/SearchRounded";
14
+ import ho from "@mui/icons-material/FilterAltOffRounded";
15
+ import Le from "moment";
16
+ import { showToast as R } from "@/common/toaster/toaster";
17
+ import { l as uo, S as F, M as de, m as mo, u as go, h as yo, n as fo, o as So, F as xo, a as wo, c as bo, G as vo, E as Co, C as Ro, k as Ee, j as Io, p as Po, q as Ae } from "./permissions-DEWACxJN.js";
18
+ import m from "prop-types";
19
+ import { useTheme as To, alpha as pe } from "@mui/material/styles";
20
+ import Eo from "@mui/icons-material/CloseRounded";
21
+ import Ao from "@mui/icons-material/CheckRounded";
22
+ import Do from "@mui/icons-material/ErrorOutlineRounded";
23
+ import Oo from "@mui/icons-material/ContentCopyRounded";
24
+ import De from "@mui/icons-material/CloudSyncRounded";
25
+ const V = (n) => n ? Le(n).format("DD MMM YYYY, HH:mm:ss") : "—";
26
+ function B({ label: n, children: d }) {
27
+ return /* @__PURE__ */ r(g, { children: [
28
+ /* @__PURE__ */ e(c, { variant: "overline", color: "text.secondary", sx: { fontWeight: 700, lineHeight: 1 }, children: n }),
29
+ /* @__PURE__ */ e(g, { sx: { mt: 0.25 }, children: d })
30
+ ] });
31
+ }
32
+ function he({ ok: n, failed: d, icon: w, title: y, at: t, detail: b, isLast: C }) {
33
+ const v = To(), f = d ? v.palette.error.main : n ? v.palette.success.main : v.palette.grey[400], a = w ?? (d ? Do : Ao);
34
+ return /* @__PURE__ */ r(h, { direction: "row", spacing: 1.25, sx: { minHeight: C ? "auto" : 48 }, children: [
35
+ /* @__PURE__ */ r(h, { alignItems: "center", children: [
36
+ /* @__PURE__ */ e(g, { sx: {
37
+ width: 28,
38
+ height: 28,
39
+ borderRadius: "50%",
40
+ flexShrink: 0,
41
+ display: "flex",
42
+ alignItems: "center",
43
+ justifyContent: "center",
44
+ bgcolor: pe(f, 0.15),
45
+ border: `2px solid ${f}`,
46
+ color: f
47
+ }, children: /* @__PURE__ */ e(a, { sx: { fontSize: 15 } }) }),
48
+ !C && /* @__PURE__ */ e(g, { sx: { width: 2, flexGrow: 1, my: 0.5, bgcolor: pe(f, 0.35) } })
49
+ ] }),
50
+ /* @__PURE__ */ r(g, { sx: { pb: C ? 0 : 1.5, minWidth: 0 }, children: [
51
+ /* @__PURE__ */ e(c, { variant: "body2", sx: { fontWeight: 700 }, children: y }),
52
+ t && /* @__PURE__ */ e(c, { variant: "caption", sx: { color: f, fontWeight: 600 }, children: V(t) }),
53
+ b && /* @__PURE__ */ e(c, { variant: "caption", color: "text.secondary", display: "block", sx: { mt: 0.25, wordBreak: "break-word" }, children: b })
54
+ ] })
55
+ ] });
56
+ }
57
+ he.propTypes = {
58
+ ok: m.bool,
59
+ failed: m.bool,
60
+ icon: m.elementType,
61
+ title: m.node,
62
+ at: m.any,
63
+ detail: m.node,
64
+ isLast: m.bool
65
+ };
66
+ function ue({ message: n }) {
67
+ return /* @__PURE__ */ e(Ze, { variant: "outlined", sx: { mt: 1, p: 1, bgcolor: (d) => pe(d.palette.error.main, 0.05), borderColor: "error.light" }, children: /* @__PURE__ */ e(g, { sx: { maxHeight: 160, overflow: "auto", fontFamily: "monospace", fontSize: 10.5, whiteSpace: "pre-wrap", wordBreak: "break-all" }, children: n }) });
68
+ }
69
+ ue.propTypes = { message: m.string };
70
+ function Ne({ event: n, defaultExpanded: d }) {
71
+ var N;
72
+ const [w, y] = l(!!d), [t, b] = l(null), [C, v] = l(!1), f = j(async () => {
73
+ if (!t) {
74
+ v(!0);
75
+ try {
76
+ const s = await mo(n.id);
77
+ b((s == null ? void 0 : s.data) ?? null);
78
+ } catch {
79
+ R({ type: "error", message: "Failed to load sync detail." });
80
+ } finally {
81
+ v(!1);
82
+ }
83
+ }
84
+ }, [t, n.id]);
85
+ U(() => {
86
+ w && f();
87
+ }, [w, f]);
88
+ const a = n.downloadStatus === "FAILED";
89
+ let P = t == null ? void 0 : t.payloadJson;
90
+ try {
91
+ P = JSON.stringify(JSON.parse(t == null ? void 0 : t.payloadJson), null, 2);
92
+ } catch {
93
+ }
94
+ const L = () => {
95
+ var s;
96
+ (s = navigator.clipboard) == null || s.writeText(P ?? "").then(
97
+ () => R({ type: "success", message: "Payload copied." }),
98
+ () => R({ type: "error", message: "Copy failed." })
99
+ );
100
+ };
101
+ return /* @__PURE__ */ r(
102
+ Ie,
103
+ {
104
+ expanded: w,
105
+ onChange: (s, A) => y(A),
106
+ disableGutters: !0,
107
+ sx: { border: "1px solid", borderColor: "divider", borderRadius: 1.5, "&:before": { display: "none" }, mb: 1, overflow: "hidden" },
108
+ children: [
109
+ /* @__PURE__ */ e(Pe, { expandIcon: /* @__PURE__ */ e(ce, {}), children: /* @__PURE__ */ r(h, { direction: "row", spacing: 1, alignItems: "center", sx: { flexWrap: "wrap", rowGap: 0.5, pr: 1 }, children: [
110
+ /* @__PURE__ */ e(De, { fontSize: "small", color: a ? "error" : "action" }),
111
+ /* @__PURE__ */ e(c, { variant: "body2", sx: { fontWeight: 700 }, children: V(n.syncedAt) }),
112
+ /* @__PURE__ */ e(F, { value: n.downloadStatus, short: !0 }),
113
+ n.processingAttempts > 0 ? /* @__PURE__ */ e(F, { value: n.latestProcessingStatus, short: !0 }) : /* @__PURE__ */ e(ke, { size: "small", variant: "outlined", label: "Not processed", sx: { height: 20 } }),
114
+ n.versionId && /* @__PURE__ */ r(c, { variant: "caption", color: "text.secondary", children: [
115
+ "v",
116
+ n.versionId
117
+ ] })
118
+ ] }) }),
119
+ /* @__PURE__ */ e(Te, { sx: { pt: 0 }, children: C ? /* @__PURE__ */ e(h, { alignItems: "center", sx: { py: 2 }, children: /* @__PURE__ */ e(J, { size: 20 }) }) : /* @__PURE__ */ r(Ye, { children: [
120
+ /* @__PURE__ */ r(g, { sx: { mb: 1.5 }, children: [
121
+ /* @__PURE__ */ e(
122
+ he,
123
+ {
124
+ ok: !a,
125
+ failed: a,
126
+ icon: De,
127
+ title: a ? "Sync failed" : "Synced",
128
+ at: n.syncedAt,
129
+ detail: a ? n.errorMessage : "Content received",
130
+ isLast: !((N = t == null ? void 0 : t.processingEvents) != null && N.length)
131
+ }
132
+ ),
133
+ ((t == null ? void 0 : t.processingEvents) ?? []).map((s, A, T) => /* @__PURE__ */ e(
134
+ he,
135
+ {
136
+ ok: s.processingStatus === "PROCESSED",
137
+ failed: s.processingStatus === "FAILED",
138
+ icon: Fe,
139
+ title: s.processingStatus === "PROCESSED" ? `Processed${s.recordsProcessed != null ? ` — ${s.recordsProcessed} record(s)` : ""}` : "Processing failed",
140
+ at: s.processedAt,
141
+ detail: s.processingStatus === "FAILED" ? /* @__PURE__ */ e(ue, { message: s.errorMessage }) : null,
142
+ isLast: A === T.length - 1
143
+ },
144
+ s.id
145
+ ))
146
+ ] }),
147
+ a && n.errorMessage && /* @__PURE__ */ e(ue, { message: n.errorMessage }),
148
+ (t == null ? void 0 : t.payloadJson) && /* @__PURE__ */ r(Ie, { disableGutters: !0, sx: { boxShadow: "none", border: "1px solid", borderColor: "divider", borderRadius: 1.5, "&:before": { display: "none" }, mt: 1 }, children: [
149
+ /* @__PURE__ */ r(Pe, { expandIcon: /* @__PURE__ */ e(ce, {}), children: [
150
+ /* @__PURE__ */ e(h, { direction: "row", spacing: 1, alignItems: "center", sx: { flexGrow: 1 }, children: /* @__PURE__ */ e(c, { variant: "caption", sx: { fontWeight: 700 }, children: "Payload (JSON)" }) }),
151
+ /* @__PURE__ */ e(Y, { title: "Copy", children: /* @__PURE__ */ e(_, { size: "small", component: "span", onClick: (s) => {
152
+ s.stopPropagation(), L();
153
+ }, children: /* @__PURE__ */ e(Oo, { fontSize: "inherit" }) }) })
154
+ ] }),
155
+ /* @__PURE__ */ e(Te, { children: /* @__PURE__ */ e(g, { sx: { maxHeight: 320, overflow: "auto", bgcolor: "#f8fafc", p: 1.5, borderRadius: 1, fontFamily: "monospace", fontSize: 11, whiteSpace: "pre-wrap", wordBreak: "break-all" }, children: P ?? "—" }) })
156
+ ] })
157
+ ] }) })
158
+ ]
159
+ }
160
+ );
161
+ }
162
+ Ne.propTypes = { event: m.object.isRequired, defaultExpanded: m.bool };
163
+ function ze({ open: n, summary: d, onClose: w, actionSlot: y }) {
164
+ const t = d ?? {}, [b, C] = l([]), [v, f] = l(!1);
165
+ return U(() => {
166
+ !n || !(d != null && d.id) || (C([]), f(!0), uo(d.id).then((a) => C((a == null ? void 0 : a.data) ?? [])).catch(() => R({ type: "error", message: "Failed to load sync history." })).finally(() => f(!1)));
167
+ }, [n, d]), /* @__PURE__ */ r(
168
+ qe,
169
+ {
170
+ anchor: "right",
171
+ open: n,
172
+ onClose: w,
173
+ PaperProps: { sx: { width: { xs: "100%", sm: 560 }, maxWidth: "100%" } },
174
+ children: [
175
+ /* @__PURE__ */ r(g, { sx: { px: 2.5, py: 2, borderBottom: "1px solid", borderColor: "divider" }, children: [
176
+ /* @__PURE__ */ r(h, { direction: "row", justifyContent: "space-between", alignItems: "flex-start", spacing: 1, children: [
177
+ /* @__PURE__ */ r(g, { sx: { minWidth: 0 }, children: [
178
+ /* @__PURE__ */ r(c, { variant: "overline", color: "text.secondary", sx: { fontWeight: 700 }, children: [
179
+ t.resourceType,
180
+ " · #",
181
+ t.id
182
+ ] }),
183
+ /* @__PURE__ */ e(c, { variant: "h6", sx: { fontWeight: 800, lineHeight: 1.2, wordBreak: "break-word" }, children: t.title ?? /* @__PURE__ */ e("em", { style: { color: "#94a3b8" }, children: "(untitled)" }) })
184
+ ] }),
185
+ /* @__PURE__ */ e(_, { onClick: w, size: "small", children: /* @__PURE__ */ e(Eo, {}) })
186
+ ] }),
187
+ /* @__PURE__ */ r(h, { direction: "row", spacing: 1, sx: { mt: 1 }, flexWrap: "wrap", useFlexGap: !0, children: [
188
+ /* @__PURE__ */ e(F, { value: t.downloadStatus }),
189
+ /* @__PURE__ */ e(F, { value: t.processingStatus })
190
+ ] })
191
+ ] }),
192
+ /* @__PURE__ */ r(g, { sx: { p: 2.5, overflowY: "auto", flexGrow: 1 }, children: [
193
+ /* @__PURE__ */ r(h, { spacing: 2, sx: { mb: 2.5 }, children: [
194
+ /* @__PURE__ */ e(B, { label: "Resource Id", children: /* @__PURE__ */ e(de, { muted: !0, children: t.resourceId ?? "—" }) }),
195
+ /* @__PURE__ */ e(B, { label: "Canonical URL", children: /* @__PURE__ */ e(de, { muted: !0, children: t.canonicalUrl ?? "—" }) }),
196
+ /* @__PURE__ */ r(h, { direction: "row", spacing: 4, children: [
197
+ /* @__PURE__ */ e(B, { label: "First Synced", children: /* @__PURE__ */ e(c, { variant: "body2", children: V(t.firstSyncedAt) }) }),
198
+ /* @__PURE__ */ e(B, { label: "Last Synced", children: /* @__PURE__ */ e(c, { variant: "body2", children: V(t.syncedAt) }) })
199
+ ] }),
200
+ /* @__PURE__ */ e(B, { label: "Server", children: /* @__PURE__ */ e(c, { variant: "body2", children: t.serverName ?? "—" }) })
201
+ ] }),
202
+ /* @__PURE__ */ e(Oe, { sx: { mb: 2 } }),
203
+ /* @__PURE__ */ r(c, { variant: "subtitle2", sx: { fontWeight: 800, mb: 1.5 }, children: [
204
+ "Sync History ",
205
+ b.length ? `(${b.length})` : ""
206
+ ] }),
207
+ v ? /* @__PURE__ */ e(h, { alignItems: "center", sx: { py: 3 }, children: /* @__PURE__ */ e(J, { size: 22 }) }) : b.length === 0 ? /* @__PURE__ */ e(c, { variant: "body2", color: "text.secondary", children: "No sync history yet." }) : b.map((a, P) => /* @__PURE__ */ e(Ne, { event: a, defaultExpanded: P === 0 }, a.id))
208
+ ] }),
209
+ y && /* @__PURE__ */ e(g, { sx: { p: 2, borderTop: "1px solid", borderColor: "divider" }, children: /* @__PURE__ */ e(h, { direction: "row", spacing: 1, justifyContent: "flex-end", children: y(t) }) })
210
+ ]
211
+ }
212
+ );
213
+ }
214
+ ze.propTypes = {
215
+ open: m.bool,
216
+ summary: m.object,
217
+ onClose: m.func.isRequired,
218
+ actionSlot: m.func
219
+ };
220
+ const ko = ["DISCOVERED", "CONTENT_DOWNLOADED", "FAILED"], Fo = ["NOT_STARTED", "PROCESSING", "PROCESSED", "FAILED"], le = 10, Lo = {
221
+ DISCOVERED: "Discovered",
222
+ CONTENT_DOWNLOADED: "Content synced",
223
+ FAILED: "Sync failed"
224
+ }, No = {
225
+ NOT_STARTED: "Not processed",
226
+ PROCESSING: "Processing",
227
+ PROCESSED: "Processed",
228
+ FAILED: "Failed"
229
+ };
230
+ function ir() {
231
+ const { serverId: n } = Je(), d = Ve(), { canManage: w } = go(), [y, t] = l(null), [b, C] = l([]), [v, f] = l(0), [a, P] = l(0), [L, N] = l(!1), [s, A] = l(""), [T, me] = l(""), [D, ge] = l(""), [O, ye] = l(""), [We, Be] = l([]), [M, fe] = l(null), [q, Se] = l(null), [xe, Z] = l(null), [_e, z] = l(null), [we, be] = l(null), G = Ue(null), K = j(async () => {
232
+ try {
233
+ const [o, i] = await Promise.all([
234
+ yo(n),
235
+ fo(n)
236
+ ]);
237
+ t(o == null ? void 0 : o.data), Be((i == null ? void 0 : i.data) ?? []);
238
+ } catch {
239
+ R({ type: "error", message: "Failed to load server." });
240
+ }
241
+ }, [n]), k = j(async (o = 0, i = {}) => {
242
+ N(!0);
243
+ try {
244
+ const p = await So(n, { page: o, size: le, ...i }), u = (p == null ? void 0 : p.data) ?? {};
245
+ C(u.content ?? []), f(u.totalElements ?? 0);
246
+ } catch {
247
+ R({ type: "error", message: "Failed to load staged resources." });
248
+ } finally {
249
+ N(!1);
250
+ }
251
+ }, [n]), H = j(() => ({
252
+ search: s,
253
+ resourceType: T,
254
+ downloadStatus: D,
255
+ processingStatus: O
256
+ }), [s, T, D, O]);
257
+ U(() => {
258
+ K();
259
+ }, [K]), U(() => (G.current && clearTimeout(G.current), G.current = setTimeout(() => {
260
+ P(0), k(0, { search: s, resourceType: T, downloadStatus: D, processingStatus: O });
261
+ }, 300), () => clearTimeout(G.current)), [s, T, D, O, k]);
262
+ const Me = (o, i) => {
263
+ P(i), k(i, H());
264
+ }, Ge = () => {
265
+ A(""), me(""), ge(""), ye("");
266
+ }, Q = s || T || D || O, X = async (o, i, p) => {
267
+ var u, S;
268
+ fe(o);
269
+ try {
270
+ await i(), R({ type: "success", message: p }), await Promise.all([K(), k(a, H())]);
271
+ } catch (E) {
272
+ R({ type: "error", message: ((S = (u = E == null ? void 0 : E.response) == null ? void 0 : u.data) == null ? void 0 : S.message) ?? "Operation failed." });
273
+ } finally {
274
+ fe(null);
275
+ }
276
+ }, ee = async (o, i, p) => {
277
+ var u, S;
278
+ Se({ id: o });
279
+ try {
280
+ await i(), R({ type: "success", message: p }), await k(a, H());
281
+ } catch (E) {
282
+ R({ type: "error", message: ((S = (u = E == null ? void 0 : E.response) == null ? void 0 : u.data) == null ? void 0 : S.message) ?? "Operation failed." });
283
+ } finally {
284
+ Se(null);
285
+ }
286
+ }, He = () => z({
287
+ title: "Process Pending",
288
+ description: "Process all synced-but-not-processed rows into the system, using stored payloads (no re-sync). Continue?",
289
+ onConfirm: () => X("Processing…", () => Po(n), "Processing complete.")
290
+ }), $e = () => z({
291
+ title: "Reprocess Failed",
292
+ description: "Re-run processing for all rows whose processing previously failed, using stored payloads. Continue?",
293
+ onConfirm: () => X("Reprocessing…", () => Ae(n, "FAILED"), "Failed rows reprocessed.")
294
+ }), je = () => z({
295
+ title: "Reprocess All",
296
+ description: "Re-run processing for every synced row on this server, using stored payloads. Continue?",
297
+ onConfirm: () => X("Reprocessing…", () => Ae(n, "ALL"), "All rows reprocessed.")
298
+ }), ve = (o) => z({
299
+ title: "Sync Complete Resource",
300
+ description: `Sync the full content for "${o.title ?? o.resourceType}". For a ValueSet this uses $expand when supported, otherwise a direct read. Continue?`,
301
+ onConfirm: () => ee(o.id, () => Io(n, o.resourceType, o.resourceId), "Content synced.")
302
+ }), oe = (o) => () => {
303
+ Z(null), o();
304
+ }, Ce = (o) => o ? Le(o).format("DD MMM YYYY HH:mm") : "—", Re = (o, { small: i = !0 } = {}) => {
305
+ if (!w) return null;
306
+ const p = (q == null ? void 0 : q.id) === o.id, u = /* @__PURE__ */ e(J, { size: 16, color: "inherit" });
307
+ return o.downloadStatus === "DISCOVERED" ? /* @__PURE__ */ e(
308
+ W,
309
+ {
310
+ size: i ? "small" : "medium",
311
+ variant: "contained",
312
+ color: "info",
313
+ startIcon: p ? u : /* @__PURE__ */ e(ao, {}),
314
+ disabled: p,
315
+ onClick: (S) => {
316
+ S.stopPropagation(), ve(o);
317
+ },
318
+ children: "Sync Content"
319
+ }
320
+ ) : o.downloadStatus === "FAILED" ? /* @__PURE__ */ e(
321
+ W,
322
+ {
323
+ size: i ? "small" : "medium",
324
+ variant: "contained",
325
+ color: "warning",
326
+ startIcon: p ? u : /* @__PURE__ */ e($, {}),
327
+ disabled: p,
328
+ onClick: (S) => {
329
+ S.stopPropagation(), ve(o);
330
+ },
331
+ children: "Retry Sync"
332
+ }
333
+ ) : o.downloadStatus === "CONTENT_DOWNLOADED" && o.processingStatus === "NOT_STARTED" ? /* @__PURE__ */ e(
334
+ W,
335
+ {
336
+ size: i ? "small" : "medium",
337
+ variant: "contained",
338
+ startIcon: p ? u : /* @__PURE__ */ e(lo, {}),
339
+ disabled: p,
340
+ onClick: (S) => {
341
+ S.stopPropagation(), ee(o.id, () => Ee(o.id), `Row #${o.id} processed.`);
342
+ },
343
+ children: "Process Now"
344
+ }
345
+ ) : o.downloadStatus === "CONTENT_DOWNLOADED" && (o.processingStatus === "PROCESSED" || o.processingStatus === "FAILED") ? /* @__PURE__ */ e(
346
+ W,
347
+ {
348
+ size: i ? "small" : "medium",
349
+ variant: "outlined",
350
+ color: "secondary",
351
+ startIcon: p ? u : /* @__PURE__ */ e($, {}),
352
+ disabled: p,
353
+ onClick: (S) => {
354
+ S.stopPropagation(), ee(o.id, () => Ee(o.id), `Row #${o.id} reprocessed.`);
355
+ },
356
+ children: "Reprocess"
357
+ }
358
+ ) : null;
359
+ };
360
+ return /* @__PURE__ */ e(xo, { children: /* @__PURE__ */ r(g, { sx: { p: { xs: 2, md: 3 } }, children: [
361
+ /* @__PURE__ */ e(
362
+ wo,
363
+ {
364
+ title: /* @__PURE__ */ r(h, { direction: "row", alignItems: "center", spacing: 1, children: [
365
+ /* @__PURE__ */ e(Y, { title: "Back to server", children: /* @__PURE__ */ e(_, { size: "small", onClick: () => d(`/ui/medplat/admin/fhirResource/${n}`), children: /* @__PURE__ */ e(so, { fontSize: "small" }) }) }),
366
+ /* @__PURE__ */ r("span", { children: [
367
+ "Staging Inbox",
368
+ y ? ` — ${y.name}` : ""
369
+ ] })
370
+ ] }),
371
+ subtitle: "Every synced resource lands here. Sync and processing are tracked independently — click any row to see its full lifecycle.",
372
+ chips: y ? [y.fhirVersion ? `FHIR ${y.fhirVersion}` : "FHIR", y.baseUrl] : [],
373
+ actions: /* @__PURE__ */ r(h, { direction: "row", spacing: 1, alignItems: "center", children: [
374
+ w && /* @__PURE__ */ e(
375
+ W,
376
+ {
377
+ variant: "contained",
378
+ sx: { minWidth: 132 },
379
+ endIcon: /* @__PURE__ */ e(ce, {}),
380
+ startIcon: M ? /* @__PURE__ */ e(J, { size: 16, color: "inherit" }) : /* @__PURE__ */ e(co, {}),
381
+ disabled: !!M,
382
+ onClick: (o) => Z(o.currentTarget),
383
+ children: M ? "Working…" : "Actions"
384
+ }
385
+ ),
386
+ /* @__PURE__ */ e(Y, { title: "Reload", children: /* @__PURE__ */ e("span", { children: /* @__PURE__ */ e(_, { onClick: () => k(a, H()), disabled: L, children: /* @__PURE__ */ e(io, {}) }) }) })
387
+ ] })
388
+ }
389
+ ),
390
+ /* @__PURE__ */ r(
391
+ Ke,
392
+ {
393
+ anchorEl: xe,
394
+ open: !!xe,
395
+ onClose: () => Z(null),
396
+ transformOrigin: { horizontal: "right", vertical: "top" },
397
+ anchorOrigin: { horizontal: "right", vertical: "bottom" },
398
+ MenuListProps: { sx: { py: 0.5 } },
399
+ PaperProps: { sx: { width: 360, maxWidth: "calc(100vw - 32px)", mt: 0.5 } },
400
+ children: [
401
+ /* @__PURE__ */ r(I, { onClick: oe(He), sx: { alignItems: "flex-start", py: 1 }, children: [
402
+ /* @__PURE__ */ e(re, { sx: { mt: 0.5 }, children: /* @__PURE__ */ e(Fe, { fontSize: "small", color: "primary" }) }),
403
+ /* @__PURE__ */ e(
404
+ ne,
405
+ {
406
+ primary: "Process Pending",
407
+ secondary: "Project synced-but-unprocessed rows into the system",
408
+ secondaryTypographyProps: { sx: { whiteSpace: "normal" } }
409
+ }
410
+ )
411
+ ] }),
412
+ /* @__PURE__ */ e(Oe, {}),
413
+ /* @__PURE__ */ r(I, { onClick: oe($e), sx: { alignItems: "flex-start", py: 1 }, children: [
414
+ /* @__PURE__ */ e(re, { sx: { mt: 0.5 }, children: /* @__PURE__ */ e($, { fontSize: "small", color: "warning" }) }),
415
+ /* @__PURE__ */ e(
416
+ ne,
417
+ {
418
+ primary: "Reprocess Failed",
419
+ secondary: "Retry rows that failed processing",
420
+ secondaryTypographyProps: { sx: { whiteSpace: "normal" } }
421
+ }
422
+ )
423
+ ] }),
424
+ /* @__PURE__ */ r(I, { onClick: oe(je), sx: { alignItems: "flex-start", py: 1 }, children: [
425
+ /* @__PURE__ */ e(re, { sx: { mt: 0.5 }, children: /* @__PURE__ */ e($, { fontSize: "small" }) }),
426
+ /* @__PURE__ */ e(
427
+ ne,
428
+ {
429
+ primary: "Reprocess All",
430
+ secondary: "Re-run processing for every synced row",
431
+ secondaryTypographyProps: { sx: { whiteSpace: "normal" } }
432
+ }
433
+ )
434
+ ] })
435
+ ]
436
+ }
437
+ ),
438
+ /* @__PURE__ */ r(
439
+ bo,
440
+ {
441
+ title: "Staged Resources",
442
+ subtitle: L ? "Loading…" : `${v} ${v === 1 ? "resource" : "resources"}`,
443
+ children: [
444
+ /* @__PURE__ */ r(h, { direction: "row", spacing: 1.25, alignItems: "center", flexWrap: "wrap", useFlexGap: !0, sx: { mb: 1.5 }, children: [
445
+ /* @__PURE__ */ e(
446
+ Qe,
447
+ {
448
+ size: "small",
449
+ placeholder: "Search name or id…",
450
+ value: s,
451
+ onChange: (o) => A(o.target.value),
452
+ InputProps: { startAdornment: /* @__PURE__ */ e(Xe, { position: "start", children: /* @__PURE__ */ e(po, { fontSize: "small" }) }) },
453
+ sx: { minWidth: 220, flexGrow: 1, maxWidth: 320 }
454
+ }
455
+ ),
456
+ /* @__PURE__ */ r(te, { size: "small", sx: { minWidth: 150 }, children: [
457
+ /* @__PURE__ */ e(se, { children: "Resource Type" }),
458
+ /* @__PURE__ */ r(ie, { label: "Resource Type", value: T, onChange: (o) => me(o.target.value), children: [
459
+ /* @__PURE__ */ e(I, { value: "", children: "All types" }),
460
+ We.map((o) => /* @__PURE__ */ e(I, { value: o, children: o }, o))
461
+ ] })
462
+ ] }),
463
+ /* @__PURE__ */ r(te, { size: "small", sx: { minWidth: 160 }, children: [
464
+ /* @__PURE__ */ e(se, { children: "Sync Status" }),
465
+ /* @__PURE__ */ r(ie, { label: "Sync Status", value: D, onChange: (o) => ge(o.target.value), children: [
466
+ /* @__PURE__ */ e(I, { value: "", children: "All" }),
467
+ ko.map((o) => /* @__PURE__ */ e(I, { value: o, children: Lo[o] }, o))
468
+ ] })
469
+ ] }),
470
+ /* @__PURE__ */ r(te, { size: "small", sx: { minWidth: 160 }, children: [
471
+ /* @__PURE__ */ e(se, { children: "Processing" }),
472
+ /* @__PURE__ */ r(ie, { label: "Processing", value: O, onChange: (o) => ye(o.target.value), children: [
473
+ /* @__PURE__ */ e(I, { value: "", children: "All" }),
474
+ Fo.map((o) => /* @__PURE__ */ e(I, { value: o, children: No[o] }, o))
475
+ ] })
476
+ ] }),
477
+ Q && /* @__PURE__ */ e(Y, { title: "Clear filters", children: /* @__PURE__ */ e(_, { size: "small", onClick: Ge, children: /* @__PURE__ */ e(ho, {}) }) })
478
+ ] }),
479
+ /* @__PURE__ */ e(g, { sx: { height: 3, mb: 0.5 }, children: M && /* @__PURE__ */ e(eo, {}) }),
480
+ /* @__PURE__ */ r(vo, { children: [
481
+ /* @__PURE__ */ e(oo, { children: /* @__PURE__ */ r(ae, { children: [
482
+ /* @__PURE__ */ e(x, { children: "Ref" }),
483
+ /* @__PURE__ */ e(x, { children: "Type" }),
484
+ /* @__PURE__ */ e(x, { children: "Name" }),
485
+ /* @__PURE__ */ e(x, { children: "Sync Status" }),
486
+ /* @__PURE__ */ e(x, { children: "Processing Status" }),
487
+ /* @__PURE__ */ e(x, { align: "right", children: "Action" })
488
+ ] }) }),
489
+ /* @__PURE__ */ e(ro, { children: L ? Array.from({ length: 6 }).map((o, i) => /* @__PURE__ */ e(ae, { children: Array.from({ length: 6 }).map((p, u) => /* @__PURE__ */ e(x, { children: /* @__PURE__ */ e(no, { height: 22 }) }, u)) }, i)) : b.length === 0 ? /* @__PURE__ */ e(
490
+ Co,
491
+ {
492
+ colSpan: 6,
493
+ title: Q ? "No matching resources" : "Nothing staged yet",
494
+ hint: Q ? "Try adjusting or clearing the filters." : "Use Sync on this server to bring resources into the staging inbox."
495
+ }
496
+ ) : b.map((o) => /* @__PURE__ */ r(ae, { hover: !0, sx: { cursor: "pointer" }, onClick: () => be(o), children: [
497
+ /* @__PURE__ */ e(x, { children: /* @__PURE__ */ e(
498
+ ke,
499
+ {
500
+ label: `#${o.id}`,
501
+ size: "small",
502
+ sx: { fontFamily: "monospace", fontWeight: 700, height: 22, borderRadius: 1 }
503
+ }
504
+ ) }),
505
+ /* @__PURE__ */ e(x, { children: /* @__PURE__ */ e(c, { variant: "body2", sx: { fontWeight: 600 }, children: o.resourceType }) }),
506
+ /* @__PURE__ */ r(x, { sx: { maxWidth: 260 }, children: [
507
+ /* @__PURE__ */ e(c, { variant: "body2", sx: { fontWeight: 700, wordBreak: "break-word" }, children: o.title ?? /* @__PURE__ */ e("em", { style: { color: "#94a3b8" }, children: "(untitled)" }) }),
508
+ /* @__PURE__ */ e(de, { muted: !0, children: o.resourceId ?? "—" })
509
+ ] }),
510
+ /* @__PURE__ */ e(x, { children: /* @__PURE__ */ r(h, { spacing: 0.5, alignItems: "flex-start", children: [
511
+ /* @__PURE__ */ e(F, { value: o.downloadStatus }),
512
+ /* @__PURE__ */ e(c, { variant: "caption", color: "text.secondary", children: Ce(o.syncedAt) })
513
+ ] }) }),
514
+ /* @__PURE__ */ e(x, { children: /* @__PURE__ */ r(h, { spacing: 0.5, alignItems: "flex-start", children: [
515
+ /* @__PURE__ */ e(F, { value: o.processingStatus }),
516
+ /* @__PURE__ */ e(c, { variant: "caption", color: "text.secondary", children: o.processedAt ? Ce(o.processedAt) : "—" })
517
+ ] }) }),
518
+ /* @__PURE__ */ e(x, { align: "right", onClick: (i) => i.stopPropagation(), children: Re(o) })
519
+ ] }, o.id)) })
520
+ ] }),
521
+ /* @__PURE__ */ e(
522
+ to,
523
+ {
524
+ component: "div",
525
+ count: v,
526
+ page: a,
527
+ onPageChange: Me,
528
+ rowsPerPage: le,
529
+ rowsPerPageOptions: [le]
530
+ }
531
+ )
532
+ ]
533
+ }
534
+ ),
535
+ /* @__PURE__ */ e(
536
+ ze,
537
+ {
538
+ open: !!we,
539
+ summary: we,
540
+ onClose: () => be(null),
541
+ actionSlot: w ? ((o) => Re(o, { small: !1 })) : void 0
542
+ }
543
+ ),
544
+ /* @__PURE__ */ e(Ro, { confirm: _e, onClose: () => z(null) })
545
+ ] }) });
546
+ }
547
+ export {
548
+ ir as default
549
+ };
550
+ //# sourceMappingURL=FhirRawResourceList-ZZFd7gTX.js.map