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

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.
Files changed (29) hide show
  1. package/dist/{DocumentsTable-CnklBHjw-D3MuxzAH.js → DocumentsTable-B5KzNxpE-CUSNylHl.js} +1 -1
  2. package/dist/{FormsTable-CBcQZdmr-fYW9hpOP.js → FormsTable-E-Ya0wBK-IfmNlxVm.js} +12 -12
  3. package/dist/{LNWAZHJI-DWbcRFOv.js → LNWAZHJI-DR-n1eVc.js} +2 -2
  4. package/dist/{MWZ6AO7Z-p0JMkR7J.js → MWZ6AO7Z-emQ-_7WP.js} +2 -2
  5. package/dist/{Observations-C7p_jHRY-CXwe8c7S.js → Observations-DO36Czp5-BRurfsiy.js} +6 -6
  6. package/dist/{YPM2AS64-CIix-ijy.js → YPM2AS64-3NniT021.js} +1 -1
  7. package/dist/{index-C7V0cO9R.js → index-4jqbsDOS.js} +18 -18
  8. package/dist/index-BXvg2o0e.js +630 -0
  9. package/dist/{index-DtJvSxJc.js → index-Dd5zlHOS.js} +68446 -62948
  10. package/dist/index.css +1 -1
  11. package/dist/index.js +1 -1
  12. package/dist/locales/locale_en.json +43 -0
  13. package/dist/locales/locale_es.json +44 -0
  14. package/dist/pages/admin/appointmentUnavailability/__mocks__/unavailabilityMock.d.ts +23 -0
  15. package/dist/pages/admin/appointmentUnavailability/__mocks__/unavailabilityMock.d.ts.map +1 -0
  16. package/dist/pages/admin/appointmentUnavailability/components/UnavailabilityForm.d.ts +10 -0
  17. package/dist/pages/admin/appointmentUnavailability/components/UnavailabilityForm.d.ts.map +1 -0
  18. package/dist/pages/admin/appointmentUnavailability/constants.d.ts +5 -0
  19. package/dist/pages/admin/appointmentUnavailability/constants.d.ts.map +1 -0
  20. package/dist/pages/admin/appointmentUnavailability/hook.d.ts +10 -0
  21. package/dist/pages/admin/appointmentUnavailability/hook.d.ts.map +1 -0
  22. package/dist/pages/admin/appointmentUnavailability/index.d.ts +4 -0
  23. package/dist/pages/admin/appointmentUnavailability/index.d.ts.map +1 -0
  24. package/dist/pages/admin/appointmentUnavailability/models.d.ts +46 -0
  25. package/dist/pages/admin/appointmentUnavailability/models.d.ts.map +1 -0
  26. package/dist/pages/admin/appointmentUnavailability/utils.d.ts +23 -0
  27. package/dist/pages/admin/appointmentUnavailability/utils.d.ts.map +1 -0
  28. package/dist/routes/index.d.ts.map +1 -1
  29. package/package.json +1 -1
@@ -0,0 +1,630 @@
1
+ import { jsx as s, jsxs as p } from "react/jsx-runtime";
2
+ import { T as g, S, U as B, V as P, a0 as Z, b, a1 as ee, a2 as te, a3 as ie, Q as ae, a4 as ne, u as K, a5 as U, a6 as re, a7 as se, a8 as le, a9 as y, aa as O, ab as V, ac as C, ad as F, ae as Y, af as x, g as de, q as oe, a as ce, z as k, s as me, ag as Ae, ah as Ie, ai as ue, t as _e, C as Te, aj as Le } from "./index-Dd5zlHOS.js";
3
+ import { useState as h, useMemo as N, useEffect as $, useRef as ve, useCallback as E } from "react";
4
+ const Ne = "Available for appointments", q = "Get Appointment Unavailability", pe = "Add Appointment Unavailability", G = "Appointment Location", Me = () => {
5
+ try {
6
+ return Z().uuid;
7
+ } catch {
8
+ return "";
9
+ }
10
+ }, w = (e) => ({
11
+ id: "",
12
+ text: e
13
+ }), be = (e) => ({
14
+ display: e,
15
+ uuid: ""
16
+ }), De = (e, a) => {
17
+ const n = e.map((t) => ({
18
+ id: t.uuid,
19
+ text: t.name,
20
+ originalItem: t
21
+ }));
22
+ return n.length > 0 && n.push({
23
+ id: "select-all-services",
24
+ text: a,
25
+ isSelectAll: !0
26
+ }), n;
27
+ }, ye = (e, a) => {
28
+ const n = e.map((t) => ({
29
+ id: t.uuid,
30
+ text: t.person?.display,
31
+ originalItem: t
32
+ }));
33
+ return n.length > 0 && n.push({
34
+ id: "select-all-providers",
35
+ text: a,
36
+ isSelectAll: !0
37
+ }), n;
38
+ }, Ee = (e, a) => ({
39
+ locationUuid: e.locationUuid,
40
+ startDate: g(e.startDate, a, !1, P).formattedResult,
41
+ startTime: B(
42
+ `${e.startTime} ${e.startTimePeriod}`
43
+ ),
44
+ endDate: g(e.endDate, a, !1, P).formattedResult,
45
+ endTime: B(`${e.endTime} ${e.endTimePeriod}`)
46
+ }), he = (e, a) => {
47
+ const n = {}, t = a("ADMIN_UNAVAILABILITY_FORM_REQUIRED");
48
+ 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()) {
49
+ const d = S(
50
+ `${e.startTime} ${e.startTimePeriod}`
51
+ ), c = S(
52
+ `${e.endTime} ${e.endTimePeriod}`
53
+ );
54
+ d !== null && c !== null && c <= d && (n.dateTime = a("ADMIN_UNAVAILABILITY_DATETIME_ERROR_MESSAGE"));
55
+ }
56
+ return n;
57
+ }, ge = (e, a) => ({
58
+ id: e.uuid,
59
+ startDateTime: g(`${e.startDate}T${e.startTime}`, a, !0).formattedResult,
60
+ endDateTime: g(`${e.endDate}T${e.endTime}`, a, !0).formattedResult,
61
+ locationName: e.location.name,
62
+ appointmentServiceName: e.service?.name ?? a("ADMIN_UNAVAILABILITY_ALL"),
63
+ providerName: e.provider?.name ?? a("ADMIN_UNAVAILABILITY_ALL")
64
+ }), H = (e) => e.filter((a) => !a.isSelectAll).map((a) => a.id), Ue = (e, a) => {
65
+ const n = Ee(
66
+ {
67
+ locationUuid: e.locationUuid,
68
+ startDate: e.startDate,
69
+ startTime: e.startTime,
70
+ startTimePeriod: e.startTimePeriod,
71
+ endDate: e.endDate,
72
+ endTime: e.endTime,
73
+ endTimePeriod: e.endTimePeriod
74
+ },
75
+ a
76
+ ), t = H(e.selectedServiceItems), d = H(e.selectedProviderItems), A = t.length === e.filteredServicesCount || t.length === 0 ? [void 0] : t, m = d.length === e.availableProvidersCount || d.length === 0 ? [void 0] : d;
77
+ return A.flatMap(
78
+ (r) => m.map((l) => ({
79
+ ...n,
80
+ appointmentServiceUuid: r,
81
+ providerUuid: l
82
+ }))
83
+ );
84
+ }, fe = (e) => !e.entry || e.entry.length === 0 ? [] : e.entry.map((a) => ({
85
+ uuid: a.resource?.id ?? "",
86
+ display: a.resource?.name ?? "",
87
+ childLocations: []
88
+ })), Re = () => {
89
+ const {
90
+ data: e,
91
+ isLoading: a,
92
+ isError: n
93
+ } = b({
94
+ queryKey: ["currentUser"],
95
+ queryFn: ee
96
+ }), {
97
+ data: t = [],
98
+ isLoading: d,
99
+ isError: c
100
+ } = b({
101
+ queryKey: ["providerLoginLocations", e?.uuid],
102
+ queryFn: async () => {
103
+ const I = await te(
104
+ e.uuid
105
+ );
106
+ if (I.length === 0) {
107
+ const u = await ie(
108
+ G
109
+ );
110
+ return fe(u);
111
+ }
112
+ return I.filter(
113
+ (u) => u.tags?.some((v) => v.display === G)
114
+ );
115
+ },
116
+ enabled: !!e?.uuid
117
+ }), {
118
+ data: A = [],
119
+ isLoading: L,
120
+ isError: m
121
+ } = b({
122
+ queryKey: ["appointmentServices"],
123
+ queryFn: ae
124
+ }), {
125
+ data: r = [],
126
+ isLoading: l,
127
+ isError: _
128
+ } = b({
129
+ queryKey: ["providers"],
130
+ queryFn: ne
131
+ });
132
+ return {
133
+ loginLocations: t,
134
+ services: A,
135
+ providers: r,
136
+ isLoading: a || d || L || l,
137
+ isError: n || c || m || _
138
+ };
139
+ }, Se = "_formContent_1huph_1", Be = "_formField_1huph_7", Pe = "_loading_1huph_12", Oe = "_error_1huph_16", Ve = "_grid_1huph_27", Ce = "_column_1huph_31", Fe = "_dateTimeColumn_1huph_36", Ye = "_datePicker_1huph_41", xe = "_timePicker_1huph_55", o = {
140
+ formContent: Se,
141
+ formField: Be,
142
+ loading: Pe,
143
+ error: Oe,
144
+ grid: Ve,
145
+ column: Ce,
146
+ dateTimeColumn: Fe,
147
+ datePicker: Ye,
148
+ timePicker: xe
149
+ }, ke = ({
150
+ errors: e,
151
+ formDataRef: a,
152
+ onClearErrors: n
153
+ }) => {
154
+ const { t } = K(), { loginLocations: d, services: c, providers: A, isLoading: L, isError: m } = Re(), [r, l] = h({
155
+ locationUuid: Me(),
156
+ selectedServiceItems: [],
157
+ selectedProviderItems: [],
158
+ startDate: null,
159
+ startTime: "",
160
+ startTimePeriod: "AM",
161
+ endDate: null,
162
+ endTime: "",
163
+ endTimePeriod: "AM"
164
+ }), _ = N(
165
+ () => c.filter((i) => i.location?.uuid === r.locationUuid),
166
+ [c, r.locationUuid]
167
+ ), I = N(
168
+ () => A.filter(
169
+ (i) => i.attributes?.some(
170
+ (D) => D.attributeType?.display === Ne && D.value
171
+ )
172
+ ),
173
+ [A]
174
+ ), u = N(
175
+ () => U(!1, !1, d, be, {
176
+ loading: "",
177
+ error: "",
178
+ empty: t("ADMIN_UNAVAILABILITY_FORM_NO_LOCATIONS")
179
+ }),
180
+ [d]
181
+ ), v = N(
182
+ () => U(
183
+ !1,
184
+ !1,
185
+ De(
186
+ _,
187
+ t("ADMIN_UNAVAILABILITY_FORM_ALL_SERVICES")
188
+ ),
189
+ w,
190
+ {
191
+ loading: "",
192
+ error: "",
193
+ empty: t("ADMIN_UNAVAILABILITY_FORM_NO_SERVICES")
194
+ }
195
+ ),
196
+ [_]
197
+ ), M = N(
198
+ () => U(
199
+ !1,
200
+ !1,
201
+ ye(
202
+ I,
203
+ t("ADMIN_UNAVAILABILITY_FORM_ALL_PROVIDERS")
204
+ ),
205
+ w,
206
+ {
207
+ loading: "",
208
+ error: "",
209
+ empty: t("ADMIN_UNAVAILABILITY_FORM_NO_PROVIDERS")
210
+ }
211
+ ),
212
+ [I]
213
+ );
214
+ return $(() => {
215
+ _.length > 0 && l((i) => ({
216
+ ...i,
217
+ selectedServiceItems: v
218
+ }));
219
+ }, [v]), $(() => {
220
+ I.length > 0 && l((i) => ({
221
+ ...i,
222
+ selectedProviderItems: M
223
+ }));
224
+ }, [M]), a.current = {
225
+ ...r,
226
+ filteredServicesCount: _.length,
227
+ availableProvidersCount: I.length
228
+ }, L ? /* @__PURE__ */ s(
229
+ "div",
230
+ {
231
+ "data-testid": "unavailability-form-skeleton",
232
+ className: o.formContent,
233
+ children: /* @__PURE__ */ s(re, { type: "multi", className: o.loading })
234
+ }
235
+ ) : m ? /* @__PURE__ */ s(
236
+ "div",
237
+ {
238
+ id: "unavailability-form-error",
239
+ "data-testid": "unavailability-form-error",
240
+ className: o.error,
241
+ children: t("ADMIN_UNAVAILABILITY_FORM_LOAD_ERROR_MESSAGE")
242
+ }
243
+ ) : /* @__PURE__ */ p(
244
+ "div",
245
+ {
246
+ id: "unavailability-form-content",
247
+ "data-testid": "unavailability-form-content-test-id",
248
+ "aria-label": "unavailability-form-content-aria-label",
249
+ className: o.formContent,
250
+ children: [
251
+ /* @__PURE__ */ s("div", { className: o.formField, children: /* @__PURE__ */ s(
252
+ se,
253
+ {
254
+ id: "location-dropdown",
255
+ "data-testid": "location-dropdown",
256
+ label: t("ADMIN_UNAVAILABILITY_FORM_LOCATION_LABEL"),
257
+ titleText: t("ADMIN_UNAVAILABILITY_FORM_LOCATION_LABEL"),
258
+ items: u,
259
+ itemToString: (i) => i?.display ?? "",
260
+ selectedItem: r.locationUuid ? d.find(
261
+ (i) => i.uuid === r.locationUuid
262
+ ) ?? null : null,
263
+ onChange: (i) => {
264
+ n(["location"]), l({
265
+ ...r,
266
+ locationUuid: i.selectedItem?.uuid ?? "",
267
+ selectedServiceItems: []
268
+ });
269
+ },
270
+ invalid: !!e.location,
271
+ invalidText: e.location
272
+ }
273
+ ) }),
274
+ /* @__PURE__ */ p(
275
+ le,
276
+ {
277
+ id: "unavailability-form-grid",
278
+ "data-testid": "unavailability-form-grid-test-id",
279
+ "aria-label": "unavailability-form-grid-aria-label",
280
+ className: o.grid,
281
+ children: [
282
+ /* @__PURE__ */ p(
283
+ y,
284
+ {
285
+ id: "unavailability-form-start-date-time",
286
+ "data-testid": "unavailability-form-start-date-time-test-id",
287
+ "aria-label": "unavailability-form-start-date-time-aria-label",
288
+ sm: 2,
289
+ md: 4,
290
+ lg: 8,
291
+ className: `${o.column} ${o.dateTimeColumn}`,
292
+ children: [
293
+ /* @__PURE__ */ s(
294
+ O,
295
+ {
296
+ datePickerType: "single",
297
+ minDate: V(),
298
+ value: r.startDate ?? void 0,
299
+ onChange: (i) => {
300
+ i[0] && (n(["startDate", "dateTime"]), l({
301
+ ...r,
302
+ startDate: i[0]
303
+ }));
304
+ },
305
+ className: o.datePicker,
306
+ children: /* @__PURE__ */ s(
307
+ C,
308
+ {
309
+ id: "start-date",
310
+ "data-testid": "start-date-input",
311
+ labelText: t("ADMIN_UNAVAILABILITY_FORM_START_DATE_LABEL"),
312
+ placeholder: t("ADMIN_UNAVAILABILITY_FORM_DATE_PLACEHOLDER"),
313
+ invalid: !!e.startDate,
314
+ invalidText: e.startDate
315
+ }
316
+ )
317
+ }
318
+ ),
319
+ /* @__PURE__ */ s(
320
+ F,
321
+ {
322
+ id: "start-time",
323
+ "data-testid": "start-time-input",
324
+ labelText: t("ADMIN_UNAVAILABILITY_FORM_START_TIME_LABEL"),
325
+ onChange: (i) => {
326
+ n(["startTime", "dateTime"]), l({ ...r, startTime: i.target.value });
327
+ },
328
+ invalid: !!e.startTime,
329
+ invalidText: e.startTime,
330
+ placeholder: "hh:mm",
331
+ pattern: "(1[012]|[0-9]):[0-5][0-9]",
332
+ use24HourFormat: !1,
333
+ className: o.timePicker,
334
+ children: /* @__PURE__ */ p(
335
+ Y,
336
+ {
337
+ id: "start-time-period",
338
+ "data-testid": "start-time-period-select",
339
+ onChange: (i) => {
340
+ n(["dateTime"]), l({
341
+ ...r,
342
+ startTimePeriod: i.target.value
343
+ });
344
+ },
345
+ value: r.startTimePeriod,
346
+ children: [
347
+ /* @__PURE__ */ s("option", { value: "AM", children: t("ADMIN_UNAVAILABILITY_AM") }),
348
+ /* @__PURE__ */ s("option", { value: "PM", children: t("ADMIN_UNAVAILABILITY_PM") })
349
+ ]
350
+ }
351
+ )
352
+ }
353
+ )
354
+ ]
355
+ }
356
+ ),
357
+ /* @__PURE__ */ p(
358
+ y,
359
+ {
360
+ id: "unavailability-form-end-date-time",
361
+ "data-testid": "unavailability-form-end-date-time-test-id",
362
+ "aria-label": "unavailability-form-end-date-time-aria-label",
363
+ sm: 2,
364
+ md: 4,
365
+ lg: 8,
366
+ className: `${o.column} ${o.dateTimeColumn}`,
367
+ children: [
368
+ /* @__PURE__ */ s(
369
+ O,
370
+ {
371
+ datePickerType: "single",
372
+ minDate: r.startDate ?? V(),
373
+ value: r.endDate ?? void 0,
374
+ onChange: (i) => {
375
+ i[0] && (n(["endDate", "dateTime"]), l({
376
+ ...r,
377
+ endDate: i[0]
378
+ }));
379
+ },
380
+ className: o.datePicker,
381
+ children: /* @__PURE__ */ s(
382
+ C,
383
+ {
384
+ id: "end-date",
385
+ "data-testid": "end-date-input",
386
+ labelText: t("ADMIN_UNAVAILABILITY_FORM_END_DATE_LABEL"),
387
+ placeholder: t("ADMIN_UNAVAILABILITY_FORM_DATE_PLACEHOLDER"),
388
+ invalid: !!e.endDate,
389
+ invalidText: e.endDate
390
+ }
391
+ )
392
+ }
393
+ ),
394
+ /* @__PURE__ */ s(
395
+ F,
396
+ {
397
+ id: "end-time",
398
+ "data-testid": "end-time-input",
399
+ labelText: t("ADMIN_UNAVAILABILITY_FORM_END_TIME_LABEL"),
400
+ onChange: (i) => {
401
+ n(["endTime", "dateTime"]), l({ ...r, endTime: i.target.value });
402
+ },
403
+ invalid: !!(e.endTime ?? e.dateTime),
404
+ invalidText: e.dateTime ?? e.endTime,
405
+ placeholder: "hh:mm",
406
+ pattern: "(1[012]|[0-9]):[0-5][0-9]",
407
+ use24HourFormat: !1,
408
+ className: o.timePicker,
409
+ children: /* @__PURE__ */ p(
410
+ Y,
411
+ {
412
+ id: "end-time-period",
413
+ "data-testid": "end-time-period-select",
414
+ onChange: (i) => {
415
+ n(["dateTime"]), l({
416
+ ...r,
417
+ endTimePeriod: i.target.value
418
+ });
419
+ },
420
+ value: r.endTimePeriod,
421
+ children: [
422
+ /* @__PURE__ */ s("option", { value: "AM", children: t("ADMIN_UNAVAILABILITY_AM") }),
423
+ /* @__PURE__ */ s("option", { value: "PM", children: t("ADMIN_UNAVAILABILITY_PM") })
424
+ ]
425
+ }
426
+ )
427
+ }
428
+ )
429
+ ]
430
+ }
431
+ ),
432
+ /* @__PURE__ */ s(
433
+ y,
434
+ {
435
+ id: "unavailability-form-service",
436
+ "data-testid": "unavailability-form-service-test-id",
437
+ "aria-label": "unavailability-form-service-aria-label",
438
+ sm: 2,
439
+ md: 4,
440
+ lg: 8,
441
+ className: o.column,
442
+ children: /* @__PURE__ */ s(
443
+ x,
444
+ {
445
+ id: "service-multiselect",
446
+ "data-testid": "service-multiselect",
447
+ titleText: t("ADMIN_UNAVAILABILITY_FORM_SERVICE_LABEL"),
448
+ placeholder: t("ADMIN_UNAVAILABILITY_FORM_SERVICE_LABEL"),
449
+ items: v,
450
+ itemToString: (i) => i?.text ?? "",
451
+ selectedItems: r.selectedServiceItems,
452
+ onChange: (i) => l({
453
+ ...r,
454
+ selectedServiceItems: i.selectedItems
455
+ })
456
+ }
457
+ )
458
+ }
459
+ ),
460
+ /* @__PURE__ */ s(
461
+ y,
462
+ {
463
+ id: "unavailability-form-provider",
464
+ "data-testid": "unavailability-form-provider-test-id",
465
+ "aria-label": "unavailability-form-provider-aria-label",
466
+ sm: 2,
467
+ md: 4,
468
+ lg: 8,
469
+ className: o.column,
470
+ children: /* @__PURE__ */ s(
471
+ x,
472
+ {
473
+ id: "provider-multiselect",
474
+ "data-testid": "provider-multiselect",
475
+ titleText: t("ADMIN_UNAVAILABILITY_FORM_PROVIDER_LABEL"),
476
+ placeholder: t("ADMIN_UNAVAILABILITY_FORM_PROVIDER_LABEL"),
477
+ items: M,
478
+ itemToString: (i) => i?.text ?? "",
479
+ selectedItems: r.selectedProviderItems,
480
+ onChange: (i) => l({
481
+ ...r,
482
+ selectedProviderItems: i.selectedItems
483
+ })
484
+ }
485
+ )
486
+ }
487
+ )
488
+ ]
489
+ }
490
+ )
491
+ ]
492
+ }
493
+ );
494
+ }, $e = "_page_8pcnh_1", qe = {
495
+ page: $e
496
+ }, Ke = () => {
497
+ const { t: e } = K(), a = de(), { userPrivileges: n } = oe(), { addNotification: t } = ce(), [d, c] = h(!1), [A, L] = h(!1), m = ve(null), [r, l] = h({}), _ = k(
498
+ n,
499
+ q
500
+ ), I = k(n, [
501
+ pe,
502
+ q
503
+ ]), { data: u, isLoading: v, isError: M } = b({
504
+ queryKey: ["appointmentUnavailabilities"],
505
+ queryFn: Le,
506
+ enabled: _
507
+ }), i = [
508
+ { id: "home", label: e("BREADCRUMB_HOME"), href: me },
509
+ {
510
+ id: "appointments",
511
+ label: e("BREADCRUMB_APPOINTMENTS"),
512
+ href: "/appointments"
513
+ },
514
+ { id: "admin", label: e("BREADCRUMB_ADMIN"), isCurrentPage: !0 }
515
+ ], D = N(() => [
516
+ { key: "startDateTime", header: e("ADMIN_UNAVAILABILITY_COLUMN_START") },
517
+ { key: "endDateTime", header: e("ADMIN_UNAVAILABILITY_COLUMN_END") },
518
+ {
519
+ key: "locationName",
520
+ header: e("ADMIN_UNAVAILABILITY_COLUMN_LOCATION")
521
+ },
522
+ {
523
+ key: "appointmentServiceName",
524
+ header: e("ADMIN_UNAVAILABILITY_COLUMN_SERVICE")
525
+ },
526
+ {
527
+ key: "providerName",
528
+ header: e("ADMIN_UNAVAILABILITY_COLUMN_PROVIDER")
529
+ }
530
+ ], [e]), Q = N(() => u ? u.map((T) => ge(T, e)) : [], [u, e]), f = E(
531
+ async (T) => {
532
+ L(!0);
533
+ try {
534
+ await Ae(T), t({
535
+ title: e("ADMIN_UNAVAILABILITY_FORM_SUCCESS_TITLE"),
536
+ message: e("ADMIN_UNAVAILABILITY_FORM_SUCCESS_MESSAGE"),
537
+ type: "success",
538
+ timeout: 5e3
539
+ }), c(!1), a.invalidateQueries({
540
+ queryKey: ["appointmentUnavailabilities"]
541
+ });
542
+ } catch {
543
+ t({
544
+ title: e("ADMIN_UNAVAILABILITY_FORM_ERROR_TITLE"),
545
+ message: e("ADMIN_UNAVAILABILITY_FORM_ERROR_MESSAGE"),
546
+ type: "error"
547
+ });
548
+ } finally {
549
+ L(!1);
550
+ }
551
+ },
552
+ [t, a, e]
553
+ ), j = E(async () => {
554
+ if (!m.current) return;
555
+ const T = he(m.current, e);
556
+ l(T), !(Object.keys(T).length > 0) && await f(Ue(m.current, e));
557
+ }, [e, f]), z = E(
558
+ (T) => {
559
+ l((J) => {
560
+ const R = { ...J };
561
+ return T.forEach((X) => delete R[X]), R;
562
+ });
563
+ },
564
+ []
565
+ ), W = E(() => {
566
+ c(!1), m.current = null, l({});
567
+ }, []);
568
+ return /* @__PURE__ */ s(
569
+ Ie,
570
+ {
571
+ headerWSideNav: /* @__PURE__ */ s(Te, { breadcrumbItems: i }),
572
+ hasSideNav: !1,
573
+ mainDisplay: /* @__PURE__ */ s(
574
+ "div",
575
+ {
576
+ id: "appointment-unavailability-page",
577
+ "data-testid": "appointment-unavailability-page-test-id",
578
+ "aria-label": "appointment-unavailability-page-aria-label",
579
+ className: qe.page,
580
+ children: /* @__PURE__ */ s(
581
+ _e,
582
+ {
583
+ id: "appointment-unavailability-actions-table",
584
+ "data-testid": "appointment-unavailability-actions-table-test-id",
585
+ "aria-label": "appointment-unavailability-actions-table-aria-label",
586
+ title: e("ADMIN_UNAVAILABILITY_TITLE"),
587
+ headers: D,
588
+ rows: Q,
589
+ ariaLabel: "unavailability-table",
590
+ loading: v,
591
+ errorStateMessage: M ? e("ADMIN_UNAVAILABILITY_ERROR_MESSAGE") : null,
592
+ emptyStateMessage: e("ADMIN_UNAVAILABILITY_EMPTY_MESSAGE"),
593
+ actionButton: !d && I ? {
594
+ label: e("ADMIN_UNAVAILABILITY_ADD_BUTTON"),
595
+ onClick: () => c(!0),
596
+ props: { id: "add-unavailability-btn", kind: "primary" }
597
+ } : void 0
598
+ }
599
+ )
600
+ }
601
+ ),
602
+ actionArea: d && /* @__PURE__ */ s(
603
+ ue,
604
+ {
605
+ "data-testid": "appointment-unavailability-form-panel-test-id",
606
+ "aria-label": "appointment-unavailability-form-panel-aria-label",
607
+ title: e("ADMIN_UNAVAILABILITY_FORM_TITLE"),
608
+ primaryButtonText: e("ADMIN_UNAVAILABILITY_FORM_ADD"),
609
+ onPrimaryButtonClick: j,
610
+ isPrimaryButtonDisabled: A,
611
+ secondaryButtonText: e("ADMIN_UNAVAILABILITY_FORM_CANCEL"),
612
+ onSecondaryButtonClick: W,
613
+ isSecondaryButtonDisabled: A,
614
+ content: /* @__PURE__ */ s(
615
+ ke,
616
+ {
617
+ errors: r,
618
+ formDataRef: m,
619
+ onClearErrors: z
620
+ }
621
+ )
622
+ }
623
+ ),
624
+ isActionAreaVisible: d
625
+ }
626
+ );
627
+ };
628
+ export {
629
+ Ke as default
630
+ };