Skip to content

Commit

Permalink
3074 added similar group permissions to DIGITTeam as Admin
Browse files Browse the repository at this point in the history
  • Loading branch information
raftmsohani committed Aug 28, 2024
1 parent 7d4baf7 commit 3847ae7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ tasks:
desc: Restart backend web server
dir: tdrs-backend
cmds:
- docker-compose -f docker-compose.yml restart -d
- docker-compose -f docker-compose.yml restart

backend-bash:
desc: Open a shell in the backend container
Expand Down Expand Up @@ -125,7 +125,7 @@ tasks:
desc: Restart frontend web server
dir: tdrs-frontend
cmds:
- docker-compose -f docker-compose.yml restart -d
- docker-compose -f docker-compose.yml restart

frontend-av:
desc: Start frontend with optional clamav service
Expand Down
11 changes: 7 additions & 4 deletions tdrs-frontend/src/components/Reports/Reports.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ function Reports() {
// The logged in user saved in our redux `auth` state object
const user = useSelector((state) => state.auth.user)
const isOFAAdmin = useSelector(selectPrimaryUserRole)?.name === 'OFA Admin'
const isDIGITTeam = useSelector(selectPrimaryUserRole)?.name === 'DIGIT Team'
console.log('______________ isDIGITTeam:', isDIGITTeam)
const sttList = useSelector((state) => state?.stts?.sttList)

const [errorModalVisible, setErrorModalVisible] = useState(false)
Expand All @@ -59,7 +61,7 @@ function Reports() {
Q4: 'Quarter 4 (July - September)',
}

const currentStt = isOFAAdmin ? selectedStt : userProfileStt
const currentStt = isOFAAdmin || isDIGITTeam ? selectedStt : userProfileStt

const stt = sttList?.find((stt) => stt?.name === currentStt)

Expand All @@ -68,7 +70,7 @@ function Reports() {

const errorsCount = formValidation.errors

const missingStt = !isOFAAdmin && !currentStt
const missingStt = !isOFAAdmin && !isDIGITTeam && !currentStt

const errorsRef = useRef(null)

Expand Down Expand Up @@ -194,7 +196,7 @@ function Reports() {
)
const touchedFields = Object.keys(touched).length

const expected_fields = isOFAAdmin ? 3 : 2
const expected_fields = isOFAAdmin || isDIGITTeam ? 3 : 2

const errors = touchedFields === 3 ? expected_fields - form.length : 0

Expand All @@ -215,6 +217,7 @@ function Reports() {
setFormValidationState,
touched,
isOFAAdmin,
isDIGITTeam,
])

return (
Expand All @@ -237,7 +240,7 @@ function Reports() {
</div>
)}
<form>
{isOFAAdmin && (
{(isOFAAdmin || isDIGITTeam) && (
<div
className={classNames('usa-form-group maxw-mobile margin-top-4', {
'usa-form-group--error': formValidation.stt,
Expand Down

0 comments on commit 3847ae7

Please sign in to comment.