Skip to content

Commit

Permalink
fix: launch Start Visit form immediately from Appointment Scheduler
Browse files Browse the repository at this point in the history
  • Loading branch information
Bharath-K-Shetty committed Jan 14, 2025
1 parent d1f9258 commit 8f40195
Show file tree
Hide file tree
Showing 2 changed files with 118 additions and 117 deletions.
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
import { Button } from '@carbon/react';
import { launchPatientChartWithWorkspaceOpen } from '@openmrs/esm-patient-common-lib';
import { launchPatientWorkspace } from '@openmrs/esm-patient-common-lib';
import React, { useCallback } from 'react';
import { useTranslation } from 'react-i18next';

const StartVisitButton = ({ patientUuid }) => {
const { t } = useTranslation();

const handleStartVisit = useCallback(() => {
launchPatientChartWithWorkspaceOpen({
patientUuid,
workspaceName: 'start-visit-workspace-form',
additionalProps: {
try {
launchPatientWorkspace('start-visit-workspace-form', {
patientUuid,
openedFrom: 'patient-chart-start-visit',
},
});
});
} catch (error) {
console.error('Error launching Start Visit workspace:', error);
}
}, [patientUuid]);

return (
<Button kind="primary" onClick={handleStartVisit}>
<Button kind="primary" onClick={handleStartVisit} aria-label={t('startVisit', 'Start visit')}>
{t('startVisit', 'Start visit')}
</Button>
);
Expand Down
Loading

0 comments on commit 8f40195

Please sign in to comment.