@bahmni/appointments-app 0.0.1-dev.278 → 0.0.1-dev.281

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