@bahmni/clinical-app 0.0.1-dev.189 → 0.0.1-dev.191

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.
@@ -158727,6 +158727,8 @@ const ys = (n, e) => n?.length === 0 ? !1 : e?.length === 0, Htt = async () => {
158727
158727
  }, The = (n, e) => {
158728
158728
  if (!n || n.length === 0)
158729
158729
  return !1;
158730
+ if (!e || e.length === 0)
158731
+ return !0;
158730
158732
  const r = Array.isArray(e) ? e : [e];
158731
158733
  return n.some(
158732
158734
  (a) => r.includes(a.name)
@@ -158878,15 +158880,16 @@ const ple = "consultation:saved", bn = (n, e = []) => {
158878
158880
  };
158879
158881
  function Dtt(n) {
158880
158882
  return n.filter((e) => e.resource?.resourceType === "DocumentReference").map((e) => {
158881
- const r = e.resource, a = r.content?.[0]?.attachment, l = r.masterIdentifier?.value ?? r.id ?? "";
158883
+ const r = e.resource, a = r.masterIdentifier?.value ?? r.id ?? "", l = (r.content ?? []).map((f) => f.attachment).filter((f) => !!f).map((f) => ({ url: f.url ?? "", contentType: f.contentType })), c = l[0];
158882
158884
  return {
158883
- id: r.id ?? l,
158884
- documentIdentifier: l,
158885
+ id: r.id ?? a,
158886
+ documentIdentifier: a,
158885
158887
  documentType: r.type?.coding?.[0]?.display ?? r.category?.[0]?.coding?.[0]?.display,
158886
158888
  uploadedOn: r.date ?? "",
158887
158889
  uploadedBy: r.author?.[0]?.display,
158888
- contentType: a?.contentType,
158889
- documentUrl: a?.url ?? ""
158890
+ contentType: c?.contentType,
158891
+ documentUrl: c?.url ?? "",
158892
+ attachments: l
158890
158893
  };
158891
158894
  });
158892
158895
  }
@@ -165261,7 +165264,7 @@ const Lot = [
165261
165264
  },
165262
165265
  {
165263
165266
  type: "patientDocuments",
165264
- component: lazy$1(() => import("./DocumentsTable-BQYdm5FO-CI7RHjMr.js"))
165267
+ component: lazy$1(() => import("./DocumentsTable-BCnYVvIx-CKfW4LkF.js"))
165265
165268
  },
165266
165269
  {
165267
165270
  type: "flowSheet",
@@ -165269,7 +165272,7 @@ const Lot = [
165269
165272
  },
165270
165273
  {
165271
165274
  type: "forms",
165272
- component: lazy$1(() => import("./FormsTable-BUw2KCew-FuIdsUF_.js"))
165275
+ component: lazy$1(() => import("./FormsTable-DFknJTr7-BAW-hDfT.js"))
165273
165276
  },
165274
165277
  {
165275
165278
  type: "labOrders",
@@ -165277,7 +165280,7 @@ const Lot = [
165277
165280
  },
165278
165281
  {
165279
165282
  type: "observations",
165280
- component: lazy$1(() => import("./Observations-D9XzsEPN-Um0M38rj.js"))
165283
+ component: lazy$1(() => import("./Observations-D0PH7TgR-A9AnKLVx.js"))
165281
165284
  },
165282
165285
  {
165283
165286
  type: "ordersControl",
@@ -167178,7 +167181,7 @@ var displayValue = (n, e = !1) => {
167178
167181
  const e = render(() => {
167179
167182
  const r = this, [a] = this.#o, [l] = this.#d, [c] = this.#f, [f] = this.#u, [p] = this.#h, [m] = this.#t;
167180
167183
  let A;
167181
- return this.#s ? A = this.#s : (A = lazy(() => import("./LNWAZHJI-DgiLh6aa.js")), this.#s = A), setupStyleSheet(this.#i, this.#l), createComponent(A, mergeProps({
167184
+ return this.#s ? A = this.#s : (A = lazy(() => import("./LNWAZHJI-DkQIvc_p.js")), this.#s = A), setupStyleSheet(this.#i, this.#l), createComponent(A, mergeProps({
167182
167185
  get queryFlavor() {
167183
167186
  return r.#n;
167184
167187
  },
@@ -167276,7 +167279,7 @@ var displayValue = (n, e = !1) => {
167276
167279
  const e = render(() => {
167277
167280
  const r = this, [a] = this.#o, [l] = this.#d, [c] = this.#f, [f] = this.#u, [p] = this.#h, [m] = this.#t, [A] = this.#s;
167278
167281
  let g;
167279
- return this.#c ? g = this.#c : (g = lazy(() => import("./MWZ6AO7Z-Tw697iV9.js")), this.#c = g), setupStyleSheet(this.#i, this.#l), createComponent(g, mergeProps({
167282
+ return this.#c ? g = this.#c : (g = lazy(() => import("./MWZ6AO7Z-BSg3RITC.js")), this.#c = g), setupStyleSheet(this.#i, this.#l), createComponent(g, mergeProps({
167280
167283
  get queryFlavor() {
167281
167284
  return r.#n;
167282
167285
  },
@@ -214295,7 +214298,7 @@ const emptyState = "_emptyState_1vrno_1", emptyStateTitle = "_emptyStateTitle_1v
214295
214298
  return c && e.length > 0 ? /* @__PURE__ */ jsx(Uh2, { description: r("LOADING_CLINICAL_DATA"), role: "status" }) : f ? /* @__PURE__ */ jsx("div", { className: "alert alert-danger", children: r("ERROR_FETCHING_CLINICAL_DATA") }) : /* @__PURE__ */ jsx(ClinicalAppContext.Provider, { value: p, children: n });
214296
214299
  };
214297
214300
  ClinicalAppProvider.displayName = "clinical apps provider";
214298
- const DASHBOARD_CONFIG_URL = (n) => `${CLINICAL_V2_CONFIG_BASE_URL}/dashboards/${n}`, EPISODE_UUID_SEARCH_PARAMS_KEY = "episodeUuid", CURRENT_DASHBOARD_SEARCH_PARAMS_KEY = "currentDashboard", PROGRAM_UUID_SEARCH_PARAMS_KEY = "programUuid", $schema = "http://json-schema.org/draft-07/schema#", title = "Clinical Dashboard Configuration Schema", description = "Schema for dashboards in clinical app which contains sections and associated controls", type = "object", additionalProperties = !1, required = ["sections"], properties = { sections: { type: "array", description: "Section in a dashboard", items: { type: "object", additionalProperties: !1, required: ["name", "icon", "controls"], properties: { name: { type: "string", description: "Display name of the section" }, translationKey: { type: "string", description: "Translation key for the section name" }, icon: { type: "string", description: "Fontawesome Icon name for the section" }, controls: { type: "array", description: "List of controls in the section", items: [{ type: "object", additionalProperties: !1, required: ["type"], properties: { type: { type: "string", description: "Type of the control" }, config: { type: "object", description: "Configuration for the control" } } }] } } } } }, dashboardConfigSchema = {
214301
+ const DASHBOARD_CONFIG_URL = (n) => `${CLINICAL_V2_CONFIG_BASE_URL}/dashboards/${n}`, EPISODE_UUID_SEARCH_PARAMS_KEY = "episodeUuid", CURRENT_DASHBOARD_SEARCH_PARAMS_KEY = "currentDashboard", PROGRAM_UUID_SEARCH_PARAMS_KEY = "programUuid", $schema = "http://json-schema.org/draft-07/schema#", title = "Clinical Dashboard Configuration Schema", description = "Schema for dashboards in clinical app which contains sections and associated controls", type = "object", additionalProperties = !1, required = ["sections"], properties = { sections: { type: "array", description: "Section in a dashboard", items: { type: "object", additionalProperties: !1, required: ["name", "icon", "controls"], properties: { name: { type: "string", description: "Display name of the section" }, translationKey: { type: "string", description: "Translation key for the section name" }, icon: { type: "string", description: "Fontawesome Icon name for the section" }, controls: { type: "array", description: "List of controls in the section", items: [{ type: "object", additionalProperties: !1, required: ["type"], properties: { type: { type: "string", description: "Type of the control" }, requiredPrivileges: { type: "array", description: "List of required privileges for the control", items: { type: "string" } }, config: { type: "object", description: "Configuration for the control" } } }] } } } } }, dashboardConfigSchema = {
214299
214302
  $schema,
214300
214303
  title,
214301
214304
  description,
@@ -214312,7 +214315,12 @@ const DASHBOARD_CONFIG_URL = (n) => `${CLINICAL_V2_CONFIG_BASE_URL}/dashboards/$
214312
214315
  (r) => r.default === !0
214313
214316
  );
214314
214317
  return e || n[0];
214315
- }, getSidebarItems = (n, e) => n.sections.map((r) => ({
214318
+ }, filterControlsByPrivileges = (n) => n.filter(
214319
+ (e) => Nat(e.requiredPrivileges)
214320
+ ), filterSectionsByPrivileges = (n) => n.map((e) => ({
214321
+ ...e,
214322
+ controls: filterControlsByPrivileges(e.controls)
214323
+ })).filter((e) => e.controls.length > 0), getSidebarItems = (n, e) => n.sections.map((r) => ({
214316
214324
  id: r.id,
214317
214325
  icon: r.icon,
214318
214326
  label: e(r.translationKey ?? r.name)
@@ -214344,7 +214352,7 @@ const DASHBOARD_CONFIG_URL = (n) => `${CLINICAL_V2_CONFIG_BASE_URL}/dashboards/$
214344
214352
  }
214345
214353
  }
214346
214354
  ], ConsultationPage = () => {
214347
- const { t: n } = useTranslation(), { clinicalConfig: e, isLoading: r } = useClinicalConfig(), { userPrivileges: a } = l5e(), { addNotification: l } = o1(), [c, f] = useState(!1), [p] = useSearchParams(), m = useObservationFormsStore(($) => $.viewingForm), A = [
214355
+ const { t: n } = useTranslation(), { clinicalConfig: e, isLoading: r } = useClinicalConfig(), { userPrivileges: a } = l5e(), { addNotification: l } = o1(), [c, f] = useState(!1), [p] = useSearchParams(), m = useObservationFormsStore((B) => B.viewingForm), A = [
214348
214356
  { id: "home", label: "Home", href: Oy$1 },
214349
214357
  {
214350
214358
  id: "clinical",
@@ -214353,12 +214361,12 @@ const DASHBOARD_CONFIG_URL = (n) => `${CLINICAL_V2_CONFIG_BASE_URL}/dashboards/$
214353
214361
  },
214354
214362
  { id: "current", label: n("CURRENT_PATIENT"), isCurrentPage: !0 }
214355
214363
  ], g = useMemo(() => {
214356
- const $ = p.get(EPISODE_UUID_SEARCH_PARAMS_KEY);
214357
- return $ ? $.split(",").map((B) => B.trim()).filter(Boolean) : [];
214364
+ const B = p.get(EPISODE_UUID_SEARCH_PARAMS_KEY);
214365
+ return B ? B.split(",").map((O) => O.trim()).filter(Boolean) : [];
214358
214366
  }, [p]), w = p.get(
214359
214367
  CURRENT_DASHBOARD_SEARCH_PARAMS_KEY
214360
214368
  ), v = useMemo(() => e ? w ? e.dashboards?.find(
214361
- ($) => $.name === w
214369
+ (B) => B.name === w
214362
214370
  ) : getDefaultDashboard(e.dashboards || []) : null, [e, w]), C = v?.url ?? null, {
214363
214371
  data: x,
214364
214372
  isLoading: _,
@@ -214379,7 +214387,10 @@ const DASHBOARD_CONFIG_URL = (n) => `${CLINICAL_V2_CONFIG_BASE_URL}/dashboards/$
214379
214387
  type: "error"
214380
214388
  });
214381
214389
  }, [y]);
214382
- const V = useMemo(() => x ? getSidebarItems(x, n) : [], [x, n]), { activeItemId: E, handleItemClick: M } = jh2(V);
214390
+ const V = useMemo(() => !x || !a ? null : {
214391
+ ...x,
214392
+ sections: filterSectionsByPrivileges(x.sections)
214393
+ }, [x, a]), E = useMemo(() => V ? getSidebarItems(V, n) : [], [V, n]), { activeItemId: M, handleItemClick: L } = jh2(E);
214383
214394
  if (r)
214384
214395
  return /* @__PURE__ */ jsx(
214385
214396
  Uh2,
@@ -214392,12 +214403,12 @@ const DASHBOARD_CONFIG_URL = (n) => `${CLINICAL_V2_CONFIG_BASE_URL}/dashboards/$
214392
214403
  if (!a)
214393
214404
  return /* @__PURE__ */ jsx(Uh2, { description: n("LOADING_USER_PRIVILEGES"), role: "status" });
214394
214405
  if (!v) {
214395
- const $ = w ? n("ERROR_DASHBOARD_NOT_CONFIGURED", {
214406
+ const B = w ? n("ERROR_DASHBOARD_NOT_CONFIGURED", {
214396
214407
  dashboardName: w
214397
214408
  }) : n("ERROR_NO_DEFAULT_DASHBOARD");
214398
214409
  return l({
214399
214410
  title: n("ERROR_DEFAULT_TITLE"),
214400
- message: $,
214411
+ message: B,
214401
214412
  type: "error"
214402
214413
  }), /* @__PURE__ */ jsx(
214403
214414
  "div",
@@ -214417,12 +214428,12 @@ const DASHBOARD_CONFIG_URL = (n) => `${CLINICAL_V2_CONFIG_BASE_URL}/dashboards/$
214417
214428
  role: "status"
214418
214429
  }
214419
214430
  );
214420
- const L = () => {
214421
- const $ = p.get(PROGRAM_UUID_SEARCH_PARAMS_KEY);
214422
- return $ && e.contextInformation?.program ? /* @__PURE__ */ jsx(
214431
+ const $ = () => {
214432
+ const B = p.get(PROGRAM_UUID_SEARCH_PARAMS_KEY);
214433
+ return B && e.contextInformation?.program ? /* @__PURE__ */ jsx(
214423
214434
  xat,
214424
214435
  {
214425
- programUUID: $,
214436
+ programUUID: B,
214426
214437
  config: {
214427
214438
  fields: e.contextInformation?.program?.fields ?? []
214428
214439
  }
@@ -214437,9 +214448,9 @@ const DASHBOARD_CONFIG_URL = (n) => `${CLINICAL_V2_CONFIG_BASE_URL}/dashboards/$
214437
214448
  {
214438
214449
  breadcrumbItems: A,
214439
214450
  globalActions,
214440
- sideNavItems: V,
214441
- activeSideNavItemId: E,
214442
- onSideNavItemClick: M,
214451
+ sideNavItems: E,
214452
+ activeSideNavItemId: M,
214453
+ onSideNavItemClick: L,
214443
214454
  isRail: c
214444
214455
  }
214445
214456
  ),
@@ -214462,7 +214473,8 @@ const DASHBOARD_CONFIG_URL = (n) => `${CLINICAL_V2_CONFIG_BASE_URL}/dashboards/$
214462
214473
  {
214463
214474
  id: "section-sticky-header",
214464
214475
  "data-testid": "section-sticky-header-test-id",
214465
- "aria-label": "section-sticky-header-aria-label",
214476
+ role: "region",
214477
+ "aria-label": n("PATIENT_HEADER_SECTION"),
214466
214478
  className: styles.stickySection,
214467
214479
  children: [
214468
214480
  /* @__PURE__ */ jsx(
@@ -214472,15 +214484,15 @@ const DASHBOARD_CONFIG_URL = (n) => `${CLINICAL_V2_CONFIG_BASE_URL}/dashboards/$
214472
214484
  setIsActionAreaVisible: f
214473
214485
  }
214474
214486
  ),
214475
- L()
214487
+ $()
214476
214488
  ]
214477
214489
  }
214478
214490
  ),
214479
214491
  /* @__PURE__ */ jsx(
214480
214492
  DashboardContainer,
214481
214493
  {
214482
- sections: x.sections,
214483
- activeItemId: E
214494
+ sections: V.sections,
214495
+ activeItemId: M
214484
214496
  }
214485
214497
  )
214486
214498
  ]
@@ -214491,7 +214503,7 @@ const DASHBOARD_CONFIG_URL = (n) => `${CLINICAL_V2_CONFIG_BASE_URL}/dashboards/$
214491
214503
  actionArea: /* @__PURE__ */ jsx(
214492
214504
  ConsultationPad,
214493
214505
  {
214494
- onClose: () => f(($) => !$)
214506
+ onClose: () => f((B) => !B)
214495
214507
  }
214496
214508
  )
214497
214509
  }
@@ -214515,7 +214527,7 @@ const DASHBOARD_CONFIG_URL = (n) => `${CLINICAL_V2_CONFIG_BASE_URL}/dashboards/$
214515
214527
  ] }) }) : /* @__PURE__ */ jsx(Uh2, {});
214516
214528
  };
214517
214529
  export {
214518
- $1 as $,
214530
+ $c as $,
214519
214531
  Ar as A,
214520
214532
  getPreferredColorScheme as B,
214521
214533
  createMemo as C,
@@ -214526,64 +214538,63 @@ export {
214526
214538
  Hat as H,
214527
214539
  createSignal as I,
214528
214540
  onMount as J,
214529
- K0 as K,
214541
+ createEffect as K,
214530
214542
  L4 as L,
214531
- createEffect as M,
214532
- Portal as N,
214533
- memo as O,
214543
+ Portal as M,
214544
+ memo as N,
214545
+ template as O,
214534
214546
  Pot as P,
214535
- template as Q,
214536
- insert as R,
214547
+ insert as Q,
214548
+ createRenderEffect as R,
214537
214549
  Show as S,
214538
214550
  T0 as T,
214539
- createRenderEffect as U,
214551
+ className as U,
214540
214552
  Vat as V,
214541
214553
  Wot as W,
214542
- className as X,
214554
+ clearDelegatedEvents as X,
214543
214555
  Y2 as Y,
214544
214556
  Zr as Z,
214545
- clearDelegatedEvents as _,
214557
+ delegateEvents as _,
214546
214558
  useQuery as a,
214547
- delegateEvents as a0,
214548
- useContext as a1,
214549
- onCleanup as a2,
214550
- sortFns as a3,
214551
- mutationSortFns as a4,
214552
- on as a5,
214553
- setAttribute as a6,
214554
- getSidedProp as a7,
214555
- use as a8,
214556
- createUniqueId as a9,
214557
- batch as aa,
214558
- getQueryStatusLabel as ab,
214559
- getMutationStatusColor as ac,
214560
- getQueryStatusColor as ad,
214561
- getQueryStatusColorByLabel as ae,
214562
- displayValue as af,
214563
- For as ag,
214564
- convertRemToPixels as ah,
214565
- untrack as ai,
214566
- $TRACK as aj,
214567
- useTransition as ak,
214568
- spread as al,
214569
- mergeProps as am,
214570
- createRoot as an,
214571
- serialize as ao,
214572
- Index as ap,
214573
- updateNestedDataByPath as aq,
214574
- addEventListener as ar,
214575
- stringify as as,
214576
- Match as at,
214577
- Switch as au,
214578
- deleteNestedDataByPath as av,
214579
- splitProps as aw,
214580
- Dynamic as ax,
214581
- createComputed as ay,
214582
- ClinicalApp as az,
214559
+ useContext as a0,
214560
+ onCleanup as a1,
214561
+ sortFns as a2,
214562
+ mutationSortFns as a3,
214563
+ on as a4,
214564
+ setAttribute as a5,
214565
+ getSidedProp as a6,
214566
+ use as a7,
214567
+ createUniqueId as a8,
214568
+ batch as a9,
214569
+ getQueryStatusLabel as aa,
214570
+ getMutationStatusColor as ab,
214571
+ getQueryStatusColor as ac,
214572
+ getQueryStatusColorByLabel as ad,
214573
+ displayValue as ae,
214574
+ For as af,
214575
+ convertRemToPixels as ag,
214576
+ untrack as ah,
214577
+ $TRACK as ai,
214578
+ useTransition as aj,
214579
+ spread as ak,
214580
+ mergeProps as al,
214581
+ createRoot as am,
214582
+ serialize as an,
214583
+ Index as ao,
214584
+ updateNestedDataByPath as ap,
214585
+ addEventListener as aq,
214586
+ stringify as ar,
214587
+ Match as as,
214588
+ Switch as at,
214589
+ deleteNestedDataByPath as au,
214590
+ splitProps as av,
214591
+ Dynamic as aw,
214592
+ createComputed as ax,
214593
+ ClinicalApp as ay,
214583
214594
  ar as b,
214584
- useQueryClient as c,
214585
- bn as d,
214586
- $c as e,
214595
+ $1 as c,
214596
+ useQueryClient as d,
214597
+ bn as e,
214587
214598
  cat as f,
214588
214599
  gat as g,
214589
214600
  h0t as h,