Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(fix) Move HtmlFormEntryForm type to patient-common-lib #1983

Merged
merged 1 commit into from
Aug 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading