-
Notifications
You must be signed in to change notification settings - Fork 296
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop_3x' into add#exportcsvpage
- Loading branch information
Showing
28 changed files
with
1,518 additions
and
881 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
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. |
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
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
146
frontend/src/components/Reports/routine/hivTestSummary.js
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,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; |
Oops, something went wrong.