-
Notifications
You must be signed in to change notification settings - Fork 231
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(feat) - O3-4200 Service queues - use visit form in patient chart for… (
#1402) * (feat) - O3-4200 Service queues - use visit form in patient chart for create queue entry workflow * rename slot names
- Loading branch information
Showing
48 changed files
with
453 additions
and
1,842 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
99 changes: 99 additions & 0 deletions
99
packages/esm-service-queues-app/src/create-queue-entry/create-queue-entry.workspace.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
import { Button, DataTableSkeleton } from '@carbon/react'; | ||
import { | ||
ArrowLeftIcon, | ||
ErrorState, | ||
ExtensionSlot, | ||
getPatientName, | ||
PatientBannerContactDetails, | ||
PatientBannerPatientInfo, | ||
PatientBannerToggleContactDetailsButton, | ||
PatientPhoto, | ||
usePatient, | ||
useVisit, | ||
type DefaultWorkspaceProps, | ||
} from '@openmrs/esm-framework'; | ||
import React, { useState } from 'react'; | ||
import { useTranslation } from 'react-i18next'; | ||
import styles from './create-queue-entry.scss'; | ||
import ExistingVisitFormComponent from './existing-visit-form/existing-visit-form.component'; | ||
|
||
interface PatientSearchProps extends DefaultWorkspaceProps { | ||
selectedPatientUuid: string; | ||
currentServiceQueueUuid?: string; | ||
handleBackToSearchList?: () => void; | ||
} | ||
|
||
export const AddPatientToQueueContext = React.createContext({ | ||
currentServiceQueueUuid: '', | ||
}); | ||
|
||
/** | ||
* | ||
* This is the component that appears when clicking on a search result in the "Add patient to queue" workspace, | ||
*/ | ||
const CreateQueueEntryWorkspace: React.FC<PatientSearchProps> = ({ | ||
closeWorkspace, | ||
promptBeforeClosing, | ||
selectedPatientUuid, | ||
currentServiceQueueUuid, | ||
handleBackToSearchList, | ||
}) => { | ||
const { t } = useTranslation(); | ||
const { patient } = usePatient(selectedPatientUuid); | ||
const { activeVisit, isLoading, error } = useVisit(selectedPatientUuid); | ||
|
||
const [showContactDetails, setContactDetails] = useState(false); | ||
|
||
const patientName = patient && getPatientName(patient); | ||
|
||
return patient ? ( | ||
<div className={styles.patientSearchContainer}> | ||
<AddPatientToQueueContext.Provider value={{ currentServiceQueueUuid }}> | ||
<div className={styles.patientBannerContainer}> | ||
<div className={styles.patientBanner}> | ||
<div className={styles.patientPhoto}> | ||
<PatientPhoto patientUuid={patient.id} patientName={patientName} /> | ||
</div> | ||
<PatientBannerPatientInfo patient={patient} /> | ||
<PatientBannerToggleContactDetailsButton | ||
showContactDetails={showContactDetails} | ||
toggleContactDetails={() => setContactDetails(!showContactDetails)} | ||
/> | ||
</div> | ||
{showContactDetails ? ( | ||
<PatientBannerContactDetails patientId={patient.id} deceased={patient.deceasedBoolean} /> | ||
) : null} | ||
</div> | ||
<div className={styles.backButton}> | ||
<Button | ||
kind="ghost" | ||
renderIcon={(props) => <ArrowLeftIcon size={24} {...props} />} | ||
iconDescription={t('backToSearchResults', 'Back to search results')} | ||
size="sm" | ||
onClick={() => handleBackToSearchList?.()}> | ||
<span>{t('backToSearchResults', 'Back to search results')}</span> | ||
</Button> | ||
</div> | ||
{isLoading ? ( | ||
<DataTableSkeleton role="progressbar" /> | ||
) : error ? ( | ||
<ErrorState headerTitle={t('errorFetchingVisit', 'Error fetching patient visit')} error={error} /> | ||
) : activeVisit ? ( | ||
<ExistingVisitFormComponent visit={activeVisit} closeWorkspace={closeWorkspace} /> | ||
) : ( | ||
<ExtensionSlot | ||
name="start-visit-workspace-form-slot" | ||
state={{ | ||
patientUuid: selectedPatientUuid, | ||
closeWorkspace, | ||
promptBeforeClosing, | ||
openedFrom: 'service-queues-add-patient', | ||
}} | ||
/> | ||
)} | ||
</AddPatientToQueueContext.Provider> | ||
</div> | ||
) : null; | ||
}; | ||
|
||
export default CreateQueueEntryWorkspace; |
Oops, something went wrong.