Skip to content
This repository has been archived by the owner on Apr 28, 2021. It is now read-only.

Commit

Permalink
Add ability to launch vitals forms from vitals-status header & rename…
Browse files Browse the repository at this point in the history
…d vitals-header extension (#179)
  • Loading branch information
donaldkibet authored Jan 22, 2021
1 parent 3a094b2 commit 421c948
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ function setupOpenMRS() {
)
},
{
id: "patient-vital-header-ext",
slot: "patient-vital-header-status-bar",
id: "patient-vital-status-ext",
slot: "patient-vital-status",
load: getAsyncLifecycle(
() =>
import(
Expand All @@ -66,8 +66,8 @@ function setupOpenMRS() {
)
},
{
id: "patient-banner-ext",
slot: "patient-banner",
id: "patient-chart-header-ext",
slot: "patient-chart-header",
load: getAsyncLifecycle(
() => import("./widgets/banner/patient-banner.component"),
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import { Button } from "carbon-components-react";
import { PatientVitals } from "../vitals-biometrics.resource";
import { isEmpty } from "lodash-es";
import { useTranslation } from "react-i18next";
import { useCurrentPatient } from "@openmrs/esm-react-utils";
import { switchTo } from "@openmrs/esm-extensions";
dayjs.extend(isToday);

interface VitalsHeaderStateTitleProps {
Expand All @@ -27,6 +29,13 @@ const VitalsHeaderStateTitle: React.FC<VitalsHeaderStateTitleProps> = ({
showDetails
}) => {
const { t } = useTranslation();
const [isLoadingPatient, , patientUuid] = useCurrentPatient();
const launchVitalsBiometricsForm = () => {
const url = `/patient/${patientUuid}/vitalsbiometrics/form`;
switchTo("workspace", url, {
title: t("recordVitalsAndBiometrics", "Record Vitals and Biometrics")
});
};
return (
<>
{!isEmpty(vitals) ? (
Expand All @@ -50,7 +59,12 @@ const VitalsHeaderStateTitle: React.FC<VitalsHeaderStateTitleProps> = ({
</span>
</span>
<div className={styles.alignCenter}>
<Button className={styles.buttonText} kind="ghost" size="small">
<Button
className={styles.buttonText}
kind="ghost"
size="small"
onClick={launchVitalsBiometricsForm}
>
{t("recordVitals", "Record Vitals")}
</Button>
{showDetails ? (
Expand Down

0 comments on commit 421c948

Please sign in to comment.