@bahmni/reports-app 0.0.1-dev.450 → 0.0.1-dev.452

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,11 +1,11 @@
1
1
  import { jsx as a, jsxs as m, Fragment as H } from "react/jsx-runtime";
2
- import { E as W, F as se, L as oe, M as ie, N as le, O as de, P as Re, Q as ce, S as Y, u as C, z as X, T as N, V as F, X as M, Z as _e, $ as Te, a0 as pe, a1 as x, k as ue, a2 as me, a3 as Ee, a4 as q, a5 as Se, a6 as U, a7 as fe, a8 as Oe, a9 as ge, aa as Pe, ab as $, ac as Ae, ad as j, ae as he, af as De } from "./index-CRUk3_DP.js";
3
- import Le, { useCallback as K, useState as A, useEffect as V, useMemo as y } from "react";
2
+ import { G as z, L as se, O as oe, P as ie, V as le, _ as de, a0 as Re, a1 as ce, a2 as Y, u as b, z as X, a3 as y, a4 as F, a5 as M, a6 as _e, a7 as Te, a8 as pe, a9 as x, Z as ue, aa as me, ab as Ee, ac as q, ad as Se, ae as U, af as fe, ag as Oe, ah as Pe, ai as ge, aj as $, ak as he, al as j, am as Ae, an as De } from "./index-B_1boRXC.js";
3
+ import Le, { useCallback as K, useState as h, useEffect as V, useMemo as N } from "react";
4
4
  import { useQuery as J } from "@tanstack/react-query";
5
- import { useLocation as be, useNavigate as Ce } from "react-router-dom";
6
- const ye = "http://json-schema.org/draft-07/schema#", Ne = "Reports App Configuration", Fe = "object", ve = { config: { type: "object", properties: { supportedFormats: { type: "array", items: { type: "string" }, description: "List of supported report formats" }, paperSize: { type: "string", description: "Default paper size for generated reports (e.g., A4)" } }, additionalProperties: !0 } }, Ie = !0, Be = {
7
- $schema: ye,
8
- title: Ne,
5
+ import { useLocation as Ce, useNavigate as be } from "react-router-dom";
6
+ const Ne = "http://json-schema.org/draft-07/schema#", ye = "Reports App Configuration", Fe = "object", ve = { config: { type: "object", properties: { supportedFormats: { type: "array", items: { type: "string" }, description: "List of supported report formats" }, paperSize: { type: "string", description: "Default paper size for generated reports (e.g., A4)" } }, additionalProperties: !0 } }, Ie = !0, Be = {
7
+ $schema: Ne,
8
+ title: ye,
9
9
  type: Fe,
10
10
  properties: ve,
11
11
  additionalProperties: Ie
@@ -31,7 +31,7 @@ const ye = "http://json-schema.org/draft-07/schema#", Ne = "Reports App Configur
31
31
  queryKey: Q.reportsAppConfig,
32
32
  queryFn: async () => {
33
33
  try {
34
- return await W(
34
+ return await z(
35
35
  se,
36
36
  Be
37
37
  );
@@ -46,7 +46,7 @@ const ye = "http://json-schema.org/draft-07/schema#", Ne = "Reports App Configur
46
46
  additionalProperties: $e
47
47
  }, ke = () => J({
48
48
  queryKey: Q.reportsConfig,
49
- queryFn: () => W(oe, je),
49
+ queryFn: () => z(oe, je),
50
50
  retry: !1
51
51
  }), k = Symbol.for("constructDateFrom");
52
52
  function Z(e, t) {
@@ -59,27 +59,27 @@ function Ge(e, t, s) {
59
59
  const d = ee(e);
60
60
  return isNaN(t) ? Z(e, NaN) : (d.setDate(d.getDate() + t), d);
61
61
  }
62
- function ze(e, t) {
62
+ function We(e, t) {
63
63
  const s = ee(e);
64
64
  return s.setDate(1), s.setHours(0, 0, 0, 0), s;
65
65
  }
66
- function We(e, t, s) {
66
+ function ze(e, t, s) {
67
67
  return Ge(e, -6);
68
68
  }
69
69
  const Xe = (e, t) => t ? de(e, t) : !0, Ke = (e, t) => e.filter(
70
70
  (s) => Xe(t, s.requiredPrivilege)
71
- ), b = (e) => e.config?.dateRangeRequired !== !1, Ve = (e) => ({
72
- dateRangeReports: e.filter(b),
73
- noDateRangeReports: e.filter((t) => !b(t))
71
+ ), C = (e) => e.config?.dateRangeRequired !== !1, Ve = (e) => ({
72
+ dateRangeReports: e.filter(C),
73
+ noDateRangeReports: e.filter((t) => !C(t))
74
74
  }), Je = (e) => !e || e.length === 0 ? ie : e.map(
75
75
  (s) => s.toUpperCase()
76
76
  ).filter((s) => s in le), Qe = (e) => {
77
77
  const t = /* @__PURE__ */ new Date();
78
78
  switch (e) {
79
79
  case "THIS_MONTH":
80
- return [ze(t), t];
81
- case "LAST_7_DAYS":
82
80
  return [We(t), t];
81
+ case "LAST_7_DAYS":
82
+ return [ze(t), t];
83
83
  default:
84
84
  return [new Date(t), new Date(t)];
85
85
  }
@@ -129,7 +129,7 @@ const Xe = (e, t) => t ? de(e, t) : !0, Ke = (e, t) => e.filter(
129
129
  },
130
130
  []
131
131
  ) }), at = (e, t, s) => {
132
- const { t: d } = C(), { addNotification: n } = X(), { runReport: _ } = tt(), [R, u] = A({}), [f, p] = A({}), [g, i] = A(null);
132
+ const { t: d } = b(), { addNotification: n } = X(), { runReport: _ } = tt(), [R, u] = h({}), [f, p] = h({}), [P, i] = h(null);
133
133
  V(() => {
134
134
  u({}), p({});
135
135
  }, [t.version]);
@@ -141,7 +141,7 @@ const Xe = (e, t) => t ? de(e, t) : !0, Ke = (e, t) => e.filter(
141
141
  return {
142
142
  rowFilters: r,
143
143
  errors: (o) => f[o],
144
- isRunning: (o) => g === o,
144
+ isRunning: (o) => P === o,
145
145
  updateRow: (o, l) => u((c) => ({
146
146
  ...c,
147
147
  [o]: { ...r(o), ...l }
@@ -155,12 +155,12 @@ const Xe = (e, t) => t ? de(e, t) : !0, Ke = (e, t) => e.filter(
155
155
  const l = r(o.id), c = Ze(
156
156
  {
157
157
  report: o,
158
- requiresDateRange: b(o),
158
+ requiresDateRange: C(o),
159
159
  format: l.format,
160
160
  startDate: l.startDate,
161
161
  endDate: l.endDate
162
162
  },
163
- (T, P) => d(T, { defaultValue: T, ...P })
163
+ (T, g) => d(T, { defaultValue: T, ...g })
164
164
  );
165
165
  if (c) {
166
166
  if (n({
@@ -174,8 +174,8 @@ const Xe = (e, t) => t ? de(e, t) : !0, Ke = (e, t) => e.filter(
174
174
  }));
175
175
  else if (c.field === "startDate" || c.field === "endDate") {
176
176
  const T = !l.startDate && !l.endDate;
177
- p((P) => ({
178
- ...P,
177
+ p((g) => ({
178
+ ...g,
179
179
  [o.id]: {
180
180
  startDate: c.field === "startDate" || T ? c.message : void 0,
181
181
  endDate: c.field === "endDate" || T ? c.message : void 0
@@ -186,8 +186,8 @@ const Xe = (e, t) => t ? de(e, t) : !0, Ke = (e, t) => e.filter(
186
186
  }
187
187
  if (p((T) => {
188
188
  if (!(o.id in T)) return T;
189
- const P = { ...T };
190
- return delete P[o.id], P;
189
+ const g = { ...T };
190
+ return delete g[o.id], g;
191
191
  }), i(o.id), !_(
192
192
  o,
193
193
  l.format,
@@ -218,17 +218,17 @@ const Xe = (e, t) => t ? de(e, t) : !0, Ke = (e, t) => e.filter(
218
218
  emptyState: Rt
219
219
  }, w = Le.memo(
220
220
  ({ reports: e, appliedFilters: t, availableFormats: s, defaultPaperSize: d }) => {
221
- const { t: n } = C(), {
221
+ const { t: n } = b(), {
222
222
  rowFilters: _,
223
223
  errors: R,
224
224
  isRunning: u,
225
225
  updateRow: f,
226
226
  clearRowFieldError: p,
227
- handleRunReport: g
227
+ handleRunReport: P
228
228
  } = at(e, t, d);
229
229
  if (e.length === 0)
230
230
  return /* @__PURE__ */ a("div", { className: E.emptyState, "data-testid": "reports-table-empty", children: n("REPORTS_NO_REPORTS_IN_SECTION") });
231
- const i = e.some(b);
231
+ const i = e.some(C);
232
232
  return /* @__PURE__ */ a("div", { className: E.tableContainer, children: /* @__PURE__ */ m("table", { className: E.table, "data-testid": "reports-table", children: [
233
233
  /* @__PURE__ */ a("thead", { children: /* @__PURE__ */ m("tr", { children: [
234
234
  /* @__PURE__ */ a(
@@ -246,7 +246,7 @@ const Xe = (e, t) => t ? de(e, t) : !0, Ke = (e, t) => e.filter(
246
246
  /* @__PURE__ */ a("th", { className: E.actionsColumn, children: n("REPORTS_ACTIONS_HEADER") })
247
247
  ] }) }),
248
248
  /* @__PURE__ */ a("tbody", { children: e.map((r) => {
249
- const O = _(r.id), S = R(r.id), h = b(r), o = u(r.id);
249
+ const O = _(r.id), S = R(r.id), A = C(r), o = u(r.id);
250
250
  return /* @__PURE__ */ m("tr", { children: [
251
251
  /* @__PURE__ */ a(
252
252
  "td",
@@ -256,8 +256,8 @@ const Xe = (e, t) => t ? de(e, t) : !0, Ke = (e, t) => e.filter(
256
256
  }
257
257
  ),
258
258
  i && /* @__PURE__ */ m(H, { children: [
259
- /* @__PURE__ */ a("td", { children: h && /* @__PURE__ */ a(
260
- N,
259
+ /* @__PURE__ */ a("td", { children: A && /* @__PURE__ */ a(
260
+ y,
261
261
  {
262
262
  datePickerType: "single",
263
263
  dateFormat: "d/m/Y",
@@ -280,8 +280,8 @@ const Xe = (e, t) => t ? de(e, t) : !0, Ke = (e, t) => e.filter(
280
280
  )
281
281
  }
282
282
  ) }),
283
- /* @__PURE__ */ a("td", { children: h && /* @__PURE__ */ a(
284
- N,
283
+ /* @__PURE__ */ a("td", { children: A && /* @__PURE__ */ a(
284
+ y,
285
285
  {
286
286
  datePickerType: "single",
287
287
  dateFormat: "d/m/Y",
@@ -337,7 +337,7 @@ const Xe = (e, t) => t ? de(e, t) : !0, Ke = (e, t) => e.filter(
337
337
  pe,
338
338
  {
339
339
  itemText: n("REPORTS_RUN_BUTTON_LABEL"),
340
- onClick: () => g(r)
340
+ onClick: () => P(r)
341
341
  }
342
342
  )
343
343
  }
@@ -369,9 +369,9 @@ const ct = "ReportList-module_reportList__tPpsJ", _t = "ReportList-module_fullWi
369
369
  onFormatChange: u,
370
370
  onPresetChange: f,
371
371
  onReset: p,
372
- onApply: g
372
+ onApply: P
373
373
  }) => {
374
- const { t: i } = C();
374
+ const { t: i } = b();
375
375
  return /* @__PURE__ */ m("section", { className: L.filtersContainer, "data-testid": "reports-filters", children: [
376
376
  /* @__PURE__ */ a("h2", { className: L.filtersTitle, children: i("REPORTS_FILTERS_LABEL") }),
377
377
  /* @__PURE__ */ m("div", { className: L.filtersRow, children: [
@@ -392,7 +392,7 @@ const ct = "ReportList-module_reportList__tPpsJ", _t = "ReportList-module_fullWi
392
392
  }
393
393
  ),
394
394
  /* @__PURE__ */ a(
395
- N,
395
+ y,
396
396
  {
397
397
  datePickerType: "single",
398
398
  dateFormat: "d/m/Y",
@@ -409,7 +409,7 @@ const ct = "ReportList-module_reportList__tPpsJ", _t = "ReportList-module_fullWi
409
409
  }
410
410
  ),
411
411
  /* @__PURE__ */ a(
412
- N,
412
+ y,
413
413
  {
414
414
  datePickerType: "single",
415
415
  dateFormat: "d/m/Y",
@@ -442,7 +442,7 @@ const ct = "ReportList-module_reportList__tPpsJ", _t = "ReportList-module_fullWi
442
442
  ] }),
443
443
  /* @__PURE__ */ m("div", { className: L.buttonsRow, children: [
444
444
  /* @__PURE__ */ a(x, { kind: "tertiary", onClick: p, children: i("REPORTS_RESET_BUTTON") }),
445
- /* @__PURE__ */ a(x, { kind: "primary", onClick: g, children: i("REPORTS_APPLY_BUTTON") })
445
+ /* @__PURE__ */ a(x, { kind: "primary", onClick: P, children: i("REPORTS_APPLY_BUTTON") })
446
446
  ] })
447
447
  ] });
448
448
  }, G = {
@@ -451,7 +451,7 @@ const ct = "ReportList-module_reportList__tPpsJ", _t = "ReportList-module_fullWi
451
451
  format: null,
452
452
  version: 0
453
453
  }, Ot = () => {
454
- const { t: e } = C(), { userPrivileges: t, isLoading: s } = ue(), { addNotification: d } = X(), {
454
+ const { t: e } = b(), { userPrivileges: t, isLoading: s } = ue(), { addNotification: d } = X(), {
455
455
  data: n,
456
456
  isLoading: _,
457
457
  error: R
@@ -463,24 +463,24 @@ const ct = "ReportList-module_reportList__tPpsJ", _t = "ReportList-module_fullWi
463
463
  type: "error"
464
464
  });
465
465
  }, [R, d, e]);
466
- const [f, p] = A(null), [g, i] = A(null), [r, O] = A(null), [S, h] = A(null), [o, l] = A(G), c = y(() => n ? Ke(
466
+ const [f, p] = h(null), [P, i] = h(null), [r, O] = h(null), [S, A] = h(null), [o, l] = h(G), c = N(() => n ? Ke(
467
467
  et(n),
468
468
  t
469
- ) : [], [n, t]), D = y(
469
+ ) : [], [n, t]), D = N(
470
470
  () => Je(u?.config?.supportedFormats),
471
471
  [u]
472
- ), T = u?.config?.paperSize, { dateRangeReports: P, noDateRangeReports: ae } = y(
472
+ ), T = u?.config?.paperSize, { dateRangeReports: g, noDateRangeReports: ae } = N(
473
473
  () => Ve(c),
474
474
  [c]
475
475
  ), re = () => {
476
476
  l((v) => ({
477
477
  startDate: f,
478
- endDate: g,
478
+ endDate: P,
479
479
  format: r,
480
480
  version: v.version + 1
481
481
  }));
482
482
  }, ne = () => {
483
- p(null), i(null), O(null), h(null), l((v) => ({ ...G, version: v.version + 1 }));
483
+ p(null), i(null), O(null), A(null), l((v) => ({ ...G, version: v.version + 1 }));
484
484
  };
485
485
  return _ || s ? /* @__PURE__ */ a(
486
486
  me,
@@ -509,14 +509,14 @@ const ct = "ReportList-module_reportList__tPpsJ", _t = "ReportList-module_fullWi
509
509
  ft,
510
510
  {
511
511
  startDate: f,
512
- endDate: g,
512
+ endDate: P,
513
513
  format: r,
514
514
  selectedPreset: S,
515
515
  availableFormats: D,
516
516
  onStartDateChange: p,
517
517
  onEndDateChange: i,
518
518
  onFormatChange: O,
519
- onPresetChange: h,
519
+ onPresetChange: A,
520
520
  onReset: ne,
521
521
  onApply: re
522
522
  }
@@ -531,7 +531,7 @@ const ct = "ReportList-module_reportList__tPpsJ", _t = "ReportList-module_fullWi
531
531
  children: /* @__PURE__ */ a(
532
532
  w,
533
533
  {
534
- reports: P,
534
+ reports: g,
535
535
  appliedFilters: o,
536
536
  availableFormats: D,
537
537
  defaultPaperSize: T
@@ -560,20 +560,20 @@ const ct = "ReportList-module_reportList__tPpsJ", _t = "ReportList-module_fullWi
560
560
  ]
561
561
  }
562
562
  );
563
- }, gt = "ReportsPage-module_page__ewRXe", Pt = "ReportsPage-module_panel__HFBCt", B = {
564
- page: gt,
565
- panel: Pt
566
- }, z = 1, At = 0, yt = () => {
567
- const { t: e } = C(), t = be(), s = Ce(), d = y(
563
+ }, Pt = "ReportsPage-module_page__ewRXe", gt = "ReportsPage-module_panel__HFBCt", B = {
564
+ page: Pt,
565
+ panel: gt
566
+ }, W = 1, ht = 0, Nt = () => {
567
+ const { t: e } = b(), t = Ce(), s = be(), d = N(
568
568
  () => [
569
569
  { id: "home", label: e("REPORTS_HOME_LABEL"), href: Se },
570
570
  { id: "reports", label: e("REPORTS_LABEL"), isCurrentPage: !0 }
571
571
  ],
572
572
  [e]
573
- ), n = t.pathname === U ? z : At, _ = K(
573
+ ), n = t.pathname === U ? W : ht, _ = K(
574
574
  ({ selectedIndex: R }) => {
575
575
  s(
576
- R === z ? U : fe
576
+ R === W ? U : fe
577
577
  );
578
578
  },
579
579
  [s]
@@ -588,7 +588,7 @@ const ct = "ReportList-module_reportList__tPpsJ", _t = "ReportList-module_fullWi
588
588
  "data-testid": "reports-page-header-test-id",
589
589
  "aria-label": "Reports Page Header",
590
590
  children: /* @__PURE__ */ a(
591
- he,
591
+ Ae,
592
592
  {
593
593
  breadcrumbItems: d,
594
594
  userMenu: /* @__PURE__ */ a(De, {})
@@ -603,9 +603,9 @@ const ct = "ReportList-module_reportList__tPpsJ", _t = "ReportList-module_fullWi
603
603
  "data-testid": "reports-page-test-id",
604
604
  "aria-label": "Reports Page",
605
605
  className: B.page,
606
- children: /* @__PURE__ */ m(ge, { selectedIndex: n, onChange: _, children: [
606
+ children: /* @__PURE__ */ m(Pe, { selectedIndex: n, onChange: _, children: [
607
607
  /* @__PURE__ */ m(
608
- Pe,
608
+ ge,
609
609
  {
610
610
  id: "reports-tab-list",
611
611
  "data-testid": "reports-tab-list-test-id",
@@ -632,7 +632,7 @@ const ct = "ReportList-module_reportList__tPpsJ", _t = "ReportList-module_fullWi
632
632
  ]
633
633
  }
634
634
  ),
635
- /* @__PURE__ */ m(Ae, { children: [
635
+ /* @__PURE__ */ m(he, { children: [
636
636
  /* @__PURE__ */ a(
637
637
  j,
638
638
  {
@@ -661,6 +661,6 @@ const ct = "ReportList-module_reportList__tPpsJ", _t = "ReportList-module_fullWi
661
661
  );
662
662
  };
663
663
  export {
664
- yt as ReportsPage,
665
- yt as default
664
+ Nt as ReportsPage,
665
+ Nt as default
666
666
  };
@@ -1,4 +1,4 @@
1
- import { aj as we, ak as z, al as xt, am as B, ah as q, ai as y, an as Ro, ao as ye, ap as R, aq as _, ar as k, as as N, at as A, au as bs, av as ir, aw as $e, ax as U, ay as Hn, az as Vn, aA as dt, aB as D, aC as xs, aD as cn, aE as Be, aF as ws, aG as qt, aH as zt, aI as $s, aJ as Cs, aK as $n, aL as Ss, aM as Nr, aN as Bt, aO as zo, aP as ks, aQ as Es, aR as j, aS as Ur, aT as Ms, aU as Ds, aV as sr, aW as As, aX as Ts, aY as zn, aZ as Fs, a_ as Is, a$ as Z, b0 as Ps, b1 as Ls } from "./index-CRUk3_DP.js";
1
+ import { ar as we, as as z, at as xt, au as B, ap as q, aq as y, av as Ro, aw as ye, ax as R, ay as _, az as k, aA as N, aB as A, aC as bs, aD as ir, aE as $e, aF as U, aG as Hn, aH as Vn, aI as dt, aJ as D, aK as xs, aL as cn, aM as Be, aN as ws, aO as qt, aP as zt, aQ as $s, aR as Cs, aS as $n, aT as Ss, aU as Nr, aV as Bt, aW as zo, aX as ks, aY as Es, aZ as j, a_ as Ur, a$ as Ms, b0 as Ds, b1 as sr, b2 as As, b3 as Ts, b4 as zn, b5 as Fs, b6 as Is, b7 as Z, b8 as Ps, b9 as Ls } from "./index-B_1boRXC.js";
2
2
  var Os = (e) => e != null, qs = (e) => e.filter(Os);
3
3
  function _s(e) {
4
4
  return (...t) => {