@bahmni/reports-app 0.0.1-dev.442 → 0.0.1-dev.445

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,5 +1,5 @@
1
- import { jsx as a, jsxs as m, Fragment as H } from "react/jsx-runtime";
2
- import { K as z, C as se, F as oe, G as ie, I as le, M as de, N as Re, O as ce, P as Y, u as b, z as X, U as N, V as F, Y 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 Pe, aa as ge, ab as G, ac as Ae, ad as k, ae as he, af as De } from "./index-g9wj_kf9.js";
1
+ import { jsx as a, jsxs as m, Fragment as Y } from "react/jsx-runtime";
2
+ import { C as W, E as se, F as oe, G as ie, Y as le, I as de, K as Re, N as ce, O as H, u as b, z as X, P as N, U as F, V as M, Z as _e, _ as Te, a0 as pe, a1 as x, k as ue, a2 as me, a3 as Ee, a4 as U, a5 as Se, a6 as q, 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-BJ2mligI.js";
3
3
  import Le, { useCallback as K, useState as A, useEffect as V, useMemo as y } from "react";
4
4
  import { useQuery as J } from "@tanstack/react-query";
5
5
  import { useLocation as Ce, useNavigate as be } from "react-router-dom";
@@ -20,18 +20,18 @@ const ye = "http://json-schema.org/draft-07/schema#", Ne = "Reports App Configur
20
20
  "TODAY",
21
21
  "THIS_MONTH",
22
22
  "LAST_7_DAYS"
23
- ], He = {
23
+ ], Ye = {
24
24
  TODAY: "REPORTS_PRESET_TODAY",
25
25
  THIS_MONTH: "REPORTS_PRESET_THIS_MONTH",
26
26
  LAST_7_DAYS: "REPORTS_PRESET_LAST_7_DAYS"
27
27
  }, Q = {
28
28
  reportsConfig: ["reportsConfig"],
29
29
  reportsAppConfig: ["reportsAppConfig"]
30
- }, Ye = () => J({
30
+ }, He = () => J({
31
31
  queryKey: Q.reportsAppConfig,
32
32
  queryFn: async () => {
33
33
  try {
34
- return await z(
34
+ return await W(
35
35
  se,
36
36
  Be
37
37
  );
@@ -39,32 +39,32 @@ const ye = "http://json-schema.org/draft-07/schema#", Ne = "Reports App Configur
39
39
  return {};
40
40
  }
41
41
  }
42
- }), xe = "http://json-schema.org/draft-07/schema#", qe = "Reports Configuration", Ue = "object", Ge = { type: "object", required: ["name", "type"], properties: { name: { type: "string", description: "Display name of the report" }, type: { type: "string", description: "Report generator type" }, requiredPrivilege: { type: "string", description: "Privilege required to view/run this report" }, config: { type: "object", properties: { dateRangeRequired: { type: "boolean", description: "Whether this report requires a date range (defaults to true)" }, paperSize: { type: "string", description: "Paper size for PDF generation (e.g., A4)" }, macroTemplatePath: { type: "string", description: "Path to macro template for custom Excel reports" } }, additionalProperties: !0 } } }, ke = {
42
+ }), xe = "http://json-schema.org/draft-07/schema#", Ue = "Reports Configuration", qe = "object", $e = { type: "object", required: ["name", "type"], properties: { name: { type: "string", description: "Display name of the report" }, type: { type: "string", description: "Report generator type" }, requiredPrivilege: { type: "string", description: "Privilege required to view/run this report" }, config: { type: "object", properties: { dateRangeRequired: { type: "boolean", description: "Whether this report requires a date range (defaults to true)" }, paperSize: { type: "string", description: "Paper size for PDF generation (e.g., A4)" }, macroTemplatePath: { type: "string", description: "Path to macro template for custom Excel reports" } }, additionalProperties: !0 } } }, je = {
43
43
  $schema: xe,
44
- title: qe,
45
- type: Ue,
46
- additionalProperties: Ge
47
- }, $e = () => J({
44
+ title: Ue,
45
+ type: qe,
46
+ additionalProperties: $e
47
+ }, ke = () => J({
48
48
  queryKey: Q.reportsConfig,
49
- queryFn: () => z(oe, ke),
49
+ queryFn: () => W(oe, je),
50
50
  retry: !1
51
- }), $ = Symbol.for("constructDateFrom");
51
+ }), k = Symbol.for("constructDateFrom");
52
52
  function Z(e, t) {
53
- return typeof e == "function" ? e(t) : e && typeof e == "object" && $ in e ? e[$](t) : e instanceof Date ? new e.constructor(t) : new Date(t);
53
+ return typeof e == "function" ? e(t) : e && typeof e == "object" && k in e ? e[k](t) : e instanceof Date ? new e.constructor(t) : new Date(t);
54
54
  }
55
55
  function ee(e, t) {
56
56
  return Z(e, e);
57
57
  }
58
- function je(e, t, s) {
58
+ 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 We(e, t) {
62
+ function ze(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 ze(e, t, s) {
67
- return je(e, -6);
66
+ function We(e, t, s) {
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)
@@ -77,9 +77,9 @@ const Xe = (e, t) => t ? de(e, t) : !0, Ke = (e, t) => e.filter(
77
77
  const t = /* @__PURE__ */ new Date();
78
78
  switch (e) {
79
79
  case "THIS_MONTH":
80
- return [We(t), t];
81
- case "LAST_7_DAYS":
82
80
  return [ze(t), t];
81
+ case "LAST_7_DAYS":
82
+ return [We(t), t];
83
83
  default:
84
84
  return [new Date(t), new Date(t)];
85
85
  }
@@ -119,9 +119,9 @@ const Xe = (e, t) => t ? de(e, t) : !0, Ke = (e, t) => e.filter(
119
119
  t.config?.paperSize ?? _
120
120
  ), u = window.open(R, "_blank");
121
121
  return u ? (u.opener = null, ce({
122
- eventType: Y.RUN_REPORT.eventType,
122
+ eventType: H.RUN_REPORT.eventType,
123
123
  messageParams: { reportName: t.name },
124
- module: Y.RUN_REPORT.module
124
+ module: H.RUN_REPORT.module
125
125
  }), !0) : !1;
126
126
  } catch (R) {
127
127
  return console.error("Error running report:", R), !1;
@@ -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 } = b(), { addNotification: n } = X(), { runReport: _ } = tt(), [R, u] = A({}), [f, p] = A({}), [P, i] = A(null);
132
+ const { t: d } = b(), { addNotification: n } = X(), { runReport: _ } = tt(), [R, u] = A({}), [f, p] = A({}), [g, i] = A(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) => P === o,
144
+ isRunning: (o) => g === o,
145
145
  updateRow: (o, l) => u((c) => ({
146
146
  ...c,
147
147
  [o]: { ...r(o), ...l }
@@ -160,7 +160,7 @@ const Xe = (e, t) => t ? de(e, t) : !0, Ke = (e, t) => e.filter(
160
160
  startDate: l.startDate,
161
161
  endDate: l.endDate
162
162
  },
163
- (T, g) => d(T, { defaultValue: T, ...g })
163
+ (T, P) => d(T, { defaultValue: T, ...P })
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((g) => ({
178
- ...g,
177
+ p((P) => ({
178
+ ...P,
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 g = { ...T };
190
- return delete g[o.id], g;
189
+ const P = { ...T };
190
+ return delete P[o.id], P;
191
191
  }), i(o.id), !_(
192
192
  o,
193
193
  l.format,
@@ -224,7 +224,7 @@ const Xe = (e, t) => t ? de(e, t) : !0, Ke = (e, t) => e.filter(
224
224
  isRunning: u,
225
225
  updateRow: f,
226
226
  clearRowFieldError: p,
227
- handleRunReport: P
227
+ handleRunReport: g
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") });
@@ -238,7 +238,7 @@ const Xe = (e, t) => t ? de(e, t) : !0, Ke = (e, t) => e.filter(
238
238
  children: n("REPORTS_NAME_HEADER")
239
239
  }
240
240
  ),
241
- i && /* @__PURE__ */ m(H, { children: [
241
+ i && /* @__PURE__ */ m(Y, { children: [
242
242
  /* @__PURE__ */ a("th", { className: E.dateColumn, children: n("REPORTS_START_DATE_LABEL") }),
243
243
  /* @__PURE__ */ a("th", { className: E.dateColumn, children: n("REPORTS_END_DATE_LABEL") })
244
244
  ] }),
@@ -255,7 +255,7 @@ const Xe = (e, t) => t ? de(e, t) : !0, Ke = (e, t) => e.filter(
255
255
  children: r.name
256
256
  }
257
257
  ),
258
- i && /* @__PURE__ */ m(H, { children: [
258
+ i && /* @__PURE__ */ m(Y, { children: [
259
259
  /* @__PURE__ */ a("td", { children: h && /* @__PURE__ */ a(
260
260
  N,
261
261
  {
@@ -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: () => P(r)
340
+ onClick: () => g(r)
341
341
  }
342
342
  )
343
343
  }
@@ -369,7 +369,7 @@ const ct = "ReportList-module_reportList__tPpsJ", _t = "ReportList-module_fullWi
369
369
  onFormatChange: u,
370
370
  onPresetChange: f,
371
371
  onReset: p,
372
- onApply: P
372
+ onApply: g
373
373
  }) => {
374
374
  const { t: i } = b();
375
375
  return /* @__PURE__ */ m("section", { className: L.filtersContainer, "data-testid": "reports-filters", children: [
@@ -382,7 +382,7 @@ const ct = "ReportList-module_reportList__tPpsJ", _t = "ReportList-module_fullWi
382
382
  titleText: i("REPORTS_SELECT_DATE_RANGE"),
383
383
  label: "",
384
384
  items: we,
385
- itemToString: (r) => r ? i(He[r]) : "",
385
+ itemToString: (r) => r ? i(Ye[r]) : "",
386
386
  selectedItem: d,
387
387
  onChange: ({ selectedItem: r }) => {
388
388
  if (f(r ?? null), !r) return;
@@ -442,10 +442,10 @@ 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: P, children: i("REPORTS_APPLY_BUTTON") })
445
+ /* @__PURE__ */ a(x, { kind: "primary", onClick: g, children: i("REPORTS_APPLY_BUTTON") })
446
446
  ] })
447
447
  ] });
448
- }, j = {
448
+ }, G = {
449
449
  startDate: null,
450
450
  endDate: null,
451
451
  format: null,
@@ -455,7 +455,7 @@ const ct = "ReportList-module_reportList__tPpsJ", _t = "ReportList-module_fullWi
455
455
  data: n,
456
456
  isLoading: _,
457
457
  error: R
458
- } = $e(), { data: u } = Ye();
458
+ } = ke(), { data: u } = He();
459
459
  V(() => {
460
460
  R && d({
461
461
  title: e("REPORTS_ERROR_TITLE"),
@@ -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), [P, i] = A(null), [r, O] = A(null), [S, h] = A(null), [o, l] = A(j), c = y(() => n ? Ke(
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(
467
467
  et(n),
468
468
  t
469
469
  ) : [], [n, t]), D = y(
470
470
  () => Je(u?.config?.supportedFormats),
471
471
  [u]
472
- ), T = u?.config?.paperSize, { dateRangeReports: g, noDateRangeReports: ae } = y(
472
+ ), T = u?.config?.paperSize, { dateRangeReports: P, noDateRangeReports: ae } = y(
473
473
  () => Ve(c),
474
474
  [c]
475
475
  ), re = () => {
476
476
  l((v) => ({
477
477
  startDate: f,
478
- endDate: P,
478
+ endDate: g,
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) => ({ ...j, version: v.version + 1 }));
483
+ p(null), i(null), O(null), h(null), l((v) => ({ ...G, version: v.version + 1 }));
484
484
  };
485
485
  return _ || s ? /* @__PURE__ */ a(
486
486
  me,
@@ -509,7 +509,7 @@ const ct = "ReportList-module_reportList__tPpsJ", _t = "ReportList-module_fullWi
509
509
  ft,
510
510
  {
511
511
  startDate: f,
512
- endDate: P,
512
+ endDate: g,
513
513
  format: r,
514
514
  selectedPreset: S,
515
515
  availableFormats: D,
@@ -523,7 +523,7 @@ const ct = "ReportList-module_reportList__tPpsJ", _t = "ReportList-module_fullWi
523
523
  ),
524
524
  /* @__PURE__ */ m(Ee, { align: "start", children: [
525
525
  /* @__PURE__ */ a(
526
- q,
526
+ U,
527
527
  {
528
528
  title: e("REPORTS_DATE_RANGE_SECTION_TITLE"),
529
529
  testId: "reports-date-range-section",
@@ -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: g,
534
+ reports: P,
535
535
  appliedFilters: o,
536
536
  availableFormats: D,
537
537
  defaultPaperSize: T
@@ -540,7 +540,7 @@ const ct = "ReportList-module_reportList__tPpsJ", _t = "ReportList-module_fullWi
540
540
  }
541
541
  ),
542
542
  /* @__PURE__ */ a(
543
- q,
543
+ U,
544
544
  {
545
545
  title: e("REPORTS_NO_DATE_RANGE_SECTION_TITLE"),
546
546
  testId: "reports-no-date-range-section",
@@ -560,20 +560,20 @@ const ct = "ReportList-module_reportList__tPpsJ", _t = "ReportList-module_fullWi
560
560
  ]
561
561
  }
562
562
  );
563
- }, Pt = "ReportsPage-module_page__ewRXe", gt = "ReportsPage-module_panel__HFBCt", B = {
564
- page: Pt,
565
- panel: gt
566
- }, W = 1, At = 0, yt = () => {
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
567
  const { t: e } = b(), t = Ce(), s = be(), d = y(
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 ? W : At, _ = K(
573
+ ), n = t.pathname === q ? z : At, _ = K(
574
574
  ({ selectedIndex: R }) => {
575
575
  s(
576
- R === W ? U : fe
576
+ R === z ? q : fe
577
577
  );
578
578
  },
579
579
  [s]
@@ -603,16 +603,16 @@ 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(Pe, { selectedIndex: n, onChange: _, children: [
606
+ children: /* @__PURE__ */ m(ge, { selectedIndex: n, onChange: _, children: [
607
607
  /* @__PURE__ */ m(
608
- ge,
608
+ Pe,
609
609
  {
610
610
  id: "reports-tab-list",
611
611
  "data-testid": "reports-tab-list-test-id",
612
612
  "aria-label": e("REPORTS_TAB_LIST_ARIA_LABEL"),
613
613
  children: [
614
614
  /* @__PURE__ */ a(
615
- G,
615
+ $,
616
616
  {
617
617
  id: "reports-tab",
618
618
  "data-testid": "reports-tab-test-id",
@@ -621,7 +621,7 @@ const ct = "ReportList-module_reportList__tPpsJ", _t = "ReportList-module_fullWi
621
621
  }
622
622
  ),
623
623
  /* @__PURE__ */ a(
624
- G,
624
+ $,
625
625
  {
626
626
  id: "my-reports-tab",
627
627
  "data-testid": "my-reports-tab-test-id",
@@ -634,7 +634,7 @@ const ct = "ReportList-module_reportList__tPpsJ", _t = "ReportList-module_fullWi
634
634
  ),
635
635
  /* @__PURE__ */ m(Ae, { children: [
636
636
  /* @__PURE__ */ a(
637
- k,
637
+ j,
638
638
  {
639
639
  id: "reports-tab-panel",
640
640
  "data-testid": "reports-tab-panel-test-id",
@@ -644,7 +644,7 @@ const ct = "ReportList-module_reportList__tPpsJ", _t = "ReportList-module_fullWi
644
644
  }
645
645
  ),
646
646
  /* @__PURE__ */ a(
647
- k,
647
+ j,
648
648
  {
649
649
  id: "my-reports-tab-panel",
650
650
  "data-testid": "my-reports-tab-panel-test-id",
@@ -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-g9wj_kf9.js";
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-BJ2mligI.js";
2
2
  var Os = (e) => e != null, qs = (e) => e.filter(Os);
3
3
  function _s(e) {
4
4
  return (...t) => {