Skip to content

Commit

Permalink
initial work save
Browse files Browse the repository at this point in the history
  • Loading branch information
binggaofw committed Jul 14, 2023
1 parent f3a6299 commit 44a816a
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions src/frontend/src/components/public/PIAFormTabs/review/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import ViewMPOReview from './viewMPOReview';
import PendingReview from './pendingReview';
import ViewProgramAreaReview from './viewProgramArea';
import EditProgramAreaReview from './editProgramArea';
import { YesNoInput } from '../../../../types/enums/yes-no.enum';

export interface IReviewProps {
printPreview?: boolean;
Expand Down Expand Up @@ -72,6 +73,40 @@ const PIAReview = ({ printPreview }: IReviewProps) => {
setReviewForm(pia.review);
}, [pia.review]);

/**
* Update reviewForm.programArea when
* Part 4 Assessment(storing personal information tab) (PIDSOC), If Assessment of Disclosures Outside of Canada is filled out in PIA,
* ADM(Assistant Deputy Minister) is a preselected role
* and can not be deleted
* personalInformation.storedOutsideCanada is yes
* sensitivePersonalInformation.doesInvolve is yes
* sensitivePersonalInformation.disclosedOutsideCanada is no
*/
useEffect(() => {
// if the condition does satisfy the rule, add the adm to programArea
// otherwise do nothing
if (
pia?.storingPersonalInformation?.personalInformation
?.storedOutsideCanada === YesNoInput.YES &&
pia?.storingPersonalInformation?.sensitivePersonalInformation
.doesInvolve === YesNoInput.YES &&
pia?.storingPersonalInformation?.sensitivePersonalInformation
.disclosedOutsideCanada === YesNoInput.NO
) {
reviewForm.programArea?.selectedRoles.push(ApprovalRoles.ADM);
stateChangeHandler(
reviewForm.programArea?.selectedRoles,
'programArea.selectedRoles',
);
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [
pia?.storingPersonalInformation?.personalInformation?.storedOutsideCanada,
pia?.storingPersonalInformation?.sensitivePersonalInformation
.disclosedOutsideCanada,
pia?.storingPersonalInformation?.sensitivePersonalInformation.doesInvolve,
]);

const [rolesSelect, setRolesSelect] = useState<string>('');
const [rolesInput, setRolesInput] = useState<string>('');
const [reviewNote, setReviewNote] = useState<string>(
Expand Down

0 comments on commit 44a816a

Please sign in to comment.