@kenyaemr/esm-express-workflow-app 5.4.4-pre.299 → 5.4.4-pre.3

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 (124) hide show
  1. package/.turbo/turbo-build.log +3 -3
  2. package/dist/126.js +1 -0
  3. package/dist/126.js.map +1 -0
  4. package/dist/2024.js +1 -1
  5. package/dist/2024.js.map +1 -1
  6. package/dist/2225.js +1 -1
  7. package/dist/2225.js.map +1 -1
  8. package/dist/2386.js +1 -0
  9. package/dist/2386.js.map +1 -0
  10. package/dist/2438.js +1 -1
  11. package/dist/2438.js.map +1 -1
  12. package/dist/4504.js +1 -0
  13. package/dist/4504.js.map +1 -0
  14. package/dist/4670.js +1 -0
  15. package/dist/4670.js.map +1 -0
  16. package/dist/4682.js +1 -1
  17. package/dist/4682.js.map +1 -1
  18. package/dist/5047.js +1 -0
  19. package/dist/5047.js.map +1 -0
  20. package/dist/586.js.map +1 -1
  21. package/dist/5986.js +1 -1
  22. package/dist/5986.js.map +1 -1
  23. package/dist/6075.js +1 -0
  24. package/dist/6075.js.map +1 -0
  25. package/dist/6328.js +1 -1
  26. package/dist/6328.js.map +1 -1
  27. package/dist/64.js +1 -0
  28. package/dist/64.js.map +1 -0
  29. package/dist/6456.js +1 -1
  30. package/dist/6720.js +1 -0
  31. package/dist/6720.js.map +1 -0
  32. package/dist/7607.js +1 -1
  33. package/dist/8566.js +1 -0
  34. package/dist/8566.js.map +1 -0
  35. package/dist/8727.js +1 -1
  36. package/dist/8799.js +1 -0
  37. package/dist/8799.js.map +1 -0
  38. package/dist/8911.js +1 -1
  39. package/dist/8911.js.map +1 -1
  40. package/dist/9157.js +1 -1
  41. package/dist/9157.js.map +1 -1
  42. package/dist/9161.js +1 -0
  43. package/dist/9161.js.map +1 -0
  44. package/dist/9182.js +1 -1
  45. package/dist/9343.js +1 -0
  46. package/dist/9343.js.map +1 -0
  47. package/dist/9535.js +1 -1
  48. package/dist/9535.js.map +1 -1
  49. package/dist/9834.js +1 -0
  50. package/dist/{4432.js.map → 9834.js.map} +1 -1
  51. package/dist/kenyaemr-esm-express-workflow-app.js +2 -2
  52. package/dist/kenyaemr-esm-express-workflow-app.js.buildmanifest.json +294 -151
  53. package/dist/kenyaemr-esm-express-workflow-app.js.map +1 -1
  54. package/dist/main.js +2 -2
  55. package/dist/main.js.map +1 -1
  56. package/dist/routes.json +1 -1
  57. package/package.json +1 -1
  58. package/src/components/admissions/index.tsx +0 -1
  59. package/src/components/anaesthetic/anaesthetic.component.tsx +10 -4
  60. package/src/components/anaesthetic/forms/interoperative-record-drug-given-form.component.tsx +2 -26
  61. package/src/components/anaesthetic/graphs/interoperative-record-drug-given-graph-wrapper.component.tsx +66 -25
  62. package/src/components/anaesthetic/resources/anaesthetic.resource.ts +2 -2
  63. package/src/components/consultation/clinical-encounter/clinical-encounter.component.tsx +4 -20
  64. package/src/components/consultation/index.ts +1 -1
  65. package/src/components/consultation/tabs/index.ts +67 -0
  66. package/src/components/facility-dashboard/components/header/home-header.component.tsx +8 -13
  67. package/src/components/laboratory/index.ts +11 -0
  68. package/src/components/laboratory/lab-table.component.tsx +25 -12
  69. package/src/components/laboratory/laboratory-tabs.component.tsx +3 -17
  70. package/src/components/pharmacy/index.ts +1 -1
  71. package/src/components/pharmacy/pharmacy-tabs.component.tsx +4 -20
  72. package/src/components/pharmacy/tabs/index.ts +21 -0
  73. package/src/components/procedures/index.ts +16 -0
  74. package/src/components/procedures/procedures-table.component.tsx +33 -15
  75. package/src/components/procedures/procedures-tabs.component.tsx +3 -22
  76. package/src/components/radiology-and-imaging/index.ts +11 -0
  77. package/src/components/radiology-and-imaging/radiology-and-imaging-table.component.tsx +35 -15
  78. package/src/components/radiology-and-imaging/radiology-and-imaging.component.tsx +3 -19
  79. package/src/components/registration/card/Local-card/local-card.component.tsx +3 -3
  80. package/src/components/registration/dependants/dependants.component.tsx +6 -1
  81. package/src/components/registration/end-visit-modal/end-visit-dialog.modal.tsx +320 -0
  82. package/src/components/registration/end-visit-modal/end-visit-dialog.scss +12 -0
  83. package/src/components/registration/end-visit-modal/end-visit.resource.tsx +59 -0
  84. package/src/components/registration/end-visit-modal/sha-end-visit.resource.ts +285 -0
  85. package/src/components/registration/start-visit-form/overflow-menu-extension/custom-end-active-visit.extension.tsx +44 -0
  86. package/src/components/registration/start-visit-form/start-visit-workspace/exported-visit-form.workspace.tsx +16 -11
  87. package/src/components/registration/type/index.ts +101 -0
  88. package/src/config-schema.ts +23 -1
  89. package/src/index.ts +36 -17
  90. package/src/routes.json +205 -12
  91. package/src/shared/otp-verification/index.ts +3 -0
  92. package/src/shared/otp-verification/otp-verification.modal.tsx +51 -17
  93. package/src/shared/patient-chart/patient-summary-dashboard/patient-summary-dashboard.component.tsx +5 -73
  94. package/src/shared/tabs/create-tab-extension.tsx +33 -0
  95. package/src/shared/tabs/extension-tabs.component.tsx +51 -33
  96. package/src/shared/utils/index.ts +6 -6
  97. package/translations/am.json +32 -24
  98. package/translations/en.json +23 -16
  99. package/translations/fr.json +23 -16
  100. package/translations/sw.json +23 -21
  101. package/Failed to delete encounter/am.json +0 -4
  102. package/Failed to delete encounter/en.json +0 -4
  103. package/Failed to delete encounter/fr.json +0 -4
  104. package/Failed to delete encounter/sw.json +0 -4
  105. package/dist/2332.js +0 -1
  106. package/dist/2332.js.map +0 -1
  107. package/dist/4432.js +0 -1
  108. package/dist/4666.js +0 -1
  109. package/dist/4666.js.map +0 -1
  110. package/dist/5733.js +0 -1
  111. package/dist/5733.js.map +0 -1
  112. package/dist/644.js +0 -1
  113. package/dist/644.js.map +0 -1
  114. package/dist/655.js +0 -1
  115. package/dist/655.js.map +0 -1
  116. package/dist/70.js +0 -1
  117. package/dist/70.js.map +0 -1
  118. package/dist/9387.js +0 -1
  119. package/dist/9387.js.map +0 -1
  120. package/src/components/admissions/admission-medication-summary.tsx +0 -302
  121. package/src/components/admissions/admissions-dashboard.utils.test.ts +0 -48
  122. package/src/components/admissions/admissions-dashboard.utils.tsx +0 -63
  123. package/src/shared/orders/OrdersTabs.tsx +0 -76
  124. /package/src/shared/{patient-chart/patient-summary-dashboard → tabs}/patient-summary-dashboard.scss +0 -0
@@ -1,48 +0,0 @@
1
- import { describe, expect, it, vi } from 'vitest';
2
-
3
- vi.mock('@openmrs/esm-framework', () => ({
4
- formatDate: vi.fn((date: Date) => date.toISOString().slice(0, 10)),
5
- parseDate: vi.fn((value: string) => new Date(value)),
6
- }));
7
-
8
- const { formatAdministrationInstructions, getDrugDisplay } = await import('./admissions-dashboard.utils');
9
-
10
- describe('admissions-dashboard utils', () => {
11
- it('formats administration instructions with translated entries', () => {
12
- const order = {
13
- quantity: 500,
14
- quantityUnits: { display: 'ml' },
15
- frequency: { display: 'OD' },
16
- dose: 20,
17
- doseUnits: { display: 'drops/min' },
18
- duration: 2,
19
- durationUnits: { display: 'days' },
20
- } as any;
21
-
22
- const translated = formatAdministrationInstructions(order, (key, defaultValue, options) => {
23
- const dictionary = {
24
- administrationVolumeValue: 'Vol: {{value}}',
25
- administrationFrequencyValue: 'Freq: {{value}}',
26
- administrationRateValue: 'Ritmo: {{value}}',
27
- administrationDurationValue: 'Duree: {{value}}',
28
- };
29
-
30
- const template = dictionary[key as keyof typeof dictionary] ?? defaultValue;
31
- return template.replace('{{value}}', String(options?.value ?? '--'));
32
- });
33
-
34
- expect(translated).toContain('Vol: 500 ml');
35
- expect(translated).toContain('Freq: OD');
36
- expect(translated).toContain('Ritmo: 20 drops/min');
37
- expect(translated).toContain('Duree: 2 days');
38
- });
39
-
40
- it('falls back to non-coded drug name when drug display is missing', () => {
41
- const order = {
42
- drug: undefined,
43
- drugNonCoded: 'Custom compounded mix',
44
- } as any;
45
-
46
- expect(getDrugDisplay(order)).toBe('Custom compounded mix');
47
- });
48
- });
@@ -1,63 +0,0 @@
1
- import { formatDate as formatLocalizedDate, parseDate } from '@openmrs/esm-framework';
2
- import { type Order } from '@openmrs/esm-patient-common-lib';
3
- import { useTranslation } from 'react-i18next';
4
-
5
- type TranslateOptions = {
6
- value?: string;
7
- };
8
-
9
- type TranslateFn = (key: string, defaultValue: string, options?: TranslateOptions) => string;
10
-
11
- export const formatValue = (value: string | number | undefined | null) => (value || value === 0 ? String(value) : '--');
12
-
13
- export const formatOrderDate = (dateValue?: string | null) => {
14
- if (!dateValue) {
15
- return '--';
16
- }
17
-
18
- return formatLocalizedDate(parseDate(dateValue));
19
- };
20
-
21
- export const formatTime = (dateValue?: string | null) => {
22
- if (!dateValue) {
23
- return '--';
24
- }
25
-
26
- const parsed = new Date(dateValue);
27
- return Number.isNaN(parsed.getTime()) ? '--' : parsed.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' });
28
- };
29
-
30
- export const getDoseText = (order: Order) =>
31
- [formatValue(order.dose), order.doseUnits?.display].filter((part) => part && part !== '--').join(' ') || '--';
32
-
33
- export const getVolumeText = (order: Order) =>
34
- [formatValue(order.quantity), order.quantityUnits?.display].filter((part) => part && part !== '--').join(' ') || '--';
35
-
36
- export const getDrugDisplay = (order: Order) => {
37
- const nonCodedDrugName = (order as Order & { drugNonCoded?: string }).drugNonCoded;
38
- return order.drug?.display || nonCodedDrugName || '--';
39
- };
40
-
41
- export const formatAdministrationInstructions = (order: Order, t: TranslateFn) => {
42
- const volume = getVolumeText(order);
43
- const frequency = formatValue(order.frequency?.display);
44
- const rate = getDoseText(order);
45
- const duration =
46
- [formatValue(order.duration), order.durationUnits?.display].filter((part) => part && part !== '--').join(' ') ||
47
- '--';
48
-
49
- return [
50
- t('administrationVolumeValue', 'Volume: {{value}}', { value: volume }),
51
- t('administrationFrequencyValue', 'Frequency: {{value}}', { value: frequency }),
52
- t('administrationRateValue', 'Rate: {{value}}', { value: rate }),
53
- t('administrationDurationValue', 'Duration: {{value}}', { value: duration }),
54
- ].join(' | ');
55
- };
56
-
57
- export const useFormatAdministrationInstructions = () => {
58
- const { t } = useTranslation();
59
-
60
- const translate: TranslateFn = (key, defaultValue, options) => t(key, { defaultValue, ...(options ?? {}) });
61
-
62
- return (order: Order) => formatAdministrationInstructions(order, translate);
63
- };
@@ -1,76 +0,0 @@
1
- import React, { useMemo } from 'react';
2
- import { useTranslation } from 'react-i18next';
3
- import { ExtensionSlot } from '@openmrs/esm-framework';
4
- import { Layer, Tabs, TabList, Tab, TabPanels, TabPanel, TabsSkeleton } from '@carbon/react';
5
- import { DocumentMultiple_02, RequestQuote } from '@carbon/react/icons';
6
- import { usePatientOrders } from '../../hooks/useOrders';
7
- import { type Order } from '../../types/order/order';
8
-
9
- type AdditionalTab = {
10
- label: string;
11
- content: React.ReactNode;
12
- };
13
-
14
- type OrdersTabsProps = {
15
- patientUuid: string;
16
- patient: fhir.Patient;
17
- basePath: string;
18
- resultsSlotName: string;
19
- orderTypeUuid: string;
20
- filter?: (o: Order) => boolean;
21
- Table: React.ComponentType<{ orders: Order[]; mutateOrders: () => void }>;
22
- additionalTabs?: AdditionalTab[];
23
- };
24
-
25
- export const OrdersTabs: React.FC<OrdersTabsProps> = ({
26
- patientUuid,
27
- patient,
28
- basePath,
29
- resultsSlotName,
30
- orderTypeUuid,
31
- filter,
32
- Table,
33
- additionalTabs,
34
- }) => {
35
- const { t } = useTranslation();
36
- const state = useMemo(() => ({ patientUuid, patient, basePath }), [patientUuid, patient, basePath]);
37
- const {
38
- data: orders,
39
- isLoading,
40
- error,
41
- mutate: mutateOrders,
42
- } = usePatientOrders(patientUuid, 'any', orderTypeUuid, undefined, undefined);
43
-
44
- const filteredOrders = useMemo(() => (filter ? orders?.filter(filter) ?? [] : orders ?? []), [filter, orders]);
45
-
46
- if (isLoading) {
47
- return <TabsSkeleton contained />;
48
- }
49
-
50
- return (
51
- <Layer>
52
- <Tabs>
53
- <TabList contained>
54
- <Tab renderIcon={RequestQuote}>{t('orders', 'Orders')}</Tab>
55
- <Tab renderIcon={DocumentMultiple_02}>{t('results', 'Results')}</Tab>
56
- {additionalTabs?.map((tab, index) => (
57
- <Tab key={`${tab.label}-${index}`}>{tab.label}</Tab>
58
- ))}
59
- </TabList>
60
- <TabPanels>
61
- <TabPanel>
62
- <Table orders={filteredOrders} mutateOrders={mutateOrders} />
63
- </TabPanel>
64
- <TabPanel>
65
- <ExtensionSlot state={state} name={resultsSlotName} />
66
- </TabPanel>
67
- {additionalTabs?.map((tab, index) => (
68
- <TabPanel key={`${tab.label}-panel-${index}`}>{tab.content}</TabPanel>
69
- ))}
70
- </TabPanels>
71
- </Tabs>
72
- </Layer>
73
- );
74
- };
75
-
76
- export default OrdersTabs;