@bahmni/appointments-app 0.0.1-dev.409 → 0.0.1-dev.410

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 { jsx as i, jsxs as y } from "react/jsx-runtime";
2
- import { H as V, I as O, u as C, J as P, K as h, z as B, a as x, N as L, O as G, _ as U, R as q, T as F, U as H, W as $, Z as k, $ as K, a0 as W } from "./index-DqgfD6Rf.js";
2
+ import { K as V, L as O, u as C, M as P, O as h, z as B, e as x, Q as L, R as G, T as U, U as q, W as F, X as $, Z as k, $ as z, a0 as H, a1 as K } from "./index-ClUHCl2k.js";
3
3
  import { useState as I, useMemo as c } from "react";
4
- import { useQueryClient as j, useQuery as w } from "@tanstack/react-query";
5
- const z = V(
4
+ import { useQueryClient as Q, useQuery as W } from "@tanstack/react-query";
5
+ const j = V(
6
6
  O,
7
7
  "useAppointmentsConfig",
8
8
  "AppointmentsConfigProvider"
9
- ), Q = ({
9
+ ), w = ({
10
10
  serviceName: e,
11
11
  isDeleting: a,
12
12
  onConfirm: t,
@@ -36,9 +36,9 @@ const z = V(
36
36
  "speciality",
37
37
  "durationMins",
38
38
  "description"
39
- ], Y = "app:appointments:manageServices", Z = "app:appointments:adminTab", J = "index-module_page__Gsfbu", X = "index-module_noPrivilegeContainer__Pu5WZ", ee = "index-module_table__GAPmb", d = {
40
- page: J,
41
- noPrivilegeContainer: X,
39
+ ], Y = "app:appointments:manageServices", Z = "app:appointments:adminTab", X = "index-module_page__Gsfbu", J = "index-module_noPrivilegeContainer__Pu5WZ", ee = "index-module_table__GAPmb", d = {
40
+ page: X,
41
+ noPrivilegeContainer: J,
42
42
  table: ee
43
43
  };
44
44
  function te(e) {
@@ -75,7 +75,7 @@ function ie(e, a) {
75
75
  }));
76
76
  }
77
77
  const oe = () => {
78
- const { t: e } = C(), a = j(), { addNotification: t } = B(), { userPrivileges: s } = x(), { appointmentsConfig: n } = z(), [E, _] = I(null), [b, p] = I(!1), l = n?.serviceTableFields ?? [
78
+ const { t: e } = C(), a = Q(), { addNotification: t } = B(), { userPrivileges: s } = x(), { appointmentsConfig: n } = j(), [E, _] = I(null), [b, p] = I(!1), l = n?.serviceTableFields ?? [
79
79
  ...u
80
80
  ], m = L(s, Z), M = L(
81
81
  s,
@@ -83,7 +83,7 @@ const oe = () => {
83
83
  ), S = c(
84
84
  () => te(l),
85
85
  [l]
86
- ), { data: A, isLoading: v, isError: R } = w({
86
+ ), { data: A, isLoading: v, isError: R } = W({
87
87
  queryKey: ["allAppointmentServices"],
88
88
  queryFn: G,
89
89
  enabled: m
@@ -96,7 +96,7 @@ const oe = () => {
96
96
  ), g = async () => {
97
97
  p(!0);
98
98
  try {
99
- await W(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",
@@ -112,7 +112,7 @@ const oe = () => {
112
112
  p(!1);
113
113
  }
114
114
  }, T = (r, o) => o === "actions" ? /* @__PURE__ */ i(
115
- k,
115
+ z,
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 oe = () => {
121
121
  label: e("ADMIN_ALL_SERVICES_DELETE_ICON_LABEL"),
122
122
  disabled: !M,
123
123
  onClick: () => _(r),
124
- children: /* @__PURE__ */ i(K, {})
124
+ children: /* @__PURE__ */ i(H, {})
125
125
  }
126
126
  ) : u.includes(o) ? r[o] ?? "-" : r.attributes[o] ?? "-", f = [
127
127
  { id: "home", label: e("BREADCRUMB_HOME"), href: U },
@@ -130,7 +130,7 @@ const oe = () => {
130
130
  return /* @__PURE__ */ i(
131
131
  q,
132
132
  {
133
- header: /* @__PURE__ */ i(H, { breadcrumbItems: f, userMenu: /* @__PURE__ */ i($, {}) }),
133
+ header: /* @__PURE__ */ i($, { breadcrumbItems: f, userMenu: /* @__PURE__ */ i(k, {}) }),
134
134
  main: m ? /* @__PURE__ */ y(
135
135
  "div",
136
136
  {
@@ -155,7 +155,7 @@ const oe = () => {
155
155
  }
156
156
  ),
157
157
  E && /* @__PURE__ */ i(
158
- Q,
158
+ w,
159
159
  {
160
160
  serviceName: E.name,
161
161
  isDeleting: b,
@@ -1,5 +1,5 @@
1
1
  import { jsx as r, jsxs as p } from "react/jsx-runtime";
2
- import { a1 as f, a2 as B, a3 as P, a4 as V, a5 as J, a6 as ee, a7 as te, a8 as ie, O as ae, a9 as ne, u as Q, aa as R, ab as le, ac as re, ad as se, ae as E, af as F, ag as C, ah as Y, ai as x, aj as k, ak as $, a as oe, z as de, N as q, al as ce, _ as me, am as Ae, an as Ie, ao as ue, T as _e, U as Te, W as Le } from "./index-DqgfD6Rf.js";
2
+ import { a2 as f, a3 as O, a4 as P, a5 as V, a6 as J, a7 as ee, a8 as te, a9 as ie, R as ae, aa as ne, u as Q, ab as R, ac as le, ad as re, ae as se, af as E, ag as F, ah as C, ai as Y, aj as x, ak as k, al as $, e as oe, z as de, Q as q, am as ce, T as me, an as Ae, ao as Ie, ap as ue, W as _e, X as Te, Z as Le } from "./index-ClUHCl2k.js";
3
3
  import { useState as g, useMemo as N, useEffect as S, useRef as ve, useCallback as U } from "react";
4
4
  import { useQuery as M, useQueryClient as Ne } from "@tanstack/react-query";
5
5
  const be = "Available for appointments", G = "Get Appointment Unavailability", pe = "Add Appointment Unavailability", w = "Appointment Location", ye = () => {
@@ -47,9 +47,9 @@ const be = "Available for appointments", G = "Get Appointment Unavailability", p
47
47
  }), ge = (e, a) => {
48
48
  const n = {}, t = a("ADMIN_UNAVAILABILITY_FORM_REQUIRED");
49
49
  if (e.locationUuid || (n.location = t), e.startDate || (n.startDate = t), e.startTime || (n.startTime = t), e.endDate || (n.endDate = t), e.endTime || (n.endTime = t), e.startDate && e.startTime && e.endDate && e.endTime && e.startDate.toDateString() === e.endDate.toDateString()) {
50
- const o = B(
50
+ const o = O(
51
51
  `${e.startTime} ${e.startTimePeriod}`
52
- ), c = B(
52
+ ), c = O(
53
53
  `${e.endTime} ${e.endTimePeriod}`
54
54
  );
55
55
  o !== null && c !== null && c <= o && (n.dateTime = a("ADMIN_UNAVAILABILITY_DATETIME_ERROR_MESSAGE"));
@@ -137,9 +137,9 @@ const be = "Available for appointments", G = "Get Appointment Unavailability", p
137
137
  isLoading: a || o || L || s,
138
138
  isError: n || c || m || _
139
139
  };
140
- }, Oe = "UnavailabilityForm-module_formContent__WmNHR", Be = "UnavailabilityForm-module_formField__8he7o", Pe = "UnavailabilityForm-module_loading__IDEY6", Ve = "UnavailabilityForm-module_error__jDeOm", Fe = "UnavailabilityForm-module_grid__t6NKR", Ce = "UnavailabilityForm-module_column__QFdnQ", Ye = "UnavailabilityForm-module_dateTimeColumn__6bi0F", xe = "UnavailabilityForm-module_datePicker__6HgbO", ke = "UnavailabilityForm-module_timePicker__DHNpK", d = {
141
- formContent: Oe,
142
- formField: Be,
140
+ }, Be = "UnavailabilityForm-module_formContent__WmNHR", Oe = "UnavailabilityForm-module_formField__8he7o", Pe = "UnavailabilityForm-module_loading__IDEY6", Ve = "UnavailabilityForm-module_error__jDeOm", Fe = "UnavailabilityForm-module_grid__t6NKR", Ce = "UnavailabilityForm-module_column__QFdnQ", Ye = "UnavailabilityForm-module_dateTimeColumn__6bi0F", xe = "UnavailabilityForm-module_datePicker__6HgbO", ke = "UnavailabilityForm-module_timePicker__DHNpK", d = {
141
+ formContent: Be,
142
+ formField: Oe,
143
143
  loading: Pe,
144
144
  error: Ve,
145
145
  grid: Fe,
@@ -567,8 +567,8 @@ const be = "Available for appointments", G = "Get Appointment Unavailability", p
567
567
  }, [e, h]), W = U(
568
568
  (T) => {
569
569
  s((X) => {
570
- const O = { ...X };
571
- return T.forEach((Z) => delete O[Z]), O;
570
+ const B = { ...X };
571
+ return T.forEach((Z) => delete B[Z]), B;
572
572
  });
573
573
  },
574
574
  []
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { bb as t } from "./index-DqgfD6Rf.js";
1
+ import { bc as t } from "./index-ClUHCl2k.js";
2
2
  export {
3
3
  t as AppointmentsApp
4
4
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bahmni/appointments-app",
3
- "version": "0.0.1-dev.409",
3
+ "version": "0.0.1-dev.410",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -1,305 +0,0 @@
1
- import { jsx as i, jsxs as x, Fragment as ye } from "react/jsx-runtime";
2
- import { u as ge, v as be, e as Oe, a as Te, b as Ne, r as Ie, m as Ae, t as Ee, c as ve, d as _e, f as Fe, g as Se, S as K, w as Be, A as z, V as G, q as Me, Y as Q, P as Ce, F as Le, p as Ue, h as De, y as Re } from "./index-DqgfD6Rf.js";
3
- import { useQueryClient as ke, useQuery as T } from "@tanstack/react-query";
4
- import { useState as Y, useMemo as d, useCallback as c } from "react";
5
- const qe = "FormsTable-module_formsTableBody__SvGha", we = "FormsTable-module_modalHeading__wnTmA", Ve = "FormsTable-module_customAccordianItem__isszs", N = {
6
- formsTableBody: qe,
7
- modalHeading: we,
8
- customAccordianItem: Ve
9
- }, He = "startConsultation", Ke = ({
10
- episodeOfCareUuids: B,
11
- encounterUuids: m,
12
- config: X,
13
- disableActions: Z = !1,
14
- activeEncounterUuid: p = null
15
- }) => {
16
- const { t: n } = ge(), u = be(), [y, M] = Y(!1), [s, C] = Y(null), {
17
- numberOfVisits: J,
18
- hideThumbnail: W = !1,
19
- forms: g
20
- } = X ?? {}, ee = Oe(
21
- Re.EDIT_OBSERVATIONS
22
- ), { userPrivileges: b } = Te(), I = ee && !Z && !!p, L = Ne(
23
- B,
24
- m
25
- ), re = ke(), {
26
- data: U = [],
27
- isLoading: D,
28
- isError: R,
29
- error: oe,
30
- refetch: ae
31
- } = T({
32
- queryKey: ["forms", u, B],
33
- queryFn: () => Ie(u, void 0, J),
34
- enabled: !!u && !L
35
- }), k = d(() => {
36
- let e = U;
37
- return m && m.length > 0 && (e = e.filter(
38
- (r) => m.includes(r.encounterUuid)
39
- )), Array.isArray(g) && g.length > 0 && (e = e.filter(
40
- (r) => g.some((o) => o.toLowerCase() === r.formName.toLowerCase())
41
- )), e;
42
- }, [U, m, g]), { data: O = [] } = T({
43
- queryKey: ["observationForms"],
44
- queryFn: () => Ae()
45
- }), q = c(
46
- (e) => {
47
- const r = O.find((t) => t.name === e);
48
- if (!r?.privileges || r.privileges.length === 0) return !0;
49
- if (!b || b.length === 0) return !1;
50
- const o = new Set(b.map((t) => t.name));
51
- return r.privileges.some(
52
- (t) => o.has(t.privilegeName) && t.editable
53
- );
54
- },
55
- [O, b]
56
- ), f = c(
57
- (e) => !p || e.encounterUuid !== p ? !1 : q(e.formName),
58
- [p, q]
59
- ), w = c(
60
- (e) => O.find((r) => r.name === e)?.uuid,
61
- [O]
62
- ), A = d(() => {
63
- if (s)
64
- return w(s.formName);
65
- }, [s, w]), {
66
- data: l,
67
- isLoading: te,
68
- isError: se,
69
- error: E
70
- } = T({
71
- queryKey: ["formMetadata", A],
72
- queryFn: () => Ee(A),
73
- enabled: !!A && y
74
- }), {
75
- data: v,
76
- isLoading: ne,
77
- isError: ie,
78
- error: _
79
- } = T({
80
- queryKey: ["formsEncounterFHIR", s?.encounterUuid],
81
- queryFn: () => ve(s.encounterUuid),
82
- enabled: !!s?.encounterUuid && y
83
- });
84
- _e(
85
- (e) => {
86
- e.patientUUID === u && (ae(), re.invalidateQueries({ queryKey: ["formsEncounterFHIR"] }));
87
- },
88
- [u]
89
- );
90
- const de = d(() => !v?.entry || !s?.formName ? [] : v.entry.filter((e) => e.resource?.resourceType === "Observation").map((e) => e.resource).filter((e) => Fe(e) ? Se(e)?.toLowerCase() === s.formName.toLowerCase() : !0), [v, s?.formName]), le = d(() => {
91
- if (!l?.schema) return;
92
- const e = [], r = (o) => {
93
- (o ?? []).forEach((t) => {
94
- const a = t;
95
- a.id != null && e.push(String(a.id)), a.controls && r(a.controls);
96
- });
97
- };
98
- return r(
99
- l.schema.controls ?? []
100
- ), e.length > 0 ? e : void 0;
101
- }, [l]), ce = d(() => {
102
- if (!l?.schema) return;
103
- const e = {}, r = (o, t) => {
104
- for (const a of o)
105
- if (a.type === "section") {
106
- const S = a.label?.value ?? "Section";
107
- r(a.controls ?? [], S);
108
- } else
109
- a.id != null && t && (e[String(a.id)] = t), a.controls && r(a.controls, t);
110
- };
111
- return r(
112
- l.schema.controls ?? [],
113
- null
114
- ), Object.keys(e).length > 0 ? e : void 0;
115
- }, [l]), me = d(() => {
116
- if (!l?.schema) return;
117
- const e = {}, r = (o) => {
118
- (o ?? []).forEach((t) => {
119
- const a = t;
120
- a.concept?.uuid && a.concept?.datatype && (e[a.concept.uuid] = a.concept.datatype), a.controls && r(a.controls);
121
- });
122
- };
123
- return r(
124
- l.schema.controls ?? []
125
- ), Object.keys(e).length > 0 ? e : void 0;
126
- }, [l]), ue = d(() => {
127
- if (E)
128
- return K(E).message;
129
- if (_)
130
- return K(_).message;
131
- }, [E, _]), h = d(
132
- () => [
133
- { key: "recordedOn", header: n("RECORDED_ON") },
134
- { key: "recordedBy", header: n("RECORDED_BY") }
135
- ],
136
- [n]
137
- ), V = d(
138
- () => [...h, { key: "actions", header: n("ACTIONS") }],
139
- [h, n]
140
- ), fe = c(
141
- (e) => I && e.some((r) => f(r)) ? V : h,
142
- [I, f, V, h]
143
- ), he = h, pe = d(
144
- () => [
145
- { key: "recordedOn", sortable: !0 },
146
- { key: "recordedBy", sortable: !0 }
147
- ],
148
- []
149
- ), H = d(() => {
150
- const e = k.reduce(
151
- (r, o) => {
152
- const t = o.formName;
153
- r[t] ??= [];
154
- const a = o.providers.map((S) => S.providerName).filter(Boolean).join(", ");
155
- return r[t].push({
156
- id: o.encounterUuid,
157
- formName: o.formName,
158
- recordedOn: Be(o.encounterDateTime, n, !0).formattedResult,
159
- recordedBy: a ?? "--",
160
- encounterDateTime: o.encounterDateTime,
161
- encounterUuid: o.encounterUuid
162
- }), r;
163
- },
164
- {}
165
- );
166
- return Object.entries(e).map(
167
- ([r, o]) => ({
168
- formName: r,
169
- records: o.sort(
170
- (t, a) => a.encounterDateTime - t.encounterDateTime
171
- )
172
- })
173
- ).sort((r, o) => r.formName.localeCompare(o.formName));
174
- }, [k, n]), j = c((e) => {
175
- C(e), M(!0);
176
- }, []), P = c(() => {
177
- M(!1), C(null);
178
- }, []), F = c((e) => {
179
- globalThis.dispatchEvent(
180
- new CustomEvent(He, {
181
- detail: {
182
- editOnly: "observationForms",
183
- editTitle: "EDIT_OBSERVATION_FORM_TITLE",
184
- sourceEncounterUuid: e.encounterUuid,
185
- formName: e.formName,
186
- directFormMode: !0
187
- }
188
- })
189
- );
190
- }, []), $ = c(
191
- (e, r) => {
192
- switch (r) {
193
- case "recordedOn":
194
- return /* @__PURE__ */ i(Me, { onClick: () => j(e), children: e.recordedOn });
195
- case "recordedBy":
196
- return e.recordedBy;
197
- case "actions":
198
- return f(e) ? /* @__PURE__ */ i(
199
- z,
200
- {
201
- label: n("EDIT_OBSERVATION_FORM"),
202
- kind: "ghost",
203
- size: "sm",
204
- testId: `edit-form-${e.encounterUuid}`,
205
- onClick: () => F(e),
206
- children: /* @__PURE__ */ i(G, {})
207
- }
208
- ) : null;
209
- default:
210
- return null;
211
- }
212
- },
213
- [j, F, f, n]
214
- );
215
- return /* @__PURE__ */ x(ye, { children: [
216
- /* @__PURE__ */ i("div", { id: "forms-table", "data-testid": "forms-table", children: D || R || H.length === 0 || L ? /* @__PURE__ */ i(
217
- Q,
218
- {
219
- headers: he,
220
- ariaLabel: n("FORMS_HEADING"),
221
- rows: [],
222
- loading: D,
223
- errorStateMessage: R ? oe?.message : void 0,
224
- emptyStateMessage: n("FORMS_UNAVAILABLE"),
225
- renderCell: $,
226
- className: N.formsTableBody,
227
- dataTestId: "forms-table"
228
- }
229
- ) : /* @__PURE__ */ i(Ce, { align: "start", children: H.map((e, r) => {
230
- const { formName: o, records: t } = e, a = fe(t);
231
- return /* @__PURE__ */ i(
232
- Le,
233
- {
234
- title: o,
235
- className: N.customAccordianItem,
236
- testId: `accordian-title-${o}`,
237
- open: r === 0,
238
- children: /* @__PURE__ */ i(
239
- Q,
240
- {
241
- headers: a,
242
- ariaLabel: n("FORMS_HEADING"),
243
- rows: t,
244
- loading: !1,
245
- errorStateMessage: "",
246
- sortable: pe,
247
- emptyStateMessage: n("FORMS_UNAVAILABLE"),
248
- renderCell: $,
249
- className: N.formsTableBody,
250
- dataTestId: `forms-table-${o}`
251
- }
252
- )
253
- },
254
- o
255
- );
256
- }) }) }),
257
- y && s && /* @__PURE__ */ i(
258
- Ue,
259
- {
260
- id: "modalIdForActionAreaLayout",
261
- portalId: "main-display-area",
262
- open: y,
263
- onRequestClose: P,
264
- modalHeading: /* @__PURE__ */ x("div", { className: N.modalHeading, children: [
265
- /* @__PURE__ */ i("span", { children: s.formName }),
266
- I && f(s) && /* @__PURE__ */ i(
267
- z,
268
- {
269
- label: n("EDIT_OBSERVATION_FORM"),
270
- kind: "ghost",
271
- size: "sm",
272
- testId: `edit-form-modal-${s.encounterUuid}`,
273
- onClick: () => {
274
- P(), F(s);
275
- },
276
- children: /* @__PURE__ */ i(G, {})
277
- }
278
- )
279
- ] }),
280
- modalLabel: `${s.recordedOn} | ${s.recordedBy}`,
281
- passiveModal: !0,
282
- size: "md",
283
- testId: "form-details-modal",
284
- children: /* @__PURE__ */ i(
285
- De,
286
- {
287
- observations: de,
288
- isLoading: te || ne,
289
- isError: se || ie,
290
- errorMessage: ue,
291
- emptyStateMessage: n("NO_FORM_DATA_AVAILABLE"),
292
- testIdPrefix: s.formName,
293
- hideThumbnail: W,
294
- controlOrder: le,
295
- sectionMap: ce,
296
- conceptDatatypeMap: me
297
- }
298
- )
299
- }
300
- )
301
- ] });
302
- };
303
- export {
304
- Ke as default
305
- };