@bahmni/appointments-app 0.0.1-dev.351 → 0.0.1-dev.352

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,12 +1,12 @@
1
- import { jsxs as S, jsx as u } from "react/jsx-runtime";
2
- import { m as V, o as Q, u as N, j as k, U as G, G as j, k as w, p as M, r as P, D as x, Q as H, t as z, A as L, s as J, v as Y, w as W, B as X, F as Z, P as ee } from "./index-CVN7C8id.js";
3
- import { useQueries as te, useQuery as ae } from "@tanstack/react-query";
4
- import { useRef as se, useEffect as $, useMemo as R } from "react";
5
- const D = (t, n, d, l, b, r) => {
6
- const a = J(t, n, b), s = a.value, o = Y(s);
1
+ import { jsxs as N, jsx as u } from "react/jsx-runtime";
2
+ import { m as V, a as q, u as S, j as k, v as z, b as M, z as Q, T as j, O as w, F as x, e as H, N as J, X as D, C as P, p as X, k as Y, n as W, l as Z, q as ee } from "./index-CNK4mjp4.js";
3
+ import { useQueries as ae, useQuery as te } from "@tanstack/react-query";
4
+ import { useRef as se, useEffect as $, useMemo as E } from "react";
5
+ const F = (a, n, d, l, b, r) => {
6
+ const t = P(a, n, b), s = t.value, o = X(s);
7
7
  let i = s;
8
8
  o === "Image" && (i = /* @__PURE__ */ u(
9
- X,
9
+ W,
10
10
  {
11
11
  imageSrc: s,
12
12
  alt: s,
@@ -22,54 +22,54 @@ const D = (t, n, d, l, b, r) => {
22
22
  }
23
23
  )), o === "PDF" && (i = /* @__PURE__ */ u(ee, { id: `${s}-pdf`, src: s }));
24
24
  const m = b("OBSERVATIONS_RECORDED_BY", {
25
- provider: a.provider
26
- }), p = t.display, v = t.observationValue?.isAbnormal ? "abnormal-obs" : "obs", c = l ? `${l}-${v}-${p}-${d}-${n}` : `${v}-${p}-${d}-${n}`;
25
+ provider: t.provider
26
+ }), p = a.display, v = a.observationValue?.isAbnormal ? "abnormal-obs" : "obs", c = l ? `${l}-${v}-${p}-${d}-${n}` : `${v}-${p}-${d}-${n}`;
27
27
  return /* @__PURE__ */ u(
28
- W,
28
+ Y,
29
29
  {
30
- header: a.header,
30
+ header: t.header,
31
31
  value: i,
32
32
  info: m,
33
33
  id: c,
34
34
  testId: c,
35
35
  ariaLabel: c
36
36
  },
37
- `obs-${t.id}`
37
+ `obs-${a.id}`
38
38
  );
39
- }, re = (t, n, d, l, b, r, a) => /* @__PURE__ */ u(
40
- L,
39
+ }, re = (a, n, d, l, b, r, t) => /* @__PURE__ */ u(
40
+ D,
41
41
  {
42
- title: t.display,
43
- id: `grouped-obs-${t.display}-${l}`,
42
+ title: a.display,
43
+ id: `grouped-obs-${a.display}-${l}`,
44
44
  open: d,
45
- children: t.members?.map(
46
- (s, o) => D(
45
+ children: a.members?.map(
46
+ (s, o) => F(
47
47
  s,
48
48
  o,
49
49
  b,
50
50
  r,
51
51
  n,
52
- a
52
+ t
53
53
  )
54
54
  )
55
55
  },
56
- `grouped-obs-${t.id}`
56
+ `grouped-obs-${a.id}`
57
57
  ), oe = ({
58
- groupedData: t,
58
+ groupedData: a,
59
59
  title: n = "",
60
60
  hideThumbnail: d
61
61
  }) => {
62
- const { t: l } = N(), b = (r, a, s) => {
63
- const o = z(r.encounterDetails, l);
64
- return /* @__PURE__ */ S(
65
- L,
62
+ const { t: l } = S(), b = (r, t, s) => {
63
+ const o = J(r.encounterDetails, l);
64
+ return /* @__PURE__ */ N(
65
+ D,
66
66
  {
67
67
  title: o,
68
68
  id: `encounter-${r.encounterId}`,
69
- open: a,
69
+ open: t,
70
70
  children: [
71
71
  r.observations.map(
72
- (i, m) => D(
72
+ (i, m) => F(
73
73
  i,
74
74
  m,
75
75
  s,
@@ -82,7 +82,7 @@ const D = (t, n, d, l, b, r) => {
82
82
  (i, m) => re(
83
83
  i,
84
84
  l,
85
- a,
85
+ t,
86
86
  m,
87
87
  s,
88
88
  n,
@@ -100,20 +100,20 @@ const D = (t, n, d, l, b, r) => {
100
100
  id: "obs-by-encounter",
101
101
  "data-testid": "obs-by-encounter-test-id",
102
102
  "aria-label": "obs-by-encounter-aria-label",
103
- children: t.map(
104
- (r, a) => b(r, a === 0, a)
103
+ children: a.map(
104
+ (r, t) => b(r, t === 0, t)
105
105
  )
106
106
  }
107
107
  );
108
108
  }, ie = "Observations-module_observations__RKSyo", ne = "Observations-module_title__TJL3z", I = {
109
109
  observations: ie,
110
110
  title: ne
111
- }, de = (t) => ["conceptUuid", t], le = (t, n) => ["observations", t, ...n], pe = ({ config: t }) => {
112
- const n = t, {
111
+ }, de = (a) => ["conceptUuid", a], le = (a, n) => ["observations", a, ...n], pe = ({ config: a }) => {
112
+ const n = a, {
113
113
  conceptNames: d = [],
114
114
  conceptUuid: l = [],
115
115
  hideThumbnail: b = !1
116
- } = n, r = se(/* @__PURE__ */ new Set()), a = V(), { addNotification: s } = Q(), { t: o } = N(), i = te({
116
+ } = n, r = se(/* @__PURE__ */ new Set()), t = V(), { addNotification: s } = q(), { t: o } = S(), i = ae({
117
117
  queries: d.map((e) => ({
118
118
  queryKey: de(e),
119
119
  queryFn: () => k(e),
@@ -123,53 +123,53 @@ const D = (t, n, d, l, b, r) => {
123
123
  $(() => {
124
124
  i.forEach((e, h) => {
125
125
  if (e.isError && !r.current.has(h)) {
126
- const C = d[h];
126
+ const B = d[h];
127
127
  s({
128
128
  title: o("ERROR_DEFAULT_TITLE"),
129
- message: o("ERROR_FETCHING_CONCEPT", { conceptName: C }),
129
+ message: o("ERROR_FETCHING_CONCEPT", { conceptName: B }),
130
130
  type: "error"
131
131
  }), r.current.add(h);
132
132
  } else e.isError || r.current.delete(h);
133
133
  });
134
134
  }, [i, d]);
135
- const m = R(() => i.map((e) => e.data?.uuid).filter((e) => !!e), [i]), p = R(() => [.../* @__PURE__ */ new Set([...m, ...l])], [m, l]), v = R(() => d.length === 0 ? !0 : i.every((e) => !e.isLoading), [i, d.length]), {
135
+ const m = E(() => i.map((e) => e.data?.uuid).filter((e) => !!e), [i]), p = E(() => [.../* @__PURE__ */ new Set([...m, ...l])], [m, l]), v = E(() => d.length === 0 ? !0 : i.every((e) => !e.isLoading), [i, d.length]), {
136
136
  data: c,
137
- isLoading: F,
138
- isError: T,
139
- refetch: O
140
- } = ae({
141
- queryKey: le(a, p),
142
- queryFn: () => G(a, p),
143
- enabled: !!a && p.length > 0 && v
137
+ isLoading: C,
138
+ isError: O,
139
+ refetch: R
140
+ } = te({
141
+ queryKey: le(t, p),
142
+ queryFn: () => z(t, p),
143
+ enabled: !!t && p.length > 0 && v
144
144
  });
145
- j(
145
+ M(
146
146
  (e) => {
147
- e.patientUUID === a && e.updatedConcepts.size > 0 && [...e.updatedConcepts.keys()].some(
147
+ e.patientUUID === t && e.updatedConcepts.size > 0 && [...e.updatedConcepts.keys()].some(
148
148
  (h) => p.includes(h)
149
- ) && O();
149
+ ) && R();
150
150
  },
151
- [a, O]
151
+ [t, R]
152
152
  ), $(() => {
153
- T && s({
153
+ O && s({
154
154
  title: o("ERROR_DEFAULT_TITLE"),
155
155
  message: o("ERROR_FETCHING_OBSERVATIONS"),
156
156
  type: "error"
157
157
  });
158
- }, [T]);
159
- const f = R(() => {
158
+ }, [O]);
159
+ const g = E(() => {
160
160
  if (!c) return [];
161
- const e = w(c), h = M(e);
162
- return P(h);
163
- }, [c]), K = [
161
+ const e = Q(c), h = j(e);
162
+ return w(h);
163
+ }, [c]), G = [
164
164
  { key: "name", header: "name" },
165
165
  { key: "value", header: "value" },
166
166
  { key: "form", header: "form" }
167
- ], g = F || !v, _ = T && v, A = (!c || c.entry?.length === 0 || p.length === 0) && v, U = _ ? o("ERROR_FETCHING_OBSERVATIONS") : null, B = A ? o("NO_OBSERVATIONS_FOUND") : void 0, q = f.length > 0 && !g && !_, E = n.titleTranslationKey, y = E ? o(E) : "";
168
- return /* @__PURE__ */ S(
167
+ ], f = C || !v, _ = O && v, L = (!c || c.entry?.length === 0 || p.length === 0) && v, A = _ ? o("ERROR_FETCHING_OBSERVATIONS") : null, K = L ? o("NO_OBSERVATIONS_FOUND") : void 0, U = g.length > 0 && !f && !_, T = n.titleTranslationKey, y = T ? o(T) : "";
168
+ return /* @__PURE__ */ N(
169
169
  "div",
170
170
  {
171
171
  id: "observations",
172
- "data-testid": E ? `observations-${y}` : "observations",
172
+ "data-testid": T ? `observations-${y}` : "observations",
173
173
  "aria-label": "observations-aria-label",
174
174
  className: I.observations,
175
175
  children: [
@@ -177,28 +177,28 @@ const D = (t, n, d, l, b, r) => {
177
177
  x,
178
178
  {
179
179
  id: "observations-title",
180
- testId: E ? `observations-title-${y}` : "observations-title",
180
+ testId: T ? `observations-title-${y}` : "observations-title",
181
181
  title: y,
182
182
  className: I.title,
183
183
  children: /* @__PURE__ */ u("p", { children: y })
184
184
  }
185
185
  ),
186
- q ? /* @__PURE__ */ u(
186
+ U ? /* @__PURE__ */ u(
187
187
  oe,
188
188
  {
189
- groupedData: f,
189
+ groupedData: g,
190
190
  title: y,
191
191
  hideThumbnail: b
192
192
  }
193
193
  ) : /* @__PURE__ */ u(
194
194
  H,
195
195
  {
196
- headers: K,
196
+ headers: G,
197
197
  rows: [],
198
198
  ariaLabel: o("OBSERVATIONS"),
199
- loading: g,
200
- errorStateMessage: U,
201
- emptyStateMessage: B,
199
+ loading: f,
200
+ errorStateMessage: A,
201
+ emptyStateMessage: K,
202
202
  dataTestId: "observations-table"
203
203
  }
204
204
  )
@@ -1,4 +1,4 @@
1
- import { aq as we, ar as z, as as xt, at as B, ao as q, ap as y, au as Ro, av as ye, aw as R, ax as _, ay as k, az as N, aA as A, aB as bs, aC as ir, aD as $e, aE as U, aF as Hn, aG as Vn, aH as dt, aI as D, aJ as xs, aK as cn, aL as Be, aM as ws, aN as qt, aO as zt, aP as $s, aQ as Cs, aR as $n, aS as Ss, aT as Nr, aU as Bt, aV as zo, aW as ks, aX as Es, aY as j, aZ as Ur, a_ as Ms, a$ as Ds, b0 as sr, b1 as As, b2 as Ts, b3 as zn, b4 as Fs, b5 as Is, b6 as Z, b7 as Ps, b8 as Ls } from "./index-CVN7C8id.js";
1
+ import { aq as we, ar as z, as as xt, at as B, ao as q, ap as y, au as Ro, av as ye, aw as R, ax as _, ay as k, az as N, aA as A, aB as bs, aC as ir, aD as $e, aE as U, aF as Hn, aG as Vn, aH as dt, aI as D, aJ as xs, aK as cn, aL as Be, aM as ws, aN as qt, aO as zt, aP as $s, aQ as Cs, aR as $n, aS as Ss, aT as Nr, aU as Bt, aV as zo, aW as ks, aX as Es, aY as j, aZ as Ur, a_ as Ms, a$ as Ds, b0 as sr, b1 as As, b2 as Ts, b3 as zn, b4 as Fs, b5 as Is, b6 as Z, b7 as Ps, b8 as Ls } from "./index-CNK4mjp4.js";
2
2
  var Os = (e) => e != null, qs = (e) => e.filter(Os);
3
3
  function _s(e) {
4
4
  return (...t) => {
@@ -1,19 +1,19 @@
1
- import { jsx as a, jsxs as y } from "react/jsx-runtime";
2
- import { x as V, z as O, u as C, C as P, I as h, o as B, H as x, J as L, T as G, L as H, M as U, N as q, S as F, V as j, Y as k, Z as K, _ as Q } from "./index-CVN7C8id.js";
1
+ import { jsx as i, jsxs as y } from "react/jsx-runtime";
2
+ import { s as V, t as O, u as C, B as P, D as h, a as B, x as G, G as L, I as x, K as U, L as q, M as F, Q as H, R as K, P as Q, U as j, S as k } from "./index-CNK4mjp4.js";
3
3
  import { useState as I, useMemo as _ } from "react";
4
- import { useQueryClient as $, useQuery as z } from "@tanstack/react-query";
5
- const W = V(
4
+ import { useQueryClient as $, useQuery as W } from "@tanstack/react-query";
5
+ const Z = V(
6
6
  O,
7
7
  "useAppointmentsConfig",
8
8
  "AppointmentsConfigProvider"
9
- ), Y = ({
9
+ ), w = ({
10
10
  serviceName: e,
11
- isDeleting: i,
11
+ isDeleting: a,
12
12
  onConfirm: t,
13
13
  onCancel: s
14
14
  }) => {
15
15
  const { t: n } = C();
16
- return /* @__PURE__ */ a(
16
+ return /* @__PURE__ */ i(
17
17
  P,
18
18
  {
19
19
  id: "delete-service-modal",
@@ -25,7 +25,7 @@ const W = V(
25
25
  onRequestSubmit: t,
26
26
  primaryButtonText: n("ADMIN_ALL_SERVICES_DELETE_BUTTON_LABEL"),
27
27
  secondaryButtonText: n("ADMIN_ALL_SERVICES_DELETE_CANCEL"),
28
- primaryButtonDisabled: i,
28
+ primaryButtonDisabled: a,
29
29
  modalHeading: n("ADMIN_ALL_SERVICES_DELETE_MODAL_TITLE"),
30
30
  children: n("ADMIN_ALL_SERVICES_DELETE_CONFIRM_BODY", { serviceName: e })
31
31
  }
@@ -36,29 +36,29 @@ const W = V(
36
36
  "speciality",
37
37
  "durationMins",
38
38
  "description"
39
- ], Z = "app:appointments:manageServices", w = "app:appointments:adminTab", J = "index-module_page__Gsfbu", X = "index-module_noPrivilegeContainer__Pu5WZ", ee = "index-module_table__GAPmb", d = {
39
+ ], z = "app:appointments:manageServices", Y = "app:appointments:adminTab", J = "index-module_page__Gsfbu", X = "index-module_noPrivilegeContainer__Pu5WZ", ee = "index-module_table__GAPmb", d = {
40
40
  page: J,
41
41
  noPrivilegeContainer: X,
42
42
  table: ee
43
43
  };
44
44
  function te(e) {
45
- return e.filter((i) => !u.includes(i));
45
+ return e.filter((a) => !u.includes(a));
46
46
  }
47
- function ie(e, i) {
47
+ function ae(e, a) {
48
48
  return [
49
49
  ...e.map((t) => ({
50
50
  key: t,
51
- header: i(
51
+ header: a(
52
52
  `ADMIN_ALL_SERVICES_COLUMN_${h(t)}`
53
53
  )
54
54
  })),
55
55
  {
56
56
  key: "actions",
57
- header: i("ADMIN_ALL_SERVICES_COLUMN_ACTIONS")
57
+ header: a("ADMIN_ALL_SERVICES_COLUMN_ACTIONS")
58
58
  }
59
59
  ];
60
60
  }
61
- function ae(e, i) {
61
+ function ie(e, a) {
62
62
  return e.map((t) => ({
63
63
  id: t.uuid,
64
64
  name: t.name,
@@ -67,7 +67,7 @@ function ae(e, i) {
67
67
  durationMins: t.durationMins,
68
68
  description: t.description,
69
69
  attributes: Object.fromEntries(
70
- i.map((s) => [
70
+ a.map((s) => [
71
71
  s,
72
72
  t.attributes?.find((n) => n.attributeType === s)?.value ?? null
73
73
  ])
@@ -75,33 +75,33 @@ function ae(e, i) {
75
75
  }));
76
76
  }
77
77
  const oe = () => {
78
- const { t: e } = C(), i = $(), { addNotification: t } = B(), { userPrivileges: s } = x(), { appointmentsConfig: n } = W(), [E, c] = I(null), [M, p] = I(!1), l = n?.serviceTableFields ?? [
78
+ const { t: e } = C(), a = $(), { addNotification: t } = B(), { userPrivileges: s } = G(), { appointmentsConfig: n } = Z(), [E, c] = I(null), [M, p] = I(!1), l = n?.serviceTableFields ?? [
79
79
  ...u
80
- ], S = L(s, w), b = L(
80
+ ], S = L(s, Y), b = L(
81
81
  s,
82
- Z
82
+ z
83
83
  ), m = _(
84
84
  () => te(l),
85
85
  [l]
86
- ), { data: A, isLoading: v, isError: D } = z({
86
+ ), { data: A, isLoading: R, isError: v } = W({
87
87
  queryKey: ["allAppointmentServices"],
88
- queryFn: G,
88
+ queryFn: x,
89
89
  enabled: S
90
- }), N = _(
91
- () => ie(l, e),
90
+ }), D = _(
91
+ () => ae(l, e),
92
92
  [l]
93
- ), R = _(
94
- () => ae(A ?? [], m),
93
+ ), N = _(
94
+ () => ie(A ?? [], m),
95
95
  [A, m]
96
96
  ), g = async () => {
97
97
  p(!0);
98
98
  try {
99
- await Q(E.id), t({
99
+ await k(E.id), t({
100
100
  title: e("ADMIN_ALL_SERVICES_DELETE_SUCCESS_TITLE"),
101
101
  message: e("ADMIN_ALL_SERVICES_DELETE_SUCCESS_MESSAGE"),
102
102
  type: "success",
103
103
  timeout: 5e3
104
- }), c(null), i.invalidateQueries({ queryKey: ["allAppointmentServices"] });
104
+ }), c(null), a.invalidateQueries({ queryKey: ["allAppointmentServices"] });
105
105
  } catch {
106
106
  t({
107
107
  title: e("ADMIN_ALL_SERVICES_DELETE_ERROR_TITLE"),
@@ -111,8 +111,8 @@ const oe = () => {
111
111
  } finally {
112
112
  p(!1);
113
113
  }
114
- }, T = (r, o) => o === "actions" ? /* @__PURE__ */ a(
115
- k,
114
+ }, T = (r, o) => o === "actions" ? /* @__PURE__ */ i(
115
+ Q,
116
116
  {
117
117
  id: `delete-service-${r.id}-btn`,
118
118
  testId: `delete-service-${r.id}-btn-test-id`,
@@ -121,16 +121,16 @@ const oe = () => {
121
121
  label: e("ADMIN_ALL_SERVICES_DELETE_ICON_LABEL"),
122
122
  disabled: !b,
123
123
  onClick: () => c(r),
124
- children: /* @__PURE__ */ a(K, {})
124
+ children: /* @__PURE__ */ i(j, {})
125
125
  }
126
126
  ) : u.includes(o) ? r[o] ?? "-" : r.attributes[o] ?? "-", f = [
127
- { id: "home", label: e("BREADCRUMB_HOME"), href: H },
127
+ { id: "home", label: e("BREADCRUMB_HOME"), href: U },
128
128
  { id: "admin", label: e("BREADCRUMB_ADMIN"), isCurrentPage: !0 }
129
129
  ];
130
- return /* @__PURE__ */ a(
131
- U,
130
+ return /* @__PURE__ */ i(
131
+ q,
132
132
  {
133
- header: /* @__PURE__ */ a(F, { breadcrumbItems: f, userMenu: /* @__PURE__ */ a(j, {}) }),
133
+ header: /* @__PURE__ */ i(H, { breadcrumbItems: f, userMenu: /* @__PURE__ */ i(K, {}) }),
134
134
  main: S ? /* @__PURE__ */ y(
135
135
  "div",
136
136
  {
@@ -139,23 +139,23 @@ const oe = () => {
139
139
  "aria-label": "all-appointment-service-page-aria-label",
140
140
  className: d.page,
141
141
  children: [
142
- /* @__PURE__ */ a(
143
- q,
142
+ /* @__PURE__ */ i(
143
+ F,
144
144
  {
145
145
  id: "all-services",
146
146
  title: e("ADMIN_ALL_SERVICES_TITLE"),
147
- headers: N,
148
- rows: R,
147
+ headers: D,
148
+ rows: N,
149
149
  ariaLabel: "all-services-table",
150
- loading: v,
151
- errorStateMessage: D ? e("ADMIN_ALL_SERVICES_ERROR_MESSAGE") : null,
150
+ loading: R,
151
+ errorStateMessage: v ? e("ADMIN_ALL_SERVICES_ERROR_MESSAGE") : null,
152
152
  emptyStateMessage: e("ADMIN_ALL_SERVICES_EMPTY_MESSAGE"),
153
153
  renderCell: T,
154
154
  className: d.table
155
155
  }
156
156
  ),
157
- E && /* @__PURE__ */ a(
158
- Y,
157
+ E && /* @__PURE__ */ i(
158
+ w,
159
159
  {
160
160
  serviceName: E.name,
161
161
  isDeleting: M,
@@ -165,7 +165,7 @@ const oe = () => {
165
165
  )
166
166
  ]
167
167
  }
168
- ) : /* @__PURE__ */ a(
168
+ ) : /* @__PURE__ */ i(
169
169
  "div",
170
170
  {
171
171
  id: "all-appointment-service-no-view-privilege",