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

Adding Out Patient Module #39

Merged
merged 3 commits into from
Aug 8, 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
1 change: 0 additions & 1 deletion packages/esm-patient-visit-report-app/src/constants.ts

This file was deleted.

6 changes: 0 additions & 6 deletions packages/esm-patient-visit-report-app/src/dashboard.meta.ts

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "@sjthc/esm-patient-visit-report-app",
"name": "@sjthc/esm-patient-visits-report-app",
"version": "1.0.0",
"license": "MPL-2.0",
"description": "Custom Patient list microfrontend for the OpenMRS SPA",
"browser": "dist/sjthc-esm-patient-visit-report-app.js",
"description": "Custom Patient Visits Reports microfrontend for the OpenMRS SPA",
"browser": "dist/sjthc-esm-patient-visits-report-app.js",
"main": "src/index.ts",
"source": true,
"scripts": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ function DashboardExtension({
navLink.match(name) && "active-left-nav-link"
}`}
>
{t("todayVisitsReports", "Today's Visit Reports")}
{t("outPatient", "Out Patient")}
</ConfigurableLink>
);
}

export const createVisitsDashboardLink =
export const createDashboardLink =
(dashboardLinkConfig: DashboardLinkConfig) => () =>
(
<BrowserRouter>
Expand Down
1 change: 1 addition & 0 deletions packages/esm-patient-visits-report-app/src/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const moduleName = "@sjthc/esm-patient-visits-report-app";
6 changes: 6 additions & 0 deletions packages/esm-patient-visits-report-app/src/dashboard.meta.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export const homeVisitsDashboardMeta = {
slot: "patients-visits-dashboard-slot",
path: "patients-visits-dashboard",
title: "OPD Visit's Reports",
name: "patients-visits-dashboard",
};
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { ConfigurableLink } from "@openmrs/esm-framework";
import styles from "../home-dashboard.scss";

interface MetricsCardProps {
className?: string;
label: string;
value: number | string;
headerLabel: string;
Expand All @@ -17,6 +18,7 @@ interface MetricsCardProps {
}

const MetricsCard: React.FC<MetricsCardProps> = ({
className,
label,
value,
headerLabel,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ import {
import {usePatientList} from "../hooks/usePatientList";
import DataTable from "react-data-table-component";

type TodaysVisitHomeProps = {
type PatientVisistsReportHomeProps = {
patientUuid?: string;
};

const TodaysVisitHome: React.FC<TodaysVisitHomeProps> = () => {
const PatientVisitsReportHome: React.FC<PatientVisistsReportHomeProps> = () => {
const {t} = useTranslation();

const {
Expand Down Expand Up @@ -45,8 +45,7 @@ const TodaysVisitHome: React.FC<TodaysVisitHomeProps> = () => {
<div className={styles["left-justified-items"]}>
<PatientQueueIllustration/>
<div className={styles["page-labels"]}>
<p className={styles.title}>{t("patients", "Patients")}</p>
<p className={styles.subTitle}>{t("dashboard", "Dashboard")}</p>
<p className={styles.title}>{t("outPatient", "Out Patient")}</p>
</div>
</div>
</div>
Expand All @@ -66,17 +65,23 @@ const TodaysVisitHome: React.FC<TodaysVisitHomeProps> = () => {
<div className={styles["left-justified-items"]}>
<PatientQueueIllustration/>
<div className={styles["page-labels"]}>
<p className={styles.title}>{t("patients", "Patients")}</p>
<p className={styles.subTitle}>{t("dashboard", "Dashboard")}</p>
<p className={styles.title}>{t("outPatient", "Out Patient")}</p>
</div>
</div>
</div>


<div className={styles.homeContainer}>
<div
className={styles.cardContainer}
data-testid="registered-patients"
>
<div className={styles.cardContainerParent} data-testid="clinic-metrics">
<MetricsCard
className="metricsCard"
label={t("total", "Total")}
value={totalPatients.toString()}
headerLabel={t("registeredPatients", "Registered Patients")}
service="scheduled"
/>
<MetricsCard
className="metricsCard"
label={t("total", "Total")}
value={totalPatients.toString()}
headerLabel={t("registeredPatients", "Registered Patients")}
Expand Down Expand Up @@ -136,4 +141,4 @@ const TodaysVisitHome: React.FC<TodaysVisitHomeProps> = () => {
);
};

export default TodaysVisitHome;
export default PatientVisitsReportHome;
Original file line number Diff line number Diff line change
Expand Up @@ -187,3 +187,16 @@ html[dir='rtl'] {
width: 100%;
border: 1px solid $ui-03;
}

.cardContainerParent {
display: flex;
align-items: center;
flex-wrap: wrap;
justify-content: space-between;
gap: 10px;
}

.metricsCard {
width: 100%;
box-sizing: border-box;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
import React from "react";

const PatientQueueIllustration: React.FC = () => {
return (
<svg
id="Layer_1"
data-name="Layer 1"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 64 64"
>
<title>medical, medicine, healthcare, health, chart, edit, clipboard</title>
<rect
style={{ fill: "#dfe8f4" }}
x="8"
y="12.7"
width="32.73"
height="37.38"
rx="3.88"
/>
<path
style={{ fill: "#7BBCB9" }}
d="M15.16,12.87H33.28a0,0,0,0,1,0,0v1.6a2.18,2.18,0,0,1-2.18,2.18H17.34a2.18,2.18,0,0,1-2.18-2.18v-1.6A0,0,0,0,1,15.16,12.87Z"
/>
<path
style={{ fill: "#7BBCB9" }}
d="M31.1,10.69H28.87a2.48,2.48,0,0,1-2.14-1.31,2.72,2.72,0,0,0-4.73,0,2.46,2.46,0,0,1-2.13,1.31H17.64a2.26,2.26,0,0,0-2.48,2.18v.74a1.1,1.1,0,0,0,1.1,1.1H32.17a1.11,1.11,0,0,0,1.11-1.1v-.74A2.19,2.19,0,0,0,31.1,10.69Z"
/>
<path
style={{ fill: "#7BBCB9" }}
d="M26.73,9.38a2.72,2.72,0,0,0-4.73,0,2.46,2.46,0,0,1-2.13,1.31h9A2.48,2.48,0,0,1,26.73,9.38Z"
/>
<rect
style={{ fill: "#7BBCB9" }}
x="20.94"
y="19.88"
width="6.85"
height="14.93"
rx="0.51"
/>
<rect
style={{ fill: "#7BBCB9" }}
x="20.94"
y="19.88"
width="6.85"
height="14.93"
rx="0.51"
transform="translate(51.71 2.98) rotate(90)"
/>
<rect
style={{ fill: "#7BBCB9" }}
x="16.9"
y="37.43"
width="14.93"
height="1.1"
/>
<rect
style={{ fill: "#7BBCB9" }}
x="16.9"
y="39.62"
width="14.93"
height="1.1"
/>
<rect
style={{ fill: "#7BBCB9" }}
x="16.9"
y="41.81"
width="7.47"
height="1.1"
/>
<path
style={{ fill: "#7BBCB9" }}
d="M39.31,49.69,54.66,34.34a4.91,4.91,0,0,0,1.27-4.75h0a4.91,4.91,0,0,0-3.47-3.47h0a4.92,4.92,0,0,0-4.74,1.27L32.37,42.74a18.91,18.91,0,0,0-4.23,6.46l-2,5.11a1.23,1.23,0,0,0,1.6,1.6l5.11-2A18.74,18.74,0,0,0,39.31,49.69Z"
/>
<path
style={{ fill: "#7BBCB9" }}
d="M55.93,29.59a4.91,4.91,0,0,0-3.47-3.47h0a4.92,4.92,0,0,0-4.74,1.27l-4.95,5a4.91,4.91,0,1,1,6.95,6.94l4.94-4.94A4.91,4.91,0,0,0,55.93,29.59Z"
/>
<path
style={{ fill: "#7BBCB9" }}
d="M27.74,55.91,31,54.63a.3.3,0,0,0,0-.1,4.9,4.9,0,0,0-3.47-3.48l-.1,0-1.29,3.28A1.23,1.23,0,0,0,27.74,55.91Z"
/>
</svg>
);
};

export default PatientQueueIllustration;
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import {
import { moduleName } from "./constants";
import { configSchema } from "./config-schema";
import { homeVisitsDashboardMeta } from "./dashboard.meta";
import { createVisitsDashboardLink as createVisitsHomeDashboardLink } from "./DashboardLink";
import { createDashboardLink as createHomeDashboardLink } from "./DashboardLink";

const options = {
featureName: "esm-patient-visit-report-app",
featureName: "esm-patient-visits-report-app",
moduleName,
};

Expand All @@ -29,7 +29,7 @@ export const rootHome = getAsyncLifecycle(
options
);

export const homeTodayVisitsLink = getSyncLifecycle(
createVisitsHomeDashboardLink(homeVisitsDashboardMeta),
export const homePatientRegisterationLink = getSyncLifecycle(
createHomeDashboardLink(homeVisitsDashboardMeta),
options
);
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
import React from "react";
import { SWRConfig } from "swr";
import { BrowserRouter, Route, Routes } from "react-router-dom";
import TodaysVisitHome from "./home-dashboard/home-dashboard.component";
import PatientVisitsReportHome from "./home-dashboard/home-dashboard.component";

const swrConfiguration = {
errorRetryCount: 3,
};

const RootComponent: React.FC = () => {
const baseName = window.getOpenmrsSpaBase() + "home/today-visits-reports";
const baseName = window.getOpenmrsSpaBase() + "home/patients-visits-dashboard";

return (
<main>
<SWRConfig value={swrConfiguration}>
<BrowserRouter basename={baseName}>
<Routes>
<Route path="/" element={<TodaysVisitHome />} />
<Route path="/" element={<PatientVisitsReportHome />} />
</Routes>
</BrowserRouter>
</SWRConfig>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@
"$schema": "https://json.openmrs.org/routes.schema.json",
"extensions": [
{
"name": "home-today-visits-dashboard-link",
"component": "homeTodayVisitsLink",
"name": "home-visits-report-dashboard-link",
"component": "homePatientRegisterationLink",
"slot": "homepage-dashboard-slot",
"order": 0,
"meta": {
"name": "patient-visit-report",
"slot": "patients-visit-report-dashboard-slot",
"title": "Today's Visits Reports"
"name": "patients-visits-dashboard",
"slot": "patients-visits-dashboard-slot",
"title": "OPD Visit's Reports"
},
"online": true,
"offline": true
},
{
"name": "root-visits-report-dashboard",
"slot": "patients-visit-report-dashboard-slot",
"slot": "patients-visits-dashboard-slot",
"component": "rootHome"
}
],
Expand Down
Loading
Loading