-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
avniproject/avni-product#1531 | WIP: Introduce locationHierarchy sele…
…ction for Locations Upload / Sample download
- Loading branch information
Showing
4 changed files
with
118 additions
and
117 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import React from "react"; | ||
import FormControl from "@material-ui/core/FormControl"; | ||
import FormLabel from "@material-ui/core/FormLabel"; | ||
import RadioGroup from "@material-ui/core/RadioGroup"; | ||
import FormControlLabel from "@material-ui/core/FormControlLabel"; | ||
import Radio from "@material-ui/core/Radio"; | ||
import _ from "lodash"; | ||
|
||
export const LocationHierarchy = ({ hierarchy, setHierarchy, configuredHierarchies }) => { | ||
const handleChange = event => { | ||
setHierarchy(event.target.value); | ||
}; | ||
|
||
return ( | ||
<FormControl component="fieldset" style={{ marginTop: "20px" }}> | ||
<FormLabel component="legend">Select Location Hierarchy</FormLabel> | ||
<RadioGroup | ||
aria-label="hierarchy" | ||
name="hierarchy1" | ||
value={hierarchy || _.get(configuredHierarchies[0], "value")} | ||
onChange={handleChange} | ||
> | ||
{configuredHierarchies.map(hierarchicalValue => ( | ||
<FormControlLabel | ||
disabled={configuredHierarchies.length <= 1} | ||
key={hierarchicalValue.value} | ||
value={hierarchicalValue.value} | ||
control={<Radio color="primary" />} | ||
label={hierarchicalValue.label} | ||
/> | ||
))} | ||
</RadioGroup> | ||
</FormControl> | ||
); | ||
}; |
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