-
Notifications
You must be signed in to change notification settings - Fork 191
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 #511 from abertnamanya/validation-fix-001
Validation fixes branch commit
- Loading branch information
Showing
9 changed files
with
1,293 additions
and
3 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
95 changes: 95 additions & 0 deletions
95
frontend/src/components/formModel/innitialValues/ValidationSearchFormValues.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,95 @@ | ||
export default { | ||
resultList: [ | ||
{ | ||
accessionNumber: "", | ||
analysisId: "", | ||
analysisMethod: "", | ||
analysisStatusId: "", | ||
childReflex: "", | ||
considerRejectReason: "", | ||
defaultResultValue: "", | ||
dictionaryResults: [], | ||
displayResultAsLog: "", | ||
enumResultType: "", | ||
failedValidation: "", | ||
forceTechApproval: "", | ||
hasQualifiedResult: "", | ||
initialSampleCondition: "", | ||
isGroupSeparator: "", | ||
isModified: "", | ||
lowerAbnormalRange: "", | ||
lowerNormalRange: "", | ||
multiSelectResultValues: "", | ||
nationalId: "", | ||
nextVisitDate: "", | ||
nonconforming: "", | ||
normal: "", | ||
normalRange: "", | ||
notIncludedInWorkplan: "", | ||
note: "", | ||
pastNotes: "", | ||
patientInfo: "", | ||
patientName: "", | ||
qualifiedDictionaryId: "", | ||
qualifiedResultId: "", | ||
qualifiedResultValue: "", | ||
rawResultDisplayType: "", | ||
readOnly: "", | ||
receivedDate: "", | ||
refer: "", | ||
referralCanceled: "", | ||
referralId: "", | ||
referralItem: "", | ||
referralReasonId: "", | ||
referredOut: "", | ||
reflexGroup: "", | ||
reflexJSONResult: "", | ||
reflexParentGroup: "", | ||
rejectReasonId: "", | ||
rejected: "", | ||
remarks: "", | ||
remove: "", | ||
removed: "", | ||
reportable: "", | ||
result: "", | ||
resultDisplayType: "", | ||
resultId: "", | ||
resultLimitId: "", | ||
resultType: "", | ||
resultValue: "", | ||
sampleGroupingNumber: "", | ||
sampleSource: "", | ||
sampleType: "", | ||
sequenceAccessionNumber: "", | ||
sequenceNumber: "", | ||
servingAsTestGroupIdentifier: "", | ||
shadowReferredOut: "", | ||
shadowRejected: "", | ||
shadowResultValue: "", | ||
showSampleDetails: "", | ||
siblingReflexKey: "", | ||
significantDigits: "", | ||
technician: "", | ||
technicianSignatureId: "", | ||
testDate: "", | ||
testId: "", | ||
testKit1InventoryId: "", | ||
testKitId: "", | ||
testKitInactive: "", | ||
testKitInventoryId: "", | ||
testMethod: "", | ||
testName: "", | ||
testSortOrder: "", | ||
thisReflexKey: "", | ||
unitsOfMeasure: "", | ||
upperAbnormalRange: "", | ||
upperNormalRange: "", | ||
userChoiceReflex: "", | ||
valid: "", | ||
}], | ||
accessionNumber: "", | ||
methods: [{ | ||
id: "", | ||
value: "", | ||
}], | ||
} |
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,15 @@ | ||
import React, {useEffect, useState} from 'react' | ||
import SearchForm from "./SearchForm"; | ||
import Validation from "./Validation"; | ||
|
||
const Index = () => { | ||
const [results, setResults] = useState(); | ||
return ( | ||
<> | ||
<SearchForm setResults={setResults}/> | ||
<Validation results={results}/> | ||
</> | ||
) | ||
} | ||
|
||
export default Index; |
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,112 @@ | ||
import React, {useState, useEffect} from 'react' | ||
import {Button, Column, Form, FormLabel, Heading, Row, Section, Stack, TextInput} from "@carbon/react"; | ||
import {FormattedMessage} from "react-intl"; | ||
import {Formik, Field} from "formik"; | ||
import ValidationSearchFormValues from "../formModel/innitialValues/ValidationSearchFormValues"; | ||
import {getFromOpenElisServer} from "../utils/Utils"; | ||
|
||
const SearchForm = (props) => { | ||
const [searchResults, setSearchResults] = useState(); | ||
const validationResults = (data) => { | ||
if (data) { | ||
setSearchResults(data); | ||
if (data.resultList) { | ||
const newResultsList = data.resultList.map((data, idx) => { | ||
let tempData = {...data} | ||
tempData.id = idx | ||
return tempData | ||
}); | ||
setSearchResults(prevState => ({ | ||
...prevState, | ||
resultList: newResultsList | ||
})); | ||
} | ||
} else { | ||
props.setResults?.({resultList: []}); | ||
} | ||
} | ||
|
||
useEffect(() => { | ||
props.setResults(searchResults) | ||
}, [searchResults]); | ||
|
||
const handleSubmit = (values) => { | ||
let searchEndPoint = "/rest/accessionValidationByRange?" + | ||
"accessionNumber=" + values.accessionNumber | ||
getFromOpenElisServer(searchEndPoint, validationResults); | ||
} | ||
|
||
const handleChange = () => { | ||
|
||
} | ||
|
||
|
||
return ( | ||
<> | ||
<Formik | ||
initialValues={ValidationSearchFormValues} | ||
//validationSchema={} | ||
onSubmit={handleSubmit} | ||
onChange | ||
> | ||
{({ | ||
values, | ||
errors, | ||
touched, | ||
handleChange, | ||
//handleBlur, | ||
handleSubmit | ||
}) => ( | ||
|
||
<Form | ||
onSubmit={handleSubmit} | ||
onChange={handleChange} | ||
//onBlur={handleBlur} | ||
> | ||
<Stack gap={2}> | ||
|
||
<FormLabel> | ||
<Section> | ||
<Section> | ||
<Section> | ||
<Heading> | ||
<FormattedMessage id="label.button.search"/> | ||
</Heading> | ||
</Section> | ||
</Section> | ||
</Section> | ||
</FormLabel> | ||
<Row lg={12}> | ||
<div className="inlineDiv"> | ||
|
||
<Field name="accessionNumber" | ||
> | ||
{({field}) => | ||
<TextInput | ||
placeholder={"Enter LabNo"} | ||
className="searchLabNumber inputText" | ||
name={field.name} id={field.name} labelText=""/> | ||
} | ||
</Field> | ||
</div> | ||
|
||
</Row> | ||
|
||
<Column lg={6}> | ||
<Button type="submit" id="submit" className="searchResultsBtn"> | ||
<FormattedMessage id="label.button.search"/> | ||
</Button> | ||
</Column> | ||
|
||
</Stack> | ||
|
||
</Form> | ||
)} | ||
</Formik> | ||
</> | ||
|
||
); | ||
|
||
} | ||
|
||
export default SearchForm; |
Oops, something went wrong.