@bahmni/appointments-app 0.0.1-dev.236 → 0.0.1-dev.238

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