forked from I-TECH-UW/OpenELIS-Global-2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request I-TECH-UW#791 from Lovelyfin00/rewrite-audit-repor…
…t-trail Rewrite audit report trail
- Loading branch information
Showing
7 changed files
with
135 additions
and
7 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
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
103 changes: 103 additions & 0 deletions
103
frontend/src/components/Reports/auditTrailReport/AuditTrailReport.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,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 |
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