Skip to content

Commit

Permalink
Merge pull request I-TECH-UW#791 from Lovelyfin00/rewrite-audit-repor…
Browse files Browse the repository at this point in the history
…t-trail

Rewrite audit report trail
  • Loading branch information
mozzy11 authored Mar 22, 2024
2 parents ebc2507 + 1949a8e commit dd551cd
Show file tree
Hide file tree
Showing 7 changed files with 135 additions and 7 deletions.
4 changes: 2 additions & 2 deletions frontend/src/components/Reports/Routine.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ export const RoutineReportsMenu = {
icon: IbmWatsonNaturalLanguageUnderstanding,
SideNavMenuItem: [
{
link: config.serverBaseUrl + "/AuditTrailReport",
label: <FormattedMessage id="sideNav.label.audittrail" />,
link: "/RoutineReport?type=routine&report=auditTrail",
label: <FormattedMessage id="sideNav.label.audittrail"/>,
},
],
},
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/Reports/Study.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,8 @@ export const RoutineReportsMenu = {
icon: IbmWatsonNaturalLanguageUnderstanding,
SideNavMenuItem: [
{
link: config.serverBaseUrl + "/AuditTrailReport",
label: <FormattedMessage id="sideNav.label.audittrail" />,
link: "/StudyReport?type=study&report=auditTrail",
label:<FormattedMessage id="sideNav.label.audittrail"/>,
},
],
},
Expand Down
103 changes: 103 additions & 0 deletions frontend/src/components/Reports/auditTrailReport/AuditTrailReport.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
import React, { useState } from 'react';
import {
Form,
Heading,
Select,
SelectItem,
Grid,
Column,
Section,
Button,
Loading,
} from "@carbon/react";
import "../../Style.css";

import { AlertDialog } from '../../common/CustomNotification';
import config from "../../../config.json";
import CustomLabNumberInput from '../../common/CustomLabNumberInput';
import { FormattedMessage, useIntl } from 'react-intl';


const AuditTrailReport = ({report, id}) => {
const [labNo, setLabNo] = useState("");
const [isLabNoError, setIsLabNoError] = useState(false);
const [isLoading, setIsLoading] = useState(false);
const [showNotification, setShowNotification] = useState(false);

const intl = useIntl();

const handleViewReport = () => {
if(labNo.length === 0){
setIsLabNoError(true);
return;
}

setIsLoading(true);
const url = config.serverBaseUrl + `/AuditTrailReport?accessionNumberSearch=${labNo}`;

window.open(url);
setIsLoading(false);
setShowNotification(true);
}

return (
<>
<br />
<Grid fullWidth={true}>
<Column lg={4} md={4} sm={4}>
<Section>
<Section>
<Heading>
<FormattedMessage id={id} />
</Heading>
</Section>
</Section>
<br/>
</Column>
</Grid>
<br />
{showNotification && <AlertDialog />}
<br/>
<Form>
<Grid fullWidth={true}>
<Column lg={6} md={16} sm={4}>
<CustomLabNumberInput
id="labNo"
labelText={intl.formatMessage({
id: "label.audittrail",
defaultMessage: "Lab No",
})}
className="inputText"
value={labNo}
onChange={(event) => setLabNo(event.target.value)}
invalid={isLabNoError ? intl.formatMessage({
id: "label.audittrail.labNo.missing"
}): ""}
invalidText={intl.formatMessage({
id: "label.audittrail.labNo.missing"
})}
/>
</Column>
</Grid>
<br />
<br />
<Grid fullWidth={true}>
<Column lg={16}>
<Section>
<Button type="button" onClick={handleViewReport}>
<FormattedMessage id="label.button.viewReport" />
<Loading
small={true}
withOverlay={false}
className={isLoading ? "show" : "hidden"}
/>
</Button>
</Section>
</Column>
</Grid>
</Form>
</>
)
}

export default AuditTrailReport
8 changes: 8 additions & 0 deletions frontend/src/components/Reports/routine/Index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import StatisticsReport from "./StatisticsReport";
import ReferredOut from "./ReferredOut";
import ReportByDate from "../study/common/ReportByDate";
import PageBreadCrumb from "../../common/PageBreadCrumb";
import AuditTrailReport from "../auditTrailReport/AuditTrailReport";

const RoutineIndex = () => {
const intl = useIntl();
Expand Down Expand Up @@ -99,6 +100,13 @@ const RoutineIndex = () => {
id={"openreports.mgt.rejection"}
/>
)}

{type === "routine" && report === "auditTrail" && (
<AuditTrailReport
report={"auditTrail"}
id={"reports.auditTrail"}
/>
)}
</>
)}
</div>
Expand Down
9 changes: 9 additions & 0 deletions frontend/src/components/Reports/study/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import ReportByID from "./common/ReportByID";
import ReportByDate from "./common/ReportByDate";
import ReportByLabNo from "./common/ReportByLabNo";
import PageBreadCrumb from "../../common/PageBreadCrumb";
import AuditTrailReport from "../auditTrailReport/AuditTrailReport";

const StudyIndex = () => {
const intl = useIntl();
Expand Down Expand Up @@ -47,6 +48,7 @@ const StudyIndex = () => {
patient_patientIndeterminate1: "project.IndeterminateStudy.name",
patient_patientIndeterminate2: "project.IndeterminateStudy.name",
patient_patientSpecialReport: "header.label.specialRequest",
study_auditTrail: "reports.auditTrail"
};

useEffect(() => {
Expand Down Expand Up @@ -212,6 +214,13 @@ const StudyIndex = () => {
id="reports.followupRequired.byLocation"
/>
)}

{type === "study" && report === "auditTrail" && (
<AuditTrailReport
report={"auditTrail"}
id={"reports.auditTrail"}
/>
)}
</>
)}
</div>
Expand Down
6 changes: 5 additions & 1 deletion frontend/src/languages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
"label.button.confirmAction": "Confirm Action",
"label.button.confirmTitle": "Are You Sure ?",
"label.button.generatePrintableVersion": "Generate Printable Version",
"label.button.viewReport": "View Report",
"label.routine.Reports":"Routine Reports",
"label.audittrail.Reports":"Audit Trail Reports",
"report.label.site.onlyResults": "Only Reports with results",
"report.enter.site.headline": "Generate Reports By Site",
"report.patient.site.description": "Generate reports by result date or by order date. Result date will show only reports with results.If you select only resports with results, all reports where all tests are in progress will not be generated.",
Expand Down Expand Up @@ -640,6 +643,8 @@
"label.search.labno.family": "Search by LabNo or Family Name",
"label.filters.mycases": "My cases",
"label.filters.status": "Status",
"label.audittrail": "Lab No",
"label.audittrail.labNo.missing": "Lab No is required!",
"filters.label": "Filters",
"all.label": "All",
"pathology.label.stage": "Stage",
Expand Down Expand Up @@ -676,7 +681,6 @@
"header.label.intialFollowup": "ARV -->Initial-FollowUp-VL",
"header.label.EID": "Diagnostic for children with DBS-PCR",
"header.label.specialRequest": "Special Request",
"header.label.intialFollowup": "ARV -->Initial-FollowUp-VL",
"header.label.nonconformityByDate": "Non-conformity Report By Date",
"label.equals": "equals",
"label.notequals": "does not equal",
Expand Down
8 changes: 6 additions & 2 deletions frontend/src/languages/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"label.button.confirm": "Confirmer",
"label.button.confirmAction": "Confirmer l'action",
"label.button.confirmTitle": "Êtes-vous sûr(e) ?",
"label.button.viewReport": "Voir le rapport",
"report.label.site.onlyResults": "Uniquement les rapports avec des résultats",
"report.enter.site.headline": "Générer des rapports par site",
"report.patient.site.description": "Générer des rapports par date de résultat ou par date de commande. La date de résultat montrera uniquement les rapports avec des résultats. Si vous sélectionnez uniquement les rapports avec des résultats, tous les rapports où tous les tests sont en cours ne seront pas générés.",
Expand All @@ -20,7 +21,6 @@
"from.title": "De",
"to.title": "À",
"report.label.site.dateType": "Type de date",
"banner.menu.reports": "Rapports",
"referral.label.testmethod": "Méthodes",
"referral.label.reason": "Raison de référence",
"referral.label.institute": "Institut",
Expand All @@ -30,7 +30,9 @@
"label.button.generatePrintableVersion": "Générer une version imprimable",
"label.report.byNationalId": "Numéro d'Identification Nationale / Identifiant Santé Unique",
"label.study.Reports": "Études Rapports",
"login.title": "Identifiant",
"label.routine.Reports":"Rapports de routine",
"label.audittrail.Reports":"Rapports de piste d'audit",
"login.title": "Identifiant",
"login.subtitle": "Identifiant",
"login.msg.username": "Nom d'utilisateur",
"login.msg.password": "Mot de passe",
Expand Down Expand Up @@ -626,6 +628,8 @@
"header.rejection.reason": "Raison du rejet",
"header.reject": "Rejeter",
"header.ID": "IDENTIFIANT",
"label.audittrail": "laboratoire non",
"label.audittrail.labNo.missing": "Le numéro de laboratoire est requis !",
"label.equals": "équivaut à",
"label.notequals": "n'est pas égal",
"label.inside.normalrange": "est dans la plage normale",
Expand Down

0 comments on commit dd551cd

Please sign in to comment.