@bahmni/appointments-app 0.0.1-dev.383 → 0.0.1-dev.385

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,19 +1,19 @@
1
- import { jsx as i, jsxs as y } from "react/jsx-runtime";
2
- import { s as V, v as P, u as I, F as O, x as h, L as B, Q as x, C as A, D as G, I as U, J as F, S as q, U as Q, Z as k, W, X as $, _ as j } from "./index-B6SqeItn.js";
3
- import { useState as C, useMemo as _ } from "react";
4
- import { useQueryClient as w, useQuery as H } from "@tanstack/react-query";
1
+ import { jsx as a, jsxs as y } from "react/jsx-runtime";
2
+ import { U as V, n as P, u as I, r as O, s as h, L as B, Q as G, t as A, v as x, C as U, H as q, I as F, J as Q, T as $, W as k, X as H, Z as W } from "./index-Bu4bscFn.js";
3
+ import { useState as C, useMemo as c } from "react";
4
+ import { useQueryClient as j, useQuery as w } from "@tanstack/react-query";
5
5
  const K = V(
6
6
  P,
7
7
  "useAppointmentsConfig",
8
8
  "AppointmentsConfigProvider"
9
- ), Z = ({
9
+ ), Y = ({
10
10
  serviceName: e,
11
- isDeleting: a,
11
+ isDeleting: i,
12
12
  onConfirm: t,
13
13
  onCancel: s
14
14
  }) => {
15
15
  const { t: n } = I();
16
- return /* @__PURE__ */ i(
16
+ return /* @__PURE__ */ a(
17
17
  O,
18
18
  {
19
19
  id: "delete-service-modal",
@@ -25,7 +25,7 @@ const K = V(
25
25
  onRequestSubmit: t,
26
26
  primaryButtonText: n("ADMIN_ALL_SERVICES_DELETE_BUTTON_LABEL"),
27
27
  secondaryButtonText: n("ADMIN_ALL_SERVICES_DELETE_CANCEL"),
28
- primaryButtonDisabled: a,
28
+ primaryButtonDisabled: i,
29
29
  modalHeading: n("ADMIN_ALL_SERVICES_DELETE_MODAL_TITLE"),
30
30
  children: n("ADMIN_ALL_SERVICES_DELETE_CONFIRM_BODY", { serviceName: e })
31
31
  }
@@ -36,29 +36,29 @@ const K = 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 = {
39
+ ], Z = "app:appointments:manageServices", z = "app:appointments:adminTab", J = "index-module_page__Gsfbu", X = "index-module_noPrivilegeContainer__Pu5WZ", ee = "index-module_table__GAPmb", d = {
40
40
  page: J,
41
41
  noPrivilegeContainer: X,
42
42
  table: ee
43
43
  };
44
44
  function te(e) {
45
- return e.filter((a) => !u.includes(a));
45
+ return e.filter((i) => !u.includes(i));
46
46
  }
47
- function ae(e, a) {
47
+ function ie(e, i) {
48
48
  return [
49
49
  ...e.map((t) => ({
50
50
  key: t,
51
- header: a(
51
+ header: i(
52
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 ie(e, a) {
61
+ function ae(e, i) {
62
62
  return e.map((t) => ({
63
63
  id: t.uuid,
64
64
  name: t.name,
@@ -67,7 +67,7 @@ function ie(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
72
  t.attributes?.find((n) => n.attributeType === s)?.value ?? null
73
73
  ])
@@ -75,33 +75,33 @@ function ie(e, a) {
75
75
  }));
76
76
  }
77
77
  const oe = () => {
78
- const { t: e } = I(), a = w(), { addNotification: t } = B(), { userPrivileges: s } = x(), { appointmentsConfig: n } = K(), [E, c] = C(null), [b, p] = C(!1), l = n?.serviceTableFields ?? [
78
+ const { t: e } = I(), i = j(), { addNotification: t } = B(), { userPrivileges: s } = G(), { appointmentsConfig: n } = K(), [E, _] = C(null), [M, p] = C(!1), l = n?.serviceTableFields ?? [
79
79
  ...u
80
- ], S = A(s, z), M = A(
80
+ ], m = A(s, z), b = A(
81
81
  s,
82
- Y
83
- ), m = _(
82
+ Z
83
+ ), S = c(
84
84
  () => te(l),
85
85
  [l]
86
- ), { data: L, isLoading: v, isError: D } = H({
86
+ ), { data: L, isLoading: v, isError: D } = w({
87
87
  queryKey: ["allAppointmentServices"],
88
- queryFn: G,
89
- enabled: S
90
- }), R = _(
91
- () => ae(l, e),
88
+ queryFn: x,
89
+ enabled: m
90
+ }), R = c(
91
+ () => ie(l, e),
92
92
  [l]
93
- ), N = _(
94
- () => ie(L ?? [], m),
95
- [L, m]
93
+ ), N = c(
94
+ () => ae(L ?? [], S),
95
+ [L, S]
96
96
  ), g = async () => {
97
97
  p(!0);
98
98
  try {
99
- await j(E.id), t({
99
+ await W(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
- }), c(null), a.invalidateQueries({ queryKey: ["allAppointmentServices"] });
104
+ }), _(null), i.invalidateQueries({ queryKey: ["allAppointmentServices"] });
105
105
  } catch {
106
106
  t({
107
107
  title: e("ADMIN_ALL_SERVICES_DELETE_ERROR_TITLE"),
@@ -111,27 +111,27 @@ const oe = () => {
111
111
  } finally {
112
112
  p(!1);
113
113
  }
114
- }, T = (r, o) => o === "actions" ? /* @__PURE__ */ i(
115
- W,
114
+ }, T = (r, o) => o === "actions" ? /* @__PURE__ */ a(
115
+ k,
116
116
  {
117
117
  id: `delete-service-${r.id}-btn`,
118
118
  testId: `delete-service-${r.id}-btn-test-id`,
119
119
  "aria-label": `delete-service-${r.id}-btn-aria-label`,
120
120
  kind: "ghost",
121
121
  label: e("ADMIN_ALL_SERVICES_DELETE_ICON_LABEL"),
122
- disabled: !M,
123
- onClick: () => c(r),
124
- children: /* @__PURE__ */ i($, {})
122
+ disabled: !b,
123
+ onClick: () => _(r),
124
+ children: /* @__PURE__ */ a(H, {})
125
125
  }
126
126
  ) : u.includes(o) ? r[o] ?? "-" : r.attributes[o] ?? "-", f = [
127
127
  { id: "home", label: e("BREADCRUMB_HOME"), href: U },
128
128
  { id: "admin", label: e("BREADCRUMB_ADMIN"), isCurrentPage: !0 }
129
129
  ];
130
- return /* @__PURE__ */ i(
131
- F,
130
+ return /* @__PURE__ */ a(
131
+ q,
132
132
  {
133
- header: /* @__PURE__ */ i(Q, { breadcrumbItems: f, userMenu: /* @__PURE__ */ i(k, {}) }),
134
- main: S ? /* @__PURE__ */ y(
133
+ header: /* @__PURE__ */ a(Q, { breadcrumbItems: f, userMenu: /* @__PURE__ */ a($, {}) }),
134
+ main: m ? /* @__PURE__ */ y(
135
135
  "div",
136
136
  {
137
137
  id: "all-appointment-service-page",
@@ -139,8 +139,8 @@ const oe = () => {
139
139
  "aria-label": "all-appointment-service-page-aria-label",
140
140
  className: d.page,
141
141
  children: [
142
- /* @__PURE__ */ i(
143
- q,
142
+ /* @__PURE__ */ a(
143
+ F,
144
144
  {
145
145
  id: "all-services",
146
146
  title: e("ADMIN_ALL_SERVICES_TITLE"),
@@ -154,18 +154,18 @@ const oe = () => {
154
154
  className: d.table
155
155
  }
156
156
  ),
157
- E && /* @__PURE__ */ i(
158
- Z,
157
+ E && /* @__PURE__ */ a(
158
+ Y,
159
159
  {
160
160
  serviceName: E.name,
161
- isDeleting: b,
161
+ isDeleting: M,
162
162
  onConfirm: g,
163
- onCancel: () => c(null)
163
+ onCancel: () => _(null)
164
164
  }
165
165
  )
166
166
  ]
167
167
  }
168
- ) : /* @__PURE__ */ i(
168
+ ) : /* @__PURE__ */ a(
169
169
  "div",
170
170
  {
171
171
  id: "all-appointment-service-no-view-privilege",
@@ -1,20 +1,20 @@
1
1
  import { jsx as r, jsxs as p } from "react/jsx-runtime";
2
- import { $ as f, a0 as O, a1 as P, a2 as V, a3 as X, a4 as ee, a5 as te, a6 as ie, D as ae, a7 as ne, u as Q, a8 as R, a9 as le, aa as re, ab as se, ac as U, ad as C, ae as F, af as Y, ag as k, ah as x, ai as $, Q as oe, L as de, C as q, aj as ce, I as me, ak as Ae, al as Ie, am as ue, S as _e, U as Te, Z as Le } from "./index-B6SqeItn.js";
2
+ import { _ as f, a0 as B, a1 as O, a2 as V, a3 as Z, a4 as ee, a5 as te, a6 as ie, v as ae, a7 as ne, u as Q, a8 as R, a9 as le, aa as re, ab as se, ac as U, ad as C, ae as F, af as Y, ag as x, ah as k, ai as $, Q as oe, L as de, t as q, aj as ce, C as me, ak as Ae, al as Ie, am as ue, I as _e, J as Te, T as Le } from "./index-Bu4bscFn.js";
3
3
  import { useState as g, useMemo as N, useEffect as h, useRef as ve, useCallback as E } from "react";
4
- import { useQuery as y, useQueryClient as Ne } from "@tanstack/react-query";
5
- const be = "Available for appointments", w = "Get Appointment Unavailability", pe = "Add Appointment Unavailability", G = "Appointment Location", De = () => {
4
+ import { useQuery as M, useQueryClient as Ne } from "@tanstack/react-query";
5
+ const be = "Available for appointments", w = "Get Appointment Unavailability", pe = "Add Appointment Unavailability", G = "Appointment Location", ye = () => {
6
6
  try {
7
- return X().uuid;
7
+ return Z().uuid;
8
8
  } catch {
9
9
  return "";
10
10
  }
11
11
  }, H = (e) => ({
12
12
  id: "",
13
13
  text: e
14
- }), Me = (e) => ({
14
+ }), De = (e) => ({
15
15
  display: e,
16
16
  uuid: ""
17
- }), ye = (e, a) => {
17
+ }), Me = (e, a) => {
18
18
  const n = e.map((t) => ({
19
19
  id: t.uuid,
20
20
  text: t.name,
@@ -39,17 +39,17 @@ const be = "Available for appointments", w = "Get Appointment Unavailability", p
39
39
  }, Ee = (e, a) => ({
40
40
  locationUuid: e.locationUuid,
41
41
  startDate: f(e.startDate, a, !1, V).formattedResult,
42
- startTime: P(
42
+ startTime: O(
43
43
  `${e.startTime} ${e.startTimePeriod}`
44
44
  ),
45
45
  endDate: f(e.endDate, a, !1, V).formattedResult,
46
- endTime: P(`${e.endTime} ${e.endTimePeriod}`)
46
+ endTime: O(`${e.endTime} ${e.endTimePeriod}`)
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 = O(
50
+ const o = B(
51
51
  `${e.startTime} ${e.startTimePeriod}`
52
- ), c = O(
52
+ ), c = B(
53
53
  `${e.endTime} ${e.endTimePeriod}`
54
54
  );
55
55
  o !== null && c !== null && c <= o && (n.dateTime = a("ADMIN_UNAVAILABILITY_DATETIME_ERROR_MESSAGE"));
@@ -91,14 +91,14 @@ const be = "Available for appointments", w = "Get Appointment Unavailability", p
91
91
  data: e,
92
92
  isLoading: a,
93
93
  isError: n
94
- } = y({
94
+ } = M({
95
95
  queryKey: ["currentUser"],
96
96
  queryFn: ee
97
97
  }), {
98
98
  data: t = [],
99
99
  isLoading: o,
100
100
  isError: c
101
- } = y({
101
+ } = M({
102
102
  queryKey: ["providerLoginLocations", e?.uuid],
103
103
  queryFn: async () => {
104
104
  const I = await te(
@@ -119,14 +119,14 @@ const be = "Available for appointments", w = "Get Appointment Unavailability", p
119
119
  data: A = [],
120
120
  isLoading: L,
121
121
  isError: m
122
- } = y({
122
+ } = M({
123
123
  queryKey: ["appointmentServices"],
124
124
  queryFn: ae
125
125
  }), {
126
126
  data: l = [],
127
127
  isLoading: s,
128
128
  isError: _
129
- } = y({
129
+ } = M({
130
130
  queryKey: ["providers"],
131
131
  queryFn: ne
132
132
  });
@@ -137,16 +137,16 @@ const be = "Available for appointments", w = "Get Appointment Unavailability", p
137
137
  isLoading: a || o || L || s,
138
138
  isError: n || c || m || _
139
139
  };
140
- }, Be = "UnavailabilityForm-module_formContent__WmNHR", Oe = "UnavailabilityForm-module_formField__8he7o", Pe = "UnavailabilityForm-module_loading__IDEY6", Ve = "UnavailabilityForm-module_error__jDeOm", Ce = "UnavailabilityForm-module_grid__t6NKR", Fe = "UnavailabilityForm-module_column__QFdnQ", Ye = "UnavailabilityForm-module_dateTimeColumn__6bi0F", ke = "UnavailabilityForm-module_datePicker__6HgbO", xe = "UnavailabilityForm-module_timePicker__DHNpK", d = {
141
- formContent: Be,
142
- formField: Oe,
143
- loading: Pe,
140
+ }, Pe = "UnavailabilityForm-module_formContent__WmNHR", Be = "UnavailabilityForm-module_formField__8he7o", Oe = "UnavailabilityForm-module_loading__IDEY6", Ve = "UnavailabilityForm-module_error__jDeOm", Ce = "UnavailabilityForm-module_grid__t6NKR", Fe = "UnavailabilityForm-module_column__QFdnQ", Ye = "UnavailabilityForm-module_dateTimeColumn__6bi0F", xe = "UnavailabilityForm-module_datePicker__6HgbO", ke = "UnavailabilityForm-module_timePicker__DHNpK", d = {
141
+ formContent: Pe,
142
+ formField: Be,
143
+ loading: Oe,
144
144
  error: Ve,
145
145
  grid: Ce,
146
146
  column: Fe,
147
147
  dateTimeColumn: Ye,
148
- datePicker: ke,
149
- timePicker: xe
148
+ datePicker: xe,
149
+ timePicker: ke
150
150
  }, $e = ({
151
151
  errors: e,
152
152
  formDataRef: a,
@@ -173,7 +173,7 @@ const be = "Available for appointments", w = "Get Appointment Unavailability", p
173
173
  ),
174
174
  [A]
175
175
  ), u = N(
176
- () => R(!1, !1, o, Me, {
176
+ () => R(!1, !1, o, De, {
177
177
  loading: "",
178
178
  error: "",
179
179
  empty: t("ADMIN_UNAVAILABILITY_FORM_NO_LOCATIONS")
@@ -183,7 +183,7 @@ const be = "Available for appointments", w = "Get Appointment Unavailability", p
183
183
  () => R(
184
184
  !1,
185
185
  !1,
186
- ye(
186
+ Me(
187
187
  _,
188
188
  t("ADMIN_UNAVAILABILITY_FORM_ALL_SERVICES")
189
189
  ),
@@ -195,7 +195,7 @@ const be = "Available for appointments", w = "Get Appointment Unavailability", p
195
195
  }
196
196
  ),
197
197
  [_]
198
- ), D = N(
198
+ ), y = N(
199
199
  () => R(
200
200
  !1,
201
201
  !1,
@@ -214,11 +214,11 @@ const be = "Available for appointments", w = "Get Appointment Unavailability", p
214
214
  );
215
215
  return h(() => {
216
216
  if (o.length === 0) return;
217
- const i = De(), b = o.some(
218
- (M) => M.uuid === i
217
+ const i = ye(), b = o.some(
218
+ (D) => D.uuid === i
219
219
  );
220
- s((M) => ({
221
- ...M,
220
+ s((D) => ({
221
+ ...D,
222
222
  locationUuid: b ? i : ""
223
223
  }));
224
224
  }, [o]), h(() => {
@@ -229,9 +229,9 @@ const be = "Available for appointments", w = "Get Appointment Unavailability", p
229
229
  }, [v]), h(() => {
230
230
  I.length > 0 && s((i) => ({
231
231
  ...i,
232
- selectedProviderItems: D
232
+ selectedProviderItems: y
233
233
  }));
234
- }, [D]), a.current = {
234
+ }, [y]), a.current = {
235
235
  ...l,
236
236
  filteredServicesCount: _.length,
237
237
  availableProvidersCount: I.length
@@ -327,7 +327,7 @@ const be = "Available for appointments", w = "Get Appointment Unavailability", p
327
327
  }
328
328
  ),
329
329
  /* @__PURE__ */ r(
330
- k,
330
+ x,
331
331
  {
332
332
  id: "start-time",
333
333
  "data-testid": "start-time-input",
@@ -342,7 +342,7 @@ const be = "Available for appointments", w = "Get Appointment Unavailability", p
342
342
  use24HourFormat: !1,
343
343
  className: d.timePicker,
344
344
  children: /* @__PURE__ */ p(
345
- x,
345
+ k,
346
346
  {
347
347
  id: "start-time-period",
348
348
  "data-testid": "start-time-period-select",
@@ -402,7 +402,7 @@ const be = "Available for appointments", w = "Get Appointment Unavailability", p
402
402
  }
403
403
  ),
404
404
  /* @__PURE__ */ r(
405
- k,
405
+ x,
406
406
  {
407
407
  id: "end-time",
408
408
  "data-testid": "end-time-input",
@@ -417,7 +417,7 @@ const be = "Available for appointments", w = "Get Appointment Unavailability", p
417
417
  use24HourFormat: !1,
418
418
  className: d.timePicker,
419
419
  children: /* @__PURE__ */ p(
420
- x,
420
+ k,
421
421
  {
422
422
  id: "end-time-period",
423
423
  "data-testid": "end-time-period-select",
@@ -484,7 +484,7 @@ const be = "Available for appointments", w = "Get Appointment Unavailability", p
484
484
  "data-testid": "provider-multiselect",
485
485
  titleText: t("ADMIN_UNAVAILABILITY_FORM_PROVIDER_LABEL"),
486
486
  placeholder: t("ADMIN_UNAVAILABILITY_FORM_PROVIDER_LABEL"),
487
- items: D,
487
+ items: y,
488
488
  itemToString: (i) => i?.text ?? "",
489
489
  selectedItems: l.selectedProviderItems,
490
490
  onChange: (i) => s({
@@ -510,7 +510,7 @@ const be = "Available for appointments", w = "Get Appointment Unavailability", p
510
510
  ), I = q(n, [
511
511
  pe,
512
512
  w
513
- ]), { data: u, isLoading: v, isError: D } = y({
513
+ ]), { data: u, isLoading: v, isError: y } = M({
514
514
  queryKey: ["appointmentUnavailabilities"],
515
515
  queryFn: ce,
516
516
  enabled: _
@@ -537,7 +537,7 @@ const be = "Available for appointments", w = "Get Appointment Unavailability", p
537
537
  key: "providerName",
538
538
  header: e("ADMIN_UNAVAILABILITY_COLUMN_PROVIDER")
539
539
  }
540
- ], [e]), M = N(() => u ? u.map((T) => fe(T, e)) : [], [u, e]), S = E(
540
+ ], [e]), D = N(() => u ? u.map((T) => fe(T, e)) : [], [u, e]), S = E(
541
541
  async (T) => {
542
542
  L(!0);
543
543
  try {
@@ -564,15 +564,15 @@ const be = "Available for appointments", w = "Get Appointment Unavailability", p
564
564
  if (!m.current) return;
565
565
  const T = ge(m.current, e);
566
566
  s(T), !(Object.keys(T).length > 0) && await S(Re(m.current, e));
567
- }, [e, S]), W = E(
567
+ }, [e, S]), z = E(
568
568
  (T) => {
569
- s((z) => {
570
- const B = { ...z };
571
- return T.forEach((J) => delete B[J]), B;
569
+ s((J) => {
570
+ const P = { ...J };
571
+ return T.forEach((X) => delete P[X]), P;
572
572
  });
573
573
  },
574
574
  []
575
- ), Z = E(() => {
575
+ ), W = E(() => {
576
576
  c(!1), m.current = null, s({});
577
577
  }, []);
578
578
  return /* @__PURE__ */ r(
@@ -595,10 +595,10 @@ const be = "Available for appointments", w = "Get Appointment Unavailability", p
595
595
  "aria-label": "appointment-unavailability-actions-table-aria-label",
596
596
  title: e("ADMIN_UNAVAILABILITY_TITLE"),
597
597
  headers: b,
598
- rows: M,
598
+ rows: D,
599
599
  ariaLabel: "unavailability-table",
600
600
  loading: v,
601
- errorStateMessage: D ? e("ADMIN_UNAVAILABILITY_ERROR_MESSAGE") : null,
601
+ errorStateMessage: y ? e("ADMIN_UNAVAILABILITY_ERROR_MESSAGE") : null,
602
602
  emptyStateMessage: e("ADMIN_UNAVAILABILITY_EMPTY_MESSAGE"),
603
603
  actionButton: !o && I ? {
604
604
  label: e("ADMIN_UNAVAILABILITY_ADD_BUTTON"),
@@ -619,14 +619,14 @@ const be = "Available for appointments", w = "Get Appointment Unavailability", p
619
619
  onPrimaryButtonClick: j,
620
620
  isPrimaryButtonDisabled: A,
621
621
  secondaryButtonText: e("ADMIN_UNAVAILABILITY_FORM_CANCEL"),
622
- onSecondaryButtonClick: Z,
622
+ onSecondaryButtonClick: W,
623
623
  isSecondaryButtonDisabled: A,
624
624
  content: /* @__PURE__ */ r(
625
625
  $e,
626
626
  {
627
627
  errors: l,
628
628
  formDataRef: m,
629
- onClearErrors: W
629
+ onClearErrors: z
630
630
  }
631
631
  )
632
632
  }
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { b9 as t } from "./index-B6SqeItn.js";
1
+ import { b9 as t } from "./index-Bu4bscFn.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.383",
3
+ "version": "0.0.1-dev.385",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",