From 881627924b25e2a19dc3a8511119ddebf6e19788 Mon Sep 17 00:00:00 2001 From: Gabriele Dal Cengio <39023674+gdalcengio@users.noreply.github.com> Date: Tue, 4 Jun 2024 15:24:19 -0700 Subject: [PATCH] Restrict user and display message when assigning AH with district (#1125) * Restrict user and display message when assigning AH with district * Change description comparison to use id * Missed a line --- .../assignRolesAndDistrictsPage/index.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/components/assignRolesAndDistrictsPage/index.js b/src/components/assignRolesAndDistrictsPage/index.js index 4d9b42e8..27e52ff2 100644 --- a/src/components/assignRolesAndDistrictsPage/index.js +++ b/src/components/assignRolesAndDistrictsPage/index.js @@ -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" > @@ -282,6 +290,10 @@ const AssignRolesAndDistrictsPage = () => { } {assigningError && {assigningError}} + { + (role?.id === 4 && selectedDistricts?.length > 0)&& + Range Agreement Holders cannot be assigned districts. + } {assigningSuccess && (