@bahmni/appointments-app 0.0.1-dev.299 → 0.0.1-dev.301

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,20 +1,20 @@
1
1
  import { jsx as r, jsxs as b } from "react/jsx-runtime";
2
- import { H as f, N as P, Q as O, T as V, U as Z, V as ee, W as te, a0 as ie, q as ae, a1 as ne, a as Q, a2 as R, a3 as le, a4 as re, a5 as se, a6 as E, a7 as F, a8 as C, a9 as Y, aa as x, ab as k, ac as w, l as oe, h as de, p as $, ad as ce, r as me, ae as Ae, af as Ie, ag as ue, t as _e, x as Te } from "./index-fg5HS614.js";
3
- import { useState as g, useMemo as N, useEffect as h, useRef as Le, useCallback as U } from "react";
4
- import { useQuery as M, useQueryClient as ve } from "@tanstack/react-query";
2
+ import { K as f, L as P, M as O, N as V, R as J, V as ee, Z as te, a0 as ie, E as ae, a1 as ne, u as Q, a2 as R, a3 as le, a4 as re, a5 as se, a6 as E, a7 as F, a8 as C, a9 as Y, aa as k, ab as x, ac as w, i as oe, Y as de, l as $, ad as ce, p as me, ae as Ae, af as Ie, ag as ue, r as _e, v as Te } from "./index-DXWAUyAO.js";
3
+ import { useState as g, useMemo as N, useEffect as S, useRef as Le, useCallback as U } from "react";
4
+ import { useQuery as D, useQueryClient as ve } from "@tanstack/react-query";
5
5
  const Ne = "Available for appointments", q = "Get Appointment Unavailability", pe = "Add Appointment Unavailability", G = "Appointment Location", be = () => {
6
6
  try {
7
- return Z().uuid;
7
+ return J().uuid;
8
8
  } catch {
9
9
  return "";
10
10
  }
11
- }, H = (e) => ({
11
+ }, K = (e) => ({
12
12
  id: "",
13
13
  text: e
14
14
  }), ye = (e) => ({
15
15
  display: e,
16
16
  uuid: ""
17
- }), De = (e, a) => {
17
+ }), Me = (e, a) => {
18
18
  const n = e.map((t) => ({
19
19
  id: t.uuid,
20
20
  text: t.name,
@@ -25,7 +25,7 @@ const Ne = "Available for appointments", q = "Get Appointment Unavailability", p
25
25
  text: a,
26
26
  isSelectAll: !0
27
27
  }), n;
28
- }, Me = (e, a) => {
28
+ }, De = (e, a) => {
29
29
  const n = e.map((t) => ({
30
30
  id: t.uuid,
31
31
  text: t.person?.display,
@@ -62,7 +62,7 @@ const Ne = "Available for appointments", q = "Get Appointment Unavailability", p
62
62
  locationName: e.location.name,
63
63
  appointmentServiceName: e.service?.name ?? a("ADMIN_UNAVAILABILITY_ALL"),
64
64
  providerName: e.provider?.name ?? a("ADMIN_UNAVAILABILITY_ALL")
65
- }), K = (e) => e.filter((a) => !a.isSelectAll).map((a) => a.id), fe = (e, a) => {
65
+ }), H = (e) => e.filter((a) => !a.isSelectAll).map((a) => a.id), fe = (e, a) => {
66
66
  const n = Ee(
67
67
  {
68
68
  locationUuid: e.locationUuid,
@@ -74,7 +74,7 @@ const Ne = "Available for appointments", q = "Get Appointment Unavailability", p
74
74
  endTimePeriod: e.endTimePeriod
75
75
  },
76
76
  a
77
- ), t = K(e.selectedServiceItems), o = K(e.selectedProviderItems), A = t.length === e.filteredServicesCount || t.length === 0 ? [void 0] : t, m = o.length === e.availableProvidersCount || o.length === 0 ? [void 0] : o;
77
+ ), t = H(e.selectedServiceItems), o = H(e.selectedProviderItems), A = t.length === e.filteredServicesCount || t.length === 0 ? [void 0] : t, m = o.length === e.availableProvidersCount || o.length === 0 ? [void 0] : o;
78
78
  return A.flatMap(
79
79
  (l) => m.map((s) => ({
80
80
  ...n,
@@ -86,19 +86,19 @@ const Ne = "Available for appointments", q = "Get Appointment Unavailability", p
86
86
  uuid: a.resource?.id ?? "",
87
87
  display: a.resource?.name ?? "",
88
88
  childLocations: []
89
- })), he = () => {
89
+ })), Se = () => {
90
90
  const {
91
91
  data: e,
92
92
  isLoading: a,
93
93
  isError: n
94
- } = M({
94
+ } = D({
95
95
  queryKey: ["currentUser"],
96
96
  queryFn: ee
97
97
  }), {
98
98
  data: t = [],
99
99
  isLoading: o,
100
100
  isError: c
101
- } = M({
101
+ } = D({
102
102
  queryKey: ["providerLoginLocations", e?.uuid],
103
103
  queryFn: async () => {
104
104
  const I = await te(
@@ -119,14 +119,14 @@ const Ne = "Available for appointments", q = "Get Appointment Unavailability", p
119
119
  data: A = [],
120
120
  isLoading: L,
121
121
  isError: m
122
- } = M({
122
+ } = D({
123
123
  queryKey: ["appointmentServices"],
124
124
  queryFn: ae
125
125
  }), {
126
126
  data: l = [],
127
127
  isLoading: s,
128
128
  isError: _
129
- } = M({
129
+ } = D({
130
130
  queryKey: ["providers"],
131
131
  queryFn: ne
132
132
  });
@@ -137,8 +137,8 @@ const Ne = "Available for appointments", q = "Get Appointment Unavailability", p
137
137
  isLoading: a || o || L || s,
138
138
  isError: n || c || m || _
139
139
  };
140
- }, Se = "UnavailabilityForm-module_formContent__WmNHR", Be = "UnavailabilityForm-module_formField__8he7o", Pe = "UnavailabilityForm-module_loading__IDEY6", Oe = "UnavailabilityForm-module_error__jDeOm", Ve = "UnavailabilityForm-module_grid__t6NKR", Fe = "UnavailabilityForm-module_column__QFdnQ", Ce = "UnavailabilityForm-module_dateTimeColumn__6bi0F", Ye = "UnavailabilityForm-module_datePicker__6HgbO", xe = "UnavailabilityForm-module_timePicker__DHNpK", d = {
141
- formContent: Se,
140
+ }, he = "UnavailabilityForm-module_formContent__WmNHR", Be = "UnavailabilityForm-module_formField__8he7o", Pe = "UnavailabilityForm-module_loading__IDEY6", Oe = "UnavailabilityForm-module_error__jDeOm", Ve = "UnavailabilityForm-module_grid__t6NKR", Fe = "UnavailabilityForm-module_column__QFdnQ", Ce = "UnavailabilityForm-module_dateTimeColumn__6bi0F", Ye = "UnavailabilityForm-module_datePicker__6HgbO", ke = "UnavailabilityForm-module_timePicker__DHNpK", d = {
141
+ formContent: he,
142
142
  formField: Be,
143
143
  loading: Pe,
144
144
  error: Oe,
@@ -146,13 +146,13 @@ const Ne = "Available for appointments", q = "Get Appointment Unavailability", p
146
146
  column: Fe,
147
147
  dateTimeColumn: Ce,
148
148
  datePicker: Ye,
149
- timePicker: xe
150
- }, ke = ({
149
+ timePicker: ke
150
+ }, xe = ({
151
151
  errors: e,
152
152
  formDataRef: a,
153
153
  onClearErrors: n
154
154
  }) => {
155
- const { t } = Q(), { loginLocations: o, services: c, providers: A, isLoading: L, isError: m } = he(), [l, s] = g({
155
+ const { t } = Q(), { loginLocations: o, services: c, providers: A, isLoading: L, isError: m } = Se(), [l, s] = g({
156
156
  locationUuid: "",
157
157
  selectedServiceItems: [],
158
158
  selectedProviderItems: [],
@@ -183,11 +183,11 @@ const Ne = "Available for appointments", q = "Get Appointment Unavailability", p
183
183
  () => R(
184
184
  !1,
185
185
  !1,
186
- De(
186
+ Me(
187
187
  _,
188
188
  t("ADMIN_UNAVAILABILITY_FORM_ALL_SERVICES")
189
189
  ),
190
- H,
190
+ K,
191
191
  {
192
192
  loading: "",
193
193
  error: "",
@@ -199,11 +199,11 @@ const Ne = "Available for appointments", q = "Get Appointment Unavailability", p
199
199
  () => R(
200
200
  !1,
201
201
  !1,
202
- Me(
202
+ De(
203
203
  I,
204
204
  t("ADMIN_UNAVAILABILITY_FORM_ALL_PROVIDERS")
205
205
  ),
206
- H,
206
+ K,
207
207
  {
208
208
  loading: "",
209
209
  error: "",
@@ -212,21 +212,21 @@ const Ne = "Available for appointments", q = "Get Appointment Unavailability", p
212
212
  ),
213
213
  [I]
214
214
  );
215
- return h(() => {
215
+ return S(() => {
216
216
  if (o.length === 0) return;
217
217
  const i = be(), p = o.some(
218
- (D) => D.uuid === i
218
+ (M) => M.uuid === i
219
219
  );
220
- s((D) => ({
221
- ...D,
220
+ s((M) => ({
221
+ ...M,
222
222
  locationUuid: p ? i : ""
223
223
  }));
224
- }, [o]), h(() => {
224
+ }, [o]), S(() => {
225
225
  _.length > 0 && s((i) => ({
226
226
  ...i,
227
227
  selectedServiceItems: v
228
228
  }));
229
- }, [v]), h(() => {
229
+ }, [v]), S(() => {
230
230
  I.length > 0 && s((i) => ({
231
231
  ...i,
232
232
  selectedProviderItems: y
@@ -327,7 +327,7 @@ const Ne = "Available for appointments", q = "Get Appointment Unavailability", p
327
327
  }
328
328
  ),
329
329
  /* @__PURE__ */ r(
330
- x,
330
+ k,
331
331
  {
332
332
  id: "start-time",
333
333
  "data-testid": "start-time-input",
@@ -342,7 +342,7 @@ const Ne = "Available for appointments", q = "Get Appointment Unavailability", p
342
342
  use24HourFormat: !1,
343
343
  className: d.timePicker,
344
344
  children: /* @__PURE__ */ b(
345
- k,
345
+ x,
346
346
  {
347
347
  id: "start-time-period",
348
348
  "data-testid": "start-time-period-select",
@@ -402,7 +402,7 @@ const Ne = "Available for appointments", q = "Get Appointment Unavailability", p
402
402
  }
403
403
  ),
404
404
  /* @__PURE__ */ r(
405
- x,
405
+ k,
406
406
  {
407
407
  id: "end-time",
408
408
  "data-testid": "end-time-input",
@@ -417,7 +417,7 @@ const Ne = "Available for appointments", q = "Get Appointment Unavailability", p
417
417
  use24HourFormat: !1,
418
418
  className: d.timePicker,
419
419
  children: /* @__PURE__ */ b(
420
- k,
420
+ x,
421
421
  {
422
422
  id: "end-time-period",
423
423
  "data-testid": "end-time-period-select",
@@ -510,7 +510,7 @@ const Ne = "Available for appointments", q = "Get Appointment Unavailability", p
510
510
  ), I = $(n, [
511
511
  pe,
512
512
  q
513
- ]), { data: u, isLoading: v, isError: y } = M({
513
+ ]), { data: u, isLoading: v, isError: y } = D({
514
514
  queryKey: ["appointmentUnavailabilities"],
515
515
  queryFn: ce,
516
516
  enabled: _
@@ -537,7 +537,7 @@ const Ne = "Available for appointments", q = "Get Appointment Unavailability", p
537
537
  key: "providerName",
538
538
  header: e("ADMIN_UNAVAILABILITY_COLUMN_PROVIDER")
539
539
  }
540
- ], [e]), D = N(() => u ? u.map((T) => ge(T, e)) : [], [u, e]), S = U(
540
+ ], [e]), M = N(() => u ? u.map((T) => ge(T, e)) : [], [u, e]), h = U(
541
541
  async (T) => {
542
542
  L(!0);
543
543
  try {
@@ -563,12 +563,12 @@ const Ne = "Available for appointments", q = "Get Appointment Unavailability", p
563
563
  ), j = U(async () => {
564
564
  if (!m.current) return;
565
565
  const T = Ue(m.current, e);
566
- s(T), !(Object.keys(T).length > 0) && await S(fe(m.current, e));
567
- }, [e, S]), W = U(
566
+ s(T), !(Object.keys(T).length > 0) && await h(fe(m.current, e));
567
+ }, [e, h]), W = U(
568
568
  (T) => {
569
- s((z) => {
570
- const B = { ...z };
571
- return T.forEach((J) => delete B[J]), B;
569
+ s((Z) => {
570
+ const B = { ...Z };
571
+ return T.forEach((z) => delete B[z]), B;
572
572
  });
573
573
  },
574
574
  []
@@ -595,7 +595,7 @@ const Ne = "Available for appointments", q = "Get Appointment Unavailability", p
595
595
  "aria-label": "appointment-unavailability-actions-table-aria-label",
596
596
  title: e("ADMIN_UNAVAILABILITY_TITLE"),
597
597
  headers: p,
598
- rows: D,
598
+ rows: M,
599
599
  ariaLabel: "unavailability-table",
600
600
  loading: v,
601
601
  errorStateMessage: y ? e("ADMIN_UNAVAILABILITY_ERROR_MESSAGE") : null,
@@ -622,7 +622,7 @@ const Ne = "Available for appointments", q = "Get Appointment Unavailability", p
622
622
  onSecondaryButtonClick: X,
623
623
  isSecondaryButtonDisabled: A,
624
624
  content: /* @__PURE__ */ r(
625
- ke,
625
+ xe,
626
626
  {
627
627
  errors: l,
628
628
  formDataRef: m,
@@ -1,20 +1,20 @@
1
1
  import { jsx as n, jsxs as y } from "react/jsx-runtime";
2
- import { o as V, g as h, a as C, i as O, $ as P, h as B, l as x, p as L, q as G, r as q, s as U, t as $, x as w, y as F, C as k, D as j } from "./index-fg5HS614.js";
3
- import { useState as I, useMemo as c } from "react";
4
- import { useQueryClient as H, useQuery as K } from "@tanstack/react-query";
5
- const Q = V(
6
- h,
2
+ import { s as V, A as O, u as C, I as P, $ as h, Y as B, i as G, l as L, E as x, p as U, n as q, r as w, v as $, w as F, C as k, D as Y } from "./index-DXWAUyAO.js";
3
+ import { useState as I, useMemo as _ } from "react";
4
+ import { useQueryClient as j, useQuery as H } from "@tanstack/react-query";
5
+ const K = V(
6
+ O,
7
7
  "useAppointmentsConfig",
8
8
  "AppointmentsConfigProvider"
9
- ), W = ({
9
+ ), Q = ({
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
- O,
17
+ P,
18
18
  {
19
19
  id: "delete-service-modal",
20
20
  testId: "delete-service-modal-test-id",
@@ -23,11 +23,11 @@ const Q = 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 Q = V(
36
36
  "speciality",
37
37
  "durationMins",
38
38
  "description"
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 = {
39
+ ], W = "app:appointments:manageServices", Z = "app:appointments:adminTab", z = "index-module_page__Gsfbu", J = "index-module_noPrivilegeContainer__Pu5WZ", X = "index-module_table__GAPmb", d = {
40
40
  page: z,
41
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(
52
- `ADMIN_ALL_SERVICES_COLUMN_${P(t)}`
51
+ header: i(
52
+ `ADMIN_ALL_SERVICES_COLUMN_${h(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 = H(), { addNotification: t } = B(), { userPrivileges: s } = x(), { appointmentsConfig: i } = Q(), [E, _] = I(null), [M, u] = I(!1), l = i?.serviceTableFields ?? [
78
+ const { t: e } = C(), i = j(), { addNotification: t } = B(), { userPrivileges: s } = G(), { appointmentsConfig: a } = K(), [E, c] = I(null), [M, u] = I(!1), l = a?.serviceTableFields ?? [
79
79
  ...p
80
80
  ], m = L(s, Z), b = L(
81
81
  s,
82
- Y
83
- ), S = c(
82
+ W
83
+ ), S = _(
84
84
  () => ee(l),
85
85
  [l]
86
- ), { data: A, isLoading: v, isError: D } = K({
86
+ ), { data: A, isLoading: v, isError: D } = H({
87
87
  queryKey: ["allAppointmentServices"],
88
- queryFn: G,
88
+ queryFn: x,
89
89
  enabled: m
90
- }), R = c(
90
+ }), R = _(
91
91
  () => te(l, e),
92
92
  [l]
93
- ), N = c(
94
- () => ae(A ?? [], S),
93
+ ), N = _(
94
+ () => ie(A ?? [], S),
95
95
  [A, S]
96
96
  ), g = async () => {
97
97
  u(!0);
98
98
  try {
99
- await j(E.id), t({
99
+ await Y(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
- }), _(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"),
@@ -120,17 +120,17 @@ const le = () => {
120
120
  kind: "ghost",
121
121
  label: e("ADMIN_ALL_SERVICES_DELETE_ICON_LABEL"),
122
122
  disabled: !b,
123
- onClick: () => _(r),
123
+ onClick: () => c(r),
124
124
  children: /* @__PURE__ */ n(k, {})
125
125
  }
126
126
  ) : p.includes(o) ? r[o] ?? "-" : r.attributes[o] ?? "-", f = [
127
- { id: "home", label: e("BREADCRUMB_HOME"), href: q },
127
+ { id: "home", label: e("BREADCRUMB_HOME"), href: U },
128
128
  { id: "admin", label: e("BREADCRUMB_ADMIN"), isCurrentPage: !0 }
129
129
  ];
130
130
  return /* @__PURE__ */ n(
131
- U,
131
+ q,
132
132
  {
133
- header: /* @__PURE__ */ n(w, { breadcrumbItems: f }),
133
+ header: /* @__PURE__ */ n($, { breadcrumbItems: f }),
134
134
  main: m ? /* @__PURE__ */ y(
135
135
  "div",
136
136
  {
@@ -140,7 +140,7 @@ const le = () => {
140
140
  className: d.page,
141
141
  children: [
142
142
  /* @__PURE__ */ n(
143
- $,
143
+ w,
144
144
  {
145
145
  id: "all-services",
146
146
  title: e("ADMIN_ALL_SERVICES_TITLE"),
@@ -155,12 +155,12 @@ const le = () => {
155
155
  }
156
156
  ),
157
157
  E && /* @__PURE__ */ n(
158
- W,
158
+ Q,
159
159
  {
160
160
  serviceName: E.name,
161
161
  isDeleting: M,
162
162
  onConfirm: g,
163
- onCancel: () => _(null)
163
+ onCancel: () => c(null)
164
164
  }
165
165
  )
166
166
  ]