Skip to content

Commit

Permalink
Restrict user and display message when assigning AH with district (#1125
Browse files Browse the repository at this point in the history
)

* Restrict user and display message when assigning AH with district

* Change description comparison to use id

* Missed a line
  • Loading branch information
gdalcengio authored Jun 4, 2024
1 parent fa396b3 commit 8816279
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/components/assignRolesAndDistrictsPage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,15 @@ const AssignRolesAndDistrictsPage = () => {
className={classes.addButton}
type="button"
onClick={handleSave}
disabled={user === null || selectedDistricts === null || role === null}
disabled={
user === null ||
selectedDistricts === null ||
role === null ||
(
role?.id === 4 &&
selectedDistricts?.length > 0
)
}
variant="contained"
color="primary"
>
Expand All @@ -282,6 +290,10 @@ const AssignRolesAndDistrictsPage = () => {
}

{assigningError && <Typography color="error">{assigningError}</Typography>}
{
(role?.id === 4 && selectedDistricts?.length > 0)&&
<Typography color="error">Range Agreement Holders cannot be assigned districts.</Typography>
}

{assigningSuccess && (
<Typography className={classes.successMessage}>
Expand Down

0 comments on commit 8816279

Please sign in to comment.