@bahmni/appointments-app 0.0.1-dev.194 → 0.0.1-dev.197

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 { aG as t } from "./index-ClooEAJt.js";
1
+ import { aM as t } from "./index-BSilwxTF.js";
2
2
  export {
3
3
  t as AppointmentsApp
4
4
  };
@@ -5,8 +5,18 @@
5
5
  "ADMIN_ALL_SERVICES_COLUMN_LOCATION": "Location",
6
6
  "ADMIN_ALL_SERVICES_COLUMN_NAME": "Service Name",
7
7
  "ADMIN_ALL_SERVICES_COLUMN_SPECIALITY": "Speciality",
8
+ "ADMIN_ALL_SERVICES_DELETE_BUTTON_LABEL": "Delete",
9
+ "ADMIN_ALL_SERVICES_DELETE_CANCEL": "Cancel",
10
+ "ADMIN_ALL_SERVICES_DELETE_CONFIRM_BODY": "Are you sure you want to delete {{serviceName}} service?",
11
+ "ADMIN_ALL_SERVICES_DELETE_ERROR_MESSAGE": "Failed to delete service. Please try again.",
12
+ "ADMIN_ALL_SERVICES_DELETE_ERROR_TITLE": "Delete Failed",
13
+ "ADMIN_ALL_SERVICES_DELETE_ICON_LABEL": "Delete service",
14
+ "ADMIN_ALL_SERVICES_DELETE_MODAL_TITLE": "Delete Service",
15
+ "ADMIN_ALL_SERVICES_DELETE_SUCCESS_MESSAGE": "Service deleted successfully.",
16
+ "ADMIN_ALL_SERVICES_DELETE_SUCCESS_TITLE": "Service Deleted",
8
17
  "ADMIN_ALL_SERVICES_EMPTY_MESSAGE": "No services found.",
9
18
  "ADMIN_ALL_SERVICES_ERROR_MESSAGE": "Failed to load services. Please try again.",
19
+ "ADMIN_ALL_SERVICES_ERROR_MESSAGE_NO_VIEW_PRIVILEGE": "You are not authorized to view this page.",
10
20
  "ADMIN_ALL_SERVICES_TITLE": "Services",
11
21
  "BREADCRUMB_ADMIN": "Admin",
12
22
  "BREADCRUMB_HOME": "Home",
@@ -5,8 +5,18 @@
5
5
  "ADMIN_ALL_SERVICES_COLUMN_LOCATION": "Ubicación",
6
6
  "ADMIN_ALL_SERVICES_COLUMN_NAME": "Nombre del servicio",
7
7
  "ADMIN_ALL_SERVICES_COLUMN_SPECIALITY": "Especialidad",
8
+ "ADMIN_ALL_SERVICES_DELETE_BUTTON_LABEL": "Eliminar",
9
+ "ADMIN_ALL_SERVICES_DELETE_CANCEL": "Cancelar",
10
+ "ADMIN_ALL_SERVICES_DELETE_CONFIRM_BODY": "¿Está seguro de que desea eliminar el servicio {{serviceName}}?",
11
+ "ADMIN_ALL_SERVICES_DELETE_ERROR_MESSAGE": "Error al eliminar el servicio. Por favor, inténtelo de nuevo.",
12
+ "ADMIN_ALL_SERVICES_DELETE_ERROR_TITLE": "Error al eliminar",
13
+ "ADMIN_ALL_SERVICES_DELETE_ICON_LABEL": "Eliminar servicio",
14
+ "ADMIN_ALL_SERVICES_DELETE_MODAL_TITLE": "Eliminar servicio",
15
+ "ADMIN_ALL_SERVICES_DELETE_SUCCESS_MESSAGE": "Servicio eliminado correctamente.",
16
+ "ADMIN_ALL_SERVICES_DELETE_SUCCESS_TITLE": "Servicio eliminado",
8
17
  "ADMIN_ALL_SERVICES_EMPTY_MESSAGE": "No se encontraron servicios.",
9
18
  "ADMIN_ALL_SERVICES_ERROR_MESSAGE": "Error al cargar los servicios. Por favor, inténtelo de nuevo.",
19
+ "ADMIN_ALL_SERVICES_ERROR_MESSAGE_NO_VIEW_PRIVILEGE": "No está autorizado para ver esta página.",
10
20
  "ADMIN_ALL_SERVICES_TITLE": "Servicios",
11
21
  "BREADCRUMB_ADMIN": "Admin",
12
22
  "BREADCRUMB_HOME": "Inicio",
@@ -0,0 +1,10 @@
1
+ import { default as React } from 'react';
2
+ interface DeleteServiceModalProps {
3
+ serviceName: string;
4
+ isDeleting: boolean;
5
+ onConfirm: () => void;
6
+ onCancel: () => void;
7
+ }
8
+ declare const DeleteServiceModal: React.FC<DeleteServiceModalProps>;
9
+ export default DeleteServiceModal;
10
+ //# sourceMappingURL=DeleteServiceModal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DeleteServiceModal.d.ts","sourceRoot":"","sources":["../../../../../src/pages/admin/allServices/components/DeleteServiceModal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,UAAU,uBAAuB;IAC/B,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,QAAA,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CAyBzD,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
@@ -1,2 +1,4 @@
1
1
  export declare const KNOWN_FIELDS: string[];
2
+ export declare const MANAGE_APPOINTMENT_SERVICES_PRIVILEGE = "app:appointments:manageServices";
3
+ export declare const ADMIN_TAB_PRIVILEGE = "app:appointments:adminTab";
2
4
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/pages/admin/allServices/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,EAAE,MAAM,EAMhC,CAAC"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/pages/admin/allServices/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,EAAE,MAAM,EAMhC,CAAC;AAEF,eAAO,MAAM,qCAAqC,oCACf,CAAC;AACpC,eAAO,MAAM,mBAAmB,8BAA8B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/pages/admin/allServices/index.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAkB,MAAM,OAAO,CAAC;AAWvC,QAAA,MAAM,eAAe,EAAE,KAAK,CAAC,EAiE5B,CAAC;AAEF,eAAe,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/pages/admin/allServices/index.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAA4B,MAAM,OAAO,CAAC;AAgBjD,QAAA,MAAM,eAAe,EAAE,KAAK,CAAC,EA6I5B,CAAC;AAEF,eAAe,eAAe,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bahmni/appointments-app",
3
- "version": "0.0.1-dev.194",
3
+ "version": "0.0.1-dev.197",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -1,170 +0,0 @@
1
- import { jsxs as N, jsx as l } from "react/jsx-runtime";
2
- import { d as k, t as B, u as I, j as Q, y as H, a as K, E as j, V as w, k as x, l as G, o as M, N as z, p as P, Q as S, T as Y, c as J, $ as W, e as X, r as Z, f as ee, H as te } from "./index-ClooEAJt.js";
3
- import { useRef as ae, useEffect as T, useMemo as R } from "react";
4
- const D = (t, d, n, u, r) => {
5
- const a = Y(t, d, r), s = a.value, o = J(s);
6
- let i = s;
7
- o === "Image" && (i = /* @__PURE__ */ l(X, { imageSrc: s, alt: s, id: `${s}-img` })), o === "Video" && (i = /* @__PURE__ */ l(Z, { id: `${s}-video`, videoSrc: s })), o === "PDF" && (i = /* @__PURE__ */ l(ee, { id: `${s}-pdf`, src: s }));
8
- const b = r("OBSERVATIONS_RECORDED_BY", {
9
- provider: a.provider
10
- }), p = t.display, y = t.observationValue?.isAbnormal ? "abnormal-obs" : "obs", c = u ? `${u}-${y}-${p}-${n}-${d}` : `${y}-${p}-${n}-${d}`;
11
- return /* @__PURE__ */ l(
12
- W,
13
- {
14
- header: a.header,
15
- value: i,
16
- info: b,
17
- id: c,
18
- testId: c,
19
- ariaLabel: c
20
- },
21
- `obs-${t.id}`
22
- );
23
- }, se = (t, d, n, u, r, a) => /* @__PURE__ */ l(
24
- S,
25
- {
26
- title: t.display,
27
- id: `grouped-obs-${t.display}-${u}`,
28
- open: n,
29
- children: t.members?.map(
30
- (s, o) => D(s, o, r, a, d)
31
- )
32
- },
33
- `grouped-obs-${t.id}`
34
- ), re = ({
35
- groupedData: t,
36
- title: d = ""
37
- }) => {
38
- const { t: n } = I(), u = (r, a, s) => {
39
- const o = P(r.encounterDetails, n);
40
- return /* @__PURE__ */ N(
41
- S,
42
- {
43
- title: o,
44
- id: `encounter-${r.encounterId}`,
45
- open: a,
46
- children: [
47
- r.observations.map(
48
- (i, b) => D(i, b, s, d, n)
49
- ),
50
- r.groupedObservations.map(
51
- (i, b) => se(
52
- i,
53
- n,
54
- a,
55
- b,
56
- s,
57
- d
58
- )
59
- )
60
- ]
61
- },
62
- `encounter-${r.encounterId}`
63
- );
64
- };
65
- return /* @__PURE__ */ l(
66
- "div",
67
- {
68
- id: "obs-by-encounter",
69
- "data-testid": "obs-by-encounter-test-id",
70
- "aria-label": "obs-by-encounter-aria-label",
71
- children: t.map(
72
- (r, a) => u(r, a === 0, a)
73
- )
74
- }
75
- );
76
- }, oe = "_observations_kfbhq_1", ie = "_title_kfbhq_12", _ = {
77
- observations: oe,
78
- title: ie
79
- }, ne = (t) => ["conceptUuid", t], de = (t, d) => ["observations", t, ...d], be = ({ config: t }) => {
80
- const d = t, { conceptNames: n = [], conceptUuid: u = [] } = d, r = ae(/* @__PURE__ */ new Set()), a = k(), { addNotification: s } = B(), { t: o } = I(), i = Q({
81
- queries: n.map((e) => ({
82
- queryKey: ne(e),
83
- queryFn: () => H(e),
84
- enabled: !!e
85
- }))
86
- });
87
- T(() => {
88
- i.forEach((e, m) => {
89
- if (e.isError && !r.current.has(m)) {
90
- const q = n[m];
91
- s({
92
- title: o("ERROR_DEFAULT_TITLE"),
93
- message: o("ERROR_FETCHING_CONCEPT", { conceptName: q }),
94
- type: "error"
95
- }), r.current.add(m);
96
- } else e.isError || r.current.delete(m);
97
- });
98
- }, [i, n]);
99
- const b = R(() => i.map((e) => e.data?.uuid).filter((e) => !!e), [i]), p = R(() => [.../* @__PURE__ */ new Set([...b, ...u])], [b, u]), y = R(() => n.length === 0 ? !0 : i.every((e) => !e.isLoading), [i, n.length]), {
100
- data: c,
101
- isLoading: F,
102
- isError: f,
103
- refetch: g
104
- } = K({
105
- queryKey: de(a, p),
106
- queryFn: () => te(a, p),
107
- enabled: !!a && p.length > 0 && y
108
- });
109
- j(
110
- (e) => {
111
- e.patientUUID === a && e.updatedConcepts.size > 0 && [...e.updatedConcepts.keys()].some(
112
- (m) => p.includes(m)
113
- ) && g();
114
- },
115
- [a, g]
116
- ), T(() => {
117
- f && s({
118
- title: o("ERROR_DEFAULT_TITLE"),
119
- message: o("ERROR_FETCHING_OBSERVATIONS"),
120
- type: "error"
121
- });
122
- }, [f]);
123
- const h = R(() => {
124
- if (!c) return [];
125
- const e = w(c), m = x(e);
126
- return G(m);
127
- }, [c]), L = [
128
- { key: "name", header: "name" },
129
- { key: "value", header: "value" },
130
- { key: "form", header: "form" }
131
- ], O = F || !y, $ = f && y, A = (!c || c.entry?.length === 0 || p.length === 0) && y, C = $ ? o("ERROR_FETCHING_OBSERVATIONS") : null, U = A ? o("NO_OBSERVATIONS_FOUND") : void 0, V = h.length > 0 && !O && !$, E = d.titleTranslationKey, v = E ? o(E) : "";
132
- return /* @__PURE__ */ N(
133
- "div",
134
- {
135
- id: "observations",
136
- "data-testid": E ? `observations-${v}` : "observations",
137
- "aria-label": "observations-aria-label",
138
- className: _.observations,
139
- children: [
140
- /* @__PURE__ */ l(
141
- M,
142
- {
143
- id: "observations-title",
144
- testId: E ? `observations-title-${v}` : "observations-title",
145
- title: v,
146
- className: _.title,
147
- children: /* @__PURE__ */ l("p", { children: v })
148
- }
149
- ),
150
- V ? /* @__PURE__ */ l(re, { groupedData: h, title: v }) : /* @__PURE__ */ l(
151
- z,
152
- {
153
- headers: L,
154
- rows: [],
155
- ariaLabel: o("OBSERVATIONS"),
156
- loading: O,
157
- errorStateMessage: C,
158
- emptyStateMessage: U,
159
- dataTestId: "observations-table"
160
- }
161
- )
162
- ]
163
- }
164
- );
165
- };
166
- export {
167
- ne as conceptUuidQueryKeys,
168
- be as default,
169
- de as observationsQueryKeys
170
- };
@@ -1,94 +0,0 @@
1
- import { jsx as r } from "react/jsx-runtime";
2
- import { Z as E, A as S, q as C, u as M, a as f, s as L, G as N, _ as g, v as y, w as I } from "./index-ClooEAJt.js";
3
- import { useMemo as o } from "react";
4
- const R = E(
5
- S,
6
- "useAppointmentsConfig",
7
- "AppointmentsConfigProvider"
8
- ), l = [
9
- "name",
10
- "location",
11
- "speciality",
12
- "durationMins",
13
- "description"
14
- ], h = "_tableContainer_jtyg5_1", D = "_table_jtyg5_1", c = {
15
- tableContainer: h,
16
- table: D
17
- };
18
- function T(t) {
19
- return t.filter((n) => !l.includes(n));
20
- }
21
- function v(t, n) {
22
- return [
23
- ...t.map((e) => ({
24
- key: e,
25
- header: n(
26
- `ADMIN_ALL_SERVICES_COLUMN_${C(e)}`
27
- )
28
- })),
29
- {
30
- key: "actions",
31
- header: n("ADMIN_ALL_SERVICES_COLUMN_ACTIONS")
32
- }
33
- ];
34
- }
35
- function O(t, n) {
36
- return t.map((e) => ({
37
- id: e.uuid,
38
- name: e.name,
39
- location: e.location?.name ?? null,
40
- speciality: e.speciality?.name ?? null,
41
- durationMins: e.durationMins,
42
- description: e.description,
43
- attributes: Object.fromEntries(
44
- n.map((a) => [
45
- a,
46
- e.attributes?.find((i) => i.attributeType === a)?.value ?? null
47
- ])
48
- )
49
- }));
50
- }
51
- const B = () => {
52
- const { t } = M(), { appointmentsConfig: n } = R(), e = n?.serviceTableFields ?? [
53
- ...l
54
- ], a = o(
55
- () => T(e),
56
- [e]
57
- ), { data: i, isLoading: m, isError: d } = f({
58
- queryKey: ["allAppointmentServices"],
59
- queryFn: I
60
- }), p = o(
61
- () => v(e, t),
62
- [e]
63
- ), _ = o(
64
- () => O(i ?? [], a),
65
- [i, a]
66
- ), b = (u, s) => s === "actions" ? null : l.includes(s) ? u[s] ?? "-" : u.attributes[s] ?? "-", A = [
67
- { id: "home", label: t("BREADCRUMB_HOME"), href: L },
68
- { id: "admin", label: t("BREADCRUMB_ADMIN"), isCurrentPage: !0 }
69
- ];
70
- return /* @__PURE__ */ r(
71
- N,
72
- {
73
- header: /* @__PURE__ */ r(y, { breadcrumbItems: A }),
74
- main: /* @__PURE__ */ r("div", { className: c.tableContainer, children: /* @__PURE__ */ r(
75
- g,
76
- {
77
- id: "all-services",
78
- title: t("ADMIN_ALL_SERVICES_TITLE"),
79
- headers: p,
80
- rows: _,
81
- ariaLabel: "all-services-table",
82
- loading: m,
83
- errorStateMessage: d ? t("ADMIN_ALL_SERVICES_ERROR_MESSAGE") : null,
84
- emptyStateMessage: t("ADMIN_ALL_SERVICES_EMPTY_MESSAGE"),
85
- renderCell: b,
86
- className: c.table
87
- }
88
- ) })
89
- }
90
- );
91
- };
92
- export {
93
- B as default
94
- };