Skip to content

Commit

Permalink
Merge pull request #4775 from bcgov/test-rook-AH-4671
Browse files Browse the repository at this point in the history
Ticket  4671. FOI-FLOW OIPC Front End Stories
  • Loading branch information
Aman-Hundal authored Nov 30, 2023
2 parents 83ccc28 + ba3f9b5 commit b8bfe37
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 51 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@ import {
import {
fetchFOIMinistryAssignedToList,
fetchFOIPersonalDivisionsAndSections,
fetchOIPCInquiryoutcomes,
fetchOIPCOutcomes,
fetchOIPCReviewtypes,
fetchOIPCStatuses,
} from "../../../../apiManager/services/FOI/foiMasterDataServices";

import { fetchFOIRequestAttachmentsList } from "../../../../apiManager/services/FOI/foiAttachmentServices";
Expand Down Expand Up @@ -66,8 +62,6 @@ import { UnsavedModal } from "../../customComponents";
import { DISABLE_GATHERINGRECORDS_TAB } from "../../../../constants/constants";
import _ from "lodash";
import { MinistryNeedsScanning } from "../../../../constants/FOI/enum";
import OIPCDetails from "../OIPCDetails/Index";
import useOIPCHook from "../OIPCDetails/oipcHook";

const useStyles = makeStyles((theme) => ({
root: {
Expand Down Expand Up @@ -114,7 +108,6 @@ const MinistryReview = React.memo(({ userDetail }) => {

const [_currentrequestStatus, setcurrentrequestStatus] = React.useState("");
const [_tabStatus, settabStatus] = React.useState(requestState);
const {oipcData, addOIPC, removeOIPC, updateOIPC, isOIPCReview, setIsOIPCReview} = useOIPCHook();

//gets the request detail from the store
const IsDivisionalCoordinator = () => {
Expand Down Expand Up @@ -218,12 +211,6 @@ const MinistryReview = React.memo(({ userDetail }) => {
dispatch(fetchPDFStitchStatusForHarms(requestId, ministryId));
dispatch(fetchPDFStitchStatusForRedlines(requestId, ministryId));
dispatch(fetchPDFStitchStatusForResponsePackage(requestId, ministryId));

dispatch(fetchOIPCOutcomes());
dispatch(fetchOIPCStatuses());
dispatch(fetchOIPCReviewtypes());
dispatch(fetchOIPCInquiryoutcomes());

fetchCFRForm(ministryId, dispatch);
if (bcgovcode) dispatch(fetchFOIMinistryAssignedToList(bcgovcode));
}
Expand Down Expand Up @@ -332,11 +319,6 @@ const MinistryReview = React.memo(({ userDetail }) => {
hasincompleteDivstage ||
!hasReceivedDate;

const isOipcReviewValidationError = (oipcData?.length > 0 && requestDetails.isoipcreview && oipcData?.some((oipc) => {
return oipc.oipcno === "" || oipc.receiveddate === null || oipc.receiveddate === "" || oipc.reviewtypeid === null || oipc.reasonid === null || oipc.statusid === null ||
oipc.inquiryattributes?.orderno === "" || oipc.inquiryattributes?.inquiryoutcome === null || oipc.inquiryattributes?.inquirydate === null || oipc.inquiryattributes?.inquirydate === "";
}))

const createMinistrySaveRequestObject = (_propName, _value, _value2) => {
const requestObject = { ...saveMinistryRequestObject };
setUnSavedRequest(true);
Expand Down Expand Up @@ -601,19 +583,6 @@ const MinistryReview = React.memo(({ userDetail }) => {
(state) => state.foiRequests.showEventQueue
);

const oipcSectionRef = React.useRef(null);
const handleOipcReviewFlagChange = (isSelected) => {
setIsOIPCReview(isSelected);
requestDetails.isoipcreview = isSelected;
oipcSectionRef.current.scrollIntoView();
//timeout to allow react state to update after setState call
if (isSelected) {
setTimeout(() => {
oipcSectionRef.current.scrollIntoView();
}, (10));
}
}

return !isLoading &&
requestDetails &&
Object.keys(requestDetails).length !== 0 &&
Expand Down Expand Up @@ -784,7 +753,6 @@ const MinistryReview = React.memo(({ userDetail }) => {
setSaveMinistryRequestObject
}
ministryAssigneeValue={ministryAssignedToValue}
handleOipcReviewFlagChange={handleOipcReviewFlagChange}
/>
<ApplicantDetails requestDetails={requestDetails} />
<ChildDetails requestDetails={requestDetails} />
Expand All @@ -800,20 +768,11 @@ const MinistryReview = React.memo(({ userDetail }) => {
/>
{divisionsBox}
{/* <RequestNotes /> */}
<div ref={oipcSectionRef}></div>
{isOIPCReview && requestState && requestState.toLowerCase() !== StateEnum.intakeinprogress.name.toLowerCase() && requestState.toLowerCase() !== StateEnum.unopened.name.toLowerCase() && (
<OIPCDetails
oipcData={oipcData}
updateOIPC={updateOIPC}
addOIPC={addOIPC}
removeOIPC={removeOIPC}
/>
)}
<BottomButtonGroup
requestState={requestState}
stateChanged={stateChanged}
attachmentsArray={requestAttachments}
isValidationError={isValidationError || isOipcReviewValidationError}
isValidationError={isValidationError}
saveMinistryRequestObject={saveMinistryRequestObject}
unSavedRequest={unSavedRequest}
recordsUploading={recordsUploading}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ const RequestHeader = React.memo(({
userDetail,
handleMinistryAssignedToValue,
setSaveMinistryRequestObject,
ministryAssigneeValue,
handleOipcReviewFlagChange
ministryAssigneeValue
}) => {
const { requestId, ministryId } = useParams();
const _requestDetails = requestDetails;
Expand Down Expand Up @@ -109,7 +108,6 @@ const RequestHeader = React.memo(({
type="oipcreview"
requestDetails={requestDetails}
isActive={requestDetails.isoipcreview}
handleSelect={handleOipcReviewFlagChange}
/>
{/* <RequestFlag
type="phasedrelease"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useState } from "react";
import { useEffect, useState } from "react";
import "./requestflag.scss";
import OutlinedInput from "@material-ui/core/OutlinedInput";
import MenuItem from "@material-ui/core/MenuItem";
Expand All @@ -13,8 +13,6 @@ import DialogTitle from "@material-ui/core/DialogTitle";
import CloseIcon from "@material-ui/icons/Close";
import IconButton from "@material-ui/core/IconButton";
import TextField from "@mui/material/TextField";
import { useParams } from "react-router-dom";
import { useDispatch } from "react-redux";

//Types are:
//oipcreview
Expand All @@ -26,9 +24,9 @@ const RequestFlag = ({ isActive, type, handleSelect, showFlag = true }) => {
const [modalMessage, setModalMessage] = useState("");
const [modalDescription, setModalDescription] = useState("");

const { requestId, ministryId } = useParams();

const dispatch = useDispatch();
useEffect(() => {
setIsSelected(isActive);
}, [isActive])

// These need to be set for each type
let options;
Expand Down

0 comments on commit b8bfe37

Please sign in to comment.