diff --git a/packages/esm-patient-chart-app/translations/km.json b/packages/esm-patient-chart-app/translations/km.json index 0b5c560e68..92fc437a99 100644 --- a/packages/esm-patient-chart-app/translations/km.json +++ b/packages/esm-patient-chart-app/translations/km.json @@ -10,7 +10,7 @@ "appointmentUpdate": "ធ្វើបច្ចុប្បន្នភាពការណាត់ជួបនាពេលខាងមុខបានជោគជ័យ", "Attachments dashboard": "ផ្ទាំងគ្រប់គ្រងឯកសារភ្ជាប់", "cancel": "បោះបង់", - "cancelActiveVisitConfirmation": "តើ\u200bអ្នក\u200bពិតជា\u200bចង់\u200bបោះបង់ការពិនិត្យជំងឺ\u200bសកម្ម\u200bនេះទេ?", + "cancelActiveVisitConfirmation": "តើ​អ្នក​ពិតជា​ចង់​បោះបង់ការពិនិត្យជំងឺ​សកម្ម​នេះទេ?", "cancellingVisit": "បោះបង់ការពិនិត្យជំងឺ", "cancelVisit": "បោះបង់ការជួបពិនិត្យជំងឺ", "cancelVisitExplainerMessage": "បោះបង់ការពិនិត្យជំងឺនេះនឹងលុបការមកពិនិត្យជំងឺដែលពាក់ព័ន្ធ។", @@ -61,7 +61,7 @@ "errorDeletingVisit": "មានបញ្ហាបច្ចេកទេសក្នុងការលុបការពិនិត្យជំងឺ", "errorEndingVisit": "មានបញ្ហាបច្ចេកទេសបញ្ចប់ការពិនិត្យជំងឺ", "errorOccuredDeletingVisit": "មានបញ្ហាបច្ចេកទេសនៅពេលលុបការពិនិត្យជំងឺ", - "errorUpdatingVisitDetails": "មានបញ្ហាបច្ចេកទេស\u200bក្នុង\u200bការ\u200bធ្វើ\u200bបច្ចុប្បន្នភាព\u200bព័ត៌មាន\u200bលម្អិត\u200bនៃ\u200bការ\u200bពិនិត្យជំងឺ", + "errorUpdatingVisitDetails": "មានបញ្ហាបច្ចេកទេស​ក្នុង​ការ​ធ្វើ​បច្ចុប្បន្នភាព​ព័ត៌មាន​លម្អិត​នៃ​ការ​ពិនិត្យជំងឺ", "errorWhenRestoringVisit": "មានបញ្ហាបច្ចេកទេសនៅពេលទាញមកវិញនូវ{{visit}}", "failedDeleting": "មិនអាចលុបបានទេ", "failedToLoadCurrentVisit": "ការទាញទិន្នន័យពិនិត្យជំងឺបច្ចុប្បន្នបរាជ័យ", @@ -173,7 +173,7 @@ "visitEndSuccessfully": "បានបញ្ចប់ការមកពិនិត្យជំងឺបច្ចុប្បន្នដោយជោគជ័យ", "visitLocation": "ទីតាំងការមកពិនិត្យជំងឺ", "visitNotRestored": "ការពិនិត្យជំងឺមិនអាចទាញមកវិញបានទេ", - "visitRestored": "ការពិនិត្យជំងឺ\u200bបាន\u200bទាញមកវិញបាន", + "visitRestored": "ការពិនិត្យជំងឺ​បាន​ទាញមកវិញបាន", "visitRestoredSuccessfully": "{{visit}} បានទាញមកវិញដោយជោគជ័យ", "visits": "មកពិនិត្យជំងឺ", "Visits": "មកពិនិត្យជំងឺ", diff --git a/packages/esm-patient-common-lib/src/orders/types.ts b/packages/esm-patient-common-lib/src/orders/types.ts index 385c9f2607..6e1d603baa 100644 --- a/packages/esm-patient-common-lib/src/orders/types.ts +++ b/packages/esm-patient-common-lib/src/orders/types.ts @@ -123,6 +123,10 @@ export interface Order { type: string; } +export interface OrderTypeFetchResponse { + results: Array; +} + export interface OrderType { uuid: string; display: string; diff --git a/packages/esm-patient-common-lib/src/orders/useOrders.ts b/packages/esm-patient-common-lib/src/orders/useOrders.ts index 7cfaffb40e..56c8fae09e 100644 --- a/packages/esm-patient-common-lib/src/orders/useOrders.ts +++ b/packages/esm-patient-common-lib/src/orders/useOrders.ts @@ -1,7 +1,7 @@ import useSWR, { mutate } from 'swr'; -import { type FetchResponse, openmrsFetch, useConfig } from '@openmrs/esm-framework'; +import { type FetchResponse, openmrsFetch } from '@openmrs/esm-framework'; import { useCallback, useMemo } from 'react'; -import { type OrderBasketItem, type OrderPost, type PatientOrderFetchResponse } from '@openmrs/esm-patient-common-lib'; +import { type OrderTypeFetchResponse, type PatientOrderFetchResponse } from '@openmrs/esm-patient-common-lib'; export const careSettingUuid = '6f0c9a92-6f24-11e3-af88-005056821db0'; @@ -38,7 +38,10 @@ export function usePatientOrders(patientUuid: string, status: 'ACTIVE' | 'any', export function useOrderTypes() { const orderTypesUrl = `/ws/rest/v1/ordertype`; - const { data, error, isLoading, isValidating } = useSWR(orderTypesUrl, openmrsFetch); + const { data, error, isLoading, isValidating } = useSWR, Error>( + orderTypesUrl, + openmrsFetch, + ); return { data: data?.data?.results, diff --git a/packages/esm-patient-orders-app/src/api/api.ts b/packages/esm-patient-orders-app/src/api/api.ts index 98ba52e191..c2811a22ab 100644 --- a/packages/esm-patient-orders-app/src/api/api.ts +++ b/packages/esm-patient-orders-app/src/api/api.ts @@ -1,13 +1,7 @@ import { useCallback, useMemo } from 'react'; -import useSWR, { mutate, useSWRConfig } from 'swr'; +import useSWR, { useSWRConfig } from 'swr'; import { type FetchResponse, openmrsFetch, type OpenmrsResource, parseDate, type Visit } from '@openmrs/esm-framework'; -import { - type OrderPost, - useVisitOrOfflineVisit, - useSystemVisitSetting, - type PatientOrderFetchResponse, - OrderType, -} from '@openmrs/esm-patient-common-lib'; +import { type OrderPost, useVisitOrOfflineVisit, useSystemVisitSetting } from '@openmrs/esm-patient-common-lib'; export const careSettingUuid = '6f0c9a92-6f24-11e3-af88-005056821db0'; diff --git a/packages/esm-patient-orders-app/src/components/orders-details-table.component.tsx b/packages/esm-patient-orders-app/src/components/orders-details-table.component.tsx index 5804246aec..a8d84f5ed6 100644 --- a/packages/esm-patient-orders-app/src/components/orders-details-table.component.tsx +++ b/packages/esm-patient-orders-app/src/components/orders-details-table.component.tsx @@ -30,7 +30,8 @@ import { ErrorState, usePatientOrders, useOrderTypes, -} from '@openmrs/esm-patient-common-lib'; +} from '../../../esm-patient-common-lib'; +// } from '@openmrs/esm-patient-common-lib'; import { Add, User, Printer } from '@carbon/react/icons'; import { age, formatDate, useConfig, useLayoutType, usePagination, usePatient } from '@openmrs/esm-framework'; import { useTranslation } from 'react-i18next'; @@ -40,7 +41,6 @@ import { compare, orderPriorityToColor } from '../utils/utils'; import PrintComponent from '../print/print.component'; import { orderBy } from 'lodash-es'; import { Tooltip } from '@carbon/react'; - interface OrderDetailsProps { title?: string; patientUuid: string; @@ -130,7 +130,10 @@ const OrderDetailsTable: React.FC = ({ title, patientUuid, sh orderId: order.orderNumber, dateOfOrder: formatDate(new Date(order.dateActivated)), orderType: capitalize(order.orderType?.display ?? '--'), - order:
{order.display.length > 20 ? order.display.substring(0, 20).concat('...') : order.display}
, + order: order.display, + // order: ( + //
{order.display.length > 20 ? : order.display}
+ // ), priority: (
{capitalize(order.urgency)} @@ -191,18 +194,13 @@ const OrderDetailsTable: React.FC = ({ title, patientUuid, sh }; }, [patient, t, excludePatientIdentifierCodeTypes?.uuids]); - // trigger a refetch to parent component if selectedOrderType changes - useEffect(() => { - // TODO: this is a hack to trigger a refetch of the parent component - }, [selectedOrderTypeUuid]); - const onBeforeGetContentResolve = useRef(null); useEffect(() => { if (isPrinting && onBeforeGetContentResolve.current) { onBeforeGetContentResolve.current(); } - }, [isPrinting]); + }, [isPrinting, onBeforeGetContentResolve]); const handlePrint = useReactToPrint({ content: () => contentToPrintRef.current, @@ -312,7 +310,7 @@ const OrderDetailsTable: React.FC = ({ title, patientUuid, sh {row.cells.map((cell) => ( - {cell.value?.content ?? cell.value} + ))} {!isPrinting && ( @@ -353,12 +351,16 @@ const OrderDetailsTable: React.FC = ({ title, patientUuid, sh ); }; -function OrderDisplayTooltip({ orderDisplay }: { orderDisplay: string }) { +function FormatCellDisplay({ rowDisplay }: { rowDisplay: string }) { return ( <> - - {orderDisplay.substring(0, 20).concat('...')} - + {typeof rowDisplay === 'string' && rowDisplay.length > 20 ? ( + + <>{rowDisplay.substring(0, 20).concat('...')} + + ) : ( + rowDisplay + )} ); } diff --git a/packages/esm-patient-orders-app/src/index.ts b/packages/esm-patient-orders-app/src/index.ts index 0c210785f7..ed67c723da 100644 --- a/packages/esm-patient-orders-app/src/index.ts +++ b/packages/esm-patient-orders-app/src/index.ts @@ -1,4 +1,4 @@ -import { defineConfigSchema, getAsyncLifecycle, getSyncLifecycle } from '@openmrs/esm-framework'; +import { defineConfigSchema, getAsyncLifecycle, getSyncLifecycle, registerFeatureFlag } from '@openmrs/esm-framework'; import { createDashboardLink, registerWorkspace } from '@openmrs/esm-patient-common-lib'; import { configSchema } from './config-schema'; import orderBasketActionMenuComponent from './order-basket-action-button/order-basket-action-button.extension'; @@ -26,14 +26,22 @@ registerWorkspace({ canHide: true, }); +registerFeatureFlag( + 'ordersSummary', + 'Orders Summary', + 'This feature introduces a navigation on the patient chart left nav called Orders and shows a history of patient orders within patient chart', +); + export const orderBasketActionMenu = getSyncLifecycle(orderBasketActionMenuComponent, options); -export const ordersDashboardLink = getSyncLifecycle( - createDashboardLink({ - ...ordersDashboardMeta, - moduleName, - }), - options, -); +export const ordersDashboardLink = + // t('Orders', 'Orders') + getSyncLifecycle( + createDashboardLink({ + ...ordersDashboardMeta, + moduleName, + }), + options, + ); export const ordersDashboard = getSyncLifecycle(OrdersSummary, options); diff --git a/packages/esm-patient-orders-app/src/orders-summary/orders-summary.component.tsx b/packages/esm-patient-orders-app/src/orders-summary/orders-summary.component.tsx index 85c8923294..c928e4ed5a 100644 --- a/packages/esm-patient-orders-app/src/orders-summary/orders-summary.component.tsx +++ b/packages/esm-patient-orders-app/src/orders-summary/orders-summary.component.tsx @@ -8,7 +8,7 @@ export interface OrdersSummaryProps { const OrdersSummary: React.FC = ({ patientUuid }) => { const { t } = useTranslation(); - const ordersDisplayText = t('Orders', 'Orders'); + const ordersDisplayText = t('orders', 'Orders'); return (
@@ -16,7 +16,7 @@ const OrdersSummary: React.FC = ({ patientUuid }) => { title={ordersDisplayText} patientUuid={patientUuid} showAddButton={true} - showPrintButton={false} // TODO: find out preferred way to print orders + showPrintButton={false} />
); diff --git a/packages/esm-patient-orders-app/src/routes.json b/packages/esm-patient-orders-app/src/routes.json index 8623dfdcd7..a4cd896623 100644 --- a/packages/esm-patient-orders-app/src/routes.json +++ b/packages/esm-patient-orders-app/src/routes.json @@ -20,7 +20,8 @@ "path": "Orders", "hideDashboardTitle": true }, - "order": 4 + "order": 4, + "featureFlag": "ordersSummary" }, { "name": "patient-orders-dashboard", @@ -28,7 +29,8 @@ "slot": "patient-chart-orders-dashboard-slot", "meta": { "columnSpan": 4 - } + }, + "featureFlag": "ordersSummary" } ] }