@bahmni/appointments-app 0.0.1-dev.267 → 0.0.1-dev.270

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.
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { b6 as t } from "./index-Dd5zlHOS.js";
1
+ import { b6 as t } from "./index-U58J_2Iy.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.267",
3
+ "version": "0.0.1-dev.270",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -1,196 +0,0 @@
1
- import { jsx as s, jsxs as J, Fragment as W } from "react/jsx-runtime";
2
- import { u as Z, d as ee, f as re, g as ae, b as c, X as te, R as v, m as oe, c as se, e as U, A as ne, _ as de, r as ie, Y as ue, I as me, j as le, B as ce, P as fe, k as ye } from "./index-Dd5zlHOS.js";
3
- import { useState as S, useMemo as d, useCallback as f } from "react";
4
- const pe = "_formsTableBody_ourq9_5", be = "_customAccordianItem_ourq9_10", A = {
5
- formsTableBody: pe,
6
- customAccordianItem: be
7
- }, ge = (u) => u ? u.extension?.find(
8
- (n) => n.url === me
9
- )?.valueString : void 0, he = ({
10
- episodeOfCareUuids: u,
11
- encounterUuids: n,
12
- config: C
13
- }) => {
14
- const { t: o } = Z(), m = ee(), [l, h] = S(!1), [t, O] = S(null), { numberOfVisits: k, hideThumbnail: j = !1 } = C ?? {}, B = re(
15
- u,
16
- n
17
- ), H = ae(), {
18
- data: y = [],
19
- isLoading: _,
20
- isError: E,
21
- error: K,
22
- refetch: x
23
- } = c({
24
- queryKey: ["forms", m, u],
25
- queryFn: () => le(m, void 0, k),
26
- enabled: !!m && !B
27
- }), T = d(() => !n || n.length === 0 ? y : y.filter(
28
- (e) => n.includes(e.encounterUuid)
29
- ), [y, n]), { data: R = [] } = c({
30
- queryKey: ["observationForms"],
31
- queryFn: () => ce()
32
- }), F = f(
33
- (e) => R.find((r) => r.name === e)?.uuid,
34
- [R]
35
- ), p = d(() => {
36
- if (t)
37
- return F(t.formName);
38
- }, [t, F]), {
39
- isLoading: V,
40
- isError: $,
41
- error: b
42
- } = c({
43
- queryKey: ["formMetadata", p],
44
- queryFn: () => fe(p),
45
- enabled: !!p && l
46
- }), {
47
- data: g,
48
- isLoading: w,
49
- isError: P,
50
- error: N
51
- } = c({
52
- queryKey: ["formsEncounterFHIR", t?.encounterUuid],
53
- queryFn: () => ye(t.encounterUuid),
54
- enabled: !!t?.encounterUuid && l
55
- });
56
- te(
57
- (e) => {
58
- e.patientUUID === m && e.updatedConcepts.size > 0 && (x(), H.invalidateQueries({ queryKey: ["formsEncounterFHIR"] }));
59
- },
60
- [m]
61
- );
62
- const Q = d(() => !g?.entry || !t?.formName ? [] : g.entry.filter((e) => e.resource?.resourceType === "Observation").map((e) => e.resource).filter((e) => {
63
- const r = ge(e);
64
- return !r || r.includes(t.formName);
65
- }), [g, t?.formName]), Y = d(() => {
66
- if (b)
67
- return v(b).message;
68
- if (N)
69
- return v(N).message;
70
- }, [b, N]), L = d(
71
- () => [
72
- { key: "recordedOn", header: o("RECORDED_ON") },
73
- { key: "recordedBy", header: o("RECORDED_BY") }
74
- ],
75
- [o]
76
- ), z = d(
77
- () => [
78
- { key: "recordedOn", sortable: !0 },
79
- { key: "recordedBy", sortable: !0 }
80
- ],
81
- []
82
- ), M = d(() => {
83
- const e = T.reduce(
84
- (r, a) => {
85
- const i = a.formName;
86
- r[i] ??= [];
87
- const I = a.providers.map((X) => X.providerName).filter(Boolean).join(", ");
88
- return r[i].push({
89
- id: a.encounterUuid,
90
- formName: a.formName,
91
- recordedOn: oe(a.encounterDateTime, o, !0).formattedResult,
92
- recordedBy: I ?? "--",
93
- encounterDateTime: a.encounterDateTime,
94
- encounterUuid: a.encounterUuid
95
- }), r;
96
- },
97
- {}
98
- );
99
- return Object.entries(e).map(
100
- ([r, a]) => ({
101
- formName: r,
102
- records: a.sort(
103
- (i, I) => I.encounterDateTime - i.encounterDateTime
104
- )
105
- })
106
- ).sort((r, a) => r.formName.localeCompare(a.formName));
107
- }, [T, o]), D = f((e) => {
108
- O(e), h(!0);
109
- }, []), G = f(() => {
110
- h(!1), O(null);
111
- }, []), q = f(
112
- (e, r) => {
113
- switch (r) {
114
- case "recordedOn":
115
- return /* @__PURE__ */ s(se, { onClick: () => D(e), children: e.recordedOn });
116
- case "recordedBy":
117
- return e.recordedBy;
118
- default:
119
- return null;
120
- }
121
- },
122
- [D]
123
- );
124
- return /* @__PURE__ */ J(W, { children: [
125
- /* @__PURE__ */ s("div", { id: "forms-table", "data-testid": "forms-table", children: _ || E || M.length === 0 || B ? /* @__PURE__ */ s(
126
- U,
127
- {
128
- headers: L,
129
- ariaLabel: o("FORMS_HEADING"),
130
- rows: [],
131
- loading: _,
132
- errorStateMessage: E ? K?.message : void 0,
133
- emptyStateMessage: o("FORMS_UNAVAILABLE"),
134
- renderCell: q,
135
- className: A.formsTableBody,
136
- dataTestId: "forms-table"
137
- }
138
- ) : /* @__PURE__ */ s(ne, { align: "start", children: M.map((e, r) => {
139
- const { formName: a, records: i } = e;
140
- return /* @__PURE__ */ s(
141
- de,
142
- {
143
- title: a,
144
- className: A.customAccordianItem,
145
- testId: `accordian-title-${a}`,
146
- open: r === 0,
147
- children: /* @__PURE__ */ s(
148
- U,
149
- {
150
- headers: L,
151
- ariaLabel: o("FORMS_HEADING"),
152
- rows: i,
153
- loading: !1,
154
- errorStateMessage: "",
155
- sortable: z,
156
- emptyStateMessage: o("FORMS_UNAVAILABLE"),
157
- renderCell: q,
158
- className: A.formsTableBody,
159
- dataTestId: `forms-table-${a}`
160
- }
161
- )
162
- },
163
- a
164
- );
165
- }) }) }),
166
- l && t && /* @__PURE__ */ s(
167
- ie,
168
- {
169
- id: "modalIdForActionAreaLayout",
170
- portalId: "main-display-area",
171
- open: l,
172
- onRequestClose: G,
173
- modalHeading: t.formName,
174
- modalLabel: `${t.recordedOn} | ${t.recordedBy}`,
175
- passiveModal: !0,
176
- size: "md",
177
- testId: "form-details-modal",
178
- children: /* @__PURE__ */ s(
179
- ue,
180
- {
181
- observations: Q,
182
- isLoading: V || w,
183
- isError: $ || P,
184
- errorMessage: Y,
185
- emptyStateMessage: o("NO_FORM_DATA_AVAILABLE"),
186
- testIdPrefix: t.formName,
187
- hideThumbnail: j
188
- }
189
- )
190
- }
191
- )
192
- ] });
193
- };
194
- export {
195
- he as default
196
- };