Skip to content

Commit

Permalink
(fix) Move HtmlFormEntryForm type to patient-common-lib (#1983)
Browse files Browse the repository at this point in the history
  • Loading branch information
ibacher authored Aug 29, 2024
1 parent d4cd290 commit 8858654
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,12 @@ import {
useSession,
userHasAccess,
} from '@openmrs/esm-framework';
import { EmptyState, PatientChartPagination, launchFormEntryOrHtmlForms } from '@openmrs/esm-patient-common-lib';
import type { HtmlFormEntryForm } from '@openmrs/esm-patient-forms-app/src/config-schema';
import {
type HtmlFormEntryForm,
EmptyState,
PatientChartPagination,
launchFormEntryOrHtmlForms,
} from '@openmrs/esm-patient-common-lib';
import { deleteEncounter } from './visits-table.resource';
import { type MappedEncounter } from '../../visit.resource';
import EncounterObservations from '../../encounter-observations';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type HtmlFormEntryForm } from '@openmrs/esm-patient-forms-app/src/config-schema';
import { type HtmlFormEntryForm } from '../types';

export interface FormEntryProps {
encounterUuid?: string;
Expand Down
10 changes: 8 additions & 2 deletions packages/esm-patient-common-lib/src/types/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { type OpenmrsResource } from '@openmrs/esm-framework';

export * from './test-results';

export interface DashboardLinkConfig {
Expand Down Expand Up @@ -49,3 +47,11 @@ export interface DisplayMetadata {
links: Links;
uuid: string;
}

export interface HtmlFormEntryForm {
formUuid: string;
formName: string;
formUiResource: string;
formUiPage: 'enterHtmlFormWithSimpleUi' | 'enterHtmlFormWithStandardUi';
formEditUiPage: 'editHtmlFormWithSimpleUi' | 'editHtmlFormWithStandardUi';
}
9 changes: 1 addition & 8 deletions packages/esm-patient-forms-app/src/config-schema.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { validator, Type } from '@openmrs/esm-framework';
import { type HtmlFormEntryForm } from '@openmrs/esm-patient-common-lib';

export const configSchema = {
htmlFormEntryForms: {
Expand Down Expand Up @@ -133,14 +134,6 @@ export const configSchema = {
},
};

export interface HtmlFormEntryForm {
formUuid: string;
formName: string;
formUiResource: string;
formUiPage: 'enterHtmlFormWithSimpleUi' | 'enterHtmlFormWithStandardUi';
formEditUiPage: 'editHtmlFormWithSimpleUi' | 'editHtmlFormWithStandardUi';
}

export interface FormsSection {
name: string;
forms: Array<string>;
Expand Down
9 changes: 6 additions & 3 deletions packages/esm-patient-forms-app/src/form-entry-interop.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import { navigate, type Visit } from '@openmrs/esm-framework';
import { type HtmlFormEntryForm } from './config-schema';
import isEmpty from 'lodash-es/isEmpty';
import { launchPatientWorkspace, launchStartVisitPrompt } from '@openmrs/esm-patient-common-lib';
import {
type HtmlFormEntryForm,
launchPatientWorkspace,
launchStartVisitPrompt,
} from '@openmrs/esm-patient-common-lib';
import { isEmpty } from 'lodash-es';

export function launchFormEntryOrHtmlForms(
currentVisit: Visit | undefined,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import useSWR from 'swr';
import { getDynamicOfflineDataEntries } from '@openmrs/esm-framework';
import { type HtmlFormEntryForm } from '@openmrs/esm-patient-common-lib';
import { type Form, type FormEncounterResource } from '../types';
import { type HtmlFormEntryForm } from '../config-schema';

/**
* Returns whether the given form encounter is valid for offline mode and can be cached.
Expand Down

0 comments on commit 8858654

Please sign in to comment.