Skip to content

Commit

Permalink
Add validation and master data to MinistryReview
Browse files Browse the repository at this point in the history
  • Loading branch information
milosdes committed Nov 29, 2023
1 parent 7c8bc27 commit 8b81cac
Showing 1 changed file with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ import {
import {
fetchFOIMinistryAssignedToList,
fetchFOIPersonalDivisionsAndSections,
fetchOIPCInquiryoutcomes,
fetchOIPCOutcomes,
fetchOIPCReviewtypes,
fetchOIPCStatuses,
} from "../../../../apiManager/services/FOI/foiMasterDataServices";

import { fetchFOIRequestAttachmentsList } from "../../../../apiManager/services/FOI/foiAttachmentServices";
Expand Down Expand Up @@ -214,6 +218,12 @@ 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 @@ -322,6 +332,11 @@ 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 @@ -798,7 +813,7 @@ const MinistryReview = React.memo(({ userDetail }) => {
requestState={requestState}
stateChanged={stateChanged}
attachmentsArray={requestAttachments}
isValidationError={isValidationError}
isValidationError={isValidationError || isOipcReviewValidationError}
saveMinistryRequestObject={saveMinistryRequestObject}
unSavedRequest={unSavedRequest}
recordsUploading={recordsUploading}
Expand Down

0 comments on commit 8b81cac

Please sign in to comment.