Skip to content

Commit

Permalink
Merge branch 'develop_3x' into add#exportcsvpage
Browse files Browse the repository at this point in the history
  • Loading branch information
konavivekramakrishna authored Mar 8, 2024
2 parents 80798a4 + c72a339 commit 138bde9
Show file tree
Hide file tree
Showing 28 changed files with 1,518 additions and 881 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/label-merge-conflict.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Auto Label Conflicts

permissions:
issues: write
pull-requests: write

on:
push:
branches: [develop_3x]
pull_request:
branches: [develop_3x]

jobs:
auto-label:
if: github.repository == 'I-TECH-UW/OpenELIS-Global-2/'
runs-on: ubuntu-latest
steps:
- uses: prince-chrismc/label-merge-conflicts-action@v2
with:
conflict_label_name: "merge conflict"
github_token: ${{ secrets.GITHUB_TOKEN }}
max_retries: 5
wait_ms: 15000
detect_merge_changes: false
conflict_comment: |
:wave: Hi, @${author},
Conflicts have been detected against the base branch. Please rebase your branch against the base branch.
12 changes: 7 additions & 5 deletions frontend/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@ import ImmunohistochemistryDashboard from "./components/immunohistochemistry/Imm
import ImmunohistochemistryCaseView from "./components/immunohistochemistry/ImmunohistochemistryCaseView";
import RoutedResultsViewer from "./components/patient/resultsViewer/results-viewer.tsx";
import EOrderPage from "./components/eOrder/Index";
import RoutineIndex from "./components/Reports/routine/Index.js";
import PrintBarcode from "./components/printBarcode/Index";
import ReferredOutTestsReport from "./components/Reports/RefferedOutTestsReport.js";


export default function App() {
let i18nConfig = {
Expand Down Expand Up @@ -413,9 +414,10 @@ export default function App() {
role="Reports"
/>
<SecureRoute
path = "/ExternalReferralsReport"
exact
component={()=> <ReferredOutTestsReport/> }
path="/AggregateReports"
exact
component={() => <RoutineIndex />}
role="Reports"
/>
<SecureRoute
path="/StudyReports"
Expand Down Expand Up @@ -469,4 +471,4 @@ export default function App() {
</UserSessionDetailsContext.Provider>
</IntlProvider>
);
}
}
16 changes: 6 additions & 10 deletions frontend/src/components/Home.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
import React from "react";
import { injectIntl, useIntl } from "react-intl";
import { Breadcrumb, BreadcrumbItem, Grid } from "@carbon/react";
import { injectIntl } from "react-intl";
import HomeDashBoard from "./home/Dashboard.tsx";
import PageBreadCrumb from "./common/PageBreadCrumb.js";

let breadcrumbs = [{ label: "home.label", link: "/" }];

function Home() {
const intl = useIntl();
return (
<>
<Grid>
<Breadcrumb>
<BreadcrumbItem href="/">
{intl.formatMessage({ id: "home.label" })}
</BreadcrumbItem>
</Breadcrumb>
</Grid>
<PageBreadCrumb breadcrumbs={breadcrumbs} />

<div>
<HomeDashBoard />
</div>
Expand Down
15 changes: 5 additions & 10 deletions frontend/src/components/Reports/Routine.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export const RoutineReportsMenu = {
link:
config.serverBaseUrl +
"/Report?type=patient&report=patientCILNSP_vreduit",

label: <FormattedMessage id="sidenav.label.statusreport"/>,
},
],
Expand All @@ -27,21 +28,15 @@ export const RoutineReportsMenu = {
icon: Microscope,
SideNavMenuItem: [
{
link:
config.serverBaseUrl +
"/Report?type=indicator&report=statisticsReport",
link: "/AggregateReports?type=indicator&report=statisticsReport",
label: <FormattedMessage id= "sidenav.label.statisticsreport"/>,
},
{
link:
config.serverBaseUrl +
"/Report?type=indicator&report=indicatorHaitiLNSPAllTests",
link: "/AggregateReports?type=indicator&report=indicatorHaitiLNSPAllTests",
label: <FormattedMessage id= "sidenav.label.testsummary"/>
},
{
link:
config.serverBaseUrl +
"/Report?type=indicator&report=indicatorCDILNSPHIV",
link:"/AggregateReports?type=indicator&report=indicatorCDILNSPHIV",
label: <FormattedMessage id="sideNav.label.hivtestsummary"/>,
},
],
Expand Down Expand Up @@ -151,7 +146,7 @@ export const RoutineReportsMenu = {
};
const Routine = () => {
return (
<>
<>
<GlobalSideBar sideNav={RoutineReportsMenu} />
</>
);
Expand Down
99 changes: 99 additions & 0 deletions frontend/src/components/Reports/routine/Index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
import React, { useContext, useState, useEffect } from "react";
import { AlertDialog } from "../../common/CustomNotification";
import { NotificationContext } from "../../layout/Layout";
import {
Heading,
Grid,
Column,
Section,
Breadcrumb,
BreadcrumbItem,
Loading,
} from "@carbon/react";
import { injectIntl, FormattedMessage, useIntl } from "react-intl";
import config from "../../../config.json";
import StatisticsReport from "./statisticsReport";
import SummaryOfAllTest from "./summaryOfAllTest";
import HIVTestSummary from "./hivTestSummary";

const RoutineIndex = () => {
const intl = useIntl();
const { setNotificationVisible, addNotification, notificationVisible } =
useContext(NotificationContext);

const [type, setType] = useState("");
const [report, setReport] = useState("");
const [source, setSource] = useState("");
const [isLoading, setIsLoading] = useState(true);


useEffect(() => {


const params = new URLSearchParams(window.location.search);
const paramType = params.get("type");
const paramReport = params.get("report");

setType(paramType);
setReport(paramReport);



if (paramType && paramReport) {
setIsLoading(false);
} else {
window.location.href = "/RoutineReports";
}
}, []);

return (
<>
<Grid fullWidth={true}>
<Column lg={16}>
<Breadcrumb>
<BreadcrumbItem href="/">
{intl.formatMessage({ id: "home.label" })}
</BreadcrumbItem>

</Breadcrumb>
</Column>
</Grid>
<Grid fullWidth={true}>
<Column lg={16}>
<Section>
<Section>
<Heading>
<FormattedMessage id="selectReportValues.title" />
</Heading>
</Section>
</Section>
</Column>
</Grid>
<div className="orderLegendBody">
{notificationVisible === true && <AlertDialog />}
{isLoading && <Loading />}
{!isLoading && (
<>


{type === "indicator" &&
report === "statisticsReport" &&
(<StatisticsReport />)}

{type === "indicator" &&
report === "indicatorHaitiLNSPAllTests" &&
( <SummaryOfAllTest /> )}


{type === "indicator" &&
report === "indicatorCDILNSPHIV" &&
(<HIVTestSummary/>)}

</>
)}
</div>
</>
);
};

export default injectIntl(RoutineIndex);
146 changes: 146 additions & 0 deletions frontend/src/components/Reports/routine/hivTestSummary.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
import React, { useEffect, useState } from 'react';
import {
Form,
FormLabel,
Grid,
Column,
Section,
Button,

} from "@carbon/react";
import { FormattedMessage, useIntl } from 'react-intl';
import "../../Style.css";
import { AlertDialog } from "../../common/CustomNotification";
import CustomDatePicker from "../../common/CustomDatePicker";
import config from "../../../config.json";


const hivTestSummary = () => {
const intl = useIntl();

const [loading, setLoading] = useState(false);
const [notificationVisible, setNotificationVisible] = useState(false);
const [reportFormValues, setReportFormValues] = useState({
startDate: null,
endDate: null
});



function encodeDate(dateString) {
if (typeof dateString === "string" && dateString.trim() !== "") {
return dateString.split("/").map(encodeURIComponent).join("%2F");
} else {
return "";
}
}

const handleDatePickerChangeDate = (datePicker, date) => {
let updatedDate = encodeDate(date);
let obj = null;
switch (datePicker) {
case "startDate":
obj = {
...reportFormValues,
startDate: updatedDate,
};
break;
case "endDate":
obj = {
...reportFormValues,
endDate: updatedDate,
};
break;
default:
}
setReportFormValues(obj);
};

const handleSubmit = () => {
setLoading(true);

const baseParams = 'report=indicatorCDILNSPHIV&type=indicator';

const baseUrl = `${config.serverBaseUrl}/ReportPrint`;
const url = `${baseUrl}?${baseParams}&upperDateRange=${reportFormValues.startDate}&lowerDateRange=${reportFormValues.endDate}`;

window.open(url, '_blank');


setLoading(false);
setNotificationVisible(true);
};

return (
<>
<FormLabel>
<Section>
<Section>
<h1>
<FormattedMessage id="openreports.hiv.aggregate" />

</h1>
</Section>
</Section>
</FormLabel>
{notificationVisible && <AlertDialog />}
{loading && <Loading />}
<Grid fullWidth={true}>
<Column lg={16}>
<Form>
<Grid fullWidth={true}>
<Column lg={10}>
<Section>
<br />
<br />
<h5>
<FormattedMessage id="select.dateRange" />

</h5>
</Section>
<div className="inlineDiv">
<CustomDatePicker
id={"startDate"}
labelText={intl.formatMessage({
id: "eorder.date.start",
defaultMessage: "Start Date",
})}
autofillDate={true}
value={reportFormValues.startDate}
className="inputDate"
onChange={(date) =>
handleDatePickerChangeDate("startDate", date)
}
/>
<CustomDatePicker
id={"endDate"}
labelText={intl.formatMessage({
id: "eorder.date.end",
defaultMessage: "End Date",
})}
className="inputDate"
autofillDate={true}
value={reportFormValues.endDate}
onChange={(date) =>
handleDatePickerChangeDate("endDate", date)
}
/>
</div>
</Column>
</Grid>
<br />
<Section>
<br />
<Button type="button" onClick={handleSubmit}>
<FormattedMessage id="label.button.generatePrintableVersion" defaultMessage="Generate printable version" />
</Button>
</Section>
</Form>
</Column>
</Grid>

</>
);
};

export default hivTestSummary;
Loading

0 comments on commit 138bde9

Please sign in to comment.