@bahmni/admin-app 0.0.1-dev.445 → 0.0.1-dev.447

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.
@@ -1,5 +1,5 @@
1
1
  import { jsx as e } from "react/jsx-runtime";
2
- import { C as o, E as a, F as s, G as N } from "./index-DI87tGQ1.js";
2
+ import { E as o, F as a, L as s, M as N } from "./index-ClETYuc0.js";
3
3
  import "react";
4
4
  import "@tanstack/react-query";
5
5
  const i = () => /* @__PURE__ */ e(o, { children: /* @__PURE__ */ e(
@@ -1,7 +1,7 @@
1
1
  import { jsx as d, jsxs as S } from "react/jsx-runtime";
2
- import { _ as ee, a0 as te, a1 as se, a2 as K, u as ae, a3 as ne, a4 as re, C as ie, U as oe, a5 as ue, a6 as de, a7 as U, Y as V, a8 as le } from "./index-DI87tGQ1.js";
2
+ import { $ as ee, a0 as te, a1 as se, a2 as K, u as ae, a3 as ne, a4 as re, E as ie, T as oe, a5 as ue, a6 as de, a7 as U, X as V, a8 as le } from "./index-ClETYuc0.js";
3
3
  import { useState as l, useRef as C, useEffect as k, useMemo as ce, useCallback as me } from "react";
4
- import { useQuery as _e } from "@tanstack/react-query";
4
+ import { useQuery as Ee } from "@tanstack/react-query";
5
5
  const G = Symbol.for("constructDateFrom");
6
6
  function y(e, t) {
7
7
  return typeof e == "function" ? e(t) : e && typeof e == "object" && G in e ? e[G](t) : e instanceof Date ? new e.constructor(t) : new Date(t);
@@ -9,15 +9,15 @@ function y(e, t) {
9
9
  function w(e, t) {
10
10
  return y(e, e);
11
11
  }
12
- function Ee(e, t) {
12
+ function _e(e, t) {
13
13
  const r = w(e), a = r.getFullYear(), i = r.getMonth(), u = y(r, 0);
14
14
  return u.setFullYear(a, i + 1, 0), u.setHours(0, 0, 0, 0), u.getDate();
15
15
  }
16
16
  function fe(e, t, r) {
17
- const a = w(e), i = a.getFullYear(), u = a.getDate(), _ = y(e, 0);
18
- _.setFullYear(i, t, 15), _.setHours(0, 0, 0, 0);
19
- const E = Ee(_);
20
- return a.setMonth(t, Math.min(u, E)), a;
17
+ const a = w(e), i = a.getFullYear(), u = a.getDate(), E = y(e, 0);
18
+ E.setFullYear(i, t, 15), E.setHours(0, 0, 0, 0);
19
+ const _ = _e(E);
20
+ return a.setMonth(t, Math.min(u, _)), a;
21
21
  }
22
22
  function ge(e, t, r) {
23
23
  let a = w(e);
@@ -38,9 +38,9 @@ const Le = (e, t) => {
38
38
  startTime: "00:00",
39
39
  username: "",
40
40
  patientId: ""
41
- }), [r, a] = l(0), [i, u] = l(0), [_, E] = l([]), [R, p] = l(null), [b, f] = l(!1), [O, g] = l(!1), [F, M] = l(1), T = C(1), s = (c) => {
41
+ }), [r, a] = l(0), [i, u] = l(0), [E, _] = l([]), [R, p] = l(null), [b, f] = l(!1), [O, g] = l(!1), [F, M] = l(1), T = C(1), s = (c) => {
42
42
  T.current = c, M(c);
43
- }, o = C(0), [n, j] = l(null), B = C(null), { data: N, isLoading: z, isFetching: L, isError: Q } = _e({
43
+ }, o = C(0), [n, j] = l(null), B = C(null), { data: N, isLoading: X, isFetching: L, isError: z } = Ee({
44
44
  queryKey: ["auditLogs", n?.requestId],
45
45
  queryFn: () => te(n.params),
46
46
  enabled: !!n,
@@ -48,17 +48,17 @@ const Le = (e, t) => {
48
48
  // (and audit logs must always be fetched fresh). Drop entries as soon as
49
49
  // they become inactive instead of retaining them for the default gcTime.
50
50
  gcTime: 0
51
- }), I = (c, H, m, D, h, $) => {
51
+ }), I = (c, H, m, D, h, W) => {
52
52
  o.current += 1, j({
53
53
  action: c,
54
54
  params: H,
55
55
  alwaysReplace: m,
56
56
  defaultFirstIndex: D,
57
57
  defaultLastIndex: h,
58
- emptyMessageKey: $,
58
+ emptyMessageKey: W,
59
59
  requestId: o.current
60
60
  });
61
- }, A = Le(e.startDate, e.startTime), X = () => {
61
+ }, A = Le(e.startDate, e.startTime), Q = () => {
62
62
  I(
63
63
  "init",
64
64
  { startFrom: A, defaultView: !0 },
@@ -88,7 +88,7 @@ const Le = (e, t) => {
88
88
  Y
89
89
  );
90
90
  }
91
- }, J = () => {
91
+ }, $ = () => {
92
92
  if (!L) {
93
93
  if (!v()) {
94
94
  x();
@@ -122,7 +122,7 @@ const Le = (e, t) => {
122
122
  0,
123
123
  Te
124
124
  );
125
- }, W = () => {
125
+ }, J = () => {
126
126
  L || (t({
127
127
  startDate: null,
128
128
  startTime: "",
@@ -131,13 +131,13 @@ const Le = (e, t) => {
131
131
  }), I("init", { defaultView: !0 }, !0, 0, 0, q));
132
132
  };
133
133
  return k(() => {
134
- X();
134
+ Q();
135
135
  }, []), k(() => {
136
136
  if (!n || N === void 0 || B.current === n.requestId) return;
137
137
  B.current = n.requestId;
138
138
  const c = !!n.params.defaultView, m = (c ? N : [...N].reverse()).map(se), D = m.length === K;
139
139
  if (m.length)
140
- if (E(m), p(null), a(m[0].auditLogId), u(m[m.length - 1].auditLogId), c)
140
+ if (_(m), p(null), a(m[0].auditLogId), u(m[m.length - 1].auditLogId), c)
141
141
  g(!1), f(D), s(1);
142
142
  else if (n.action === "next")
143
143
  g(!0), f(D), s(T.current + 1);
@@ -147,14 +147,14 @@ const Le = (e, t) => {
147
147
  g(h > 1), s(h);
148
148
  }
149
149
  else
150
- n.alwaysReplace && E([]), p(n.emptyMessageKey), a(n.defaultFirstIndex), u(n.defaultLastIndex), c ? (f(!1), g(!1), s(1)) : n.action === "next" ? f(!1) : g(!1);
150
+ n.alwaysReplace && _([]), p(n.emptyMessageKey), a(n.defaultFirstIndex), u(n.defaultLastIndex), c ? (f(!1), g(!1), s(1)) : n.action === "next" ? f(!1) : g(!1);
151
151
  }, [N, n]), {
152
152
  filters: e,
153
153
  setFilters: t,
154
- logs: _,
155
- isLoading: z || L,
154
+ logs: E,
155
+ isLoading: X || L,
156
156
  isFetching: L,
157
- isError: Q,
157
+ isError: z,
158
158
  emptyMessageKey: R,
159
159
  firstIndex: r,
160
160
  lastIndex: i,
@@ -162,9 +162,9 @@ const Le = (e, t) => {
162
162
  hasPrevious: O,
163
163
  currentPageNumber: F,
164
164
  next: Z,
165
- prev: J,
165
+ prev: $,
166
166
  runReport: x,
167
- reset: W
167
+ reset: J
168
168
  };
169
169
  }, pe = "AuditLog-module_page__-FKzd", Ne = "AuditLog-module_filters__DA4tQ", Ae = "AuditLog-module_filterRow__x6DqE", P = {
170
170
  page: pe,
@@ -177,8 +177,8 @@ const Le = (e, t) => {
177
177
  logs: a,
178
178
  isLoading: i,
179
179
  isFetching: u,
180
- isError: _,
181
- emptyMessageKey: E,
180
+ isError: E,
181
+ emptyMessageKey: _,
182
182
  hasNext: R,
183
183
  hasPrevious: p,
184
184
  currentPageNumber: b,
@@ -329,8 +329,8 @@ const Le = (e, t) => {
329
329
  dataTestId: "audit-log-table",
330
330
  loading: i,
331
331
  renderCell: T,
332
- emptyStateMessage: E ? e(E) : void 0,
333
- errorStateMessage: _ ? e("ADMIN_ERROR_FETCH_CONFIG") : null,
332
+ emptyStateMessage: _ ? e(_) : void 0,
333
+ errorStateMessage: E ? e("ADMIN_ERROR_FETCH_CONFIG") : null,
334
334
  pagination: {
335
335
  mode: "cursor",
336
336
  pageSize: K,
@@ -1,27 +1,27 @@
1
1
  import { jsx as n, jsxs as d } from "react/jsx-runtime";
2
- import { u as A, z as M, I as R, K as O, N as h, O as P, P as g, C as V, U as f, V as D, Y as x, Z as b } from "./index-DI87tGQ1.js";
2
+ import { u as A, z as M, N as R, O, P as h, Q as P, S as g, E as V, T as D, V as f, X as x, Z as b } from "./index-ClETYuc0.js";
3
3
  import { useState as E, useMemo as y } from "react";
4
- import { useQuery as L, useMutation as v } from "@tanstack/react-query";
5
- const X = "CsvExport-module_tile__yBrLM", U = "CsvExport-module_title__epZnI", B = "CsvExport-module_form__w-cN-", H = "CsvExport-module_search__G82i7", r = {
6
- tile: X,
7
- title: U,
8
- form: B,
9
- search: H
10
- }, z = 300, p = 2, _ = 5e3, G = "custom:(uuid,setMembers:(uuid))", k = () => {
11
- const { t } = A(), { addNotification: i } = M(), [C, S] = E(""), [s, c] = E(
4
+ import { useQuery as L, useMutation as X } from "@tanstack/react-query";
5
+ const v = "CsvExport-module_tile__yBrLM", B = "CsvExport-module_title__epZnI", H = "CsvExport-module_form__w-cN-", U = "CsvExport-module_search__G82i7", r = {
6
+ tile: v,
7
+ title: B,
8
+ form: H,
9
+ search: U
10
+ }, z = 300, S = 2, _ = 5e3, G = "custom:(uuid,setMembers:(uuid))", q = () => {
11
+ const { t } = A(), { addNotification: i } = M(), [p, C] = E(""), [s, c] = E(
12
12
  null
13
- ), a = R(C.trim(), z), { data: l = [] } = L({
13
+ ), a = R(p.trim(), z), { data: l = [] } = L({
14
14
  queryKey: ["csvExportConceptSearch", a],
15
15
  queryFn: () => O(a),
16
- enabled: a.length >= p && a !== s?.name,
16
+ enabled: a.length >= S && a !== s?.name,
17
17
  // Keep prior options visible while the next term loads, but not once the input is too short to search
18
- placeholderData: (e) => a.length >= p ? e : void 0
18
+ placeholderData: (e) => a.length >= S ? e : void 0
19
19
  }), T = y(
20
20
  () => l.flatMap(
21
21
  (e) => e.name?.name ? [{ uuid: e.uuid, name: e.name.name }] : []
22
22
  ),
23
23
  [l]
24
- ), o = v({
24
+ ), o = X({
25
25
  mutationFn: async (e) => (await P(e.uuid, G)).setMembers?.length ? g(e.name) : null,
26
26
  onSuccess: (e, u) => {
27
27
  const m = u.name;
@@ -50,7 +50,7 @@ const X = "CsvExport-module_tile__yBrLM", U = "CsvExport-module_title__epZnI", B
50
50
  });
51
51
  }
52
52
  }), I = (e) => {
53
- S(e), s && e !== s.name && c(null);
53
+ C(e), s && e !== s.name && c(null);
54
54
  }, N = (e) => {
55
55
  if (e.preventDefault(), !o.isPending) {
56
56
  if (!s) {
@@ -66,7 +66,7 @@ const X = "CsvExport-module_tile__yBrLM", U = "CsvExport-module_title__epZnI", B
66
66
  }
67
67
  };
68
68
  return /* @__PURE__ */ n(V, { breadcrumbLabel: t("BREADCRUMB_CSV_EXPORT"), children: /* @__PURE__ */ d(
69
- f,
69
+ D,
70
70
  {
71
71
  id: "admin-csv-export-page",
72
72
  "data-testid": "admin-csv-export-page-test-id",
@@ -76,7 +76,7 @@ const X = "CsvExport-module_tile__yBrLM", U = "CsvExport-module_title__epZnI", B
76
76
  /* @__PURE__ */ n("h2", { className: r.title, children: t("ADMIN_CSV_EXPORT_TITLE") }),
77
77
  /* @__PURE__ */ d("form", { className: r.form, onSubmit: N, noValidate: !0, children: [
78
78
  /* @__PURE__ */ n("div", { className: r.search, children: /* @__PURE__ */ n(
79
- D,
79
+ f,
80
80
  {
81
81
  id: "csv-export-concept-search",
82
82
  "data-testid": "csv-export-concept-search-test-id",
@@ -118,5 +118,5 @@ const X = "CsvExport-module_tile__yBrLM", U = "CsvExport-module_title__epZnI", B
118
118
  ) });
119
119
  };
120
120
  export {
121
- k as CsvExport
121
+ q as CsvExport
122
122
  };
@@ -1,5 +1,5 @@
1
1
  import { jsx as a, jsxs as e } from "react/jsx-runtime";
2
- import { u as d, C as o } from "./index-DI87tGQ1.js";
2
+ import { u as d, E as o } from "./index-ClETYuc0.js";
3
3
  const t = "CsvUpload-module_page__AxMNv", i = {
4
4
  page: t
5
5
  }, n = () => {
@@ -1,7 +1,7 @@
1
- import { jsx as d, jsxs as h, Fragment as x } from "react/jsx-runtime";
2
- import { d as G, u as J, z as W, i as Y, J as X, h as Z, $ as ee, a as te } from "./index-DI87tGQ1.js";
1
+ import { jsx as d, jsxs as h, Fragment as Y } from "react/jsx-runtime";
2
+ import { d as x, u as G, z as J, J as W, Y as X, h as Z, I as ee, a as te } from "./index-ClETYuc0.js";
3
3
  import { useQuery as ae } from "@tanstack/react-query";
4
- import { useState as l, useCallback as _, useEffect as I, useMemo as p } from "react";
4
+ import { useState as l, useCallback as _, useEffect as D, useMemo as p } from "react";
5
5
  const ne = "DocumentsTable-module_documentsTableBody__6iR3w", oe = "DocumentsTable-module_viewAttachmentsLink__aQ1on", de = "DocumentsTable-module_documentViewerContainer__F5m8D", re = "DocumentsTable-module_attachmentItem__17KA7", se = "DocumentsTable-module_attachmentCounter__WFiI3", me = "DocumentsTable-module_attachmentError__RI4U2", ce = "DocumentsTable-module_documentIframe__ptq5I", le = "DocumentsTable-module_documentImage__KQVgS", r = {
6
6
  documentsTableBody: ne,
7
7
  viewAttachmentsLink: oe,
@@ -33,12 +33,12 @@ const Te = [
33
33
  "attachments",
34
34
  "uploadedOn",
35
35
  "uploadedBy"
36
- ], he = /\.(jpg|jpeg|png|gif|webp|bmp|svg)$/i, B = (a) => a.attachments.length > 0 ? a.attachments : a.documentUrl ? [{ url: a.documentUrl, contentType: a.contentType }] : [], Ne = ({ config: a, encounterUuids: E }) => {
36
+ ], he = /\.(jpg|jpeg|png|gif|webp|bmp|svg)$/i, B = (a) => a.attachments.length > 0 ? a.attachments : a.documentUrl ? [{ url: a.documentUrl, contentType: a.contentType }] : [], Ie = ({ config: a, encounterUuids: E }) => {
37
37
  const [s, w] = l(!1), [o, U] = l(
38
38
  null
39
39
  ), [$, O] = l(
40
40
  /* @__PURE__ */ new Set()
41
- ), g = G(), { t: n } = J(), { addNotification: L } = W(), k = Number(a?.pageSize) || 5, [f, C] = l(1), [u, V] = l(k), [F, A] = l(void 0), M = _((e) => {
41
+ ), g = x(), { t: n } = G(), { addNotification: L } = J(), k = Number(a?.pageSize) || 5, [f, C] = l(1), [u, V] = l(k), [F, A] = l(void 0), M = _((e) => {
42
42
  U(e), w(!0);
43
43
  }, []), H = _(() => {
44
44
  w(!1), U(null), O(/* @__PURE__ */ new Set());
@@ -53,24 +53,24 @@ const Te = [
53
53
  u
54
54
  ],
55
55
  enabled: !!g,
56
- queryFn: () => Y(
56
+ queryFn: () => W(
57
57
  g,
58
58
  E,
59
59
  u,
60
60
  f
61
61
  )
62
62
  });
63
- I(() => {
63
+ D(() => {
64
64
  i && A(i.total);
65
- }, [i]), I(() => {
65
+ }, [i]), D(() => {
66
66
  C(1), A(void 0);
67
- }, [g]), I(() => {
67
+ }, [g]), D(() => {
68
68
  y && L({
69
69
  title: n("ERROR_DEFAULT_TITLE"),
70
70
  message: b?.message ?? "",
71
71
  type: "error"
72
72
  });
73
- }, [y, b, L, n]), I(() => {
73
+ }, [y, b, L, n]), D(() => {
74
74
  const e = new AbortController();
75
75
  return (async () => {
76
76
  if (!s || !o) return;
@@ -82,8 +82,8 @@ const Te = [
82
82
  method: "HEAD",
83
83
  signal: e.signal
84
84
  })).ok || t.add(c);
85
- } catch (D) {
86
- D instanceof Error && D.name !== "AbortError" && t.add(c);
85
+ } catch (N) {
86
+ N instanceof Error && N.name !== "AbortError" && t.add(c);
87
87
  }
88
88
  }
89
89
  e.signal.aborted || O(t);
@@ -94,15 +94,15 @@ const Te = [
94
94
  t !== u ? (V(t), C(1), A(void 0)) : C(e);
95
95
  },
96
96
  [u]
97
- ), N = p(
97
+ ), I = p(
98
98
  () => a?.fields ?? Te,
99
99
  [a?.fields]
100
- ), j = p(() => [...i?.documents ?? []].sort((e, t) => !e.uploadedOn && !t.uploadedOn ? 0 : e.uploadedOn ? t.uploadedOn ? new Date(t.uploadedOn).getTime() - new Date(e.uploadedOn).getTime() : -1 : 1), [i]), P = p(() => ie(N, n), [N, n]), K = p(
101
- () => N.map((e) => ({
100
+ ), j = p(() => [...i?.documents ?? []].sort((e, t) => !e.uploadedOn && !t.uploadedOn ? 0 : e.uploadedOn ? t.uploadedOn ? new Date(t.uploadedOn).getTime() - new Date(e.uploadedOn).getTime() : -1 : 1), [i]), P = p(() => ie(I, n), [I, n]), K = p(
101
+ () => I.map((e) => ({
102
102
  key: e,
103
103
  sortable: e !== "attachments"
104
104
  })),
105
- [N]
105
+ [I]
106
106
  ), T = p(
107
107
  () => o ? B(o) : [],
108
108
  [o]
@@ -137,7 +137,7 @@ const Te = [
137
137
  },
138
138
  [M, n]
139
139
  );
140
- return /* @__PURE__ */ h(x, { children: [
140
+ return /* @__PURE__ */ h(Y, { children: [
141
141
  /* @__PURE__ */ d("div", { "data-testid": "documents-table", children: /* @__PURE__ */ d(
142
142
  ee,
143
143
  {
@@ -169,8 +169,8 @@ const Te = [
169
169
  size: "lg",
170
170
  testId: "document-view-modal",
171
171
  children: /* @__PURE__ */ d("div", { className: r.documentViewerContainer, children: T.map((e, t) => {
172
- const m = R(e.url), c = e.contentType?.toLowerCase().includes("pdf"), S = (e.contentType?.toLowerCase().includes("image") ?? !1) || he.test(e.url ?? ""), D = $.has(t);
173
- return m === "#" || D ? /* @__PURE__ */ h(
172
+ const m = R(e.url), c = e.contentType?.toLowerCase().includes("pdf"), S = (e.contentType?.toLowerCase().includes("image") ?? !1) || he.test(e.url ?? ""), N = $.has(t);
173
+ return m === "#" || N ? /* @__PURE__ */ h(
174
174
  "div",
175
175
  {
176
176
  className: r.attachmentError,
@@ -223,5 +223,5 @@ const Te = [
223
223
  ] });
224
224
  };
225
225
  export {
226
- Ne as default
226
+ Ie as default
227
227
  };
@@ -1,102 +1,102 @@
1
1
  import { jsx as n, jsxs as q, Fragment as ne } from "react/jsx-runtime";
2
- import { u as ie, d as de, x as le, k as me, H as ue, b as ce, y as fe, e as ye, w as Te, S as he, D as Ne, R as ge, h as pe, L as V, T as $, J as Oe, $ as x, W as be, q as Ie, a as Ee, c as _e, M as Ae } from "./index-DI87tGQ1.js";
3
- import { useQueryClient as Le, useQuery as E } from "@tanstack/react-query";
4
- import { useState as K, useMemo as i, useCallback as d } from "react";
5
- const Re = "FormsTable-module_formsTableBody__SvGha", Ce = "FormsTable-module_modalHeading__wnTmA", ve = "FormsTable-module_customAccordianItem__isszs", N = {
6
- formsTableBody: Re,
7
- modalHeading: Ce,
8
- customAccordianItem: ve
9
- }, Be = "startConsultation", Ue = ({
10
- episodeOfCareUuids: _,
2
+ import { u as ie, d as de, y as le, k as me, H as ue, b as ce, m as fe, c as ye, w as he, e as Ne, f as ge, R as Te, h as pe, g as V, i as z, Y as Ie, I as K, U as Oe, W as be, a as Ae, A as Ee, j as _e } from "./index-ClETYuc0.js";
3
+ import { useQueryClient as Re, useQuery as A } from "@tanstack/react-query";
4
+ import { useState as Y, useMemo as i, useCallback as d } from "react";
5
+ const Ce = "FormsTable-module_formsTableBody__SvGha", ve = "FormsTable-module_modalHeading__wnTmA", Le = "FormsTable-module_customAccordianItem__isszs", g = {
6
+ formsTableBody: Ce,
7
+ modalHeading: ve,
8
+ customAccordianItem: Le
9
+ }, Ue = "startConsultation", Me = ({
10
+ episodeOfCareUuids: E,
11
11
  encounterUuids: l,
12
- config: j,
13
- disableActions: z = !1,
12
+ config: $,
13
+ disableActions: j = !1,
14
14
  activeEncounterUuid: y = null
15
15
  }) => {
16
- const { t: o } = ie(), m = de(), [g, A] = K(!1), [t, L] = K(null), {
17
- numberOfVisits: Q,
18
- hideThumbnail: G = !1,
19
- forms: T
20
- } = j ?? {}, J = le(
21
- Ae.EDIT_OBSERVATIONS
22
- ), { userPrivileges: h } = me(), p = J && !z && !!y, R = ue(
23
- _,
16
+ const { t: o } = ie(), m = de(), [T, _] = Y(!1), [t, R] = Y(null), {
17
+ numberOfVisits: x,
18
+ hideThumbnail: Q = !1,
19
+ forms: h
20
+ } = $ ?? {}, G = le(
21
+ _e.EDIT_OBSERVATIONS
22
+ ), { userPrivileges: N } = me(), p = G && !j && !!y, C = ue(
23
+ E,
24
24
  l
25
- ), P = Le(), {
26
- data: C = [],
27
- isLoading: v,
28
- isError: B,
25
+ ), P = Re(), {
26
+ data: v = [],
27
+ isLoading: L,
28
+ isError: U,
29
29
  error: W,
30
- refetch: Y
31
- } = E({
32
- queryKey: ["forms", m, _],
33
- queryFn: () => ce(m, void 0, Q),
34
- enabled: !!m && !R
35
- }), D = i(() => {
36
- let e = C;
30
+ refetch: J
31
+ } = A({
32
+ queryKey: ["forms", m, E],
33
+ queryFn: () => ce(m, void 0, x),
34
+ enabled: !!m && !C
35
+ }), B = i(() => {
36
+ let e = v;
37
37
  return l && l.length > 0 && (e = e.filter(
38
38
  (r) => l.includes(r.encounterUuid)
39
- )), Array.isArray(T) && T.length > 0 && (e = e.filter(
40
- (r) => T.some((a) => a.toLowerCase() === r.formName.toLowerCase())
39
+ )), Array.isArray(h) && h.length > 0 && (e = e.filter(
40
+ (r) => h.some((a) => a.toLowerCase() === r.formName.toLowerCase())
41
41
  )), e;
42
- }, [C, l, T]), { data: F = [] } = E({
42
+ }, [v, l, h]), { data: F = [] } = A({
43
43
  queryKey: ["observationForms"],
44
44
  queryFn: () => fe()
45
- }), S = d(
45
+ }), D = d(
46
46
  (e) => {
47
47
  const r = F.find(
48
48
  (s) => s.name.toLowerCase() === e.toLowerCase()
49
49
  );
50
50
  if (!r?.privileges || r.privileges.length === 0) return !0;
51
- if (!h || h.length === 0) return !1;
52
- const a = new Set(h.map((s) => s.name));
51
+ if (!N || N.length === 0) return !1;
52
+ const a = new Set(N.map((s) => s.name));
53
53
  return r.privileges.some(
54
54
  (s) => a.has(s.privilegeName) && s.editable
55
55
  );
56
56
  },
57
- [F, h]
57
+ [F, N]
58
58
  ), u = d(
59
- (e) => !y || e.encounterUuid !== y ? !1 : S(e.formName),
60
- [y, S]
59
+ (e) => !y || e.encounterUuid !== y ? !1 : D(e.formName),
60
+ [y, D]
61
61
  ), {
62
- data: O,
62
+ data: I,
63
63
  isLoading: X,
64
64
  isError: Z,
65
- error: b
66
- } = E({
65
+ error: O
66
+ } = A({
67
67
  queryKey: ["formsEncounterFHIR", t?.encounterUuid],
68
68
  queryFn: () => ye(t.encounterUuid),
69
- enabled: !!t?.encounterUuid && g
69
+ enabled: !!t?.encounterUuid && T
70
70
  });
71
- Te(
71
+ he(
72
72
  (e) => {
73
- e.patientUUID === m && (Y(), P.invalidateQueries({ queryKey: ["formsEncounterFHIR"] }));
73
+ e.patientUUID === m && (J(), P.invalidateQueries({ queryKey: ["formsEncounterFHIR"] }));
74
74
  },
75
75
  [m]
76
76
  );
77
- const ee = i(() => !O?.entry || !t?.formName ? [] : O.entry.filter((e) => e.resource?.resourceType === "Observation").map((e) => e.resource).filter((e) => he(e) ? Ne(e)?.toLowerCase() === t.formName.toLowerCase() : !0), [O, t?.formName]), re = i(() => {
78
- if (b)
79
- return ge(b).message;
80
- }, [b]), c = i(
77
+ const ee = i(() => !I?.entry || !t?.formName ? [] : I.entry.filter((e) => e.resource?.resourceType === "Observation").map((e) => e.resource).filter((e) => Ne(e) ? ge(e)?.toLowerCase() === t.formName.toLowerCase() : !0), [I, t?.formName]), re = i(() => {
78
+ if (O)
79
+ return Te(O).message;
80
+ }, [O]), c = i(
81
81
  () => [
82
82
  { key: "recordedOn", header: o("RECORDED_ON") },
83
83
  { key: "recordedBy", header: o("RECORDED_BY") }
84
84
  ],
85
85
  [o]
86
- ), M = i(
86
+ ), S = i(
87
87
  () => [...c, { key: "actions", header: o("ACTIONS") }],
88
88
  [c, o]
89
89
  ), ae = d(
90
- (e) => p && e.some((r) => u(r)) ? M : c,
91
- [p, u, M, c]
90
+ (e) => p && e.some((r) => u(r)) ? S : c,
91
+ [p, u, S, c]
92
92
  ), oe = c, te = i(
93
93
  () => [
94
94
  { key: "recordedOn", sortable: !0 },
95
95
  { key: "recordedBy", sortable: !0 }
96
96
  ],
97
97
  []
98
- ), U = i(() => {
99
- const e = D.reduce(
98
+ ), M = i(() => {
99
+ const e = B.reduce(
100
100
  (r, a) => {
101
101
  const s = a.formName;
102
102
  r[s] ??= [];
@@ -120,13 +120,13 @@ const Re = "FormsTable-module_formsTableBody__SvGha", Ce = "FormsTable-module_mo
120
120
  )
121
121
  })
122
122
  ).sort((r, a) => r.formName.localeCompare(a.formName));
123
- }, [D, o]), k = d((e) => {
124
- L(e), A(!0);
123
+ }, [B, o]), k = d((e) => {
124
+ R(e), _(!0);
125
125
  }, []), w = d(() => {
126
- A(!1), L(null);
127
- }, []), I = d((e) => {
126
+ _(!1), R(null);
127
+ }, []), b = d((e) => {
128
128
  globalThis.dispatchEvent(
129
- new CustomEvent(Be, {
129
+ new CustomEvent(Ue, {
130
130
  detail: {
131
131
  editOnly: "observationForms",
132
132
  editTitle: "EDIT_OBSERVATION_FORM_TITLE",
@@ -140,7 +140,7 @@ const Re = "FormsTable-module_formsTableBody__SvGha", Ce = "FormsTable-module_mo
140
140
  (e, r) => {
141
141
  switch (r) {
142
142
  case "recordedOn":
143
- return /* @__PURE__ */ n(Oe, { onClick: () => k(e), children: e.recordedOn });
143
+ return /* @__PURE__ */ n(Ie, { onClick: () => k(e), children: e.recordedOn });
144
144
  case "recordedBy":
145
145
  return e.recordedBy;
146
146
  case "actions":
@@ -151,41 +151,41 @@ const Re = "FormsTable-module_formsTableBody__SvGha", Ce = "FormsTable-module_mo
151
151
  kind: "ghost",
152
152
  size: "sm",
153
153
  testId: `edit-form-${e.encounterUuid}`,
154
- onClick: () => I(e),
155
- children: /* @__PURE__ */ n($, {})
154
+ onClick: () => b(e),
155
+ children: /* @__PURE__ */ n(z, {})
156
156
  }
157
157
  ) : null;
158
158
  default:
159
159
  return null;
160
160
  }
161
161
  },
162
- [k, I, u, o]
162
+ [k, b, u, o]
163
163
  );
164
164
  return /* @__PURE__ */ q(ne, { children: [
165
- /* @__PURE__ */ n("div", { id: "forms-table", "data-testid": "forms-table", children: v || B || U.length === 0 || R ? /* @__PURE__ */ n(
166
- x,
165
+ /* @__PURE__ */ n("div", { id: "forms-table", "data-testid": "forms-table", children: L || U || M.length === 0 || C ? /* @__PURE__ */ n(
166
+ K,
167
167
  {
168
168
  headers: oe,
169
169
  ariaLabel: o("FORMS_HEADING"),
170
170
  rows: [],
171
- loading: v,
172
- errorStateMessage: B ? W?.message : void 0,
171
+ loading: L,
172
+ errorStateMessage: U ? W?.message : void 0,
173
173
  emptyStateMessage: o("FORMS_UNAVAILABLE"),
174
174
  renderCell: H,
175
- className: N.formsTableBody,
175
+ className: g.formsTableBody,
176
176
  dataTestId: "forms-table"
177
177
  }
178
- ) : /* @__PURE__ */ n(be, { align: "start", children: U.map((e, r) => {
178
+ ) : /* @__PURE__ */ n(Oe, { align: "start", children: M.map((e, r) => {
179
179
  const { formName: a, records: s } = e, f = ae(s);
180
180
  return /* @__PURE__ */ n(
181
- Ie,
181
+ be,
182
182
  {
183
183
  title: a,
184
- className: N.customAccordianItem,
184
+ className: g.customAccordianItem,
185
185
  testId: `accordian-title-${a}`,
186
186
  open: r === 0,
187
187
  children: /* @__PURE__ */ n(
188
- x,
188
+ K,
189
189
  {
190
190
  headers: f,
191
191
  ariaLabel: o("FORMS_HEADING"),
@@ -195,7 +195,7 @@ const Re = "FormsTable-module_formsTableBody__SvGha", Ce = "FormsTable-module_mo
195
195
  sortable: te,
196
196
  emptyStateMessage: o("FORMS_UNAVAILABLE"),
197
197
  renderCell: H,
198
- className: N.formsTableBody,
198
+ className: g.formsTableBody,
199
199
  dataTestId: `forms-table-${a}`
200
200
  }
201
201
  )
@@ -203,14 +203,14 @@ const Re = "FormsTable-module_formsTableBody__SvGha", Ce = "FormsTable-module_mo
203
203
  a
204
204
  );
205
205
  }) }) }),
206
- g && t && /* @__PURE__ */ n(
207
- Ee,
206
+ T && t && /* @__PURE__ */ n(
207
+ Ae,
208
208
  {
209
209
  id: "modalIdForActionAreaLayout",
210
210
  portalId: "main-display-area",
211
- open: g,
211
+ open: T,
212
212
  onRequestClose: w,
213
- modalHeading: /* @__PURE__ */ q("div", { className: N.modalHeading, children: [
213
+ modalHeading: /* @__PURE__ */ q("div", { className: g.modalHeading, children: [
214
214
  /* @__PURE__ */ n("span", { children: t.formName }),
215
215
  p && u(t) && /* @__PURE__ */ n(
216
216
  V,
@@ -220,9 +220,9 @@ const Re = "FormsTable-module_formsTableBody__SvGha", Ce = "FormsTable-module_mo
220
220
  size: "sm",
221
221
  testId: `edit-form-modal-${t.encounterUuid}`,
222
222
  onClick: () => {
223
- w(), I(t);
223
+ w(), b(t);
224
224
  },
225
- children: /* @__PURE__ */ n($, {})
225
+ children: /* @__PURE__ */ n(z, {})
226
226
  }
227
227
  )
228
228
  ] }),
@@ -231,7 +231,7 @@ const Re = "FormsTable-module_formsTableBody__SvGha", Ce = "FormsTable-module_mo
231
231
  size: "md",
232
232
  testId: "form-details-modal",
233
233
  children: /* @__PURE__ */ n(
234
- _e,
234
+ Ee,
235
235
  {
236
236
  observations: ee,
237
237
  isLoading: X,
@@ -239,7 +239,7 @@ const Re = "FormsTable-module_formsTableBody__SvGha", Ce = "FormsTable-module_mo
239
239
  errorMessage: re,
240
240
  emptyStateMessage: o("NO_FORM_DATA_AVAILABLE"),
241
241
  testIdPrefix: t.formName,
242
- hideThumbnail: G,
242
+ hideThumbnail: Q,
243
243
  formName: t.formName
244
244
  }
245
245
  )
@@ -248,5 +248,5 @@ const Re = "FormsTable-module_formsTableBody__SvGha", Ce = "FormsTable-module_mo
248
248
  ] });
249
249
  };
250
250
  export {
251
- Ue as default
251
+ Me as default
252
252
  };
@@ -1,5 +1,5 @@
1
- import { c, T as l, P as m, a as u, D as v, Q as i } from "./YPM2AS64-7x86dV9L.js";
2
- import { a9 as d, aa as f, ab as e } from "./index-DI87tGQ1.js";
1
+ import { c, T as l, P as m, a as u, D as v, Q as i } from "./YPM2AS64-DrF_cHRZ.js";
2
+ import { a9 as d, aa as f, ab as e } from "./index-ClETYuc0.js";
3
3
  var p = (a) => {
4
4
  const [r, t] = c({
5
5
  prefix: "TanstackQueryDevtools"